summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--ChangeLog.MELT4
-rw-r--r--MAINTAINERS2
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac6
-rw-r--r--contrib/ChangeLog4
-rw-r--r--contrib/config-list.mk2
-rw-r--r--gcc/ChangeLog336
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/c-family/ChangeLog13
-rw-r--r--gcc/c-family/c-common.h7
-rw-r--r--gcc/c-family/c-cppbuiltin.c160
-rw-r--r--gcc/c-family/c-opts.c8
-rw-r--r--gcc/c-family/c.opt4
-rw-r--r--gcc/c-parser.c11
-rw-r--r--gcc/common/config/rs6000/rs6000-common.c2
-rw-r--r--gcc/config.gcc7
-rw-r--r--gcc/config/arm/arm.c3
-rw-r--r--gcc/config/arm/arm.md16
-rw-r--r--gcc/config/arm/cortex-a15.md186
-rw-r--r--gcc/config/arm/fpa.md2
-rw-r--r--gcc/config/arm/neon.md4
-rw-r--r--gcc/config/arm/t-arm38
-rw-r--r--gcc/config/arm/vfp.md6
-rw-r--r--gcc/config/darwin.c27
-rw-r--r--gcc/config/darwin.h18
-rw-r--r--gcc/config/i386/i386.md2
-rw-r--r--gcc/config/i386/sync.md36
-rw-r--r--gcc/config/pa/pa.md12
-rw-r--r--gcc/config/rl78/constraints.md266
-rw-r--r--gcc/config/rl78/predicates.md60
-rw-r--r--gcc/config/rl78/rl78-c.c43
-rw-r--r--gcc/config/rl78/rl78-expand.md256
-rw-r--r--gcc/config/rl78/rl78-opts.h30
-rw-r--r--gcc/config/rl78/rl78-protos.h43
-rw-r--r--gcc/config/rl78/rl78-real.md339
-rw-r--r--gcc/config/rl78/rl78-virt.md259
-rw-r--r--gcc/config/rl78/rl78.c2705
-rw-r--r--gcc/config/rl78/rl78.h462
-rw-r--r--gcc/config/rl78/rl78.md320
-rw-r--r--gcc/config/rl78/rl78.opt43
-rw-r--r--gcc/config/rl78/t-rl7822
-rw-r--r--gcc/config/rs6000/rs6000-builtin.def2378
-rw-r--r--gcc/config/rs6000/rs6000-c.c298
-rw-r--r--gcc/config/rs6000/rs6000-protos.h4
-rw-r--r--gcc/config/rs6000/rs6000.c2284
-rw-r--r--gcc/config/rs6000/rs6000.h127
-rw-r--r--gcc/config/rs6000/rs6000.opt4
-rw-r--r--gcc/config/rs6000/vector.md2
-rw-r--r--gcc/config/sh/constraints.md3
-rw-r--r--gcc/config/sh/sh.c8
-rw-r--r--gcc/config/sh/sh.h6
-rw-r--r--gcc/config/sparc/constraints.md5
-rw-r--r--gcc/config/sparc/predicates.md13
-rw-r--r--gcc/config/sparc/sparc-opts.h10
-rw-r--r--gcc/config/sparc/sparc-protos.h4
-rw-r--r--gcc/config/sparc/sparc.c150
-rw-r--r--gcc/config/sparc/sparc.md1
-rw-r--r--gcc/config/sparc/sparc.opt22
-rw-r--r--gcc/config/sparc/sync.md258
-rw-r--r--gcc/cp/ChangeLog14
-rw-r--r--gcc/cp/decl.c19
-rw-r--r--gcc/cp/name-lookup.c1
-rw-r--r--gcc/cp/rtti.c6
-rw-r--r--gcc/defaults.h5
-rw-r--r--gcc/doc/contrib.texi2
-rw-r--r--gcc/doc/extend.texi22
-rw-r--r--gcc/doc/install.texi7
-rw-r--r--gcc/doc/invoke.texi101
-rw-r--r--gcc/doc/md.texi90
-rw-r--r--gcc/doc/tm.texi19
-rw-r--r--gcc/doc/tm.texi.in19
-rw-r--r--gcc/dse.c7
-rw-r--r--gcc/expr.c3
-rw-r--r--gcc/flags.h4
-rw-r--r--gcc/fortran/ChangeLog30
-rw-r--r--gcc/fortran/check.c8
-rw-r--r--gcc/fortran/module.c39
-rw-r--r--gcc/fortran/symbol.c10
-rw-r--r--gcc/fortran/trans-intrinsic.c143
-rw-r--r--gcc/function.c4
-rw-r--r--gcc/gccspec.c2
-rw-r--r--gcc/gimple.c30
-rw-r--r--gcc/gimple.h14
-rw-r--r--gcc/go/ChangeLog12
-rw-r--r--gcc/go/Make-lang.in13
-rw-r--r--gcc/go/go-gcc.cc174
-rw-r--r--gcc/go/go-linemap.cc126
-rw-r--r--gcc/go/go-location.h45
-rw-r--r--gcc/go/gofrontend/backend.h44
-rw-r--r--gcc/go/gofrontend/dataflow.cc4
-rw-r--r--gcc/go/gofrontend/export.cc2
-rw-r--r--gcc/go/gofrontend/expressions.cc622
-rw-r--r--gcc/go/gofrontend/expressions.h134
-rw-r--r--gcc/go/gofrontend/go-linemap.h131
-rw-r--r--gcc/go/gofrontend/go.cc8
-rw-r--r--gcc/go/gofrontend/gogo-tree.cc121
-rw-r--r--gcc/go/gofrontend/gogo.cc126
-rw-r--r--gcc/go/gofrontend/gogo.h198
-rw-r--r--gcc/go/gofrontend/import-archive.cc8
-rw-r--r--gcc/go/gofrontend/import.cc16
-rw-r--r--gcc/go/gofrontend/import.h21
-rw-r--r--gcc/go/gofrontend/lex.cc42
-rw-r--r--gcc/go/gofrontend/lex.h35
-rw-r--r--gcc/go/gofrontend/parse.cc182
-rw-r--r--gcc/go/gofrontend/parse.h38
-rw-r--r--gcc/go/gofrontend/runtime.cc11
-rw-r--r--gcc/go/gofrontend/runtime.h2
-rw-r--r--gcc/go/gofrontend/statements.cc164
-rw-r--r--gcc/go/gofrontend/statements.h112
-rw-r--r--gcc/go/gofrontend/types.cc170
-rw-r--r--gcc/go/gofrontend/types.h93
-rw-r--r--gcc/go/gofrontend/unsafe.cc7
-rw-r--r--gcc/haifa-sched.c39
-rw-r--r--gcc/optabs.c40
-rw-r--r--gcc/predict.c42
-rw-r--r--gcc/reg-stack.c4
-rw-r--r--gcc/sched-deps.c6
-rw-r--r--gcc/sched-ebb.c9
-rw-r--r--gcc/testsuite/ChangeLog84
-rw-r--r--gcc/testsuite/g++.dg/cdce3.C12
-rw-r--r--gcc/testsuite/g++.dg/init/aggr8.C19
-rw-r--r--gcc/testsuite/g++.dg/opt/pr50682.C39
-rw-r--r--gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-4.C22
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr51247.c16
-rw-r--r--gcc/testsuite/gcc.dg/atomic-op-optimize.c20
-rw-r--r--gcc/testsuite/gcc.dg/compat/compat-common.h2
-rw-r--r--gcc/testsuite/gcc.dg/pr50078.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr51321.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/pr50907.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr51301.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr48721.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/pr50725.c48
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr51089.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/iso_c_binding_compiler_4.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/move_alloc_5.f904
-rw-r--r--gcc/testsuite/gfortran.dg/move_alloc_6.f9080
-rw-r--r--gcc/testsuite/gfortran.dg/move_alloc_7.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/select_type_23.f036
-rw-r--r--gcc/toplev.c8
-rw-r--r--gcc/trans-mem.c4
-rw-r--r--gcc/tree-diagnostic.c16
-rw-r--r--gcc/tree-eh.c57
-rw-r--r--gcc/tree-flow.h1
-rw-r--r--gcc/tree-optimize.c1
-rw-r--r--gcc/tree-ssa-forwprop.c14
-rw-r--r--gcc/tree-ssa.c16
-rw-r--r--gcc/tree-vect-patterns.c8
-rw-r--r--gcc/tree-vrp.c50
-rw-r--r--libgcc/ChangeLog45
-rw-r--r--libgcc/config.host37
-rw-r--r--libgcc/config/pa/stublib.c46
-rw-r--r--libgcc/config/pa/t-stublib9
-rw-r--r--libgcc/config/rl78/cmpsi2.S122
-rw-r--r--libgcc/config/rl78/lib2div.c81
-rw-r--r--libgcc/config/rl78/lib2mul.c49
-rw-r--r--libgcc/config/rl78/lib2shift.c113
-rw-r--r--libgcc/config/rl78/lshrsi3.S131
-rw-r--r--libgcc/config/rl78/mulsi3.S235
-rw-r--r--libgcc/config/rl78/rl78-divmod.h118
-rw-r--r--libgcc/config/rl78/rl78-mul.h43
-rw-r--r--libgcc/config/rl78/t-rl7828
-rw-r--r--libgcc/config/rl78/trampoline.S139
-rw-r--r--libgcc/config/rs6000/t-ppccomm21
-rw-r--r--libgcc/config/rs6000/t-ppccomm-ldbl1
-rw-r--r--libgcc/config/rs6000/t-savresfgpr21
-rw-r--r--libgo/MERGE2
-rw-r--r--libgo/Makefile.am49
-rw-r--r--libgo/Makefile.in44
-rw-r--r--libgo/config.h.in3
-rwxr-xr-xlibgo/configure18
-rw-r--r--libgo/configure.ac8
-rw-r--r--libgo/go/big/int.go31
-rw-r--r--libgo/go/big/int_test.go11
-rw-r--r--libgo/go/big/nat.go13
-rw-r--r--libgo/go/big/nat_test.go20
-rw-r--r--libgo/go/big/rat.go201
-rw-r--r--libgo/go/big/rat_test.go124
-rw-r--r--libgo/go/crypto/x509/x509.go4
-rw-r--r--libgo/go/crypto/x509/x509_test.go13
-rw-r--r--libgo/go/exp/inotify/inotify_linux.go (renamed from libgo/go/os/inotify/inotify_linux.go)0
-rw-r--r--libgo/go/exp/inotify/inotify_linux_test.go (renamed from libgo/go/os/inotify/inotify_linux_test.go)2
-rw-r--r--libgo/go/exp/ssh/channel.go2
-rw-r--r--libgo/go/exp/ssh/client.go490
-rw-r--r--libgo/go/exp/ssh/doc.go48
-rw-r--r--libgo/go/exp/ssh/messages.go2
-rw-r--r--libgo/go/exp/ssh/server.go151
-rw-r--r--libgo/go/exp/ssh/session.go132
-rw-r--r--libgo/go/exp/ssh/transport.go17
-rw-r--r--libgo/go/exp/ssh/transport_test.go10
-rw-r--r--libgo/go/exp/types/gcimporter.go5
-rw-r--r--libgo/go/exp/winfsnotify/winfsnotify_test.go10
-rw-r--r--libgo/go/fmt/fmt_test.go5
-rw-r--r--libgo/go/fmt/print.go179
-rw-r--r--libgo/go/go/ast/print_test.go7
-rw-r--r--libgo/go/html/doc.go3
-rw-r--r--libgo/go/html/parse.go353
-rw-r--r--libgo/go/html/parse_test.go22
-rw-r--r--libgo/go/html/render.go12
-rw-r--r--libgo/go/html/token.go50
-rw-r--r--libgo/go/html/token_test.go1
-rw-r--r--libgo/go/http/client.go5
-rw-r--r--libgo/go/http/client_test.go24
-rw-r--r--libgo/go/http/doc.go79
-rw-r--r--libgo/go/http/request.go2
-rw-r--r--libgo/go/http/transport.go11
-rw-r--r--libgo/go/net/sock_windows.go3
-rw-r--r--libgo/go/unicode/tables.go5858
-rw-r--r--libgo/runtime/go-append.c2
-rw-r--r--libgo/runtime/go-close.c4
-rw-r--r--libgo/runtime/go-eface-compare.c4
-rw-r--r--libgo/runtime/go-eface-val-compare.c4
-rw-r--r--libgo/runtime/go-interface-eface-compare.c4
-rw-r--r--libgo/runtime/go-make-slice.c4
-rw-r--r--libgo/runtime/go-map-delete.c4
-rw-r--r--libgo/runtime/go-map-index.c4
-rw-r--r--libgo/runtime/go-new-channel.c4
-rw-r--r--libgo/runtime/go-new-map.c4
-rw-r--r--libgo/runtime/go-panic.c19
-rw-r--r--libgo/runtime/go-panic.h6
-rw-r--r--libgo/runtime/go-reflect-map.c4
-rw-r--r--libgo/runtime/go-reflect.c6
-rw-r--r--libgo/runtime/go-runtime-error.c16
-rw-r--r--libgo/runtime/go-send-nb-small.c2
-rw-r--r--libgo/runtime/go-send-small.c2
-rw-r--r--libgo/runtime/go-signal.c2
-rw-r--r--libgo/runtime/go-strslice.c2
-rw-r--r--libgo/runtime/go-type-eface.c4
-rw-r--r--libgo/runtime/go-type-error.c6
-rw-r--r--libgo/runtime/go-unreflect.c4
-rw-r--r--libgo/runtime/go-unsafe-new.c4
-rw-r--r--libgo/runtime/go-unsafe-newarray.c4
-rw-r--r--libgo/runtime/iface.goc12
-rw-r--r--libgo/runtime/lock_sema.c9
-rw-r--r--libgo/runtime/malloc.goc3
-rw-r--r--libgo/runtime/map.goc6
-rw-r--r--libgo/runtime/reflect.goc4
-rw-r--r--libgo/runtime/runtime.c15
-rw-r--r--libgo/runtime/runtime.h14
-rw-r--r--libgo/runtime/string.goc2
-rw-r--r--libgo/runtime/thread-linux.c4
-rw-r--r--libgo/runtime/thread-sema.c87
-rw-r--r--libgomp/ChangeLog37
-rw-r--r--libgomp/config/linux/arm/mutex.h28
-rw-r--r--libgomp/config/linux/bar.c30
-rw-r--r--libgomp/config/linux/bar.h15
-rw-r--r--libgomp/config/linux/ia64/mutex.h66
-rw-r--r--libgomp/config/linux/mips/mutex.h27
-rw-r--r--libgomp/config/linux/mutex.c19
-rw-r--r--libgomp/config/linux/mutex.h41
-rw-r--r--libgomp/config/linux/omp-lock.h4
-rw-r--r--libgomp/config/linux/powerpc/mutex.h2
-rw-r--r--libgomp/config/linux/sem.c60
-rw-r--r--libgomp/config/linux/sem.h58
-rw-r--r--libgomp/critical.c4
-rw-r--r--libgomp/libgomp.h11
-rw-r--r--libgomp/ordered.c7
-rw-r--r--libgomp/task.c1
-rw-r--r--libitm/ChangeLog8
-rw-r--r--libitm/beginend.cc12
-rw-r--r--libitm/config/alpha/sjlj.S44
-rw-r--r--libitm/config/x86/sjlj.S19
-rw-r--r--libitm/libitm_i.h2
-rw-r--r--libjava/classpath/ChangeLog.gcj6
-rwxr-xr-xlibjava/classpath/config.rpath4
-rwxr-xr-xlibjava/classpath/configure12
-rw-r--r--libstdc++-v3/ChangeLog55
-rw-r--r--libstdc++-v3/acinclude.m432
-rw-r--r--libstdc++-v3/config.h.in15
-rwxr-xr-xlibstdc++-v3/configure49
-rw-r--r--libstdc++-v3/doc/doxygen/user.cfg.in4
-rw-r--r--libstdc++-v3/doc/xml/manual/concurrency_extensions.xml12
-rw-r--r--libstdc++-v3/include/Makefile.am1
-rw-r--r--libstdc++-v3/include/Makefile.in1
-rw-r--r--libstdc++-v3/include/bits/atomic_base.h23
-rw-r--r--libstdc++-v3/include/bits/hashtable.h44
-rw-r--r--libstdc++-v3/include/ext/atomicity.h4
-rw-r--r--libstdc++-v3/include/std/future4
-rw-r--r--libstdc++-v3/libsupc++/Makefile.am20
-rw-r--r--libstdc++-v3/libsupc++/Makefile.in20
-rw-r--r--libstdc++-v3/libsupc++/atomic_lockfree_defines.h63
-rw-r--r--libstdc++-v3/libsupc++/eh_ptr.cc5
-rw-r--r--libstdc++-v3/libsupc++/eh_throw.cc4
-rw-r--r--libstdc++-v3/libsupc++/exception4
-rw-r--r--libstdc++-v3/libsupc++/exception_ptr.h2
-rw-r--r--libstdc++-v3/libsupc++/guard.cc2
-rw-r--r--libstdc++-v3/libsupc++/nested_exception.cc2
-rw-r--r--libstdc++-v3/libsupc++/nested_exception.h2
-rw-r--r--libstdc++-v3/src/future.cc2
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/erase/1.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/1.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/2.cc90
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/1.cc12
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/2.cc89
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/erase/1.cc36
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc48
-rw-r--r--libstdc++-v3/testsuite/lib/libstdc++.exp10
298 files changed, 18192 insertions, 8043 deletions
diff --git a/ChangeLog b/ChangeLog
index e70df0cb9e1..3796087c5f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-11-30 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+
+ * MAINTAINERS (write-after-approval): Add self.
+
+2011-11-29 DJ Delorie <dj@redhat.com>
+
+ * configure.ac (rl78-*-*) New case.
+ * configure: Regenerate.
+ * MAINTAINERS: Add myself as RL78 maintainer.
+
2011-11-21 Eric Botcazou <ebotcazou@libertysurf.fr>
* MAINTAINERS: Add self as co-maintainer of the Ada front end.
diff --git a/ChangeLog.MELT b/ChangeLog.MELT
index cd089b06f87..7e066f0f450 100644
--- a/ChangeLog.MELT
+++ b/ChangeLog.MELT
@@ -1,4 +1,8 @@
+2011-12-01 Basile Starynkevitch <basile@starynkevitch.net>
+
+ MELT branch merged with trunk rev 181872 using svnmerge
+
2011-11-30 Basile Starynkevitch <basile@starynkevitch.net>
{{MELT branch rev 181694 is the last which is able to go to melt-stage3}}
diff --git a/MAINTAINERS b/MAINTAINERS
index d6af32eb8d6..82f1c8d8d21 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -87,6 +87,7 @@ moxie port Anthony Green green@moxielogic.com
pdp11 port Paul Koning ni1d@arrl.net
picochip port Hariharan Sandanagobalane hariharan@picochip.com
picochip port Daniel Towner dant@picochip.com
+rl78 port DJ Delorie dj@redhat.com
rs6000 port Geoff Keating geoffk@geoffk.org
rs6000 port David Edelsohn dje.gcc@gmail.com
rs6000 vector extns Aldy Hernandez aldyh@redhat.com
@@ -371,6 +372,7 @@ Matthew Gingell gingell@gnat.com
Tristan Gingold gingold@adacore.com
Anthony Green green@redhat.com
Doug Gregor doug.gregor@gmail.com
+Matthew Gretton-Dann matthew.gretton-dann@arm.com
Jon Grimm jgrimm2@us.ibm.com
Laurent Guerby laurent@guerby.net
Xuepeng Guo terry.guo@arm.com
diff --git a/configure b/configure
index d1c3103cd07..1c94f40bf42 100755
--- a/configure
+++ b/configure
@@ -3092,6 +3092,10 @@ case "${target}" in
powerpc-*-aix* | rs6000-*-aix*)
noconfigdirs="$noconfigdirs target-libssp"
;;
+ rl78-*-*)
+ # Dereferencing -1 is a compile-time error
+ noconfigdirs="$noconfigdirs target-libssp"
+ ;;
esac
# Disable libstdc++-v3 for some systems.
diff --git a/configure.ac b/configure.ac
index 87a7bd9d87c..45ed1f07fe8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -518,6 +518,12 @@ case "${target}" in
powerpc-*-aix* | rs6000-*-aix*)
noconfigdirs="$noconfigdirs target-libssp"
;;
+ rl78-*-*)
+ # libssp uses a misaligned load to trigger a fault, but the RL78
+ # doesn't fault for those - instead, it gives a build-time error
+ # for explicit misaligned loads.
+ noconfigdirs="$noconfigdirs target-libssp"
+ ;;
esac
# Disable libstdc++-v3 for some systems.
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index abe317ad9db..26d59590852 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-29 DJ Delorie <dj@redhat.com>
+
+ * config-list.mk (LIST): Add rl78-elf.
+
2011-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* make_sunver.pl: Convert '?' in glob patterns to '.'.
diff --git a/contrib/config-list.mk b/contrib/config-list.mk
index 31e0237b62d..7d03cd3fae2 100644
--- a/contrib/config-list.mk
+++ b/contrib/config-list.mk
@@ -53,7 +53,7 @@ LIST = alpha-linux-gnu alpha-freebsd6 alpha-netbsd alpha-openbsd \
powerpc-wrs-vxworks powerpc-wrs-vxworksae powerpc-lynxos powerpcle-elf \
powerpcle-eabisim powerpcle-eabi rs6000-ibm-aix4.3 rs6000-ibm-aix5.1.0 \
rs6000-ibm-aix5.2.0 rs6000-ibm-aix5.3.0 rs6000-ibm-aix6.0 \
- rx-elf s390-linux-gnu s390x-linux-gnu s390x-ibm-tpf sh-elf \
+ rl78-elf rx-elf s390-linux-gnu s390x-linux-gnu s390x-ibm-tpf sh-elf \
shle-linux sh-netbsdelf sh-superh-elf sh5el-netbsd sh64-netbsd sh64-linux \
sh64-elfOPT-with-newlib sh-rtems sh-wrs-vxworks sparc-elf \
sparc-leon-elf sparc-rtems sparc-linux-gnu \
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d37a4411fb6..addee392384 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,330 @@
+2011-11-30 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR middle-end/50283
+ * config/pa/pa.md (in_branch_delay): Disallow frame related insns.
+ (in_nullified_branch_delay): Likewise.
+ (in_call_delay): Likewise.
+
+2011-11-30 Richard Henderson <rth@redhat.com>
+
+ * predict.c (expr_expected_value_1): Assume compare-and-swap builtin
+ boolean return is true.
+
+2011-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/51044
+ * dse.c (emit_inc_dec_insn_before): Ensure new_insn is an instruction
+ rather than just insn body.
+
+ PR target/50725
+ * function.c (thread_prologue_and_epilogue_insns): If
+ stack_realign_drap, add drap_reg to SET_UP_BY_PROLOGUE
+ regset.
+
+ PR middle-end/51089
+ * tree-eh.c (cleanup_empty_eh_merge_phis): Add check to
+ avoid creating duplicate edges here.
+ (cleanup_empty_eh_unsplit): And remove it in the caller.
+
+2011-11-30 Andrew Pinski <apinski@cavium.com>
+
+ PR c/51321
+ * c-parser.c (c_parser_postfix_expression): Check groktypename results
+ before looking at the main variant.
+
+2011-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/48721
+ * sched-deps.c (sched_analyze_insn): For SIBLING_CALL_P set
+ reg_pending_barrier to TRUE_BARRIER.
+
+ PR rtl-optimization/48721
+ * sched-ebb.c (begin_move_insn): Insert empty unreachable
+ block after BARRIER if insn is followed by it.
+
+2011-11-30 Richard Henderson <rth@redhat.com>
+
+ * config/sparc/sparc-opts.h (enum sparc_memory_model_type): New.
+ * config/sparc/sparc.opt (mmemory-model=): New option.
+ * doc/invoke.texi (Sparc Options): Document it.
+ * config/sparc/sparc.c (sparc_option_override): Provide default
+ for sparc_memory_model.
+ (sparc_emit_membar_for_model): Omit barrier combinations that are
+ implied by the memory model.
+
+2011-11-30 Richard Henderson <rth@redhat.com>
+
+ * config/sparc/sync.md (I124MODE): New mode iterator.
+ (memory_barrier): Remove.
+ (atomic_exchangesi): New.
+ (swapsi): Rename from *swapsi.
+ (atomic_test_and_set<I124MODE>): New.
+ (ldstubqi): Rename from *ldstubqi, merge with expander.
+ (ldstub<I24MODE>): Rename from *ldstub<I24MODE>, merge with expander.
+ (sync_lock_test_and_setsi): Remove.
+ (sync_lock_test_and_set<I12MODE>): Remove.
+
+2011-11-30 Richard Henderson <rth@redhat.com>
+
+ * config/sparc/constraints.md ("w"): New.
+ * config/sparc/predicates.md (mem_noofs_operand): New.
+ * config/sparc/sparc.c (sparc_expand_compare_and_swap_12): Make static.
+ Generate the boolean result of the atomic_compare_exchange.
+ (sparc_expand_compare_and_swap): New.
+ * config/sparc/sync.md (atomic_compare_and_swap<I>): New.
+ (atomic_compare_and_swap<I48MODE>_1): Rename from
+ *sync_compare_and_swap<I48MODE>, use mem_noofs_operand.
+ (*atomic_compare_and_swapdi_v8plus): Rename from
+ *sync_compare_and_swapdi_v8plus, use mem_noofs_operand.
+ (sync_compare_and_swap<I12MODE>): Remove.
+ (sync_compare_and_swap<I48MODE>): Remove.
+
+2011-11-30 Richard Henderson <rth@redhat.com>
+
+ * config/sparc/predicates.md (register_or_v9_zero_operand): New.
+ * config/sparc/sparc.md (UNSPEC_ATOMIC): New.
+ * config/sparc/sync.md (atomic_load<I>): New.
+ (atomic_loaddi_1, atomic_store<I>, atomic_storedi_1): New.
+
+2011-11-30 Richard Henderson <rth@redhat.com>
+
+ * config/sparc/predicates.md (zero_or_v7_operand): New.
+ * config/sparc/sparc.c (sparc_emit_membar_for_model): New.
+ * config/sparc/sparc-protos.h: Update.
+ * config/sparc/sync.md (mem_thread_fence): New.
+ (memory_barrier): Use sparc_emit_membar_for_model.
+ (membar, *membar_empty, *membar_storestore, *membar_storeload): New.
+ (*membar_v8): Accept and ignore the membar mask.
+ (*membar): Accept and print the membar mask.
+
+2011-11-30 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+
+ * config/arm/arm.c (arm_issue_rate): Cortex-A15 can triple issue.
+ * config/arm/arm.md (mul64): New attribute.
+ (generic_sched): Cortex-A15 is not scheduled generically.
+ (cortex-a15.md): Include.
+ * config/arm/cortex-a15.md: New machine description.
+ * config/arm/t-arm (MD_INCLUDES): Add cortex-a15.md.
+
+2011-11-30 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+
+ * config/arm/t-arm (MD_INCLUDES): Ensure all md files are listed.
+
+2011-11-30 Iain Sandoe <iains@gcc.gnu.org>
+
+ * doc/tm.texi.in (NEXT_OBJC_RUNTIME): Update macro description.
+ * doc/tm.texi: Regenerate.
+ * flags.h (flag_next_runtime): Remove references.
+ * toplev.c: Likewise.
+ * defaults.h (NEXT_OBJC_RUNTIME): Provide default.
+ * gccspec.c (lang_specific_driver): Adjust use of NEXT_OBJC_RUNTIME.
+ * config/darwin.c (darwin_override_options): Provide default
+ Objective-C abi settings and target conflict checks.
+ * config/darwin.h (SUBTARGET_C_COMMON_OVERRIDE_OPTIONS): Remove unused
+ code. Adjust indenting.
+
+2011-11-29 Joseph Myers <joseph@codesourcery.com>
+
+ * config/sh/sh.h (enum reg_class, REG_CLASS_NAMES)
+ (REG_CLASS_CONTENTS): Add NON_SP_REGS.
+ (REGCLASS_HAS_GENERAL_REG): Handle NON_SP_REGS.
+ * config/sh/constraints.md (u): New constraint.
+
+2011-11-29 Oleg Endo <oleg.endo@t-online.de>
+
+ PR target/51337
+ * config/sh/sh.c (sh_secondary_reload): Add case when FPUL
+ register is being loaded from a pseudo in memory.
+
+2011-11-29 DJ Delorie <dj@redhat.com>
+
+ * config.gcc (rl78-*-elf): New case.
+ * doc/extend.texi: Add RL78 documentation.
+ * doc/invoke.texi: Likewise.
+ * doc/md.texi: Likewise.
+ * doc/contrib.texi: Add RL78.
+ * doc/install.texi: Add rl78-*-elf.
+ * config/rl78: New directory for the Renesas RL78.
+
+2011-11-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/51247
+ * tree-vrp.c (extract_range_from_assert): For signed 1-bit precision
+ types instead of adding 1 subtract -1 and instead of subtracting 1
+ add -1 to avoid overflows.
+
+2011-11-29 Andrew MacLeod <amacleod@redhat.com>
+
+ PR target/50123
+ * optabs.c (maybe_optimize_fetch_op): New. Look for more optimal
+ instructions for a FECTH_OP or OP_FECTH sequence.
+ (expand_atomic_fetch_op): Call maybe_optimize_fetch_op.
+
+2011-11-29 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/sync.md (UNSPEC_LDA, UNSPEC_STA): New unspecs.
+ (movdi_via_fpu): Remove.
+ (loaddi_via_fpu): New insn pattern.
+ (storedi_via_fpu): Ditto.
+ (atomic_loaddi_fpu): Use loaddi_via_fpu and storedi_via_fpu.
+ (atomic_storedi_fpu): Ditto.
+ * reg-stack.c (get_true_reg): Handle UNSPEC_LDA.
+ (subst_stack_regs_pat): Handle UNSPEC_STA.
+
+2011-11-29 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (*floathi<mode>2_i387_with_temp): Do not
+ allocate scratch memory for alternative 0.
+
+2011-11-29 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ * config/rs6000/rs6000-builtins.def: Completely rewrite builtin
+ handling to centralize more of the builtins in this file. Change
+ some builtin enumerations to be more consistant. Use a new mask
+ to hold the current builtins, including SPE and PAIRED builtins
+ which no longer are set via target_flags masks. Add
+ -mdebug=builtin debug support. For power machines, define all
+ Altivec and VSX buitins when the compiler starts, but don't allow
+ the use of a builtin unless the appropriate switch is used, or
+ #pragma GCC target is used to change the options. If the user
+ uses #pragma GCC target, update the appropriate hardware macros.
+ * common/config/rs6000/rs6000-common.c (rs6000_handle_option): Ditto.
+ * config/rs6000/rs6000.opt (rs6000_builtin_mask): Ditto.
+ * config/rs6000/rs6000-c.c (rs6000_macro_to_expand): Ditto.
+ (rs6000_define_or_undefine_macro): Ditto.
+ (rs6000_target_modify_macros): Ditto.
+ (rs6000_cpu_cpp_builtins): Ditto.
+ (altivec_overloaded_builtins): Ditto.
+ (altivec_build_resolved_builtin): Ditto.
+ * config/rs6000/rs6000.c (rs6000_target_modify_macros_ptr): Ditto.
+ (rs6000_builtin_info): Ditto.
+ (def_builtin): Ditto.
+ (enable_mask_for_builtins): Ditto.
+ (DEBUG_FMT_X): Ditto.
+ (rs6000_debug_reg_global): Ditto.
+ (rs6000_builtin_mask_calculate): Ditto.
+ (rs6000_option_override_internal): Ditto.
+ (rs6000_builtin_conversion): Ditto.
+ (rs6000_builtin_vectorized_function): Ditto.
+ (bdesc_3arg): Ditto.
+ (bdesc_dst): Ditto.
+ (bdesc_2arg): Ditto.
+ (builtin_description_predicates): Ditto.
+ (bdesc_altivec_preds): Ditto.
+ (bdesc_spe_predicates): Ditto.
+ (bdesc_spe_evsel): Ditto.
+ (bdesc_paired_preds): Ditto.
+ (bdesc_abs): Ditto.
+ (bdesc_1arg): Ditto.
+ (rs6000_overloaded_builtin_p): Ditto.
+ (rs6000_expand_unop_builtin): Ditto.
+ (bdesc_2arg_spe): Ditto.
+ (spe_expand_builtin): Ditto.
+ (rs6000_invalid_builtin): Ditto.
+ (rs6000_expand_builtin): Ditto.
+ (rs6000_init_builtins): Ditto.
+ (spe_init_builtins): Ditto.
+ (paired_init_builtins): Ditto.
+ (altivec_init_builtins): Ditto.
+ (builtin_function_type): Ditto.
+ (rs6000_common_init_builtins): Ditto.
+ (rs6000_builtin_reciprocal): Ditto.
+ (rs6000_builtin_mask_names): Ditto.
+ (rs6000_pragma_target_parse): Ditto.
+ (rs6000_function_specific_print): Ditto.
+ * config/rs6000/rs6000.h (MASK_DEBUG_BUILTIN): Ditto.
+ (MASK_DEBUG_ALL): Ditto.
+ (TARGET_DEBUG_BUILTIN): Ditto.
+ (TARGET_EXTRA_BUILTINS): Ditto.
+ (REGISTER_TARGET_PRAGMAS): Ditto.
+ (enum rs6000_btc): Ditto.
+ (RS6000_BTC_*): Ditto.
+ (RS6000_BTM_*): Ditto.
+ (enum rs6000_builtins): Ditto.
+ * config/rs6000/rs6000-protos.h (rs6000_overloaded_builtin_p): Ditto.
+ (rs6000_target_modify_macros): Ditto.
+ (rs6000_target_modify_macros_ptr): Ditto.
+
+ * config/rs6000/vector.md (unsfloat<VEC_int><mode>2): Use the
+ standard name for converting vector unsigned values to floating
+ point. Delete the TARGET_VECTORIZE_BUILTIN_CONVERSION hook, which
+ is handled by machine independent code.
+ * config/rs6000/rs6000.c (TARGET_VECTORIZE_BUILTIN_CONVERSION): Ditto.
+ (rs6000_builtin_conversion): Ditto.
+
+2011-11-29 Dodji Seketeli <dodji@redhat.com>
+
+ * tree-diagnostic (struct loc_t): Rename into struct loc_map_pair.
+ (maybe_unwind_expanded_macro_loc): Adjust.
+
+2011-11-29 David Edelsohn <dje.gcc@gmail.com>
+ Aldy Hernandez <aldyh@redhat.com>
+
+ * trans-mem.c (ipa_tm_create_version_alias): Mangle new_decl
+ if DECL_ONE_ONLY.
+ (ipa_tm_create_version): Same.
+
+2011-11-29 Bernd Schmidt <bernds@codesourcery.com>
+
+ * haifa-sched.c (recompute_todo_spec): Simplify and correct the
+ code checking for a clobber of a condition register when deciding
+ whether to predicate.
+
+2011-11-29 Diego Novillo <dnovillo@google.com>
+
+ * gimple.c (gimple_call_set_cannot_inline): Move from gimple.h.
+ Update field call_stmt_cannot_inline_p from call graph edge, if needed.
+ * gimple.h (gimple_call_set_cannot_inline): Move to gimple.c.
+
+2011-11-29 Sameera Deshpande <sameera.deshpande@arm.com>
+
+ * config/arm/arm.md (arm_movdi): Update NEG_POOL_RANGE.
+ (movdf_soft_insn): Likewise.
+ * config/arm/fpa.md (thumb2_movdf_fpa): Likewise.
+ * config/arm/neon.md (neon_mov<mode>): Likewise.
+ * config/arm/vfp.md (movdi_vfp): Likewise.
+ (movdi_vfp_cortexa8): Likewise.
+ (movdf_vfp): Likewise.
+
+2011-11-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/50074
+ * expr.c (expand_expr_addr_expr_1): Don't call force_operand for
+ EXPAND_SUM modifier.
+
+2011-11-29 Ira Rosen <ira.rosen@linaro.org>
+
+ PR tree-optimization/51301
+ * tree-vect-patterns.c (vect_recog_over_widening_pattern): Check that
+ the last statement doesn't convert to a bigger type than the original
+ type of the computation.
+
+2011-11-28 Richard Henderson <rth@redhat.com>
+
+ * config/rs6000/rs6000.c (rs6000_expand_atomic_compare_and_swap):
+ Handle overlap between retval and oldval. Always compute boolval
+ from CR0 EQ value.
+
+2011-11-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/50317
+ * tree-ssa.c (execute_update_addresses_taken): Remove
+ var ={v} {CLOBBER} stmts instead of rewriting them into
+ var_N ={v} {CLOBBER}.
+
+ PR middle-end/50907
+ * function.c (convert_jumps_to_returns): When redirecting an edge
+ succ to EXIT_BLOCK_PTR, clear EDGE_CROSSING flag.
+
+ PR tree-optimization/50078
+ * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Copy over
+ TREE_THIS_VOLATILE also from the old to new lhs resp. rhs.
+
+ PR tree-optimization/50682
+ * tree-eh.c (maybe_remove_unreachable_handlers): New function.
+ * tree-flow.h (maybe_remove_unreachable_handlers): New prototype.
+ * tree-optimize.c (execute_cleanup_cfg_post_optimizing): Call it.
+
2011-11-28 Georg-Johann Lay <avr@gjlay.de>
* doc/extend.texi (AVR Built-in Functions): Add documentation for
@@ -90,8 +417,7 @@
(init_reg_sets_1): Limit operand_reg_set to accessible_reg_set.
Remove NO_REGS registers from operand_reg_set. Treat members
of operand_reg_set as fixed.
- * recog.c (general_operand): Check operand_reg_set rather than
- NO_REGS.
+ * recog.c (general_operand): Check operand_reg_set rather than NO_REGS.
(register_operand, nonmemory_operand): Likewise.
* varasm.c (make_decl_rtl): Always use DECL_MODE as the mode of
register variables. Check accessible_reg_set and operand_reg_set.
@@ -705,6 +1031,12 @@
2011-11-17 Richard Henderson <rth@redhat.com>
+ * config/rs6000/rs6000.c (rs6000_expand_atomic_compare_and_swap): Get
+ new pseudo for target after convert_modes.
+ (rs6000_expand_atomic_exchange, rs6000_expand_atomic_op): Likewise.
+
+2011-11-17 Richard Henderson <rth@redhat.com>
+
* builtins.c (expand_builtin_mem_thread_fence): Remove.
(expand_builtin_mem_signal_fence): Remove.
(expand_builtin_atomic_thread_fence): Use expand_mem_thread_fence.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 24a16bebbcf..1678f2f93ab 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20111128
+20111201
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 44631060789..075da2f43b3 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,16 @@
+2011-11-30 Iain Sandoe <iains@gcc.gnu.org>
+
+ * c.opt (fgnu-runtime): Provide full description.
+ (fnext-runtime): Likewise.
+ * c-opts.c (OPT_fgnu_runtime, OPT_fnext_runtime) Remove.
+
+2011-11-28 Andrew MacLeod <amacleod@redhat.com>
+
+ * c-cpp-builtin.c (cpp_atomic_builtins):New. Emit all atomic
+ predefines in one place. Add LOCK_FREE predefines.
+ (c_cpp_builtins): Move Legacy HAVE_SYNC predefines to
+ new func.
+
2011-11-24 Andrew MacLeod <amacleod@redhat.com>
PR c/51256
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 4d65dd1b7f1..8ef95aa0b17 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -487,18 +487,13 @@ struct GTY(()) stmt_tree_s {
VEC(tree,gc) *x_cur_stmt_list;
/* In C++, Nonzero if we should treat statements as full
- expressions. In particular, this variable is no-zero if at the
+ expressions. In particular, this variable is non-zero if at the
end of a statement we should destroy any temporaries created
during that statement. Similarly, if, at the end of a block, we
should destroy any local variables in this block. Normally, this
variable is nonzero, since those are the normal semantics of
C++.
- However, in order to represent aggregate initialization code as
- tree structure, we use statement-expressions. The statements
- within the statement expression should not result in cleanups
- being run until the entire enclosing statement is complete.
-
This flag has no effect in C. */
int stmts_are_full_exprs_p;
};
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index bf83c261c20..8d0d4af9c92 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -568,6 +568,117 @@ c_cpp_builtins_optimize_pragma (cpp_reader *pfile, tree prev_tree,
}
+/* This function will emit cpp macros to indicate the presence of various lock
+ free atomic operations. */
+
+static void
+cpp_atomic_builtins (cpp_reader *pfile)
+{
+ /* Set a flag for each size of object that compare and swap exists for up to
+ a 16 byte object. */
+#define SWAP_LIMIT 17
+ bool have_swap[SWAP_LIMIT];
+ unsigned int psize;
+
+ /* Clear the map of sizes compare_and swap exists for. */
+ memset (have_swap, 0, sizeof (have_swap));
+
+ /* Tell source code if the compiler makes sync_compare_and_swap
+ builtins available. */
+#ifndef HAVE_sync_compare_and_swapqi
+#define HAVE_sync_compare_and_swapqi 0
+#endif
+#ifndef HAVE_atomic_compare_and_swapqi
+#define HAVE_atomic_compare_and_swapqi 0
+#endif
+
+ if (HAVE_sync_compare_and_swapqi || HAVE_atomic_compare_and_swapqi)
+ {
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
+ have_swap[1] = true;
+ }
+
+#ifndef HAVE_sync_compare_and_swaphi
+#define HAVE_sync_compare_and_swaphi 0
+#endif
+#ifndef HAVE_atomic_compare_and_swaphi
+#define HAVE_atomic_compare_and_swaphi 0
+#endif
+ if (HAVE_sync_compare_and_swaphi || HAVE_atomic_compare_and_swaphi)
+ {
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+ have_swap[2] = true;
+ }
+
+#ifndef HAVE_sync_compare_and_swapsi
+#define HAVE_sync_compare_and_swapsi 0
+#endif
+#ifndef HAVE_atomic_compare_and_swapsi
+#define HAVE_atomic_compare_and_swapsi 0
+#endif
+ if (HAVE_sync_compare_and_swapsi || HAVE_atomic_compare_and_swapsi)
+ {
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
+ have_swap[4] = true;
+ }
+
+#ifndef HAVE_sync_compare_and_swapdi
+#define HAVE_sync_compare_and_swapdi 0
+#endif
+#ifndef HAVE_atomic_compare_and_swapdi
+#define HAVE_atomic_compare_and_swapdi 0
+#endif
+ if (HAVE_sync_compare_and_swapdi || HAVE_atomic_compare_and_swapdi)
+ {
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+ have_swap[8] = true;
+ }
+
+#ifndef HAVE_sync_compare_and_swapti
+#define HAVE_sync_compare_and_swapti 0
+#endif
+#ifndef HAVE_atomic_compare_and_swapti
+#define HAVE_atomic_compare_and_swapti 0
+#endif
+ if (HAVE_sync_compare_and_swapti || HAVE_atomic_compare_and_swapti)
+ {
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16");
+ have_swap[16] = true;
+ }
+
+ /* Tell the source code about various types. These map to the C++11 and C1x
+ macros where 2 indicates lock-free always, and 1 indicates sometimes
+ lock free. */
+#define SIZEOF_NODE(T) (tree_low_cst (TYPE_SIZE_UNIT (T), 1))
+#define SWAP_INDEX(T) ((SIZEOF_NODE (T) < SWAP_LIMIT) ? SIZEOF_NODE (T) : 0)
+ builtin_define_with_int_value ("__GCC_ATOMIC_BOOL_LOCK_FREE",
+ (have_swap[SWAP_INDEX (boolean_type_node)]? 2 : 1));
+ builtin_define_with_int_value ("__GCC_ATOMIC_CHAR_LOCK_FREE",
+ (have_swap[SWAP_INDEX (signed_char_type_node)]? 2 : 1));
+ builtin_define_with_int_value ("__GCC_ATOMIC_CHAR16_T_LOCK_FREE",
+ (have_swap[SWAP_INDEX (char16_type_node)]? 2 : 1));
+ builtin_define_with_int_value ("__GCC_ATOMIC_CHAR32_T_LOCK_FREE",
+ (have_swap[SWAP_INDEX (char32_type_node)]? 2 : 1));
+ builtin_define_with_int_value ("__GCC_ATOMIC_WCHAR_T_LOCK_FREE",
+ (have_swap[SWAP_INDEX (wchar_type_node)]? 2 : 1));
+ builtin_define_with_int_value ("__GCC_ATOMIC_SHORT_LOCK_FREE",
+ (have_swap[SWAP_INDEX (short_integer_type_node)]? 2 : 1));
+ builtin_define_with_int_value ("__GCC_ATOMIC_INT_LOCK_FREE",
+ (have_swap[SWAP_INDEX (integer_type_node)]? 2 : 1));
+ builtin_define_with_int_value ("__GCC_ATOMIC_LONG_LOCK_FREE",
+ (have_swap[SWAP_INDEX (long_integer_type_node)]? 2 : 1));
+ builtin_define_with_int_value ("__GCC_ATOMIC_LLONG_LOCK_FREE",
+ (have_swap[SWAP_INDEX (long_long_integer_type_node)]? 2 : 1));
+
+ /* ptr_type_node can't be used here since ptr_mode is only set when
+ toplev calls backend_init which is not done with -E or pch. */
+ psize = POINTER_SIZE / BITS_PER_UNIT;
+ if (psize >= SWAP_LIMIT)
+ psize = 0;
+ builtin_define_with_int_value ("__GCC_ATOMIC_POINTER_LOCK_FREE",
+ (have_swap[psize]? 2 : 1));
+}
+
/* Hook that registers front end and target-specific built-ins. */
void
c_cpp_builtins (cpp_reader *pfile)
@@ -756,53 +867,8 @@ c_cpp_builtins (cpp_reader *pfile)
if (c_dialect_cxx () && TYPE_UNSIGNED (wchar_type_node))
cpp_define (pfile, "__WCHAR_UNSIGNED__");
- /* Tell source code if the compiler makes sync_compare_and_swap
- builtins available. */
-#ifndef HAVE_sync_compare_and_swapqi
-#define HAVE_sync_compare_and_swapqi 0
-#endif
-#ifndef HAVE_atomic_compare_and_swapqi
-#define HAVE_atomic_compare_and_swapqi 0
-#endif
- if (HAVE_sync_compare_and_swapqi || HAVE_atomic_compare_and_swapqi)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
-
-#ifndef HAVE_sync_compare_and_swaphi
-#define HAVE_sync_compare_and_swaphi 0
-#endif
-#ifndef HAVE_atomic_compare_and_swaphi
-#define HAVE_atomic_compare_and_swaphi 0
-#endif
- if (HAVE_sync_compare_and_swaphi || HAVE_atomic_compare_and_swaphi)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
-
-#ifndef HAVE_sync_compare_and_swapsi
-#define HAVE_sync_compare_and_swapsi 0
-#endif
-#ifndef HAVE_atomic_compare_and_swapsi
-#define HAVE_atomic_compare_and_swapsi 0
-#endif
- if (HAVE_sync_compare_and_swapsi || HAVE_atomic_compare_and_swapsi)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
-
-#ifndef HAVE_sync_compare_and_swapdi
-#define HAVE_sync_compare_and_swapdi 0
-#endif
-#ifndef HAVE_atomic_compare_and_swapdi
-#define HAVE_atomic_compare_and_swapdi 0
-#endif
- if (HAVE_sync_compare_and_swapdi || HAVE_atomic_compare_and_swapdi)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
-
-#ifndef HAVE_sync_compare_and_swapti
-#define HAVE_sync_compare_and_swapti 0
-#endif
-#ifndef HAVE_atomic_compare_and_swapti
-#define HAVE_atomic_compare_and_swapti 0
-#endif
- if (HAVE_sync_compare_and_swapti || HAVE_atomic_compare_and_swapti)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16");
-
+ cpp_atomic_builtins (pfile);
+
#ifdef DWARF2_UNWIND_INFO
if (dwarf2out_do_cfi_asm ())
cpp_define (pfile, "__GCC_HAVE_DWARF2_CFI_ASM");
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 465bce35de3..a08b0e80a56 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -604,14 +604,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
cpp_opts->extended_identifiers = value;
break;
- case OPT_fgnu_runtime:
- flag_next_runtime = !value;
- break;
-
- case OPT_fnext_runtime:
- flag_next_runtime = value;
- break;
-
case OPT_foperator_names:
cpp_opts->operator_names = value;
break;
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 0d7dc88b1ca..7694794e0c6 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -810,7 +810,7 @@ C++ ObjC++ Var(flag_no_gnu_keywords, 0)
Recognize GNU-defined keywords
fgnu-runtime
-ObjC ObjC++
+ObjC ObjC++ Report RejectNegative Var(flag_next_runtime,0) Init(NEXT_OBJC_RUNTIME)
Generate code for GNU runtime environment
fgnu89-inline
@@ -872,7 +872,7 @@ fnew-abi
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
fnext-runtime
-ObjC ObjC++
+ObjC ObjC++ Report RejectNegative Var(flag_next_runtime)
Generate code for NeXT (Apple Mac OS X) runtime environment
fnil-receivers
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index b88b11fc430..e227137bfb0 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -6568,9 +6568,16 @@ c_parser_postfix_expression (c_parser *parser)
"expected %<)%>");
{
tree e1, e2;
+ e1 = groktypename (t1, NULL, NULL);
+ e2 = groktypename (t2, NULL, NULL);
+ if (e1 == error_mark_node || e2 == error_mark_node)
+ {
+ expr.value = error_mark_node;
+ break;
+ }
- e1 = TYPE_MAIN_VARIANT (groktypename (t1, NULL, NULL));
- e2 = TYPE_MAIN_VARIANT (groktypename (t2, NULL, NULL));
+ e1 = TYPE_MAIN_VARIANT (e1);
+ e2 = TYPE_MAIN_VARIANT (e2);
expr.value
= comptypes (e1, e2) ? integer_one_node : integer_zero_node;
diff --git a/gcc/common/config/rs6000/rs6000-common.c b/gcc/common/config/rs6000/rs6000-common.c
index 683240f27ba..f40b69e3676 100644
--- a/gcc/common/config/rs6000/rs6000-common.c
+++ b/gcc/common/config/rs6000/rs6000-common.c
@@ -202,6 +202,8 @@ rs6000_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
mask = MASK_DEBUG_COST;
else if (! strcmp (q, "target"))
mask = MASK_DEBUG_TARGET;
+ else if (! strcmp (q, "builtin"))
+ mask = MASK_DEBUG_BUILTIN;
else
error_at (loc, "unknown -mdebug-%s switch", q);
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 45ba919dadf..a4772892b45 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2115,6 +2115,13 @@ rs6000-ibm-aix[6789].* | powerpc-ibm-aix[6789].*)
use_gcc_stdint=wrap
extra_headers=altivec.h
;;
+rl78-*-elf*)
+ tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+ target_has_targetm_common=no
+ c_target_objs="rl78-c.o"
+ cxx_target_objs="rl78-c.o"
+ tmake_file="${tmake_file} rl78/t-rl78"
+ ;;
rx-*-elf*)
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
tmake_file="${tmake_file} rx/t-rx"
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index ee26c51b0a0..a57494c4c3e 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -24127,6 +24127,9 @@ arm_issue_rate (void)
{
switch (arm_tune)
{
+ case cortexa15:
+ return 3;
+
case cortexr4:
case cortexr4f:
case cortexr5:
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index a78ba88f8ce..8ec9b2288bb 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -268,7 +268,7 @@
; can be placed. If the distance is zero, then this insn will never
; reference the pool.
; NEG_POOL_RANGE is nonzero for insns that can reference a constant pool entry
-; before its address.
+; before its address. It is set to <max_range> - (8 + <data_size>).
(define_attr "arm_pool_range" "" (const_int 0))
(define_attr "thumb2_pool_range" "" (const_int 0))
(define_attr "arm_neg_pool_range" "" (const_int 0))
@@ -355,6 +355,13 @@
(const_string "mult")
(const_string "alu")))
+; Is this an (integer side) multiply with a 64-bit result?
+(define_attr "mul64" "no,yes"
+ (if_then_else
+ (eq_attr "insn" "smlalxy,umull,umulls,umlal,umlals,smull,smulls,smlal,smlals")
+ (const_string "yes")
+ (const_string "no")))
+
; Load scheduling, set from the arm_ld_sched variable
; initialized by arm_option_override()
(define_attr "ldsched" "no,yes" (const (symbol_ref "arm_ld_sched")))
@@ -518,7 +525,7 @@
(define_attr "generic_sched" "yes,no"
(const (if_then_else
- (ior (eq_attr "tune" "fa526,fa626,fa606te,fa626te,fmp626,fa726te,arm926ejs,arm1020e,arm1026ejs,arm1136js,arm1136jfs,cortexa5,cortexa8,cortexa9,cortexm4")
+ (ior (eq_attr "tune" "fa526,fa626,fa606te,fa626te,fmp626,fa726te,arm926ejs,arm1020e,arm1026ejs,arm1136js,arm1136jfs,cortexa5,cortexa8,cortexa9,cortexa15,cortexm4")
(eq_attr "tune_cortexr4" "yes"))
(const_string "no")
(const_string "yes"))))
@@ -544,6 +551,7 @@
(include "cortex-a5.md")
(include "cortex-a8.md")
(include "cortex-a9.md")
+(include "cortex-a15.md")
(include "cortex-r4.md")
(include "cortex-r4f.md")
(include "cortex-m4.md")
@@ -5223,7 +5231,7 @@
[(set_attr "length" "8,12,16,8,8")
(set_attr "type" "*,*,*,load2,store2")
(set_attr "arm_pool_range" "*,*,*,1020,*")
- (set_attr "arm_neg_pool_range" "*,*,*,1008,*")
+ (set_attr "arm_neg_pool_range" "*,*,*,1004,*")
(set_attr "thumb2_pool_range" "*,*,*,4096,*")
(set_attr "thumb2_neg_pool_range" "*,*,*,0,*")]
)
@@ -6583,7 +6591,7 @@
[(set_attr "length" "8,12,16,8,8")
(set_attr "type" "*,*,*,load2,store2")
(set_attr "pool_range" "*,*,*,1020,*")
- (set_attr "arm_neg_pool_range" "*,*,*,1008,*")
+ (set_attr "arm_neg_pool_range" "*,*,*,1004,*")
(set_attr "thumb2_neg_pool_range" "*,*,*,0,*")]
)
diff --git a/gcc/config/arm/cortex-a15.md b/gcc/config/arm/cortex-a15.md
new file mode 100644
index 00000000000..ccab7cbe906
--- /dev/null
+++ b/gcc/config/arm/cortex-a15.md
@@ -0,0 +1,186 @@
+;; ARM Cortex-A15 pipeline description
+;; Copyright (C) 2011 Free Software Foundation, Inc.
+;;
+;; Written by Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; GCC is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3. If not see
+;; <http://www.gnu.org/licenses/>.
+
+(define_automaton "cortex_a15")
+
+;; The Cortex-A15 core is modelled as a triple issue pipeline that has
+;; the following dispatch units.
+;; 1. Two pipelines for simple integer operations: SX1, SX2
+;; 2. Two pipelines for Neon and FP data-processing operations: CX1, CX2
+;; 3. One pipeline for branch operations: BX
+;; 4. One pipeline for integer multiply and divide operations: MX
+;; 5. Two pipelines for load and store operations: LS1, LS2
+;;
+;; We can issue into three pipelines per-cycle.
+;;
+;; We assume that where we have unit pairs xx1 is always filled before xx2.
+
+;; The three issue units
+(define_cpu_unit "ca15_i0, ca15_i1, ca15_i2" "cortex_a15")
+
+(define_reservation "ca15_issue1" "(ca15_i0|ca15_i1|ca15_i2)")
+(define_reservation "ca15_issue2" "((ca15_i0+ca15_i1)|(ca15_i1+ca15_i2))")
+(define_reservation "ca15_issue3" "(ca15_i0+ca15_i1+ca15_i2)")
+(final_presence_set "ca15_i1" "ca15_i0")
+(final_presence_set "ca15_i2" "ca15_i1")
+
+;; The main dispatch units
+(define_cpu_unit "ca15_sx1, ca15_sx2" "cortex_a15")
+(define_cpu_unit "ca15_cx1, ca15_cx2" "cortex_a15")
+(define_cpu_unit "ca15_ls1, ca15_ls2" "cortex_a15")
+(define_cpu_unit "ca15_bx, ca15_mx" "cortex_a15")
+
+(define_reservation "ca15_ls" "(ca15_ls1|ca15_ls2)")
+
+;; The extended load-store pipeline
+(define_cpu_unit "ca15_ldr, ca15_str" "cortex_a15")
+
+;; The extended ALU pipeline
+(define_cpu_unit "ca15_sx1_alu, ca15_sx1_shf, ca15_sx1_sat" "cortex_a15")
+(define_cpu_unit "ca15_sx2_alu, ca15_sx2_shf, ca15_sx2_sat" "cortex_a15")
+
+;; Simple Execution Unit:
+;;
+;; Simple ALU without shift
+(define_insn_reservation "cortex_a15_alu" 2
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "alu")
+ (eq_attr "neon_type" "none")))
+ "ca15_issue1,(ca15_sx1,ca15_sx1_alu)|(ca15_sx2,ca15_sx2_alu)")
+
+;; ALU ops with immediate shift
+(define_insn_reservation "cortex_a15_alu_shift" 3
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "alu_shift")
+ (eq_attr "neon_type" "none")))
+ "ca15_issue1,(ca15_sx1,ca15_sx1+ca15_sx1_shf,ca15_sx1_alu)\
+ |(ca15_sx2,ca15_sx2+ca15_sx2_shf,ca15_sx2_alu)")
+
+;; ALU ops with register controlled shift
+(define_insn_reservation "cortex_a15_alu_shift_reg" 3
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "alu_shift_reg")
+ (eq_attr "neon_type" "none")))
+ "(ca15_issue2,ca15_sx1+ca15_sx2,ca15_sx1_shf,ca15_sx2_alu)\
+ |(ca15_issue1,(ca15_issue1+ca15_sx2,ca15_sx1+ca15_sx2_shf)\
+ |(ca15_issue1+ca15_sx1,ca15_sx1+ca15_sx1_shf),ca15_sx1_alu)")
+
+;; Multiply Execution Unit:
+;;
+;; 32-bit multiplies
+(define_insn_reservation "cortex_a15_mult32" 3
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "mult")
+ (and (eq_attr "neon_type" "none")
+ (eq_attr "mul64" "no"))))
+ "ca15_issue1,ca15_mx")
+
+;; 64-bit multiplies
+(define_insn_reservation "cortex_a15_mult64" 4
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "mult")
+ (and (eq_attr "neon_type" "none")
+ (eq_attr "mul64" "yes"))))
+ "ca15_issue1,ca15_mx*2")
+
+;; Integer divide
+(define_insn_reservation "cortex_a15_udiv" 9
+ (and (eq_attr "tune" "cortexa15")
+ (eq_attr "insn" "udiv"))
+ "ca15_issue1,ca15_mx")
+
+(define_insn_reservation "cortex_a15_sdiv" 10
+ (and (eq_attr "tune" "cortexa15")
+ (eq_attr "insn" "sdiv"))
+ "ca15_issue1,ca15_mx")
+
+;; Block all issue pipes for a cycle
+(define_insn_reservation "cortex_a15_block" 1
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "block")
+ (eq_attr "neon_type" "none")))
+ "ca15_issue3")
+
+;; Branch execution Unit
+;;
+;; Branches take one issue slot.
+;; No latency as there is no result
+(define_insn_reservation "cortex_a15_branch" 0
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "branch")
+ (eq_attr "neon_type" "none")))
+ "ca15_issue1,ca15_bx")
+
+
+;; We lie with calls. They take up all issue slots, and form a block in the
+;; pipeline. The result however is available the next cycle.
+;;
+;; Addition of new units requires this to be updated.
+(define_insn_reservation "cortex_a15_call" 1
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "call")
+ (eq_attr "neon_type" "none")))
+ "ca15_issue3,\
+ ca15_sx1+ca15_sx2+ca15_bx+ca15_mx+ca15_cx1+ca15_cx2+ca15_ls1+ca15_ls2,\
+ ca15_sx1_alu+ca15_sx1_shf+ca15_sx1_sat+ca15_sx2_alu+ca15_sx2_shf\
+ +ca15_sx2_sat+ca15_ldr+ca15_str")
+
+;; Load-store execution Unit
+;;
+;; Loads of up to two words.
+(define_insn_reservation "cortex_a15_load1" 4
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "load_byte,load1,load2")
+ (eq_attr "neon_type" "none")))
+ "ca15_issue1,ca15_ls,ca15_ldr,nothing")
+
+;; Loads of three or four words.
+(define_insn_reservation "cortex_a15_load3" 5
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "load3,load4")
+ (eq_attr "neon_type" "none")))
+ "ca15_issue2,ca15_ls1+ca15_ls2,ca15_ldr,ca15_ldr,nothing")
+
+;; Stores of up to two words.
+(define_insn_reservation "cortex_a15_store1" 0
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "store1,store2")
+ (eq_attr "neon_type" "none")))
+ "ca15_issue1,ca15_ls,ca15_str")
+
+;; Stores of three or four words.
+(define_insn_reservation "cortex_a15_store3" 0
+ (and (eq_attr "tune" "cortexa15")
+ (and (eq_attr "type" "store3,store4")
+ (eq_attr "neon_type" "none")))
+ "ca15_issue2,ca15_ls1+ca15_ls2,ca15_str,ca15_str")
+
+;; Simple execution unit bypasses
+(define_bypass 1 "cortex_a15_alu"
+ "cortex_a15_alu,cortex_a15_alu_shift,cortex_a15_alu_shift_reg")
+(define_bypass 2 "cortex_a15_alu_shift"
+ "cortex_a15_alu,cortex_a15_alu_shift,cortex_a15_alu_shift_reg")
+(define_bypass 2 "cortex_a15_alu_shift_reg"
+ "cortex_a15_alu,cortex_a15_alu_shift,cortex_a15_alu_shift_reg")
+(define_bypass 1 "cortex_a15_alu" "cortex_a15_load1,cortex_a15_load3")
+(define_bypass 2 "cortex_a15_alu_shift" "cortex_a15_load1,cortex_a15_load3")
+(define_bypass 2 "cortex_a15_alu_shift_reg"
+ "cortex_a15_load1,cortex_a15_load3")
diff --git a/gcc/config/arm/fpa.md b/gcc/config/arm/fpa.md
index f2113a98458..875176b724b 100644
--- a/gcc/config/arm/fpa.md
+++ b/gcc/config/arm/fpa.md
@@ -671,7 +671,7 @@
(set_attr "type"
"load1,store2,*,store2,load1,ffarith,ffarith,f_fpa_load,f_fpa_store,r_mem_f,f_mem_r")
(set_attr "pool_range" "*,*,*,*,4092,*,*,1024,*,*,*")
- (set_attr "neg_pool_range" "*,*,*,*,0,*,*,1020,*,*,*")]
+ (set_attr "neg_pool_range" "*,*,*,*,0,*,*,1008,*,*,*")]
)
;; Saving and restoring the floating point registers in the prologue should
diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index 5cbe5bed2cc..94e0a5fd08c 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -198,7 +198,7 @@
(set_attr "insn" "*,*,*,*,*,*,mov,*,*")
(set_attr "length" "4,4,4,4,4,4,8,8,8")
(set_attr "pool_range" "*,*,*,1020,*,*,*,1020,*")
- (set_attr "neg_pool_range" "*,*,*,1008,*,*,*,1008,*")])
+ (set_attr "neg_pool_range" "*,*,*,1004,*,*,*,1004,*")])
(define_insn "*neon_mov<mode>"
[(set (match_operand:VQXMOV 0 "nonimmediate_operand"
@@ -243,7 +243,7 @@
(set_attr "insn" "*,*,*,*,*,*,mov,*,*")
(set_attr "length" "4,8,4,8,8,8,16,8,16")
(set_attr "pool_range" "*,*,*,1020,*,*,*,1020,*")
- (set_attr "neg_pool_range" "*,*,*,1008,*,*,*,1008,*")])
+ (set_attr "neg_pool_range" "*,*,*,996,*,*,*,996,*")])
(define_expand "movti"
[(set (match_operand:TI 0 "nonimmediate_operand" "")
diff --git a/gcc/config/arm/t-arm b/gcc/config/arm/t-arm
index a9a174d473d..1128d1904b0 100644
--- a/gcc/config/arm/t-arm
+++ b/gcc/config/arm/t-arm
@@ -19,26 +19,44 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-MD_INCLUDES= $(srcdir)/config/arm/arm-tune.md \
- $(srcdir)/config/arm/predicates.md \
- $(srcdir)/config/arm/arm-generic.md \
- $(srcdir)/config/arm/arm1020e.md \
+# All md files - except for arm.md.
+# This list should be kept in alphabetical order and updated whenever an md
+# file is added or removed.
+MD_INCLUDES= $(srcdir)/config/arm/arm1020e.md \
$(srcdir)/config/arm/arm1026ejs.md \
$(srcdir)/config/arm/arm1136jfs.md \
+ $(srcdir)/config/arm/arm926ejs.md \
+ $(srcdir)/config/arm/arm-fixed.md \
+ $(srcdir)/config/arm/arm-generic.md \
+ $(srcdir)/config/arm/arm-tune.md \
+ $(srcdir)/config/arm/cirrus.md \
+ $(srcdir)/config/arm/constraints.md \
+ $(srcdir)/config/arm/cortex-a15.md \
+ $(srcdir)/config/arm/cortex-a5.md \
+ $(srcdir)/config/arm/cortex-a8.md \
+ $(srcdir)/config/arm/cortex-a8-neon.md \
+ $(srcdir)/config/arm/cortex-a9.md \
+ $(srcdir)/config/arm/cortex-a9-neon.md \
+ $(srcdir)/config/arm/cortex-m4-fpu.md \
+ $(srcdir)/config/arm/cortex-m4.md \
+ $(srcdir)/config/arm/cortex-r4f.md \
+ $(srcdir)/config/arm/cortex-r4.md \
$(srcdir)/config/arm/fa526.md \
$(srcdir)/config/arm/fa606te.md \
$(srcdir)/config/arm/fa626te.md \
- $(srcdir)/config/arm/fmp626.md \
$(srcdir)/config/arm/fa726te.md \
- $(srcdir)/config/arm/arm926ejs.md \
- $(srcdir)/config/arm/cirrus.md \
+ $(srcdir)/config/arm/fmp626.md \
$(srcdir)/config/arm/fpa.md \
- $(srcdir)/config/arm/vec-common.md \
+ $(srcdir)/config/arm/iterators.md \
$(srcdir)/config/arm/iwmmxt.md \
- $(srcdir)/config/arm/vfp.md \
+ $(srcdir)/config/arm/ldmstm.md \
$(srcdir)/config/arm/neon.md \
+ $(srcdir)/config/arm/predicates.md \
+ $(srcdir)/config/arm/sync.md \
$(srcdir)/config/arm/thumb2.md \
- $(srcdir)/config/arm/arm-fixed.md
+ $(srcdir)/config/arm/vec-common.md \
+ $(srcdir)/config/arm/vfp11.md \
+ $(srcdir)/config/arm/vfp.md
s-config s-conditions s-flags s-codes s-constants s-emit s-recog s-preds \
s-opinit s-extract s-peep s-attr s-attrtab s-output: $(MD_INCLUDES)
diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
index 0c85c46019b..1ae0eeb08e0 100644
--- a/gcc/config/arm/vfp.md
+++ b/gcc/config/arm/vfp.md
@@ -178,7 +178,7 @@
(const_int 4))]
(const_int 4)))
(set_attr "pool_range" "*,*,*,*,1020,4096,*,*,*,*,1020,*")
- (set_attr "neg_pool_range" "*,*,*,*,1008,0,*,*,*,*,1008,*")
+ (set_attr "neg_pool_range" "*,*,*,*,1004,0,*,*,*,*,1004,*")
(set_attr "arch" "t2,any,any,any,a,t2,any,any,any,any,any,any")]
)
@@ -223,7 +223,7 @@
(const_int 4)))
(set_attr "predicable" "yes")
(set_attr "pool_range" "*,*,*,*,1020,4096,*,*,*,*,1020,*")
- (set_attr "neg_pool_range" "*,*,*,*,1008,0,*,*,*,*,1008,*")
+ (set_attr "neg_pool_range" "*,*,*,*,1004,0,*,*,*,*,1004,*")
(set (attr "ce_count")
(symbol_ref "get_attr_length (insn) / 4"))
(set_attr "arch" "t2,any,any,any,a,t2,any,any,any,any,any,any")]
@@ -460,7 +460,7 @@
(const_int 4)))
(set_attr "predicable" "yes")
(set_attr "pool_range" "*,*,*,1020,*,1020,*,*,*")
- (set_attr "neg_pool_range" "*,*,*,1008,*,1008,*,*,*")]
+ (set_attr "neg_pool_range" "*,*,*,1004,*,1004,*,*,*")]
)
(define_insn "*thumb2_movdf_vfp"
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index b1038f40660..ba253dd7dbf 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -2942,6 +2942,33 @@ darwin_override_options (void)
/* Earlier versions are not specifically accounted, until required. */
}
+ /* In principle, this should be c-family only. However, we really need to
+ set sensible defaults for LTO as well, since the section selection stuff
+ should check for correctness re. the ABI. TODO: check and provide the
+ flags (runtime & ABI) from the lto wrapper). */
+
+ /* Unless set, force ABI=2 for NeXT and m64, 0 otherwise. */
+ if (!global_options_set.x_flag_objc_abi)
+ global_options.x_flag_objc_abi
+ = (!flag_next_runtime)
+ ? 0
+ : (TARGET_64BIT ? 2
+ : (generating_for_darwin_version >= 9) ? 1
+ : 0);
+
+ /* Objective-C family ABI 2 is only valid for next/m64 at present. */
+ if (global_options_set.x_flag_objc_abi && flag_next_runtime)
+ {
+ if (TARGET_64BIT && global_options.x_flag_objc_abi < 2)
+ error_at (UNKNOWN_LOCATION, "%<-fobjc-abi-version%> >= 2 must be"
+ " used for %<-m64%> targets with"
+ " %<-fnext-runtime%>");
+ if (!TARGET_64BIT && global_options.x_flag_objc_abi >= 2)
+ error_at (UNKNOWN_LOCATION, "%<-fobjc-abi-version%> >= 2 is not"
+ " supported on %<-m32%> targets with"
+ " %<-fnext-runtime%>");
+ }
+
/* Don't emit DWARF3/4 unless specifically selected. This is a
workaround for tool bugs. */
if (!global_options_set.x_dwarf_strict)
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 29a24ddc6d6..fd4590404bd 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -112,7 +112,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Default to using the NeXT-style runtime, since that's what is
pre-installed on Darwin systems. */
-#define NEXT_OBJC_RUNTIME
+#define NEXT_OBJC_RUNTIME 1
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions. */
@@ -140,20 +140,8 @@ extern GTY(()) int darwin_ms_struct;
} while (0)
#define SUBTARGET_C_COMMON_OVERRIDE_OPTIONS do { \
- /* Unless set, force ABI=2 for NeXT and m64, 0 otherwise. */ \
- if (!global_options_set.x_flag_objc_abi) \
- global_options.x_flag_objc_abi \
- = (flag_next_runtime && TARGET_64BIT) ? 2 : 0; \
- /* Objective-C family ABI 2 is only valid for next/m64 at present. */ \
- if (global_options_set.x_flag_objc_abi && flag_next_runtime) \
- if (TARGET_64BIT && global_options.x_flag_objc_abi < 2) \
- error_at (UNKNOWN_LOCATION, "%<-fobjc-abi-version%> >= 2 is only" \
- " supported on %<-m64%> targets for" \
- " %<-fnext-runtime%>"); \
- /* Sort out ObjC exceptions: If the runtime is NeXT we default to \
- sjlj for m32 only. */ \
- if (!global_options_set.x_flag_objc_sjlj_exceptions) \
- global_options.x_flag_objc_sjlj_exceptions = \
+ if (!global_options_set.x_flag_objc_sjlj_exceptions) \
+ global_options.x_flag_objc_sjlj_exceptions = \
flag_next_runtime && !TARGET_64BIT; \
if (flag_mkernel || flag_apple_kext) \
{ \
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index fa306ba79d8..47e7c6b33e5 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -4679,7 +4679,7 @@
(define_insn "*floathi<mode>2_i387_with_temp"
[(set (match_operand:X87MODEF 0 "register_operand" "=f,f")
(float:X87MODEF (match_operand:HI 1 "nonimmediate_operand" "m,?r")))
- (clobber (match_operand:HI 2 "memory_operand" "=m,m"))]
+ (clobber (match_operand:HI 2 "memory_operand" "=X,m"))]
"TARGET_80387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)"
diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md
index 5799b0aca50..9f9134486c4 100644
--- a/gcc/config/i386/sync.md
+++ b/gcc/config/i386/sync.md
@@ -23,6 +23,8 @@
UNSPEC_SFENCE
UNSPEC_MFENCE
UNSPEC_MOVA ; For __atomic support
+ UNSPEC_LDA
+ UNSPEC_STA
])
(define_c_enum "unspecv" [
@@ -180,7 +182,10 @@
mem = dst;
if (FP_REG_P (tmp))
- emit_insn (gen_movdi_via_fpu (mem, src, tmp));
+ {
+ emit_insn (gen_loaddi_via_fpu (tmp, src));
+ emit_insn (gen_storedi_via_fpu (mem, tmp));
+ }
else
{
adjust_reg_mode (tmp, DImode);
@@ -258,7 +263,8 @@
if (FP_REG_P (tmp))
{
- emit_insn (gen_movdi_via_fpu (dst, src, tmp));
+ emit_insn (gen_loaddi_via_fpu (tmp, src));
+ emit_insn (gen_storedi_via_fpu (dst, tmp));
DONE;
}
else
@@ -276,15 +282,27 @@
;; operations. But the fix_trunc patterns want way more setup than we want
;; to provide. Note that the scratch is DFmode instead of XFmode in order
;; to make it easy to allocate a scratch in either SSE or FP_REGs above.
-(define_insn "movdi_via_fpu"
+
+(define_insn "loaddi_via_fpu"
+ [(set (match_operand:DF 0 "register_operand" "=f")
+ (unspec:DF [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_LDA))]
+ "TARGET_80387"
+ "fild%Z1\t%1"
+ [(set_attr "type" "fmov")
+ (set_attr "mode" "DF")
+ (set_attr "fp_int_src" "true")])
+
+(define_insn "storedi_via_fpu"
[(set (match_operand:DI 0 "memory_operand" "=m")
- (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_MOVA))
- (clobber (match_operand:DF 2 "register_operand" "=f"))]
+ (unspec:DI [(match_operand:DF 1 "register_operand" "f")] UNSPEC_STA))]
"TARGET_80387"
- "fild%Z1\t%1\;fistp%Z0\t%0"
- [(set_attr "type" "multi")
- ;; Worst case based on full sib+offset32 addressing modes
- (set_attr "length" "14")])
+{
+ gcc_assert (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != NULL_RTX);
+
+ return "fistp%Z0\t%0";
+}
+ [(set_attr "type" "fmov")
+ (set_attr "mode" "DI")])
(define_expand "atomic_compare_and_swap<mode>"
[(match_operand:QI 0 "register_operand" "") ;; bool success output
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index 1be614c3241..d5417febe8b 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -121,10 +121,12 @@
;; Attributes for instruction and branch scheduling
-;; For conditional branches.
+;; For conditional branches. Frame related instructions are not allowed
+;; because they confuse the unwind support.
(define_attr "in_branch_delay" "false,true"
(if_then_else (and (eq_attr "type" "!uncond_branch,btable_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
- (eq_attr "length" "4"))
+ (eq_attr "length" "4")
+ (not (match_test "RTX_FRAME_RELATED_P (insn)")))
(const_string "true")
(const_string "false")))
@@ -132,7 +134,8 @@
;; even if the instruction is nullified.
(define_attr "in_nullified_branch_delay" "false,true"
(if_then_else (and (eq_attr "type" "!uncond_branch,btable_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,parallel_branch")
- (eq_attr "length" "4"))
+ (eq_attr "length" "4")
+ (not (match_test "RTX_FRAME_RELATED_P (insn)")))
(const_string "true")
(const_string "false")))
@@ -140,7 +143,8 @@
;; delay slot.
(define_attr "in_call_delay" "false,true"
(cond [(and (eq_attr "type" "!uncond_branch,btable_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
- (eq_attr "length" "4"))
+ (eq_attr "length" "4")
+ (not (match_test "RTX_FRAME_RELATED_P (insn)")))
(const_string "true")
(eq_attr "type" "uncond_branch")
(if_then_else (match_test "TARGET_JUMP_IN_DELAY")
diff --git a/gcc/config/rl78/constraints.md b/gcc/config/rl78/constraints.md
new file mode 100644
index 00000000000..a89e1a244e4
--- /dev/null
+++ b/gcc/config/rl78/constraints.md
@@ -0,0 +1,266 @@
+;; Machine Description for Renesas RL78 processors
+;; 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/>.
+
+; Constraints in use:
+
+; core:
+; V X g i m n o p r s < >
+; 0..9
+; I..Q - integers
+; Int8 = 0..255
+; Int3 = 1..7
+; J = -255..0
+; K = 1
+; L = -1
+; M = 0
+; N = 2
+; O = -2
+; P = 1..15
+
+; E..H - float constants
+
+; RL78-specific
+; a x b c d e h l w - 8-bit regs
+; A B D T S - 16-bit regs
+; R = all regular registers (A-L)
+; Y - any valid memory
+; Wxx - various memory addressing modes
+; Qxx - conditionals
+; v = virtual registers
+; Zxx = specific virtual registers
+
+(define_constraint "Int8"
+ "Integer constant in the range 0 @dots{} 255."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 0, 255)")))
+
+(define_constraint "Int3"
+ "Integer constant in the range 1 @dots{} 7."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 1, 7)")))
+
+(define_constraint "J"
+ "Integer constant in the range -255 @dots{} 0"
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, -255, 0)")))
+
+(define_constraint "K"
+ "Integer constant 1."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 1, 1)")))
+
+(define_constraint "L"
+ "Integer constant -1."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, -1, -1)")))
+
+(define_constraint "M"
+ "Integer constant 0."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 0, 0)")))
+
+(define_constraint "N"
+ "Integer constant 2."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 2, 2)")))
+
+(define_constraint "O"
+ "Integer constant -2."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, -2, -2)")))
+
+(define_constraint "P"
+ "Integer constant 1..15"
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 1, 15)")))
+
+(define_register_constraint "R" "QI_REGS"
+ "@code{A} through @code{L} registers.")
+
+(define_register_constraint "a" "AREG"
+ "The @code{A} register.")
+
+(define_register_constraint "x" "XREG"
+ "The @code{X} register.")
+
+(define_register_constraint "b" "BREG"
+ "The @code{B} register.")
+
+(define_register_constraint "c" "CREG"
+ "The @code{C} register.")
+
+(define_register_constraint "d" "DREG"
+ "The @code{D} register.")
+
+(define_register_constraint "e" "EREG"
+ "The @code{E} register.")
+
+(define_register_constraint "h" "HREG"
+ "The @code{H} register.")
+
+(define_register_constraint "l" "LREG"
+ "The @code{L} register.")
+
+(define_register_constraint "w" "PSWREG"
+ "The @code{PSW} register.")
+
+(define_register_constraint "A" "AXREG"
+ "The @code{AX} register.")
+
+(define_register_constraint "B" "BCREG"
+ "The @code{BC} register.")
+
+(define_register_constraint "D" "DEREG"
+ "The @code{DE} register.")
+
+; because H + L = T, assuming A=1.
+(define_register_constraint "T" "HLREG"
+ "The @code{HL} register.")
+
+(define_register_constraint "S" "SPREG"
+ "The @code{SP} register.")
+
+(define_register_constraint "v" "V_REGS"
+ "The virtual registers.")
+
+(define_register_constraint "Z08W" "R8W_REGS"
+ "The R8 register, HImode.")
+
+(define_register_constraint "Z10W" "R10W_REGS"
+ "The R10 register, HImode.")
+
+(define_register_constraint "Zint" "INT_REGS"
+ "The interrupt registers.")
+
+; All the memory addressing schemes the RL78 supports
+; of the form W {register} {bytes of offset}
+; or W {register} {register}
+
+; absolute address
+(define_memory_constraint "Wab"
+ "[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 "Wbc"
+ "word16[BC]"
+ (and (match_code "mem")
+ (ior
+ (and (match_code "reg" "0")
+ (match_test "REGNO (XEXP (op, 0)) == BC_REG"))
+ (and (match_code "plus" "0")
+ (and (and (match_code "reg" "00")
+ (match_test "REGNO (XEXP (XEXP (op, 0), 0)) == BC_REG"))
+ (match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
+ )
+ )
+
+(define_memory_constraint "Wde"
+ "[DE]"
+ (and (match_code "mem")
+ (and (match_code "reg" "0")
+ (match_test "REGNO (XEXP (op, 0)) == DE_REG")))
+ )
+
+(define_memory_constraint "Wca"
+ "[AX..HL] for calls"
+ (and (match_code "mem")
+ (and (match_code "reg" "0")
+ (match_test "REGNO (XEXP (op, 0)) <= HL_REG")))
+ )
+
+(define_memory_constraint "Wcv"
+ "[AX..HL,r8-r23] for calls"
+ (and (match_code "mem")
+ (and (match_code "reg" "0")
+ (match_test "REGNO (XEXP (op, 0)) < 24")))
+ )
+
+(define_memory_constraint "Wd2"
+ "word16[DE]"
+ (and (match_code "mem")
+ (ior
+ (and (match_code "reg" "0")
+ (match_test "REGNO (XEXP (op, 0)) == DE_REG"))
+ (and (match_code "plus" "0")
+ (and (and (match_code "reg" "00")
+ (match_test "REGNO (XEXP (XEXP (op, 0), 0)) == DE_REG"))
+ (match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
+ )
+ )
+
+(define_memory_constraint "Whl"
+ "[HL]"
+ (and (match_code "mem")
+ (and (match_code "reg" "0")
+ (match_test "REGNO (XEXP (op, 0)) == HL_REG")))
+ )
+
+(define_memory_constraint "Wh1"
+ "byte8[HL]"
+ (and (match_code "mem")
+ (and (match_code "plus" "0")
+ (and (and (match_code "reg" "00")
+ (match_test "REGNO (XEXP (XEXP (op, 0), 0)) == HL_REG"))
+ (match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
+ )
+
+(define_memory_constraint "Whb"
+ "[HL+B]"
+ (and (match_code "mem")
+ (match_test "rl78_hl_b_c_addr_p (XEXP (op, 0))"))
+ )
+
+(define_memory_constraint "Ws1"
+ "word8[SP]"
+ (and (match_code "mem")
+ (ior
+ (and (match_code "reg" "0")
+ (match_test "REGNO (XEXP (op, 0)) == SP_REG"))
+ (and (match_code "plus" "0")
+ (and (and (match_code "reg" "00")
+ (match_test "REGNO (XEXP (XEXP (op, 0), 0)) == SP_REG"))
+ (match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
+ )
+ )
+
+(define_memory_constraint "Wfr"
+ "ES/CS far pointer"
+ (and (match_code "mem")
+ (match_test "rl78_far_p (op)"))
+ )
+
+(define_memory_constraint "Y"
+ "any near legitimate memory access"
+ (and (match_code "mem")
+ (match_test "!rl78_far_p (op) && rl78_as_legitimate_address (VOIDmode, XEXP (op, 0), true, ADDR_SPACE_GENERIC)"))
+)
+
+
+(define_memory_constraint "Qbi"
+ "built-in compare types"
+ (match_code "eq,ne,gtu,ltu,geu,leu"))
+
+(define_memory_constraint "Qsc"
+ "synthetic compares"
+ (match_code "gt,lt,ge,le"))
diff --git a/gcc/config/rl78/predicates.md b/gcc/config/rl78/predicates.md
new file mode 100644
index 00000000000..343cd8aca6f
--- /dev/null
+++ b/gcc/config/rl78/predicates.md
@@ -0,0 +1,60 @@
+;; Machine Description for Renesas RL78 processors
+;; 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/>.
+
+(define_predicate "rl78_any_operand"
+ (ior (match_operand 0 "general_operand")
+ (match_code "mem,const_int,const_double,reg"))
+)
+
+(define_predicate "rl78_nonfar_operand"
+ (and (match_operand 0 "general_operand")
+ (not (match_test "rl78_far_p (op)")))
+)
+
+(define_predicate "rl78_nonfar_nonimm_operand"
+ (and (match_operand 0 "nonimmediate_operand")
+ (not (match_test "rl78_far_p (op)")))
+)
+
+(define_predicate "ubyte_operand"
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (INTVAL (op), 0, 255)")))
+
+(define_predicate "rl78_24_operand"
+ (and (match_code "const_int")
+ (match_test "INTVAL (op) == 2 || INTVAL (op) == 4")))
+
+(define_predicate "uword_operand"
+ (ior (match_code "const")
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (INTVAL (op), 0, 65536)"))))
+
+(define_predicate "rl78_cmp_operator_real"
+ (match_code "eq,ne,gtu,ltu,geu,leu"))
+(define_predicate "rl78_cmp_operator"
+ (match_code "eq,ne,gtu,ltu,geu,leu,gt,lt,ge,le"))
+
+(define_predicate "rl78_ax_operand"
+ (and (match_code "reg")
+ (match_test "REGNO (op) == AX_REG || REGNO (op) >= FIRST_PSEUDO_REGISTER")))
+
+(define_predicate "rl78_addw_operand"
+ (and (match_code "reg")
+ (match_test "REGNO (op) == AX_REG || REGNO (op) == SP_REG || REGNO (op) >= FIRST_PSEUDO_REGISTER")))
diff --git a/gcc/config/rl78/rl78-c.c b/gcc/config/rl78/rl78-c.c
new file mode 100644
index 00000000000..98f704c975c
--- /dev/null
+++ b/gcc/config/rl78/rl78-c.c
@@ -0,0 +1,43 @@
+/* RL78 C-specific support
+ Copyright (C) 2011 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-pragma.h"
+#include "c-family/c-common.h"
+#include "diagnostic-core.h"
+#include "cpplib.h"
+#include "hard-reg-set.h"
+#include "output.h"
+#include "rl78-protos.h"
+#include "function.h"
+#define MAX_RECOG_OPERANDS 10
+#include "reload.h"
+#include "target.h"
+
+/* Implements REGISTER_TARGET_PRAGMAS. */
+void
+rl78_register_pragmas (void)
+{
+ c_register_addr_space ("__far", ADDR_SPACE_FAR);
+}
diff --git a/gcc/config/rl78/rl78-expand.md b/gcc/config/rl78/rl78-expand.md
new file mode 100644
index 00000000000..9707e5ba387
--- /dev/null
+++ b/gcc/config/rl78/rl78-expand.md
@@ -0,0 +1,256 @@
+;; Machine Description for Renesas RL78 processors
+;; 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/>.
+
+;;---------- Moving ------------------------
+
+(define_expand "movqi"
+ [(set (match_operand:QI 0 "nonimmediate_operand")
+ (match_operand:QI 1 "general_operand"))]
+ ""
+ {
+ if (MEM_P (operand0) && MEM_P (operand1))
+ operands[1] = copy_to_mode_reg (QImode, operand1);
+ if (rl78_far_p (operand0) && rl78_far_p (operand1))
+ operands[1] = copy_to_mode_reg (QImode, operand1);
+
+ /* FIXME: Not sure how GCC can generate (SUBREG (SYMBOL_REF)),
+ but it does. Since this makes no sense, reject it here. */
+ if (GET_CODE (operand1) == SUBREG
+ && GET_CODE (XEXP (operand1, 0)) == SYMBOL_REF)
+ FAIL;
+
+ if (CONST_INT_P (operand1) && ! IN_RANGE (INTVAL (operand1), (-1 << 8) + 1, (1 << 8) - 1))
+ gcc_unreachable();
+ }
+)
+
+(define_expand "movhi"
+ [(set (match_operand:HI 0 "nonimmediate_operand")
+ (match_operand:HI 1 "general_operand"))]
+ ""
+ {
+ if (MEM_P (operand0) && MEM_P (operand1))
+ operands[1] = copy_to_mode_reg (HImode, operand1);
+ if (rl78_far_p (operand0) && rl78_far_p (operand1))
+ operands[1] = copy_to_mode_reg (HImode, operand1);
+
+ /* FIXME: Not sure how GCC can generate (SUBREG (SYMBOL_REF)),
+ but it does. Since this makes no sense, reject it here. */
+ if (GET_CODE (operand1) == SUBREG
+ && GET_CODE (XEXP (operand1, 0)) == SYMBOL_REF)
+ FAIL;
+ }
+)
+
+(define_expand "movsi"
+ [(set (match_operand:SI 0 "nonimmediate_operand")
+ (match_operand:SI 1 "general_operand"))]
+ ""
+ {
+ rl78_expand_movsi (operands);
+ DONE;
+ }
+)
+
+;;---------- Conversions ------------------------
+
+(define_expand "zero_extendqihi2"
+ [(set (match_operand:HI 0 "nonimmediate_operand")
+ (zero_extend:HI (match_operand:QI 1 "general_operand")))]
+ ""
+ "if (rl78_force_nonfar_2 (operands, gen_zero_extendqihi2))
+ DONE;"
+ )
+
+(define_expand "extendqihi2"
+ [(set (match_operand:HI 0 "nonimmediate_operand")
+ (sign_extend:HI (match_operand:QI 1 "general_operand")))]
+ ""
+ "if (rl78_force_nonfar_2 (operands, gen_extendqihi2))
+ DONE;"
+ )
+
+;;---------- Arithmetic ------------------------
+
+(define_expand "add<mode>3"
+ [(set (match_operand:QHI 0 "nonimmediate_operand")
+ (plus:QHI (match_operand:QHI 1 "general_operand")
+ (match_operand:QHI 2 "general_operand")))
+ ]
+ ""
+ "if (rl78_force_nonfar_3 (operands, gen_add<mode>3))
+ DONE;"
+)
+
+(define_expand "sub<mode>3"
+ [(set (match_operand:QHI 0 "nonimmediate_operand")
+ (minus:QHI (match_operand:QHI 1 "general_operand")
+ (match_operand:QHI 2 "general_operand")))
+ ]
+ ""
+ "if (rl78_force_nonfar_3 (operands, gen_sub<mode>3))
+ DONE;"
+)
+
+(define_expand "neg<mode>2"
+ [(set (match_operand:QHI 0 "nonimmediate_operand")
+ (minus:QHI (const_int 0)
+ (match_operand:QHI 1 "general_operand")))
+ ]
+ ""
+ "if (rl78_force_nonfar_2 (operands, gen_neg<mode>2))
+ DONE;"
+)
+
+(define_expand "umulqihi3"
+ [(set (match_operand:HI 0 "register_operand")
+ (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand"))
+ (zero_extend:HI (match_operand:QI 2 "register_operand"))))]
+ ""
+ ""
+)
+
+(define_expand "andqi3"
+ [(set (match_operand:QI 0 "nonimmediate_operand")
+ (and:QI (match_operand:QI 1 "general_operand")
+ (match_operand:QI 2 "general_operand")))
+ ]
+ ""
+ "if (rl78_force_nonfar_3 (operands, gen_andqi3))
+ DONE;"
+)
+
+(define_expand "iorqi3"
+ [(set (match_operand:QI 0 "nonimmediate_operand")
+ (ior:QI (match_operand:QI 1 "general_operand")
+ (match_operand:QI 2 "general_operand")))
+ ]
+ ""
+ "if (rl78_force_nonfar_3 (operands, gen_iorqi3))
+ DONE;"
+)
+
+(define_expand "xorqi3"
+ [(set (match_operand:QI 0 "nonimmediate_operand")
+ (xor:QI (match_operand:QI 1 "general_operand")
+ (match_operand:QI 2 "general_operand")))
+ ]
+ ""
+ "if (rl78_force_nonfar_3 (operands, gen_xorqi3))
+ DONE;"
+)
+
+(define_expand "one_cmplqi2"
+ [(set (match_operand:QI 0 "nonimmediate_operand")
+ (xor:QI (match_operand:QI 1 "general_operand")
+ (const_int 255)))
+ ]
+ ""
+ "if (rl78_force_nonfar_2 (operands, gen_one_cmplqi2))
+ DONE;"
+)
+
+;;---------- Shifts ------------------------
+
+(define_expand "ashl<mode>3"
+ [(set (match_operand:QHI 0 "nonimmediate_operand")
+ (ashift:QHI (match_operand:QHI 1 "general_operand")
+ (match_operand:QI 2 "general_operand")))
+ ]
+ ""
+ "if (rl78_force_nonfar_3 (operands, gen_ashl<mode>3))
+ DONE;"
+)
+
+(define_expand "ashr<mode>3"
+ [(set (match_operand:QHI 0 "nonimmediate_operand")
+ (ashiftrt:QHI (match_operand:QHI 1 "general_operand")
+ (match_operand:QI 2 "general_operand")))
+ ]
+ ""
+ "if (rl78_force_nonfar_3 (operands, gen_ashr<mode>3))
+ DONE;"
+)
+
+(define_expand "lshr<mode>3"
+ [(set (match_operand:QHI 0 "nonimmediate_operand")
+ (lshiftrt:QHI (match_operand:QHI 1 "general_operand")
+ (match_operand:QI 2 "general_operand")))
+ ]
+ ""
+ "if (rl78_force_nonfar_3 (operands, gen_lshr<mode>3))
+ DONE;"
+)
+
+(define_expand "ashrsi3"
+ [(set (match_operand:SI 0 "register_operand")
+ (ashiftrt:SI (match_operand:SI 1 "register_operand")
+ (match_operand:SI 2 "immediate_operand")))
+ ]
+ ""
+ "if (GET_CODE (operands[2]) != CONST_INT)
+ FAIL;"
+)
+
+;;---------- Branching ------------------------
+
+(define_expand "indirect_jump"
+ [(set (pc)
+ (match_operand:HI 0 "nonimmediate_operand"))]
+ ""
+ ""
+)
+
+(define_expand "call"
+ [(call (match_operand:HI 0 "memory_operand")
+ (match_operand 1 ""))]
+ ""
+ ""
+)
+
+(define_expand "call_value"
+ [(set (match_operand 0 "register_operand")
+ (call (match_operand:HI 1 "memory_operand")
+ (match_operand 2 "")))]
+ ""
+ ""
+)
+
+(define_expand "cbranchqi4"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator"
+ [(match_operand:QI 1 "general_operand")
+ (match_operand:QI 2 "general_operand")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ ""
+ "rl78_expand_compare (operands);"
+)
+
+(define_expand "cbranchhi4"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator"
+ [(match_operand:HI 1 "general_operand")
+ (match_operand:HI 2 "general_operand")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ ""
+ "rl78_expand_compare (operands);"
+)
diff --git a/gcc/config/rl78/rl78-opts.h b/gcc/config/rl78/rl78-opts.h
new file mode 100644
index 00000000000..c0caa506ca4
--- /dev/null
+++ b/gcc/config/rl78/rl78-opts.h
@@ -0,0 +1,30 @@
+/* GCC option-handling definitions for the Renesas RL78 processor.
+ Copyright (C) 2011 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 RL78_OPTS_H
+#define RL78_OPTS_H
+
+enum rl78_mul_types
+{
+ MUL_NONE,
+ MUL_RL78,
+ MUL_G13
+};
+
+#endif
diff --git a/gcc/config/rl78/rl78-protos.h b/gcc/config/rl78/rl78-protos.h
new file mode 100644
index 00000000000..f4ce1864273
--- /dev/null
+++ b/gcc/config/rl78/rl78-protos.h
@@ -0,0 +1,43 @@
+/* Prototypes for Renesas RL78 processors
+ 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/>. */
+
+void rl78_emit_eh_epilogue (rtx);
+void rl78_expand_compare (rtx *);
+void rl78_expand_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);
+void rl78_expand_epilogue (void);
+void rl78_expand_prologue (void);
+int rl78_far_p (rtx x);
+int rl78_hard_regno_mode_ok (int, enum machine_mode);
+int rl78_hard_regno_nregs (int, enum machine_mode);
+bool rl78_hl_b_c_addr_p (rtx);
+int rl78_initial_elimination_offset (int, int);
+bool rl78_as_legitimate_address (enum machine_mode, rtx,
+ bool, addr_space_t);
+int rl78_legitimize_reload_address (rtx *, enum machine_mode, int,int, int);
+enum reg_class rl78_mode_code_base_reg_class (enum machine_mode, addr_space_t, int, int);
+bool rl78_peep_movhi_p (rtx *);
+bool rl78_real_insns_ok (void);
+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);
diff --git a/gcc/config/rl78/rl78-real.md b/gcc/config/rl78/rl78-real.md
new file mode 100644
index 00000000000..e13dc4e4382
--- /dev/null
+++ b/gcc/config/rl78/rl78-real.md
@@ -0,0 +1,339 @@
+;; Machine Description for Renesas RL78 processors
+;; 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/>.
+
+;; The insns in this file correspond to the actual opcodes the RL78
+;; can issue with real registers. All insns in here should be
+;; conditional on rl78_real_insns_ok() returning true, and should
+;; allow virtual registers in their predicates - the reorg pass that
+;; allocates physical registers uses the constraints to select
+;; registers, but insns with virtual registers MUST match one of these
+;; patterns - other than the constraints - so that the operand info is
+;; properly set up for the alloc pass.
+
+;;---------- Moving ------------------------
+
+(define_insn "movqi_es"
+ [(set (reg:QI ES_REG)
+ (match_operand:QI 0 "register_operand" "a"))]
+ ""
+ "mov\tes, %0"
+)
+
+(define_insn "movqi_cs"
+ [(set (reg:QI CS_REG)
+ (match_operand:QI 0 "register_operand" "a"))]
+ ""
+ "mov\tcs, %0"
+)
+
+(define_insn "*movqi_real"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=g,RaxbcWab,RaxbcWab,a, bcx,R, WabWd2WhlWh1WhbWbcWs1v, bcx")
+ (match_operand 1 "general_operand" "0,K, M, RInt8sJvWabWdeWd2WhlWh1WhbWbcWs1,Wab,aInt8J,a, R"))]
+ "rl78_real_insns_ok ()"
+ "@
+ ; mov\t%0, %1
+ oneb\t%0
+ clrb\t%0
+ mov\t%0, %1
+ mov\t%0, %1
+ mov\t%0, %1
+ mov\t%0, %1
+ mov\t%0, %S1"
+)
+
+(define_insn "*movhi_real"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=g,AB,AB,RSv,A,BDTvSWabWd2WdeWhlWh1WbcWs1, BDT,ABDT,v")
+ (match_operand:HI 1 "general_operand" " 0,K, M, i, BDTvSWabWd2WdeWh1WhlWbcWs1,A, BDT,vS, ABDT"))]
+ "rl78_real_insns_ok ()"
+ "@
+ ; movw\t%0, %1
+ onew\t%0
+ clrw\t%0
+ movw\t%0, %1
+ movw\t%0, %1
+ movw\t%0, %1
+ movw\t%0, %S1
+ movw\t%0, %1
+ movw\t%0, %1"
+)
+
+;;---------- Conversions ------------------------
+
+(define_insn "*zero_extendqihi2_real"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rv,A")
+ (zero_extend:HI (match_operand:QI 1 "general_operand" "0,a")))]
+ "rl78_real_insns_ok ()"
+ "@
+ mov\t%Q0, #0
+ mov\tx, a \;mov\ta, #0"
+ )
+
+(define_insn "*extendqihi2_real"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=A,A")
+ (sign_extend:HI (match_operand:QI 1 "general_operand" "x,a")))]
+ "rl78_real_insns_ok ()"
+ "@
+ shlw\t%0, 8 \;sarw\t%0, 8
+ sarw\t%0, 8"
+ )
+
+;;---------- Arithmetic ------------------------
+
+(define_insn "*addqi3_real"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=rvWabWhlWh1,rvWabWhlWh1,a,*bcdehl")
+ (plus:QI (match_operand:QI 1 "general_operand" "%0,0,0,0")
+ (match_operand:QI 2 "general_operand" "K,L,RWhlWh1i,a")))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ inc\t%0
+ dec\t%0
+ add\t%0, %2
+ add\t%0, %2"
+)
+
+(define_insn "*addhi3_real"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=vABDTWh1Wab,vABDTWh1Wab,v,v,A,S,S,A")
+ (plus:HI (match_operand:HI 1 "general_operand" "%0,0,0,0,0,0,0,S")
+ (match_operand:HI 2 "general_operand" "K,L,N,O,RWh1WhlWabiv,Int8,J,Ri")))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ incw\t%0
+ decw\t%0
+ incw\t%0 \;incw\t%0
+ decw\t%0 \;decw\t%0
+ addw\t%0, %p2
+ addw\t%0, %2
+ subw\t%0, %m2
+ movw\t%0, %1 \;addw\t%0, %2"
+)
+
+(define_insn "*addqihi3a_real"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (plus:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%r"))
+ (match_operand:HI 2 "register_operand" "r")))
+ ]
+ "rl78_real_insns_ok ()"
+ "add\t%q0, %q1 \;addc\t%Q0, #0"
+)
+
+(define_insn "*subqi3_real"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=a,R,v")
+ (minus:QI (match_operand:QI 1 "general_operand" "0,0,0")
+ (match_operand:QI 2 "general_operand" "RiWabWhbWh1Whl,a,i")))
+ ]
+ "rl78_real_insns_ok ()"
+ "sub\t%0, %2"
+)
+
+(define_insn "*subhi3_real"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=A,S")
+ (minus:HI (match_operand:HI 1 "general_operand" "0,0")
+ (match_operand:HI 2 "general_operand" "iBDTWabWh1v,i")))
+ ]
+ "rl78_real_insns_ok ()"
+ "subw\t%0, %2"
+)
+
+(define_insn "*umulhi3_shift_real"
+ [(set (match_operand:HI 0 "register_operand" "=A,A")
+ (mult:HI (match_operand:HI 1 "rl78_nonfar_operand" "0,0")
+ (match_operand:HI 2 "rl78_24_operand" "N,i")))]
+ "rl78_real_insns_ok ()"
+ "@
+ shlw\t%0, 1
+ shlw\t%0, 2"
+)
+
+(define_insn "*umulqihi3_real"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=A")
+ (mult:HI (zero_extend:HI (match_operand:QI 1 "general_operand" "%a"))
+ (zero_extend:HI (match_operand:QI 2 "general_operand" "x"))))]
+ "rl78_real_insns_ok ()"
+ "mulu\t%2"
+)
+
+(define_insn "*andqi3_real"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=A,R,v")
+ (and:QI (match_operand:QI 1 "general_operand" "%0,0,0")
+ (match_operand:QI 2 "general_operand" "iRvWabWhbWh1Whl,A,i")))
+ ]
+ "rl78_real_insns_ok ()"
+ "and\t%0, %2"
+)
+
+(define_insn "*iorqi3_real"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=A,R,v")
+ (ior:QI (match_operand:QI 1 "general_operand" "%0,0,0")
+ (match_operand:QI 2 "general_operand" "iRvWabWhbWh1Whl,A,i")))
+ ]
+ "rl78_real_insns_ok ()"
+ "or\t%0, %2"
+)
+
+(define_insn "*xorqi3_real"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=A,R,v")
+ (xor:QI (match_operand:QI 1 "general_operand" "%0,0,0")
+ (match_operand 2 "general_operand" "iRvWabWhbWh1Whl,A,i")))
+ ]
+ "rl78_real_insns_ok ()"
+ "xor\t%0, %2"
+)
+
+;;---------- Shifts ------------------------
+
+(define_insn "*ashlqi3_real"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=abc,a,a")
+ (ashift:QI (match_operand:QI 1 "general_operand" "0,0,0")
+ (match_operand:QI 2 "general_operand" "Int3,bc,dehl")))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ shl\t%0, %u2
+ cmp0 %2\; bz $2f\; 1: shl\t%0, 1 \;dec %2 \;bnz $1b\;2:
+ inc %2\;dec %2\;bz $2f\;1: shl\t%0, 1 \;dec %2 \;bnz $1b\;2:"
+)
+
+(define_insn "*ashlhi3_real"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=AB,A,A")
+ (ashift:HI (match_operand:HI 1 "general_operand" "0,0,0")
+ (match_operand:QI 2 "general_operand" "P,bc,dehl")))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ shlw\t%0, %u2
+ cmp0 %2\; bz $2f\; 1: shlw\t%0, 1 \;dec %2 \;bnz $1b\;2:
+ inc %2\;dec %2\;bz $2f\;1: shlw\t%0, 1 \;dec %2 \;bnz $1b\;2:"
+)
+
+;;----------
+
+(define_insn "*ashrqi3_real"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=abc,a,a")
+ (ashiftrt:QI (match_operand:QI 1 "general_operand" "0,0,0")
+ (match_operand:QI 2 "general_operand" "Int3,bc,dehl")))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ sar\t%0, %u2
+ cmp0 %2\; bz $2f\; 1: sar\t%0, 1 \;dec %2 \;bnz $1b\;2:
+ inc %2\;dec %2\;bz $2f\;1: sar\t%0, 1\;dec %2 \;bnz $1b\;2:"
+)
+
+(define_insn "*ashrhi3_real"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=AB,A,A")
+ (ashiftrt:HI (match_operand:HI 1 "general_operand" "0,0,0")
+ (match_operand:QI 2 "general_operand" "P,bc,dehl")))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ sarw\t%0, %u2
+ cmp0 %2\; bz $2f\; 1: sarw\t%0, 1 \;dec %2 \;bnz $1b\;2:
+ inc %2\;dec %2\;bz $2f\;1: sarw\t%0, 1\;dec %2\;bnz $1b\;2:"
+)
+
+;;----------
+
+(define_insn "*lshrqi3_real"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=abc,a,a")
+ (lshiftrt:QI (match_operand:QI 1 "general_operand" "0,0,0")
+ (match_operand:QI 2 "general_operand" "Int3,bc,dehl")))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ shr\t%0, %u2
+ cmp0 %2\; bz $2f\; 1: shr\t%0, 1 \;dec %2 \;bnz $1b\;2:
+ inc %2\;dec %2\;bz $2f\;1: shr\t%0, 1\;dec %2\;bnz $1b\;2:"
+)
+
+(define_insn "*lshrhi3_real"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=AB,A,A")
+ (lshiftrt:HI (match_operand:HI 1 "general_operand" "0,0,0")
+ (match_operand:QI 2 "general_operand" "P,bc,dehl")))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ shrw\t%0, %u2
+ cmp0 %2\; bz $2f\; 1: shrw\t%0, 1 \;dec %2 \;bnz $1b\;2:
+ inc %2\;dec %2\;bz $2f\;1: shrw\t%0, 1\;dec %2\;bnz $1b\;2:"
+)
+
+;;---------- Branching ------------------------
+
+(define_insn "*indirect_jump_real"
+ [(set (pc)
+ (match_operand:HI 0 "nonimmediate_operand" "A"))]
+ "rl78_real_insns_ok ()"
+ "br\t%0"
+)
+
+(define_insn "jump"
+ [(set (pc)
+ (label_ref (match_operand 0 "" "")))]
+ ""
+ ;; $rel8, $!rel16, !abs16, !!abs20
+ "br\t!!%0"
+)
+
+(define_insn "*call_real"
+ [(call (match_operand:HI 0 "memory_operand" "Wab,Wca")
+ (match_operand 1 "" ""))]
+ "rl78_real_insns_ok ()"
+ "@
+ call\t!!%A0
+ call\t%A0"
+ )
+
+(define_insn "*call_value_real"
+ [(set (match_operand 0 "register_operand" "=v,v")
+ (call (match_operand:HI 1 "memory_operand" "Wab,Wca")
+ (match_operand 2 "" "")))]
+ "rl78_real_insns_ok ()"
+ "@
+ call\t!!%A1
+ call\t%A1"
+ )
+
+(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")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ "rl78_real_insns_ok ()"
+ "@
+ cmp0\t%1 \;sk%c0 \;br\t!!%3
+ cmp\t%1, %2 \;sk%c0 \;br\t!!%3
+ cmp\t%1, %2 \;sk%c0 \;br\t!!%3
+ cmp\t%1, %2 \;sk%c0 \;br\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")
+ (match_operand:HI 2 "general_operand" "iBDTWhlWh1")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ "rl78_real_insns_ok ()"
+ "cmpw\t%1, %2 \;sk%c0 \;br\t!!%3"
+ )
diff --git a/gcc/config/rl78/rl78-virt.md b/gcc/config/rl78/rl78-virt.md
new file mode 100644
index 00000000000..bd224160cd9
--- /dev/null
+++ b/gcc/config/rl78/rl78-virt.md
@@ -0,0 +1,259 @@
+;; Machine Description for Renesas RL78 processors
+;; 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/>.
+
+;; In this MD file, we define those insn patterns that involve
+;; registers, where such registers are virtual until allocated to a
+;; physical register. All of these insns need to be conditional on
+;; rl78_virt_insns_ok () being true.
+
+;; This tells the physical register allocator what method to use to
+;; allocate registers. Basically, this defines the template of the
+;; instruction - op1 is of the form "a = op(b)", op2 is "a = b op c"
+;; etc.
+
+(define_attr "valloc" "op1,op2,ro1,cmp,umul,macax"
+ (const_string "op2"))
+
+;;---------- Moving ------------------------
+
+(define_insn "*movqi_virt"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=vY,v,Wfr")
+ (match_operand 1 "general_operand" "vInt8JY,Wfr,vInt8J"))]
+ "rl78_virt_insns_ok ()"
+ "v.mov %0, %1"
+ [(set_attr "valloc" "op1")]
+)
+
+(define_insn "*movhi_virt"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=vYS,v,Wfr")
+ (match_operand:HI 1 "general_operand" "viYS,Wfr,v"))]
+ "rl78_virt_insns_ok ()"
+ "v.movw %0, %1"
+ [(set_attr "valloc" "op1")]
+)
+
+;;---------- Conversions ------------------------
+
+(define_insn "*zero_extendqihi2_virt"
+ [(set (match_operand:HI 0 "rl78_nonfar_nonimm_operand" "=vm")
+ (zero_extend:HI (match_operand:QI 1 "general_operand" "vim")))]
+ "rl78_virt_insns_ok ()"
+ "v.zero_extend\t%0, %1"
+ [(set_attr "valloc" "op1")]
+ )
+
+(define_insn "*extendqihi2_virt"
+ [(set (match_operand:HI 0 "rl78_nonfar_nonimm_operand" "=vm")
+ (sign_extend:HI (match_operand:QI 1 "general_operand" "vim")))]
+ "rl78_virt_insns_ok ()"
+ "v.sign_extend\t%0, %1"
+ [(set_attr "valloc" "op1")]
+ )
+
+;;---------- Arithmetic ------------------------
+
+(define_insn "*add<mode>3_virt"
+ [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vY,S")
+ (plus:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "viY,0")
+ (match_operand:QHI 2 "general_operand" "vim,i")))
+ ]
+ "rl78_virt_insns_ok ()"
+ "v.add\t%0, %1, %2"
+)
+
+(define_insn "*sub<mode>3_virt"
+ [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vm,S")
+ (minus:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim,0")
+ (match_operand:QHI 2 "general_operand" "vim,i")))
+ ]
+ "rl78_virt_insns_ok ()"
+ "v.sub\t%0, %1, %2"
+)
+
+(define_insn "*umulhi3_shift_virt"
+ [(set (match_operand:HI 0 "register_operand" "=vm")
+ (mult:HI (match_operand:HI 1 "rl78_nonfar_operand" "%vim")
+ (match_operand:HI 2 "rl78_24_operand" "Ni")))]
+ "rl78_virt_insns_ok ()"
+ "v.mulu\t%0, %1, %2"
+ [(set_attr "valloc" "umul")]
+)
+
+(define_insn "*umulqihi3_virt"
+ [(set (match_operand:HI 0 "register_operand" "=vm")
+ (mult:HI (zero_extend:HI (match_operand:QI 1 "rl78_nonfar_operand" "%vim"))
+ (zero_extend:HI (match_operand:QI 2 "general_operand" "vim"))))]
+ "rl78_virt_insns_ok ()"
+ "v.mulu\t%0, %2"
+ [(set_attr "valloc" "umul")]
+)
+
+(define_insn "*andqi3_virt"
+ [(set (match_operand:QI 0 "rl78_nonfar_nonimm_operand" "=vm")
+ (and:QI (match_operand:QI 1 "rl78_nonfar_operand" "vim")
+ (match_operand:QI 2 "general_operand" "vim")))
+ ]
+ "rl78_virt_insns_ok ()"
+ "v.and\t%0, %1, %2"
+)
+
+(define_insn "*iorqi3_virt"
+ [(set (match_operand:QI 0 "rl78_nonfar_nonimm_operand" "=vm")
+ (ior:QI (match_operand:QI 1 "rl78_nonfar_operand" "vim")
+ (match_operand:QI 2 "general_operand" "vim")))
+ ]
+ "rl78_virt_insns_ok ()"
+ "v.or\t%0, %1, %2"
+)
+
+(define_insn "*xor3_virt"
+ [(set (match_operand:QI 0 "rl78_nonfar_nonimm_operand" "=v,vm,m")
+ (xor:QI (match_operand:QI 1 "rl78_nonfar_operand" "%0,vm,vm")
+ (match_operand 2 "general_operand" "i,vm,vim")))
+ ]
+ "rl78_virt_insns_ok ()"
+ "v.xor\t%0, %1, %2"
+)
+
+;;---------- Shifts ------------------------
+
+(define_insn "*ashl<mode>3_virt"
+ [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vm")
+ (ashift:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim")
+ (match_operand:QI 2 "general_operand" "vim")))
+ ]
+ "rl78_virt_insns_ok ()"
+ "v.shl\t%0, %1, %2"
+)
+
+(define_insn "*ashr<mode>3_virt"
+ [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vm")
+ (ashiftrt:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim")
+ (match_operand:QI 2 "general_operand" "vim")))
+ ]
+ "rl78_virt_insns_ok ()"
+ "v.sar\t%0, %1, %2"
+)
+
+(define_insn "*lshr<mode>3_virt"
+ [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vm")
+ (lshiftrt:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim")
+ (match_operand:QI 2 "general_operand" "vim")))
+ ]
+ "rl78_virt_insns_ok ()"
+ "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")))
+ ]
+ ""
+ "@
+ ; 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"
+ [(set_attr "valloc" "macax")]
+)
+
+;;---------- Branching ------------------------
+
+(define_insn "*indirect_jump_virt"
+ [(set (pc)
+ (match_operand:HI 0 "nonimmediate_operand" "vm"))]
+ "rl78_virt_insns_ok ()"
+ "v.br\t%0"
+ [(set_attr "valloc" "ro1")]
+)
+
+(define_insn "*call_virt"
+ [(call (match_operand:HI 0 "memory_operand" "Wab,Wcv")
+ (match_operand 1 "" ""))]
+ "rl78_virt_insns_ok ()"
+ "v.call\t%0"
+ [(set_attr "valloc" "ro1")]
+ )
+
+(define_insn "*call_value_virt"
+ [(set (match_operand 0 "register_operand" "=v,v")
+ (call (match_operand:HI 1 "memory_operand" "Wab,Wcv")
+ (match_operand 2 "" "")))]
+ "rl78_virt_insns_ok ()"
+ "v.call\t%1"
+ [(set_attr "valloc" "op1")]
+ )
+
+(define_insn "*cbranchqi4_virt"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator_real"
+ [(match_operand:QI 1 "general_operand" "vim")
+ (match_operand:QI 2 "general_operand" "vim")])
+ (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 "*cbranchhi4_virt"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator_real"
+ [(match_operand:HI 1 "general_operand" "vim")
+ (match_operand:HI 2 "general_operand" "vim")])
+ (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")]
+ )
+
+;;---------- Peepholes ------------------------
+
+(define_peephole2
+ [(set (match_operand:QI 0 "" "")
+ (match_operand:QI 1 "" ""))
+ (set (match_operand:QI 2 "" "")
+ (match_operand:QI 3 "" ""))]
+ "rl78_peep_movhi_p (operands)"
+ [(set (match_dup 4)
+ (match_dup 5))]
+ "rl78_setup_peep_movhi (operands);"
+ )
+
+(define_peephole2
+ [(set (reg:QI A_REG)
+ (match_operand:QI 1 "" ""))
+ (set (match_operand:QI 0 "" "")
+ (reg:QI A_REG))
+ (set (reg:QI A_REG)
+ (match_operand:QI 3 "" ""))
+ (set (match_operand:QI 2 "" "")
+ (reg:QI A_REG))
+ ]
+ "rl78_peep_movhi_p (operands)"
+ [(set (reg:HI AX_REG)
+ (match_dup 5))
+ (set (match_dup 4)
+ (reg:HI AX_REG))
+ ]
+ "rl78_setup_peep_movhi (operands);"
+ )
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
new file mode 100644
index 00000000000..460538eb131
--- /dev/null
+++ b/gcc/config/rl78/rl78.c
@@ -0,0 +1,2705 @@
+/* Subroutines used for code generation on Renesas RL78 processors.
+ 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/>. */
+
+#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 "rl78-protos.h"
+#include "tree-pass.h"
+
+static inline bool is_interrupt_func (const_tree decl);
+static inline bool is_brk_interrupt_func (const_tree decl);
+static void rl78_reorg (void);
+
+
+/* Debugging statements are tagged with DEBUG0 only so that they can
+ be easily enabled individually, by replacing the '0' with '1' as
+ needed. */
+#define DEBUG0 0
+#define DEBUG1 1
+
+/* REGISTER_NAMES has the names for individual 8-bit registers, but
+ these have the names we need to use when referring to 16-bit
+ register pairs. */
+static const char * const word_regnames[] =
+{
+ "ax", "AX", "bc", "BC", "de", "DE", "hl", "HL",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ "sp", "ap", "psw", "es", "cs"
+};
+
+struct GTY(()) machine_function
+{
+ /* If set, the rest of the fields have been computed. */
+ int computed;
+ /* Which register pairs need to be pushed in the prologue. */
+ int need_to_push [FIRST_PSEUDO_REGISTER / 2];
+
+ /* These fields describe the frame layout... */
+ /* arg pointer */
+ /* 4 bytes for saved PC */
+ int framesize_regs;
+ /* frame pointer */
+ int framesize_locals;
+ int framesize_outgoing;
+ /* stack pointer */
+ int framesize;
+
+ /* If set, recog is allowed to match against the "real" patterns. */
+ int real_insns_ok;
+ /* If set, recog is allowed to match against the "virtual" patterns. */
+ int virt_insns_ok;
+ /* Set if the current function needs to clean up any trampolines. */
+ int trampolines_used;
+};
+
+/* This is our init_machine_status, as set in
+ rl78_option_override. */
+static struct machine_function *
+rl78_init_machine_status (void)
+{
+ struct machine_function *m;
+
+ m = ggc_alloc_cleared_machine_function ();
+ m->virt_insns_ok = 1;
+
+ return m;
+}
+
+/* Returns whether to run the devirtualization pass. */
+static bool
+devirt_gate (void)
+{
+ return true;
+}
+
+/* Runs the devirtualization pass. */
+static unsigned int
+devirt_pass (void)
+{
+ rl78_reorg ();
+ return 0;
+}
+
+/* This pass converts virtual instructions using virtual registers, to
+ real instructions using real registers. Rather than run it as
+ reorg, we reschedule it before vartrack to help with debugging. */
+static struct opt_pass rl78_devirt_pass =
+{
+ RTL_PASS,
+ "devirt",
+ devirt_gate,
+ devirt_pass,
+ NULL,
+ NULL,
+ 212,
+ TV_MACH_DEP,
+ 0, 0, 0,
+ 0,
+ TODO_dump_func
+};
+
+static struct register_pass_info rl78_devirt_info =
+{
+ & rl78_devirt_pass,
+ "vartrack",
+ 1,
+ PASS_POS_INSERT_BEFORE
+};
+
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START rl78_asm_file_start
+
+static void
+rl78_asm_file_start (void)
+{
+ int 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);
+ }
+
+ register_pass (& rl78_devirt_info);
+}
+
+
+#undef TARGET_OPTION_OVERRIDE
+#define TARGET_OPTION_OVERRIDE rl78_option_override
+
+static void
+rl78_option_override (void)
+{
+ flag_omit_frame_pointer = 1;
+ flag_no_function_cse = 1;
+ flag_split_wide_types = 0;
+
+ init_machine_status = rl78_init_machine_status;
+}
+
+/* Most registers are 8 bits. Some are 16 bits because, for example,
+ gcc doesn't like dealing with $FP as a register pair. This table
+ maps register numbers to size in bytes. */
+static const int register_sizes[] =
+{
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 1, 1, 1
+};
+
+/* Predicates used in the MD patterns. This one is true when virtual
+ insns may be matched, which typically means before (or during) the
+ devirt pass. */
+bool
+rl78_virt_insns_ok (void)
+{
+ if (cfun)
+ return cfun->machine->virt_insns_ok;
+ return true;
+}
+
+/* Predicates used in the MD patterns. This one is true when real
+ insns may be matched, which typically means after (or during) the
+ devirt pass. */
+bool
+rl78_real_insns_ok (void)
+{
+ if (cfun)
+ return cfun->machine->real_insns_ok;
+ return false;
+}
+
+/* Implements HARD_REGNO_NREGS. */
+int
+rl78_hard_regno_nregs (int regno, enum machine_mode mode)
+{
+ int rs = register_sizes[regno];
+ if (rs < 1)
+ rs = 1;
+ return ((GET_MODE_SIZE (mode) + rs - 1) / rs);
+}
+
+/* Implements HARD_REGNO_MODE_OK. */
+int
+rl78_hard_regno_mode_ok (int regno, enum machine_mode mode)
+{
+ int s = GET_MODE_SIZE (mode);
+
+ if (s < 1)
+ return 0;
+ /* These are not to be used by gcc. */
+ if (regno == 23 || regno == ES_REG || regno == CS_REG)
+ return 0;
+ /* $fp can alway sbe accessed as a 16-bit value. */
+ if (regno == FP_REG && s == 2)
+ return 1;
+ if (regno < SP_REG)
+ {
+ /* Since a reg-reg move is really a reg-mem move, we must
+ enforce alignment. */
+ if (s > 1 && (regno % 2))
+ return 0;
+ return 1;
+ }
+ if (s == CC_REGNUM)
+ return (mode == BImode);
+ /* All other registers must be accessed in their natural sizes. */
+ if (s == register_sizes [regno])
+ return 1;
+ return 0;
+}
+
+/* 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. */
+static rtx
+rl78_subreg (enum machine_mode mode, rtx r, enum machine_mode omode, int byte)
+{
+ if (GET_CODE (r) == MEM)
+ return adjust_address (r, mode, byte);
+ else
+ return simplify_gen_subreg (mode, r, omode, byte);
+}
+
+/* Used by movsi. Split SImode moves into two HImode moves, using
+ appropriate patterns for the upper and lower halves of symbols. */
+void
+rl78_expand_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))
+ {
+ emit_move_insn (op02, op12);
+ emit_move_insn (op00, op10);
+ }
+ else
+ {
+ emit_move_insn (op00, op10);
+ emit_move_insn (op02, 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. */
+int
+rl78_force_nonfar_2 (rtx *operands, rtx (*gen)(rtx,rtx))
+{
+ int did = 0;
+ rtx temp_reg = NULL;
+
+ /* FIXME: in the future, be smarter about only doing this if the
+ other operand is also far, assuming the devirtualizer can also
+ handle that. */
+ if (rl78_far_p (operands[0]))
+ {
+ temp_reg = operands[0];
+ operands[0] = gen_reg_rtx (GET_MODE (operands[0]));
+ did = 1;
+ }
+ if (!did)
+ return 0;
+
+ emit_insn (gen (operands[0], operands[1]));
+ if (temp_reg)
+ emit_move_insn (temp_reg, operands[0]);
+ return 1;
+}
+
+/* Likewise, but for three-operand expanders. */
+int
+rl78_force_nonfar_3 (rtx *operands, rtx (*gen)(rtx,rtx,rtx))
+{
+ int did = 0;
+ rtx temp_reg = NULL;
+
+ /* FIXME: Likewise. */
+ if (rl78_far_p (operands[1]))
+ {
+ rtx temp_reg = gen_reg_rtx (GET_MODE (operands[1]));
+ emit_move_insn (temp_reg, operands[1]);
+ operands[1] = temp_reg;
+ did = 1;
+ }
+ if (rl78_far_p (operands[0]))
+ {
+ temp_reg = operands[0];
+ operands[0] = gen_reg_rtx (GET_MODE (operands[0]));
+ did = 1;
+ }
+ if (!did)
+ return 0;
+
+ emit_insn (gen (operands[0], operands[1], operands[2]));
+ if (temp_reg)
+ emit_move_insn (temp_reg, operands[0]);
+ return 1;
+}
+
+#undef TARGET_CAN_ELIMINATE
+#define TARGET_CAN_ELIMINATE rl78_can_eliminate
+
+static bool
+rl78_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to ATTRIBUTE_UNUSED)
+{
+ return true;
+}
+
+/* Returns nonzero if the given register needs to be saved by the
+ current function. */
+static int
+need_to_save (int regno)
+{
+ if (is_interrupt_func (cfun->decl))
+ {
+ if (regno < 8)
+ return 1; /* don't know what devirt will need */
+ if (regno > 23)
+ return 0; /* don't need to save interrupt registers */
+ if (current_function_is_leaf)
+ {
+ return df_regs_ever_live_p (regno);
+ }
+ else
+ return 1;
+ }
+ if (regno == FRAME_POINTER_REGNUM && frame_pointer_needed)
+ return 1;
+ if (fixed_regs[regno])
+ return 0;
+ if (crtl->calls_eh_return)
+ return 1;
+ if (df_regs_ever_live_p (regno)
+ && !call_used_regs[regno])
+ return 1;
+ return 0;
+}
+
+/* We use this to wrap all emitted insns in the prologue. */
+static rtx
+F (rtx x)
+{
+ RTX_FRAME_RELATED_P (x) = 1;
+ return x;
+}
+
+/* Compute all the frame-related fields in our machine_function
+ structure. */
+static void
+rl78_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 < 16; i ++)
+ if (need_to_save (i * 2) || need_to_save (i * 2 + 1))
+ {
+ cfun->machine->need_to_push [i] = 1;
+ cfun->machine->framesize_regs += 2;
+ }
+ else
+ cfun->machine->need_to_push [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);
+}
+
+/* Returns true if the provided function has the specified attribute. */
+static inline bool
+has_func_attr (const_tree decl, const char * func_attr)
+{
+ if (decl == NULL_TREE)
+ decl = current_function_decl;
+
+ return lookup_attribute (func_attr, DECL_ATTRIBUTES (decl)) != NULL_TREE;
+}
+
+/* Returns true if the provided function has the "interrupt" attribute. */
+static inline bool
+is_interrupt_func (const_tree decl)
+{
+ return has_func_attr (decl, "interrupt") || has_func_attr (decl, "brk_interrupt");
+}
+
+/* Returns true if the provided function has the "brk_interrupt" attribute. */
+static inline bool
+is_brk_interrupt_func (const_tree decl)
+{
+ return has_func_attr (decl, "brk_interrupt");
+}
+
+/* Check "interrupt" attributes. */
+static tree
+rl78_handle_func_attribute (tree * node,
+ tree name,
+ tree args,
+ int flags ATTRIBUTE_UNUSED,
+ bool * no_add_attrs)
+{
+ gcc_assert (DECL_P (* node));
+ gcc_assert (args == NULL_TREE);
+
+ 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 and exception
+ handler attributes have been applied to void functions. */
+ return NULL_TREE;
+}
+
+#undef TARGET_ATTRIBUTE_TABLE
+#define TARGET_ATTRIBUTE_TABLE rl78_attribute_table
+
+/* Table of RL78-specific attributes. */
+const struct attribute_spec rl78_attribute_table[] =
+{
+ /* Name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
+ affects_type_identity. */
+ { "interrupt", 0, 0, true, false, false, rl78_handle_func_attribute,
+ false },
+ { "brk_interrupt", 0, 0, true, false, false, rl78_handle_func_attribute,
+ false },
+ { NULL, 0, 0, false, false, false, NULL, false }
+};
+
+
+
+/* Break down an address RTX into its component base/index/addend
+ portions and return TRUE if the address is of a valid form, else
+ FALSE. */
+static bool
+characterize_address (rtx x, rtx *base, rtx *index, rtx *addend)
+{
+ *base = NULL_RTX;
+ *index = NULL_RTX;
+ *addend = NULL_RTX;
+
+ if (GET_CODE (x) == REG)
+ {
+ *base = x;
+ return true;
+ }
+
+ /* We sometimes get these without the CONST wrapper */
+ if (GET_CODE (x) == PLUS
+ && GET_CODE (XEXP (x, 0)) == SYMBOL_REF
+ && GET_CODE (XEXP (x, 1)) == CONST_INT)
+ {
+ *addend = x;
+ return true;
+ }
+
+ if (GET_CODE (x) == PLUS)
+ {
+ *base = XEXP (x, 0);
+ x = XEXP (x, 1);
+
+ if (GET_CODE (*base) != REG
+ && GET_CODE (x) == REG)
+ {
+ rtx tmp = *base;
+ *base = x;
+ x = tmp;
+ }
+
+ if (GET_CODE (*base) != REG)
+ return false;
+
+ if (GET_CODE (x) == ZERO_EXTEND
+ && GET_CODE (XEXP (x, 0)) == REG)
+ {
+ *index = XEXP (x, 0);
+ return false;
+ }
+ }
+
+ switch (GET_CODE (x))
+ {
+ case PLUS:
+ if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
+ && GET_CODE (XEXP (x, 0)) == CONST_INT)
+ {
+ *addend = x;
+ return true;
+ }
+ /* fall through */
+ case MEM:
+ case REG:
+ return false;
+
+ case CONST:
+ case SYMBOL_REF:
+ case CONST_INT:
+ *addend = x;
+ return true;
+
+ default:
+ return false;
+ }
+
+ return false;
+}
+
+/* Used by the Whb constraint. Match addresses that use HL+B or HL+C
+ addressing. */
+bool
+rl78_hl_b_c_addr_p (rtx op)
+{
+ rtx hl, bc;
+
+ if (GET_CODE (op) != PLUS)
+ return false;
+ hl = XEXP (op, 0);
+ bc = XEXP (op, 1);
+ if (GET_CODE (hl) == ZERO_EXTEND)
+ {
+ rtx tmp = hl;
+ hl = bc;
+ bc = tmp;
+ }
+ if (GET_CODE (hl) != REG)
+ return false;
+ if (GET_CODE (bc) != ZERO_EXTEND)
+ return false;
+ bc = XEXP (bc, 0);
+ if (GET_CODE (bc) != REG)
+ return false;
+ if (REGNO (hl) != HL_REG)
+ return false;
+ if (REGNO (bc) != B_REG && REGNO (bc) != C_REG)
+ return false;
+
+ return true;
+}
+
+#define REG_IS(r, regno) (((r) == (regno)) || ((r) >= FIRST_PSEUDO_REGISTER && !(strict)))
+
+/* Used in various constraints and predicates to match operands in the
+ "far" address space. */
+int
+rl78_far_p (rtx x)
+{
+ if (GET_CODE (x) != MEM)
+ 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);
+#endif
+ return MEM_ADDR_SPACE (x) == ADDR_SPACE_FAR;
+}
+
+/* Return the appropriate mode for a named address pointer. */
+#undef TARGET_ADDR_SPACE_POINTER_MODE
+#define TARGET_ADDR_SPACE_POINTER_MODE rl78_addr_space_pointer_mode
+static enum machine_mode
+rl78_addr_space_pointer_mode (addr_space_t addrspace)
+{
+ switch (addrspace)
+ {
+ case ADDR_SPACE_GENERIC:
+ return HImode;
+ case ADDR_SPACE_FAR:
+ return SImode;
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* Return the appropriate mode for a named address address. */
+#undef TARGET_ADDR_SPACE_ADDRESS_MODE
+#define TARGET_ADDR_SPACE_ADDRESS_MODE rl78_addr_space_address_mode
+static enum machine_mode
+rl78_addr_space_address_mode (addr_space_t addrspace)
+{
+ switch (addrspace)
+ {
+ case ADDR_SPACE_GENERIC:
+ return HImode;
+ case ADDR_SPACE_FAR:
+ return SImode;
+ default:
+ gcc_unreachable ();
+ }
+}
+
+#undef TARGET_LEGITIMATE_CONSTANT_P
+#define TARGET_LEGITIMATE_CONSTANT_P rl78_is_legitimate_constant
+
+static bool
+rl78_is_legitimate_constant (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED)
+{
+ return true;
+}
+
+#undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
+#define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P rl78_as_legitimate_address
+
+bool
+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;
+
+ if (as == ADDR_SPACE_GENERIC
+ && GET_MODE (x) == SImode)
+ return false;
+
+ if (! characterize_address (x, &base, &index, &addend))
+ return false;
+
+ if (base && index)
+ {
+ int ir = REGNO (index);
+ int br = REGNO (base);
+
+#define OK(test, debug) if (test) { /*fprintf(stderr, "%d: OK %s\n", __LINE__, debug);*/ return true; }
+ OK (REG_IS (br, HL_REG) && REG_IS (ir, B_REG), "[hl+b]");
+ OK (REG_IS (br, HL_REG) && REG_IS (ir, C_REG), "[hl+c]");
+ return false;
+ }
+
+ if (strict && base && GET_CODE (base) == REG && REGNO (base) >= FIRST_PSEUDO_REGISTER)
+ return false;
+
+ return true;
+}
+
+/* Determine if one named address space is a subset of another. */
+#undef TARGET_ADDR_SPACE_SUBSET_P
+#define TARGET_ADDR_SPACE_SUBSET_P rl78_addr_space_subset_p
+static bool
+rl78_addr_space_subset_p (addr_space_t subset, addr_space_t superset)
+{
+ gcc_assert (subset == ADDR_SPACE_GENERIC || subset == ADDR_SPACE_FAR);
+ gcc_assert (superset == ADDR_SPACE_GENERIC || superset == ADDR_SPACE_FAR);
+
+ if (subset == superset)
+ return true;
+
+ else
+ return (subset == ADDR_SPACE_GENERIC && superset == ADDR_SPACE_FAR);
+}
+
+#undef TARGET_ADDR_SPACE_CONVERT
+#define TARGET_ADDR_SPACE_CONVERT rl78_addr_space_convert
+/* Convert from one address space to another. */
+static rtx
+rl78_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;
+
+ gcc_assert (from_as == ADDR_SPACE_GENERIC || from_as == ADDR_SPACE_FAR);
+ gcc_assert (to_as == ADDR_SPACE_GENERIC || to_as == ADDR_SPACE_FAR);
+
+ if (to_as == ADDR_SPACE_GENERIC && from_as == ADDR_SPACE_FAR)
+ {
+ /* This is unpredictable, as we're truncating off usable address
+ bits. */
+
+ result = gen_reg_rtx (HImode);
+ emit_move_insn (result, simplify_subreg (HImode, op, SImode, 0));
+ return result;
+ }
+ else if (to_as == ADDR_SPACE_FAR && from_as == ADDR_SPACE_GENERIC)
+ {
+ /* 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;
+ }
+ else
+ gcc_unreachable ();
+}
+
+/* Implements REGNO_MODE_CODE_OK_FOR_BASE_P. */
+bool
+rl78_regno_mode_code_ok_for_base_p (int regno, enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t address_space ATTRIBUTE_UNUSED,
+ int outer_code ATTRIBUTE_UNUSED, int index_code)
+{
+ if (regno < 24 && regno >= 16)
+ return true;
+ if (index_code == REG)
+ return (regno == HL_REG);
+ if (regno == C_REG || regno == B_REG || regno == E_REG || regno == L_REG)
+ return true;
+ return false;
+}
+
+/* Implements MODE_CODE_BASE_REG_CLASS. */
+enum reg_class
+rl78_mode_code_base_reg_class (enum machine_mode mode ATTRIBUTE_UNUSED,
+ addr_space_t address_space ATTRIBUTE_UNUSED,
+ int outer_code ATTRIBUTE_UNUSED,
+ int index_code ATTRIBUTE_UNUSED)
+{
+ return V_REGS;
+}
+
+/* Implements INITIAL_ELIMINATION_OFFSET. The frame layout is
+ described in the machine_Function struct definition, above. */
+int
+rl78_initial_elimination_offset (int from, int to)
+{
+ int rv = 0; /* as if arg to arg */
+
+ rl78_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;
+ rv += 4;
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ switch (from)
+ {
+ case FRAME_POINTER_REGNUM:
+ rv -= 4;
+ rv -= cfun->machine->framesize_regs;
+ case ARG_POINTER_REGNUM:
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ return rv;
+}
+
+/* Expand the function prologue (from the prologue pattern). */
+void
+rl78_expand_prologue (void)
+{
+ int i, fs;
+ rtx sp = gen_rtx_REG (HImode, STACK_POINTER_REGNUM);
+ int rb = 0;
+
+ if (!cfun->machine->computed)
+ rl78_compute_frame_info ();
+
+ for (i = 0; i < 16; i++)
+ if (cfun->machine->need_to_push [i])
+ {
+ 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))));
+ }
+ 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)));
+
+ fs = cfun->machine->framesize_locals + cfun->machine->framesize_outgoing;
+ while (fs > 0)
+ {
+ int fs_byte = (fs > 254) ? 254 : fs;
+ F (emit_insn (gen_subhi3 (sp, sp, GEN_INT (fs_byte))));
+ fs -= fs_byte;
+ }
+}
+
+/* Expand the function epilogue (from the epilogue pattern). */
+void
+rl78_expand_epilogue (void)
+{
+ int i, fs;
+ rtx sp = gen_rtx_REG (HImode, STACK_POINTER_REGNUM);
+ int rb = 0;
+
+ if (frame_pointer_needed)
+ {
+ emit_move_insn (gen_rtx_REG (HImode, STACK_POINTER_REGNUM),
+ gen_rtx_REG (HImode, FRAME_POINTER_REGNUM));
+ }
+ else
+ {
+ fs = cfun->machine->framesize_locals + cfun->machine->framesize_outgoing;
+ while (fs > 0)
+ {
+ int fs_byte = (fs > 254) ? 254 : fs;
+
+ emit_insn (gen_addhi3 (sp, sp, GEN_INT (fs_byte)));
+ fs -= fs_byte;
+ }
+ }
+
+ for (i = 15; i >= 0; i--)
+ if (cfun->machine->need_to_push [i])
+ {
+ 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)));
+ }
+
+ if (rb != 0)
+ emit_insn (gen_sel_rb (GEN_INT (0)));
+
+ if (cfun->machine->trampolines_used)
+ emit_insn (gen_trampoline_uninit ());
+
+ if (is_brk_interrupt_func (cfun->decl))
+ emit_jump_insn (gen_brk_interrupt_return ());
+ else if (is_interrupt_func (cfun->decl))
+ emit_jump_insn (gen_interrupt_return ());
+ else
+ emit_jump_insn (gen_return ());
+}
+
+/* Likewise, for exception handlers. */
+void
+rl78_expand_eh_epilogue (rtx x ATTRIBUTE_UNUSED)
+{
+ /* FIXME - replace this with an indirect jump with stack adjust. */
+ emit_jump_insn (gen_return ());
+}
+
+#undef TARGET_ASM_FUNCTION_PROLOGUE
+#define TARGET_ASM_FUNCTION_PROLOGUE rl78_start_function
+
+/* We don't use this to actually emit the function prologue. We use
+ this to insert a comment in the asm file describing the
+ function. */
+static void
+rl78_start_function (FILE *file, HOST_WIDE_INT hwi_local ATTRIBUTE_UNUSED)
+{
+ int i;
+
+ if (cfun->machine->framesize == 0)
+ return;
+ fprintf (file, "\t; start of function\n");
+
+ if (cfun->machine->framesize_regs)
+ {
+ fprintf (file, "\t; push %d:", cfun->machine->framesize_regs);
+ for (i = 0; i < 16; i ++)
+ if (cfun->machine->need_to_push[i])
+ fprintf (file, " %s", word_regnames[i*2]);
+ fprintf(file, "\n");
+ }
+
+ if (frame_pointer_needed)
+ fprintf (file, "\t; $fp points here (r22)\n");
+
+ if (cfun->machine->framesize_locals)
+ fprintf (file, "\t; locals: %d byte%s\n", cfun->machine->framesize_locals,
+ cfun->machine->framesize_locals == 1 ? "" : "s");
+
+ if (cfun->machine->framesize_outgoing)
+ fprintf (file, "\t; outgoing: %d byte%s\n", cfun->machine->framesize_outgoing,
+ cfun->machine->framesize_outgoing == 1 ? "" : "s");
+}
+
+/* Return an RTL describing where a function return value of type RET_TYPE
+ is held. */
+
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE rl78_function_value
+
+static rtx
+rl78_function_value (const_tree ret_type,
+ const_tree fn_decl_or_type ATTRIBUTE_UNUSED,
+ bool outgoing ATTRIBUTE_UNUSED)
+{
+ enum machine_mode mode = TYPE_MODE (ret_type);
+
+ return gen_rtx_REG (mode, 8);
+}
+
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE rl78_promote_function_mode
+
+static enum machine_mode
+rl78_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED,
+ const_tree funtype ATTRIBUTE_UNUSED, int for_return ATTRIBUTE_UNUSED)
+{
+ return mode;
+}
+
+/* Return an RTL expression describing the register holding a function
+ parameter of mode MODE and type TYPE or NULL_RTX if the parameter should
+ be passed on the stack. CUM describes the previous parameters to the
+ function and NAMED is false if the parameter is part of a variable
+ parameter list, or the last named parameter before the start of a
+ variable parameter list. */
+
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG rl78_function_arg
+
+static rtx
+rl78_function_arg (cumulative_args_t cum_v ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED,
+ bool named ATTRIBUTE_UNUSED)
+{
+ return NULL_RTX;
+}
+
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE rl78_function_arg_advance
+
+static void
+rl78_function_arg_advance (cumulative_args_t cum_v, enum machine_mode mode, const_tree type,
+ bool named ATTRIBUTE_UNUSED)
+{
+ int rounded_size;
+ CUMULATIVE_ARGS * cum = get_cumulative_args (cum_v);
+
+ rounded_size = ((mode == BLKmode)
+ ? int_size_in_bytes (type) : GET_MODE_SIZE (mode));
+ if (rounded_size & 1)
+ rounded_size ++;
+ (*cum) += rounded_size;
+}
+
+#undef TARGET_FUNCTION_ARG_BOUNDARY
+#define TARGET_FUNCTION_ARG_BOUNDARY rl78_function_arg_boundary
+
+static unsigned int
+rl78_function_arg_boundary (enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED)
+{
+ return 16;
+}
+
+/* Supported modifier letters:
+
+ A - address of a MEM
+ S - SADDR form of a real register
+ 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)
+
+ 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)
+
+*/
+
+/* Implements the bulk of rl78_print_operand, below. We do it this
+ way because we need to test for a constant at the top level and
+ insert the '#', but not test for it anywhere else as we recurse
+ down into the operand. */
+static void
+rl78_print_operand_1 (FILE * file, rtx op, int letter)
+{
+ int need_paren;
+
+ switch (GET_CODE (op))
+ {
+ case MEM:
+ if (letter == 'A')
+ rl78_print_operand_1 (file, XEXP (op, 0), letter);
+ else
+ {
+ if (rl78_far_p (op))
+ fprintf(file, "es:");
+ if (letter == 'H')
+ {
+ op = adjust_address (op, HImode, 2);
+ letter = 0;
+ }
+ if (letter == 'h')
+ {
+ op = adjust_address (op, HImode, 0);
+ letter = 0;
+ }
+ if (letter == 'Q')
+ {
+ op = adjust_address (op, QImode, 1);
+ letter = 0;
+ }
+ if (letter == 'q')
+ {
+ op = adjust_address (op, QImode, 0);
+ letter = 0;
+ }
+ if (letter == 'e')
+ {
+ op = adjust_address (op, QImode, 2);
+ letter = 0;
+ }
+ if (CONSTANT_P (XEXP (op, 0)))
+ {
+ 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, "!");
+ rl78_print_operand_1 (file, XEXP (op, 0), letter);
+ }
+ else if (GET_CODE (XEXP (op, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (op, 0), 0)) == REG
+ && REGNO (XEXP (XEXP (op, 0), 0)) == 2)
+ {
+ rl78_print_operand_1 (file, XEXP (XEXP (op, 0), 1), 'u');
+ fprintf(file, "[");
+ rl78_print_operand_1 (file, XEXP (XEXP (op, 0), 0), 0);
+ fprintf(file, "]");
+ }
+ else
+ {
+ fprintf(file, "[");
+ rl78_print_operand_1 (file, XEXP (op, 0), letter);
+ fprintf(file, "]");
+ }
+ }
+ break;
+
+ case REG:
+ if (letter == 'Q')
+ fprintf (file, "%s", reg_names [REGNO (op) | 1]);
+ else if (letter == 'H')
+ fprintf (file, "%s", reg_names [REGNO (op) + 2]);
+ else if (letter == 'q')
+ fprintf (file, "%s", reg_names [REGNO (op) & ~1]);
+ else if (letter == 'e')
+ fprintf (file, "%s", reg_names [REGNO (op) + 2]);
+ else if (letter == 'S')
+ fprintf (file, "0x%x", 0xffef8 + REGNO (op));
+ else if (GET_MODE (op) == HImode
+ && ! (REGNO (op) & ~0xfe))
+ {
+ if (letter == 'v')
+ fprintf (file, "%s", word_regnames [REGNO (op) % 8]);
+ else
+ fprintf (file, "%s", word_regnames [REGNO (op)]);
+ }
+ else
+ fprintf (file, "%s", reg_names [REGNO (op)]);
+ break;
+
+ case CONST_INT:
+ if (letter == 'Q')
+ fprintf (file, "%ld", INTVAL (op) >> 8);
+ else if (letter == 'H')
+ fprintf (file, "%ld", INTVAL (op) >> 16);
+ else if (letter == 'q')
+ fprintf (file, "%ld", INTVAL (op) & 0xff);
+ else if (letter == 'h')
+ fprintf (file, "%ld", INTVAL (op) & 0xffff);
+ else if (letter == 'e')
+ fprintf (file, "%ld", (INTVAL (op) >> 16) & 0xff);
+ else if (letter == 'm')
+ fprintf (file, "%ld", - INTVAL (op));
+ else
+ fprintf(file, "%ld", INTVAL (op));
+ break;
+
+ case CONST:
+ rl78_print_operand_1 (file, XEXP (op, 0), letter);
+ break;
+
+ case ZERO_EXTRACT:
+ {
+ int bits = INTVAL (XEXP (op, 1));
+ int ofs = INTVAL (XEXP (op, 2));
+ if (bits == 16 && ofs == 0)
+ fprintf (file, "%%lo16(");
+ else if (bits == 16 && ofs == 16)
+ fprintf (file, "%%hi16(");
+ else if (bits == 8 && ofs == 16)
+ fprintf (file, "%%hi8(");
+ else
+ gcc_unreachable ();
+ rl78_print_operand_1 (file, XEXP (op, 0), 0);
+ fprintf (file, ")");
+ }
+ break;
+
+ case ZERO_EXTEND:
+ if (GET_CODE (XEXP (op, 0)) == REG)
+ fprintf (file, "%s", reg_names [REGNO (XEXP (op, 0))]);
+ else
+ print_rtl (file, op);
+ break;
+
+ case PLUS:
+ need_paren = 0;
+ if (letter == 'H')
+ {
+ fprintf (file, "%%hi16(");
+ need_paren = 1;
+ letter = 0;
+ }
+ if (letter == 'h')
+ {
+ fprintf (file, "%%lo16(");
+ need_paren = 1;
+ letter = 0;
+ }
+ if (letter == 'e')
+ {
+ fprintf (file, "%%hi8(");
+ need_paren = 1;
+ letter = 0;
+ }
+ if (letter == 'q' || letter == 'Q')
+ output_operand_lossage ("q/Q modifiers invalid for symbol references");
+
+ if (GET_CODE (XEXP (op, 0)) == ZERO_EXTEND)
+ {
+ rl78_print_operand_1 (file, XEXP (op, 1), letter);
+ fprintf (file, "+");
+ rl78_print_operand_1 (file, XEXP (op, 0), letter);
+ }
+ else
+ {
+ rl78_print_operand_1 (file, XEXP (op, 0), letter);
+ fprintf (file, "+");
+ rl78_print_operand_1 (file, XEXP (op, 1), letter);
+ }
+ if (need_paren)
+ fprintf (file, ")");
+ break;
+
+ case SYMBOL_REF:
+ need_paren = 0;
+ if (letter == 'H')
+ {
+ fprintf (file, "%%hi16(");
+ need_paren = 1;
+ letter = 0;
+ }
+ if (letter == 'h')
+ {
+ fprintf (file, "%%lo16(");
+ need_paren = 1;
+ letter = 0;
+ }
+ if (letter == 'e')
+ {
+ fprintf (file, "%%hi8(");
+ need_paren = 1;
+ letter = 0;
+ }
+ if (letter == 'q' || letter == 'Q')
+ output_operand_lossage ("q/Q modifiers invalid for symbol references");
+
+ output_addr_const (file, op);
+ if (need_paren)
+ fprintf (file, ")");
+ break;
+
+ case CODE_LABEL:
+ case LABEL_REF:
+ output_asm_label (op);
+ break;
+
+ case LTU:
+ fprintf (file, letter == 'c' ? "nc" : "c");
+ break;
+ case LEU:
+ fprintf (file, letter == 'c' ? "h" : "nh");
+ break;
+ case GEU:
+ fprintf (file, letter == 'c' ? "c" : "nc");
+ break;
+ case GTU:
+ fprintf (file, letter == 'c' ? "nh" : "h");
+ break;
+ case EQ:
+ fprintf (file, letter == 'c' ? "nz" : "z");
+ break;
+ case NE:
+ fprintf (file, letter == 'c' ? "z" : "nz");
+ break;
+
+ default:
+ fprintf (file, "(%s)", GET_RTX_NAME (GET_CODE (op)));
+ break;
+ }
+}
+
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND rl78_print_operand
+
+static void
+rl78_print_operand (FILE * file, rtx op, int letter)
+{
+ if (CONSTANT_P (op) && letter != 'u')
+ fprintf (file, "#");
+ rl78_print_operand_1 (file, op, letter);
+}
+
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT rl78_trampoline_init
+
+/* Note that the RL78's addressing makes it very difficult to do
+ trampolines on the stack. So, libgcc has a small pool of
+ trampolines from which one is allocated to this task. */
+static void
+rl78_trampoline_init (rtx m_tramp, tree fndecl, rtx static_chain)
+{
+ rtx mov_addr, thunk_addr;
+ rtx function = XEXP (DECL_RTL (fndecl), 0);
+
+ mov_addr = adjust_address (m_tramp, HImode, 0);
+ thunk_addr = gen_reg_rtx (HImode);
+
+ function = force_reg (HImode, function);
+ static_chain = force_reg (HImode, static_chain);
+
+ emit_insn (gen_trampoline_init (thunk_addr, function, static_chain));
+ emit_move_insn (mov_addr, thunk_addr);
+
+ cfun->machine->trampolines_used = 1;
+}
+
+#undef TARGET_TRAMPOLINE_ADJUST_ADDRESS
+#define TARGET_TRAMPOLINE_ADJUST_ADDRESS rl78_trampoline_adjust_address
+
+static rtx
+rl78_trampoline_adjust_address (rtx m_tramp)
+{
+ rtx x = gen_rtx_MEM (HImode, m_tramp);
+ return x;
+}
+
+/* Expander for cbranchqi4 and cbranchhi4. RL78 is missing some of
+ the "normal" compares, specifically, it only has unsigned compares,
+ so we must synthesize the missing ones. */
+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
+}
+
+
+
+/* Define this to 1 if you are debugging the peephole optimizers. */
+#define DEBUG_PEEP 0
+
+/* Predicate used to enable the peephole2 patterns in rl78-virt.md.
+ The default "word" size is a byte so we can effectively use all the
+ registers, but we want to do 16-bit moves whenever possible. This
+ function determines when such a move is an option. */
+bool
+rl78_peep_movhi_p (rtx *operands)
+{
+ int i;
+ rtx m, a;
+
+ /* (set (op0) (op1))
+ (set (op2) (op3)) */
+
+#if DEBUG_PEEP
+ fprintf (stderr, "\033[33m");
+ debug_rtx(operands[0]);
+ debug_rtx(operands[1]);
+ debug_rtx(operands[2]);
+ debug_rtx(operands[3]);
+ fprintf (stderr, "\033[0m");
+#endif
+
+ if (rtx_equal_p (operands[0], operands[3]))
+ {
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: overlapping\n");
+#endif
+ return false;
+ }
+
+ for (i = 0; i < 2; i ++)
+ {
+ if (GET_CODE (operands[i]) != GET_CODE (operands[i+2]))
+ {
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: different codes\n");
+#endif
+ return false;
+ }
+ if (GET_MODE (operands[i]) != GET_MODE (operands[i+2]))
+ {
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: different modes\n");
+#endif
+ return false;
+ }
+
+ switch (GET_CODE (operands[i]))
+ {
+ case REG:
+ /* LSB MSB */
+ if (REGNO (operands[i]) + 1 != REGNO (operands[i+2])
+ || GET_MODE (operands[i]) != QImode)
+ {
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: wrong regnos %d %d %d\n",
+ REGNO (operands[i]), REGNO (operands[i+2]),
+ i);
+#endif
+ return false;
+ }
+ if (! rl78_hard_regno_mode_ok (REGNO (operands[i]), HImode))
+ {
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: reg %d not HI\n", REGNO (operands[i]));
+#endif
+ return false;
+ }
+ break;
+
+ case CONST_INT:
+ break;
+
+ case MEM:
+ if (GET_MODE (operands[i]) != QImode)
+ return false;
+ if (MEM_ALIGN (operands[i]) < 16)
+ return false;
+ a = XEXP (operands[i], 0);
+ if (GET_CODE (a) == CONST)
+ a = XEXP (a, 0);
+ if (GET_CODE (a) == PLUS)
+ a = XEXP (a, 1);
+ if (GET_CODE (a) == CONST_INT
+ && INTVAL (a) & 1)
+ {
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: misaligned mem %d\n", i);
+ debug_rtx (operands[i]);
+#endif
+ return false;
+ }
+ m = adjust_address (operands[i], QImode, 1);
+ if (! rtx_equal_p (m, operands[i+2]))
+ {
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: wrong mem %d\n", i);
+ debug_rtx(m);
+ debug_rtx (operands[i+2]);
+#endif
+ return false;
+ }
+ break;
+
+ default:
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: wrong rtx %d\n", i);
+#endif
+ return false;
+ }
+ }
+#if DEBUG_PEEP
+ fprintf (stderr, "\033[32mpeep!\033[0m\n");
+#endif
+ return true;
+}
+
+/* Likewise, when a peephole is activated, this function helps compute
+ the new operands. */
+void
+rl78_setup_peep_movhi (rtx *operands)
+{
+ int i;
+
+ for (i = 0; i < 2; i ++)
+ {
+ switch (GET_CODE (operands[i]))
+ {
+ case REG:
+ operands[i+4] = gen_rtx_REG (HImode, REGNO (operands[i]));
+ break;
+
+ case CONST_INT:
+ operands[i+4] = GEN_INT ((INTVAL (operands[i]) & 0xff) + ((char)INTVAL (operands[i+2])) * 256);
+ break;
+
+ case MEM:
+ operands[i+4] = adjust_address (operands[i], HImode, 0);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+/*
+ How Devirtualization works in the RL78 GCC port
+
+Background
+
+The RL78 is an 8-bit port with some 16-bit operations. It has 32
+bytes of register space, in four banks, memory-mapped. One bank is
+the "selected" bank and holds the registers used for primary
+operations. Since the registers are memory mapped, often you can
+still refer to the unselected banks via memory accesses.
+
+Virtual Registers
+
+The GCC port uses bank 0 as the "selected" registers (A, X, BC, etc)
+and refers to the other banks via their memory addresses, although
+they're treated as regular registers internally. These "virtual"
+registers are R8 through R23 (bank3 is reserved for asm-based
+interrupt handlers).
+
+There are four machine description files:
+
+rl78.md - common register-independent patterns and definitions
+rl78-expand.md - expanders
+rl78-virt.md - patterns that match BEFORE devirtualization
+rl78-real.md - patterns that match AFTER devirtualization
+
+At least through register allocation and reload, gcc is told that it
+can do pretty much anything - but may only use the virtual registers.
+GCC cannot properly create the varying addressing modes that the RL78
+supports in an efficient way.
+
+Sometime after reload, the RL78 backend "devirtualizes" the RTL. It
+uses the "valloc" attribute in rl78-virt.md for determining the rules
+by which it will replace virtual registers with real registers (or
+not) and how to make up addressing modes. For example, insns tagged
+with "ro1" have a single read-only parameter, which may need to be
+moved from memory/constant/vreg to a suitable real register. As part
+of devirtualization, a flag is toggled, disabling the rl78-virt.md
+patterns and enabling the rl78-real.md patterns. The new patterns'
+constraints are used to determine the real registers used. NOTE:
+patterns in rl78-virt.md essentially ignore the constrains and rely on
+predicates, where the rl78-real.md ones essentially ignore the
+predicates and rely on the constraints.
+
+The devirtualization pass is scheduled via the pass manager (despite
+being called "rl78_reorg") so it can be scheduled prior to var-track
+(the idea is to let gdb know about the new registers). Ideally, it
+would be scheduled right after pro/epilogue generation, so the
+post-reload optimizers could operate on the real registers, but when I
+tried that there were some issues building the target libraries.
+
+During devirtualization, a simple register move optimizer is run. It
+would be better to run a full CSE/propogation pass on it through, or
+re-run regmove, but that has not yet been attempted.
+
+ */
+#define DEBUG_ALLOC 0
+
+/* 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)
+{
+ INSN_CODE (insn) = -1;
+ if (recog (PATTERN (insn), insn, 0) > -1)
+ {
+ extract_insn (insn);
+ if (constrain_operands (1))
+ {
+#if DEBUG_ALLOC
+ fprintf (stderr, "\033[32m");
+ debug_rtx (insn);
+ fprintf (stderr, "\033[0m");
+#endif
+ return true;
+ }
+ }
+ else
+ {
+ fprintf (stderr, "\033[41;30m Unrecognized insn \033[0m\n");
+ debug_rtx (insn);
+ gcc_unreachable ();
+ }
+#if DEBUG_ALLOC
+ fprintf (stderr, "\033[31m");
+ debug_rtx (insn);
+ fprintf (stderr, "\033[0m");
+#endif
+ return false;
+}
+
+#if DEBUG_ALLOC
+#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 MAYBE_OK(insn) if (insn_ok_now (insn)) { WORKED; return; } else { FAILEDSOFAR; }
+#else
+#define WORKED
+#define FAILEDSOFAR
+#define FAILED gcc_unreachable ()
+#define MAYBE_OK(insn) if (insn_ok_now (insn)) return;
+#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])
+
+/* Returns TRUE if R is a virtual register. */
+static bool
+is_virtual_register (rtx r)
+{
+ return (GET_CODE (r) == REG
+ && REGNO (r) >= 8
+ && REGNO (r) < 24);
+}
+
+/* In all these alloc routines, we expect the following: the insn
+ pattern is unshared, the insn was previously recognized and failed
+ due to predicates or constraints, and the operand data is in
+ recog_data. */
+
+static int virt_insn_was_frame;
+
+/* Hook for all insns we emit. Re-mark them as FRAME_RELATED if
+ needed. */
+static rtx
+EM2 (int line ATTRIBUTE_UNUSED, rtx r)
+{
+#if DEBUG_ALLOC
+ fprintf (stderr, "\033[36m%d: ", line);
+ debug_rtx(r);
+ fprintf (stderr, "\033[0m");
+#endif
+ /*SCHED_GROUP_P (r) = 1;*/
+ if (virt_insn_was_frame)
+ RTX_FRAME_RELATED_P (r) = 1;
+ return r;
+}
+
+#define EM(x) EM2 (__LINE__, x)
+
+/* Return a suitable RTX for the low half of a __far address. */
+static rtx
+rl78_lo16 (rtx addr)
+{
+ 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_CONST (HImode, r);
+ return r;
+ }
+ return rl78_subreg (HImode, addr, SImode, 0);
+}
+
+/* Return a suitable RTX for the high half's lower byte of a __far address. */
+static rtx
+rl78_hi8 (rtx addr)
+{
+ if (GET_CODE (addr) == SYMBOL_REF
+ || GET_CODE (addr) == CONST)
+ {
+ rtx r = gen_rtx_ZERO_EXTRACT (QImode, addr, GEN_INT (8), GEN_INT (16));
+ r = gen_rtx_CONST (QImode, r);
+ return r;
+ }
+ 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 rtx
+transcode_memory_rtx (rtx m, rtx newbase, rtx before)
+{
+ rtx base, index, addendr;
+ int addend = 0;
+
+ if (GET_CODE (m) != MEM)
+ return m;
+
+ if (GET_MODE (XEXP (m, 0)) == SImode)
+ {
+ 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)));
+ }
+
+ 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");
+ debug_rtx (base);
+#endif
+ if (base == NULL_RTX)
+ return m;
+
+ if (addendr && GET_CODE (addendr) == CONST_INT)
+ addend = INTVAL (addendr);
+
+ if (REGNO (base) == SP_REG)
+ {
+ if (addend >= 0 && addend <= 255)
+ return m;
+ }
+
+ /* BASE should be a virtual register. We copy it to NEWBASE. If
+ the addend is out of range for DE/HL, we use AX to compute the full
+ address. */
+
+ if (addend < 0
+ || (addend > 255 && REGNO (newbase) != 2)
+ || (addendr && GET_CODE (addendr) != CONST_INT))
+ {
+ /* mov ax, vreg
+ add ax, #imm
+ mov hl, ax */
+ 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));
+ base = newbase;
+ addend = 0;
+ }
+ else
+ {
+ EM (emit_insn_before (gen_movhi (newbase, base), before));
+ base = newbase;
+ }
+
+ if (addend)
+ 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 DEBUG_ALLOC
+ debug_rtx (m);
+ fprintf (stderr, "\033[0m");
+#endif
+ return m;
+}
+
+/* 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);
+ enum machine_mode mode = GET_MODE (src);
+
+ if (GET_CODE (src) == REG
+ && 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;
+ }
+}
+
+/* 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)
+{
+ 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;
+ }
+}
+
+/* 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)
+{
+ enum machine_mode mode = GET_MODE (acc);
+ rtx reg;
+
+ 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;
+ }
+}
+
+/* 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);
+ enum machine_mode mode = GET_MODE (src);
+ rtx reg;
+
+ if (mode == VOIDmode)
+ mode = recog_data.operand_mode[opno];
+ reg = (mode == QImode) ? X : AX;
+
+ 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);
+ 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;
+}
+
+/* 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)
+{
+ rtx src = OP (opno);
+ enum machine_mode mode = GET_MODE (src);
+ rtx reg;
+
+ if (mode == VOIDmode)
+ mode = recog_data.operand_mode[opno];
+ reg = (mode == QImode) ? L : HL;
+
+ if (mode == QImode || ! is_virtual_register (OP (opno)))
+ {
+ OP (opno) = move_to_acc (opno, before);
+ OP (opno) = move_acc_to_reg (OP (opno), L_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;
+}
+
+/* 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)
+{
+ rtx src = OP (opno);
+ enum machine_mode mode = GET_MODE (src);
+ rtx reg;
+
+ if (mode == VOIDmode)
+ mode = recog_data.operand_mode[opno];
+
+ reg = (mode == QImode) ? E : DE;
+
+ if (mode == QImode || ! is_virtual_register (OP (opno)))
+ {
+ OP (opno) = move_to_acc (opno, before);
+ OP (opno) = move_acc_to_reg (OP (opno), E_REG, before);
+ }
+ else
+ {
+ rtx move = mode == QImode ? gen_movqi (reg, src) : gen_movhi (reg, src);
+
+ EM (emit_insn_before (move, before));
+ }
+
+ return reg;
+}
+
+/* Devirtualize an insn of the form (SET (op) (unop (op))). */
+static void
+rl78_alloc_physical_registers_op1 (rtx insn)
+{
+ /* op[0] = func op[1] */
+
+ /* We first try using A as the destination, then copying it
+ back. */
+ if (rtx_equal_p (OP(0), OP(1)))
+ {
+ 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);
+ }
+
+ MAYBE_OK (insn);
+
+ OP(0) = move_from_acc (OP(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);
+
+ MAYBE_OK (insn);
+
+ FAILED;
+}
+
+/* Devirtualize an insn of the form (SET (op) (unop (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 first;
+ bool hl_used;
+
+ 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);
+ }
+ 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);
+ }
+ 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);
+ }
+
+ MAYBE_OK (insn);
+
+ prev = prev_nonnote_nondebug_insn (insn);
+ if (recog_data.constraints[1][0] == '%'
+ && 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;
+ }
+
+ /* Make a note of wether (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);
+
+ MAYBE_OK (insn);
+
+ /* We have to copy op2 to HL, but that involves AX, 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) = hl_used ? move_to_de (2, first) : move_to_hl (2, first);
+
+ MAYBE_OK (insn);
+
+ FAILED;
+}
+
+/* Devirtualize an insn of the form (SET () (unop (op))). */
+
+static void
+rl78_alloc_physical_registers_ro1 (rtx insn)
+{
+ /* (void) op[0] */
+ OP(0) = transcode_memory_rtx (OP(0), BC, insn);
+
+ MAYBE_OK (insn);
+
+ OP(0) = move_to_acc (0, insn);
+
+ MAYBE_OK (insn);
+
+ FAILED;
+}
+
+/* Devirtualize a compare insn. */
+static void
+rl78_alloc_physical_registers_cmp (rtx insn)
+{
+ /* op[1] cmp_op[0] op[2] */
+ 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);
+
+ MAYBE_OK (insn);
+
+ OP(1) = move_to_acc (1, insn);
+
+ MAYBE_OK (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);
+
+ FAILED;
+}
+
+/* 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;
+
+ 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)))
+ {
+ 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);
+
+ MAYBE_OK (insn);
+
+ /* We have to copy op2 to X, 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_x (2, first);
+
+ MAYBE_OK (insn);
+
+ FAILED;
+}
+
+/* Scan all insns and devirtualize them. */
+static void
+rl78_alloc_physical_registers (void)
+{
+ /* During most of the compile, gcc is dealing with virtual
+ registers. At this point, we need to assign physical registers
+ to the vitual ones, and copy in/out as needed. */
+
+ rtx insn, curr;
+ enum attr_valloc valloc_method;
+
+ for (insn = get_insns (); insn; insn = curr)
+ {
+ int i;
+
+ curr = next_nonnote_nondebug_insn (insn);
+
+ if (INSN_P (insn)
+ && (GET_CODE (PATTERN (insn)) == SET
+ || GET_CODE (PATTERN (insn)) == CALL)
+ && INSN_CODE (insn) == -1)
+ {
+ if (GET_CODE (SET_SRC (PATTERN (insn))) == ASM_OPERANDS)
+ continue;
+ i = recog (PATTERN (insn), insn, 0);
+ if (i == -1)
+ {
+ debug_rtx (insn);
+ gcc_unreachable ();
+ }
+ INSN_CODE (insn) = i;
+ }
+ }
+
+ cfun->machine->virt_insns_ok = 0;
+ cfun->machine->real_insns_ok = 1;
+
+ for (insn = get_insns (); insn; insn = curr)
+ {
+ 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 (GET_CODE (SET_SRC (PATTERN (insn))) == ASM_OPERANDS)
+ continue;
+
+ valloc_method = get_attr_valloc (insn);
+
+ PATTERN (insn)= copy_rtx_if_shared (PATTERN (insn));
+
+ if (insn_ok_now (insn))
+ continue;
+
+ INSN_CODE (insn) = -1;
+
+ if (RTX_FRAME_RELATED_P (insn))
+ virt_insn_was_frame = 1;
+ else
+ virt_insn_was_frame = 0;
+
+ switch (valloc_method)
+ {
+ case VALLOC_OP1:
+ rl78_alloc_physical_registers_op1 (insn);
+ break;
+ case VALLOC_OP2:
+ rl78_alloc_physical_registers_op2 (insn);
+ break;
+ case VALLOC_RO1:
+ rl78_alloc_physical_registers_ro1 (insn);
+ break;
+ case VALLOC_CMP:
+ rl78_alloc_physical_registers_cmp (insn);
+ break;
+ case VALLOC_UMUL:
+ rl78_alloc_physical_registers_umul (insn);
+ break;
+ case VALLOC_MACAX:
+ /* Macro that clobbers AX */
+ break;
+ }
+ }
+#if DEBUG_ALLOC
+ fprintf (stderr, "\033[0m");
+#endif
+}
+
+/* Add REG_DEAD notes using DEAD[reg] for rtx S which is part of INSN.
+ This function scans for uses of registers; the last use (i.e. first
+ encounter when scanning backwards) triggers a REG_DEAD note if the
+ reg was previously in DEAD[]. */
+static void
+rl78_note_reg_uses (char *dead, rtx s, rtx insn)
+{
+ const char *fmt;
+ int i, r;
+ enum rtx_code code;
+
+ if (!s)
+ return;
+
+ code = GET_CODE (s);
+
+ switch (code)
+ {
+ /* Compare registers by number. */
+ case REG:
+ r = REGNO (s);
+ if (dump_file)
+ {
+ fprintf (dump_file, "note use reg %d size %d on insn %d\n",
+ r, GET_MODE_SIZE (GET_MODE (s)), INSN_UID (insn));
+ print_rtl_single (dump_file, s);
+ }
+ if (dead [r])
+ add_reg_note (insn, REG_DEAD, gen_rtx_REG (GET_MODE (s), r));
+ for (i = 0; i < GET_MODE_SIZE (GET_MODE (s)); i ++)
+ dead [r + i] = 0;
+ return;
+
+ /* These codes have no constituent expressions
+ and are unique. */
+ case SCRATCH:
+ case CC0:
+ case PC:
+ return;
+
+ case CONST_INT:
+ case CONST_VECTOR:
+ case CONST_DOUBLE:
+ case CONST_FIXED:
+ /* These are kept unique for a given value. */
+ return;
+
+ default:
+ break;
+ }
+
+ fmt = GET_RTX_FORMAT (code);
+
+ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+ {
+ if (fmt[i] == 'E')
+ {
+ int j;
+ for (j = XVECLEN (s, i) - 1; j >= 0; j--)
+ rl78_note_reg_uses (dead, XVECEXP (s, i, j), insn);
+ }
+ else if (fmt[i] == 'e')
+ rl78_note_reg_uses (dead, XEXP (s, i), insn);
+ }
+}
+
+/* Like the previous function, but scan for SETs instead. */
+static void
+rl78_note_reg_set (char *dead, rtx d, rtx insn)
+{
+ int r, i;
+
+ if (GET_CODE (d) != REG)
+ return;
+
+ r = REGNO (d);
+ if (dead [r])
+ add_reg_note (insn, REG_UNUSED, gen_rtx_REG (GET_MODE (d), r));
+ if (dump_file)
+ fprintf (dump_file, "note set reg %d size %d\n", r, GET_MODE_SIZE (GET_MODE (d)));
+ for (i = 0; i < GET_MODE_SIZE (GET_MODE (d)); i ++)
+ dead [r + i] = 1;
+}
+
+/* This is a rather crude register death pass. Death status is reset
+ at every jump or call insn. */
+static void
+rl78_calculate_death_notes (void)
+{
+ char dead[FIRST_PSEUDO_REGISTER];
+ rtx insn, p, s, d;
+ int i;
+
+ memset (dead, 0, sizeof (dead));
+
+ for (insn = get_last_insn ();
+ insn;
+ insn = prev_nonnote_nondebug_insn (insn))
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, "\n--------------------------------------------------");
+ 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, "\n");
+ print_rtl_single (dump_file, insn);
+ }
+
+ switch (GET_CODE (insn))
+ {
+ case INSN:
+ p = PATTERN (insn);
+ switch (GET_CODE (p))
+ {
+ case SET:
+ s = SET_SRC (p);
+ d = SET_DEST (p);
+ rl78_note_reg_set (dead, d, insn);
+ rl78_note_reg_uses (dead, s, insn);
+ break;
+
+ case USE:
+ rl78_note_reg_uses (dead, p, insn);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case JUMP_INSN:
+ if (INSN_CODE (insn) == CODE_FOR_return)
+ {
+ memset (dead, 1, sizeof (dead));
+ /* We expect a USE just prior to this, which will mark
+ the actual return registers. The USE will have a
+ death note, but we aren't going to be modifying it
+ after this pass. */
+ break;
+ }
+ case CALL_INSN:
+ memset (dead, 0, sizeof (dead));
+ break;
+
+ default:
+ break;
+ }
+ if (dump_file)
+ print_rtl_single (dump_file, insn);
+ }
+}
+
+/* Helper function to reset the origins in RP and the age in AGE for
+ all registers. */
+static void
+reset_origins (int *rp, int *age)
+{
+ int i;
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ {
+ rp[i] = i;
+ age[i] = 0;
+ }
+}
+
+/* The idea behind this optimization is to look for cases where we
+ move data from A to B to C, and instead move from A to B, and A to
+ C. If B is a virtual register or memory, this is a big win on its
+ own. If B turns out to be unneeded after this, it's a bigger win.
+ For each register, we try to determine where it's value originally
+ came from, if it's propogated purely through moves (and not
+ computes). The ORIGINS[] array has the regno for the "origin" of
+ the value in the [regno] it's indexed by. */
+static void
+rl78_propogate_register_origins (void)
+{
+ int origins[FIRST_PSEUDO_REGISTER];
+ int age[FIRST_PSEUDO_REGISTER];
+ int i;
+ rtx insn, ninsn = NULL_RTX;
+ rtx pat;
+
+ reset_origins (origins, age);
+
+ for (insn = get_insns (); insn; insn = ninsn)
+ {
+ ninsn = next_nonnote_nondebug_insn (insn);
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "\n");
+ fprintf (dump_file, "Origins:");
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i ++)
+ if (origins[i] != i)
+ fprintf (dump_file, " r%d=r%d", i, origins[i]);
+ fprintf (dump_file, "\n");
+ print_rtl_single (dump_file, insn);
+ }
+
+ switch (GET_CODE (insn))
+ {
+ case CODE_LABEL:
+ case BARRIER:
+ case CALL_INSN:
+ case JUMP_INSN:
+ reset_origins (origins, age);
+ break;
+
+ default:
+ break;
+
+ case INSN:
+ pat = PATTERN (insn);
+
+ if (GET_CODE (pat) == PARALLEL)
+ {
+ rtx clobber = XVECEXP (pat, 0, 1);
+ pat = XVECEXP (pat, 0, 0);
+ if (GET_CODE (clobber) == CLOBBER)
+ {
+ int cr = REGNO (XEXP (clobber, 0));
+ int mb = GET_MODE_SIZE (GET_MODE (XEXP (clobber, 0)));
+ if (dump_file)
+ fprintf (dump_file, "reset origins of %d regs at %d\n", mb, cr);
+ for (i = 0; i < mb; i++)
+ {
+ origins[cr + i] = cr + i;
+ age[cr + i] = 0;
+ }
+ }
+ else
+ break;
+ }
+
+ if (GET_CODE (pat) == SET)
+ {
+ rtx src = SET_SRC (pat);
+ rtx dest = SET_DEST (pat);
+ int mb = GET_MODE_SIZE (GET_MODE (dest));
+
+ if (GET_CODE (dest) == REG)
+ {
+ int dr = REGNO (dest);
+
+ if (GET_CODE (src) == REG)
+ {
+ int sr = REGNO (src);
+ int same = 1;
+ int best_age, best_reg;
+
+ /* See if the copy is not needed. */
+ for (i = 0; i < mb; i ++)
+ if (origins[dr + i] != origins[sr + i])
+ same = 0;
+ if (same)
+ {
+ if (dump_file)
+ fprintf (dump_file, "deleting because dest already has correct value\n");
+ delete_insn (insn);
+ break;
+ }
+
+ if (dr < 8 || sr >= 8)
+ {
+ int ar;
+
+ best_age = -1;
+ best_reg = -1;
+ /* See if the copy can be made from another
+ bank 0 register instead, instead of the
+ virtual src register. */
+ for (ar = 0; ar < 8; ar += mb)
+ {
+ same = 1;
+ for (i = 0; i < mb; i ++)
+ if (origins[ar + i] != origins[sr + i])
+ same = 0;
+
+ /* The chip has some reg-reg move limitations. */
+ if (mb == 1 && dr > 3)
+ same = 0;
+
+ if (same)
+ {
+ if (best_age == -1 || best_age > age[sr + i])
+ {
+ best_age = age[sr + i];
+ best_reg = sr;
+ }
+ }
+ }
+
+ if (best_reg != -1)
+ {
+ /* FIXME: copy debug info too. */
+ SET_SRC (pat) = gen_rtx_REG (GET_MODE (src), best_reg);
+ sr = best_reg;
+ }
+ }
+
+ for (i = 0; i < mb; i++)
+ {
+ origins[dr + i] = origins[sr + i];
+ age[dr + i] = age[sr + i] + 1;
+ }
+ }
+ else
+ {
+ /* The destination is computed, its origin is itself. */
+ if (dump_file)
+ fprintf (dump_file, "resetting origin of r%d for %d byte%s\n",
+ dr, mb, mb == 1 ? "" : "s");
+ for (i = 0; i < mb; i ++)
+ {
+ origins[dr + i] = dr + i;
+ age[dr + i] = 0;
+ }
+ }
+
+ /* Any registers marked with that reg as an origin are reset. */
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (origins[i] >= dr && origins[i] < dr + mb)
+ {
+ origins[i] = i;
+ age[i] = 0;
+ }
+ }
+
+ /* Special case - our ADDSI3 macro uses AX */
+ if (get_attr_valloc (insn) == VALLOC_MACAX)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Resetting origin of AX for macro.\n");
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (i <= 1 || origins[i] <= 1)
+ {
+ origins[i] = i;
+ age[i] = 0;
+ }
+ }
+
+ if (GET_CODE (src) == ASHIFT
+ || GET_CODE (src) == ASHIFTRT
+ || GET_CODE (src) == LSHIFTRT)
+ {
+ rtx count = XEXP (src, 1);
+ if (GET_CODE (count) == REG)
+ {
+ /* Special case - our pattern clobbers the count register. */
+ int r = REGNO (count);
+ if (dump_file)
+ fprintf (dump_file, "Resetting origin of r%d for shift.\n", r);
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (i == r || origins[i] == r)
+ {
+ origins[i] = i;
+ age[i] = 0;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+/* Remove any SETs where the destination is unneeded. */
+static void
+rl78_remove_unused_sets (void)
+{
+ rtx insn, ninsn = NULL_RTX;
+ rtx dest;
+
+ for (insn = get_insns (); insn; insn = ninsn)
+ {
+ ninsn = next_nonnote_nondebug_insn (insn);
+
+ if ((insn = single_set (insn)) == NULL_RTX)
+ continue;
+
+ dest = SET_DEST (insn);
+
+ if (REGNO (dest) > 23)
+ continue;
+
+ if (find_regno_note (insn, REG_UNUSED, REGNO (dest)))
+ delete_insn (insn);
+ }
+}
+
+#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)
+{
+ rl78_alloc_physical_registers ();
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "\n================DEVIRT:=AFTER=ALLOC=PHYSICAL=REGISTERS================\n");
+ print_rtl_with_bb (dump_file, get_insns ());
+ }
+
+ rl78_propogate_register_origins ();
+ rl78_calculate_death_notes ();
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "\n================DEVIRT:=AFTER=PROPOGATION=============================\n");
+ print_rtl_with_bb (dump_file, get_insns ());
+ fprintf (dump_file, "\n======================================================================\n");
+ }
+
+ rl78_remove_unused_sets ();
+
+ /* The code after devirtualizing has changed so much that at this point
+ we might as well just rescan everything. Note that
+ df_rescan_all_insns is not going to help here because it does not
+ touch the artificial uses and defs. */
+ df_finish_pass (true);
+ if (optimize > 1)
+ df_live_add_problem ();
+ df_scan_alloc (NULL);
+ df_scan_blocks ();
+
+ if (optimize)
+ df_analyze ();
+}
+
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY rl78_return_in_memory
+
+static bool
+rl78_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
+{
+ const HOST_WIDE_INT size = int_size_in_bytes (type);
+ return (size == -1 || size > 8);
+}
+
+
+struct gcc_target targetm = TARGET_INITIALIZER;
+
+#include "gt-rl78.h"
diff --git a/gcc/config/rl78/rl78.h b/gcc/config/rl78/rl78.h
new file mode 100644
index 00000000000..5980c418843
--- /dev/null
+++ b/gcc/config/rl78/rl78.h
@@ -0,0 +1,462 @@
+/* GCC backend definitions for the Renesas RL78 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/>. */
+
+
+#define RL78_MUL_NONE (rl78_mul_type == MUL_NONE)
+#define RL78_MUL_RL78 (rl78_mul_type == MUL_RL78)
+#define RL78_MUL_G13 (rl78_mul_type == MUL_G13)
+
+#define TARGET_CPU_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("__RL78__"); \
+ builtin_assert ("cpu=RL78"); \
+ if (RL78_MUL_RL78) \
+ builtin_define ("__RL78_MUL_RL78__"); \
+ if (RL78_MUL_G13) \
+ builtin_define ("__RL78_MUL_G13__"); \
+ } \
+ while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s} crtbegin.o%s"
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
+
+#undef LIB_SPEC
+#define LIB_SPEC " \
+--start-group \
+-lc \
+-lsim \
+%{fprofile-arcs|fprofile-generate|coverage:-lgcov} \
+--end-group \
+%{!T*: %{msim:%Trl78-sim.ld}%{!msim:%Trl78.ld}} \
+"
+
+
+#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 RL78 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 1
+#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 32 /*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 8
+#define BIGGEST_ALIGNMENT 16
+#define STACK_BOUNDARY 16
+#define PARM_BOUNDARY 16
+
+#define STACK_GROWS_DOWNWARD 1
+#define FRAME_GROWS_DOWNWARD 1
+#define FIRST_PARM_OFFSET(FNDECL) 0
+
+#define MAX_REGS_PER_ADDRESS 1
+
+#define Pmode HImode
+#define POINTER_SIZE 16
+#undef SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "long int"
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE BITS_PER_WORD
+#define POINTERS_EXTEND_UNSIGNED 1
+#define FUNCTION_MODE HImode
+#define CASE_VECTOR_MODE Pmode
+#define WORD_REGISTER_OPERATIONS 0
+#define HAS_LONG_COND_BRANCH 0
+#define HAS_LONG_UNCOND_BRANCH 0
+
+#define MOVE_MAX 2
+#define STARTING_FRAME_OFFSET 0
+
+#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+
+#define ADDR_SPACE_FAR 1
+
+#define HAVE_PRE_DECCREMENT 0
+#define HAVE_POST_INCREMENT 0
+
+#define MOVE_RATIO(SPEED) ((SPEED) ? 24 : 16)
+#define SLOW_BYTE_ACCESS 0
+
+#define STORE_FLAG_VALUE 1
+#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
+#define SHORT_IMMEDIATES_SIGN_EXTEND 0
+
+
+/* The RL78 has four register banks. Normal operation uses RB0 as
+ real registers, RB1 and RB2 as "virtual" registers (because we know
+ they'll be there, and not used as variables), and RB3 is reserved
+ for interrupt handlers. The virtual registers are accessed as
+ SADDRs:
+
+ FFEE0-FFEE7 RB0
+ FFEE8-FFEEF RB1
+ FFEF0-FFEF7 RB2
+ FFEF8-FFEFF RB3
+*/
+#define REGISTER_NAMES \
+ { \
+ "x", "a", "c", "b", "e", "d", "l", "h", \
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
+ "sp", "ap", "psw", "es", "cs" \
+ }
+
+#define ADDITIONAL_REGISTER_NAMES \
+{ \
+{ "ax", 0 }, \
+{ "bc", 2 }, \
+{ "de", 4 }, \
+{ "hl", 6 }, \
+{ "rp0", 0 }, \
+{ "rp1", 2 }, \
+{ "rp2", 4 }, \
+{ "rp3", 6 }, \
+{ "r0", 0 }, \
+{ "r1", 1 }, \
+{ "r2", 2 }, \
+{ "r3", 3 }, \
+{ "r4", 4 }, \
+{ "r5", 5 }, \
+{ "r6", 6 }, \
+{ "r7", 7 }, \
+}
+
+enum reg_class
+{
+ NO_REGS, /* No registers in set. */
+ XREG,
+ AREG,
+ AXREG,
+ CREG,
+ BREG,
+ BCREG,
+ EREG,
+ DREG,
+ DEREG,
+ LREG,
+ HREG,
+ HLREG,
+ IDX_REGS,
+ QI_REGS,
+ SPREG,
+ R8W_REGS,
+ R10W_REGS,
+ INT_REGS,
+ V_REGS, /* Virtual registers. */
+ GR_REGS, /* Integer registers. */
+ PSWREG,
+ ALL_REGS, /* All registers. */
+ LIM_REG_CLASSES /* Max value + 1. */
+};
+
+#define REG_CLASS_NAMES \
+{ \
+ "NO_REGS", \
+ "XREG", \
+ "AREG", \
+ "AXREG", \
+ "CREG", \
+ "BREG", \
+ "BCREG", \
+ "EREG", \
+ "DREG", \
+ "DEREG", \
+ "LREG", \
+ "HREG", \
+ "HLREG", \
+ "IDX_REGS", \
+ "QI_REGS", \
+ "SPREG", \
+ "R8W_REGS", \
+ "R10W_REGS", \
+ "INT_REGS", \
+ "V_REGS", \
+ "GR_REGS", \
+ "PSWREG", \
+ "ALL_REGS" \
+}
+
+#define REG_CLASS_CONTENTS \
+{ \
+ { 0x00000000, 0x00000000 }, /* No registers, */ \
+ { 0x00000001, 0x00000000 }, \
+ { 0x00000002, 0x00000000 }, \
+ { 0x00000003, 0x00000000 }, \
+ { 0x00000004, 0x00000000 }, \
+ { 0x00000008, 0x00000000 }, \
+ { 0x0000000c, 0x00000000 }, \
+ { 0x00000010, 0x00000000 }, \
+ { 0x00000020, 0x00000000 }, \
+ { 0x00000030, 0x00000000 }, \
+ { 0x00000040, 0x00000000 }, \
+ { 0x00000080, 0x00000000 }, \
+ { 0x000000c0, 0x00000000 }, \
+ { 0x0000000c, 0x00000000 }, /* B and C - index regs. */ \
+ { 0x000000ff, 0x00000000 }, /* all real registers. */ \
+ { 0x00000000, 0x00000001 }, /* SP */ \
+ { 0x00000300, 0x00000000 }, /* R8 - HImode */ \
+ { 0x00000c00, 0x00000000 }, /* R10 - HImode */ \
+ { 0xff000000, 0x00000000 }, /* INT - HImode */ \
+ { 0x007fff00, 0x00000000 }, /* Virtual registers. */ \
+ { 0xff7fffff, 0x00000002 }, /* General registers. */ \
+ { 0x04000000, 0x00000004 }, /* PSW. */ \
+ { 0xff7fffff, 0x0000001f } /* All registers. */ \
+}
+
+#define SMALL_REGISTER_CLASSES 1
+#define N_REG_CLASSES (int) LIM_REG_CLASSES
+#define CLASS_MAX_NREGS(CLASS, MODE) ((GET_MODE_SIZE (MODE) \
+ + UNITS_PER_WORD - 1) \
+ / UNITS_PER_WORD)
+
+#define GENERAL_REGS GR_REGS
+#define BASE_REG_CLASS V_REGS
+#define INDEX_REG_CLASS V_REGS
+
+#define FIRST_PSEUDO_REGISTER 37
+
+#define REGNO_REG_CLASS(REGNO) ((REGNO) < FIRST_PSEUDO_REGISTER \
+ ? GR_REGS : NO_REGS)
+
+#define FRAME_POINTER_REGNUM 22
+#define STACK_POINTER_REGNUM 32
+#define ARG_POINTER_REGNUM 33
+#define CC_REGNUM 34
+#define FUNC_RETURN_REGNUM 8
+#define STATIC_CHAIN_REGNUM 14
+
+/* Trampolines are implemented with a separate data stack. The memory
+ on stack only holds the function pointer for the chosen stub.
+ */
+
+#define TRAMPOLINE_SIZE 4
+#define TRAMPOLINE_ALIGNMENT 16
+
+#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) = rl78_initial_elimination_offset ((FROM), (TO))
+
+
+#define FUNCTION_ARG_REGNO_P(N) 0
+#define FUNCTION_VALUE_REGNO_P(N) ((N) == 8)
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+#define FIXED_REGISTERS \
+{ \
+ 1,1,1,1, 1,1,1,1, \
+ 0,0,0,0, 0,0,0,0, \
+ 0,0,0,0, 0,0,1,1, \
+ 1,1,1,1, 1,1,1,1, \
+ 0, 1, 0, 1, 1 \
+}
+
+#define CALL_USED_REGISTERS \
+{ \
+ 1,1,1,1, 1,1,1,1, \
+ 1,1,1,1, 1,1,1,1, \
+ 0,0,0,0, 0,0,1,1, \
+ 1,1,1,1, 1,1,1,1, \
+ 0, 1, 1, 1, 1 \
+}
+
+#define LIBCALL_VALUE(MODE) \
+ gen_rtx_REG ((MODE), \
+ FUNC_RETURN_REGNUM)
+
+/* Order of allocation of registers. */
+
+#define REG_ALLOC_ORDER \
+ { 8, 9, 10, 11, 12, 13, 14, 15, \
+ 16, 17, 18, 19, 20, 21, 22, 23, \
+ 0, 1, 6, 7, 2, 3, 4, 5, \
+ 24, 25, 26, 27, 28, 29, 30, 31, \
+ 32, 33, 34 \
+}
+
+#define REGNO_IN_RANGE(REGNO, MIN, MAX) \
+ (IN_RANGE ((REGNO), (MIN), (MAX)) \
+ || (reg_renumber != NULL \
+ && reg_renumber[(REGNO)] >= (MIN) \
+ && reg_renumber[(REGNO)] <= (MAX)))
+
+#ifdef REG_OK_STRICT
+#define REGNO_OK_FOR_BASE_P(regno) REGNO_IN_RANGE (regno, 16, 23)
+#else
+#define REGNO_OK_FOR_BASE_P(regno) 1
+#endif
+
+#define REGNO_OK_FOR_INDEX_P(regno) REGNO_OK_FOR_BASE_P (regno)
+
+#define REGNO_MODE_CODE_OK_FOR_BASE_P(regno, mode, address_space, outer_code, index_code) \
+ rl78_regno_mode_code_ok_for_base_p (regno, mode, address_space, outer_code, index_code)
+
+#define MODE_CODE_BASE_REG_CLASS(mode, address_space, outer_code, index_code) \
+ rl78_mode_code_base_reg_class (mode, address_space, outer_code, index_code)
+
+#define RETURN_ADDR_RTX(COUNT, FRAMEADDR) \
+ ((COUNT) == 0 \
+ ? gen_rtx_MEM (Pmode, gen_rtx_PLUS (HImode, arg_pointer_rtx, GEN_INT (-4))) \
+ : NULL_RTX)
+
+#define INCOMING_RETURN_ADDR_RTX gen_rtx_MEM (Pmode, stack_pointer_rtx)
+
+#define ACCUMULATE_OUTGOING_ARGS 1
+
+typedef unsigned int CUMULATIVE_ARGS;
+
+#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
+ (CUM) = 0
+
+
+/* FIXME */
+#define NO_PROFILE_COUNTERS 1
+#define PROFILE_BEFORE_PROLOGUE 1
+
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+ fprintf (FILE, "\tbsr\t__mcount\n");
+
+
+#define HARD_REGNO_NREGS(REGNO, MODE) \
+ rl78_hard_regno_nregs (REGNO, MODE)
+
+#define HARD_REGNO_MODE_OK(REGNO, MODE) \
+ rl78_hard_regno_mode_ok (REGNO, MODE)
+
+#define MODES_TIEABLE_P(MODE1, MODE2) \
+ ( ( 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))
+
+
+#define TEXT_SECTION_ASM_OP ".text"
+#define DATA_SECTION_ASM_OP ".data"
+#define BSS_SECTION_ASM_OP ".bss"
+#define CTORS_SECTION_ASM_OP ".section \".ctors\",\"a\""
+#define DTORS_SECTION_ASM_OP ".section \".dtors\",\"a\""
+
+#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_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)
+
+/* For PIC put jump tables into the text section so that the offsets that
+ they contain are always computed between two same-section symbols. */
+#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
+
+/* This is a version of REG_P that also returns TRUE for SUBREGs. */
+#define RL78_REG_P(rtl) (REG_P (rtl) || GET_CODE (rtl) == SUBREG)
+
+/* Like REG_P except that this macro is true for SET expressions. */
+#define SET_P(rtl) (GET_CODE (rtl) == SET)
+
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
+#undef DWARF2_ADDR_SIZE
+#define DWARF2_ADDR_SIZE 4
+
+#define DWARF2_ASM_LINE_DEBUG_INFO 1
+
+#define EXIT_IGNORE_STACK 0
+#define INCOMING_FRAME_SP_OFFSET 4
+
+
+#define BRANCH_COST(SPEED,PREDICT) 1
+#define REGISTER_MOVE_COST(MODE,FROM,TO) 2
+
+#define EH_RETURN_DATA_REGNO(N) (N < 2 ? (8+(N)*2) : INVALID_REGNUM)
+#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (HImode, 20)
+
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) DW_EH_PE_udata4
+
+/* NOTE: defined but zero means dwarf2 debugging, but sjlj EH. */
+#define DWARF2_UNWIND_INFO 0
+/*#define DONT_USE_BUILTIN_SETJMP 1*/
+#undef DONT_USE_BUILTIN_SETJMP
+#define JMP_BUF_SIZE (8*3+8)
+
+#define REGISTER_TARGET_PRAGMAS() rl78_register_pragmas()
diff --git a/gcc/config/rl78/rl78.md b/gcc/config/rl78/rl78.md
new file mode 100644
index 00000000000..220ed991773
--- /dev/null
+++ b/gcc/config/rl78/rl78.md
@@ -0,0 +1,320 @@
+;; Machine Description for Renesas RL78 processors
+;; 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/>.
+
+(define_constants
+ [
+ (AX_REG 0)
+ (X_REG 0)
+ (A_REG 1)
+ (BC_REG 2)
+ (C_REG 2)
+ (B_REG 3)
+ (DE_REG 4)
+ (E_REG 4)
+ (D_REG 5)
+ (HL_REG 6)
+ (L_REG 6)
+ (H_REG 7)
+
+ (FP_REG 22)
+ (SP_REG 32)
+ (CC_REG 33)
+ (ES_REG 35)
+ (CS_REG 36)
+
+ (UNS_PROLOG 1)
+ (UNS_EPILOG 1)
+ (UNS_RETI 2)
+ (UNS_RETB 3)
+
+ (UNS_SET_RB 10)
+
+ (UNS_TRAMPOLINE_INIT 20)
+ (UNS_TRAMPOLINE_UNINIT 21)
+ (UNS_NONLOCAL_GOTO 22)
+
+ ])
+
+(define_insn "nop"
+ [(const_int 0)]
+ ""
+ "nop"
+ )
+
+(define_mode_iterator QHI [QI HI])
+
+(include "predicates.md")
+(include "constraints.md")
+(include "rl78-expand.md")
+(include "rl78-virt.md")
+(include "rl78-real.md")
+
+
+;; Function Prologue/Epilogue Instructions
+
+(define_expand "prologue"
+ [(const_int 0)]
+ ""
+ "rl78_expand_prologue (); DONE;"
+)
+
+(define_expand "epilogue"
+ [(const_int 0)]
+ ""
+ "rl78_expand_epilogue (); DONE;"
+)
+
+(define_expand "sibcall_epilogue"
+ [(return)]
+ ""
+ "FAIL;"
+)
+
+(define_insn "return"
+ [(return)]
+ ""
+ "ret"
+)
+
+(define_insn "interrupt_return"
+ [(unspec_volatile [(return)] UNS_RETI) ]
+ ""
+ "reti"
+)
+
+(define_insn "brk_interrupt_return"
+ [(unspec_volatile [(return)] UNS_RETB) ]
+ ""
+ "retb"
+)
+
+(define_expand "eh_return"
+ [(match_operand:HI 0 "" "")]
+ ""
+ "rl78_expand_eh_epilogue (operands[0]);
+ emit_barrier ();
+ DONE;"
+)
+
+;; These are used only by prologue/epilogue so it's "safe" to pass
+;; virtual registers.
+(define_insn "push"
+ [(set (reg:HI SP_REG)
+ (plus:HI (reg:HI SP_REG)
+ (const_int -2)))
+ (set (mem:HI (reg:HI SP_REG))
+ (match_operand:HI 0 "register_operand" "ABDT,vZint"))]
+ ""
+ "@
+ push\t%v0
+ push\t%v0 ; %0"
+)
+
+(define_insn "pop"
+ [(set (match_operand:HI 0 "register_operand" "=ABDT,vZint")
+ (mem:HI (reg:HI SP_REG)))
+ (set (reg:HI SP_REG)
+ (plus:HI (reg:HI SP_REG)
+ (const_int 2)))]
+ ""
+ "@
+ pop\t%v0
+ pop\t%v0 ; %0"
+)
+
+(define_insn "sel_rb"
+ [(unspec_volatile [(match_operand 0 "immediate_operand" "")] UNS_SET_RB)]
+ ""
+ "sel\trb%u0"
+ )
+
+(define_insn "trampoline_init"
+ [(set (match_operand 0 "register_operand" "=Z08W")
+ (unspec_volatile [(match_operand 1 "register_operand" "Z08W")
+ (match_operand 2 "register_operand" "Z10W")
+ ] UNS_TRAMPOLINE_INIT))
+ ]
+ ""
+ "call !!___trampoline_init ; %0 <= %1 %2"
+ )
+
+(define_insn "trampoline_uninit"
+ [(unspec_volatile [(const_int 0)] UNS_TRAMPOLINE_UNINIT)
+ ]
+ ""
+ "call !!___trampoline_uninit"
+ )
+
+;; GCC restores $fp *before* using it to access values on the *old*
+;; frame. So, we do it ourselves, to ensure this is not the case.
+;; Note that while %1 is usually a label_ref, we allow for a
+;; non-immediate as well.
+(define_expand "nonlocal_goto"
+ [(set (pc)
+ (unspec_volatile [(match_operand 0 "" "") ;; fp (ignore)
+ (match_operand 1 "" "vi") ;; target
+ (match_operand 2 "" "vi") ;; sp
+ (match_operand 3 "" "vi") ;; ?
+ ] UNS_NONLOCAL_GOTO))
+ ]
+ ""
+ "emit_jump_insn (gen_nonlocal_goto_insn (operands[0], operands[1], operands[2], operands[3]));
+ emit_barrier ();
+ DONE;"
+ )
+
+(define_insn "nonlocal_goto_insn"
+ [(set (pc)
+ (unspec_volatile [(match_operand 0 "" "") ;; fp (ignore)
+ (match_operand 1 "" "vi") ;; target
+ (match_operand 2 "" "vi") ;; sp
+ (match_operand 3 "" "vi") ;; ?
+ ] UNS_NONLOCAL_GOTO))
+ ]
+ ""
+ "; nonlocal goto
+ movw ax, %3
+ movw r22, ax
+ movw ax, %2
+ movw sp, ax
+ movw ax, %1
+ br ax
+"
+ )
+
+;;======================================================================
+;;
+;; "macro" insns - cases where inline chunks of code are more
+;; 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")))
+ ]
+ ""
+ "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]);"
+)
+
+(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")))
+ ]
+ ""
+ "; 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_expand "mulsi3"
+ [(set (match_operand:SI 0 "register_operand" "=&v")
+ (mult:SI (match_operand:SI 1 "nonmemory_operand" "vi")
+ (match_operand:SI 2 "nonmemory_operand" "vi")))
+ ]
+ "! RL78_MUL_NONE"
+ ""
+)
+
+;; 0xFFFF0 is MACR(L). 0xFFFF2 is MACR(H) but we don't care about it
+;; because we're only using the lower 16 bits (which is the upper 16
+;; 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")))
+ ]
+ "RL78_MUL_RL78"
+ "; mulsi macro %0 = %1 * %2
+ movw ax, %h1
+ movw bc, %h2
+ MULHU ; bcax = bc * ax
+ movw %h0, ax
+ movw ax, bc
+ movw 0xffff0, ax
+ movw ax, %H1
+ movw bc, %h2
+ MACHU ; MACR += bc * ax
+ movw ax, %h1
+ movw bc, %H2
+ MACHU ; MACR += bc * ax
+ movw ax, 0xffff0
+ movw %H0, ax
+ ; end of mulsi macro"
+ [(set_attr "valloc" "macax")]
+ )
+
+;; 0xFFFF0 is MDAL. 0xFFFF2 is MDAH.
+;; 0xFFFF4 is MDBL. 0xFFFF6 is MDBH.
+;; 0xF00E0 is MDCL. 0xF00E2 is MDCH.
+;; 0xF00E8 is MDUC.
+;; Warning: this matches the documentation, not the silicon.
+(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")))
+ ]
+ "RL78_MUL_G13"
+ "; mulsi macro %0 = %1 * %2
+ mov a, #0x00
+ mov !0xf00e8, a ; MDUC
+ movw ax, %h1
+ movw 0xffff0, ax ; MDAL
+ movw ax, %h2
+ movw 0xffff2, ax ; MDAH
+ nop ; mdb = mdal * mdah
+ movw ax, 0xffff4 ; MDBL
+ movw %h0, ax
+
+ mov a, #0x40
+ mov !0xf00e8, a ; MDUC
+ movw ax, 0xffff6 ; MDBH
+ movw !0xf00e0, ax ; MDCL
+ movw ax, #0
+ movw !0xf00e2, ax ; MDCL
+ movw ax, %H1
+ movw 0xffff0, ax ; MDAL
+ movw ax, %h2
+ movw 0xffff2, ax ; MDAH
+ nop ; mdc += mdal * mdah
+
+ mov a, #0x40
+ mov !0xf00e8, a ; MDUC
+ movw ax, %h1
+ movw 0xffff0, ax ; MDAL
+ movw ax, %H2
+ movw 0xffff2, ax ; MDAH
+ nop ; mdc += mdal * mdah
+ movw ax, !0xf00e0 ; MDCL
+ movw %H0, ax
+ ; end of mulsi macro"
+ [(set_attr "valloc" "macax")]
+ )
diff --git a/gcc/config/rl78/rl78.opt b/gcc/config/rl78/rl78.opt
new file mode 100644
index 00000000000..d4858ba1794
--- /dev/null
+++ b/gcc/config/rl78/rl78.opt
@@ -0,0 +1,43 @@
+; Command line options for the Renesas RL78 port of GCC.
+; 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/>.
+;---------------------------------------------------
+
+HeaderInclude
+config/rl78/rl78-opts.h
+
+msim
+Target
+Use the simulator runtime.
+
+mmul=
+Target RejectNegative Joined Var(rl78_mul_type) Report Tolower Enum(rl78_mul_types) Init(MUL_NONE)
+Select hardware or software multiplication support.
+
+Enum
+Name(rl78_mul_types) Type(enum rl78_mul_types)
+
+EnumValue
+Enum(rl78_mul_types) String(none) Value(MUL_NONE)
+
+EnumValue
+Enum(rl78_mul_types) String(rl78) Value(MUL_RL78)
+
+EnumValue
+Enum(rl78_mul_types) String(g13) Value(MUL_G13)
diff --git a/gcc/config/rl78/t-rl78 b/gcc/config/rl78/t-rl78
new file mode 100644
index 00000000000..9d08f1f2526
--- /dev/null
+++ b/gcc/config/rl78/t-rl78
@@ -0,0 +1,22 @@
+# Makefile fragment for building GCC for the Renesas RL78 target.
+# 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/>.
+
+rl78-c.o: $(srcdir)/config/rl78/rl78-c.c $(RTL_H) $(TREE_H) $(CONFIG_H) $(TM_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index 7bd6b20fa07..25880ea5691 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -24,997 +24,1415 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-/* Before including this file, two macros must be defined:
- RS6000_BUILTIN -- 2 arguments, the enum name, and classification
- RS6000_BUILTIN_EQUATE -- 2 arguments, enum name and value */
-
-/* AltiVec builtins. */
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ST_INTERNAL_4si, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LD_INTERNAL_4si, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ST_INTERNAL_8hi, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LD_INTERNAL_8hi, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ST_INTERNAL_16qi, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LD_INTERNAL_16qi, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ST_INTERNAL_4sf, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LD_INTERNAL_4sf, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ST_INTERNAL_2df, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LD_INTERNAL_2df, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ST_INTERNAL_2di, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LD_INTERNAL_2di, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDUBM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDUHM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDUWM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDCUW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDUBS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDSBS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDUHS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDSHS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDUWS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VADDSWS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VAND, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VANDC, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VAVGUB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VAVGSB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VAVGUH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VAVGSH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VAVGUW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VAVGSW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCFUX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCFSX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCTSXS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCTUXS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPBFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPEQUB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPEQUH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPEQUW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPEQFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGEFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTUB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTSB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTUH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTSH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTUW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTSW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEXPTEFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VLOGEFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMADDFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMAXUB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMAXSB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMAXUH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMAXSH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMAXUW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMAXSW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMAXFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMHADDSHS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMHRADDSHS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMLADDUHM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMRGHB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMRGHH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMRGHW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMRGLB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMRGLH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMRGLW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMSUMUBM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMSUMMBM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMSUMUHM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMSUMSHM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMSUMUHS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMSUMSHS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMINUB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMINSB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMINUH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMINSH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMINUW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMINSW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMINFP, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULEUB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULEUB_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULESB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULEUH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULEUH_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULESH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULOUB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULOUB_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULOSB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULOUH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULOUH_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VMULOSH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VNMSUBFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VNOR, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VOR, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_2DI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_4SI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_8HI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSEL_16QI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_2DI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_4SI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_8HI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPERM_16QI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKUHUM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKUWUM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKPX, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKUHSS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKSHSS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKUWSS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKSWSS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKUHUS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKSHUS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKUWUS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VPKSWUS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VREFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRFIM, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRFIN, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRFIP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRFIZ, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRLB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRLH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRLW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRSQRTFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRSQRTEFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSL, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLO, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSPLTB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSPLTH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSPLTW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSPLTISB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSPLTISH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSPLTISW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSRB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSRH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSRW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSRAB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSRAH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSRAW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSR, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSRO, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBUBM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBUHM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBUWM, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBFP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBCUW, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBUBS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBSBS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBUHS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBSHS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBUWS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUBSWS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUM4UBS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUM4SBS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUM4SHS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUM2SWS, RS6000_BTC_SAT)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSUMSWS, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VXOR, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLDOI_16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLDOI_8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLDOI_4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VSLDOI_4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VUPKHSB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VUPKHPX, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VUPKHSH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VUPKLSB, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VUPKLPX, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VUPKLSH, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_MTVSCR, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_MFVSCR, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_DSSALL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_DSS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVSL, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVSR, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_DSTT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_DSTST, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_DSTSTT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_DST, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVEBX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVEHX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVEWX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVXL, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_STVX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVLX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVLXL, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVRX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_LVRXL, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_STVEBX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_STVEHX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_STVEWX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_STVXL, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_STVLX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_STVLXL, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_STVRX, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_STVRXL, RS6000_BTC_MEM)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPBFP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPEQFP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPEQUB_P, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPEQUH_P, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPEQUW_P, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGEFP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTFP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTSB_P, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTSH_P, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTSW_P, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTUB_P, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTUH_P, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGTUW_P, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ABSS_V4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ABSS_V8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ABSS_V16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ABS_V4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ABS_V4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ABS_V8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_ABS_V16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_MASK_FOR_LOAD, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_MASK_FOR_STORE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_INIT_V4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_INIT_V8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_INIT_V16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_INIT_V4SF, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SET_V4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SET_V8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SET_V16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SET_V4SF, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_EXT_V4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_EXT_V8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_EXT_V16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_EXT_V4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_COPYSIGN_V4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VRECIPFP, RS6000_BTC_FP_PURE)
+/* Before including this file, some macros must be defined:
+ RS6000_BUILTIN_1 -- 1 arg builtins
+ RS6000_BUILTIN_2 -- 2 arg builtins
+ RS6000_BUILTIN_3 -- 3 arg builtins
+ RS6000_BUILTIN_A -- ABS builtins
+ RS6000_BUILTIN_D -- DST builtins
+ RS6000_BUILTIN_E -- SPE EVSEL builtins.
+ RS6000_BUILTIN_P -- Altivec and VSX predicate builtins
+ RS6000_BUILTIN_Q -- Paired floating point VSX predicate builtins
+ RS6000_BUILTIN_S -- SPE predicate builtins
+ RS6000_BUILTIN_X -- special builtins
+
+ Each of the above macros takes 4 arguments:
+ ENUM Enumeration name
+ NAME String literal for the name
+ MASK Mask of bits that indicate which options enables the builtin
+ ATTR builtin attribute information.
+ ICODE Insn code of the function that implents the builtin. */
+
+#ifndef RS6000_BUILTIN_1
+ #error "RS6000_BUILTIN_1 is not defined."
+#endif
+
+#ifndef RS6000_BUILTIN_2
+ #error "RS6000_BUILTIN_2 is not defined."
+#endif
+
+#ifndef RS6000_BUILTIN_3
+ #error "RS6000_BUILTIN_3 is not defined."
+#endif
+
+#ifndef RS6000_BUILTIN_A
+ #error "RS6000_BUILTIN_A is not defined."
+#endif
+
+#ifndef RS6000_BUILTIN_D
+ #error "RS6000_BUILTIN_D is not defined."
+#endif
+
+#ifndef RS6000_BUILTIN_E
+ #error "RS6000_BUILTIN_E is not defined."
+#endif
+
+#ifndef RS6000_BUILTIN_P
+ #error "RS6000_BUILTIN_P is not defined."
+#endif
+
+#ifndef RS6000_BUILTIN_Q
+ #error "RS6000_BUILTIN_Q is not defined."
+#endif
+
+#ifndef RS6000_BUILTIN_S
+ #error "RS6000_BUILTIN_S is not defined."
+#endif
+
+#ifndef RS6000_BUILTIN_X
+ #error "RS6000_BUILTIN_X is not defined."
+#endif
+
+#ifndef BU_AV_1
+/* Define convenience macros using token pasting to allow fitting everything in
+ one line. */
+
+/* Altivec convenience macros. */
+#define BU_ALTIVEC_1(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_1 (ALTIVEC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_altivec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_UNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_ALTIVEC_2(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_2 (ALTIVEC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_altivec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_BINARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_ALTIVEC_3(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_3 (ALTIVEC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_altivec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_TERNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_ALTIVEC_A(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_A (ALTIVEC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_altivec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_ABS), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_ALTIVEC_D(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_D (ALTIVEC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_altivec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_DST), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_ALTIVEC_P(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_P (ALTIVEC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_altivec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_PREDICATE), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_ALTIVEC_X(ENUM, NAME, ATTR) \
+ RS6000_BUILTIN_X (ALTIVEC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_altivec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_SPECIAL), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_ALTIVEC_C(ENUM, NAME, ATTR) \
+ RS6000_BUILTIN_X (ALTIVEC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_altivec_" NAME, /* NAME */ \
+ (RS6000_BTM_ALTIVEC /* MASK */ \
+ | RS6000_BTM_CELL), \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_SPECIAL), \
+ CODE_FOR_nothing) /* ICODE */
+
+/* Altivec overloaded builtin function macros. */
+#define BU_ALTIVEC_OVERLOAD_1(ENUM, NAME) \
+ RS6000_BUILTIN_1 (ALTIVEC_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_UNARY), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_ALTIVEC_OVERLOAD_2(ENUM, NAME) \
+ RS6000_BUILTIN_2 (ALTIVEC_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_BINARY), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_ALTIVEC_OVERLOAD_3(ENUM, NAME) \
+ RS6000_BUILTIN_3 (ALTIVEC_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_TERNARY), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_ALTIVEC_OVERLOAD_A(ENUM, NAME) \
+ RS6000_BUILTIN_A (ALTIVEC_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_ABS), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_ALTIVEC_OVERLOAD_D(ENUM, NAME) \
+ RS6000_BUILTIN_D (ALTIVEC_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_DST), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_ALTIVEC_OVERLOAD_P(ENUM, NAME) \
+ RS6000_BUILTIN_P (ALTIVEC_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_PREDICATE), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_ALTIVEC_OVERLOAD_X(ENUM, NAME) \
+ RS6000_BUILTIN_X (ALTIVEC_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_ALTIVEC, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_SPECIAL), \
+ CODE_FOR_nothing) /* ICODE */
+
+/* VSX convenience macros. */
+#define BU_VSX_1(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_1 (VSX_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_vsx_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_UNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_VSX_2(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_2 (VSX_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_vsx_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_BINARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_VSX_3(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_3 (VSX_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_vsx_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_TERNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_VSX_A(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_A (VSX_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_vsx_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_ABS), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_VSX_P(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_P (VSX_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_vsx_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_PREDICATE), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_VSX_X(ENUM, NAME, ATTR) \
+ RS6000_BUILTIN_X (VSX_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_vsx_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_SPECIAL), \
+ CODE_FOR_nothing) /* ICODE */
+
+/* VSX overloaded builtin function macros. */
+#define BU_VSX_OVERLOAD_1(ENUM, NAME) \
+ RS6000_BUILTIN_1 (VSX_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_UNARY), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_VSX_OVERLOAD_2(ENUM, NAME) \
+ RS6000_BUILTIN_2 (VSX_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_BINARY), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_VSX_OVERLOAD_3(ENUM, NAME) \
+ RS6000_BUILTIN_3 (VSX_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_TERNARY), \
+ CODE_FOR_nothing) /* ICODE */
+
+/* xxpermdi and xxsldwi are overloaded functions, but had __builtin_vsx names
+ instead of __builtin_vec. */
+#define BU_VSX_OVERLOAD_3V(ENUM, NAME) \
+ RS6000_BUILTIN_3 (VSX_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vsx_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_TERNARY), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_VSX_OVERLOAD_X(ENUM, NAME) \
+ RS6000_BUILTIN_X (VSX_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_VSX, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_SPECIAL), \
+ CODE_FOR_nothing) /* ICODE */
+
+/* SPE convenience macros. */
+#define BU_SPE_1(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_1 (SPE_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_spe_" NAME, /* NAME */ \
+ RS6000_BTM_SPE, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_UNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_SPE_2(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_2 (SPE_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_spe_" NAME, /* NAME */ \
+ RS6000_BTM_SPE, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_BINARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_SPE_3(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_3 (SPE_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_spe_" NAME, /* NAME */ \
+ RS6000_BTM_SPE, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_TERNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_SPE_E(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_E (SPE_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_spe_" NAME, /* NAME */ \
+ RS6000_BTM_SPE, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_EVSEL), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_SPE_P(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_S (SPE_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_spe_" NAME, /* NAME */ \
+ RS6000_BTM_SPE, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_PREDICATE), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_SPE_X(ENUM, NAME, ATTR) \
+ RS6000_BUILTIN_X (SPE_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_spe_" NAME, /* NAME */ \
+ RS6000_BTM_SPE, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_SPECIAL), \
+ CODE_FOR_nothing) /* ICODE */
+
+/* Paired floating point convenience macros. */
+#define BU_PAIRED_1(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_1 (PAIRED_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_paired_" NAME, /* NAME */ \
+ RS6000_BTM_PAIRED, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_UNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_PAIRED_2(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_2 (PAIRED_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_paired_" NAME, /* NAME */ \
+ RS6000_BTM_PAIRED, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_BINARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_PAIRED_3(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_3 (PAIRED_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_paired_" NAME, /* NAME */ \
+ RS6000_BTM_PAIRED, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_TERNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_PAIRED_P(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_Q (PAIRED_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_paired_" NAME, /* NAME */ \
+ RS6000_BTM_PAIRED, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_PREDICATE), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
+#define BU_PAIRED_X(ENUM, NAME, ATTR) \
+ RS6000_BUILTIN_X (PAIRED_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_paired_" NAME, /* NAME */ \
+ RS6000_BTM_PAIRED, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_SPECIAL), \
+ CODE_FOR_nothing) /* ICODE */
+
+#define BU_SPECIAL_X(ENUM, NAME, MASK, ATTR) \
+ RS6000_BUILTIN_X (ENUM, /* ENUM */ \
+ NAME, /* NAME */ \
+ MASK, /* MASK */ \
+ (ATTR | RS6000_BTC_SPECIAL), /* ATTR */ \
+ CODE_FOR_nothing) /* ICODE */
+#endif
+
+/* Insure 0 is not a legitimate index. */
+BU_SPECIAL_X (RS6000_BUILTIN_NONE, NULL, 0, RS6000_BTC_MISC)
+
+/* 3 argument Altivec builtins. */
+BU_ALTIVEC_3 (VMADDFP, "vmaddfp", FP, fmav4sf4)
+BU_ALTIVEC_3 (VMHADDSHS, "vmhaddshs", SAT, altivec_vmhaddshs)
+BU_ALTIVEC_3 (VMHRADDSHS, "vmhraddshs", SAT, altivec_vmhraddshs)
+BU_ALTIVEC_3 (VMLADDUHM, "vmladduhm", CONST, altivec_vmladduhm)
+BU_ALTIVEC_3 (VMSUMUBM, "vmsumubm", CONST, altivec_vmsumubm)
+BU_ALTIVEC_3 (VMSUMMBM, "vmsummbm", CONST, altivec_vmsummbm)
+BU_ALTIVEC_3 (VMSUMUHM, "vmsumuhm", CONST, altivec_vmsumuhm)
+BU_ALTIVEC_3 (VMSUMSHM, "vmsumshm", CONST, altivec_vmsumshm)
+BU_ALTIVEC_3 (VMSUMUHS, "vmsumuhs", SAT, altivec_vmsumuhs)
+BU_ALTIVEC_3 (VMSUMSHS, "vmsumshs", SAT, altivec_vmsumshs)
+BU_ALTIVEC_3 (VNMSUBFP, "vnmsubfp", FP, nfmsv4sf4)
+BU_ALTIVEC_3 (VPERM_2DF, "vperm_2df", CONST, altivec_vperm_v2df)
+BU_ALTIVEC_3 (VPERM_2DI, "vperm_2di", CONST, altivec_vperm_v2di)
+BU_ALTIVEC_3 (VPERM_4SF, "vperm_4sf", CONST, altivec_vperm_v4sf)
+BU_ALTIVEC_3 (VPERM_4SI, "vperm_4si", CONST, altivec_vperm_v4si)
+BU_ALTIVEC_3 (VPERM_8HI, "vperm_8hi", CONST, altivec_vperm_v8hi)
+BU_ALTIVEC_3 (VPERM_16QI, "vperm_16qi", CONST, altivec_vperm_v16qi_uns)
+BU_ALTIVEC_3 (VPERM_2DI_UNS, "vperm_2di_uns", CONST, altivec_vperm_v2di_uns)
+BU_ALTIVEC_3 (VPERM_4SI_UNS, "vperm_4si_uns", CONST, altivec_vperm_v4si_uns)
+BU_ALTIVEC_3 (VPERM_8HI_UNS, "vperm_8hi_uns", CONST, altivec_vperm_v8hi_uns)
+BU_ALTIVEC_3 (VPERM_16QI_UNS, "vperm_16qi_uns", CONST, altivec_vperm_v16qi_uns)
+BU_ALTIVEC_3 (VSEL_4SF, "vsel_4sf", CONST, vector_select_v4sf)
+BU_ALTIVEC_3 (VSEL_4SI, "vsel_4si", CONST, vector_select_v4si)
+BU_ALTIVEC_3 (VSEL_8HI, "vsel_8hi", CONST, vector_select_v8hi)
+BU_ALTIVEC_3 (VSEL_16QI, "vsel_16qi", CONST, vector_select_v16qi)
+BU_ALTIVEC_3 (VSEL_2DF, "vsel_2df", CONST, vector_select_v2df)
+BU_ALTIVEC_3 (VSEL_2DI, "vsel_2di", CONST, vector_select_v2di)
+BU_ALTIVEC_3 (VSEL_4SI_UNS, "vsel_4si_uns", CONST, vector_select_v4si_uns)
+BU_ALTIVEC_3 (VSEL_8HI_UNS, "vsel_8hi_uns", CONST, vector_select_v8hi_uns)
+BU_ALTIVEC_3 (VSEL_16QI_UNS, "vsel_16qi_uns", CONST, vector_select_v16qi_uns)
+BU_ALTIVEC_3 (VSEL_2DI_UNS, "vsel_2di_uns", CONST, vector_select_v2di_uns)
+BU_ALTIVEC_3 (VSLDOI_16QI, "vsldoi_16qi", CONST, altivec_vsldoi_v16qi)
+BU_ALTIVEC_3 (VSLDOI_8HI, "vsldoi_8hi", CONST, altivec_vsldoi_v8hi)
+BU_ALTIVEC_3 (VSLDOI_4SI, "vsldoi_4si", CONST, altivec_vsldoi_v4si)
+BU_ALTIVEC_3 (VSLDOI_4SF, "vsldoi_4sf", CONST, altivec_vsldoi_v4sf)
+
+/* Altivec DST builtins. */
+BU_ALTIVEC_D (DST, "dst", MISC, altivec_dst)
+BU_ALTIVEC_D (DSTT, "dstt", MISC, altivec_dstt)
+BU_ALTIVEC_D (DSTST, "dstst", MISC, altivec_dstst)
+BU_ALTIVEC_D (DSTSTT, "dststt", MISC, altivec_dststt)
+
+/* Altivec 2 argument builtin functions. */
+BU_ALTIVEC_2 (VADDUBM, "vaddubm", CONST, addv16qi3)
+BU_ALTIVEC_2 (VADDUHM, "vadduhm", CONST, addv8hi3)
+BU_ALTIVEC_2 (VADDUWM, "vadduwm", CONST, addv4si3)
+BU_ALTIVEC_2 (VADDFP, "vaddfp", CONST, addv4sf3)
+BU_ALTIVEC_2 (VADDCUW, "vaddcuw", CONST, altivec_vaddcuw)
+BU_ALTIVEC_2 (VADDUBS, "vaddubs", CONST, altivec_vaddubs)
+BU_ALTIVEC_2 (VADDSBS, "vaddsbs", CONST, altivec_vaddsbs)
+BU_ALTIVEC_2 (VADDUHS, "vadduhs", CONST, altivec_vadduhs)
+BU_ALTIVEC_2 (VADDSHS, "vaddshs", CONST, altivec_vaddshs)
+BU_ALTIVEC_2 (VADDUWS, "vadduws", CONST, altivec_vadduws)
+BU_ALTIVEC_2 (VADDSWS, "vaddsws", CONST, altivec_vaddsws)
+BU_ALTIVEC_2 (VAND, "vand", CONST, andv4si3)
+BU_ALTIVEC_2 (VANDC, "vandc", CONST, andcv4si3)
+BU_ALTIVEC_2 (VAVGUB, "vavgub", CONST, altivec_vavgub)
+BU_ALTIVEC_2 (VAVGSB, "vavgsb", CONST, altivec_vavgsb)
+BU_ALTIVEC_2 (VAVGUH, "vavguh", CONST, altivec_vavguh)
+BU_ALTIVEC_2 (VAVGSH, "vavgsh", CONST, altivec_vavgsh)
+BU_ALTIVEC_2 (VAVGUW, "vavguw", CONST, altivec_vavguw)
+BU_ALTIVEC_2 (VAVGSW, "vavgsw", CONST, altivec_vavgsw)
+BU_ALTIVEC_2 (VCFUX, "vcfux", CONST, altivec_vcfux)
+BU_ALTIVEC_2 (VCFSX, "vcfsx", CONST, altivec_vcfsx)
+BU_ALTIVEC_2 (VCMPBFP, "vcmpbfp", CONST, altivec_vcmpbfp)
+BU_ALTIVEC_2 (VCMPEQUB, "vcmpequb", CONST, vector_eqv16qi)
+BU_ALTIVEC_2 (VCMPEQUH, "vcmpequh", CONST, vector_eqv8hi)
+BU_ALTIVEC_2 (VCMPEQUW, "vcmpequw", CONST, vector_eqv4si)
+BU_ALTIVEC_2 (VCMPEQFP, "vcmpeqfp", CONST, vector_eqv4sf)
+BU_ALTIVEC_2 (VCMPGEFP, "vcmpgefp", CONST, vector_gev4sf)
+BU_ALTIVEC_2 (VCMPGTUB, "vcmpgtub", CONST, vector_gtuv16qi)
+BU_ALTIVEC_2 (VCMPGTSB, "vcmpgtsb", CONST, vector_gtv16qi)
+BU_ALTIVEC_2 (VCMPGTUH, "vcmpgtuh", CONST, vector_gtuv8hi)
+BU_ALTIVEC_2 (VCMPGTSH, "vcmpgtsh", CONST, vector_gtv8hi)
+BU_ALTIVEC_2 (VCMPGTUW, "vcmpgtuw", CONST, vector_gtuv4si)
+BU_ALTIVEC_2 (VCMPGTSW, "vcmpgtsw", CONST, vector_gtv4si)
+BU_ALTIVEC_2 (VCMPGTFP, "vcmpgtfp", CONST, vector_gtv4sf)
+BU_ALTIVEC_2 (VCTSXS, "vctsxs", CONST, altivec_vctsxs)
+BU_ALTIVEC_2 (VCTUXS, "vctuxs", CONST, altivec_vctuxs)
+BU_ALTIVEC_2 (VMAXUB, "vmaxub", CONST, umaxv16qi3)
+BU_ALTIVEC_2 (VMAXSB, "vmaxsb", CONST, smaxv16qi3)
+BU_ALTIVEC_2 (VMAXUH, "vmaxuh", CONST, umaxv8hi3)
+BU_ALTIVEC_2 (VMAXSH, "vmaxsh", CONST, smaxv8hi3)
+BU_ALTIVEC_2 (VMAXUW, "vmaxuw", CONST, umaxv4si3)
+BU_ALTIVEC_2 (VMAXSW, "vmaxsw", CONST, smaxv4si3)
+BU_ALTIVEC_2 (VMAXFP, "vmaxfp", CONST, smaxv4sf3)
+BU_ALTIVEC_2 (VMRGHB, "vmrghb", CONST, altivec_vmrghb)
+BU_ALTIVEC_2 (VMRGHH, "vmrghh", CONST, altivec_vmrghh)
+BU_ALTIVEC_2 (VMRGHW, "vmrghw", CONST, altivec_vmrghw)
+BU_ALTIVEC_2 (VMRGLB, "vmrglb", CONST, altivec_vmrglb)
+BU_ALTIVEC_2 (VMRGLH, "vmrglh", CONST, altivec_vmrglh)
+BU_ALTIVEC_2 (VMRGLW, "vmrglw", CONST, altivec_vmrglw)
+BU_ALTIVEC_2 (VMINUB, "vminub", CONST, uminv16qi3)
+BU_ALTIVEC_2 (VMINSB, "vminsb", CONST, sminv16qi3)
+BU_ALTIVEC_2 (VMINUH, "vminuh", CONST, uminv8hi3)
+BU_ALTIVEC_2 (VMINSH, "vminsh", CONST, sminv8hi3)
+BU_ALTIVEC_2 (VMINUW, "vminuw", CONST, uminv4si3)
+BU_ALTIVEC_2 (VMINSW, "vminsw", CONST, sminv4si3)
+BU_ALTIVEC_2 (VMINFP, "vminfp", CONST, sminv4sf3)
+BU_ALTIVEC_2 (VMULEUB, "vmuleub", CONST, altivec_vmuleub)
+BU_ALTIVEC_2 (VMULEUB_UNS, "vmuleub_uns", CONST, altivec_vmuleub)
+BU_ALTIVEC_2 (VMULESB, "vmulesb", CONST, altivec_vmulesb)
+BU_ALTIVEC_2 (VMULEUH, "vmuleuh", CONST, altivec_vmuleuh)
+BU_ALTIVEC_2 (VMULEUH_UNS, "vmuleuh_uns", CONST, altivec_vmuleuh)
+BU_ALTIVEC_2 (VMULESH, "vmulesh", CONST, altivec_vmulesh)
+BU_ALTIVEC_2 (VMULOUB, "vmuloub", CONST, altivec_vmuloub)
+BU_ALTIVEC_2 (VMULOUB_UNS, "vmuloub_uns", CONST, altivec_vmuloub)
+BU_ALTIVEC_2 (VMULOSB, "vmulosb", CONST, altivec_vmulosb)
+BU_ALTIVEC_2 (VMULOUH, "vmulouh", CONST, altivec_vmulouh)
+BU_ALTIVEC_2 (VMULOUH_UNS, "vmulouh_uns", CONST, altivec_vmulouh)
+BU_ALTIVEC_2 (VMULOSH, "vmulosh", CONST, altivec_vmulosh)
+BU_ALTIVEC_2 (VNOR, "vnor", CONST, norv4si3)
+BU_ALTIVEC_2 (VOR, "vor", CONST, iorv4si3)
+BU_ALTIVEC_2 (VPKUHUM, "vpkuhum", CONST, altivec_vpkuhum)
+BU_ALTIVEC_2 (VPKUWUM, "vpkuwum", CONST, altivec_vpkuwum)
+BU_ALTIVEC_2 (VPKPX, "vpkpx", CONST, altivec_vpkpx)
+BU_ALTIVEC_2 (VPKSHSS, "vpkshss", CONST, altivec_vpkshss)
+BU_ALTIVEC_2 (VPKSWSS, "vpkswss", CONST, altivec_vpkswss)
+BU_ALTIVEC_2 (VPKUHUS, "vpkuhus", CONST, altivec_vpkuhus)
+BU_ALTIVEC_2 (VPKSHUS, "vpkshus", CONST, altivec_vpkshus)
+BU_ALTIVEC_2 (VPKUWUS, "vpkuwus", CONST, altivec_vpkuwus)
+BU_ALTIVEC_2 (VPKSWUS, "vpkswus", CONST, altivec_vpkswus)
+BU_ALTIVEC_2 (VRECIPFP, "vrecipdivfp", CONST, recipv4sf3)
+BU_ALTIVEC_2 (VRLB, "vrlb", CONST, vrotlv16qi3)
+BU_ALTIVEC_2 (VRLH, "vrlh", CONST, vrotlv8hi3)
+BU_ALTIVEC_2 (VRLW, "vrlw", CONST, vrotlv4si3)
+BU_ALTIVEC_2 (VSLB, "vslb", CONST, vashlv16qi3)
+BU_ALTIVEC_2 (VSLH, "vslh", CONST, vashlv8hi3)
+BU_ALTIVEC_2 (VSLW, "vslw", CONST, vashlv4si3)
+BU_ALTIVEC_2 (VSL, "vsl", CONST, altivec_vsl)
+BU_ALTIVEC_2 (VSLO, "vslo", CONST, altivec_vslo)
+BU_ALTIVEC_2 (VSPLTB, "vspltb", CONST, altivec_vspltb)
+BU_ALTIVEC_2 (VSPLTH, "vsplth", CONST, altivec_vsplth)
+BU_ALTIVEC_2 (VSPLTW, "vspltw", CONST, altivec_vspltw)
+BU_ALTIVEC_2 (VSRB, "vsrb", CONST, vlshrv16qi3)
+BU_ALTIVEC_2 (VSRH, "vsrh", CONST, vlshrv8hi3)
+BU_ALTIVEC_2 (VSRW, "vsrw", CONST, vlshrv4si3)
+BU_ALTIVEC_2 (VSRAB, "vsrab", CONST, vashrv16qi3)
+BU_ALTIVEC_2 (VSRAH, "vsrah", CONST, vashrv8hi3)
+BU_ALTIVEC_2 (VSRAW, "vsraw", CONST, vashrv4si3)
+BU_ALTIVEC_2 (VSR, "vsr", CONST, altivec_vsr)
+BU_ALTIVEC_2 (VSRO, "vsro", CONST, altivec_vsro)
+BU_ALTIVEC_2 (VSUBUBM, "vsububm", CONST, subv16qi3)
+BU_ALTIVEC_2 (VSUBUHM, "vsubuhm", CONST, subv8hi3)
+BU_ALTIVEC_2 (VSUBUWM, "vsubuwm", CONST, subv4si3)
+BU_ALTIVEC_2 (VSUBFP, "vsubfp", CONST, subv4sf3)
+BU_ALTIVEC_2 (VSUBCUW, "vsubcuw", CONST, altivec_vsubcuw)
+BU_ALTIVEC_2 (VSUBUBS, "vsububs", CONST, altivec_vsububs)
+BU_ALTIVEC_2 (VSUBSBS, "vsubsbs", CONST, altivec_vsubsbs)
+BU_ALTIVEC_2 (VSUBUHS, "vsubuhs", CONST, altivec_vsubuhs)
+BU_ALTIVEC_2 (VSUBSHS, "vsubshs", CONST, altivec_vsubshs)
+BU_ALTIVEC_2 (VSUBUWS, "vsubuws", CONST, altivec_vsubuws)
+BU_ALTIVEC_2 (VSUBSWS, "vsubsws", CONST, altivec_vsubsws)
+BU_ALTIVEC_2 (VSUM4UBS, "vsum4ubs", CONST, altivec_vsum4ubs)
+BU_ALTIVEC_2 (VSUM4SBS, "vsum4sbs", CONST, altivec_vsum4sbs)
+BU_ALTIVEC_2 (VSUM4SHS, "vsum4shs", CONST, altivec_vsum4shs)
+BU_ALTIVEC_2 (VSUM2SWS, "vsum2sws", CONST, altivec_vsum2sws)
+BU_ALTIVEC_2 (VSUMSWS, "vsumsws", CONST, altivec_vsumsws)
+BU_ALTIVEC_2 (VXOR, "vxor", CONST, xorv4si3)
+BU_ALTIVEC_2 (COPYSIGN_V4SF, "copysignfp", CONST, vector_copysignv4sf3)
+
+/* Altivec ABS functions. */
+BU_ALTIVEC_A (ABS_V4SI, "abs_v4si", CONST, absv4si2)
+BU_ALTIVEC_A (ABS_V8HI, "abs_v8hi", CONST, absv8hi2)
+BU_ALTIVEC_A (ABS_V4SF, "abs_v4sf", CONST, absv4sf2)
+BU_ALTIVEC_A (ABS_V16QI, "abs_v16qi", CONST, absv16qi2)
+BU_ALTIVEC_A (ABSS_V4SI, "abss_v4si", SAT, altivec_abss_v4si)
+BU_ALTIVEC_A (ABSS_V8HI, "abss_v8hi", SAT, altivec_abss_v8hi)
+BU_ALTIVEC_A (ABSS_V16QI, "abss_v16qi", SAT, altivec_abss_v16qi)
+
+/* 1 argument Altivec builtin functions. */
+BU_ALTIVEC_1 (VEXPTEFP, "vexptefp", FP, altivec_vexptefp)
+BU_ALTIVEC_1 (VLOGEFP, "vlogefp", FP, altivec_vlogefp)
+BU_ALTIVEC_1 (VREFP, "vrefp", FP, rev4sf2)
+BU_ALTIVEC_1 (VRFIM, "vrfim", FP, vector_floorv4sf2)
+BU_ALTIVEC_1 (VRFIN, "vrfin", FP, altivec_vrfin)
+BU_ALTIVEC_1 (VRFIP, "vrfip", FP, vector_ceilv4sf2)
+BU_ALTIVEC_1 (VRFIZ, "vrfiz", FP, vector_btruncv4sf2)
+BU_ALTIVEC_1 (VRSQRTFP, "vrsqrtfp", FP, rsqrtv4sf2)
+BU_ALTIVEC_1 (VRSQRTEFP, "vrsqrtefp", FP, rsqrtev4sf2)
+BU_ALTIVEC_1 (VSPLTISB, "vspltisb", CONST, altivec_vspltisb)
+BU_ALTIVEC_1 (VSPLTISH, "vspltish", CONST, altivec_vspltish)
+BU_ALTIVEC_1 (VSPLTISW, "vspltisw", CONST, altivec_vspltisw)
+BU_ALTIVEC_1 (VUPKHSB, "vupkhsb", CONST, altivec_vupkhsb)
+BU_ALTIVEC_1 (VUPKHPX, "vupkhpx", CONST, altivec_vupkhpx)
+BU_ALTIVEC_1 (VUPKHSH, "vupkhsh", CONST, altivec_vupkhsh)
+BU_ALTIVEC_1 (VUPKLSB, "vupklsb", CONST, altivec_vupklsb)
+BU_ALTIVEC_1 (VUPKLPX, "vupklpx", CONST, altivec_vupklpx)
+BU_ALTIVEC_1 (VUPKLSH, "vupklsh", CONST, altivec_vupklsh)
+
+BU_ALTIVEC_1 (FLOAT_V4SI_V4SF, "float_sisf", FP, floatv4siv4sf2)
+BU_ALTIVEC_1 (UNSFLOAT_V4SI_V4SF, "uns_float_sisf", FP, floatunsv4siv4sf2)
+BU_ALTIVEC_1 (FIX_V4SF_V4SI, "fix_sfsi", FP, fix_truncv4sfv4si2)
+BU_ALTIVEC_1 (FIXUNS_V4SF_V4SI, "fixuns_sfsi", FP, fixuns_truncv4sfv4si2)
+
+/* Altivec predicate functions. */
+BU_ALTIVEC_P (VCMPBFP_P, "vcmpbfp_p", CONST, altivec_vcmpbfp_p)
+BU_ALTIVEC_P (VCMPEQFP_P, "vcmpeqfp_p", CONST, vector_eq_v4sf_p)
+BU_ALTIVEC_P (VCMPGEFP_P, "vcmpgefp_p", CONST, vector_ge_v4sf_p)
+BU_ALTIVEC_P (VCMPGTFP_P, "vcmpgtfp_p", CONST, vector_gt_v4sf_p)
+BU_ALTIVEC_P (VCMPEQUW_P, "vcmpequw_p", CONST, vector_eq_v4si_p)
+BU_ALTIVEC_P (VCMPGTSW_P, "vcmpgtsw_p", CONST, vector_gt_v4si_p)
+BU_ALTIVEC_P (VCMPGTUW_P, "vcmpgtuw_p", CONST, vector_gtu_v4si_p)
+BU_ALTIVEC_P (VCMPEQUH_P, "vcmpequh_p", CONST, vector_eq_v8hi_p)
+BU_ALTIVEC_P (VCMPGTSH_P, "vcmpgtsh_p", CONST, vector_gt_v8hi_p)
+BU_ALTIVEC_P (VCMPGTUH_P, "vcmpgtuh_p", CONST, vector_gtu_v8hi_p)
+BU_ALTIVEC_P (VCMPEQUB_P, "vcmpequb_p", CONST, vector_eq_v16qi_p)
+BU_ALTIVEC_P (VCMPGTSB_P, "vcmpgtsb_p", CONST, vector_gt_v16qi_p)
+BU_ALTIVEC_P (VCMPGTUB_P, "vcmpgtub_p", CONST, vector_gtu_v16qi_p)
+
+/* AltiVec builtins that are handled as special cases. */
+BU_ALTIVEC_X (ST_INTERNAL_4si, "st_internal_4si", MEM)
+BU_ALTIVEC_X (LD_INTERNAL_4si, "ld_internal_4si", MEM)
+BU_ALTIVEC_X (ST_INTERNAL_8hi, "st_internal_8hi", MEM)
+BU_ALTIVEC_X (LD_INTERNAL_8hi, "ld_internal_8hi", MEM)
+BU_ALTIVEC_X (ST_INTERNAL_16qi, "st_internal_16qi", MEM)
+BU_ALTIVEC_X (LD_INTERNAL_16qi, "ld_internal_16qi", MEM)
+BU_ALTIVEC_X (ST_INTERNAL_4sf, "st_internal_16qi", MEM)
+BU_ALTIVEC_X (LD_INTERNAL_4sf, "ld_internal_4sf", MEM)
+BU_ALTIVEC_X (ST_INTERNAL_2df, "st_internal_4sf", MEM)
+BU_ALTIVEC_X (LD_INTERNAL_2df, "ld_internal_2df", MEM)
+BU_ALTIVEC_X (ST_INTERNAL_2di, "st_internal_2di", MEM)
+BU_ALTIVEC_X (LD_INTERNAL_2di, "ld_internal_2di", MEM)
+BU_ALTIVEC_X (MTVSCR, "mtvscr", MISC)
+BU_ALTIVEC_X (MFVSCR, "mfvscr", MISC)
+BU_ALTIVEC_X (DSSALL, "dssall", MISC)
+BU_ALTIVEC_X (DSS, "dss", MISC)
+BU_ALTIVEC_X (LVSL, "lvsl", MEM)
+BU_ALTIVEC_X (LVSR, "lvsr", MEM)
+BU_ALTIVEC_X (LVEBX, "lvebx", MEM)
+BU_ALTIVEC_X (LVEHX, "lvehx", MEM)
+BU_ALTIVEC_X (LVEWX, "lvewx", MEM)
+BU_ALTIVEC_X (LVXL, "lvxl", MEM)
+BU_ALTIVEC_X (LVX, "lvx", MEM)
+BU_ALTIVEC_X (STVX, "stvx", MEM)
+BU_ALTIVEC_C (LVLX, "lvlx", MEM)
+BU_ALTIVEC_C (LVLXL, "lvlxl", MEM)
+BU_ALTIVEC_C (LVRX, "lvrx", MEM)
+BU_ALTIVEC_C (LVRXL, "lvrxl", MEM)
+BU_ALTIVEC_X (STVEBX, "stvebx", MEM)
+BU_ALTIVEC_X (STVEHX, "stvehx", MEM)
+BU_ALTIVEC_X (STVEWX, "stvewx", MEM)
+BU_ALTIVEC_X (STVXL, "stvxl", MEM)
+BU_ALTIVEC_C (STVLX, "stvlx", MEM)
+BU_ALTIVEC_C (STVLXL, "stvlxl", MEM)
+BU_ALTIVEC_C (STVRX, "stvrx", MEM)
+BU_ALTIVEC_C (STVRXL, "stvrxl", MEM)
+BU_ALTIVEC_X (MASK_FOR_LOAD, "mask_for_load", MISC)
+BU_ALTIVEC_X (MASK_FOR_STORE, "mask_for_store", MISC)
+BU_ALTIVEC_X (VEC_INIT_V4SI, "vec_init_v4si", CONST)
+BU_ALTIVEC_X (VEC_INIT_V8HI, "vec_init_v8hi", CONST)
+BU_ALTIVEC_X (VEC_INIT_V16QI, "vec_init_v16qi", CONST)
+BU_ALTIVEC_X (VEC_INIT_V4SF, "vec_init_v4sf", CONST)
+BU_ALTIVEC_X (VEC_SET_V4SI, "vec_set_v4si", CONST)
+BU_ALTIVEC_X (VEC_SET_V8HI, "vec_set_v8hi", CONST)
+BU_ALTIVEC_X (VEC_SET_V16QI, "vec_set_v16qi", CONST)
+BU_ALTIVEC_X (VEC_SET_V4SF, "vec_set_v4sf", CONST)
+BU_ALTIVEC_X (VEC_EXT_V4SI, "vec_ext_v4si", CONST)
+BU_ALTIVEC_X (VEC_EXT_V8HI, "vec_ext_v8hi", CONST)
+BU_ALTIVEC_X (VEC_EXT_V16QI, "vec_ext_v16qi", CONST)
+BU_ALTIVEC_X (VEC_EXT_V4SF, "vec_ext_v4sf", CONST)
/* Altivec overloaded builtins. */
/* For now, don't set the classification for overloaded functions.
The function should be converted to the type specific instruction
before we get to the point about classifying the builtin type. */
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPEQ_P, RS6000_BTC_MISC)
-RS6000_BUILTIN_EQUATE(ALTIVEC_BUILTIN_OVERLOADED_FIRST,
- ALTIVEC_BUILTIN_VCMPEQ_P)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGT_P, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VCMPGE_P, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_ABS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_ABSS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_ADD, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_ADDC, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_ADDS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_AND, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_ANDC, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_AVG, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_EXTRACT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CEIL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CMPB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CMPEQ, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CMPEQUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CMPEQUH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CMPEQUW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CMPGE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CMPGT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CMPLE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CMPLT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_COPYSIGN, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CTF, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CTS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_CTU, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_DST, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_DSTST, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_DSTSTT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_DSTT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_EXPTE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_FLOOR, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LD, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LDE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LDL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LOGE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LVEBX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LVEHX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LVEWX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LVLX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LVLXL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LVRX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LVRXL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LVSL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_LVSR, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MADD, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MADDS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MAX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MERGEH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MERGEL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MIN, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MLADD, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MPERM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MRADDS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MRGHB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MRGHH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MRGHW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MRGLB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MRGLH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MRGLW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MSUM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MSUMS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MTVSCR, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MULE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_MULO, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_NEARBYINT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_NMSUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_NOR, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_OR, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_PACK, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_PACKPX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_PACKS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_PACKSU, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_PERM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RECIP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RINT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_ROUND, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RSQRT, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_RSQRTE, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SEL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SLD, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SLL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SLO, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLAT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLAT_S16, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLAT_S32, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLAT_S8, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLAT_U16, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLAT_U32, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLAT_U8, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLTB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLTH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLTW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SQRT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SR, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SRA, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SRL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SRO, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_ST, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STVEBX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STVEHX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STVEWX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STVLX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STVLXL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STVRX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STVRXL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SUBC, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SUBS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SUM2S, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SUM4S, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SUMS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_TRUNC, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_UNPACKH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_UNPACKL, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDFP, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDSBS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDSHS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDSWS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDUBM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDUBS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDUHM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDUHS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDUWM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VADDUWS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VAVGSB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VAVGSH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VAVGSW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VAVGUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VAVGUH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VAVGUW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCFSX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCFUX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPEQFP, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPEQUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPEQUH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPEQUW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPGTFP, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPGTSB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPGTSH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPGTSW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPGTUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPGTUH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VCMPGTUW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMAXFP, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMAXSB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMAXSH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMAXSW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMAXUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMAXUH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMAXUW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMINFP, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMINSB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMINSH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMINSW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMINUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMINUH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMINUW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMRGHB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMRGHH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMRGHW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMRGLB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMRGLH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMRGLW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMSUMMBM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMSUMSHM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMSUMSHS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMSUMUBM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMSUMUHM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMSUMUHS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMULESB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMULESH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMULEUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMULEUH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMULOSB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMULOSH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMULOUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VMULOUH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VPKSHSS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VPKSHUS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VPKSWSS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VPKSWUS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VPKUHUM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VPKUHUS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VPKUWUM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VPKUWUS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VRLB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VRLH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VRLW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSLB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSLH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSLW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSPLTB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSPLTH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSPLTW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSRAB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSRAH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSRAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSRB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSRH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSRW, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBFP, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBSBS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBSHS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBSWS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBUBM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBUBS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBUHM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBUHS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBUWM, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUBUWS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUM4SBS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUM4SHS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VSUM4UBS, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VUPKHPX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VUPKHSB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VUPKHSH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VUPKLPX, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VUPKLSB, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_VUPKLSH, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_XOR, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_STEP, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_PROMOTE, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_INSERT, RS6000_BTC_MISC)
-RS6000_BUILTIN(ALTIVEC_BUILTIN_VEC_SPLATS, RS6000_BTC_MISC)
-RS6000_BUILTIN_EQUATE(ALTIVEC_BUILTIN_OVERLOADED_LAST,
- ALTIVEC_BUILTIN_VEC_SPLATS)
-
-/* SPE builtins. */
-RS6000_BUILTIN(SPE_BUILTIN_EVADDW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVAND, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVANDC, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVDIVWS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVDIVWU, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVEQV, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSADD, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSDIV, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSMUL, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSSUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLDDX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLDHX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLDWX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLHHESPLATX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLHHOSSPLATX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLHHOUSPLATX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWHEX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWHOSX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWHOUX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWHSPLATX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWWSPLATX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMERGEHI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMERGEHILO, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMERGELO, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMERGELOHI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEGSMFAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEGSMFAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEGSMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEGSMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEGUMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEGUMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESMF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESMFA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESMFAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESMFANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESMI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESMIA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESMIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESSF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESSFA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESSFAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESSFANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHESSIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEUMI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEUMIA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEUMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEUMIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEUSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHEUSIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOGSMFAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOGSMFAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOGSMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOGSMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOGUMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOGUMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSMF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSMFA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSMFAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSMFANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSMI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSMIA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSMIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSSF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSSFA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSSFAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSSFANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOSSIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOUMI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOUMIA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOUMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOUMIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOUSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMHOUSIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSMF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSMFA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSMI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSMIA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSSF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSSFA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHUMI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHUMIA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLSMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLSMIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLSSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLSSIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLUMI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLUMIA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLUMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLUMIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLUSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWLUSIANW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSMF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSMFA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSMFAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSMFAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSMI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSMIA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSSFAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSSF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSSFA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSSFAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWSSFAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWUMI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWUMIA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWUMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWUMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVNAND, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVNOR, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVOR, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVORC, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVRLW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSLW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSRWS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSRWU, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTDDX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTDHX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTDWX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTWHEX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTWHOX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTWWEX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTWWOX, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSUBFW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVXOR, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVABS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVADDSMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVADDSSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVADDUMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVADDUSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVCNTLSW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVCNTLZW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVEXTSB, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVEXTSH, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSABS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCFSF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCFSI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCFUF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCFUI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCTSF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCTSI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCTSIZ, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCTUF, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCTUI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCTUIZ, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSNABS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSNEG, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMRA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVNEG, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVRNDW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSUBFSMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSUBFSSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSUBFUMIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSUBFUSIAAW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVADDIW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLDD, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLDH, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLDW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLHHESPLAT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLHHOSSPLAT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLHHOUSPLAT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWHE, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWHOS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWHOU, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWHSPLAT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVLWWSPLAT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVRLWI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSLWI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSRWIS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSRWIU, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTDD, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTDH, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTDW, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTWHE, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTWHO, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTWWE, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSTWWO, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSUBIFW, RS6000_BTC_MISC)
-
- /* Compares. */
-RS6000_BUILTIN(SPE_BUILTIN_EVCMPEQ, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVCMPGTS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVCMPGTU, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVCMPLTS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVCMPLTU, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCMPEQ, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCMPGT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSCMPLT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSTSTEQ, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSTSTGT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVFSTSTLT, RS6000_BTC_MISC)
-
-/* EVSEL compares. */
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_CMPEQ, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_CMPGTS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_CMPGTU, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_CMPLTS, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_CMPLTU, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_FSCMPEQ, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_FSCMPGT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_FSCMPLT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_FSTSTEQ, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_FSTSTGT, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSEL_FSTSTLT, RS6000_BTC_MISC)
-
-RS6000_BUILTIN(SPE_BUILTIN_EVSPLATFI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVSPLATI, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSSMAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSMFAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHUSIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHUMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSSFAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSSIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSMFAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHSMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHUSIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHUMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHGSSFAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHGSMFAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHGSMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHGUMIAA, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHGSSFAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHGSMFAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHGSMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_EVMWHGUMIAN, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_MTSPEFSCR, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_MFSPEFSCR, RS6000_BTC_MISC)
-RS6000_BUILTIN(SPE_BUILTIN_BRINC, RS6000_BTC_MISC)
-
-/* PAIRED builtins. */
-RS6000_BUILTIN(PAIRED_BUILTIN_DIVV2SF3, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_ABSV2SF2, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_NEGV2SF2, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_SQRTV2SF2, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_ADDV2SF3, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_SUBV2SF3, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_RESV2SF2, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MULV2SF3, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MSUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MADD, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_NMSUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_NMADD, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_NABSV2SF2, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_SUM0, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_SUM1, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MULS0, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MULS1, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MERGE00, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MERGE01, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MERGE10, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MERGE11, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MADDS0, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_MADDS1, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_STX, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_LX, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_SELV2SF4, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_CMPU0, RS6000_BTC_MISC)
-RS6000_BUILTIN(PAIRED_BUILTIN_CMPU1, RS6000_BTC_MISC)
-
- /* VSX builtins. */
-RS6000_BUILTIN(VSX_BUILTIN_LXSDX, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_LXVD2X_V2DF, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_LXVD2X_V2DI, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_LXVDSX, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_LXVW4X_V4SF, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_LXVW4X_V4SI, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_LXVW4X_V8HI, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_LXVW4X_V16QI, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_STXSDX, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_STXVD2X_V2DF, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_STXVD2X_V2DI, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_STXVW4X_V4SF, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_STXVW4X_V4SI, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_STXVW4X_V8HI, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_STXVW4X_V16QI, RS6000_BTC_MEM)
-RS6000_BUILTIN(VSX_BUILTIN_XSABSDP, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XSADDDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCMPODP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCMPUDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCPSGNDP, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XSCVDPSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCVDPSXDS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCVDPSXWS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCVDPUXDS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCVDPUXWS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCVSPDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCVSXDDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSCVUXDDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSDIVDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSMADDADP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSMADDMDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSMAXDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSMINDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSMOVDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSMSUBADP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSMSUBMDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSMULDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSNABSDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSNEGDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSNMADDADP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSNMADDMDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSNMSUBADP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSNMSUBMDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSRDPI, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSRDPIC, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSRDPIM, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSRDPIP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSRDPIZ, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSREDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSRSQRTEDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSSQRTDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSSUBDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_CPSGNDP, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_CPSGNSP, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XSTDIVDP_FE, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSTDIVDP_FG, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSTSQRTDP_FE, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XSTSQRTDP_FG, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVABSDP, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XVABSSP, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XVADDDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVADDSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPEQDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPEQSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPGEDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPGESP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPGTDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPGTSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPEQDP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPEQSP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPGEDP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPGESP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPGTDP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCMPGTSP_P, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCPSGNDP, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XVCPSGNSP, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVDPSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVDPSXDS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVDPSXWS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVDPUXDS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVDPUXDS_UNS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVDPUXWS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVSPDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVSPSXDS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVSPSXWS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVSPUXDS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVSPUXWS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVSXDDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVSXDSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVSXWDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVSXWSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVUXDDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVUXDDP_UNS, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVUXDSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVUXWDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVCVUXWSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVDIVDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVDIVSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMADDDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMADDSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMAXDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMAXSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMINDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMINSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMSUBDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMSUBSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMULDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVMULSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVNABSDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVNABSSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVNEGDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVNEGSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVNMADDDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVNMADDSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVNMSUBDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVNMSUBSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRDPI, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRDPIC, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRDPIM, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRDPIP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRDPIZ, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVREDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRESP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRSPI, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRSPIC, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRSPIM, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRSPIP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRSPIZ, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRSQRTEDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVRSQRTESP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVSQRTDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVSQRTSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVSUBDP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVSUBSP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVTDIVDP_FE, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVTDIVDP_FG, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVTDIVSP_FE, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVTDIVSP_FG, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVTSQRTDP_FE, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVTSQRTDP_FG, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVTSQRTSP_FE, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XVTSQRTSP_FG, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_2DI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_4SI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_8HI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSEL_16QI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_2DI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_4SI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_8HI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VPERM_16QI_UNS, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXPERMDI_2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXPERMDI_2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXPERMDI_4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXPERMDI_4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXPERMDI_8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXPERMDI_16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_CONCAT_2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_CONCAT_2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_SET_2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_SET_2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_SPLAT_2DF, RS6000_BTC_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_SPLAT_2DI, RS6000_BTC_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_XXMRGHW_4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXMRGHW_4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXMRGLW_4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXMRGLW_4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSLDWI_16QI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSLDWI_8HI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSLDWI_4SI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSLDWI_4SF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSLDWI_2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_XXSLDWI_2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_INIT_V2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_INIT_V2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_SET_V2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_SET_V2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_EXT_V2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_EXT_V2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_MERGEL_V2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_MERGEL_V2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_MERGEH_V2DF, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_MERGEH_V2DI, RS6000_BTC_CONST)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_RSQRT_V4SF, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_RSQRT_V2DF, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_RECIP_V4SF, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VSX_BUILTIN_RECIP_V2DF, RS6000_BTC_FP_PURE)
+
+/* 3 argument Altivec overloaded builtins. */
+BU_ALTIVEC_OVERLOAD_3 (MADD, "madd")
+BU_ALTIVEC_OVERLOAD_3 (MADDS, "madds")
+BU_ALTIVEC_OVERLOAD_3 (MLADD, "mladd")
+BU_ALTIVEC_OVERLOAD_3 (MRADDS, "mradds")
+BU_ALTIVEC_OVERLOAD_3 (MSUM, "msum")
+BU_ALTIVEC_OVERLOAD_3 (MSUMS, "msums")
+BU_ALTIVEC_OVERLOAD_3 (NMSUB, "nmsub")
+BU_ALTIVEC_OVERLOAD_3 (PERM, "perm")
+BU_ALTIVEC_OVERLOAD_3 (SEL, "sel")
+BU_ALTIVEC_OVERLOAD_3 (VMSUMMBM, "vmsummbm")
+BU_ALTIVEC_OVERLOAD_3 (VMSUMSHM, "vmsumshm")
+BU_ALTIVEC_OVERLOAD_3 (VMSUMSHS, "vmsumshs")
+BU_ALTIVEC_OVERLOAD_3 (VMSUMUBM, "vmsumubm")
+BU_ALTIVEC_OVERLOAD_3 (VMSUMUHM, "vmsumuhm")
+BU_ALTIVEC_OVERLOAD_3 (VMSUMUHS, "vmsumuhs")
+
+/* Altivec DST overloaded builtins. */
+BU_ALTIVEC_OVERLOAD_D (DST, "dst")
+BU_ALTIVEC_OVERLOAD_D (DSTT, "dstt")
+BU_ALTIVEC_OVERLOAD_D (DSTST, "dstst")
+BU_ALTIVEC_OVERLOAD_D (DSTSTT, "dststt")
+
+/* 2 argument Altivec overloaded builtins. */
+BU_ALTIVEC_OVERLOAD_2 (ADD, "add")
+BU_ALTIVEC_OVERLOAD_2 (ADDC, "addc")
+BU_ALTIVEC_OVERLOAD_2 (ADDS, "adds")
+BU_ALTIVEC_OVERLOAD_2 (AND, "and")
+BU_ALTIVEC_OVERLOAD_2 (ANDC, "andc")
+BU_ALTIVEC_OVERLOAD_2 (AVG, "avg")
+BU_ALTIVEC_OVERLOAD_2 (CMPB, "cmpb")
+BU_ALTIVEC_OVERLOAD_2 (CMPEQ, "cmpeq")
+BU_ALTIVEC_OVERLOAD_2 (CMPGE, "cmpge")
+BU_ALTIVEC_OVERLOAD_2 (CMPGT, "cmpgt")
+BU_ALTIVEC_OVERLOAD_2 (CMPLE, "cmple")
+BU_ALTIVEC_OVERLOAD_2 (CMPLT, "cmplt")
+BU_ALTIVEC_OVERLOAD_2 (COPYSIGN, "copysign")
+BU_ALTIVEC_OVERLOAD_2 (MAX, "max")
+BU_ALTIVEC_OVERLOAD_2 (MERGEH, "mergeh")
+BU_ALTIVEC_OVERLOAD_2 (MERGEL, "mergel")
+BU_ALTIVEC_OVERLOAD_2 (MIN, "min")
+BU_ALTIVEC_OVERLOAD_2 (MULE, "mule")
+BU_ALTIVEC_OVERLOAD_2 (MULO, "mulo")
+BU_ALTIVEC_OVERLOAD_2 (NOR, "nor")
+BU_ALTIVEC_OVERLOAD_2 (OR, "or")
+BU_ALTIVEC_OVERLOAD_2 (PACK, "pack")
+BU_ALTIVEC_OVERLOAD_2 (PACKPX, "packpx")
+BU_ALTIVEC_OVERLOAD_2 (PACKS, "packs")
+BU_ALTIVEC_OVERLOAD_2 (PACKSU, "packsu")
+BU_ALTIVEC_OVERLOAD_2 (RECIP, "recipdiv")
+BU_ALTIVEC_OVERLOAD_2 (RL, "rl")
+BU_ALTIVEC_OVERLOAD_2 (SL, "sl")
+BU_ALTIVEC_OVERLOAD_2 (SLL, "sll")
+BU_ALTIVEC_OVERLOAD_2 (SLO, "slo")
+BU_ALTIVEC_OVERLOAD_2 (SR, "sr")
+BU_ALTIVEC_OVERLOAD_2 (SRA, "sra")
+BU_ALTIVEC_OVERLOAD_2 (SRL, "srl")
+BU_ALTIVEC_OVERLOAD_2 (SRO, "sro")
+BU_ALTIVEC_OVERLOAD_2 (SUB, "sub")
+BU_ALTIVEC_OVERLOAD_2 (SUBC, "subc")
+BU_ALTIVEC_OVERLOAD_2 (SUBS, "subs")
+BU_ALTIVEC_OVERLOAD_2 (SUM2S, "sum2s")
+BU_ALTIVEC_OVERLOAD_2 (SUM4S, "sum4s")
+BU_ALTIVEC_OVERLOAD_2 (SUMS, "sums")
+BU_ALTIVEC_OVERLOAD_2 (VADDFP, "vaddfp")
+BU_ALTIVEC_OVERLOAD_2 (VADDSBS, "vaddsbs")
+BU_ALTIVEC_OVERLOAD_2 (VADDSHS, "vaddshs")
+BU_ALTIVEC_OVERLOAD_2 (VADDSWS, "vaddsws")
+BU_ALTIVEC_OVERLOAD_2 (VADDUBM, "vaddubm")
+BU_ALTIVEC_OVERLOAD_2 (VADDUBS, "vaddubs")
+BU_ALTIVEC_OVERLOAD_2 (VADDUHM, "vadduhm")
+BU_ALTIVEC_OVERLOAD_2 (VADDUHS, "vadduhs")
+BU_ALTIVEC_OVERLOAD_2 (VADDUWM, "vadduwm")
+BU_ALTIVEC_OVERLOAD_2 (VADDUWS, "vadduws")
+BU_ALTIVEC_OVERLOAD_2 (VAVGSB, "vavgsb")
+BU_ALTIVEC_OVERLOAD_2 (VAVGSH, "vavgsh")
+BU_ALTIVEC_OVERLOAD_2 (VAVGSW, "vavgsw")
+BU_ALTIVEC_OVERLOAD_2 (VAVGUB, "vavgub")
+BU_ALTIVEC_OVERLOAD_2 (VAVGUH, "vavguh")
+BU_ALTIVEC_OVERLOAD_2 (VAVGUW, "vavguw")
+BU_ALTIVEC_OVERLOAD_2 (VCMPEQFP, "vcmpeqfp")
+BU_ALTIVEC_OVERLOAD_2 (VCMPEQUB, "vcmpequb")
+BU_ALTIVEC_OVERLOAD_2 (VCMPEQUH, "vcmpequh")
+BU_ALTIVEC_OVERLOAD_2 (VCMPEQUW, "vcmpequw")
+BU_ALTIVEC_OVERLOAD_2 (VCMPGTFP, "vcmpgtfp")
+BU_ALTIVEC_OVERLOAD_2 (VCMPGTSB, "vcmpgtsb")
+BU_ALTIVEC_OVERLOAD_2 (VCMPGTSH, "vcmpgtsh")
+BU_ALTIVEC_OVERLOAD_2 (VCMPGTSW, "vcmpgtsw")
+BU_ALTIVEC_OVERLOAD_2 (VCMPGTUB, "vcmpgtub")
+BU_ALTIVEC_OVERLOAD_2 (VCMPGTUH, "vcmpgtuh")
+BU_ALTIVEC_OVERLOAD_2 (VCMPGTUW, "vcmpgtuw")
+BU_ALTIVEC_OVERLOAD_2 (VMAXFP, "vmaxfp")
+BU_ALTIVEC_OVERLOAD_2 (VMAXSB, "vmaxsb")
+BU_ALTIVEC_OVERLOAD_2 (VMAXSH, "vmaxsh")
+BU_ALTIVEC_OVERLOAD_2 (VMAXSW, "vmaxsw")
+BU_ALTIVEC_OVERLOAD_2 (VMAXUB, "vmaxub")
+BU_ALTIVEC_OVERLOAD_2 (VMAXUH, "vmaxuh")
+BU_ALTIVEC_OVERLOAD_2 (VMAXUW, "vmaxuw")
+BU_ALTIVEC_OVERLOAD_2 (VMINFP, "vminfp")
+BU_ALTIVEC_OVERLOAD_2 (VMINSB, "vminsb")
+BU_ALTIVEC_OVERLOAD_2 (VMINSH, "vminsh")
+BU_ALTIVEC_OVERLOAD_2 (VMINSW, "vminsw")
+BU_ALTIVEC_OVERLOAD_2 (VMINUB, "vminub")
+BU_ALTIVEC_OVERLOAD_2 (VMINUH, "vminuh")
+BU_ALTIVEC_OVERLOAD_2 (VMINUW, "vminuw")
+BU_ALTIVEC_OVERLOAD_2 (VMRGHB, "vmrghb")
+BU_ALTIVEC_OVERLOAD_2 (VMRGHH, "vmrghh")
+BU_ALTIVEC_OVERLOAD_2 (VMRGHW, "vmrghw")
+BU_ALTIVEC_OVERLOAD_2 (VMRGLB, "vmrglb")
+BU_ALTIVEC_OVERLOAD_2 (VMRGLH, "vmrglh")
+BU_ALTIVEC_OVERLOAD_2 (VMRGLW, "vmrglw")
+BU_ALTIVEC_OVERLOAD_2 (VMULESB, "vmulesb")
+BU_ALTIVEC_OVERLOAD_2 (VMULESH, "vmulesh")
+BU_ALTIVEC_OVERLOAD_2 (VMULEUB, "vmuleub")
+BU_ALTIVEC_OVERLOAD_2 (VMULEUH, "vmuleuh")
+BU_ALTIVEC_OVERLOAD_2 (VMULOSB, "vmulosb")
+BU_ALTIVEC_OVERLOAD_2 (VMULOSH, "vmulosh")
+BU_ALTIVEC_OVERLOAD_2 (VMULOUB, "vmuloub")
+BU_ALTIVEC_OVERLOAD_2 (VMULOUH, "vmulouh")
+BU_ALTIVEC_OVERLOAD_2 (VPKSHSS, "vpkshss")
+BU_ALTIVEC_OVERLOAD_2 (VPKSHUS, "vpkshus")
+BU_ALTIVEC_OVERLOAD_2 (VPKSWSS, "vpkswss")
+BU_ALTIVEC_OVERLOAD_2 (VPKSWUS, "vpkswus")
+BU_ALTIVEC_OVERLOAD_2 (VPKUHUM, "vpkuhum")
+BU_ALTIVEC_OVERLOAD_2 (VPKUHUS, "vpkuhus")
+BU_ALTIVEC_OVERLOAD_2 (VPKUWUM, "vpkuwum")
+BU_ALTIVEC_OVERLOAD_2 (VPKUWUS, "vpkuwus")
+BU_ALTIVEC_OVERLOAD_2 (VRLB, "vrlb")
+BU_ALTIVEC_OVERLOAD_2 (VRLH, "vrlh")
+BU_ALTIVEC_OVERLOAD_2 (VRLW, "vrlw")
+BU_ALTIVEC_OVERLOAD_2 (VSLB, "vslb")
+BU_ALTIVEC_OVERLOAD_2 (VSLH, "vslh")
+BU_ALTIVEC_OVERLOAD_2 (VSLW, "vslw")
+BU_ALTIVEC_OVERLOAD_2 (VSRAB, "vsrab")
+BU_ALTIVEC_OVERLOAD_2 (VSRAH, "vsrah")
+BU_ALTIVEC_OVERLOAD_2 (VSRAW, "vsraw")
+BU_ALTIVEC_OVERLOAD_2 (VSRB, "vsrb")
+BU_ALTIVEC_OVERLOAD_2 (VSRH, "vsrh")
+BU_ALTIVEC_OVERLOAD_2 (VSRW, "vsrw")
+BU_ALTIVEC_OVERLOAD_2 (VSUBFP, "vsubfp")
+BU_ALTIVEC_OVERLOAD_2 (VSUBSBS, "vsubsbs")
+BU_ALTIVEC_OVERLOAD_2 (VSUBSHS, "vsubshs")
+BU_ALTIVEC_OVERLOAD_2 (VSUBSWS, "vsubsws")
+BU_ALTIVEC_OVERLOAD_2 (VSUBUBM, "vsububm")
+BU_ALTIVEC_OVERLOAD_2 (VSUBUBS, "vsububs")
+BU_ALTIVEC_OVERLOAD_2 (VSUBUHM, "vsubuhm")
+BU_ALTIVEC_OVERLOAD_2 (VSUBUHS, "vsubuhs")
+BU_ALTIVEC_OVERLOAD_2 (VSUBUWM, "vsubuwm")
+BU_ALTIVEC_OVERLOAD_2 (VSUBUWS, "vsubuws")
+BU_ALTIVEC_OVERLOAD_2 (VSUM4SBS, "vsum4sbs")
+BU_ALTIVEC_OVERLOAD_2 (VSUM4SHS, "vsum4shs")
+BU_ALTIVEC_OVERLOAD_2 (VSUM4UBS, "vsum4ubs")
+BU_ALTIVEC_OVERLOAD_2 (XOR, "xor")
+
+/* 1 argument Altivec overloaded functions. */
+BU_ALTIVEC_OVERLOAD_1 (ABS, "abs")
+BU_ALTIVEC_OVERLOAD_1 (ABSS, "abss")
+BU_ALTIVEC_OVERLOAD_1 (CEIL, "ceil")
+BU_ALTIVEC_OVERLOAD_1 (EXPTE, "expte")
+BU_ALTIVEC_OVERLOAD_1 (FLOOR, "floor")
+BU_ALTIVEC_OVERLOAD_1 (LOGE, "loge")
+BU_ALTIVEC_OVERLOAD_1 (MTVSCR, "mtvscr")
+BU_ALTIVEC_OVERLOAD_1 (NEARBYINT, "nearbyint")
+BU_ALTIVEC_OVERLOAD_1 (RE, "re")
+BU_ALTIVEC_OVERLOAD_1 (RINT, "rint")
+BU_ALTIVEC_OVERLOAD_1 (ROUND, "round")
+BU_ALTIVEC_OVERLOAD_1 (RSQRT, "rsqrt")
+BU_ALTIVEC_OVERLOAD_1 (RSQRTE, "rsqrte")
+BU_ALTIVEC_OVERLOAD_1 (SQRT, "sqrt")
+BU_ALTIVEC_OVERLOAD_1 (TRUNC, "trunc")
+BU_ALTIVEC_OVERLOAD_1 (UNPACKH, "unpackh")
+BU_ALTIVEC_OVERLOAD_1 (UNPACKL, "unpackl")
+BU_ALTIVEC_OVERLOAD_1 (VUPKHPX, "vupkhpx")
+BU_ALTIVEC_OVERLOAD_1 (VUPKHSB, "vupkhsb")
+BU_ALTIVEC_OVERLOAD_1 (VUPKHSH, "vupkhsh")
+BU_ALTIVEC_OVERLOAD_1 (VUPKLPX, "vupklpx")
+BU_ALTIVEC_OVERLOAD_1 (VUPKLSB, "vupklsb")
+BU_ALTIVEC_OVERLOAD_1 (VUPKLSH, "vupklsh")
+
+/* Overloaded altivec predicates. */
+BU_ALTIVEC_OVERLOAD_P (VCMPEQ_P, "vcmpeq_p")
+BU_ALTIVEC_OVERLOAD_P (VCMPGT_P, "vcmpgt_p")
+BU_ALTIVEC_OVERLOAD_P (VCMPGE_P, "vcmpge_p")
+
+/* Overloaded Altivec builtins that are handled as special cases. */
+BU_ALTIVEC_OVERLOAD_X (CTF, "ctf")
+BU_ALTIVEC_OVERLOAD_X (CTS, "cts")
+BU_ALTIVEC_OVERLOAD_X (CTU, "ctu")
+BU_ALTIVEC_OVERLOAD_X (EXTRACT, "extract")
+BU_ALTIVEC_OVERLOAD_X (INSERT, "insert")
+BU_ALTIVEC_OVERLOAD_X (LD, "ld")
+BU_ALTIVEC_OVERLOAD_X (LDE, "lde")
+BU_ALTIVEC_OVERLOAD_X (LDL, "ldl")
+BU_ALTIVEC_OVERLOAD_X (LVEBX, "lvebx")
+BU_ALTIVEC_OVERLOAD_X (LVEHX, "lvehx")
+BU_ALTIVEC_OVERLOAD_X (LVEWX, "lvewx")
+BU_ALTIVEC_OVERLOAD_X (LVLX, "lvlx")
+BU_ALTIVEC_OVERLOAD_X (LVLXL, "lvlxl")
+BU_ALTIVEC_OVERLOAD_X (LVRX, "lvrx")
+BU_ALTIVEC_OVERLOAD_X (LVRXL, "lvrxl")
+BU_ALTIVEC_OVERLOAD_X (LVSL, "lvsl")
+BU_ALTIVEC_OVERLOAD_X (LVSR, "lvsr")
+BU_ALTIVEC_OVERLOAD_X (PROMOTE, "promote")
+BU_ALTIVEC_OVERLOAD_X (SLD, "sld")
+BU_ALTIVEC_OVERLOAD_X (SPLAT, "splat")
+BU_ALTIVEC_OVERLOAD_X (SPLATS, "splats")
+BU_ALTIVEC_OVERLOAD_X (ST, "st")
+BU_ALTIVEC_OVERLOAD_X (STE, "ste")
+BU_ALTIVEC_OVERLOAD_X (STEP, "step")
+BU_ALTIVEC_OVERLOAD_X (STL, "stl")
+BU_ALTIVEC_OVERLOAD_X (STVEBX, "stvebx")
+BU_ALTIVEC_OVERLOAD_X (STVEHX, "stvehx")
+BU_ALTIVEC_OVERLOAD_X (STVEWX, "stvewx")
+BU_ALTIVEC_OVERLOAD_X (STVLX, "stvlx")
+BU_ALTIVEC_OVERLOAD_X (STVLXL, "stvlxl")
+BU_ALTIVEC_OVERLOAD_X (STVRX, "stvrx")
+BU_ALTIVEC_OVERLOAD_X (STVRXL, "stvrxl")
+BU_ALTIVEC_OVERLOAD_X (VCFSX, "vcfsx")
+BU_ALTIVEC_OVERLOAD_X (VCFUX, "vcfux")
+BU_ALTIVEC_OVERLOAD_X (VSPLTB, "vspltb")
+BU_ALTIVEC_OVERLOAD_X (VSPLTH, "vsplth")
+BU_ALTIVEC_OVERLOAD_X (VSPLTW, "vspltw")
+
+/* 3 argument VSX builtins. */
+BU_VSX_3 (XVMADDSP, "xvmaddsp", CONST, fmav4sf4)
+BU_VSX_3 (XVMSUBSP, "xvmsubsp", CONST, fmsv4sf4)
+BU_VSX_3 (XVNMADDSP, "xvnmaddsp", CONST, nfmav4sf4)
+BU_VSX_3 (XVNMSUBSP, "xvnmsubsp", CONST, nfmsv4sf4)
+
+BU_VSX_3 (XVMADDDP, "xvmadddp", CONST, fmav2df4)
+BU_VSX_3 (XVMSUBDP, "xvmsubdp", CONST, fmsv2df4)
+BU_VSX_3 (XVNMADDDP, "xvnmadddp", CONST, nfmav2df4)
+BU_VSX_3 (XVNMSUBDP, "xvnmsubdp", CONST, nfmsv2df4)
+
+BU_VSX_3 (XXSEL_2DI, "xxsel_2di", CONST, vector_select_v2di)
+BU_VSX_3 (XXSEL_2DF, "xxsel_2df", CONST, vector_select_v2df)
+BU_VSX_3 (XXSEL_4SF, "xxsel_4sf", CONST, vector_select_v4sf)
+BU_VSX_3 (XXSEL_4SI, "xxsel_4si", CONST, vector_select_v4si)
+BU_VSX_3 (XXSEL_8HI, "xxsel_8hi", CONST, vector_select_v8hi)
+BU_VSX_3 (XXSEL_16QI, "xxsel_16qi", CONST, vector_select_v16qi)
+BU_VSX_3 (XXSEL_2DI_UNS, "xxsel_2di_uns", CONST, vector_select_v2di_uns)
+BU_VSX_3 (XXSEL_4SI_UNS, "xxsel_4si_uns", CONST, vector_select_v4si_uns)
+BU_VSX_3 (XXSEL_8HI_UNS, "xxsel_8hi_uns", CONST, vector_select_v8hi_uns)
+BU_VSX_3 (XXSEL_16QI_UNS, "xxsel_16qi_uns", CONST, vector_select_v16qi_uns)
+
+BU_VSX_3 (VPERM_2DI, "vperm_2di", CONST, altivec_vperm_v2di)
+BU_VSX_3 (VPERM_2DF, "vperm_2df", CONST, altivec_vperm_v2df)
+BU_VSX_3 (VPERM_4SF, "vperm_4sf", CONST, altivec_vperm_v4sf)
+BU_VSX_3 (VPERM_4SI, "vperm_4si", CONST, altivec_vperm_v4si)
+BU_VSX_3 (VPERM_8HI, "vperm_8hi", CONST, altivec_vperm_v8hi)
+BU_VSX_3 (VPERM_16QI, "vperm_16qi", CONST, altivec_vperm_v16qi)
+BU_VSX_3 (VPERM_2DI_UNS, "vperm_2di_uns", CONST, altivec_vperm_v2di_uns)
+BU_VSX_3 (VPERM_4SI_UNS, "vperm_4si_uns", CONST, altivec_vperm_v4si_uns)
+BU_VSX_3 (VPERM_8HI_UNS, "vperm_8hi_uns", CONST, altivec_vperm_v8hi_uns)
+BU_VSX_3 (VPERM_16QI_UNS, "vperm_16qi_uns", CONST, altivec_vperm_v16qi_uns)
+
+BU_VSX_3 (XXPERMDI_2DF, "xxpermdi_2df", CONST, vsx_xxpermdi_v2df)
+BU_VSX_3 (XXPERMDI_2DI, "xxpermdi_2di", CONST, vsx_xxpermdi_v2di)
+BU_VSX_3 (XXPERMDI_4SF, "xxpermdi_4sf", CONST, vsx_xxpermdi_v4sf)
+BU_VSX_3 (XXPERMDI_4SI, "xxpermdi_4si", CONST, vsx_xxpermdi_v4si)
+BU_VSX_3 (XXPERMDI_8HI, "xxpermdi_8hi", CONST, vsx_xxpermdi_v8hi)
+BU_VSX_3 (XXPERMDI_16QI, "xxpermdi_16qi", CONST, vsx_xxpermdi_v16qi)
+BU_VSX_3 (SET_2DF, "set_2df", CONST, vsx_set_v2df)
+BU_VSX_3 (SET_2DI, "set_2di", CONST, vsx_set_v2di)
+BU_VSX_3 (XXSLDWI_2DI, "xxsldwi_2di", CONST, vsx_xxsldwi_v2di)
+BU_VSX_3 (XXSLDWI_2DF, "xxsldwi_2df", CONST, vsx_xxsldwi_v2df)
+BU_VSX_3 (XXSLDWI_4SF, "xxsldwi_4sf", CONST, vsx_xxsldwi_v4sf)
+BU_VSX_3 (XXSLDWI_4SI, "xxsldwi_4si", CONST, vsx_xxsldwi_v4si)
+BU_VSX_3 (XXSLDWI_8HI, "xxsldwi_8hi", CONST, vsx_xxsldwi_v8hi)
+BU_VSX_3 (XXSLDWI_16QI, "xxsldwi_16qi", CONST, vsx_xxsldwi_v16qi)
+
+/* 2 argument VSX builtins. */
+BU_VSX_2 (XVADDDP, "xvadddp", FP, addv2df3)
+BU_VSX_2 (XVSUBDP, "xvsubdp", FP, subv2df3)
+BU_VSX_2 (XVMULDP, "xvmuldp", FP, mulv2df3)
+BU_VSX_2 (XVDIVDP, "xvdivdp", FP, divv2df3)
+BU_VSX_2 (RECIP_V2DF, "xvrecipdivdp", FP, recipv2df3)
+BU_VSX_2 (XVMINDP, "xvmindp", CONST, sminv2df3)
+BU_VSX_2 (XVMAXDP, "xvmaxdp", CONST, smaxv2df3)
+BU_VSX_2 (XVTDIVDP_FE, "xvtdivdp_fe", CONST, vsx_tdivv2df3_fe)
+BU_VSX_2 (XVTDIVDP_FG, "xvtdivdp_fg", CONST, vsx_tdivv2df3_fg)
+BU_VSX_2 (XVCMPEQDP, "xvcmpeqdp", CONST, vector_eqv2df)
+BU_VSX_2 (XVCMPGTDP, "xvcmpgtdp", CONST, vector_gtv2df)
+BU_VSX_2 (XVCMPGEDP, "xvcmpgedp", CONST, vector_gev2df)
+
+BU_VSX_2 (XVADDSP, "xvaddsp", FP, addv4sf3)
+BU_VSX_2 (XVSUBSP, "xvsubsp", FP, subv4sf3)
+BU_VSX_2 (XVMULSP, "xvmulsp", FP, mulv4sf3)
+BU_VSX_2 (XVDIVSP, "xvdivsp", FP, divv4sf3)
+BU_VSX_2 (RECIP_V4SF, "xvrecipdivsp", FP, recipv4sf3)
+BU_VSX_2 (XVMINSP, "xvminsp", CONST, sminv4sf3)
+BU_VSX_2 (XVMAXSP, "xvmaxsp", CONST, smaxv4sf3)
+BU_VSX_2 (XVTDIVSP_FE, "xvtdivsp_fe", CONST, vsx_tdivv4sf3_fe)
+BU_VSX_2 (XVTDIVSP_FG, "xvtdivsp_fg", CONST, vsx_tdivv4sf3_fg)
+BU_VSX_2 (XVCMPEQSP, "xvcmpeqsp", CONST, vector_eqv4sf)
+BU_VSX_2 (XVCMPGTSP, "xvcmpgtsp", CONST, vector_gtv4sf)
+BU_VSX_2 (XVCMPGESP, "xvcmpgesp", CONST, vector_gev4sf)
+
+BU_VSX_2 (XSMINDP, "xsmindp", CONST, smindf3)
+BU_VSX_2 (XSMAXDP, "xsmaxdp", CONST, smaxdf3)
+BU_VSX_2 (XSTDIVDP_FE, "xstdivdp_fe", CONST, vsx_tdivdf3_fe)
+BU_VSX_2 (XSTDIVDP_FG, "xstdivdp_fg", CONST, vsx_tdivdf3_fg)
+BU_VSX_2 (CPSGNDP, "cpsgndp", CONST, vector_copysignv2df3)
+BU_VSX_2 (CPSGNSP, "cpsgnsp", CONST, vector_copysignv4sf3)
+
+BU_VSX_2 (CONCAT_2DF, "concat_2df", CONST, vsx_concat_v2df)
+BU_VSX_2 (CONCAT_2DI, "concat_2di", CONST, vsx_concat_v2di)
+BU_VSX_2 (SPLAT_2DF, "splat_2df", CONST, vsx_splat_v2df)
+BU_VSX_2 (SPLAT_2DI, "splat_2di", CONST, vsx_splat_v2di)
+BU_VSX_2 (XXMRGHW_4SF, "xxmrghw", CONST, vsx_xxmrghw_v4sf)
+BU_VSX_2 (XXMRGHW_4SI, "xxmrghw_4si", CONST, vsx_xxmrghw_v4si)
+BU_VSX_2 (XXMRGLW_4SF, "xxmrglw", CONST, vsx_xxmrglw_v4sf)
+BU_VSX_2 (XXMRGLW_4SI, "xxmrglw_4si", CONST, vsx_xxmrglw_v4si)
+BU_VSX_2 (VEC_MERGEL_V2DF, "mergel_2df", CONST, vec_interleave_lowv2df)
+BU_VSX_2 (VEC_MERGEL_V2DI, "mergel_2di", CONST, vec_interleave_lowv2di)
+BU_VSX_2 (VEC_MERGEH_V2DF, "mergeh_2df", CONST, vec_interleave_highv2df)
+BU_VSX_2 (VEC_MERGEH_V2DI, "mergeh_2di", CONST, vec_interleave_highv2di)
+
+/* VSX abs builtin functions. */
+BU_VSX_A (XVABSDP, "xvabsdp", CONST, absv2df2)
+BU_VSX_A (XVNABSDP, "xvnabsdp", CONST, vsx_nabsv2df2)
+BU_VSX_A (XVABSSP, "xvabssp", CONST, absv4sf2)
+BU_VSX_A (XVNABSSP, "xvnabssp", CONST, vsx_nabsv4sf2)
+
+/* 1 argument VSX builtin functions. */
+BU_VSX_1 (XVNEGDP, "xvnegdp", CONST, negv2df2)
+BU_VSX_1 (XVSQRTDP, "xvsqrtdp", CONST, sqrtv2df2)
+BU_VSX_1 (RSQRT_2DF, "xvrsqrtdp", CONST, rsqrtv2df2)
+BU_VSX_1 (XVRSQRTEDP, "xvrsqrtedp", CONST, rsqrtev2df2)
+BU_VSX_1 (XVTSQRTDP_FE, "xvtsqrtdp_fe", CONST, vsx_tsqrtv2df2_fe)
+BU_VSX_1 (XVTSQRTDP_FG, "xvtsqrtdp_fg", CONST, vsx_tsqrtv2df2_fg)
+BU_VSX_1 (XVREDP, "xvredp", CONST, vsx_frev2df2)
+
+BU_VSX_1 (XVNEGSP, "xvnegsp", CONST, negv4sf2)
+BU_VSX_1 (XVSQRTSP, "xvsqrtsp", CONST, sqrtv4sf2)
+BU_VSX_1 (RSQRT_4SF, "xvrsqrtsp", CONST, rsqrtv4sf2)
+BU_VSX_1 (XVRSQRTESP, "xvrsqrtesp", CONST, rsqrtev4sf2)
+BU_VSX_1 (XVTSQRTSP_FE, "xvtsqrtsp_fe", CONST, vsx_tsqrtv4sf2_fe)
+BU_VSX_1 (XVTSQRTSP_FG, "xvtsqrtsp_fg", CONST, vsx_tsqrtv4sf2_fg)
+BU_VSX_1 (XVRESP, "xvresp", CONST, vsx_frev4sf2)
+
+BU_VSX_1 (XSCVDPSP, "xscvdpsp", CONST, vsx_xscvdpsp)
+BU_VSX_1 (XSCVSPDP, "xscvspdp", CONST, vsx_xscvdpsp)
+BU_VSX_1 (XVCVDPSP, "xvcvdpsp", CONST, vsx_xvcvdpsp)
+BU_VSX_1 (XVCVSPDP, "xvcvspdp", CONST, vsx_xvcvspdp)
+BU_VSX_1 (XSTSQRTDP_FE, "xstsqrtdp_fe", CONST, vsx_tsqrtdf2_fe)
+BU_VSX_1 (XSTSQRTDP_FG, "xstsqrtdp_fg", CONST, vsx_tsqrtdf2_fg)
+
+BU_VSX_1 (XVCVDPSXDS, "xvcvdpsxds", CONST, vsx_fix_truncv2dfv2di2)
+BU_VSX_1 (XVCVDPUXDS, "xvcvdpuxds", CONST, vsx_fixuns_truncv2dfv2di2)
+BU_VSX_1 (XVCVDPUXDS_UNS, "xvcvdpuxds_uns", CONST, vsx_fixuns_truncv2dfv2di2)
+BU_VSX_1 (XVCVSXDDP, "xvcvsxddp", CONST, vsx_floatv2div2df2)
+BU_VSX_1 (XVCVUXDDP, "xvcvuxddp", CONST, vsx_floatunsv2div2df2)
+BU_VSX_1 (XVCVUXDDP_UNS, "xvcvuxddp_uns", CONST, vsx_floatunsv2div2df2)
+
+BU_VSX_1 (XVCVSPSXWS, "xvcvspsxws", CONST, vsx_fix_truncv4sfv4si2)
+BU_VSX_1 (XVCVSPUXWS, "xvcvspuxws", CONST, vsx_fixuns_truncv4sfv4si2)
+BU_VSX_1 (XVCVSXWSP, "xvcvsxwsp", CONST, vsx_floatv4siv4sf2)
+BU_VSX_1 (XVCVUXWSP, "xvcvuxwsp", CONST, vsx_floatunsv4siv4sf2)
+
+BU_VSX_1 (XVCVDPSXWS, "xvcvdpsxws", CONST, vsx_xvcvdpsxws)
+BU_VSX_1 (XVCVDPUXWS, "xvcvdpuxws", CONST, vsx_xvcvdpuxws)
+BU_VSX_1 (XVCVSXWDP, "xvcvsxwdp", CONST, vsx_xvcvsxwdp)
+BU_VSX_1 (XVCVUXWDP, "xvcvuxwdp", CONST, vsx_xvcvuxwdp)
+BU_VSX_1 (XVRDPI, "xvrdpi", CONST, vsx_xvrdpi)
+BU_VSX_1 (XVRDPIC, "xvrdpic", CONST, vsx_xvrdpic)
+BU_VSX_1 (XVRDPIM, "xvrdpim", CONST, vsx_floorv2df2)
+BU_VSX_1 (XVRDPIP, "xvrdpip", CONST, vsx_ceilv2df2)
+BU_VSX_1 (XVRDPIZ, "xvrdpiz", CONST, vsx_btruncv2df2)
+
+BU_VSX_1 (XVCVSPSXDS, "xvcvspsxds", CONST, vsx_xvcvspsxds)
+BU_VSX_1 (XVCVSPUXDS, "xvcvspuxds", CONST, vsx_xvcvspuxds)
+BU_VSX_1 (XVCVSXDSP, "xvcvsxdsp", CONST, vsx_xvcvsxdsp)
+BU_VSX_1 (XVCVUXDSP, "xvcvuxdsp", CONST, vsx_xvcvuxdsp)
+BU_VSX_1 (XVRSPI, "xvrspi", CONST, vsx_xvrspi)
+BU_VSX_1 (XVRSPIC, "xvrspic", CONST, vsx_xvrspic)
+BU_VSX_1 (XVRSPIM, "xvrspim", CONST, vsx_floorv4sf2)
+BU_VSX_1 (XVRSPIP, "xvrspip", CONST, vsx_ceilv4sf2)
+BU_VSX_1 (XVRSPIZ, "xvrspiz", CONST, vsx_btruncv4sf2)
+
+BU_VSX_1 (XSRDPI, "xsrdpi", CONST, vsx_xsrdpi)
+BU_VSX_1 (XSRDPIC, "xsrdpic", CONST, vsx_xsrdpic)
+BU_VSX_1 (XSRDPIM, "xsrdpim", CONST, vsx_floordf2)
+BU_VSX_1 (XSRDPIP, "xsrdpip", CONST, vsx_ceildf2)
+BU_VSX_1 (XSRDPIZ, "xsrdpiz", CONST, vsx_btruncdf2)
+
+/* VSX predicate functions. */
+BU_VSX_P (XVCMPEQSP_P, "xvcmpeqsp_p", CONST, vector_eq_v4sf_p)
+BU_VSX_P (XVCMPGESP_P, "xvcmpgesp_p", CONST, vector_ge_v4sf_p)
+BU_VSX_P (XVCMPGTSP_P, "xvcmpgtsp_p", CONST, vector_gt_v4sf_p)
+BU_VSX_P (XVCMPEQDP_P, "xvcmpeqdp_p", CONST, vector_eq_v2df_p)
+BU_VSX_P (XVCMPGEDP_P, "xvcmpgedp_p", CONST, vector_ge_v2df_p)
+BU_VSX_P (XVCMPGTDP_P, "xvcmpgtdp_p", CONST, vector_gt_v2df_p)
+
+/* VSX builtins that are handled as special cases. */
+BU_VSX_X (LXSDX, "lxsdx", MEM)
+BU_VSX_X (LXVD2X_V2DF, "lxvd2x_v2df", MEM)
+BU_VSX_X (LXVD2X_V2DI, "lxvd2x_v2di", MEM)
+BU_VSX_X (LXVDSX, "lxvdsx", MEM)
+BU_VSX_X (LXVW4X_V4SF, "lxvw4x_v4sf", MEM)
+BU_VSX_X (LXVW4X_V4SI, "lxvw4x_v4si", MEM)
+BU_VSX_X (LXVW4X_V8HI, "lxvw4x_v8hi", MEM)
+BU_VSX_X (LXVW4X_V16QI, "lxvw4x_v16qi", MEM)
+BU_VSX_X (STXSDX, "stxsdx", MEM)
+BU_VSX_X (STXVD2X_V2DF, "stxsdx_v2df", MEM)
+BU_VSX_X (STXVD2X_V2DI, "stxsdx_v2di", MEM)
+BU_VSX_X (STXVW4X_V4SF, "stxsdx_v4sf", MEM)
+BU_VSX_X (STXVW4X_V4SI, "stxsdx_v4si", MEM)
+BU_VSX_X (STXVW4X_V8HI, "stxsdx_v8hi", MEM)
+BU_VSX_X (STXVW4X_V16QI, "stxsdx_v16qi", MEM)
+BU_VSX_X (XSABSDP, "xsabsdp", CONST)
+BU_VSX_X (XSADDDP, "xsadddp", FP)
+BU_VSX_X (XSCMPODP, "xscmpodp", FP)
+BU_VSX_X (XSCMPUDP, "xscmpudp", FP)
+BU_VSX_X (XSCVDPSXDS, "xscvdpsxds", FP)
+BU_VSX_X (XSCVDPSXWS, "xscvdpsxws", FP)
+BU_VSX_X (XSCVDPUXDS, "xscvdpuxds", FP)
+BU_VSX_X (XSCVDPUXWS, "xscvdpuxws", FP)
+BU_VSX_X (XSCVSXDDP, "xscvsxddp", FP)
+BU_VSX_X (XSCVUXDDP, "xscvuxddp", FP)
+BU_VSX_X (XSDIVDP, "xsdivdp", FP)
+BU_VSX_X (XSMADDADP, "xsmaddadp", FP)
+BU_VSX_X (XSMADDMDP, "xsmaddmdp", FP)
+BU_VSX_X (XSMOVDP, "xsmovdp", FP)
+BU_VSX_X (XSMSUBADP, "xsmsubadp", FP)
+BU_VSX_X (XSMSUBMDP, "xsmsubmdp", FP)
+BU_VSX_X (XSMULDP, "xsmuldp", FP)
+BU_VSX_X (XSNABSDP, "xsnabsdp", FP)
+BU_VSX_X (XSNEGDP, "xsnegdp", FP)
+BU_VSX_X (XSNMADDADP, "xsnmaddadp", FP)
+BU_VSX_X (XSNMADDMDP, "xsnmaddmdp", FP)
+BU_VSX_X (XSNMSUBADP, "xsnmsubadp", FP)
+BU_VSX_X (XSNMSUBMDP, "xsnmsubmdp", FP)
+BU_VSX_X (XSSUBDP, "xssubdp", FP)
+BU_VSX_X (VEC_INIT_V2DF, "vec_init_v2df", CONST)
+BU_VSX_X (VEC_INIT_V2DI, "vec_init_v2di", CONST)
+BU_VSX_X (VEC_SET_V2DF, "vec_set_v2df", CONST)
+BU_VSX_X (VEC_SET_V2DI, "vec_set_v2di", CONST)
+BU_VSX_X (VEC_EXT_V2DF, "vec_ext_v2df", CONST)
+BU_VSX_X (VEC_EXT_V2DI, "vec_ext_v2di", CONST)
/* VSX overloaded builtins, add the overloaded functions not present in
Altivec. */
-RS6000_BUILTIN(VSX_BUILTIN_VEC_MUL, RS6000_BTC_MISC)
-RS6000_BUILTIN_EQUATE(VSX_BUILTIN_OVERLOADED_FIRST,
- VSX_BUILTIN_VEC_MUL)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_MSUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_NMADD, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUITLIN_VEC_NMSUB, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_DIV, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_XXMRGHW, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_XXMRGLW, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_XXPERMDI, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_XXSLDWI, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_XXSPLTD, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_XXSPLTW, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_LD, RS6000_BTC_MISC)
-RS6000_BUILTIN(VSX_BUILTIN_VEC_ST, RS6000_BTC_MISC)
-RS6000_BUILTIN_EQUATE(VSX_BUILTIN_OVERLOADED_LAST,
- VSX_BUILTIN_VEC_ST)
-
-/* Combined VSX/Altivec builtins. */
-RS6000_BUILTIN(VECTOR_BUILTIN_FLOAT_V4SI_V4SF, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VECTOR_BUILTIN_UNSFLOAT_V4SI_V4SF, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VECTOR_BUILTIN_FIX_V4SF_V4SI, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(VECTOR_BUILTIN_FIXUNS_V4SF_V4SI, RS6000_BTC_FP_PURE)
+/* 3 argument VSX overloaded builtins. */
+BU_VSX_OVERLOAD_3 (MSUB, "msub")
+BU_VSX_OVERLOAD_3 (NMADD, "nmadd")
+BU_VSX_OVERLOAD_3V (XXPERMDI, "xxpermdi")
+BU_VSX_OVERLOAD_3V (XXSLDWI, "xxsldwi")
+
+/* 2 argument VSX overloaded builtin functions. */
+BU_VSX_OVERLOAD_2 (MUL, "mul")
+BU_VSX_OVERLOAD_2 (DIV, "div")
+BU_VSX_OVERLOAD_2 (XXMRGHW, "xxmrghw")
+BU_VSX_OVERLOAD_2 (XXMRGLW, "xxmrglw")
+BU_VSX_OVERLOAD_2 (XXSPLTD, "xxspltd")
+BU_VSX_OVERLOAD_2 (XXSPLTW, "xxspltw")
+
+/* VSX builtins that are handled as special cases. */
+BU_VSX_OVERLOAD_X (LD, "ld")
+BU_VSX_OVERLOAD_X (ST, "st")
+
+/* 3 argument paired floating point builtins. */
+BU_PAIRED_3 (MSUB, "msub", FP, fmsv2sf4)
+BU_PAIRED_3 (MADD, "madd", FP, fmav2sf4)
+BU_PAIRED_3 (MADDS0, "madds0", FP, paired_madds0)
+BU_PAIRED_3 (MADDS1, "madds1", FP, paired_madds1)
+BU_PAIRED_3 (NMSUB, "nmsub", FP, nfmsv2sf4)
+BU_PAIRED_3 (NMADD, "nmadd", FP, nfmav2sf4)
+BU_PAIRED_3 (SUM0, "sum0", FP, paired_sum0)
+BU_PAIRED_3 (SUM1, "sum1", FP, paired_sum1)
+BU_PAIRED_3 (SELV2SF4, "selv2sf4", CONST, selv2sf4)
+
+/* 2 argument paired floating point builtins. */
+BU_PAIRED_2 (DIVV2SF3, "divv2sf3", FP, paired_divv2sf3)
+BU_PAIRED_2 (ADDV2SF3, "addv2sf3", FP, paired_addv2sf3)
+BU_PAIRED_2 (SUBV2SF3, "subv2sf3", FP, paired_subv2sf3)
+BU_PAIRED_2 (MULV2SF3, "mulv2sf3", FP, paired_mulv2sf3)
+BU_PAIRED_2 (MULS0, "muls0", FP, paired_muls0)
+BU_PAIRED_2 (MULS1, "muls1", FP, paired_muls1)
+BU_PAIRED_2 (MERGE00, "merge00", CONST, paired_merge00)
+BU_PAIRED_2 (MERGE01, "merge01", CONST, paired_merge01)
+BU_PAIRED_2 (MERGE10, "merge10", CONST, paired_merge10)
+BU_PAIRED_2 (MERGE11, "merge11", CONST, paired_merge11)
+
+/* 1 argument paired floating point builtin functions. */
+BU_PAIRED_1 (ABSV2SF2, "absv2sf2", CONST, paired_absv2sf2)
+BU_PAIRED_1 (NABSV2SF2, "nabsv2sf2", CONST, nabsv2sf2)
+BU_PAIRED_1 (NEGV2SF2, "negv2sf2", CONST, paired_negv2sf2)
+BU_PAIRED_1 (SQRTV2SF2, "sqrtv2sf2", FP, sqrtv2sf2)
+BU_PAIRED_1 (RESV2SF, "resv2sf2", FP, resv2sf2)
+
+/* PAIRED builtins that are handled as special cases. */
+BU_PAIRED_X (STX, "stx", MISC)
+BU_PAIRED_X (LX, "lx", MISC)
+
+/* Paired predicates. */
+BU_PAIRED_P (CMPU0, "cmpu0", CONST, paired_cmpu0)
+BU_PAIRED_P (CMPU1, "cmpu1", CONST, paired_cmpu1)
+
+/* PowerPC E500 builtins (SPE). */
+
+BU_SPE_2 (EVADDW, "evaddw", MISC, addv2si3)
+BU_SPE_2 (EVAND, "evand", MISC, andv2si3)
+BU_SPE_2 (EVANDC, "evandc", MISC, spe_evandc)
+BU_SPE_2 (EVDIVWS, "evdivws", MISC, divv2si3)
+BU_SPE_2 (EVDIVWU, "evdivwu", MISC, spe_evdivwu)
+BU_SPE_2 (EVEQV, "eveqv", MISC, spe_eveqv)
+BU_SPE_2 (EVFSADD, "evfsadd", MISC, spe_evfsadd)
+BU_SPE_2 (EVFSDIV, "evfsdiv", MISC, spe_evfsdiv)
+BU_SPE_2 (EVFSMUL, "evfsmul", MISC, spe_evfsmul)
+BU_SPE_2 (EVFSSUB, "evfssub", MISC, spe_evfssub)
+BU_SPE_2 (EVMERGEHI, "evmergehi", MISC, spe_evmergehi)
+BU_SPE_2 (EVMERGEHILO, "evmergehilo", MISC, spe_evmergehilo)
+BU_SPE_2 (EVMERGELO, "evmergelo", MISC, spe_evmergelo)
+BU_SPE_2 (EVMERGELOHI, "evmergelohi", MISC, spe_evmergelohi)
+BU_SPE_2 (EVMHEGSMFAA, "evmhegsmfaa", MISC, spe_evmhegsmfaa)
+BU_SPE_2 (EVMHEGSMFAN, "evmhegsmfan", MISC, spe_evmhegsmfan)
+BU_SPE_2 (EVMHEGSMIAA, "evmhegsmiaa", MISC, spe_evmhegsmiaa)
+BU_SPE_2 (EVMHEGSMIAN, "evmhegsmian", MISC, spe_evmhegsmian)
+BU_SPE_2 (EVMHEGUMIAA, "evmhegumiaa", MISC, spe_evmhegumiaa)
+BU_SPE_2 (EVMHEGUMIAN, "evmhegumian", MISC, spe_evmhegumian)
+BU_SPE_2 (EVMHESMF, "evmhesmf", MISC, spe_evmhesmf)
+BU_SPE_2 (EVMHESMFA, "evmhesmfa", MISC, spe_evmhesmfa)
+BU_SPE_2 (EVMHESMFAAW, "evmhesmfaaw", MISC, spe_evmhesmfaaw)
+BU_SPE_2 (EVMHESMFANW, "evmhesmfanw", MISC, spe_evmhesmfanw)
+BU_SPE_2 (EVMHESMI, "evmhesmi", MISC, spe_evmhesmi)
+BU_SPE_2 (EVMHESMIA, "evmhesmia", MISC, spe_evmhesmia)
+BU_SPE_2 (EVMHESMIAAW, "evmhesmiaaw", MISC, spe_evmhesmiaaw)
+BU_SPE_2 (EVMHESMIANW, "evmhesmianw", MISC, spe_evmhesmianw)
+BU_SPE_2 (EVMHESSF, "evmhessf", MISC, spe_evmhessf)
+BU_SPE_2 (EVMHESSFA, "evmhessfa", MISC, spe_evmhessfa)
+BU_SPE_2 (EVMHESSFAAW, "evmhessfaaw", MISC, spe_evmhessfaaw)
+BU_SPE_2 (EVMHESSFANW, "evmhessfanw", MISC, spe_evmhessfanw)
+BU_SPE_2 (EVMHESSIAAW, "evmhessiaaw", MISC, spe_evmhessiaaw)
+BU_SPE_2 (EVMHESSIANW, "evmhessianw", MISC, spe_evmhessianw)
+BU_SPE_2 (EVMHEUMI, "evmheumi", MISC, spe_evmheumi)
+BU_SPE_2 (EVMHEUMIA, "evmheumia", MISC, spe_evmheumia)
+BU_SPE_2 (EVMHEUMIAAW, "evmheumiaaw", MISC, spe_evmheumiaaw)
+BU_SPE_2 (EVMHEUMIANW, "evmheumianw", MISC, spe_evmheumianw)
+BU_SPE_2 (EVMHEUSIAAW, "evmheusiaaw", MISC, spe_evmheusiaaw)
+BU_SPE_2 (EVMHEUSIANW, "evmheusianw", MISC, spe_evmheusianw)
+BU_SPE_2 (EVMHOGSMFAA, "evmhogsmfaa", MISC, spe_evmhogsmfaa)
+BU_SPE_2 (EVMHOGSMFAN, "evmhogsmfan", MISC, spe_evmhogsmfan)
+BU_SPE_2 (EVMHOGSMIAA, "evmhogsmiaa", MISC, spe_evmhogsmiaa)
+BU_SPE_2 (EVMHOGSMIAN, "evmhogsmian", MISC, spe_evmhogsmian)
+BU_SPE_2 (EVMHOGUMIAA, "evmhogumiaa", MISC, spe_evmhogumiaa)
+BU_SPE_2 (EVMHOGUMIAN, "evmhogumian", MISC, spe_evmhogumian)
+BU_SPE_2 (EVMHOSMF, "evmhosmf", MISC, spe_evmhosmf)
+BU_SPE_2 (EVMHOSMFA, "evmhosmfa", MISC, spe_evmhosmfa)
+BU_SPE_2 (EVMHOSMFAAW, "evmhosmfaaw", MISC, spe_evmhosmfaaw)
+BU_SPE_2 (EVMHOSMFANW, "evmhosmfanw", MISC, spe_evmhosmfanw)
+BU_SPE_2 (EVMHOSMI, "evmhosmi", MISC, spe_evmhosmi)
+BU_SPE_2 (EVMHOSMIA, "evmhosmia", MISC, spe_evmhosmia)
+BU_SPE_2 (EVMHOSMIAAW, "evmhosmiaaw", MISC, spe_evmhosmiaaw)
+BU_SPE_2 (EVMHOSMIANW, "evmhosmianw", MISC, spe_evmhosmianw)
+BU_SPE_2 (EVMHOSSF, "evmhossf", MISC, spe_evmhossf)
+BU_SPE_2 (EVMHOSSFA, "evmhossfa", MISC, spe_evmhossfa)
+BU_SPE_2 (EVMHOSSFAAW, "evmhossfaaw", MISC, spe_evmhossfaaw)
+BU_SPE_2 (EVMHOSSFANW, "evmhossfanw", MISC, spe_evmhossfanw)
+BU_SPE_2 (EVMHOSSIAAW, "evmhossiaaw", MISC, spe_evmhossiaaw)
+BU_SPE_2 (EVMHOSSIANW, "evmhossianw", MISC, spe_evmhossianw)
+BU_SPE_2 (EVMHOUMI, "evmhoumi", MISC, spe_evmhoumi)
+BU_SPE_2 (EVMHOUMIA, "evmhoumia", MISC, spe_evmhoumia)
+BU_SPE_2 (EVMHOUMIAAW, "evmhoumiaaw", MISC, spe_evmhoumiaaw)
+BU_SPE_2 (EVMHOUMIANW, "evmhoumianw", MISC, spe_evmhoumianw)
+BU_SPE_2 (EVMHOUSIAAW, "evmhousiaaw", MISC, spe_evmhousiaaw)
+BU_SPE_2 (EVMHOUSIANW, "evmhousianw", MISC, spe_evmhousianw)
+BU_SPE_2 (EVMWHSMF, "evmwhsmf", MISC, spe_evmwhsmf)
+BU_SPE_2 (EVMWHSMFA, "evmwhsmfa", MISC, spe_evmwhsmfa)
+BU_SPE_2 (EVMWHSMI, "evmwhsmi", MISC, spe_evmwhsmi)
+BU_SPE_2 (EVMWHSMIA, "evmwhsmia", MISC, spe_evmwhsmia)
+BU_SPE_2 (EVMWHSSF, "evmwhssf", MISC, spe_evmwhssf)
+BU_SPE_2 (EVMWHSSFA, "evmwhssfa", MISC, spe_evmwhssfa)
+BU_SPE_2 (EVMWHUMI, "evmwhumi", MISC, spe_evmwhumi)
+BU_SPE_2 (EVMWHUMIA, "evmwhumia", MISC, spe_evmwhumia)
+BU_SPE_2 (EVMWLSMIAAW, "evmwlsmiaaw", MISC, spe_evmwlsmiaaw)
+BU_SPE_2 (EVMWLSMIANW, "evmwlsmianw", MISC, spe_evmwlsmianw)
+BU_SPE_2 (EVMWLSSIAAW, "evmwlssiaaw", MISC, spe_evmwlssiaaw)
+BU_SPE_2 (EVMWLSSIANW, "evmwlssianw", MISC, spe_evmwlssianw)
+BU_SPE_2 (EVMWLUMI, "evmwlumi", MISC, spe_evmwlumi)
+BU_SPE_2 (EVMWLUMIA, "evmwlumia", MISC, spe_evmwlumia)
+BU_SPE_2 (EVMWLUMIAAW, "evmwlumiaaw", MISC, spe_evmwlumiaaw)
+BU_SPE_2 (EVMWLUMIANW, "evmwlumianw", MISC, spe_evmwlumianw)
+BU_SPE_2 (EVMWLUSIAAW, "evmwlusiaaw", MISC, spe_evmwlusiaaw)
+BU_SPE_2 (EVMWLUSIANW, "evmwlusianw", MISC, spe_evmwlusianw)
+BU_SPE_2 (EVMWSMF, "evmwsmf", MISC, spe_evmwsmf)
+BU_SPE_2 (EVMWSMFA, "evmwsmfa", MISC, spe_evmwsmfa)
+BU_SPE_2 (EVMWSMFAA, "evmwsmfaa", MISC, spe_evmwsmfaa)
+BU_SPE_2 (EVMWSMFAN, "evmwsmfan", MISC, spe_evmwsmfan)
+BU_SPE_2 (EVMWSMI, "evmwsmi", MISC, spe_evmwsmi)
+BU_SPE_2 (EVMWSMIA, "evmwsmia", MISC, spe_evmwsmia)
+BU_SPE_2 (EVMWSMIAA, "evmwsmiaa", MISC, spe_evmwsmiaa)
+BU_SPE_2 (EVMWSMIAN, "evmwsmian", MISC, spe_evmwsmian)
+BU_SPE_2 (EVMWSSF, "evmwssf", MISC, spe_evmwssf)
+BU_SPE_2 (EVMWSSFA, "evmwssfa", MISC, spe_evmwssfa)
+BU_SPE_2 (EVMWSSFAA, "evmwssfaa", MISC, spe_evmwssfaa)
+BU_SPE_2 (EVMWSSFAN, "evmwssfan", MISC, spe_evmwssfan)
+BU_SPE_2 (EVMWUMI, "evmwumi", MISC, spe_evmwumi)
+BU_SPE_2 (EVMWUMIA, "evmwumia", MISC, spe_evmwumia)
+BU_SPE_2 (EVMWUMIAA, "evmwumiaa", MISC, spe_evmwumiaa)
+BU_SPE_2 (EVMWUMIAN, "evmwumian", MISC, spe_evmwumian)
+BU_SPE_2 (EVNAND, "evnand", MISC, spe_evnand)
+BU_SPE_2 (EVNOR, "evnor", MISC, spe_evnor)
+BU_SPE_2 (EVOR, "evor", MISC, spe_evor)
+BU_SPE_2 (EVORC, "evorc", MISC, spe_evorc)
+BU_SPE_2 (EVRLW, "evrlw", MISC, spe_evrlw)
+BU_SPE_2 (EVSLW, "evslw", MISC, spe_evslw)
+BU_SPE_2 (EVSRWS, "evsrws", MISC, spe_evsrws)
+BU_SPE_2 (EVSRWU, "evsrwu", MISC, spe_evsrwu)
+BU_SPE_2 (EVSUBFW, "evsubfw", MISC, subv2si3)
+
+/* SPE binary operations expecting a 5-bit unsigned literal. */
+BU_SPE_2 (EVADDIW, "evaddiw", MISC, spe_evaddiw)
+
+BU_SPE_2 (EVRLWI, "evrlwi", MISC, spe_evrlwi)
+BU_SPE_2 (EVSLWI, "evslwi", MISC, spe_evslwi)
+BU_SPE_2 (EVSRWIS, "evsrwis", MISC, spe_evsrwis)
+BU_SPE_2 (EVSRWIU, "evsrwiu", MISC, spe_evsrwiu)
+BU_SPE_2 (EVSUBIFW, "evsubifw", MISC, spe_evsubifw)
+BU_SPE_2 (EVMWHSSFAA, "evmwhssfaa", MISC, spe_evmwhssfaa)
+BU_SPE_2 (EVMWHSSMAA, "evmwhssmaa", MISC, spe_evmwhssmaa)
+BU_SPE_2 (EVMWHSMFAA, "evmwhsmfaa", MISC, spe_evmwhsmfaa)
+BU_SPE_2 (EVMWHSMIAA, "evmwhsmiaa", MISC, spe_evmwhsmiaa)
+BU_SPE_2 (EVMWHUSIAA, "evmwhusiaa", MISC, spe_evmwhusiaa)
+BU_SPE_2 (EVMWHUMIAA, "evmwhumiaa", MISC, spe_evmwhumiaa)
+BU_SPE_2 (EVMWHSSFAN, "evmwhssfan", MISC, spe_evmwhssfan)
+BU_SPE_2 (EVMWHSSIAN, "evmwhssian", MISC, spe_evmwhssian)
+BU_SPE_2 (EVMWHSMFAN, "evmwhsmfan", MISC, spe_evmwhsmfan)
+BU_SPE_2 (EVMWHSMIAN, "evmwhsmian", MISC, spe_evmwhsmian)
+BU_SPE_2 (EVMWHUSIAN, "evmwhusian", MISC, spe_evmwhusian)
+BU_SPE_2 (EVMWHUMIAN, "evmwhumian", MISC, spe_evmwhumian)
+BU_SPE_2 (EVMWHGSSFAA, "evmwhgssfaa", MISC, spe_evmwhgssfaa)
+BU_SPE_2 (EVMWHGSMFAA, "evmwhgsmfaa", MISC, spe_evmwhgsmfaa)
+BU_SPE_2 (EVMWHGSMIAA, "evmwhgsmiaa", MISC, spe_evmwhgsmiaa)
+BU_SPE_2 (EVMWHGUMIAA, "evmwhgumiaa", MISC, spe_evmwhgumiaa)
+BU_SPE_2 (EVMWHGSSFAN, "evmwhgssfan", MISC, spe_evmwhgssfan)
+BU_SPE_2 (EVMWHGSMFAN, "evmwhgsmfan", MISC, spe_evmwhgsmfan)
+BU_SPE_2 (EVMWHGSMIAN, "evmwhgsmian", MISC, spe_evmwhgsmian)
+BU_SPE_2 (EVMWHGUMIAN, "evmwhgumian", MISC, spe_evmwhgumian)
+BU_SPE_2 (BRINC, "brinc", MISC, spe_brinc)
+BU_SPE_2 (EVXOR, "evxor", MISC, xorv2si3)
+
+/* SPE predicate builtins. */
+BU_SPE_P (EVCMPEQ, "evcmpeq", MISC, spe_evcmpeq)
+BU_SPE_P (EVCMPGTS, "evcmpgts", MISC, spe_evcmpgts)
+BU_SPE_P (EVCMPGTU, "evcmpgtu", MISC, spe_evcmpgtu)
+BU_SPE_P (EVCMPLTS, "evcmplts", MISC, spe_evcmplts)
+BU_SPE_P (EVCMPLTU, "evcmpltu", MISC, spe_evcmpltu)
+BU_SPE_P (EVFSCMPEQ, "evfscmpeq", MISC, spe_evfscmpeq)
+BU_SPE_P (EVFSCMPGT, "evfscmpgt", MISC, spe_evfscmpgt)
+BU_SPE_P (EVFSCMPLT, "evfscmplt", MISC, spe_evfscmplt)
+BU_SPE_P (EVFSTSTEQ, "evfststeq", MISC, spe_evfststeq)
+BU_SPE_P (EVFSTSTGT, "evfststgt", MISC, spe_evfststgt)
+BU_SPE_P (EVFSTSTLT, "evfststlt", MISC, spe_evfststlt)
+
+/* SPE evsel builtins. */
+BU_SPE_E (EVSEL_CMPGTS, "evsel_gts", MISC, spe_evcmpgts)
+BU_SPE_E (EVSEL_CMPGTU, "evsel_gtu", MISC, spe_evcmpgtu)
+BU_SPE_E (EVSEL_CMPLTS, "evsel_lts", MISC, spe_evcmplts)
+BU_SPE_E (EVSEL_CMPLTU, "evsel_ltu", MISC, spe_evcmpltu)
+BU_SPE_E (EVSEL_CMPEQ, "evsel_eq", MISC, spe_evcmpeq)
+BU_SPE_E (EVSEL_FSCMPGT, "evsel_fsgt", MISC, spe_evfscmpgt)
+BU_SPE_E (EVSEL_FSCMPLT, "evsel_fslt", MISC, spe_evfscmplt)
+BU_SPE_E (EVSEL_FSCMPEQ, "evsel_fseq", MISC, spe_evfscmpeq)
+BU_SPE_E (EVSEL_FSTSTGT, "evsel_fststgt", MISC, spe_evfststgt)
+BU_SPE_E (EVSEL_FSTSTLT, "evsel_fststlt", MISC, spe_evfststlt)
+BU_SPE_E (EVSEL_FSTSTEQ, "evsel_fststeq", MISC, spe_evfststeq)
+
+BU_SPE_1 (EVABS, "evabs", CONST, absv2si2)
+BU_SPE_1 (EVADDSMIAAW, "evaddsmiaaw", CONST, spe_evaddsmiaaw)
+BU_SPE_1 (EVADDSSIAAW, "evaddssiaaw", CONST, spe_evaddssiaaw)
+BU_SPE_1 (EVADDUMIAAW, "evaddumiaaw", CONST, spe_evaddumiaaw)
+BU_SPE_1 (EVADDUSIAAW, "evaddusiaaw", CONST, spe_evaddusiaaw)
+BU_SPE_1 (EVCNTLSW, "evcntlsw", CONST, spe_evcntlsw)
+BU_SPE_1 (EVCNTLZW, "evcntlzw", CONST, spe_evcntlzw)
+BU_SPE_1 (EVEXTSB, "evextsb", CONST, spe_evextsb)
+BU_SPE_1 (EVEXTSH, "evextsh", CONST, spe_evextsh)
+BU_SPE_1 (EVFSABS, "evfsabs", CONST, spe_evfsabs)
+BU_SPE_1 (EVFSCFSF, "evfscfsf", CONST, spe_evfscfsf)
+BU_SPE_1 (EVFSCFSI, "evfscfsi", CONST, spe_evfscfsi)
+BU_SPE_1 (EVFSCFUF, "evfscfuf", CONST, spe_evfscfuf)
+BU_SPE_1 (EVFSCFUI, "evfscfui", CONST, spe_evfscfui)
+BU_SPE_1 (EVFSCTSF, "evfsctsf", CONST, spe_evfsctsf)
+BU_SPE_1 (EVFSCTSI, "evfsctsi", CONST, spe_evfsctsi)
+BU_SPE_1 (EVFSCTSIZ, "evfsctsiz", CONST, spe_evfsctsiz)
+BU_SPE_1 (EVFSCTUF, "evfsctuf", CONST, spe_evfsctuf)
+BU_SPE_1 (EVFSCTUI, "evfsctui", CONST, spe_evfsctui)
+BU_SPE_1 (EVFSCTUIZ, "evfsctuiz", CONST, spe_evfsctuiz)
+BU_SPE_1 (EVFSNABS, "evfsnabs", CONST, spe_evfsnabs)
+BU_SPE_1 (EVFSNEG, "evfsneg", CONST, spe_evfsneg)
+BU_SPE_1 (EVMRA, "evmra", CONST, spe_evmra)
+BU_SPE_1 (EVNEG, "evneg", CONST, negv2si2)
+BU_SPE_1 (EVRNDW, "evrndw", CONST, spe_evrndw)
+BU_SPE_1 (EVSUBFSMIAAW, "evsubfsmiaaw", CONST, spe_evsubfsmiaaw)
+BU_SPE_1 (EVSUBFSSIAAW, "evsubfssiaaw", CONST, spe_evsubfssiaaw)
+BU_SPE_1 (EVSUBFUMIAAW, "evsubfumiaaw", CONST, spe_evsubfumiaaw)
+BU_SPE_1 (EVSUBFUSIAAW, "evsubfusiaaw", CONST, spe_evsubfusiaaw)
+
+/* SPE builtins that are handled as special cases. */
+BU_SPE_X (EVLDD, "evldd", MISC)
+BU_SPE_X (EVLDDX, "evlddx", MISC)
+BU_SPE_X (EVLDH, "evldh", MISC)
+BU_SPE_X (EVLDHX, "evldhx", MISC)
+BU_SPE_X (EVLDW, "evldw", MISC)
+BU_SPE_X (EVLDWX, "evldwx", MISC)
+BU_SPE_X (EVLHHESPLAT, "evlhhesplat", MISC)
+BU_SPE_X (EVLHHESPLATX, "evlhhesplatx", MISC)
+BU_SPE_X (EVLHHOSSPLAT, "evlhhossplat", MISC)
+BU_SPE_X (EVLHHOSSPLATX, "evlhhossplatx", MISC)
+BU_SPE_X (EVLHHOUSPLAT, "evlhhousplat", MISC)
+BU_SPE_X (EVLHHOUSPLATX, "evlhhousplatx", MISC)
+BU_SPE_X (EVLWHE, "evlwhe", MISC)
+BU_SPE_X (EVLWHEX, "evlwhex", MISC)
+BU_SPE_X (EVLWHOS, "evlwhos", MISC)
+BU_SPE_X (EVLWHOSX, "evlwhosx", MISC)
+BU_SPE_X (EVLWHOU, "evlwhou", MISC)
+BU_SPE_X (EVLWHOUX, "evlwhoux", MISC)
+BU_SPE_X (EVLWHSPLAT, "evlwhsplat", MISC)
+BU_SPE_X (EVLWHSPLATX, "evlwhsplatx", MISC)
+BU_SPE_X (EVLWWSPLAT, "evlwwsplat", MISC)
+BU_SPE_X (EVLWWSPLATX, "evlwwsplatx", MISC)
+BU_SPE_X (EVSPLATFI, "evsplatfi", MISC)
+BU_SPE_X (EVSPLATI, "evsplati", MISC)
+BU_SPE_X (EVSTDD, "evstdd", MISC)
+BU_SPE_X (EVSTDDX, "evstddx", MISC)
+BU_SPE_X (EVSTDH, "evstdh", MISC)
+BU_SPE_X (EVSTDHX, "evstdhx", MISC)
+BU_SPE_X (EVSTDW, "evstdw", MISC)
+BU_SPE_X (EVSTDWX, "evstdwx", MISC)
+BU_SPE_X (EVSTWHE, "evstwhe", MISC)
+BU_SPE_X (EVSTWHEX, "evstwhex", MISC)
+BU_SPE_X (EVSTWHO, "evstwho", MISC)
+BU_SPE_X (EVSTWHOX, "evstwhox", MISC)
+BU_SPE_X (EVSTWWE, "evstwwe", MISC)
+BU_SPE_X (EVSTWWEX, "evstwwex", MISC)
+BU_SPE_X (EVSTWWO, "evstwwo", MISC)
+BU_SPE_X (EVSTWWOX, "evstwwox", MISC)
+BU_SPE_X (MFSPEFSCR, "mfspefscr", MISC)
+BU_SPE_X (MTSPEFSCR, "mtspefscr", MISC)
+
+
/* Power7 builtins, that aren't VSX instructions. */
-RS6000_BUILTIN(POWER7_BUILTIN_BPERMD, RS6000_BTC_CONST)
+BU_SPECIAL_X (POWER7_BUILTIN_BPERMD, "__builtin_bpermd", RS6000_BTM_POPCNTD,
+ RS6000_BTC_CONST)
/* Miscellaneous builtins. */
-RS6000_BUILTIN(RS6000_BUILTIN_RECIP, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(RS6000_BUILTIN_RECIPF, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(RS6000_BUILTIN_RSQRTF, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(RS6000_BUILTIN_RSQRT, RS6000_BTC_FP_PURE)
-RS6000_BUILTIN(RS6000_BUILTIN_BSWAP_HI, RS6000_BTC_CONST)
+BU_SPECIAL_X (RS6000_BUILTIN_RECIP, "__builtin_recipdiv", RS6000_BTM_FRE,
+ RS6000_BTC_FP)
+
+BU_SPECIAL_X (RS6000_BUILTIN_RECIPF, "__builtin_recipdivf", RS6000_BTM_FRES,
+ RS6000_BTC_FP)
+
+BU_SPECIAL_X (RS6000_BUILTIN_RSQRT, "__builtin_rsqrt", RS6000_BTM_FRSQRTE,
+ RS6000_BTC_FP)
+
+BU_SPECIAL_X (RS6000_BUILTIN_RSQRTF, "__builtin_rsqrtf", RS6000_BTM_FRSQRTES,
+ RS6000_BTC_FP)
+
+BU_SPECIAL_X (RS6000_BUILTIN_BSWAP_HI, "__builtin_bswap16", RS6000_BTM_POWERPC,
+ RS6000_BTC_MEM)
/* Darwin CfString builtin. */
-RS6000_BUILTIN(RS6000_BUILTIN_CFSTRING, RS6000_BTC_MISC)
+BU_SPECIAL_X (RS6000_BUILTIN_CFSTRING, "__builtin_cfstring", RS6000_BTM_POWERPC,
+ RS6000_BTC_MISC)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index c1683bc709b..76a21463ec3 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -159,6 +159,11 @@ rs6000_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
cpp_hashnode *expand_this = tok->val.node.node;
cpp_hashnode *ident;
+ /* If the current machine does not have altivec, don't look for the
+ keywords. */
+ if (!TARGET_ALTIVEC)
+ return NULL;
+
ident = altivec_categorize_keyword (tok);
if (ident != expand_this)
@@ -260,40 +265,107 @@ rs6000_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
return expand_this;
}
+
+/* Define or undefine a single macro. */
+
+static void
+rs6000_define_or_undefine_macro (bool define_p, const char *name)
+{
+ if (TARGET_DEBUG_BUILTIN || TARGET_DEBUG_TARGET)
+ fprintf (stderr, "#%s %s\n", (define_p) ? "define" : "undef", name);
+
+ if (define_p)
+ cpp_define (parse_in, name);
+ else
+ cpp_undef (parse_in, name);
+}
+
+/* Define or undefine macros based on the current target. If the user does
+ #pragma GCC target, we need to adjust the macros dynamically. Note, some of
+ the options needed for builtins have been moved to separate variables, so
+ have both the target flags and the builtin flags as arguments. */
+
+void
+rs6000_target_modify_macros (bool define_p, int flags, unsigned bu_mask)
+{
+ if (TARGET_DEBUG_BUILTIN || TARGET_DEBUG_TARGET)
+ fprintf (stderr, "rs6000_target_modify_macros (%s, 0x%x, 0x%x)\n",
+ (define_p) ? "define" : "undef",
+ (unsigned) flags, bu_mask);
+
+ /* target_flags based options. */
+ if ((flags & MASK_POWER2) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR2");
+ else if ((flags & MASK_POWER) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR");
+ if ((flags & MASK_POWERPC) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PPC");
+ if ((flags & MASK_PPC_GPOPT) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PPCSQ");
+ if ((flags & MASK_PPC_GFXOPT) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PPCGR");
+ if ((flags & MASK_POWERPC64) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PPC64");
+ if ((flags & MASK_MFCRF) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR4");
+ if ((flags & MASK_POPCNTB) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR5");
+ if ((flags & MASK_FPRND) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR5X");
+ if ((flags & MASK_CMPB) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR6");
+ if ((flags & MASK_MFPGPR) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR6X");
+ if ((flags & MASK_POPCNTD) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR7");
+ if ((flags & MASK_SOFT_FLOAT) != 0)
+ rs6000_define_or_undefine_macro (define_p, "_SOFT_FLOAT");
+ if ((flags & MASK_RECIP_PRECISION) != 0)
+ rs6000_define_or_undefine_macro (define_p, "__RECIP_PRECISION__");
+ if ((flags & MASK_ALTIVEC) != 0)
+ {
+ const char *vec_str = (define_p) ? "__VEC__=10206" : "__VEC__";
+ rs6000_define_or_undefine_macro (define_p, "__ALTIVEC__");
+ rs6000_define_or_undefine_macro (define_p, vec_str);
+
+ /* Define this when supporting context-sensitive keywords. */
+ if (!flag_iso)
+ rs6000_define_or_undefine_macro (define_p, "__APPLE_ALTIVEC__");
+ }
+ if ((flags & MASK_VSX) != 0)
+ rs6000_define_or_undefine_macro (define_p, "__VSX__");
+
+ /* options from the builtin masks. */
+ if ((bu_mask & RS6000_BTM_SPE) != 0)
+ rs6000_define_or_undefine_macro (define_p, "__SPE__");
+ if ((bu_mask & RS6000_BTM_PAIRED) != 0)
+ rs6000_define_or_undefine_macro (define_p, "__PAIRED__");
+ if ((bu_mask & RS6000_BTM_CELL) != 0)
+ rs6000_define_or_undefine_macro (define_p, "__PPU__");
+}
+
void
rs6000_cpu_cpp_builtins (cpp_reader *pfile)
{
- if (TARGET_POWER2)
- builtin_define ("_ARCH_PWR2");
- else if (TARGET_POWER)
- builtin_define ("_ARCH_PWR");
- if (TARGET_POWERPC)
- builtin_define ("_ARCH_PPC");
- if (TARGET_PPC_GPOPT)
- builtin_define ("_ARCH_PPCSQ");
- if (TARGET_PPC_GFXOPT)
- builtin_define ("_ARCH_PPCGR");
- if (TARGET_POWERPC64)
- builtin_define ("_ARCH_PPC64");
- if (TARGET_MFCRF)
- builtin_define ("_ARCH_PWR4");
- if (TARGET_POPCNTB)
- builtin_define ("_ARCH_PWR5");
- if (TARGET_FPRND)
- builtin_define ("_ARCH_PWR5X");
- if (TARGET_CMPB)
- builtin_define ("_ARCH_PWR6");
- if (TARGET_MFPGPR)
- builtin_define ("_ARCH_PWR6X");
+ /* Define all of the common macros. */
+ rs6000_target_modify_macros (true, target_flags,
+ rs6000_builtin_mask_calculate ());
+
+ /* _ARCH_COM does not fit in the framework of target_modify_macros, so handle
+ it specially. */
if (! TARGET_POWER && ! TARGET_POWER2 && ! TARGET_POWERPC)
builtin_define ("_ARCH_COM");
- if (TARGET_POPCNTD)
- builtin_define ("_ARCH_PWR7");
- if (TARGET_ALTIVEC)
- {
- builtin_define ("__ALTIVEC__");
- builtin_define ("__VEC__=10206");
+ if (TARGET_FRE)
+ builtin_define ("__RECIP__");
+ if (TARGET_FRES)
+ builtin_define ("__RECIPF__");
+ if (TARGET_FRSQRTE)
+ builtin_define ("__RSQRTE__");
+ if (TARGET_FRSQRTES)
+ builtin_define ("__RSQRTEF__");
+ if (TARGET_EXTRA_BUILTINS)
+ {
/* Define the AltiVec syntactic elements. */
builtin_define ("__vector=__attribute__((altivec(vector__)))");
builtin_define ("__pixel=__attribute__((altivec(pixel__))) unsigned short");
@@ -301,9 +373,6 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
if (!flag_iso)
{
- /* Define this when supporting context-sensitive keywords. */
- builtin_define ("__APPLE_ALTIVEC__");
-
builtin_define ("vector=vector");
builtin_define ("pixel=pixel");
builtin_define ("bool=bool");
@@ -314,14 +383,6 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
cpp_get_callbacks (pfile)->macro_to_expand = rs6000_macro_to_expand;
}
}
- if (rs6000_cpu == PROCESSOR_CELL)
- builtin_define ("__PPU__");
- if (TARGET_SPE)
- builtin_define ("__SPE__");
- if (TARGET_PAIRED_FLOAT)
- builtin_define ("__PAIRED__");
- if (TARGET_SOFT_FLOAT)
- builtin_define ("_SOFT_FLOAT");
if ((!(TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)))
||(TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_DOUBLE_FLOAT))
builtin_define ("_SOFT_DOUBLE");
@@ -331,10 +392,9 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
/* Used by libstdc++. */
if (TARGET_NO_LWSYNC)
builtin_define ("__NO_LWSYNC__");
- if (TARGET_VSX)
- {
- builtin_define ("__VSX__");
+ if (TARGET_EXTRA_BUILTINS)
+ {
/* For the VSX builtin functions identical to Altivec functions, just map
the altivec builtin into the vsx version (the altivec functions
generate VSX code if -mvsx). */
@@ -365,16 +425,6 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
builtin_define ("__builtin_vsx_xvnmsubasp=__builtin_vsx_xvnmsubsp");
builtin_define ("__builtin_vsx_xvnmsubmsp=__builtin_vsx_xvnmsubsp");
}
- if (RS6000_RECIP_HAVE_RE_P (DFmode))
- builtin_define ("__RECIP__");
- if (RS6000_RECIP_HAVE_RE_P (SFmode))
- builtin_define ("__RECIPF__");
- if (RS6000_RECIP_HAVE_RSQRTE_P (DFmode))
- builtin_define ("__RSQRTE__");
- if (RS6000_RECIP_HAVE_RSQRTE_P (SFmode))
- builtin_define ("__RSQRTEF__");
- if (TARGET_RECIP_PRECISION)
- builtin_define ("__RECIP_PRECISION__");
/* Tell users they can use __builtin_bswap{16,64}. */
builtin_define ("__HAVE_BSWAP__");
@@ -516,7 +566,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_RSQRT, ALTIVEC_BUILTIN_VRSQRTFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
- { ALTIVEC_BUILTIN_VEC_RSQRT, VSX_BUILTIN_VEC_RSQRT_V2DF,
+ { ALTIVEC_BUILTIN_VEC_RSQRT, VSX_BUILTIN_RSQRT_2DF,
RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_RSQRTE, ALTIVEC_BUILTIN_VRSQRTEFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
@@ -3198,140 +3248,140 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
~RS6000_BTI_pixel_V8HI },
/* Predicates. */
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V16QI, RS6000_BTI_unsigned_V16QI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V16QI, RS6000_BTI_V16QI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V8HI, RS6000_BTI_unsigned_V8HI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V8HI, RS6000_BTI_V8HI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI },
- { ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTFP_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTFP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
- { ALTIVEC_BUILTIN_VCMPGT_P, VSX_BUILTIN_XVCMPGTDP_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGT_P, VSX_BUILTIN_XVCMPGTDP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V16QI, RS6000_BTI_unsigned_V16QI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V16QI, RS6000_BTI_V16QI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V16QI, RS6000_BTI_bool_V16QI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V8HI, RS6000_BTI_unsigned_V8HI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V8HI, RS6000_BTI_V8HI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V8HI, RS6000_BTI_bool_V8HI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_pixel_V8HI, RS6000_BTI_pixel_V8HI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI },
- { ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQFP_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQFP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
- { ALTIVEC_BUILTIN_VCMPEQ_P, VSX_BUILTIN_XVCMPEQDP_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, VSX_BUILTIN_XVCMPEQDP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
/* cmpge is the same as cmpgt for all cases except floating point.
There is further code to deal with this special case in
altivec_build_resolved_builtin. */
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V16QI, RS6000_BTI_unsigned_V16QI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSB_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V16QI, RS6000_BTI_V16QI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V8HI, RS6000_BTI_unsigned_V8HI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V8HI, RS6000_BTI_V8HI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSH_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTUW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI },
- { ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGEFP_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGEFP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
- { ALTIVEC_BUILTIN_VCMPGE_P, VSX_BUILTIN_XVCMPGEDP_P,
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, VSX_BUILTIN_XVCMPGEDP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
{ (enum rs6000_builtins) 0, (enum rs6000_builtins) 0, 0, 0, 0, 0 }
@@ -3402,7 +3452,7 @@ altivec_build_resolved_builtin (tree *args, int n,
condition (LT vs. EQ, which is recognizable by bit 1 of the first
argument) is reversed. Patch the arguments here before building
the resolved CALL_EXPR. */
- if (desc->code == ALTIVEC_BUILTIN_VCMPGE_P
+ if (desc->code == ALTIVEC_BUILTIN_VEC_VCMPGE_P
&& desc->overloaded_code != ALTIVEC_BUILTIN_VCMPGEFP_P)
{
tree t;
@@ -3448,18 +3498,20 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
{
VEC(tree,gc) *arglist = (VEC(tree,gc) *) passed_arglist;
unsigned int nargs = VEC_length (tree, arglist);
- unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
+ enum rs6000_builtins fcode
+ = (enum rs6000_builtins)DECL_FUNCTION_CODE (fndecl);
tree fnargs = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
tree types[3], args[3];
const struct altivec_builtin_types *desc;
unsigned int n;
- if ((fcode < ALTIVEC_BUILTIN_OVERLOADED_FIRST
- || fcode > ALTIVEC_BUILTIN_OVERLOADED_LAST)
- && (fcode < VSX_BUILTIN_OVERLOADED_FIRST
- || fcode > VSX_BUILTIN_OVERLOADED_LAST))
+ if (!rs6000_overloaded_builtin_p (fcode))
return NULL_TREE;
+ if (TARGET_DEBUG_BUILTIN)
+ fprintf (stderr, "altivec_resolve_overloaded_builtin, code = %4d, %s\n",
+ (int)fcode, IDENTIFIER_POINTER (DECL_NAME (fndecl)));
+
/* For now treat vec_splats and vec_promote as the same. */
if (fcode == ALTIVEC_BUILTIN_VEC_SPLATS
|| fcode == ALTIVEC_BUILTIN_VEC_PROMOTE)
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index af4c95488de..465015270c6 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -170,6 +170,8 @@ extern const char * output_isel (rtx *);
extern void rs6000_call_indirect_aix (rtx, rtx, rtx);
extern void rs6000_aix_asm_output_dwarf_table_ref (char *);
extern void get_ppc476_thunk_name (char name[32]);
+extern bool rs6000_overloaded_builtin_p (enum rs6000_builtins);
+extern unsigned rs6000_builtin_mask_calculate (void);
/* Declare functions in rs6000-c.c */
@@ -178,6 +180,8 @@ extern void rs6000_cpu_cpp_builtins (struct cpp_reader *);
#ifdef TREE_CODE
extern bool rs6000_pragma_target_parse (tree, tree);
#endif
+extern void rs6000_target_modify_macros (bool, int, unsigned);
+extern void (*rs6000_target_modify_macros_ptr) (bool, int, unsigned);
#if TARGET_MACHO
char *output_call (rtx, rtx *, int, int);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index f01353b8942..a615381fd73 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -289,6 +289,11 @@ static struct
/* 2 argument gen function typedef. */
typedef rtx (*gen_2arg_fn_t) (rtx, rtx, rtx);
+/* Pointer to function (in rs6000-c.c) that can define or undefine target
+ macros that have changed. Languages that don't support the preprocessor
+ don't link in rs6000-c.c, so we can't call it directly. */
+void (*rs6000_target_modify_macros_ptr) (bool, int, unsigned);
+
/* Target cpu costs. */
@@ -849,18 +854,69 @@ struct processor_costs ppca2_cost = {
/* Table that classifies rs6000 builtin functions (pure, const, etc.). */
-#undef RS6000_BUILTIN
-#undef RS6000_BUILTIN_EQUATE
-#define RS6000_BUILTIN(NAME, TYPE) TYPE,
-#define RS6000_BUILTIN_EQUATE(NAME, VALUE)
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
+
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
+
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
+
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
+
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
+
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
+
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
-static const enum rs6000_btc builtin_classify[(int)RS6000_BUILTIN_COUNT] =
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
+
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
+
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE) \
+ { NAME, ICODE, MASK, ATTR },
+
+struct rs6000_builtin_info_type {
+ const char *name;
+ const enum insn_code icode;
+ const unsigned mask;
+ const unsigned attr;
+};
+
+static const struct rs6000_builtin_info_type rs6000_builtin_info[] =
{
#include "rs6000-builtin.def"
};
-#undef RS6000_BUILTIN
-#undef RS6000_BUILTIN_EQUATE
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
/* Support for -mveclibabi=<xxx> to control which vector library to use. */
static tree (*rs6000_veclib_handler) (tree, tree, tree);
@@ -985,7 +1041,6 @@ static tree rs6000_builtin_reciprocal (unsigned int, bool, bool);
static tree rs6000_builtin_mask_for_load (void);
static tree rs6000_builtin_mul_widen_even (tree);
static tree rs6000_builtin_mul_widen_odd (tree);
-static tree rs6000_builtin_conversion (unsigned int, tree, tree);
static bool rs6000_builtin_support_vector_misalignment (enum
machine_mode,
const_tree,
@@ -994,7 +1049,7 @@ static int rs6000_builtin_vectorization_cost (enum vect_cost_for_stmt,
tree, int);
static enum machine_mode rs6000_preferred_simd_mode (enum machine_mode);
-static void def_builtin (int, const char *, tree, int);
+static void def_builtin (const char *, tree, enum rs6000_builtins);
static bool rs6000_vector_alignment_reachable (const_tree, bool);
static void rs6000_init_builtins (void);
static tree rs6000_builtin_decl (unsigned, bool);
@@ -1018,9 +1073,6 @@ static rtx paired_expand_lv_builtin (enum insn_code, tree, rtx);
static rtx paired_expand_stv_builtin (enum insn_code, tree);
static rtx paired_expand_predicate_builtin (enum insn_code, tree, rtx);
-static void enable_mask_for_builtins (struct builtin_description *, int,
- enum rs6000_builtins,
- enum rs6000_builtins);
static void spe_init_builtins (void);
static rtx spe_expand_builtin (tree, rtx, bool *);
static rtx spe_expand_stv_builtin (enum insn_code, tree);
@@ -1403,8 +1455,6 @@ static const struct attribute_spec rs6000_attribute_table[] =
#define TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN rs6000_builtin_mul_widen_even
#undef TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD
#define TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD rs6000_builtin_mul_widen_odd
-#undef TARGET_VECTORIZE_BUILTIN_CONVERSION
-#define TARGET_VECTORIZE_BUILTIN_CONVERSION rs6000_builtin_conversion
#undef TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT
#define TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT \
rs6000_builtin_support_vector_misalignment
@@ -1876,6 +1926,7 @@ rs6000_debug_reg_print (int first_regno, int last_regno, const char *reg_name)
}
#define DEBUG_FMT_D "%-32s= %d\n"
+#define DEBUG_FMT_X "%-32s= 0x%x\n"
#define DEBUG_FMT_S "%-32s= %s\n"
/* Print various interesting information with -mdebug=reg. */
@@ -2103,6 +2154,11 @@ rs6000_debug_reg_global (void)
rs6000_long_double_type_size);
fprintf (stderr, DEBUG_FMT_D, "sched_restricted_insns_priority",
(int)rs6000_sched_restricted_insns_priority);
+ fprintf (stderr, DEBUG_FMT_D, "Number of standard builtins",
+ (int)END_BUILTINS);
+ fprintf (stderr, DEBUG_FMT_D, "Number of rs6000 builtins",
+ (int)RS6000_BUILTIN_COUNT);
+ fprintf (stderr, DEBUG_FMT_X, "Builtin mask", rs6000_builtin_mask);
}
/* Initialize the various global tables that are based on register size. */
@@ -2493,6 +2549,27 @@ darwin_rs6000_override_options (void)
#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 64
#endif
+/* Return the builtin mask of the various options used that could affect which
+ builtins were used. In the past we used target_flags, but we've run out of
+ bits, and some options like SPE and PAIRED are no longer in
+ target_flags. */
+
+unsigned
+rs6000_builtin_mask_calculate (void)
+{
+ return (((TARGET_ALTIVEC) ? RS6000_BTM_ALTIVEC : 0)
+ | ((TARGET_VSX) ? RS6000_BTM_VSX : 0)
+ | ((TARGET_SPE) ? RS6000_BTM_SPE : 0)
+ | ((TARGET_PAIRED_FLOAT) ? RS6000_BTM_PAIRED : 0)
+ | ((TARGET_FRE) ? RS6000_BTM_FRE : 0)
+ | ((TARGET_FRES) ? RS6000_BTM_FRES : 0)
+ | ((TARGET_FRSQRTE) ? RS6000_BTM_FRSQRTE : 0)
+ | ((TARGET_FRSQRTES) ? RS6000_BTM_FRSQRTES : 0)
+ | ((TARGET_POPCNTD) ? RS6000_BTM_POPCNTD : 0)
+ | ((TARGET_POWERPC) ? RS6000_BTM_POWERPC : 0)
+ | ((rs6000_cpu == PROCESSOR_CELL) ? RS6000_BTM_CELL : 0));
+}
+
/* Override command line options. Mostly we process the processor type and
sometimes adjust other TARGET_ options. */
@@ -3232,6 +3309,19 @@ rs6000_option_override_internal (bool global_init_p)
}
}
+ /* Set the builtin mask of the various options used that could affect which
+ builtins were used. In the past we used target_flags, but we've run out
+ of bits, and some options like SPE and PAIRED are no longer in
+ target_flags. */
+ rs6000_builtin_mask = rs6000_builtin_mask_calculate ();
+ if (TARGET_DEBUG_BUILTIN || TARGET_DEBUG_TARGET)
+ fprintf (stderr, "new builtin mask = 0x%x%s%s%s%s\n", rs6000_builtin_mask,
+ (rs6000_builtin_mask & RS6000_BTM_ALTIVEC) ? ", altivec" : "",
+ (rs6000_builtin_mask & RS6000_BTM_VSX) ? ", vsx" : "",
+ (rs6000_builtin_mask & RS6000_BTM_PAIRED) ? ", paired" : "",
+ (rs6000_builtin_mask & RS6000_BTM_SPE) ? ", spe" : "");
+
+ /* Initialize all of the registers. */
rs6000_init_hard_regno_mode_ok (global_init_p);
/* Save the initial options in case the user does function specific options */
@@ -3299,69 +3389,6 @@ rs6000_loop_align_max_skip (rtx label)
return (1 << rs6000_loop_align (label)) - 1;
}
-/* Implement targetm.vectorize.builtin_conversion.
- Returns a decl of a function that implements conversion of an integer vector
- into a floating-point vector, or vice-versa. DEST_TYPE is the
- destination type and SRC_TYPE the source type of the conversion.
- Return NULL_TREE if it is not available. */
-static tree
-rs6000_builtin_conversion (unsigned int tcode, tree dest_type, tree src_type)
-{
- enum tree_code code = (enum tree_code) tcode;
-
- switch (code)
- {
- case FIX_TRUNC_EXPR:
- switch (TYPE_MODE (dest_type))
- {
- case V2DImode:
- if (!VECTOR_UNIT_VSX_P (V2DFmode))
- return NULL_TREE;
-
- return TYPE_UNSIGNED (dest_type)
- ? rs6000_builtin_decls[VSX_BUILTIN_XVCVDPUXDS_UNS]
- : rs6000_builtin_decls[VSX_BUILTIN_XVCVDPSXDS];
-
- case V4SImode:
- if (VECTOR_UNIT_NONE_P (V4SImode) || VECTOR_UNIT_NONE_P (V4SFmode))
- return NULL_TREE;
-
- return TYPE_UNSIGNED (dest_type)
- ? rs6000_builtin_decls[VECTOR_BUILTIN_FIXUNS_V4SF_V4SI]
- : rs6000_builtin_decls[VECTOR_BUILTIN_FIX_V4SF_V4SI];
-
- default:
- return NULL_TREE;
- }
-
- case FLOAT_EXPR:
- switch (TYPE_MODE (src_type))
- {
- case V2DImode:
- if (!VECTOR_UNIT_VSX_P (V2DFmode))
- return NULL_TREE;
-
- return TYPE_UNSIGNED (src_type)
- ? rs6000_builtin_decls[VSX_BUILTIN_XVCVUXDDP]
- : rs6000_builtin_decls[VSX_BUILTIN_XVCVSXDDP];
-
- case V4SImode:
- if (VECTOR_UNIT_NONE_P (V4SImode) || VECTOR_UNIT_NONE_P (V4SFmode))
- return NULL_TREE;
-
- return TYPE_UNSIGNED (src_type)
- ? rs6000_builtin_decls[VECTOR_BUILTIN_UNSFLOAT_V4SI_V4SF]
- : rs6000_builtin_decls[VECTOR_BUILTIN_FLOAT_V4SI_V4SF];
-
- default:
- return NULL_TREE;
- }
-
- default:
- return NULL_TREE;
- }
-}
-
/* Implement targetm.vectorize.builtin_mul_widen_even. */
static tree
rs6000_builtin_mul_widen_even (tree type)
@@ -3765,6 +3792,12 @@ rs6000_builtin_vectorized_function (tree fndecl, tree type_out,
enum machine_mode in_mode, out_mode;
int in_n, out_n;
+ if (TARGET_DEBUG_BUILTIN)
+ fprintf (stderr, "rs6000_builtin_vectorized_function (%s, %s, %s)\n",
+ IDENTIFIER_POINTER (DECL_NAME (fndecl)),
+ GET_MODE_NAME (TYPE_MODE (type_out)),
+ GET_MODE_NAME (TYPE_MODE (type_in)));
+
if (TREE_CODE (type_out) != VECTOR_TYPE
|| TREE_CODE (type_in) != VECTOR_TYPE
|| !TARGET_VECTORIZE_BUILTINS)
@@ -3917,7 +3950,7 @@ rs6000_builtin_vectorized_function (tree fndecl, tree type_out,
if (VECTOR_UNIT_VSX_P (V2DFmode)
&& out_mode == DFmode && out_n == 2
&& in_mode == DFmode && in_n == 2)
- return rs6000_builtin_decls[VSX_BUILTIN_VEC_RSQRT_V2DF];
+ return rs6000_builtin_decls[VSX_BUILTIN_RSQRT_2DF];
break;
case RS6000_BUILTIN_RECIPF:
if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)
@@ -9358,931 +9391,361 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
/* Builtins. */
static void
-def_builtin (int mask, const char *name, tree type, int code)
+def_builtin (const char *name, tree type, enum rs6000_builtins code)
{
- if ((mask & target_flags) || TARGET_PAIRED_FLOAT)
- {
- tree t;
- if (rs6000_builtin_decls[code])
- fatal_error ("internal error: builtin function to %s already processed",
- name);
+ tree t;
+ unsigned classify = rs6000_builtin_info[(int)code].mask;
+ const char *attr_string = "";
- rs6000_builtin_decls[code] = t =
- add_builtin_function (name, type, code, BUILT_IN_MD,
- NULL, NULL_TREE);
+ gcc_assert (name != NULL);
+ gcc_assert (IN_RANGE ((int)code, 0, (int)RS6000_BUILTIN_COUNT));
- gcc_assert (code >= 0 && code < (int)RS6000_BUILTIN_COUNT);
- switch (builtin_classify[code])
- {
- default:
- gcc_unreachable ();
+ if (rs6000_builtin_decls[(int)code])
+ fatal_error ("internal error: builtin function %s already processed", name);
- /* assume builtin can do anything. */
- case RS6000_BTC_MISC:
- break;
+ rs6000_builtin_decls[(int)code] = t =
+ add_builtin_function (name, type, (int)code, BUILT_IN_MD, NULL, NULL_TREE);
- /* const function, function only depends on the inputs. */
- case RS6000_BTC_CONST:
- TREE_READONLY (t) = 1;
- TREE_NOTHROW (t) = 1;
- break;
-
- /* pure function, function can read global memory. */
- case RS6000_BTC_PURE:
+ /* Set any special attributes. */
+ if ((classify & RS6000_BTC_CONST) != 0)
+ {
+ /* const function, function only depends on the inputs. */
+ TREE_READONLY (t) = 1;
+ TREE_NOTHROW (t) = 1;
+ attr_string = ", pure";
+ }
+ else if ((classify & RS6000_BTC_PURE) != 0)
+ {
+ /* pure function, function can read global memory, but does not set any
+ external state. */
+ DECL_PURE_P (t) = 1;
+ TREE_NOTHROW (t) = 1;
+ attr_string = ", const";
+ }
+ else if ((classify & RS6000_BTC_FP) != 0)
+ {
+ /* Function is a math function. If rounding mode is on, then treat the
+ function as not reading global memory, but it can have arbitrary side
+ effects. If it is off, then assume the function is a const function.
+ This mimics the ATTR_MATHFN_FPROUNDING attribute in
+ builtin-attribute.def that is used for the math functions. */
+ TREE_NOTHROW (t) = 1;
+ if (flag_rounding_math)
+ {
DECL_PURE_P (t) = 1;
- TREE_NOTHROW (t) = 1;
- break;
-
- /* Function is a math function. If rounding mode is on, then treat
- the function as not reading global memory, but it can have
- arbitrary side effects. If it is off, then assume the function is
- a const function. This mimics the ATTR_MATHFN_FPROUNDING
- attribute in builtin-attribute.def that is used for the math
- functions. */
- case RS6000_BTC_FP_PURE:
- TREE_NOTHROW (t) = 1;
- if (flag_rounding_math)
- {
- DECL_PURE_P (t) = 1;
- DECL_IS_NOVOPS (t) = 1;
- }
- else
- TREE_READONLY (t) = 1;
- break;
+ DECL_IS_NOVOPS (t) = 1;
+ attr_string = ", fp, pure";
+ }
+ else
+ {
+ TREE_READONLY (t) = 1;
+ attr_string = ", fp, const";
}
}
+ else if ((classify & RS6000_BTC_ATTR_MASK) != 0)
+ gcc_unreachable ();
+
+ if (TARGET_DEBUG_BUILTIN)
+ fprintf (stderr, "rs6000_builtin, code = %4d, %s%s\n",
+ (int)code, name, attr_string);
}
/* Simple ternary operations: VECd = foo (VECa, VECb, VECc). */
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE) \
+ { MASK, ICODE, NAME, ENUM },
+
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+
static const struct builtin_description bdesc_3arg[] =
{
- { MASK_ALTIVEC, CODE_FOR_fmav4sf4, "__builtin_altivec_vmaddfp", ALTIVEC_BUILTIN_VMADDFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmhaddshs, "__builtin_altivec_vmhaddshs", ALTIVEC_BUILTIN_VMHADDSHS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmhraddshs, "__builtin_altivec_vmhraddshs", ALTIVEC_BUILTIN_VMHRADDSHS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmladduhm, "__builtin_altivec_vmladduhm", ALTIVEC_BUILTIN_VMLADDUHM},
- { MASK_ALTIVEC, CODE_FOR_altivec_vmsumubm, "__builtin_altivec_vmsumubm", ALTIVEC_BUILTIN_VMSUMUBM },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmsummbm, "__builtin_altivec_vmsummbm", ALTIVEC_BUILTIN_VMSUMMBM },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmsumuhm, "__builtin_altivec_vmsumuhm", ALTIVEC_BUILTIN_VMSUMUHM },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmsumshm, "__builtin_altivec_vmsumshm", ALTIVEC_BUILTIN_VMSUMSHM },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmsumuhs, "__builtin_altivec_vmsumuhs", ALTIVEC_BUILTIN_VMSUMUHS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmsumshs, "__builtin_altivec_vmsumshs", ALTIVEC_BUILTIN_VMSUMSHS },
- { MASK_ALTIVEC, CODE_FOR_nfmsv4sf4, "__builtin_altivec_vnmsubfp", ALTIVEC_BUILTIN_VNMSUBFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v2df, "__builtin_altivec_vperm_2df", ALTIVEC_BUILTIN_VPERM_2DF },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v2di, "__builtin_altivec_vperm_2di", ALTIVEC_BUILTIN_VPERM_2DI },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v4sf, "__builtin_altivec_vperm_4sf", ALTIVEC_BUILTIN_VPERM_4SF },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v4si, "__builtin_altivec_vperm_4si", ALTIVEC_BUILTIN_VPERM_4SI },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v8hi, "__builtin_altivec_vperm_8hi", ALTIVEC_BUILTIN_VPERM_8HI },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v16qi_uns, "__builtin_altivec_vperm_16qi", ALTIVEC_BUILTIN_VPERM_16QI },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v2di_uns, "__builtin_altivec_vperm_2di_uns", ALTIVEC_BUILTIN_VPERM_2DI_UNS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v4si_uns, "__builtin_altivec_vperm_4si_uns", ALTIVEC_BUILTIN_VPERM_4SI_UNS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v8hi_uns, "__builtin_altivec_vperm_8hi_uns", ALTIVEC_BUILTIN_VPERM_8HI_UNS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vperm_v16qi_uns, "__builtin_altivec_vperm_16qi_uns", ALTIVEC_BUILTIN_VPERM_16QI_UNS },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v4sf, "__builtin_altivec_vsel_4sf", ALTIVEC_BUILTIN_VSEL_4SF },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v4si, "__builtin_altivec_vsel_4si", ALTIVEC_BUILTIN_VSEL_4SI },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v8hi, "__builtin_altivec_vsel_8hi", ALTIVEC_BUILTIN_VSEL_8HI },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v16qi, "__builtin_altivec_vsel_16qi", ALTIVEC_BUILTIN_VSEL_16QI },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v2df, "__builtin_altivec_vsel_2df", ALTIVEC_BUILTIN_VSEL_2DF },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v2di, "__builtin_altivec_vsel_2di", ALTIVEC_BUILTIN_VSEL_2DI },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v4si_uns, "__builtin_altivec_vsel_4si_uns", ALTIVEC_BUILTIN_VSEL_4SI_UNS },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v8hi_uns, "__builtin_altivec_vsel_8hi_uns", ALTIVEC_BUILTIN_VSEL_8HI_UNS },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v16qi_uns, "__builtin_altivec_vsel_16qi_uns", ALTIVEC_BUILTIN_VSEL_16QI_UNS },
- { MASK_ALTIVEC, CODE_FOR_vector_select_v2di_uns, "__builtin_altivec_vsel_2di_uns", ALTIVEC_BUILTIN_VSEL_2DI_UNS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsldoi_v16qi, "__builtin_altivec_vsldoi_16qi", ALTIVEC_BUILTIN_VSLDOI_16QI },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsldoi_v8hi, "__builtin_altivec_vsldoi_8hi", ALTIVEC_BUILTIN_VSLDOI_8HI },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsldoi_v4si, "__builtin_altivec_vsldoi_4si", ALTIVEC_BUILTIN_VSLDOI_4SI },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsldoi_v4sf, "__builtin_altivec_vsldoi_4sf", ALTIVEC_BUILTIN_VSLDOI_4SF },
-
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_madd", ALTIVEC_BUILTIN_VEC_MADD },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_madds", ALTIVEC_BUILTIN_VEC_MADDS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_mladd", ALTIVEC_BUILTIN_VEC_MLADD },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_mradds", ALTIVEC_BUILTIN_VEC_MRADDS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_msum", ALTIVEC_BUILTIN_VEC_MSUM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmsumshm", ALTIVEC_BUILTIN_VEC_VMSUMSHM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmsumuhm", ALTIVEC_BUILTIN_VEC_VMSUMUHM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmsummbm", ALTIVEC_BUILTIN_VEC_VMSUMMBM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmsumubm", ALTIVEC_BUILTIN_VEC_VMSUMUBM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_msums", ALTIVEC_BUILTIN_VEC_MSUMS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmsumshs", ALTIVEC_BUILTIN_VEC_VMSUMSHS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmsumuhs", ALTIVEC_BUILTIN_VEC_VMSUMUHS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_nmsub", ALTIVEC_BUILTIN_VEC_NMSUB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_perm", ALTIVEC_BUILTIN_VEC_PERM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sel", ALTIVEC_BUILTIN_VEC_SEL },
-
- { MASK_VSX, CODE_FOR_fmav2df4, "__builtin_vsx_xvmadddp", VSX_BUILTIN_XVMADDDP },
- { MASK_VSX, CODE_FOR_fmsv2df4, "__builtin_vsx_xvmsubdp", VSX_BUILTIN_XVMSUBDP },
- { MASK_VSX, CODE_FOR_nfmav2df4, "__builtin_vsx_xvnmadddp", VSX_BUILTIN_XVNMADDDP },
- { MASK_VSX, CODE_FOR_nfmsv2df4, "__builtin_vsx_xvnmsubdp", VSX_BUILTIN_XVNMSUBDP },
-
- { MASK_VSX, CODE_FOR_fmav4sf4, "__builtin_vsx_xvmaddsp", VSX_BUILTIN_XVMADDSP },
- { MASK_VSX, CODE_FOR_fmsv4sf4, "__builtin_vsx_xvmsubsp", VSX_BUILTIN_XVMSUBSP },
- { MASK_VSX, CODE_FOR_nfmav4sf4, "__builtin_vsx_xvnmaddsp", VSX_BUILTIN_XVNMADDSP },
- { MASK_VSX, CODE_FOR_nfmsv4sf4, "__builtin_vsx_xvnmsubsp", VSX_BUILTIN_XVNMSUBSP },
-
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_msub", VSX_BUILTIN_VEC_MSUB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_nmadd", VSX_BUILTIN_VEC_NMADD },
-
- { MASK_VSX, CODE_FOR_vector_select_v2di, "__builtin_vsx_xxsel_2di", VSX_BUILTIN_XXSEL_2DI },
- { MASK_VSX, CODE_FOR_vector_select_v2df, "__builtin_vsx_xxsel_2df", VSX_BUILTIN_XXSEL_2DF },
- { MASK_VSX, CODE_FOR_vector_select_v4sf, "__builtin_vsx_xxsel_4sf", VSX_BUILTIN_XXSEL_4SF },
- { MASK_VSX, CODE_FOR_vector_select_v4si, "__builtin_vsx_xxsel_4si", VSX_BUILTIN_XXSEL_4SI },
- { MASK_VSX, CODE_FOR_vector_select_v8hi, "__builtin_vsx_xxsel_8hi", VSX_BUILTIN_XXSEL_8HI },
- { MASK_VSX, CODE_FOR_vector_select_v16qi, "__builtin_vsx_xxsel_16qi", VSX_BUILTIN_XXSEL_16QI },
- { MASK_VSX, CODE_FOR_vector_select_v2di_uns, "__builtin_vsx_xxsel_2di_uns", VSX_BUILTIN_XXSEL_2DI_UNS },
- { MASK_VSX, CODE_FOR_vector_select_v4si_uns, "__builtin_vsx_xxsel_4si_uns", VSX_BUILTIN_XXSEL_4SI_UNS },
- { MASK_VSX, CODE_FOR_vector_select_v8hi_uns, "__builtin_vsx_xxsel_8hi_uns", VSX_BUILTIN_XXSEL_8HI_UNS },
- { MASK_VSX, CODE_FOR_vector_select_v16qi_uns, "__builtin_vsx_xxsel_16qi_uns", VSX_BUILTIN_XXSEL_16QI_UNS },
-
- { MASK_VSX, CODE_FOR_altivec_vperm_v2di, "__builtin_vsx_vperm_2di", VSX_BUILTIN_VPERM_2DI },
- { MASK_VSX, CODE_FOR_altivec_vperm_v2df, "__builtin_vsx_vperm_2df", VSX_BUILTIN_VPERM_2DF },
- { MASK_VSX, CODE_FOR_altivec_vperm_v4sf, "__builtin_vsx_vperm_4sf", VSX_BUILTIN_VPERM_4SF },
- { MASK_VSX, CODE_FOR_altivec_vperm_v4si, "__builtin_vsx_vperm_4si", VSX_BUILTIN_VPERM_4SI },
- { MASK_VSX, CODE_FOR_altivec_vperm_v8hi, "__builtin_vsx_vperm_8hi", VSX_BUILTIN_VPERM_8HI },
- { MASK_VSX, CODE_FOR_altivec_vperm_v16qi, "__builtin_vsx_vperm_16qi", VSX_BUILTIN_VPERM_16QI },
- { MASK_VSX, CODE_FOR_altivec_vperm_v2di_uns, "__builtin_vsx_vperm_2di_uns", VSX_BUILTIN_VPERM_2DI_UNS },
- { MASK_VSX, CODE_FOR_altivec_vperm_v4si_uns, "__builtin_vsx_vperm_4si_uns", VSX_BUILTIN_VPERM_4SI_UNS },
- { MASK_VSX, CODE_FOR_altivec_vperm_v8hi_uns, "__builtin_vsx_vperm_8hi_uns", VSX_BUILTIN_VPERM_8HI_UNS },
- { MASK_VSX, CODE_FOR_altivec_vperm_v16qi_uns, "__builtin_vsx_vperm_16qi_uns", VSX_BUILTIN_VPERM_16QI_UNS },
-
- { MASK_VSX, CODE_FOR_vsx_xxpermdi_v2df, "__builtin_vsx_xxpermdi_2df", VSX_BUILTIN_XXPERMDI_2DF },
- { MASK_VSX, CODE_FOR_vsx_xxpermdi_v2di, "__builtin_vsx_xxpermdi_2di", VSX_BUILTIN_XXPERMDI_2DI },
- { MASK_VSX, CODE_FOR_vsx_xxpermdi_v4sf, "__builtin_vsx_xxpermdi_4sf", VSX_BUILTIN_XXPERMDI_4SF },
- { MASK_VSX, CODE_FOR_vsx_xxpermdi_v4si, "__builtin_vsx_xxpermdi_4si", VSX_BUILTIN_XXPERMDI_4SI },
- { MASK_VSX, CODE_FOR_vsx_xxpermdi_v8hi, "__builtin_vsx_xxpermdi_8hi", VSX_BUILTIN_XXPERMDI_8HI },
- { MASK_VSX, CODE_FOR_vsx_xxpermdi_v16qi, "__builtin_vsx_xxpermdi_16qi", VSX_BUILTIN_XXPERMDI_16QI },
- { MASK_VSX, CODE_FOR_nothing, "__builtin_vsx_xxpermdi", VSX_BUILTIN_VEC_XXPERMDI },
- { MASK_VSX, CODE_FOR_vsx_set_v2df, "__builtin_vsx_set_2df", VSX_BUILTIN_SET_2DF },
- { MASK_VSX, CODE_FOR_vsx_set_v2di, "__builtin_vsx_set_2di", VSX_BUILTIN_SET_2DI },
-
- { MASK_VSX, CODE_FOR_vsx_xxsldwi_v2di, "__builtin_vsx_xxsldwi_2di", VSX_BUILTIN_XXSLDWI_2DI },
- { MASK_VSX, CODE_FOR_vsx_xxsldwi_v2df, "__builtin_vsx_xxsldwi_2df", VSX_BUILTIN_XXSLDWI_2DF },
- { MASK_VSX, CODE_FOR_vsx_xxsldwi_v4sf, "__builtin_vsx_xxsldwi_4sf", VSX_BUILTIN_XXSLDWI_4SF },
- { MASK_VSX, CODE_FOR_vsx_xxsldwi_v4si, "__builtin_vsx_xxsldwi_4si", VSX_BUILTIN_XXSLDWI_4SI },
- { MASK_VSX, CODE_FOR_vsx_xxsldwi_v8hi, "__builtin_vsx_xxsldwi_8hi", VSX_BUILTIN_XXSLDWI_8HI },
- { MASK_VSX, CODE_FOR_vsx_xxsldwi_v16qi, "__builtin_vsx_xxsldwi_16qi", VSX_BUILTIN_XXSLDWI_16QI },
- { MASK_VSX, CODE_FOR_nothing, "__builtin_vsx_xxsldwi", VSX_BUILTIN_VEC_XXSLDWI },
-
- { 0, CODE_FOR_fmsv2sf4, "__builtin_paired_msub", PAIRED_BUILTIN_MSUB },
- { 0, CODE_FOR_fmav2sf4, "__builtin_paired_madd", PAIRED_BUILTIN_MADD },
- { 0, CODE_FOR_paired_madds0, "__builtin_paired_madds0", PAIRED_BUILTIN_MADDS0 },
- { 0, CODE_FOR_paired_madds1, "__builtin_paired_madds1", PAIRED_BUILTIN_MADDS1 },
- { 0, CODE_FOR_nfmsv2sf4, "__builtin_paired_nmsub", PAIRED_BUILTIN_NMSUB },
- { 0, CODE_FOR_nfmav2sf4, "__builtin_paired_nmadd", PAIRED_BUILTIN_NMADD },
- { 0, CODE_FOR_paired_sum0, "__builtin_paired_sum0", PAIRED_BUILTIN_SUM0 },
- { 0, CODE_FOR_paired_sum1, "__builtin_paired_sum1", PAIRED_BUILTIN_SUM1 },
- { 0, CODE_FOR_selv2sf4, "__builtin_paired_selv2sf4", PAIRED_BUILTIN_SELV2SF4 },
+#include "rs6000-builtin.def"
};
/* DST operations: void foo (void *, const int, const char). */
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) \
+ { MASK, ICODE, NAME, ENUM },
+
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+
static const struct builtin_description bdesc_dst[] =
{
- { MASK_ALTIVEC, CODE_FOR_altivec_dst, "__builtin_altivec_dst", ALTIVEC_BUILTIN_DST },
- { MASK_ALTIVEC, CODE_FOR_altivec_dstt, "__builtin_altivec_dstt", ALTIVEC_BUILTIN_DSTT },
- { MASK_ALTIVEC, CODE_FOR_altivec_dstst, "__builtin_altivec_dstst", ALTIVEC_BUILTIN_DSTST },
- { MASK_ALTIVEC, CODE_FOR_altivec_dststt, "__builtin_altivec_dststt", ALTIVEC_BUILTIN_DSTSTT },
-
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_dst", ALTIVEC_BUILTIN_VEC_DST },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_dstt", ALTIVEC_BUILTIN_VEC_DSTT },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_dstst", ALTIVEC_BUILTIN_VEC_DSTST },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_dststt", ALTIVEC_BUILTIN_VEC_DSTSTT }
+#include "rs6000-builtin.def"
};
/* Simple binary operations: VECc = foo (VECa, VECb). */
-static struct builtin_description bdesc_2arg[] =
-{
- { MASK_ALTIVEC, CODE_FOR_addv16qi3, "__builtin_altivec_vaddubm", ALTIVEC_BUILTIN_VADDUBM },
- { MASK_ALTIVEC, CODE_FOR_addv8hi3, "__builtin_altivec_vadduhm", ALTIVEC_BUILTIN_VADDUHM },
- { MASK_ALTIVEC, CODE_FOR_addv4si3, "__builtin_altivec_vadduwm", ALTIVEC_BUILTIN_VADDUWM },
- { MASK_ALTIVEC, CODE_FOR_addv4sf3, "__builtin_altivec_vaddfp", ALTIVEC_BUILTIN_VADDFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vaddcuw, "__builtin_altivec_vaddcuw", ALTIVEC_BUILTIN_VADDCUW },
- { MASK_ALTIVEC, CODE_FOR_altivec_vaddubs, "__builtin_altivec_vaddubs", ALTIVEC_BUILTIN_VADDUBS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vaddsbs, "__builtin_altivec_vaddsbs", ALTIVEC_BUILTIN_VADDSBS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vadduhs, "__builtin_altivec_vadduhs", ALTIVEC_BUILTIN_VADDUHS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vaddshs, "__builtin_altivec_vaddshs", ALTIVEC_BUILTIN_VADDSHS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vadduws, "__builtin_altivec_vadduws", ALTIVEC_BUILTIN_VADDUWS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vaddsws, "__builtin_altivec_vaddsws", ALTIVEC_BUILTIN_VADDSWS },
- { MASK_ALTIVEC, CODE_FOR_andv4si3, "__builtin_altivec_vand", ALTIVEC_BUILTIN_VAND },
- { MASK_ALTIVEC, CODE_FOR_andcv4si3, "__builtin_altivec_vandc", ALTIVEC_BUILTIN_VANDC },
- { MASK_ALTIVEC, CODE_FOR_altivec_vavgub, "__builtin_altivec_vavgub", ALTIVEC_BUILTIN_VAVGUB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vavgsb, "__builtin_altivec_vavgsb", ALTIVEC_BUILTIN_VAVGSB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vavguh, "__builtin_altivec_vavguh", ALTIVEC_BUILTIN_VAVGUH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vavgsh, "__builtin_altivec_vavgsh", ALTIVEC_BUILTIN_VAVGSH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vavguw, "__builtin_altivec_vavguw", ALTIVEC_BUILTIN_VAVGUW },
- { MASK_ALTIVEC, CODE_FOR_altivec_vavgsw, "__builtin_altivec_vavgsw", ALTIVEC_BUILTIN_VAVGSW },
- { MASK_ALTIVEC, CODE_FOR_altivec_vcfux, "__builtin_altivec_vcfux", ALTIVEC_BUILTIN_VCFUX },
- { MASK_ALTIVEC, CODE_FOR_altivec_vcfsx, "__builtin_altivec_vcfsx", ALTIVEC_BUILTIN_VCFSX },
- { MASK_ALTIVEC, CODE_FOR_altivec_vcmpbfp, "__builtin_altivec_vcmpbfp", ALTIVEC_BUILTIN_VCMPBFP },
- { MASK_ALTIVEC, CODE_FOR_vector_eqv16qi, "__builtin_altivec_vcmpequb", ALTIVEC_BUILTIN_VCMPEQUB },
- { MASK_ALTIVEC, CODE_FOR_vector_eqv8hi, "__builtin_altivec_vcmpequh", ALTIVEC_BUILTIN_VCMPEQUH },
- { MASK_ALTIVEC, CODE_FOR_vector_eqv4si, "__builtin_altivec_vcmpequw", ALTIVEC_BUILTIN_VCMPEQUW },
- { MASK_ALTIVEC, CODE_FOR_vector_eqv4sf, "__builtin_altivec_vcmpeqfp", ALTIVEC_BUILTIN_VCMPEQFP },
- { MASK_ALTIVEC, CODE_FOR_vector_gev4sf, "__builtin_altivec_vcmpgefp", ALTIVEC_BUILTIN_VCMPGEFP },
- { MASK_ALTIVEC, CODE_FOR_vector_gtuv16qi, "__builtin_altivec_vcmpgtub", ALTIVEC_BUILTIN_VCMPGTUB },
- { MASK_ALTIVEC, CODE_FOR_vector_gtv16qi, "__builtin_altivec_vcmpgtsb", ALTIVEC_BUILTIN_VCMPGTSB },
- { MASK_ALTIVEC, CODE_FOR_vector_gtuv8hi, "__builtin_altivec_vcmpgtuh", ALTIVEC_BUILTIN_VCMPGTUH },
- { MASK_ALTIVEC, CODE_FOR_vector_gtv8hi, "__builtin_altivec_vcmpgtsh", ALTIVEC_BUILTIN_VCMPGTSH },
- { MASK_ALTIVEC, CODE_FOR_vector_gtuv4si, "__builtin_altivec_vcmpgtuw", ALTIVEC_BUILTIN_VCMPGTUW },
- { MASK_ALTIVEC, CODE_FOR_vector_gtv4si, "__builtin_altivec_vcmpgtsw", ALTIVEC_BUILTIN_VCMPGTSW },
- { MASK_ALTIVEC, CODE_FOR_vector_gtv4sf, "__builtin_altivec_vcmpgtfp", ALTIVEC_BUILTIN_VCMPGTFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vctsxs, "__builtin_altivec_vctsxs", ALTIVEC_BUILTIN_VCTSXS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vctuxs, "__builtin_altivec_vctuxs", ALTIVEC_BUILTIN_VCTUXS },
- { MASK_ALTIVEC, CODE_FOR_umaxv16qi3, "__builtin_altivec_vmaxub", ALTIVEC_BUILTIN_VMAXUB },
- { MASK_ALTIVEC, CODE_FOR_smaxv16qi3, "__builtin_altivec_vmaxsb", ALTIVEC_BUILTIN_VMAXSB },
- { MASK_ALTIVEC, CODE_FOR_umaxv8hi3, "__builtin_altivec_vmaxuh", ALTIVEC_BUILTIN_VMAXUH },
- { MASK_ALTIVEC, CODE_FOR_smaxv8hi3, "__builtin_altivec_vmaxsh", ALTIVEC_BUILTIN_VMAXSH },
- { MASK_ALTIVEC, CODE_FOR_umaxv4si3, "__builtin_altivec_vmaxuw", ALTIVEC_BUILTIN_VMAXUW },
- { MASK_ALTIVEC, CODE_FOR_smaxv4si3, "__builtin_altivec_vmaxsw", ALTIVEC_BUILTIN_VMAXSW },
- { MASK_ALTIVEC, CODE_FOR_smaxv4sf3, "__builtin_altivec_vmaxfp", ALTIVEC_BUILTIN_VMAXFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmrghb, "__builtin_altivec_vmrghb", ALTIVEC_BUILTIN_VMRGHB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmrghh, "__builtin_altivec_vmrghh", ALTIVEC_BUILTIN_VMRGHH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmrghw, "__builtin_altivec_vmrghw", ALTIVEC_BUILTIN_VMRGHW },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmrglb, "__builtin_altivec_vmrglb", ALTIVEC_BUILTIN_VMRGLB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmrglh, "__builtin_altivec_vmrglh", ALTIVEC_BUILTIN_VMRGLH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmrglw, "__builtin_altivec_vmrglw", ALTIVEC_BUILTIN_VMRGLW },
- { MASK_ALTIVEC, CODE_FOR_uminv16qi3, "__builtin_altivec_vminub", ALTIVEC_BUILTIN_VMINUB },
- { MASK_ALTIVEC, CODE_FOR_sminv16qi3, "__builtin_altivec_vminsb", ALTIVEC_BUILTIN_VMINSB },
- { MASK_ALTIVEC, CODE_FOR_uminv8hi3, "__builtin_altivec_vminuh", ALTIVEC_BUILTIN_VMINUH },
- { MASK_ALTIVEC, CODE_FOR_sminv8hi3, "__builtin_altivec_vminsh", ALTIVEC_BUILTIN_VMINSH },
- { MASK_ALTIVEC, CODE_FOR_uminv4si3, "__builtin_altivec_vminuw", ALTIVEC_BUILTIN_VMINUW },
- { MASK_ALTIVEC, CODE_FOR_sminv4si3, "__builtin_altivec_vminsw", ALTIVEC_BUILTIN_VMINSW },
- { MASK_ALTIVEC, CODE_FOR_sminv4sf3, "__builtin_altivec_vminfp", ALTIVEC_BUILTIN_VMINFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmuleub, "__builtin_altivec_vmuleub", ALTIVEC_BUILTIN_VMULEUB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmuleub, "__builtin_altivec_vmuleub_uns", ALTIVEC_BUILTIN_VMULEUB_UNS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmulesb, "__builtin_altivec_vmulesb", ALTIVEC_BUILTIN_VMULESB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmuleuh, "__builtin_altivec_vmuleuh", ALTIVEC_BUILTIN_VMULEUH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmuleuh, "__builtin_altivec_vmuleuh_uns", ALTIVEC_BUILTIN_VMULEUH_UNS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmulesh, "__builtin_altivec_vmulesh", ALTIVEC_BUILTIN_VMULESH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmuloub, "__builtin_altivec_vmuloub", ALTIVEC_BUILTIN_VMULOUB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmuloub, "__builtin_altivec_vmuloub_uns", ALTIVEC_BUILTIN_VMULOUB_UNS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmulosb, "__builtin_altivec_vmulosb", ALTIVEC_BUILTIN_VMULOSB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmulouh, "__builtin_altivec_vmulouh", ALTIVEC_BUILTIN_VMULOUH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmulouh, "__builtin_altivec_vmulouh_uns", ALTIVEC_BUILTIN_VMULOUH_UNS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vmulosh, "__builtin_altivec_vmulosh", ALTIVEC_BUILTIN_VMULOSH },
- { MASK_ALTIVEC, CODE_FOR_norv4si3, "__builtin_altivec_vnor", ALTIVEC_BUILTIN_VNOR },
- { MASK_ALTIVEC, CODE_FOR_iorv4si3, "__builtin_altivec_vor", ALTIVEC_BUILTIN_VOR },
- { MASK_ALTIVEC, CODE_FOR_altivec_vpkuhum, "__builtin_altivec_vpkuhum", ALTIVEC_BUILTIN_VPKUHUM },
- { MASK_ALTIVEC, CODE_FOR_altivec_vpkuwum, "__builtin_altivec_vpkuwum", ALTIVEC_BUILTIN_VPKUWUM },
- { MASK_ALTIVEC, CODE_FOR_altivec_vpkpx, "__builtin_altivec_vpkpx", ALTIVEC_BUILTIN_VPKPX },
- { MASK_ALTIVEC, CODE_FOR_altivec_vpkshss, "__builtin_altivec_vpkshss", ALTIVEC_BUILTIN_VPKSHSS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vpkswss, "__builtin_altivec_vpkswss", ALTIVEC_BUILTIN_VPKSWSS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vpkuhus, "__builtin_altivec_vpkuhus", ALTIVEC_BUILTIN_VPKUHUS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vpkshus, "__builtin_altivec_vpkshus", ALTIVEC_BUILTIN_VPKSHUS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vpkuwus, "__builtin_altivec_vpkuwus", ALTIVEC_BUILTIN_VPKUWUS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vpkswus, "__builtin_altivec_vpkswus", ALTIVEC_BUILTIN_VPKSWUS },
- { MASK_ALTIVEC, CODE_FOR_recipv4sf3, "__builtin_altivec_vrecipdivfp", ALTIVEC_BUILTIN_VRECIPFP },
- { MASK_ALTIVEC, CODE_FOR_vrotlv16qi3, "__builtin_altivec_vrlb", ALTIVEC_BUILTIN_VRLB },
- { MASK_ALTIVEC, CODE_FOR_vrotlv8hi3, "__builtin_altivec_vrlh", ALTIVEC_BUILTIN_VRLH },
- { MASK_ALTIVEC, CODE_FOR_vrotlv4si3, "__builtin_altivec_vrlw", ALTIVEC_BUILTIN_VRLW },
- { MASK_ALTIVEC, CODE_FOR_vashlv16qi3, "__builtin_altivec_vslb", ALTIVEC_BUILTIN_VSLB },
- { MASK_ALTIVEC, CODE_FOR_vashlv8hi3, "__builtin_altivec_vslh", ALTIVEC_BUILTIN_VSLH },
- { MASK_ALTIVEC, CODE_FOR_vashlv4si3, "__builtin_altivec_vslw", ALTIVEC_BUILTIN_VSLW },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsl, "__builtin_altivec_vsl", ALTIVEC_BUILTIN_VSL },
- { MASK_ALTIVEC, CODE_FOR_altivec_vslo, "__builtin_altivec_vslo", ALTIVEC_BUILTIN_VSLO },
- { MASK_ALTIVEC, CODE_FOR_altivec_vspltb, "__builtin_altivec_vspltb", ALTIVEC_BUILTIN_VSPLTB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsplth, "__builtin_altivec_vsplth", ALTIVEC_BUILTIN_VSPLTH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vspltw, "__builtin_altivec_vspltw", ALTIVEC_BUILTIN_VSPLTW },
- { MASK_ALTIVEC, CODE_FOR_vlshrv16qi3, "__builtin_altivec_vsrb", ALTIVEC_BUILTIN_VSRB },
- { MASK_ALTIVEC, CODE_FOR_vlshrv8hi3, "__builtin_altivec_vsrh", ALTIVEC_BUILTIN_VSRH },
- { MASK_ALTIVEC, CODE_FOR_vlshrv4si3, "__builtin_altivec_vsrw", ALTIVEC_BUILTIN_VSRW },
- { MASK_ALTIVEC, CODE_FOR_vashrv16qi3, "__builtin_altivec_vsrab", ALTIVEC_BUILTIN_VSRAB },
- { MASK_ALTIVEC, CODE_FOR_vashrv8hi3, "__builtin_altivec_vsrah", ALTIVEC_BUILTIN_VSRAH },
- { MASK_ALTIVEC, CODE_FOR_vashrv4si3, "__builtin_altivec_vsraw", ALTIVEC_BUILTIN_VSRAW },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsr, "__builtin_altivec_vsr", ALTIVEC_BUILTIN_VSR },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsro, "__builtin_altivec_vsro", ALTIVEC_BUILTIN_VSRO },
- { MASK_ALTIVEC, CODE_FOR_subv16qi3, "__builtin_altivec_vsububm", ALTIVEC_BUILTIN_VSUBUBM },
- { MASK_ALTIVEC, CODE_FOR_subv8hi3, "__builtin_altivec_vsubuhm", ALTIVEC_BUILTIN_VSUBUHM },
- { MASK_ALTIVEC, CODE_FOR_subv4si3, "__builtin_altivec_vsubuwm", ALTIVEC_BUILTIN_VSUBUWM },
- { MASK_ALTIVEC, CODE_FOR_subv4sf3, "__builtin_altivec_vsubfp", ALTIVEC_BUILTIN_VSUBFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsubcuw, "__builtin_altivec_vsubcuw", ALTIVEC_BUILTIN_VSUBCUW },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsububs, "__builtin_altivec_vsububs", ALTIVEC_BUILTIN_VSUBUBS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsubsbs, "__builtin_altivec_vsubsbs", ALTIVEC_BUILTIN_VSUBSBS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsubuhs, "__builtin_altivec_vsubuhs", ALTIVEC_BUILTIN_VSUBUHS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsubshs, "__builtin_altivec_vsubshs", ALTIVEC_BUILTIN_VSUBSHS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsubuws, "__builtin_altivec_vsubuws", ALTIVEC_BUILTIN_VSUBUWS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsubsws, "__builtin_altivec_vsubsws", ALTIVEC_BUILTIN_VSUBSWS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsum4ubs, "__builtin_altivec_vsum4ubs", ALTIVEC_BUILTIN_VSUM4UBS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsum4sbs, "__builtin_altivec_vsum4sbs", ALTIVEC_BUILTIN_VSUM4SBS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsum4shs, "__builtin_altivec_vsum4shs", ALTIVEC_BUILTIN_VSUM4SHS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsum2sws, "__builtin_altivec_vsum2sws", ALTIVEC_BUILTIN_VSUM2SWS },
- { MASK_ALTIVEC, CODE_FOR_altivec_vsumsws, "__builtin_altivec_vsumsws", ALTIVEC_BUILTIN_VSUMSWS },
- { MASK_ALTIVEC, CODE_FOR_xorv4si3, "__builtin_altivec_vxor", ALTIVEC_BUILTIN_VXOR },
- { MASK_ALTIVEC, CODE_FOR_vector_copysignv4sf3, "__builtin_altivec_copysignfp", ALTIVEC_BUILTIN_COPYSIGN_V4SF },
-
- { MASK_VSX, CODE_FOR_addv2df3, "__builtin_vsx_xvadddp", VSX_BUILTIN_XVADDDP },
- { MASK_VSX, CODE_FOR_subv2df3, "__builtin_vsx_xvsubdp", VSX_BUILTIN_XVSUBDP },
- { MASK_VSX, CODE_FOR_mulv2df3, "__builtin_vsx_xvmuldp", VSX_BUILTIN_XVMULDP },
- { MASK_VSX, CODE_FOR_divv2df3, "__builtin_vsx_xvdivdp", VSX_BUILTIN_XVDIVDP },
- { MASK_VSX, CODE_FOR_recipv2df3, "__builtin_vsx_xvrecipdivdp", VSX_BUILTIN_RECIP_V2DF },
- { MASK_VSX, CODE_FOR_sminv2df3, "__builtin_vsx_xvmindp", VSX_BUILTIN_XVMINDP },
- { MASK_VSX, CODE_FOR_smaxv2df3, "__builtin_vsx_xvmaxdp", VSX_BUILTIN_XVMAXDP },
- { MASK_VSX, CODE_FOR_vsx_tdivv2df3_fe, "__builtin_vsx_xvtdivdp_fe", VSX_BUILTIN_XVTDIVDP_FE },
- { MASK_VSX, CODE_FOR_vsx_tdivv2df3_fg, "__builtin_vsx_xvtdivdp_fg", VSX_BUILTIN_XVTDIVDP_FG },
- { MASK_VSX, CODE_FOR_vector_eqv2df, "__builtin_vsx_xvcmpeqdp", VSX_BUILTIN_XVCMPEQDP },
- { MASK_VSX, CODE_FOR_vector_gtv2df, "__builtin_vsx_xvcmpgtdp", VSX_BUILTIN_XVCMPGTDP },
- { MASK_VSX, CODE_FOR_vector_gev2df, "__builtin_vsx_xvcmpgedp", VSX_BUILTIN_XVCMPGEDP },
-
- { MASK_VSX, CODE_FOR_addv4sf3, "__builtin_vsx_xvaddsp", VSX_BUILTIN_XVADDSP },
- { MASK_VSX, CODE_FOR_subv4sf3, "__builtin_vsx_xvsubsp", VSX_BUILTIN_XVSUBSP },
- { MASK_VSX, CODE_FOR_mulv4sf3, "__builtin_vsx_xvmulsp", VSX_BUILTIN_XVMULSP },
- { MASK_VSX, CODE_FOR_divv4sf3, "__builtin_vsx_xvdivsp", VSX_BUILTIN_XVDIVSP },
- { MASK_VSX, CODE_FOR_recipv4sf3, "__builtin_vsx_xvrecipdivsp", VSX_BUILTIN_RECIP_V4SF },
- { MASK_VSX, CODE_FOR_sminv4sf3, "__builtin_vsx_xvminsp", VSX_BUILTIN_XVMINSP },
- { MASK_VSX, CODE_FOR_smaxv4sf3, "__builtin_vsx_xvmaxsp", VSX_BUILTIN_XVMAXSP },
- { MASK_VSX, CODE_FOR_vsx_tdivv4sf3_fe, "__builtin_vsx_xvtdivsp_fe", VSX_BUILTIN_XVTDIVSP_FE },
- { MASK_VSX, CODE_FOR_vsx_tdivv4sf3_fg, "__builtin_vsx_xvtdivsp_fg", VSX_BUILTIN_XVTDIVSP_FG },
- { MASK_VSX, CODE_FOR_vector_eqv4sf, "__builtin_vsx_xvcmpeqsp", VSX_BUILTIN_XVCMPEQSP },
- { MASK_VSX, CODE_FOR_vector_gtv4sf, "__builtin_vsx_xvcmpgtsp", VSX_BUILTIN_XVCMPGTSP },
- { MASK_VSX, CODE_FOR_vector_gev4sf, "__builtin_vsx_xvcmpgesp", VSX_BUILTIN_XVCMPGESP },
-
- { MASK_VSX, CODE_FOR_smindf3, "__builtin_vsx_xsmindp", VSX_BUILTIN_XSMINDP },
- { MASK_VSX, CODE_FOR_smaxdf3, "__builtin_vsx_xsmaxdp", VSX_BUILTIN_XSMAXDP },
- { MASK_VSX, CODE_FOR_vsx_tdivdf3_fe, "__builtin_vsx_xstdivdp_fe", VSX_BUILTIN_XSTDIVDP_FE },
- { MASK_VSX, CODE_FOR_vsx_tdivdf3_fg, "__builtin_vsx_xstdivdp_fg", VSX_BUILTIN_XSTDIVDP_FG },
- { MASK_VSX, CODE_FOR_vector_copysignv2df3, "__builtin_vsx_cpsgndp", VSX_BUILTIN_CPSGNDP },
- { MASK_VSX, CODE_FOR_vector_copysignv4sf3, "__builtin_vsx_cpsgnsp", VSX_BUILTIN_CPSGNSP },
-
- { MASK_VSX, CODE_FOR_vsx_concat_v2df, "__builtin_vsx_concat_2df", VSX_BUILTIN_CONCAT_2DF },
- { MASK_VSX, CODE_FOR_vsx_concat_v2di, "__builtin_vsx_concat_2di", VSX_BUILTIN_CONCAT_2DI },
- { MASK_VSX, CODE_FOR_vsx_splat_v2df, "__builtin_vsx_splat_2df", VSX_BUILTIN_SPLAT_2DF },
- { MASK_VSX, CODE_FOR_vsx_splat_v2di, "__builtin_vsx_splat_2di", VSX_BUILTIN_SPLAT_2DI },
- { MASK_VSX, CODE_FOR_vsx_xxmrghw_v4sf, "__builtin_vsx_xxmrghw", VSX_BUILTIN_XXMRGHW_4SF },
- { MASK_VSX, CODE_FOR_vsx_xxmrghw_v4si, "__builtin_vsx_xxmrghw_4si", VSX_BUILTIN_XXMRGHW_4SI },
- { MASK_VSX, CODE_FOR_vsx_xxmrglw_v4sf, "__builtin_vsx_xxmrglw", VSX_BUILTIN_XXMRGLW_4SF },
- { MASK_VSX, CODE_FOR_vsx_xxmrglw_v4si, "__builtin_vsx_xxmrglw_4si", VSX_BUILTIN_XXMRGLW_4SI },
- { MASK_VSX, CODE_FOR_vec_interleave_lowv2df, "__builtin_vsx_mergel_2df", VSX_BUILTIN_VEC_MERGEL_V2DF },
- { MASK_VSX, CODE_FOR_vec_interleave_lowv2di, "__builtin_vsx_mergel_2di", VSX_BUILTIN_VEC_MERGEL_V2DI },
- { MASK_VSX, CODE_FOR_vec_interleave_highv2df, "__builtin_vsx_mergeh_2df", VSX_BUILTIN_VEC_MERGEH_V2DF },
- { MASK_VSX, CODE_FOR_vec_interleave_highv2di, "__builtin_vsx_mergeh_2di", VSX_BUILTIN_VEC_MERGEH_V2DI },
-
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_add", ALTIVEC_BUILTIN_VEC_ADD },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vaddfp", ALTIVEC_BUILTIN_VEC_VADDFP },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vadduwm", ALTIVEC_BUILTIN_VEC_VADDUWM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vadduhm", ALTIVEC_BUILTIN_VEC_VADDUHM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vaddubm", ALTIVEC_BUILTIN_VEC_VADDUBM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_addc", ALTIVEC_BUILTIN_VEC_ADDC },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_adds", ALTIVEC_BUILTIN_VEC_ADDS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vaddsws", ALTIVEC_BUILTIN_VEC_VADDSWS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vadduws", ALTIVEC_BUILTIN_VEC_VADDUWS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vaddshs", ALTIVEC_BUILTIN_VEC_VADDSHS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vadduhs", ALTIVEC_BUILTIN_VEC_VADDUHS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vaddsbs", ALTIVEC_BUILTIN_VEC_VADDSBS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vaddubs", ALTIVEC_BUILTIN_VEC_VADDUBS },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_and", ALTIVEC_BUILTIN_VEC_AND },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_andc", ALTIVEC_BUILTIN_VEC_ANDC },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_avg", ALTIVEC_BUILTIN_VEC_AVG },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vavgsw", ALTIVEC_BUILTIN_VEC_VAVGSW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vavguw", ALTIVEC_BUILTIN_VEC_VAVGUW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vavgsh", ALTIVEC_BUILTIN_VEC_VAVGSH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vavguh", ALTIVEC_BUILTIN_VEC_VAVGUH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vavgsb", ALTIVEC_BUILTIN_VEC_VAVGSB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vavgub", ALTIVEC_BUILTIN_VEC_VAVGUB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_cmpb", ALTIVEC_BUILTIN_VEC_CMPB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_cmpeq", ALTIVEC_BUILTIN_VEC_CMPEQ },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpeqfp", ALTIVEC_BUILTIN_VEC_VCMPEQFP },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpequw", ALTIVEC_BUILTIN_VEC_VCMPEQUW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpequh", ALTIVEC_BUILTIN_VEC_VCMPEQUH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpequb", ALTIVEC_BUILTIN_VEC_VCMPEQUB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_cmpge", ALTIVEC_BUILTIN_VEC_CMPGE },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_cmpgt", ALTIVEC_BUILTIN_VEC_CMPGT },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpgtfp", ALTIVEC_BUILTIN_VEC_VCMPGTFP },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpgtsw", ALTIVEC_BUILTIN_VEC_VCMPGTSW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpgtuw", ALTIVEC_BUILTIN_VEC_VCMPGTUW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpgtsh", ALTIVEC_BUILTIN_VEC_VCMPGTSH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpgtuh", ALTIVEC_BUILTIN_VEC_VCMPGTUH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpgtsb", ALTIVEC_BUILTIN_VEC_VCMPGTSB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpgtub", ALTIVEC_BUILTIN_VEC_VCMPGTUB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_cmple", ALTIVEC_BUILTIN_VEC_CMPLE },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_cmplt", ALTIVEC_BUILTIN_VEC_CMPLT },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_copysign", ALTIVEC_BUILTIN_VEC_COPYSIGN },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_max", ALTIVEC_BUILTIN_VEC_MAX },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vmaxfp", ALTIVEC_BUILTIN_VEC_VMAXFP },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmaxsw", ALTIVEC_BUILTIN_VEC_VMAXSW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmaxuw", ALTIVEC_BUILTIN_VEC_VMAXUW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmaxsh", ALTIVEC_BUILTIN_VEC_VMAXSH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmaxuh", ALTIVEC_BUILTIN_VEC_VMAXUH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmaxsb", ALTIVEC_BUILTIN_VEC_VMAXSB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmaxub", ALTIVEC_BUILTIN_VEC_VMAXUB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_mergeh", ALTIVEC_BUILTIN_VEC_MERGEH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmrghw", ALTIVEC_BUILTIN_VEC_VMRGHW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmrghh", ALTIVEC_BUILTIN_VEC_VMRGHH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmrghb", ALTIVEC_BUILTIN_VEC_VMRGHB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_mergel", ALTIVEC_BUILTIN_VEC_MERGEL },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmrglw", ALTIVEC_BUILTIN_VEC_VMRGLW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmrglh", ALTIVEC_BUILTIN_VEC_VMRGLH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmrglb", ALTIVEC_BUILTIN_VEC_VMRGLB },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_min", ALTIVEC_BUILTIN_VEC_MIN },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vminfp", ALTIVEC_BUILTIN_VEC_VMINFP },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vminsw", ALTIVEC_BUILTIN_VEC_VMINSW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vminuw", ALTIVEC_BUILTIN_VEC_VMINUW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vminsh", ALTIVEC_BUILTIN_VEC_VMINSH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vminuh", ALTIVEC_BUILTIN_VEC_VMINUH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vminsb", ALTIVEC_BUILTIN_VEC_VMINSB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vminub", ALTIVEC_BUILTIN_VEC_VMINUB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_mule", ALTIVEC_BUILTIN_VEC_MULE },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmuleub", ALTIVEC_BUILTIN_VEC_VMULEUB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmulesb", ALTIVEC_BUILTIN_VEC_VMULESB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmuleuh", ALTIVEC_BUILTIN_VEC_VMULEUH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmulesh", ALTIVEC_BUILTIN_VEC_VMULESH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_mulo", ALTIVEC_BUILTIN_VEC_MULO },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmulosh", ALTIVEC_BUILTIN_VEC_VMULOSH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmulouh", ALTIVEC_BUILTIN_VEC_VMULOUH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmulosb", ALTIVEC_BUILTIN_VEC_VMULOSB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmuloub", ALTIVEC_BUILTIN_VEC_VMULOUB },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_nor", ALTIVEC_BUILTIN_VEC_NOR },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_or", ALTIVEC_BUILTIN_VEC_OR },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_pack", ALTIVEC_BUILTIN_VEC_PACK },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkuwum", ALTIVEC_BUILTIN_VEC_VPKUWUM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkuhum", ALTIVEC_BUILTIN_VEC_VPKUHUM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_packpx", ALTIVEC_BUILTIN_VEC_PACKPX },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_packs", ALTIVEC_BUILTIN_VEC_PACKS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkswss", ALTIVEC_BUILTIN_VEC_VPKSWSS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkuwus", ALTIVEC_BUILTIN_VEC_VPKUWUS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkshss", ALTIVEC_BUILTIN_VEC_VPKSHSS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkuhus", ALTIVEC_BUILTIN_VEC_VPKUHUS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_packsu", ALTIVEC_BUILTIN_VEC_PACKSU },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkswus", ALTIVEC_BUILTIN_VEC_VPKSWUS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vpkshus", ALTIVEC_BUILTIN_VEC_VPKSHUS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_recipdiv", ALTIVEC_BUILTIN_VEC_RECIP },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_rl", ALTIVEC_BUILTIN_VEC_RL },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vrlw", ALTIVEC_BUILTIN_VEC_VRLW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vrlh", ALTIVEC_BUILTIN_VEC_VRLH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vrlb", ALTIVEC_BUILTIN_VEC_VRLB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sl", ALTIVEC_BUILTIN_VEC_SL },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vslw", ALTIVEC_BUILTIN_VEC_VSLW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vslh", ALTIVEC_BUILTIN_VEC_VSLH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vslb", ALTIVEC_BUILTIN_VEC_VSLB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sll", ALTIVEC_BUILTIN_VEC_SLL },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_slo", ALTIVEC_BUILTIN_VEC_SLO },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sr", ALTIVEC_BUILTIN_VEC_SR },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsrw", ALTIVEC_BUILTIN_VEC_VSRW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsrh", ALTIVEC_BUILTIN_VEC_VSRH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsrb", ALTIVEC_BUILTIN_VEC_VSRB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sra", ALTIVEC_BUILTIN_VEC_SRA },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsraw", ALTIVEC_BUILTIN_VEC_VSRAW },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsrah", ALTIVEC_BUILTIN_VEC_VSRAH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsrab", ALTIVEC_BUILTIN_VEC_VSRAB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_srl", ALTIVEC_BUILTIN_VEC_SRL },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sro", ALTIVEC_BUILTIN_VEC_SRO },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_sub", ALTIVEC_BUILTIN_VEC_SUB },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vsubfp", ALTIVEC_BUILTIN_VEC_VSUBFP },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsubuwm", ALTIVEC_BUILTIN_VEC_VSUBUWM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsubuhm", ALTIVEC_BUILTIN_VEC_VSUBUHM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsububm", ALTIVEC_BUILTIN_VEC_VSUBUBM },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_subc", ALTIVEC_BUILTIN_VEC_SUBC },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_subs", ALTIVEC_BUILTIN_VEC_SUBS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsubsws", ALTIVEC_BUILTIN_VEC_VSUBSWS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsubuws", ALTIVEC_BUILTIN_VEC_VSUBUWS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsubshs", ALTIVEC_BUILTIN_VEC_VSUBSHS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsubuhs", ALTIVEC_BUILTIN_VEC_VSUBUHS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsubsbs", ALTIVEC_BUILTIN_VEC_VSUBSBS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsububs", ALTIVEC_BUILTIN_VEC_VSUBUBS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sum4s", ALTIVEC_BUILTIN_VEC_SUM4S },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsum4shs", ALTIVEC_BUILTIN_VEC_VSUM4SHS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsum4sbs", ALTIVEC_BUILTIN_VEC_VSUM4SBS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vsum4ubs", ALTIVEC_BUILTIN_VEC_VSUM4UBS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sum2s", ALTIVEC_BUILTIN_VEC_SUM2S },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sums", ALTIVEC_BUILTIN_VEC_SUMS },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_xor", ALTIVEC_BUILTIN_VEC_XOR },
-
- { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_mul", VSX_BUILTIN_VEC_MUL },
- { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_div", VSX_BUILTIN_VEC_DIV },
-
- { 0, CODE_FOR_paired_divv2sf3, "__builtin_paired_divv2sf3", PAIRED_BUILTIN_DIVV2SF3 },
- { 0, CODE_FOR_paired_addv2sf3, "__builtin_paired_addv2sf3", PAIRED_BUILTIN_ADDV2SF3 },
- { 0, CODE_FOR_paired_subv2sf3, "__builtin_paired_subv2sf3", PAIRED_BUILTIN_SUBV2SF3 },
- { 0, CODE_FOR_paired_mulv2sf3, "__builtin_paired_mulv2sf3", PAIRED_BUILTIN_MULV2SF3 },
- { 0, CODE_FOR_paired_muls0, "__builtin_paired_muls0", PAIRED_BUILTIN_MULS0 },
- { 0, CODE_FOR_paired_muls1, "__builtin_paired_muls1", PAIRED_BUILTIN_MULS1 },
- { 0, CODE_FOR_paired_merge00, "__builtin_paired_merge00", PAIRED_BUILTIN_MERGE00 },
- { 0, CODE_FOR_paired_merge01, "__builtin_paired_merge01", PAIRED_BUILTIN_MERGE01 },
- { 0, CODE_FOR_paired_merge10, "__builtin_paired_merge10", PAIRED_BUILTIN_MERGE10 },
- { 0, CODE_FOR_paired_merge11, "__builtin_paired_merge11", PAIRED_BUILTIN_MERGE11 },
-
- /* Place holder, leave as first spe builtin. */
- { 0, CODE_FOR_addv2si3, "__builtin_spe_evaddw", SPE_BUILTIN_EVADDW },
- { 0, CODE_FOR_andv2si3, "__builtin_spe_evand", SPE_BUILTIN_EVAND },
- { 0, CODE_FOR_spe_evandc, "__builtin_spe_evandc", SPE_BUILTIN_EVANDC },
- { 0, CODE_FOR_divv2si3, "__builtin_spe_evdivws", SPE_BUILTIN_EVDIVWS },
- { 0, CODE_FOR_spe_evdivwu, "__builtin_spe_evdivwu", SPE_BUILTIN_EVDIVWU },
- { 0, CODE_FOR_spe_eveqv, "__builtin_spe_eveqv", SPE_BUILTIN_EVEQV },
- { 0, CODE_FOR_spe_evfsadd, "__builtin_spe_evfsadd", SPE_BUILTIN_EVFSADD },
- { 0, CODE_FOR_spe_evfsdiv, "__builtin_spe_evfsdiv", SPE_BUILTIN_EVFSDIV },
- { 0, CODE_FOR_spe_evfsmul, "__builtin_spe_evfsmul", SPE_BUILTIN_EVFSMUL },
- { 0, CODE_FOR_spe_evfssub, "__builtin_spe_evfssub", SPE_BUILTIN_EVFSSUB },
- { 0, CODE_FOR_spe_evmergehi, "__builtin_spe_evmergehi", SPE_BUILTIN_EVMERGEHI },
- { 0, CODE_FOR_spe_evmergehilo, "__builtin_spe_evmergehilo", SPE_BUILTIN_EVMERGEHILO },
- { 0, CODE_FOR_spe_evmergelo, "__builtin_spe_evmergelo", SPE_BUILTIN_EVMERGELO },
- { 0, CODE_FOR_spe_evmergelohi, "__builtin_spe_evmergelohi", SPE_BUILTIN_EVMERGELOHI },
- { 0, CODE_FOR_spe_evmhegsmfaa, "__builtin_spe_evmhegsmfaa", SPE_BUILTIN_EVMHEGSMFAA },
- { 0, CODE_FOR_spe_evmhegsmfan, "__builtin_spe_evmhegsmfan", SPE_BUILTIN_EVMHEGSMFAN },
- { 0, CODE_FOR_spe_evmhegsmiaa, "__builtin_spe_evmhegsmiaa", SPE_BUILTIN_EVMHEGSMIAA },
- { 0, CODE_FOR_spe_evmhegsmian, "__builtin_spe_evmhegsmian", SPE_BUILTIN_EVMHEGSMIAN },
- { 0, CODE_FOR_spe_evmhegumiaa, "__builtin_spe_evmhegumiaa", SPE_BUILTIN_EVMHEGUMIAA },
- { 0, CODE_FOR_spe_evmhegumian, "__builtin_spe_evmhegumian", SPE_BUILTIN_EVMHEGUMIAN },
- { 0, CODE_FOR_spe_evmhesmf, "__builtin_spe_evmhesmf", SPE_BUILTIN_EVMHESMF },
- { 0, CODE_FOR_spe_evmhesmfa, "__builtin_spe_evmhesmfa", SPE_BUILTIN_EVMHESMFA },
- { 0, CODE_FOR_spe_evmhesmfaaw, "__builtin_spe_evmhesmfaaw", SPE_BUILTIN_EVMHESMFAAW },
- { 0, CODE_FOR_spe_evmhesmfanw, "__builtin_spe_evmhesmfanw", SPE_BUILTIN_EVMHESMFANW },
- { 0, CODE_FOR_spe_evmhesmi, "__builtin_spe_evmhesmi", SPE_BUILTIN_EVMHESMI },
- { 0, CODE_FOR_spe_evmhesmia, "__builtin_spe_evmhesmia", SPE_BUILTIN_EVMHESMIA },
- { 0, CODE_FOR_spe_evmhesmiaaw, "__builtin_spe_evmhesmiaaw", SPE_BUILTIN_EVMHESMIAAW },
- { 0, CODE_FOR_spe_evmhesmianw, "__builtin_spe_evmhesmianw", SPE_BUILTIN_EVMHESMIANW },
- { 0, CODE_FOR_spe_evmhessf, "__builtin_spe_evmhessf", SPE_BUILTIN_EVMHESSF },
- { 0, CODE_FOR_spe_evmhessfa, "__builtin_spe_evmhessfa", SPE_BUILTIN_EVMHESSFA },
- { 0, CODE_FOR_spe_evmhessfaaw, "__builtin_spe_evmhessfaaw", SPE_BUILTIN_EVMHESSFAAW },
- { 0, CODE_FOR_spe_evmhessfanw, "__builtin_spe_evmhessfanw", SPE_BUILTIN_EVMHESSFANW },
- { 0, CODE_FOR_spe_evmhessiaaw, "__builtin_spe_evmhessiaaw", SPE_BUILTIN_EVMHESSIAAW },
- { 0, CODE_FOR_spe_evmhessianw, "__builtin_spe_evmhessianw", SPE_BUILTIN_EVMHESSIANW },
- { 0, CODE_FOR_spe_evmheumi, "__builtin_spe_evmheumi", SPE_BUILTIN_EVMHEUMI },
- { 0, CODE_FOR_spe_evmheumia, "__builtin_spe_evmheumia", SPE_BUILTIN_EVMHEUMIA },
- { 0, CODE_FOR_spe_evmheumiaaw, "__builtin_spe_evmheumiaaw", SPE_BUILTIN_EVMHEUMIAAW },
- { 0, CODE_FOR_spe_evmheumianw, "__builtin_spe_evmheumianw", SPE_BUILTIN_EVMHEUMIANW },
- { 0, CODE_FOR_spe_evmheusiaaw, "__builtin_spe_evmheusiaaw", SPE_BUILTIN_EVMHEUSIAAW },
- { 0, CODE_FOR_spe_evmheusianw, "__builtin_spe_evmheusianw", SPE_BUILTIN_EVMHEUSIANW },
- { 0, CODE_FOR_spe_evmhogsmfaa, "__builtin_spe_evmhogsmfaa", SPE_BUILTIN_EVMHOGSMFAA },
- { 0, CODE_FOR_spe_evmhogsmfan, "__builtin_spe_evmhogsmfan", SPE_BUILTIN_EVMHOGSMFAN },
- { 0, CODE_FOR_spe_evmhogsmiaa, "__builtin_spe_evmhogsmiaa", SPE_BUILTIN_EVMHOGSMIAA },
- { 0, CODE_FOR_spe_evmhogsmian, "__builtin_spe_evmhogsmian", SPE_BUILTIN_EVMHOGSMIAN },
- { 0, CODE_FOR_spe_evmhogumiaa, "__builtin_spe_evmhogumiaa", SPE_BUILTIN_EVMHOGUMIAA },
- { 0, CODE_FOR_spe_evmhogumian, "__builtin_spe_evmhogumian", SPE_BUILTIN_EVMHOGUMIAN },
- { 0, CODE_FOR_spe_evmhosmf, "__builtin_spe_evmhosmf", SPE_BUILTIN_EVMHOSMF },
- { 0, CODE_FOR_spe_evmhosmfa, "__builtin_spe_evmhosmfa", SPE_BUILTIN_EVMHOSMFA },
- { 0, CODE_FOR_spe_evmhosmfaaw, "__builtin_spe_evmhosmfaaw", SPE_BUILTIN_EVMHOSMFAAW },
- { 0, CODE_FOR_spe_evmhosmfanw, "__builtin_spe_evmhosmfanw", SPE_BUILTIN_EVMHOSMFANW },
- { 0, CODE_FOR_spe_evmhosmi, "__builtin_spe_evmhosmi", SPE_BUILTIN_EVMHOSMI },
- { 0, CODE_FOR_spe_evmhosmia, "__builtin_spe_evmhosmia", SPE_BUILTIN_EVMHOSMIA },
- { 0, CODE_FOR_spe_evmhosmiaaw, "__builtin_spe_evmhosmiaaw", SPE_BUILTIN_EVMHOSMIAAW },
- { 0, CODE_FOR_spe_evmhosmianw, "__builtin_spe_evmhosmianw", SPE_BUILTIN_EVMHOSMIANW },
- { 0, CODE_FOR_spe_evmhossf, "__builtin_spe_evmhossf", SPE_BUILTIN_EVMHOSSF },
- { 0, CODE_FOR_spe_evmhossfa, "__builtin_spe_evmhossfa", SPE_BUILTIN_EVMHOSSFA },
- { 0, CODE_FOR_spe_evmhossfaaw, "__builtin_spe_evmhossfaaw", SPE_BUILTIN_EVMHOSSFAAW },
- { 0, CODE_FOR_spe_evmhossfanw, "__builtin_spe_evmhossfanw", SPE_BUILTIN_EVMHOSSFANW },
- { 0, CODE_FOR_spe_evmhossiaaw, "__builtin_spe_evmhossiaaw", SPE_BUILTIN_EVMHOSSIAAW },
- { 0, CODE_FOR_spe_evmhossianw, "__builtin_spe_evmhossianw", SPE_BUILTIN_EVMHOSSIANW },
- { 0, CODE_FOR_spe_evmhoumi, "__builtin_spe_evmhoumi", SPE_BUILTIN_EVMHOUMI },
- { 0, CODE_FOR_spe_evmhoumia, "__builtin_spe_evmhoumia", SPE_BUILTIN_EVMHOUMIA },
- { 0, CODE_FOR_spe_evmhoumiaaw, "__builtin_spe_evmhoumiaaw", SPE_BUILTIN_EVMHOUMIAAW },
- { 0, CODE_FOR_spe_evmhoumianw, "__builtin_spe_evmhoumianw", SPE_BUILTIN_EVMHOUMIANW },
- { 0, CODE_FOR_spe_evmhousiaaw, "__builtin_spe_evmhousiaaw", SPE_BUILTIN_EVMHOUSIAAW },
- { 0, CODE_FOR_spe_evmhousianw, "__builtin_spe_evmhousianw", SPE_BUILTIN_EVMHOUSIANW },
- { 0, CODE_FOR_spe_evmwhsmf, "__builtin_spe_evmwhsmf", SPE_BUILTIN_EVMWHSMF },
- { 0, CODE_FOR_spe_evmwhsmfa, "__builtin_spe_evmwhsmfa", SPE_BUILTIN_EVMWHSMFA },
- { 0, CODE_FOR_spe_evmwhsmi, "__builtin_spe_evmwhsmi", SPE_BUILTIN_EVMWHSMI },
- { 0, CODE_FOR_spe_evmwhsmia, "__builtin_spe_evmwhsmia", SPE_BUILTIN_EVMWHSMIA },
- { 0, CODE_FOR_spe_evmwhssf, "__builtin_spe_evmwhssf", SPE_BUILTIN_EVMWHSSF },
- { 0, CODE_FOR_spe_evmwhssfa, "__builtin_spe_evmwhssfa", SPE_BUILTIN_EVMWHSSFA },
- { 0, CODE_FOR_spe_evmwhumi, "__builtin_spe_evmwhumi", SPE_BUILTIN_EVMWHUMI },
- { 0, CODE_FOR_spe_evmwhumia, "__builtin_spe_evmwhumia", SPE_BUILTIN_EVMWHUMIA },
- { 0, CODE_FOR_spe_evmwlsmiaaw, "__builtin_spe_evmwlsmiaaw", SPE_BUILTIN_EVMWLSMIAAW },
- { 0, CODE_FOR_spe_evmwlsmianw, "__builtin_spe_evmwlsmianw", SPE_BUILTIN_EVMWLSMIANW },
- { 0, CODE_FOR_spe_evmwlssiaaw, "__builtin_spe_evmwlssiaaw", SPE_BUILTIN_EVMWLSSIAAW },
- { 0, CODE_FOR_spe_evmwlssianw, "__builtin_spe_evmwlssianw", SPE_BUILTIN_EVMWLSSIANW },
- { 0, CODE_FOR_spe_evmwlumi, "__builtin_spe_evmwlumi", SPE_BUILTIN_EVMWLUMI },
- { 0, CODE_FOR_spe_evmwlumia, "__builtin_spe_evmwlumia", SPE_BUILTIN_EVMWLUMIA },
- { 0, CODE_FOR_spe_evmwlumiaaw, "__builtin_spe_evmwlumiaaw", SPE_BUILTIN_EVMWLUMIAAW },
- { 0, CODE_FOR_spe_evmwlumianw, "__builtin_spe_evmwlumianw", SPE_BUILTIN_EVMWLUMIANW },
- { 0, CODE_FOR_spe_evmwlusiaaw, "__builtin_spe_evmwlusiaaw", SPE_BUILTIN_EVMWLUSIAAW },
- { 0, CODE_FOR_spe_evmwlusianw, "__builtin_spe_evmwlusianw", SPE_BUILTIN_EVMWLUSIANW },
- { 0, CODE_FOR_spe_evmwsmf, "__builtin_spe_evmwsmf", SPE_BUILTIN_EVMWSMF },
- { 0, CODE_FOR_spe_evmwsmfa, "__builtin_spe_evmwsmfa", SPE_BUILTIN_EVMWSMFA },
- { 0, CODE_FOR_spe_evmwsmfaa, "__builtin_spe_evmwsmfaa", SPE_BUILTIN_EVMWSMFAA },
- { 0, CODE_FOR_spe_evmwsmfan, "__builtin_spe_evmwsmfan", SPE_BUILTIN_EVMWSMFAN },
- { 0, CODE_FOR_spe_evmwsmi, "__builtin_spe_evmwsmi", SPE_BUILTIN_EVMWSMI },
- { 0, CODE_FOR_spe_evmwsmia, "__builtin_spe_evmwsmia", SPE_BUILTIN_EVMWSMIA },
- { 0, CODE_FOR_spe_evmwsmiaa, "__builtin_spe_evmwsmiaa", SPE_BUILTIN_EVMWSMIAA },
- { 0, CODE_FOR_spe_evmwsmian, "__builtin_spe_evmwsmian", SPE_BUILTIN_EVMWSMIAN },
- { 0, CODE_FOR_spe_evmwssf, "__builtin_spe_evmwssf", SPE_BUILTIN_EVMWSSF },
- { 0, CODE_FOR_spe_evmwssfa, "__builtin_spe_evmwssfa", SPE_BUILTIN_EVMWSSFA },
- { 0, CODE_FOR_spe_evmwssfaa, "__builtin_spe_evmwssfaa", SPE_BUILTIN_EVMWSSFAA },
- { 0, CODE_FOR_spe_evmwssfan, "__builtin_spe_evmwssfan", SPE_BUILTIN_EVMWSSFAN },
- { 0, CODE_FOR_spe_evmwumi, "__builtin_spe_evmwumi", SPE_BUILTIN_EVMWUMI },
- { 0, CODE_FOR_spe_evmwumia, "__builtin_spe_evmwumia", SPE_BUILTIN_EVMWUMIA },
- { 0, CODE_FOR_spe_evmwumiaa, "__builtin_spe_evmwumiaa", SPE_BUILTIN_EVMWUMIAA },
- { 0, CODE_FOR_spe_evmwumian, "__builtin_spe_evmwumian", SPE_BUILTIN_EVMWUMIAN },
- { 0, CODE_FOR_spe_evnand, "__builtin_spe_evnand", SPE_BUILTIN_EVNAND },
- { 0, CODE_FOR_spe_evnor, "__builtin_spe_evnor", SPE_BUILTIN_EVNOR },
- { 0, CODE_FOR_spe_evor, "__builtin_spe_evor", SPE_BUILTIN_EVOR },
- { 0, CODE_FOR_spe_evorc, "__builtin_spe_evorc", SPE_BUILTIN_EVORC },
- { 0, CODE_FOR_spe_evrlw, "__builtin_spe_evrlw", SPE_BUILTIN_EVRLW },
- { 0, CODE_FOR_spe_evslw, "__builtin_spe_evslw", SPE_BUILTIN_EVSLW },
- { 0, CODE_FOR_spe_evsrws, "__builtin_spe_evsrws", SPE_BUILTIN_EVSRWS },
- { 0, CODE_FOR_spe_evsrwu, "__builtin_spe_evsrwu", SPE_BUILTIN_EVSRWU },
- { 0, CODE_FOR_subv2si3, "__builtin_spe_evsubfw", SPE_BUILTIN_EVSUBFW },
-
- /* SPE binary operations expecting a 5-bit unsigned literal. */
- { 0, CODE_FOR_spe_evaddiw, "__builtin_spe_evaddiw", SPE_BUILTIN_EVADDIW },
-
- { 0, CODE_FOR_spe_evrlwi, "__builtin_spe_evrlwi", SPE_BUILTIN_EVRLWI },
- { 0, CODE_FOR_spe_evslwi, "__builtin_spe_evslwi", SPE_BUILTIN_EVSLWI },
- { 0, CODE_FOR_spe_evsrwis, "__builtin_spe_evsrwis", SPE_BUILTIN_EVSRWIS },
- { 0, CODE_FOR_spe_evsrwiu, "__builtin_spe_evsrwiu", SPE_BUILTIN_EVSRWIU },
- { 0, CODE_FOR_spe_evsubifw, "__builtin_spe_evsubifw", SPE_BUILTIN_EVSUBIFW },
- { 0, CODE_FOR_spe_evmwhssfaa, "__builtin_spe_evmwhssfaa", SPE_BUILTIN_EVMWHSSFAA },
- { 0, CODE_FOR_spe_evmwhssmaa, "__builtin_spe_evmwhssmaa", SPE_BUILTIN_EVMWHSSMAA },
- { 0, CODE_FOR_spe_evmwhsmfaa, "__builtin_spe_evmwhsmfaa", SPE_BUILTIN_EVMWHSMFAA },
- { 0, CODE_FOR_spe_evmwhsmiaa, "__builtin_spe_evmwhsmiaa", SPE_BUILTIN_EVMWHSMIAA },
- { 0, CODE_FOR_spe_evmwhusiaa, "__builtin_spe_evmwhusiaa", SPE_BUILTIN_EVMWHUSIAA },
- { 0, CODE_FOR_spe_evmwhumiaa, "__builtin_spe_evmwhumiaa", SPE_BUILTIN_EVMWHUMIAA },
- { 0, CODE_FOR_spe_evmwhssfan, "__builtin_spe_evmwhssfan", SPE_BUILTIN_EVMWHSSFAN },
- { 0, CODE_FOR_spe_evmwhssian, "__builtin_spe_evmwhssian", SPE_BUILTIN_EVMWHSSIAN },
- { 0, CODE_FOR_spe_evmwhsmfan, "__builtin_spe_evmwhsmfan", SPE_BUILTIN_EVMWHSMFAN },
- { 0, CODE_FOR_spe_evmwhsmian, "__builtin_spe_evmwhsmian", SPE_BUILTIN_EVMWHSMIAN },
- { 0, CODE_FOR_spe_evmwhusian, "__builtin_spe_evmwhusian", SPE_BUILTIN_EVMWHUSIAN },
- { 0, CODE_FOR_spe_evmwhumian, "__builtin_spe_evmwhumian", SPE_BUILTIN_EVMWHUMIAN },
- { 0, CODE_FOR_spe_evmwhgssfaa, "__builtin_spe_evmwhgssfaa", SPE_BUILTIN_EVMWHGSSFAA },
- { 0, CODE_FOR_spe_evmwhgsmfaa, "__builtin_spe_evmwhgsmfaa", SPE_BUILTIN_EVMWHGSMFAA },
- { 0, CODE_FOR_spe_evmwhgsmiaa, "__builtin_spe_evmwhgsmiaa", SPE_BUILTIN_EVMWHGSMIAA },
- { 0, CODE_FOR_spe_evmwhgumiaa, "__builtin_spe_evmwhgumiaa", SPE_BUILTIN_EVMWHGUMIAA },
- { 0, CODE_FOR_spe_evmwhgssfan, "__builtin_spe_evmwhgssfan", SPE_BUILTIN_EVMWHGSSFAN },
- { 0, CODE_FOR_spe_evmwhgsmfan, "__builtin_spe_evmwhgsmfan", SPE_BUILTIN_EVMWHGSMFAN },
- { 0, CODE_FOR_spe_evmwhgsmian, "__builtin_spe_evmwhgsmian", SPE_BUILTIN_EVMWHGSMIAN },
- { 0, CODE_FOR_spe_evmwhgumian, "__builtin_spe_evmwhgumian", SPE_BUILTIN_EVMWHGUMIAN },
- { 0, CODE_FOR_spe_brinc, "__builtin_spe_brinc", SPE_BUILTIN_BRINC },
-
- /* Place-holder. Leave as last binary SPE builtin. */
- { 0, CODE_FOR_xorv2si3, "__builtin_spe_evxor", SPE_BUILTIN_EVXOR }
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE) \
+ { MASK, ICODE, NAME, ENUM },
+
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+
+static const struct builtin_description bdesc_2arg[] =
+{
+#include "rs6000-builtin.def"
};
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) \
+ { MASK, ICODE, NAME, ENUM },
+
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+
/* AltiVec predicates. */
-struct builtin_description_predicates
+static const struct builtin_description bdesc_altivec_preds[] =
{
- const unsigned int mask;
- const enum insn_code icode;
- const char *const name;
- const enum rs6000_builtins code;
-};
-
-static const struct builtin_description_predicates bdesc_altivec_preds[] =
-{
- { MASK_ALTIVEC, CODE_FOR_altivec_vcmpbfp_p, "__builtin_altivec_vcmpbfp_p",
- ALTIVEC_BUILTIN_VCMPBFP_P },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_vector_eq_v4sf_p,
- "__builtin_altivec_vcmpeqfp_p", ALTIVEC_BUILTIN_VCMPEQFP_P },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_vector_ge_v4sf_p,
- "__builtin_altivec_vcmpgefp_p", ALTIVEC_BUILTIN_VCMPGEFP_P },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_vector_gt_v4sf_p,
- "__builtin_altivec_vcmpgtfp_p", ALTIVEC_BUILTIN_VCMPGTFP_P },
- { MASK_ALTIVEC, CODE_FOR_vector_eq_v4si_p, "__builtin_altivec_vcmpequw_p",
- ALTIVEC_BUILTIN_VCMPEQUW_P },
- { MASK_ALTIVEC, CODE_FOR_vector_gt_v4si_p, "__builtin_altivec_vcmpgtsw_p",
- ALTIVEC_BUILTIN_VCMPGTSW_P },
- { MASK_ALTIVEC, CODE_FOR_vector_gtu_v4si_p, "__builtin_altivec_vcmpgtuw_p",
- ALTIVEC_BUILTIN_VCMPGTUW_P },
- { MASK_ALTIVEC, CODE_FOR_vector_eq_v8hi_p, "__builtin_altivec_vcmpequh_p",
- ALTIVEC_BUILTIN_VCMPEQUH_P },
- { MASK_ALTIVEC, CODE_FOR_vector_gt_v8hi_p, "__builtin_altivec_vcmpgtsh_p",
- ALTIVEC_BUILTIN_VCMPGTSH_P },
- { MASK_ALTIVEC, CODE_FOR_vector_gtu_v8hi_p, "__builtin_altivec_vcmpgtuh_p",
- ALTIVEC_BUILTIN_VCMPGTUH_P },
- { MASK_ALTIVEC, CODE_FOR_vector_eq_v16qi_p, "__builtin_altivec_vcmpequb_p",
- ALTIVEC_BUILTIN_VCMPEQUB_P },
- { MASK_ALTIVEC, CODE_FOR_vector_gt_v16qi_p, "__builtin_altivec_vcmpgtsb_p",
- ALTIVEC_BUILTIN_VCMPGTSB_P },
- { MASK_ALTIVEC, CODE_FOR_vector_gtu_v16qi_p, "__builtin_altivec_vcmpgtub_p",
- ALTIVEC_BUILTIN_VCMPGTUB_P },
-
- { MASK_VSX, CODE_FOR_vector_eq_v4sf_p, "__builtin_vsx_xvcmpeqsp_p",
- VSX_BUILTIN_XVCMPEQSP_P },
- { MASK_VSX, CODE_FOR_vector_ge_v4sf_p, "__builtin_vsx_xvcmpgesp_p",
- VSX_BUILTIN_XVCMPGESP_P },
- { MASK_VSX, CODE_FOR_vector_gt_v4sf_p, "__builtin_vsx_xvcmpgtsp_p",
- VSX_BUILTIN_XVCMPGTSP_P },
- { MASK_VSX, CODE_FOR_vector_eq_v2df_p, "__builtin_vsx_xvcmpeqdp_p",
- VSX_BUILTIN_XVCMPEQDP_P },
- { MASK_VSX, CODE_FOR_vector_ge_v2df_p, "__builtin_vsx_xvcmpgedp_p",
- VSX_BUILTIN_XVCMPGEDP_P },
- { MASK_VSX, CODE_FOR_vector_gt_v2df_p, "__builtin_vsx_xvcmpgtdp_p",
- VSX_BUILTIN_XVCMPGTDP_P },
-
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vcmpeq_p",
- ALTIVEC_BUILTIN_VCMPEQ_P },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vcmpgt_p",
- ALTIVEC_BUILTIN_VCMPGT_P },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vcmpge_p",
- ALTIVEC_BUILTIN_VCMPGE_P }
+#include "rs6000-builtin.def"
};
/* SPE predicates. */
-static struct builtin_description bdesc_spe_predicates[] =
-{
- /* Place-holder. Leave as first. */
- { 0, CODE_FOR_spe_evcmpeq, "__builtin_spe_evcmpeq", SPE_BUILTIN_EVCMPEQ },
- { 0, CODE_FOR_spe_evcmpgts, "__builtin_spe_evcmpgts", SPE_BUILTIN_EVCMPGTS },
- { 0, CODE_FOR_spe_evcmpgtu, "__builtin_spe_evcmpgtu", SPE_BUILTIN_EVCMPGTU },
- { 0, CODE_FOR_spe_evcmplts, "__builtin_spe_evcmplts", SPE_BUILTIN_EVCMPLTS },
- { 0, CODE_FOR_spe_evcmpltu, "__builtin_spe_evcmpltu", SPE_BUILTIN_EVCMPLTU },
- { 0, CODE_FOR_spe_evfscmpeq, "__builtin_spe_evfscmpeq", SPE_BUILTIN_EVFSCMPEQ },
- { 0, CODE_FOR_spe_evfscmpgt, "__builtin_spe_evfscmpgt", SPE_BUILTIN_EVFSCMPGT },
- { 0, CODE_FOR_spe_evfscmplt, "__builtin_spe_evfscmplt", SPE_BUILTIN_EVFSCMPLT },
- { 0, CODE_FOR_spe_evfststeq, "__builtin_spe_evfststeq", SPE_BUILTIN_EVFSTSTEQ },
- { 0, CODE_FOR_spe_evfststgt, "__builtin_spe_evfststgt", SPE_BUILTIN_EVFSTSTGT },
- /* Place-holder. Leave as last. */
- { 0, CODE_FOR_spe_evfststlt, "__builtin_spe_evfststlt", SPE_BUILTIN_EVFSTSTLT },
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) \
+ { MASK, ICODE, NAME, ENUM },
+
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+
+static const struct builtin_description bdesc_spe_predicates[] =
+{
+#include "rs6000-builtin.def"
};
/* SPE evsel predicates. */
-static struct builtin_description bdesc_spe_evsel[] =
-{
- /* Place-holder. Leave as first. */
- { 0, CODE_FOR_spe_evcmpgts, "__builtin_spe_evsel_gts", SPE_BUILTIN_EVSEL_CMPGTS },
- { 0, CODE_FOR_spe_evcmpgtu, "__builtin_spe_evsel_gtu", SPE_BUILTIN_EVSEL_CMPGTU },
- { 0, CODE_FOR_spe_evcmplts, "__builtin_spe_evsel_lts", SPE_BUILTIN_EVSEL_CMPLTS },
- { 0, CODE_FOR_spe_evcmpltu, "__builtin_spe_evsel_ltu", SPE_BUILTIN_EVSEL_CMPLTU },
- { 0, CODE_FOR_spe_evcmpeq, "__builtin_spe_evsel_eq", SPE_BUILTIN_EVSEL_CMPEQ },
- { 0, CODE_FOR_spe_evfscmpgt, "__builtin_spe_evsel_fsgt", SPE_BUILTIN_EVSEL_FSCMPGT },
- { 0, CODE_FOR_spe_evfscmplt, "__builtin_spe_evsel_fslt", SPE_BUILTIN_EVSEL_FSCMPLT },
- { 0, CODE_FOR_spe_evfscmpeq, "__builtin_spe_evsel_fseq", SPE_BUILTIN_EVSEL_FSCMPEQ },
- { 0, CODE_FOR_spe_evfststgt, "__builtin_spe_evsel_fststgt", SPE_BUILTIN_EVSEL_FSTSTGT },
- { 0, CODE_FOR_spe_evfststlt, "__builtin_spe_evsel_fststlt", SPE_BUILTIN_EVSEL_FSTSTLT },
- /* Place-holder. Leave as last. */
- { 0, CODE_FOR_spe_evfststeq, "__builtin_spe_evsel_fststeq", SPE_BUILTIN_EVSEL_FSTSTEQ },
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) \
+ { MASK, ICODE, NAME, ENUM },
+
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+
+static const struct builtin_description bdesc_spe_evsel[] =
+{
+#include "rs6000-builtin.def"
};
/* PAIRED predicates. */
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) \
+ { MASK, ICODE, NAME, ENUM },
+
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+
static const struct builtin_description bdesc_paired_preds[] =
{
- /* Place-holder. Leave as first. */
- { 0, CODE_FOR_paired_cmpu0, "__builtin_paired_cmpu0", PAIRED_BUILTIN_CMPU0 },
- /* Place-holder. Leave as last. */
- { 0, CODE_FOR_paired_cmpu1, "__builtin_paired_cmpu1", PAIRED_BUILTIN_CMPU1 },
+#include "rs6000-builtin.def"
};
/* ABS* operations. */
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) \
+ { MASK, ICODE, NAME, ENUM },
+
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+
static const struct builtin_description bdesc_abs[] =
{
- { MASK_ALTIVEC, CODE_FOR_absv4si2, "__builtin_altivec_abs_v4si", ALTIVEC_BUILTIN_ABS_V4SI },
- { MASK_ALTIVEC, CODE_FOR_absv8hi2, "__builtin_altivec_abs_v8hi", ALTIVEC_BUILTIN_ABS_V8HI },
- { MASK_ALTIVEC, CODE_FOR_absv4sf2, "__builtin_altivec_abs_v4sf", ALTIVEC_BUILTIN_ABS_V4SF },
- { MASK_ALTIVEC, CODE_FOR_absv16qi2, "__builtin_altivec_abs_v16qi", ALTIVEC_BUILTIN_ABS_V16QI },
- { MASK_ALTIVEC, CODE_FOR_altivec_abss_v4si, "__builtin_altivec_abss_v4si", ALTIVEC_BUILTIN_ABSS_V4SI },
- { MASK_ALTIVEC, CODE_FOR_altivec_abss_v8hi, "__builtin_altivec_abss_v8hi", ALTIVEC_BUILTIN_ABSS_V8HI },
- { MASK_ALTIVEC, CODE_FOR_altivec_abss_v16qi, "__builtin_altivec_abss_v16qi", ALTIVEC_BUILTIN_ABSS_V16QI },
- { MASK_VSX, CODE_FOR_absv2df2, "__builtin_vsx_xvabsdp", VSX_BUILTIN_XVABSDP },
- { MASK_VSX, CODE_FOR_vsx_nabsv2df2, "__builtin_vsx_xvnabsdp", VSX_BUILTIN_XVNABSDP },
- { MASK_VSX, CODE_FOR_absv4sf2, "__builtin_vsx_xvabssp", VSX_BUILTIN_XVABSSP },
- { MASK_VSX, CODE_FOR_vsx_nabsv4sf2, "__builtin_vsx_xvnabssp", VSX_BUILTIN_XVNABSSP },
+#include "rs6000-builtin.def"
};
/* Simple unary operations: VECb = foo (unsigned literal) or VECb =
foo (VECa). */
-static struct builtin_description bdesc_1arg[] =
-{
- { MASK_ALTIVEC, CODE_FOR_altivec_vexptefp, "__builtin_altivec_vexptefp", ALTIVEC_BUILTIN_VEXPTEFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vlogefp, "__builtin_altivec_vlogefp", ALTIVEC_BUILTIN_VLOGEFP },
- { MASK_ALTIVEC, CODE_FOR_rev4sf2, "__builtin_altivec_vrefp", ALTIVEC_BUILTIN_VREFP },
- { MASK_ALTIVEC, CODE_FOR_vector_floorv4sf2, "__builtin_altivec_vrfim", ALTIVEC_BUILTIN_VRFIM },
- { MASK_ALTIVEC, CODE_FOR_altivec_vrfin, "__builtin_altivec_vrfin", ALTIVEC_BUILTIN_VRFIN },
- { MASK_ALTIVEC, CODE_FOR_vector_ceilv4sf2, "__builtin_altivec_vrfip", ALTIVEC_BUILTIN_VRFIP },
- { MASK_ALTIVEC, CODE_FOR_vector_btruncv4sf2, "__builtin_altivec_vrfiz", ALTIVEC_BUILTIN_VRFIZ },
- { MASK_ALTIVEC, CODE_FOR_rsqrtv4sf2, "__builtin_altivec_vrsqrtfp", ALTIVEC_BUILTIN_VRSQRTFP },
- { MASK_ALTIVEC, CODE_FOR_rsqrtev4sf2, "__builtin_altivec_vrsqrtefp", ALTIVEC_BUILTIN_VRSQRTEFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vspltisb, "__builtin_altivec_vspltisb", ALTIVEC_BUILTIN_VSPLTISB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vspltish, "__builtin_altivec_vspltish", ALTIVEC_BUILTIN_VSPLTISH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vspltisw, "__builtin_altivec_vspltisw", ALTIVEC_BUILTIN_VSPLTISW },
- { MASK_ALTIVEC, CODE_FOR_altivec_vupkhsb, "__builtin_altivec_vupkhsb", ALTIVEC_BUILTIN_VUPKHSB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vupkhpx, "__builtin_altivec_vupkhpx", ALTIVEC_BUILTIN_VUPKHPX },
- { MASK_ALTIVEC, CODE_FOR_altivec_vupkhsh, "__builtin_altivec_vupkhsh", ALTIVEC_BUILTIN_VUPKHSH },
- { MASK_ALTIVEC, CODE_FOR_altivec_vupklsb, "__builtin_altivec_vupklsb", ALTIVEC_BUILTIN_VUPKLSB },
- { MASK_ALTIVEC, CODE_FOR_altivec_vupklpx, "__builtin_altivec_vupklpx", ALTIVEC_BUILTIN_VUPKLPX },
- { MASK_ALTIVEC, CODE_FOR_altivec_vupklsh, "__builtin_altivec_vupklsh", ALTIVEC_BUILTIN_VUPKLSH },
-
- { MASK_VSX, CODE_FOR_negv2df2, "__builtin_vsx_xvnegdp", VSX_BUILTIN_XVNEGDP },
- { MASK_VSX, CODE_FOR_sqrtv2df2, "__builtin_vsx_xvsqrtdp", VSX_BUILTIN_XVSQRTDP },
- { MASK_VSX, CODE_FOR_rsqrtv2df2, "__builtin_vsx_xvrsqrtdp", VSX_BUILTIN_VEC_RSQRT_V2DF },
- { MASK_VSX, CODE_FOR_rsqrtev2df2, "__builtin_vsx_xvrsqrtedp", VSX_BUILTIN_XVRSQRTEDP },
- { MASK_VSX, CODE_FOR_vsx_tsqrtv2df2_fe, "__builtin_vsx_xvtsqrtdp_fe", VSX_BUILTIN_XVTSQRTDP_FE },
- { MASK_VSX, CODE_FOR_vsx_tsqrtv2df2_fg, "__builtin_vsx_xvtsqrtdp_fg", VSX_BUILTIN_XVTSQRTDP_FG },
- { MASK_VSX, CODE_FOR_vsx_frev2df2, "__builtin_vsx_xvredp", VSX_BUILTIN_XVREDP },
-
- { MASK_VSX, CODE_FOR_negv4sf2, "__builtin_vsx_xvnegsp", VSX_BUILTIN_XVNEGSP },
- { MASK_VSX, CODE_FOR_sqrtv4sf2, "__builtin_vsx_xvsqrtsp", VSX_BUILTIN_XVSQRTSP },
- { MASK_VSX, CODE_FOR_rsqrtv4sf2, "__builtin_vsx_xvrsqrtsp", VSX_BUILTIN_VEC_RSQRT_V4SF },
- { MASK_VSX, CODE_FOR_rsqrtev4sf2, "__builtin_vsx_xvrsqrtesp", VSX_BUILTIN_XVRSQRTESP },
- { MASK_VSX, CODE_FOR_vsx_tsqrtv4sf2_fe, "__builtin_vsx_xvtsqrtsp_fe", VSX_BUILTIN_XVTSQRTSP_FE },
- { MASK_VSX, CODE_FOR_vsx_tsqrtv4sf2_fg, "__builtin_vsx_xvtsqrtsp_fg", VSX_BUILTIN_XVTSQRTSP_FG },
- { MASK_VSX, CODE_FOR_vsx_frev4sf2, "__builtin_vsx_xvresp", VSX_BUILTIN_XVRESP },
-
- { MASK_VSX, CODE_FOR_vsx_xscvdpsp, "__builtin_vsx_xscvdpsp", VSX_BUILTIN_XSCVDPSP },
- { MASK_VSX, CODE_FOR_vsx_xscvdpsp, "__builtin_vsx_xscvspdp", VSX_BUILTIN_XSCVSPDP },
- { MASK_VSX, CODE_FOR_vsx_xvcvdpsp, "__builtin_vsx_xvcvdpsp", VSX_BUILTIN_XVCVDPSP },
- { MASK_VSX, CODE_FOR_vsx_xvcvspdp, "__builtin_vsx_xvcvspdp", VSX_BUILTIN_XVCVSPDP },
- { MASK_VSX, CODE_FOR_vsx_tsqrtdf2_fe, "__builtin_vsx_xstsqrtdp_fe", VSX_BUILTIN_XSTSQRTDP_FE },
- { MASK_VSX, CODE_FOR_vsx_tsqrtdf2_fg, "__builtin_vsx_xstsqrtdp_fg", VSX_BUILTIN_XSTSQRTDP_FG },
-
- { MASK_VSX, CODE_FOR_vsx_fix_truncv2dfv2di2, "__builtin_vsx_xvcvdpsxds", VSX_BUILTIN_XVCVDPSXDS },
- { MASK_VSX, CODE_FOR_vsx_fixuns_truncv2dfv2di2, "__builtin_vsx_xvcvdpuxds", VSX_BUILTIN_XVCVDPUXDS },
- { MASK_VSX, CODE_FOR_vsx_fixuns_truncv2dfv2di2, "__builtin_vsx_xvcvdpuxds_uns", VSX_BUILTIN_XVCVDPUXDS_UNS },
- { MASK_VSX, CODE_FOR_vsx_floatv2div2df2, "__builtin_vsx_xvcvsxddp", VSX_BUILTIN_XVCVSXDDP },
- { MASK_VSX, CODE_FOR_vsx_floatunsv2div2df2, "__builtin_vsx_xvcvuxddp", VSX_BUILTIN_XVCVUXDDP },
- { MASK_VSX, CODE_FOR_vsx_floatunsv2div2df2, "__builtin_vsx_xvcvuxddp_uns", VSX_BUILTIN_XVCVUXDDP_UNS },
-
- { MASK_VSX, CODE_FOR_vsx_fix_truncv4sfv4si2, "__builtin_vsx_xvcvspsxws", VSX_BUILTIN_XVCVSPSXWS },
- { MASK_VSX, CODE_FOR_vsx_fixuns_truncv4sfv4si2, "__builtin_vsx_xvcvspuxws", VSX_BUILTIN_XVCVSPUXWS },
- { MASK_VSX, CODE_FOR_vsx_floatv4siv4sf2, "__builtin_vsx_xvcvsxwsp", VSX_BUILTIN_XVCVSXWSP },
- { MASK_VSX, CODE_FOR_vsx_floatunsv4siv4sf2, "__builtin_vsx_xvcvuxwsp", VSX_BUILTIN_XVCVUXWSP },
-
- { MASK_VSX, CODE_FOR_vsx_xvcvdpsxws, "__builtin_vsx_xvcvdpsxws", VSX_BUILTIN_XVCVDPSXWS },
- { MASK_VSX, CODE_FOR_vsx_xvcvdpuxws, "__builtin_vsx_xvcvdpuxws", VSX_BUILTIN_XVCVDPUXWS },
- { MASK_VSX, CODE_FOR_vsx_xvcvsxwdp, "__builtin_vsx_xvcvsxwdp", VSX_BUILTIN_XVCVSXWDP },
- { MASK_VSX, CODE_FOR_vsx_xvcvuxwdp, "__builtin_vsx_xvcvuxwdp", VSX_BUILTIN_XVCVUXWDP },
- { MASK_VSX, CODE_FOR_vsx_xvrdpi, "__builtin_vsx_xvrdpi", VSX_BUILTIN_XVRDPI },
- { MASK_VSX, CODE_FOR_vsx_xvrdpic, "__builtin_vsx_xvrdpic", VSX_BUILTIN_XVRDPIC },
- { MASK_VSX, CODE_FOR_vsx_floorv2df2, "__builtin_vsx_xvrdpim", VSX_BUILTIN_XVRDPIM },
- { MASK_VSX, CODE_FOR_vsx_ceilv2df2, "__builtin_vsx_xvrdpip", VSX_BUILTIN_XVRDPIP },
- { MASK_VSX, CODE_FOR_vsx_btruncv2df2, "__builtin_vsx_xvrdpiz", VSX_BUILTIN_XVRDPIZ },
-
- { MASK_VSX, CODE_FOR_vsx_xvcvspsxds, "__builtin_vsx_xvcvspsxds", VSX_BUILTIN_XVCVSPSXDS },
- { MASK_VSX, CODE_FOR_vsx_xvcvspuxds, "__builtin_vsx_xvcvspuxds", VSX_BUILTIN_XVCVSPUXDS },
- { MASK_VSX, CODE_FOR_vsx_xvcvsxdsp, "__builtin_vsx_xvcvsxdsp", VSX_BUILTIN_XVCVSXDSP },
- { MASK_VSX, CODE_FOR_vsx_xvcvuxdsp, "__builtin_vsx_xvcvuxdsp", VSX_BUILTIN_XVCVUXDSP },
- { MASK_VSX, CODE_FOR_vsx_xvrspi, "__builtin_vsx_xvrspi", VSX_BUILTIN_XVRSPI },
- { MASK_VSX, CODE_FOR_vsx_xvrspic, "__builtin_vsx_xvrspic", VSX_BUILTIN_XVRSPIC },
- { MASK_VSX, CODE_FOR_vsx_floorv4sf2, "__builtin_vsx_xvrspim", VSX_BUILTIN_XVRSPIM },
- { MASK_VSX, CODE_FOR_vsx_ceilv4sf2, "__builtin_vsx_xvrspip", VSX_BUILTIN_XVRSPIP },
- { MASK_VSX, CODE_FOR_vsx_btruncv4sf2, "__builtin_vsx_xvrspiz", VSX_BUILTIN_XVRSPIZ },
-
- { MASK_VSX, CODE_FOR_vsx_xsrdpi, "__builtin_vsx_xsrdpi", VSX_BUILTIN_XSRDPI },
- { MASK_VSX, CODE_FOR_vsx_xsrdpic, "__builtin_vsx_xsrdpic", VSX_BUILTIN_XSRDPIC },
- { MASK_VSX, CODE_FOR_vsx_floordf2, "__builtin_vsx_xsrdpim", VSX_BUILTIN_XSRDPIM },
- { MASK_VSX, CODE_FOR_vsx_ceildf2, "__builtin_vsx_xsrdpip", VSX_BUILTIN_XSRDPIP },
- { MASK_VSX, CODE_FOR_vsx_btruncdf2, "__builtin_vsx_xsrdpiz", VSX_BUILTIN_XSRDPIZ },
-
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_abs", ALTIVEC_BUILTIN_VEC_ABS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_abss", ALTIVEC_BUILTIN_VEC_ABSS },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_ceil", ALTIVEC_BUILTIN_VEC_CEIL },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_expte", ALTIVEC_BUILTIN_VEC_EXPTE },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_floor", ALTIVEC_BUILTIN_VEC_FLOOR },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_loge", ALTIVEC_BUILTIN_VEC_LOGE },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_mtvscr", ALTIVEC_BUILTIN_VEC_MTVSCR },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_re", ALTIVEC_BUILTIN_VEC_RE },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_round", ALTIVEC_BUILTIN_VEC_ROUND },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_rsqrt", ALTIVEC_BUILTIN_VEC_RSQRT },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_rsqrte", ALTIVEC_BUILTIN_VEC_RSQRTE },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_trunc", ALTIVEC_BUILTIN_VEC_TRUNC },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_unpackh", ALTIVEC_BUILTIN_VEC_UNPACKH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vupkhsh", ALTIVEC_BUILTIN_VEC_VUPKHSH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vupkhpx", ALTIVEC_BUILTIN_VEC_VUPKHPX },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vupkhsb", ALTIVEC_BUILTIN_VEC_VUPKHSB },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_unpackl", ALTIVEC_BUILTIN_VEC_UNPACKL },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vupklpx", ALTIVEC_BUILTIN_VEC_VUPKLPX },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vupklsh", ALTIVEC_BUILTIN_VEC_VUPKLSH },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vupklsb", ALTIVEC_BUILTIN_VEC_VUPKLSB },
-
- { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_nearbyint", ALTIVEC_BUILTIN_VEC_NEARBYINT },
- { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_rint", ALTIVEC_BUILTIN_VEC_RINT },
- { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_sqrt", ALTIVEC_BUILTIN_VEC_SQRT },
-
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_floatv4siv4sf2, "__builtin_vec_float_sisf", VECTOR_BUILTIN_FLOAT_V4SI_V4SF },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_unsigned_floatv4siv4sf2, "__builtin_vec_uns_float_sisf", VECTOR_BUILTIN_UNSFLOAT_V4SI_V4SF },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_fix_truncv4sfv4si2, "__builtin_vec_fix_sfsi", VECTOR_BUILTIN_FIX_V4SF_V4SI },
- { MASK_ALTIVEC|MASK_VSX, CODE_FOR_fixuns_truncv4sfv4si2, "__builtin_vec_fixuns_sfsi", VECTOR_BUILTIN_FIXUNS_V4SF_V4SI },
-
- /* The SPE unary builtins must start with SPE_BUILTIN_EVABS and
- end with SPE_BUILTIN_EVSUBFUSIAAW. */
- { 0, CODE_FOR_absv2si2, "__builtin_spe_evabs", SPE_BUILTIN_EVABS },
- { 0, CODE_FOR_spe_evaddsmiaaw, "__builtin_spe_evaddsmiaaw", SPE_BUILTIN_EVADDSMIAAW },
- { 0, CODE_FOR_spe_evaddssiaaw, "__builtin_spe_evaddssiaaw", SPE_BUILTIN_EVADDSSIAAW },
- { 0, CODE_FOR_spe_evaddumiaaw, "__builtin_spe_evaddumiaaw", SPE_BUILTIN_EVADDUMIAAW },
- { 0, CODE_FOR_spe_evaddusiaaw, "__builtin_spe_evaddusiaaw", SPE_BUILTIN_EVADDUSIAAW },
- { 0, CODE_FOR_spe_evcntlsw, "__builtin_spe_evcntlsw", SPE_BUILTIN_EVCNTLSW },
- { 0, CODE_FOR_spe_evcntlzw, "__builtin_spe_evcntlzw", SPE_BUILTIN_EVCNTLZW },
- { 0, CODE_FOR_spe_evextsb, "__builtin_spe_evextsb", SPE_BUILTIN_EVEXTSB },
- { 0, CODE_FOR_spe_evextsh, "__builtin_spe_evextsh", SPE_BUILTIN_EVEXTSH },
- { 0, CODE_FOR_spe_evfsabs, "__builtin_spe_evfsabs", SPE_BUILTIN_EVFSABS },
- { 0, CODE_FOR_spe_evfscfsf, "__builtin_spe_evfscfsf", SPE_BUILTIN_EVFSCFSF },
- { 0, CODE_FOR_spe_evfscfsi, "__builtin_spe_evfscfsi", SPE_BUILTIN_EVFSCFSI },
- { 0, CODE_FOR_spe_evfscfuf, "__builtin_spe_evfscfuf", SPE_BUILTIN_EVFSCFUF },
- { 0, CODE_FOR_spe_evfscfui, "__builtin_spe_evfscfui", SPE_BUILTIN_EVFSCFUI },
- { 0, CODE_FOR_spe_evfsctsf, "__builtin_spe_evfsctsf", SPE_BUILTIN_EVFSCTSF },
- { 0, CODE_FOR_spe_evfsctsi, "__builtin_spe_evfsctsi", SPE_BUILTIN_EVFSCTSI },
- { 0, CODE_FOR_spe_evfsctsiz, "__builtin_spe_evfsctsiz", SPE_BUILTIN_EVFSCTSIZ },
- { 0, CODE_FOR_spe_evfsctuf, "__builtin_spe_evfsctuf", SPE_BUILTIN_EVFSCTUF },
- { 0, CODE_FOR_spe_evfsctui, "__builtin_spe_evfsctui", SPE_BUILTIN_EVFSCTUI },
- { 0, CODE_FOR_spe_evfsctuiz, "__builtin_spe_evfsctuiz", SPE_BUILTIN_EVFSCTUIZ },
- { 0, CODE_FOR_spe_evfsnabs, "__builtin_spe_evfsnabs", SPE_BUILTIN_EVFSNABS },
- { 0, CODE_FOR_spe_evfsneg, "__builtin_spe_evfsneg", SPE_BUILTIN_EVFSNEG },
- { 0, CODE_FOR_spe_evmra, "__builtin_spe_evmra", SPE_BUILTIN_EVMRA },
- { 0, CODE_FOR_negv2si2, "__builtin_spe_evneg", SPE_BUILTIN_EVNEG },
- { 0, CODE_FOR_spe_evrndw, "__builtin_spe_evrndw", SPE_BUILTIN_EVRNDW },
- { 0, CODE_FOR_spe_evsubfsmiaaw, "__builtin_spe_evsubfsmiaaw", SPE_BUILTIN_EVSUBFSMIAAW },
- { 0, CODE_FOR_spe_evsubfssiaaw, "__builtin_spe_evsubfssiaaw", SPE_BUILTIN_EVSUBFSSIAAW },
- { 0, CODE_FOR_spe_evsubfumiaaw, "__builtin_spe_evsubfumiaaw", SPE_BUILTIN_EVSUBFUMIAAW },
-
- /* Place-holder. Leave as last unary SPE builtin. */
- { 0, CODE_FOR_spe_evsubfusiaaw, "__builtin_spe_evsubfusiaaw", SPE_BUILTIN_EVSUBFUSIAAW },
-
- { 0, CODE_FOR_paired_absv2sf2, "__builtin_paired_absv2sf2", PAIRED_BUILTIN_ABSV2SF2 },
- { 0, CODE_FOR_nabsv2sf2, "__builtin_paired_nabsv2sf2", PAIRED_BUILTIN_NABSV2SF2 },
- { 0, CODE_FOR_paired_negv2sf2, "__builtin_paired_negv2sf2", PAIRED_BUILTIN_NEGV2SF2 },
- { 0, CODE_FOR_sqrtv2sf2, "__builtin_paired_sqrtv2sf2", PAIRED_BUILTIN_SQRTV2SF2 },
- { 0, CODE_FOR_resv2sf2, "__builtin_paired_resv2sf2", PAIRED_BUILTIN_RESV2SF2 }
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE) \
+ { MASK, ICODE, NAME, ENUM },
+
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+
+static const struct builtin_description bdesc_1arg[] =
+{
+#include "rs6000-builtin.def"
};
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+/* Return true if a builtin function is overloaded. */
+bool
+rs6000_overloaded_builtin_p (enum rs6000_builtins fncode)
+{
+ return (rs6000_builtin_info[(int)fncode].attr & RS6000_BTC_OVERLOADED) != 0;
+}
+
+
static rtx
rs6000_expand_unop_builtin (enum insn_code icode, tree exp, rtx target)
{
@@ -11104,19 +10567,16 @@ static rtx
altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
{
const struct builtin_description *d;
- const struct builtin_description_predicates *dp;
size_t i;
enum insn_code icode;
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
tree arg0;
rtx op0, pat;
enum machine_mode tmode, mode0;
- unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
+ enum rs6000_builtins fcode
+ = (enum rs6000_builtins) DECL_FUNCTION_CODE (fndecl);
- if ((fcode >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && fcode <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
- || (fcode >= VSX_BUILTIN_OVERLOADED_FIRST
- && fcode <= VSX_BUILTIN_OVERLOADED_LAST))
+ if (rs6000_overloaded_builtin_p (fcode))
{
*expandedp = true;
error ("unresolved overload for Altivec builtin %qF", fndecl);
@@ -11269,10 +10729,10 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
return altivec_expand_abs_builtin (d->icode, exp, target);
/* Expand the AltiVec predicates. */
- dp = bdesc_altivec_preds;
- for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, dp++)
- if (dp->code == fcode)
- return altivec_expand_predicate_builtin (dp->icode, exp, target);
+ d = bdesc_altivec_preds;
+ for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, d++)
+ if (d->code == fcode)
+ return altivec_expand_predicate_builtin (d->icode, exp, target);
/* LV* are funky. We initialized them differently. */
switch (fcode)
@@ -11373,30 +10833,30 @@ paired_expand_builtin (tree exp, rtx target, bool * expandedp)
/* Binops that need to be initialized manually, but can be expanded
automagically by rs6000_expand_binop_builtin. */
-static struct builtin_description bdesc_2arg_spe[] =
-{
- { 0, CODE_FOR_spe_evlddx, "__builtin_spe_evlddx", SPE_BUILTIN_EVLDDX },
- { 0, CODE_FOR_spe_evldwx, "__builtin_spe_evldwx", SPE_BUILTIN_EVLDWX },
- { 0, CODE_FOR_spe_evldhx, "__builtin_spe_evldhx", SPE_BUILTIN_EVLDHX },
- { 0, CODE_FOR_spe_evlwhex, "__builtin_spe_evlwhex", SPE_BUILTIN_EVLWHEX },
- { 0, CODE_FOR_spe_evlwhoux, "__builtin_spe_evlwhoux", SPE_BUILTIN_EVLWHOUX },
- { 0, CODE_FOR_spe_evlwhosx, "__builtin_spe_evlwhosx", SPE_BUILTIN_EVLWHOSX },
- { 0, CODE_FOR_spe_evlwwsplatx, "__builtin_spe_evlwwsplatx", SPE_BUILTIN_EVLWWSPLATX },
- { 0, CODE_FOR_spe_evlwhsplatx, "__builtin_spe_evlwhsplatx", SPE_BUILTIN_EVLWHSPLATX },
- { 0, CODE_FOR_spe_evlhhesplatx, "__builtin_spe_evlhhesplatx", SPE_BUILTIN_EVLHHESPLATX },
- { 0, CODE_FOR_spe_evlhhousplatx, "__builtin_spe_evlhhousplatx", SPE_BUILTIN_EVLHHOUSPLATX },
- { 0, CODE_FOR_spe_evlhhossplatx, "__builtin_spe_evlhhossplatx", SPE_BUILTIN_EVLHHOSSPLATX },
- { 0, CODE_FOR_spe_evldd, "__builtin_spe_evldd", SPE_BUILTIN_EVLDD },
- { 0, CODE_FOR_spe_evldw, "__builtin_spe_evldw", SPE_BUILTIN_EVLDW },
- { 0, CODE_FOR_spe_evldh, "__builtin_spe_evldh", SPE_BUILTIN_EVLDH },
- { 0, CODE_FOR_spe_evlwhe, "__builtin_spe_evlwhe", SPE_BUILTIN_EVLWHE },
- { 0, CODE_FOR_spe_evlwhou, "__builtin_spe_evlwhou", SPE_BUILTIN_EVLWHOU },
- { 0, CODE_FOR_spe_evlwhos, "__builtin_spe_evlwhos", SPE_BUILTIN_EVLWHOS },
- { 0, CODE_FOR_spe_evlwwsplat, "__builtin_spe_evlwwsplat", SPE_BUILTIN_EVLWWSPLAT },
- { 0, CODE_FOR_spe_evlwhsplat, "__builtin_spe_evlwhsplat", SPE_BUILTIN_EVLWHSPLAT },
- { 0, CODE_FOR_spe_evlhhesplat, "__builtin_spe_evlhhesplat", SPE_BUILTIN_EVLHHESPLAT },
- { 0, CODE_FOR_spe_evlhhousplat, "__builtin_spe_evlhhousplat", SPE_BUILTIN_EVLHHOUSPLAT },
- { 0, CODE_FOR_spe_evlhhossplat, "__builtin_spe_evlhhossplat", SPE_BUILTIN_EVLHHOSSPLAT }
+static const struct builtin_description bdesc_2arg_spe[] =
+{
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlddx, "__builtin_spe_evlddx", SPE_BUILTIN_EVLDDX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evldwx, "__builtin_spe_evldwx", SPE_BUILTIN_EVLDWX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evldhx, "__builtin_spe_evldhx", SPE_BUILTIN_EVLDHX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwhex, "__builtin_spe_evlwhex", SPE_BUILTIN_EVLWHEX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwhoux, "__builtin_spe_evlwhoux", SPE_BUILTIN_EVLWHOUX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwhosx, "__builtin_spe_evlwhosx", SPE_BUILTIN_EVLWHOSX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwwsplatx, "__builtin_spe_evlwwsplatx", SPE_BUILTIN_EVLWWSPLATX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwhsplatx, "__builtin_spe_evlwhsplatx", SPE_BUILTIN_EVLWHSPLATX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlhhesplatx, "__builtin_spe_evlhhesplatx", SPE_BUILTIN_EVLHHESPLATX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlhhousplatx, "__builtin_spe_evlhhousplatx", SPE_BUILTIN_EVLHHOUSPLATX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlhhossplatx, "__builtin_spe_evlhhossplatx", SPE_BUILTIN_EVLHHOSSPLATX },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evldd, "__builtin_spe_evldd", SPE_BUILTIN_EVLDD },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evldw, "__builtin_spe_evldw", SPE_BUILTIN_EVLDW },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evldh, "__builtin_spe_evldh", SPE_BUILTIN_EVLDH },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwhe, "__builtin_spe_evlwhe", SPE_BUILTIN_EVLWHE },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwhou, "__builtin_spe_evlwhou", SPE_BUILTIN_EVLWHOU },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwhos, "__builtin_spe_evlwhos", SPE_BUILTIN_EVLWHOS },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwwsplat, "__builtin_spe_evlwwsplat", SPE_BUILTIN_EVLWWSPLAT },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlwhsplat, "__builtin_spe_evlwhsplat", SPE_BUILTIN_EVLWHSPLAT },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlhhesplat, "__builtin_spe_evlhhesplat", SPE_BUILTIN_EVLHHESPLAT },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlhhousplat, "__builtin_spe_evlhhousplat", SPE_BUILTIN_EVLHHOUSPLAT },
+ { RS6000_BTM_SPE, CODE_FOR_spe_evlhhossplat, "__builtin_spe_evlhhossplat", SPE_BUILTIN_EVLHHOSSPLAT }
};
/* Expand the builtin in EXP and store the result in TARGET. Store
@@ -11413,7 +10873,7 @@ spe_expand_builtin (tree exp, rtx target, bool *expandedp)
enum insn_code icode;
enum machine_mode tmode, mode0;
rtx pat, op0;
- struct builtin_description *d;
+ const struct builtin_description *d;
size_t i;
*expandedp = true;
@@ -11453,17 +10913,17 @@ spe_expand_builtin (tree exp, rtx target, bool *expandedp)
break;
}
- d = (struct builtin_description *) bdesc_2arg_spe;
+ d = bdesc_2arg_spe;
for (i = 0; i < ARRAY_SIZE (bdesc_2arg_spe); ++i, ++d)
if (d->code == fcode)
return rs6000_expand_binop_builtin (d->icode, exp, target);
- d = (struct builtin_description *) bdesc_spe_predicates;
+ d = bdesc_spe_predicates;
for (i = 0; i < ARRAY_SIZE (bdesc_spe_predicates); ++i, ++d)
if (d->code == fcode)
return spe_expand_predicate_builtin (d->icode, exp, target);
- d = (struct builtin_description *) bdesc_spe_evsel;
+ d = bdesc_spe_evsel;
for (i = 0; i < ARRAY_SIZE (bdesc_spe_evsel); ++i, ++d)
if (d->code == fcode)
return spe_expand_evsel_builtin (d->icode, exp, target);
@@ -11766,6 +11226,32 @@ spe_expand_evsel_builtin (enum insn_code icode, tree exp, rtx target)
return target;
}
+/* Raise an error message for a builtin function that is called without the
+ appropriate target options being set. */
+
+static void
+rs6000_invalid_builtin (enum rs6000_builtins fncode)
+{
+ size_t uns_fncode = (size_t)fncode;
+ const char *name = rs6000_builtin_info[uns_fncode].name;
+ unsigned fnmask = rs6000_builtin_info[uns_fncode].mask;
+
+ gcc_assert (name != NULL);
+ if ((fnmask & RS6000_BTM_CELL) != 0)
+ error ("Builtin function %s is only valid for the cell processor", name);
+ else if ((fnmask & RS6000_BTM_VSX) != 0)
+ error ("Builtin function %s requires the -mvsx option", name);
+ else if ((fnmask & RS6000_BTM_ALTIVEC) != 0)
+ error ("Builtin function %s requires the -maltivec option", name);
+ else if ((fnmask & RS6000_BTM_PAIRED) != 0)
+ error ("Builtin function %s requires the -mpaired option", name);
+ else if ((fnmask & RS6000_BTM_SPE) != 0)
+ error ("Builtin function %s requires the -mspe option", name);
+ else
+ error ("Builtin function %s is not supported with the current options",
+ name);
+}
+
/* Expand an expression EXP that calls a built-in function,
with result going to TARGET if that's convenient
(and in mode MODE if that's convenient).
@@ -11778,11 +11264,52 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
int ignore ATTRIBUTE_UNUSED)
{
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
- unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
+ enum rs6000_builtins fcode
+ = (enum rs6000_builtins)DECL_FUNCTION_CODE (fndecl);
+ size_t uns_fcode = (size_t)fcode;
const struct builtin_description *d;
size_t i;
rtx ret;
bool success;
+ unsigned mask = rs6000_builtin_info[uns_fcode].mask;
+ bool func_valid_p = ((rs6000_builtin_mask & mask) == mask);
+
+ if (TARGET_DEBUG_BUILTIN)
+ {
+ enum insn_code icode = rs6000_builtin_info[uns_fcode].icode;
+ const char *name1 = rs6000_builtin_info[uns_fcode].name;
+ const char *name2 = ((icode != CODE_FOR_nothing)
+ ? get_insn_name ((int)icode)
+ : "nothing");
+ const char *name3;
+
+ switch (rs6000_builtin_info[uns_fcode].attr & RS6000_BTC_TYPE_MASK)
+ {
+ default: name3 = "unknown"; break;
+ case RS6000_BTC_SPECIAL: name3 = "special"; break;
+ case RS6000_BTC_UNARY: name3 = "unary"; break;
+ case RS6000_BTC_BINARY: name3 = "binary"; break;
+ case RS6000_BTC_TERNARY: name3 = "ternary"; break;
+ case RS6000_BTC_PREDICATE: name3 = "predicate"; break;
+ case RS6000_BTC_ABS: name3 = "abs"; break;
+ case RS6000_BTC_EVSEL: name3 = "evsel"; break;
+ case RS6000_BTC_DST: name3 = "dst"; break;
+ }
+
+
+ fprintf (stderr,
+ "rs6000_expand_builtin, %s (%d), insn = %s (%d), type=%s%s\n",
+ (name1) ? name1 : "---", fcode,
+ (name2) ? name2 : "---", (int)icode,
+ name3,
+ func_valid_p ? "" : ", not valid");
+ }
+
+ if (!func_valid_p)
+ {
+ rs6000_invalid_builtin (fcode);
+ return NULL_RTX;
+ }
switch (fcode)
{
@@ -11888,13 +11415,13 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
gcc_assert (TARGET_ALTIVEC || TARGET_VSX || TARGET_SPE || TARGET_PAIRED_FLOAT);
/* Handle simple unary operations. */
- d = (struct builtin_description *) bdesc_1arg;
+ d = bdesc_1arg;
for (i = 0; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
if (d->code == fcode)
return rs6000_expand_unop_builtin (d->icode, exp, target);
/* Handle simple binary operations. */
- d = (struct builtin_description *) bdesc_2arg;
+ d = bdesc_2arg;
for (i = 0; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
if (d->code == fcode)
return rs6000_expand_binop_builtin (d->icode, exp, target);
@@ -11913,6 +11440,14 @@ rs6000_init_builtins (void)
{
tree tdecl;
tree ftype;
+ enum machine_mode mode;
+
+ if (TARGET_DEBUG_BUILTIN)
+ fprintf (stderr, "rs6000_init_builtins%s%s%s%s\n",
+ (TARGET_PAIRED_FLOAT) ? ", paired" : "",
+ (TARGET_SPE) ? ", spe" : "",
+ (TARGET_ALTIVEC) ? ", altivec" : "",
+ (TARGET_VSX) ? ", vsx" : "");
V2SI_type_node = build_vector_type (intSI_type_node, 2);
V2SF_type_node = build_vector_type (float_type_node, 2);
@@ -12069,91 +11604,70 @@ rs6000_init_builtins (void)
TYPE_NAME (pixel_V8HI_type_node) = tdecl;
(*lang_hooks.decls.pushdecl) (tdecl);
- if (TARGET_VSX)
- {
- tdecl = build_decl (BUILTINS_LOCATION,
- TYPE_DECL, get_identifier ("__vector double"),
- V2DF_type_node);
- TYPE_NAME (V2DF_type_node) = tdecl;
- (*lang_hooks.decls.pushdecl) (tdecl);
+ tdecl = build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("__vector double"),
+ V2DF_type_node);
+ TYPE_NAME (V2DF_type_node) = tdecl;
+ (*lang_hooks.decls.pushdecl) (tdecl);
- tdecl = build_decl (BUILTINS_LOCATION,
- TYPE_DECL, get_identifier ("__vector long"),
- V2DI_type_node);
- TYPE_NAME (V2DI_type_node) = tdecl;
- (*lang_hooks.decls.pushdecl) (tdecl);
+ tdecl = build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("__vector long"),
+ V2DI_type_node);
+ TYPE_NAME (V2DI_type_node) = tdecl;
+ (*lang_hooks.decls.pushdecl) (tdecl);
- tdecl = build_decl (BUILTINS_LOCATION,
- TYPE_DECL, get_identifier ("__vector unsigned long"),
- unsigned_V2DI_type_node);
- TYPE_NAME (unsigned_V2DI_type_node) = tdecl;
- (*lang_hooks.decls.pushdecl) (tdecl);
+ tdecl = build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("__vector unsigned long"),
+ unsigned_V2DI_type_node);
+ TYPE_NAME (unsigned_V2DI_type_node) = tdecl;
+ (*lang_hooks.decls.pushdecl) (tdecl);
- tdecl = build_decl (BUILTINS_LOCATION,
- TYPE_DECL, get_identifier ("__vector __bool long"),
- bool_V2DI_type_node);
- TYPE_NAME (bool_V2DI_type_node) = tdecl;
- (*lang_hooks.decls.pushdecl) (tdecl);
- }
+ tdecl = build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("__vector __bool long"),
+ bool_V2DI_type_node);
+ TYPE_NAME (bool_V2DI_type_node) = tdecl;
+ (*lang_hooks.decls.pushdecl) (tdecl);
+ /* Paired and SPE builtins are only available if you build a compiler with
+ the appropriate options, so only create those builtins with the
+ appropriate compiler option. Create Altivec and VSX builtins on machines
+ with at least the general purpose extensions (970 and newer) to allow the
+ use of the target attribute. */
if (TARGET_PAIRED_FLOAT)
paired_init_builtins ();
if (TARGET_SPE)
spe_init_builtins ();
- if (TARGET_ALTIVEC)
+ if (TARGET_EXTRA_BUILTINS)
altivec_init_builtins ();
- if (TARGET_ALTIVEC || TARGET_SPE || TARGET_PAIRED_FLOAT || TARGET_VSX)
+ if (TARGET_EXTRA_BUILTINS || TARGET_SPE || TARGET_PAIRED_FLOAT)
rs6000_common_init_builtins ();
- if (TARGET_FRE)
- {
- ftype = builtin_function_type (DFmode, DFmode, DFmode, VOIDmode,
- RS6000_BUILTIN_RECIP,
- "__builtin_recipdiv");
- def_builtin (MASK_POPCNTB, "__builtin_recipdiv", ftype,
- RS6000_BUILTIN_RECIP);
- }
- if (TARGET_FRES)
- {
- ftype = builtin_function_type (SFmode, SFmode, SFmode, VOIDmode,
- RS6000_BUILTIN_RECIPF,
- "__builtin_recipdivf");
- def_builtin (MASK_PPC_GFXOPT, "__builtin_recipdivf", ftype,
- RS6000_BUILTIN_RECIPF);
- }
- if (TARGET_FRSQRTE)
- {
- ftype = builtin_function_type (DFmode, DFmode, VOIDmode, VOIDmode,
- RS6000_BUILTIN_RSQRT,
- "__builtin_rsqrt");
- def_builtin (MASK_PPC_GFXOPT, "__builtin_rsqrt", ftype,
- RS6000_BUILTIN_RSQRT);
- }
- if (TARGET_FRSQRTES)
- {
- ftype = builtin_function_type (SFmode, SFmode, VOIDmode, VOIDmode,
- RS6000_BUILTIN_RSQRTF,
- "__builtin_rsqrtf");
- def_builtin (MASK_PPC_GFXOPT, "__builtin_rsqrtf", ftype,
- RS6000_BUILTIN_RSQRTF);
- }
- if (TARGET_POPCNTD)
- {
- enum machine_mode mode = (TARGET_64BIT) ? DImode : SImode;
- tree ftype = builtin_function_type (mode, mode, mode, VOIDmode,
- POWER7_BUILTIN_BPERMD,
- "__builtin_bpermd");
- def_builtin (MASK_POPCNTD, "__builtin_bpermd", ftype,
- POWER7_BUILTIN_BPERMD);
- }
- if (TARGET_POWERPC)
- {
+
+ ftype = builtin_function_type (DFmode, DFmode, DFmode, VOIDmode,
+ RS6000_BUILTIN_RECIP, "__builtin_recipdiv");
+ def_builtin ("__builtin_recipdiv", ftype, RS6000_BUILTIN_RECIP);
+
+ ftype = builtin_function_type (SFmode, SFmode, SFmode, VOIDmode,
+ RS6000_BUILTIN_RECIPF, "__builtin_recipdivf");
+ def_builtin ("__builtin_recipdivf", ftype, RS6000_BUILTIN_RECIPF);
+
+ ftype = builtin_function_type (DFmode, DFmode, VOIDmode, VOIDmode,
+ RS6000_BUILTIN_RSQRT, "__builtin_rsqrt");
+ def_builtin ("__builtin_rsqrt", ftype, RS6000_BUILTIN_RSQRT);
+
+ ftype = builtin_function_type (SFmode, SFmode, VOIDmode, VOIDmode,
+ RS6000_BUILTIN_RSQRTF, "__builtin_rsqrtf");
+ def_builtin ("__builtin_rsqrtf", ftype, RS6000_BUILTIN_RSQRTF);
+
+ mode = (TARGET_64BIT) ? DImode : SImode;
+ ftype = builtin_function_type (mode, mode, mode, VOIDmode,
+ POWER7_BUILTIN_BPERMD, "__builtin_bpermd");
+ def_builtin ("__builtin_bpermd", ftype, POWER7_BUILTIN_BPERMD);
+
/* Don't use builtin_function_type here, as it maps HI/QI to SI. */
- tree ftype = build_function_type_list (unsigned_intHI_type_node,
- unsigned_intHI_type_node,
- NULL_TREE);
- def_builtin (MASK_POWERPC, "__builtin_bswap16", ftype,
- RS6000_BUILTIN_BSWAP_HI);
- }
+ ftype = build_function_type_list (unsigned_intHI_type_node,
+ unsigned_intHI_type_node,
+ NULL_TREE);
+ def_builtin ("__builtin_bswap16", ftype, RS6000_BUILTIN_BSWAP_HI);
#if TARGET_XCOFF
/* AIX libm provides clog as __clog. */
@@ -12171,38 +11685,19 @@ rs6000_init_builtins (void)
static tree
rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
{
+ unsigned fnmask;
+
if (code >= RS6000_BUILTIN_COUNT)
return error_mark_node;
- return rs6000_builtin_decls[code];
-}
-
-/* Search through a set of builtins and enable the mask bits.
- DESC is an array of builtins.
- SIZE is the total number of builtins.
- START is the builtin enum at which to start.
- END is the builtin enum at which to end. */
-static void
-enable_mask_for_builtins (struct builtin_description *desc, int size,
- enum rs6000_builtins start,
- enum rs6000_builtins end)
-{
- int i;
-
- for (i = 0; i < size; ++i)
- if (desc[i].code == start)
- break;
-
- if (i == size)
- return;
-
- for (; i < size; ++i)
+ fnmask = rs6000_builtin_info[code].mask;
+ if ((fnmask & rs6000_builtin_mask) != fnmask)
{
- /* Flip all the bits on. */
- desc[i].mask = target_flags;
- if (desc[i].code == end)
- break;
+ rs6000_invalid_builtin ((enum rs6000_builtins)code);
+ return error_mark_node;
}
+
+ return rs6000_builtin_decls[code];
}
static void
@@ -12210,7 +11705,7 @@ spe_init_builtins (void)
{
tree puint_type_node = build_pointer_type (unsigned_type_node);
tree pushort_type_node = build_pointer_type (short_unsigned_type_node);
- struct builtin_description *d;
+ const struct builtin_description *d;
size_t i;
tree v2si_ftype_4_v2si
@@ -12300,28 +11795,6 @@ spe_init_builtins (void)
signed_char_type_node,
NULL_TREE);
- /* The initialization of the simple binary and unary builtins is
- done in rs6000_common_init_builtins, but we have to enable the
- mask bits here manually because we have run out of `target_flags'
- bits. We really need to redesign this mask business. */
-
- enable_mask_for_builtins ((struct builtin_description *) bdesc_2arg,
- ARRAY_SIZE (bdesc_2arg),
- SPE_BUILTIN_EVADDW,
- SPE_BUILTIN_EVXOR);
- enable_mask_for_builtins ((struct builtin_description *) bdesc_1arg,
- ARRAY_SIZE (bdesc_1arg),
- SPE_BUILTIN_EVABS,
- SPE_BUILTIN_EVSUBFUSIAAW);
- enable_mask_for_builtins ((struct builtin_description *) bdesc_spe_predicates,
- ARRAY_SIZE (bdesc_spe_predicates),
- SPE_BUILTIN_EVCMPEQ,
- SPE_BUILTIN_EVFSTSTLT);
- enable_mask_for_builtins ((struct builtin_description *) bdesc_spe_evsel,
- ARRAY_SIZE (bdesc_spe_evsel),
- SPE_BUILTIN_EVSEL_CMPGTS,
- SPE_BUILTIN_EVSEL_FSTSTEQ);
-
(*lang_hooks.decls.pushdecl)
(build_decl (BUILTINS_LOCATION, TYPE_DECL,
get_identifier ("__ev64_opaque__"),
@@ -12329,51 +11802,51 @@ spe_init_builtins (void)
/* Initialize irregular SPE builtins. */
- def_builtin (target_flags, "__builtin_spe_mtspefscr", void_ftype_int, SPE_BUILTIN_MTSPEFSCR);
- def_builtin (target_flags, "__builtin_spe_mfspefscr", int_ftype_void, SPE_BUILTIN_MFSPEFSCR);
- def_builtin (target_flags, "__builtin_spe_evstddx", void_ftype_v2si_pv2si_int, SPE_BUILTIN_EVSTDDX);
- def_builtin (target_flags, "__builtin_spe_evstdhx", void_ftype_v2si_pv2si_int, SPE_BUILTIN_EVSTDHX);
- def_builtin (target_flags, "__builtin_spe_evstdwx", void_ftype_v2si_pv2si_int, SPE_BUILTIN_EVSTDWX);
- def_builtin (target_flags, "__builtin_spe_evstwhex", void_ftype_v2si_puint_int, SPE_BUILTIN_EVSTWHEX);
- def_builtin (target_flags, "__builtin_spe_evstwhox", void_ftype_v2si_puint_int, SPE_BUILTIN_EVSTWHOX);
- def_builtin (target_flags, "__builtin_spe_evstwwex", void_ftype_v2si_puint_int, SPE_BUILTIN_EVSTWWEX);
- def_builtin (target_flags, "__builtin_spe_evstwwox", void_ftype_v2si_puint_int, SPE_BUILTIN_EVSTWWOX);
- def_builtin (target_flags, "__builtin_spe_evstdd", void_ftype_v2si_pv2si_char, SPE_BUILTIN_EVSTDD);
- def_builtin (target_flags, "__builtin_spe_evstdh", void_ftype_v2si_pv2si_char, SPE_BUILTIN_EVSTDH);
- def_builtin (target_flags, "__builtin_spe_evstdw", void_ftype_v2si_pv2si_char, SPE_BUILTIN_EVSTDW);
- def_builtin (target_flags, "__builtin_spe_evstwhe", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWHE);
- def_builtin (target_flags, "__builtin_spe_evstwho", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWHO);
- def_builtin (target_flags, "__builtin_spe_evstwwe", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWWE);
- def_builtin (target_flags, "__builtin_spe_evstwwo", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWWO);
- def_builtin (target_flags, "__builtin_spe_evsplatfi", v2si_ftype_signed_char, SPE_BUILTIN_EVSPLATFI);
- def_builtin (target_flags, "__builtin_spe_evsplati", v2si_ftype_signed_char, SPE_BUILTIN_EVSPLATI);
+ def_builtin ("__builtin_spe_mtspefscr", void_ftype_int, SPE_BUILTIN_MTSPEFSCR);
+ def_builtin ("__builtin_spe_mfspefscr", int_ftype_void, SPE_BUILTIN_MFSPEFSCR);
+ def_builtin ("__builtin_spe_evstddx", void_ftype_v2si_pv2si_int, SPE_BUILTIN_EVSTDDX);
+ def_builtin ("__builtin_spe_evstdhx", void_ftype_v2si_pv2si_int, SPE_BUILTIN_EVSTDHX);
+ def_builtin ("__builtin_spe_evstdwx", void_ftype_v2si_pv2si_int, SPE_BUILTIN_EVSTDWX);
+ def_builtin ("__builtin_spe_evstwhex", void_ftype_v2si_puint_int, SPE_BUILTIN_EVSTWHEX);
+ def_builtin ("__builtin_spe_evstwhox", void_ftype_v2si_puint_int, SPE_BUILTIN_EVSTWHOX);
+ def_builtin ("__builtin_spe_evstwwex", void_ftype_v2si_puint_int, SPE_BUILTIN_EVSTWWEX);
+ def_builtin ("__builtin_spe_evstwwox", void_ftype_v2si_puint_int, SPE_BUILTIN_EVSTWWOX);
+ def_builtin ("__builtin_spe_evstdd", void_ftype_v2si_pv2si_char, SPE_BUILTIN_EVSTDD);
+ def_builtin ("__builtin_spe_evstdh", void_ftype_v2si_pv2si_char, SPE_BUILTIN_EVSTDH);
+ def_builtin ("__builtin_spe_evstdw", void_ftype_v2si_pv2si_char, SPE_BUILTIN_EVSTDW);
+ def_builtin ("__builtin_spe_evstwhe", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWHE);
+ def_builtin ("__builtin_spe_evstwho", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWHO);
+ def_builtin ("__builtin_spe_evstwwe", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWWE);
+ def_builtin ("__builtin_spe_evstwwo", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWWO);
+ def_builtin ("__builtin_spe_evsplatfi", v2si_ftype_signed_char, SPE_BUILTIN_EVSPLATFI);
+ def_builtin ("__builtin_spe_evsplati", v2si_ftype_signed_char, SPE_BUILTIN_EVSPLATI);
/* Loads. */
- def_builtin (target_flags, "__builtin_spe_evlddx", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDDX);
- def_builtin (target_flags, "__builtin_spe_evldwx", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDWX);
- def_builtin (target_flags, "__builtin_spe_evldhx", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDHX);
- def_builtin (target_flags, "__builtin_spe_evlwhex", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHEX);
- def_builtin (target_flags, "__builtin_spe_evlwhoux", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHOUX);
- def_builtin (target_flags, "__builtin_spe_evlwhosx", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHOSX);
- def_builtin (target_flags, "__builtin_spe_evlwwsplatx", v2si_ftype_puint_int, SPE_BUILTIN_EVLWWSPLATX);
- def_builtin (target_flags, "__builtin_spe_evlwhsplatx", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHSPLATX);
- def_builtin (target_flags, "__builtin_spe_evlhhesplatx", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHESPLATX);
- def_builtin (target_flags, "__builtin_spe_evlhhousplatx", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHOUSPLATX);
- def_builtin (target_flags, "__builtin_spe_evlhhossplatx", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHOSSPLATX);
- def_builtin (target_flags, "__builtin_spe_evldd", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDD);
- def_builtin (target_flags, "__builtin_spe_evldw", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDW);
- def_builtin (target_flags, "__builtin_spe_evldh", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDH);
- def_builtin (target_flags, "__builtin_spe_evlhhesplat", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHESPLAT);
- def_builtin (target_flags, "__builtin_spe_evlhhossplat", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHOSSPLAT);
- def_builtin (target_flags, "__builtin_spe_evlhhousplat", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHOUSPLAT);
- def_builtin (target_flags, "__builtin_spe_evlwhe", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHE);
- def_builtin (target_flags, "__builtin_spe_evlwhos", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHOS);
- def_builtin (target_flags, "__builtin_spe_evlwhou", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHOU);
- def_builtin (target_flags, "__builtin_spe_evlwhsplat", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHSPLAT);
- def_builtin (target_flags, "__builtin_spe_evlwwsplat", v2si_ftype_puint_int, SPE_BUILTIN_EVLWWSPLAT);
+ def_builtin ("__builtin_spe_evlddx", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDDX);
+ def_builtin ("__builtin_spe_evldwx", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDWX);
+ def_builtin ("__builtin_spe_evldhx", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDHX);
+ def_builtin ("__builtin_spe_evlwhex", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHEX);
+ def_builtin ("__builtin_spe_evlwhoux", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHOUX);
+ def_builtin ("__builtin_spe_evlwhosx", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHOSX);
+ def_builtin ("__builtin_spe_evlwwsplatx", v2si_ftype_puint_int, SPE_BUILTIN_EVLWWSPLATX);
+ def_builtin ("__builtin_spe_evlwhsplatx", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHSPLATX);
+ def_builtin ("__builtin_spe_evlhhesplatx", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHESPLATX);
+ def_builtin ("__builtin_spe_evlhhousplatx", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHOUSPLATX);
+ def_builtin ("__builtin_spe_evlhhossplatx", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHOSSPLATX);
+ def_builtin ("__builtin_spe_evldd", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDD);
+ def_builtin ("__builtin_spe_evldw", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDW);
+ def_builtin ("__builtin_spe_evldh", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDH);
+ def_builtin ("__builtin_spe_evlhhesplat", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHESPLAT);
+ def_builtin ("__builtin_spe_evlhhossplat", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHOSSPLAT);
+ def_builtin ("__builtin_spe_evlhhousplat", v2si_ftype_pushort_int, SPE_BUILTIN_EVLHHOUSPLAT);
+ def_builtin ("__builtin_spe_evlwhe", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHE);
+ def_builtin ("__builtin_spe_evlwhos", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHOS);
+ def_builtin ("__builtin_spe_evlwhou", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHOU);
+ def_builtin ("__builtin_spe_evlwhsplat", v2si_ftype_puint_int, SPE_BUILTIN_EVLWHSPLAT);
+ def_builtin ("__builtin_spe_evlwwsplat", v2si_ftype_puint_int, SPE_BUILTIN_EVLWWSPLAT);
/* Predicates. */
- d = (struct builtin_description *) bdesc_spe_predicates;
+ d = bdesc_spe_predicates;
for (i = 0; i < ARRAY_SIZE (bdesc_spe_predicates); ++i, d++)
{
tree type;
@@ -12390,11 +11863,11 @@ spe_init_builtins (void)
gcc_unreachable ();
}
- def_builtin (d->mask, d->name, type, d->code);
+ def_builtin (d->name, type, d->code);
}
/* Evsel predicates. */
- d = (struct builtin_description *) bdesc_spe_evsel;
+ d = bdesc_spe_evsel;
for (i = 0; i < ARRAY_SIZE (bdesc_spe_evsel); ++i, d++)
{
tree type;
@@ -12411,7 +11884,7 @@ spe_init_builtins (void)
gcc_unreachable ();
}
- def_builtin (d->mask, d->name, type, d->code);
+ def_builtin (d->name, type, d->code);
}
}
@@ -12443,11 +11916,11 @@ paired_init_builtins (void)
NULL_TREE);
- def_builtin (0, "__builtin_paired_lx", v2sf_ftype_long_pcfloat,
+ def_builtin ("__builtin_paired_lx", v2sf_ftype_long_pcfloat,
PAIRED_BUILTIN_LX);
- def_builtin (0, "__builtin_paired_stx", void_ftype_v2sf_long_pcfloat,
+ def_builtin ("__builtin_paired_stx", void_ftype_v2sf_long_pcfloat,
PAIRED_BUILTIN_STX);
/* Predicates. */
@@ -12456,6 +11929,11 @@ paired_init_builtins (void)
{
tree type;
+ if (TARGET_DEBUG_BUILTIN)
+ fprintf (stderr, "paired pred #%d, insn = %s [%d], mode = %s\n",
+ (int)i, get_insn_name (d->icode), (int)d->icode,
+ GET_MODE_NAME (insn_data[d->icode].operand[1].mode));
+
switch (insn_data[d->icode].operand[1].mode)
{
case V2SFmode:
@@ -12465,7 +11943,7 @@ paired_init_builtins (void)
gcc_unreachable ();
}
- def_builtin (d->mask, d->name, type, d->code);
+ def_builtin (d->name, type, d->code);
}
}
@@ -12473,9 +11951,9 @@ static void
altivec_init_builtins (void)
{
const struct builtin_description *d;
- const struct builtin_description_predicates *dp;
size_t i;
tree ftype;
+ tree decl;
tree pvoid_type_node = build_pointer_type (void_type_node);
@@ -12600,125 +12078,120 @@ altivec_init_builtins (void)
pcvoid_type_node, integer_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_mtvscr", void_ftype_v4si, ALTIVEC_BUILTIN_MTVSCR);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_mfvscr", v8hi_ftype_void, ALTIVEC_BUILTIN_MFVSCR);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_dssall", void_ftype_void, ALTIVEC_BUILTIN_DSSALL);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_dss", void_ftype_int, ALTIVEC_BUILTIN_DSS);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvsl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVSL);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvsr", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVSR);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvebx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEBX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvehx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEHX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvewx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEWX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvxl", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVXL);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_stvx", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_stvewx", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVEWX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_stvxl", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVXL);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_stvebx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVEBX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_stvehx", void_ftype_v8hi_long_pvoid, ALTIVEC_BUILTIN_STVEHX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_ld", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LD);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lde", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LDE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_ldl", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LDL);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lvsl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVSL);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lvsr", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVSR);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lvebx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEBX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lvehx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEHX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lvewx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEWX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_st", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_ST);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_ste", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_stl", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STL);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_stvewx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEWX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_stvebx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEBX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_stvehx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEHX);
-
- def_builtin (MASK_VSX, "__builtin_vsx_lxvd2x_v2df", v2df_ftype_long_pcvoid,
+ def_builtin ("__builtin_altivec_mtvscr", void_ftype_v4si, ALTIVEC_BUILTIN_MTVSCR);
+ def_builtin ("__builtin_altivec_mfvscr", v8hi_ftype_void, ALTIVEC_BUILTIN_MFVSCR);
+ def_builtin ("__builtin_altivec_dssall", void_ftype_void, ALTIVEC_BUILTIN_DSSALL);
+ def_builtin ("__builtin_altivec_dss", void_ftype_int, ALTIVEC_BUILTIN_DSS);
+ def_builtin ("__builtin_altivec_lvsl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVSL);
+ def_builtin ("__builtin_altivec_lvsr", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVSR);
+ def_builtin ("__builtin_altivec_lvebx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEBX);
+ def_builtin ("__builtin_altivec_lvehx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEHX);
+ def_builtin ("__builtin_altivec_lvewx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEWX);
+ def_builtin ("__builtin_altivec_lvxl", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVXL);
+ def_builtin ("__builtin_altivec_lvx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVX);
+ def_builtin ("__builtin_altivec_stvx", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVX);
+ def_builtin ("__builtin_altivec_stvewx", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVEWX);
+ def_builtin ("__builtin_altivec_stvxl", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVXL);
+ def_builtin ("__builtin_altivec_stvebx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVEBX);
+ def_builtin ("__builtin_altivec_stvehx", void_ftype_v8hi_long_pvoid, ALTIVEC_BUILTIN_STVEHX);
+ def_builtin ("__builtin_vec_ld", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LD);
+ def_builtin ("__builtin_vec_lde", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LDE);
+ def_builtin ("__builtin_vec_ldl", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LDL);
+ def_builtin ("__builtin_vec_lvsl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVSL);
+ def_builtin ("__builtin_vec_lvsr", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVSR);
+ def_builtin ("__builtin_vec_lvebx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEBX);
+ def_builtin ("__builtin_vec_lvehx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEHX);
+ def_builtin ("__builtin_vec_lvewx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEWX);
+ def_builtin ("__builtin_vec_st", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_ST);
+ def_builtin ("__builtin_vec_ste", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STE);
+ def_builtin ("__builtin_vec_stl", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STL);
+ def_builtin ("__builtin_vec_stvewx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEWX);
+ def_builtin ("__builtin_vec_stvebx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEBX);
+ def_builtin ("__builtin_vec_stvehx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEHX);
+
+ def_builtin ("__builtin_vsx_lxvd2x_v2df", v2df_ftype_long_pcvoid,
VSX_BUILTIN_LXVD2X_V2DF);
- def_builtin (MASK_VSX, "__builtin_vsx_lxvd2x_v2di", v2di_ftype_long_pcvoid,
+ def_builtin ("__builtin_vsx_lxvd2x_v2di", v2di_ftype_long_pcvoid,
VSX_BUILTIN_LXVD2X_V2DI);
- def_builtin (MASK_VSX, "__builtin_vsx_lxvw4x_v4sf", v4sf_ftype_long_pcvoid,
+ def_builtin ("__builtin_vsx_lxvw4x_v4sf", v4sf_ftype_long_pcvoid,
VSX_BUILTIN_LXVW4X_V4SF);
- def_builtin (MASK_VSX, "__builtin_vsx_lxvw4x_v4si", v4si_ftype_long_pcvoid,
+ def_builtin ("__builtin_vsx_lxvw4x_v4si", v4si_ftype_long_pcvoid,
VSX_BUILTIN_LXVW4X_V4SI);
- def_builtin (MASK_VSX, "__builtin_vsx_lxvw4x_v8hi",
- v8hi_ftype_long_pcvoid, VSX_BUILTIN_LXVW4X_V8HI);
- def_builtin (MASK_VSX, "__builtin_vsx_lxvw4x_v16qi",
- v16qi_ftype_long_pcvoid, VSX_BUILTIN_LXVW4X_V16QI);
- def_builtin (MASK_VSX, "__builtin_vsx_stxvd2x_v2df",
- void_ftype_v2df_long_pvoid, VSX_BUILTIN_STXVD2X_V2DF);
- def_builtin (MASK_VSX, "__builtin_vsx_stxvd2x_v2di",
- void_ftype_v2di_long_pvoid, VSX_BUILTIN_STXVD2X_V2DI);
- def_builtin (MASK_VSX, "__builtin_vsx_stxvw4x_v4sf",
- void_ftype_v4sf_long_pvoid, VSX_BUILTIN_STXVW4X_V4SF);
- def_builtin (MASK_VSX, "__builtin_vsx_stxvw4x_v4si",
- void_ftype_v4si_long_pvoid, VSX_BUILTIN_STXVW4X_V4SI);
- def_builtin (MASK_VSX, "__builtin_vsx_stxvw4x_v8hi",
- void_ftype_v8hi_long_pvoid, VSX_BUILTIN_STXVW4X_V8HI);
- def_builtin (MASK_VSX, "__builtin_vsx_stxvw4x_v16qi",
- void_ftype_v16qi_long_pvoid, VSX_BUILTIN_STXVW4X_V16QI);
- def_builtin (MASK_VSX, "__builtin_vec_vsx_ld", opaque_ftype_long_pcvoid,
+ def_builtin ("__builtin_vsx_lxvw4x_v8hi", v8hi_ftype_long_pcvoid,
+ VSX_BUILTIN_LXVW4X_V8HI);
+ def_builtin ("__builtin_vsx_lxvw4x_v16qi", v16qi_ftype_long_pcvoid,
+ VSX_BUILTIN_LXVW4X_V16QI);
+ def_builtin ("__builtin_vsx_stxvd2x_v2df", void_ftype_v2df_long_pvoid,
+ VSX_BUILTIN_STXVD2X_V2DF);
+ def_builtin ("__builtin_vsx_stxvd2x_v2di", void_ftype_v2di_long_pvoid,
+ VSX_BUILTIN_STXVD2X_V2DI);
+ def_builtin ("__builtin_vsx_stxvw4x_v4sf", void_ftype_v4sf_long_pvoid,
+ VSX_BUILTIN_STXVW4X_V4SF);
+ def_builtin ("__builtin_vsx_stxvw4x_v4si", void_ftype_v4si_long_pvoid,
+ VSX_BUILTIN_STXVW4X_V4SI);
+ def_builtin ("__builtin_vsx_stxvw4x_v8hi", void_ftype_v8hi_long_pvoid,
+ VSX_BUILTIN_STXVW4X_V8HI);
+ def_builtin ("__builtin_vsx_stxvw4x_v16qi", void_ftype_v16qi_long_pvoid,
+ VSX_BUILTIN_STXVW4X_V16QI);
+ def_builtin ("__builtin_vec_vsx_ld", opaque_ftype_long_pcvoid,
VSX_BUILTIN_VEC_LD);
- def_builtin (MASK_VSX, "__builtin_vec_vsx_st", void_ftype_opaque_long_pvoid,
+ def_builtin ("__builtin_vec_vsx_st", void_ftype_opaque_long_pvoid,
VSX_BUILTIN_VEC_ST);
- if (rs6000_cpu == PROCESSOR_CELL)
- {
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvlx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVLX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvlxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVLXL);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvrx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVRX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_lvrxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVRXL);
-
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lvlx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVLX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lvlxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVLXL);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lvrx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVRX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_lvrxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVRXL);
-
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_stvlx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVLX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_stvlxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVLXL);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_stvrx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVRX);
- def_builtin (MASK_ALTIVEC, "__builtin_altivec_stvrxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVRXL);
-
- def_builtin (MASK_ALTIVEC, "__builtin_vec_stvlx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVLX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_stvlxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVLXL);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_stvrx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVRX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_stvrxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVRXL);
- }
- def_builtin (MASK_ALTIVEC, "__builtin_vec_step", int_ftype_opaque, ALTIVEC_BUILTIN_VEC_STEP);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_splats", opaque_ftype_opaque, ALTIVEC_BUILTIN_VEC_SPLATS);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_promote", opaque_ftype_opaque, ALTIVEC_BUILTIN_VEC_PROMOTE);
-
- def_builtin (MASK_ALTIVEC, "__builtin_vec_sld", opaque_ftype_opaque_opaque_int, ALTIVEC_BUILTIN_VEC_SLD);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_splat", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_SPLAT);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_extract", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_EXTRACT);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_insert", opaque_ftype_opaque_opaque_int, ALTIVEC_BUILTIN_VEC_INSERT);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_vspltw", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VSPLTW);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_vsplth", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VSPLTH);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_vspltb", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VSPLTB);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_ctf", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_CTF);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_vcfsx", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VCFSX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_vcfux", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VCFUX);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_cts", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_CTS);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_ctu", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_CTU);
+ def_builtin ("__builtin_vec_step", int_ftype_opaque, ALTIVEC_BUILTIN_VEC_STEP);
+ def_builtin ("__builtin_vec_splats", opaque_ftype_opaque, ALTIVEC_BUILTIN_VEC_SPLATS);
+ def_builtin ("__builtin_vec_promote", opaque_ftype_opaque, ALTIVEC_BUILTIN_VEC_PROMOTE);
+
+ def_builtin ("__builtin_vec_sld", opaque_ftype_opaque_opaque_int, ALTIVEC_BUILTIN_VEC_SLD);
+ def_builtin ("__builtin_vec_splat", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_SPLAT);
+ def_builtin ("__builtin_vec_extract", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_EXTRACT);
+ def_builtin ("__builtin_vec_insert", opaque_ftype_opaque_opaque_int, ALTIVEC_BUILTIN_VEC_INSERT);
+ def_builtin ("__builtin_vec_vspltw", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VSPLTW);
+ def_builtin ("__builtin_vec_vsplth", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VSPLTH);
+ def_builtin ("__builtin_vec_vspltb", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VSPLTB);
+ def_builtin ("__builtin_vec_ctf", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_CTF);
+ def_builtin ("__builtin_vec_vcfsx", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VCFSX);
+ def_builtin ("__builtin_vec_vcfux", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_VCFUX);
+ def_builtin ("__builtin_vec_cts", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_CTS);
+ def_builtin ("__builtin_vec_ctu", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_CTU);
+
+ /* Cell builtins. */
+ def_builtin ("__builtin_altivec_lvlx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVLX);
+ def_builtin ("__builtin_altivec_lvlxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVLXL);
+ def_builtin ("__builtin_altivec_lvrx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVRX);
+ def_builtin ("__builtin_altivec_lvrxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVRXL);
+
+ def_builtin ("__builtin_vec_lvlx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVLX);
+ def_builtin ("__builtin_vec_lvlxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVLXL);
+ def_builtin ("__builtin_vec_lvrx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVRX);
+ def_builtin ("__builtin_vec_lvrxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVRXL);
+
+ def_builtin ("__builtin_altivec_stvlx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVLX);
+ def_builtin ("__builtin_altivec_stvlxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVLXL);
+ def_builtin ("__builtin_altivec_stvrx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVRX);
+ def_builtin ("__builtin_altivec_stvrxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVRXL);
+
+ def_builtin ("__builtin_vec_stvlx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVLX);
+ def_builtin ("__builtin_vec_stvlxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVLXL);
+ def_builtin ("__builtin_vec_stvrx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVRX);
+ def_builtin ("__builtin_vec_stvrxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVRXL);
/* Add the DST variants. */
d = bdesc_dst;
for (i = 0; i < ARRAY_SIZE (bdesc_dst); i++, d++)
- def_builtin (d->mask, d->name, void_ftype_pcvoid_int_int, d->code);
+ def_builtin (d->name, void_ftype_pcvoid_int_int, d->code);
/* Initialize the predicates. */
- dp = bdesc_altivec_preds;
- for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, dp++)
+ d = bdesc_altivec_preds;
+ for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, d++)
{
enum machine_mode mode1;
tree type;
- bool is_overloaded = ((dp->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && dp->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
- || (dp->code >= VSX_BUILTIN_OVERLOADED_FIRST
- && dp->code <= VSX_BUILTIN_OVERLOADED_LAST));
- if (is_overloaded)
+ if (rs6000_overloaded_builtin_p (d->code))
mode1 = VOIDmode;
else
- mode1 = insn_data[dp->icode].operand[1].mode;
+ mode1 = insn_data[d->icode].operand[1].mode;
switch (mode1)
{
@@ -12744,7 +12217,7 @@ altivec_init_builtins (void)
gcc_unreachable ();
}
- def_builtin (dp->mask, dp->name, type, dp->code);
+ def_builtin (d->name, type, d->code);
}
/* Initialize the abs* operators. */
@@ -12777,31 +12250,25 @@ altivec_init_builtins (void)
gcc_unreachable ();
}
- def_builtin (d->mask, d->name, type, d->code);
+ def_builtin (d->name, type, d->code);
}
- if (TARGET_ALTIVEC)
- {
- tree decl;
+ /* Initialize target builtin that implements
+ targetm.vectorize.builtin_mask_for_load. */
- /* Initialize target builtin that implements
- targetm.vectorize.builtin_mask_for_load. */
-
- decl = add_builtin_function ("__builtin_altivec_mask_for_load",
- v16qi_ftype_long_pcvoid,
- ALTIVEC_BUILTIN_MASK_FOR_LOAD,
- BUILT_IN_MD, NULL, NULL_TREE);
- TREE_READONLY (decl) = 1;
- /* Record the decl. Will be used by rs6000_builtin_mask_for_load. */
- altivec_builtin_mask_for_load = decl;
- }
+ decl = add_builtin_function ("__builtin_altivec_mask_for_load",
+ v16qi_ftype_long_pcvoid,
+ ALTIVEC_BUILTIN_MASK_FOR_LOAD,
+ BUILT_IN_MD, NULL, NULL_TREE);
+ TREE_READONLY (decl) = 1;
+ /* Record the decl. Will be used by rs6000_builtin_mask_for_load. */
+ altivec_builtin_mask_for_load = decl;
/* Access to the vec_init patterns. */
ftype = build_function_type_list (V4SI_type_node, integer_type_node,
integer_type_node, integer_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_init_v4si", ftype,
- ALTIVEC_BUILTIN_VEC_INIT_V4SI);
+ def_builtin ("__builtin_vec_init_v4si", ftype, ALTIVEC_BUILTIN_VEC_INIT_V4SI);
ftype = build_function_type_list (V8HI_type_node, short_integer_type_node,
short_integer_type_node,
@@ -12811,8 +12278,7 @@ altivec_init_builtins (void)
short_integer_type_node,
short_integer_type_node,
short_integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_init_v8hi", ftype,
- ALTIVEC_BUILTIN_VEC_INIT_V8HI);
+ def_builtin ("__builtin_vec_init_v8hi", ftype, ALTIVEC_BUILTIN_VEC_INIT_V8HI);
ftype = build_function_type_list (V16QI_type_node, char_type_node,
char_type_node, char_type_node,
@@ -12823,101 +12289,78 @@ altivec_init_builtins (void)
char_type_node, char_type_node,
char_type_node, char_type_node,
char_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_init_v16qi", ftype,
+ def_builtin ("__builtin_vec_init_v16qi", ftype,
ALTIVEC_BUILTIN_VEC_INIT_V16QI);
ftype = build_function_type_list (V4SF_type_node, float_type_node,
float_type_node, float_type_node,
float_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_init_v4sf", ftype,
- ALTIVEC_BUILTIN_VEC_INIT_V4SF);
+ def_builtin ("__builtin_vec_init_v4sf", ftype, ALTIVEC_BUILTIN_VEC_INIT_V4SF);
- if (TARGET_VSX)
- {
- ftype = build_function_type_list (V2DF_type_node, double_type_node,
- double_type_node, NULL_TREE);
- def_builtin (MASK_VSX, "__builtin_vec_init_v2df", ftype,
- VSX_BUILTIN_VEC_INIT_V2DF);
+ /* VSX builtins. */
+ ftype = build_function_type_list (V2DF_type_node, double_type_node,
+ double_type_node, NULL_TREE);
+ def_builtin ("__builtin_vec_init_v2df", ftype, VSX_BUILTIN_VEC_INIT_V2DF);
- ftype = build_function_type_list (V2DI_type_node, intDI_type_node,
- intDI_type_node, NULL_TREE);
- def_builtin (MASK_VSX, "__builtin_vec_init_v2di", ftype,
- VSX_BUILTIN_VEC_INIT_V2DI);
- }
+ ftype = build_function_type_list (V2DI_type_node, intDI_type_node,
+ intDI_type_node, NULL_TREE);
+ def_builtin ("__builtin_vec_init_v2di", ftype, VSX_BUILTIN_VEC_INIT_V2DI);
/* Access to the vec_set patterns. */
ftype = build_function_type_list (V4SI_type_node, V4SI_type_node,
intSI_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_set_v4si", ftype,
- ALTIVEC_BUILTIN_VEC_SET_V4SI);
+ def_builtin ("__builtin_vec_set_v4si", ftype, ALTIVEC_BUILTIN_VEC_SET_V4SI);
ftype = build_function_type_list (V8HI_type_node, V8HI_type_node,
intHI_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_set_v8hi", ftype,
- ALTIVEC_BUILTIN_VEC_SET_V8HI);
+ def_builtin ("__builtin_vec_set_v8hi", ftype, ALTIVEC_BUILTIN_VEC_SET_V8HI);
ftype = build_function_type_list (V16QI_type_node, V16QI_type_node,
intQI_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_set_v16qi", ftype,
- ALTIVEC_BUILTIN_VEC_SET_V16QI);
+ def_builtin ("__builtin_vec_set_v16qi", ftype, ALTIVEC_BUILTIN_VEC_SET_V16QI);
ftype = build_function_type_list (V4SF_type_node, V4SF_type_node,
float_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC|MASK_VSX, "__builtin_vec_set_v4sf", ftype,
- ALTIVEC_BUILTIN_VEC_SET_V4SF);
+ def_builtin ("__builtin_vec_set_v4sf", ftype, ALTIVEC_BUILTIN_VEC_SET_V4SF);
- if (TARGET_VSX)
- {
- ftype = build_function_type_list (V2DF_type_node, V2DF_type_node,
- double_type_node,
- integer_type_node, NULL_TREE);
- def_builtin (MASK_VSX, "__builtin_vec_set_v2df", ftype,
- VSX_BUILTIN_VEC_SET_V2DF);
+ ftype = build_function_type_list (V2DF_type_node, V2DF_type_node,
+ double_type_node,
+ integer_type_node, NULL_TREE);
+ def_builtin ("__builtin_vec_set_v2df", ftype, VSX_BUILTIN_VEC_SET_V2DF);
- ftype = build_function_type_list (V2DI_type_node, V2DI_type_node,
- intDI_type_node,
- integer_type_node, NULL_TREE);
- def_builtin (MASK_VSX, "__builtin_vec_set_v2di", ftype,
- VSX_BUILTIN_VEC_SET_V2DI);
- }
+ ftype = build_function_type_list (V2DI_type_node, V2DI_type_node,
+ intDI_type_node,
+ integer_type_node, NULL_TREE);
+ def_builtin ("__builtin_vec_set_v2di", ftype, VSX_BUILTIN_VEC_SET_V2DI);
/* Access to the vec_extract patterns. */
ftype = build_function_type_list (intSI_type_node, V4SI_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_ext_v4si", ftype,
- ALTIVEC_BUILTIN_VEC_EXT_V4SI);
+ def_builtin ("__builtin_vec_ext_v4si", ftype, ALTIVEC_BUILTIN_VEC_EXT_V4SI);
ftype = build_function_type_list (intHI_type_node, V8HI_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_ext_v8hi", ftype,
- ALTIVEC_BUILTIN_VEC_EXT_V8HI);
+ def_builtin ("__builtin_vec_ext_v8hi", ftype, ALTIVEC_BUILTIN_VEC_EXT_V8HI);
ftype = build_function_type_list (intQI_type_node, V16QI_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC, "__builtin_vec_ext_v16qi", ftype,
- ALTIVEC_BUILTIN_VEC_EXT_V16QI);
+ def_builtin ("__builtin_vec_ext_v16qi", ftype, ALTIVEC_BUILTIN_VEC_EXT_V16QI);
ftype = build_function_type_list (float_type_node, V4SF_type_node,
integer_type_node, NULL_TREE);
- def_builtin (MASK_ALTIVEC|MASK_VSX, "__builtin_vec_ext_v4sf", ftype,
- ALTIVEC_BUILTIN_VEC_EXT_V4SF);
+ def_builtin ("__builtin_vec_ext_v4sf", ftype, ALTIVEC_BUILTIN_VEC_EXT_V4SF);
- if (TARGET_VSX)
- {
- ftype = build_function_type_list (double_type_node, V2DF_type_node,
- integer_type_node, NULL_TREE);
- def_builtin (MASK_VSX, "__builtin_vec_ext_v2df", ftype,
- VSX_BUILTIN_VEC_EXT_V2DF);
+ ftype = build_function_type_list (double_type_node, V2DF_type_node,
+ integer_type_node, NULL_TREE);
+ def_builtin ("__builtin_vec_ext_v2df", ftype, VSX_BUILTIN_VEC_EXT_V2DF);
- ftype = build_function_type_list (intDI_type_node, V2DI_type_node,
- integer_type_node, NULL_TREE);
- def_builtin (MASK_VSX, "__builtin_vec_ext_v2di", ftype,
- VSX_BUILTIN_VEC_EXT_V2DI);
- }
+ ftype = build_function_type_list (intDI_type_node, V2DI_type_node,
+ integer_type_node, NULL_TREE);
+ def_builtin ("__builtin_vec_ext_v2di", ftype, VSX_BUILTIN_VEC_EXT_V2DI);
}
/* Hash function for builtin functions with up to 3 arguments and a return
@@ -13044,13 +12487,13 @@ builtin_function_type (enum machine_mode mode_ret, enum machine_mode mode_arg0,
/* unsigned args, signed return. */
case VSX_BUILTIN_XVCVUXDDP_UNS:
- case VECTOR_BUILTIN_UNSFLOAT_V4SI_V4SF:
+ case ALTIVEC_BUILTIN_UNSFLOAT_V4SI_V4SF:
h.uns_p[1] = 1;
break;
/* signed args, unsigned return. */
case VSX_BUILTIN_XVCVDPUXDS_UNS:
- case VECTOR_BUILTIN_FIXUNS_V4SF_V4SI:
+ case ALTIVEC_BUILTIN_FIXUNS_V4SF_V4SI:
h.uns_p[0] = 1;
break;
@@ -13117,6 +12560,7 @@ rs6000_common_init_builtins (void)
tree v2si_ftype_qi = NULL_TREE;
tree v2si_ftype_v2si_qi = NULL_TREE;
tree v2si_ftype_int_qi = NULL_TREE;
+ unsigned builtin_mask = rs6000_builtin_mask;
if (!TARGET_PAIRED_FLOAT)
{
@@ -13124,21 +12568,30 @@ rs6000_common_init_builtins (void)
builtin_mode_to_type[V2SFmode][0] = opaque_V2SF_type_node;
}
+ /* Paired and SPE builtins are only available if you build a compiler with
+ the appropriate options, so only create those builtins with the
+ appropriate compiler option. Create Altivec and VSX builtins on machines
+ with at least the general purpose extensions (970 and newer) to allow the
+ use of the target attribute.. */
+
+ if (TARGET_EXTRA_BUILTINS)
+ builtin_mask |= RS6000_BTM_COMMON;
+
/* Add the ternary operators. */
d = bdesc_3arg;
for (i = 0; i < ARRAY_SIZE (bdesc_3arg); i++, d++)
{
tree type;
- int mask = d->mask;
+ unsigned mask = d->mask;
- if ((mask != 0 && (mask & target_flags) == 0)
- || (mask == 0 && !TARGET_PAIRED_FLOAT))
- continue;
+ if ((mask & builtin_mask) != mask)
+ {
+ if (TARGET_DEBUG_BUILTIN)
+ fprintf (stderr, "rs6000_builtin, skip ternary %s\n", d->name);
+ continue;
+ }
- if ((d->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && d->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
- || (d->code >= VSX_BUILTIN_OVERLOADED_FIRST
- && d->code <= VSX_BUILTIN_OVERLOADED_LAST))
+ if (rs6000_overloaded_builtin_p (d->code))
{
if (! (type = opaque_ftype_opaque_opaque_opaque))
type = opaque_ftype_opaque_opaque_opaque
@@ -13161,7 +12614,7 @@ rs6000_common_init_builtins (void)
d->code, d->name);
}
- def_builtin (d->mask, d->name, type, d->code);
+ def_builtin (d->name, type, d->code);
}
/* Add the binary operators. */
@@ -13170,16 +12623,16 @@ rs6000_common_init_builtins (void)
{
enum machine_mode mode0, mode1, mode2;
tree type;
- int mask = d->mask;
+ unsigned mask = d->mask;
- if ((mask != 0 && (mask & target_flags) == 0)
- || (mask == 0 && !TARGET_PAIRED_FLOAT))
- continue;
+ if ((mask & builtin_mask) != mask)
+ {
+ if (TARGET_DEBUG_BUILTIN)
+ fprintf (stderr, "rs6000_builtin, skip binary %s\n", d->name);
+ continue;
+ }
- if ((d->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && d->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
- || (d->code >= VSX_BUILTIN_OVERLOADED_FIRST
- && d->code <= VSX_BUILTIN_OVERLOADED_LAST))
+ if (rs6000_overloaded_builtin_p (d->code))
{
if (! (type = opaque_ftype_opaque_opaque))
type = opaque_ftype_opaque_opaque
@@ -13224,25 +12677,25 @@ rs6000_common_init_builtins (void)
d->code, d->name);
}
- def_builtin (d->mask, d->name, type, d->code);
+ def_builtin (d->name, type, d->code);
}
/* Add the simple unary operators. */
- d = (struct builtin_description *) bdesc_1arg;
+ d = bdesc_1arg;
for (i = 0; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
{
enum machine_mode mode0, mode1;
tree type;
- int mask = d->mask;
+ unsigned mask = d->mask;
- if ((mask != 0 && (mask & target_flags) == 0)
- || (mask == 0 && !TARGET_PAIRED_FLOAT))
- continue;
+ if ((mask & builtin_mask) != mask)
+ {
+ if (TARGET_DEBUG_BUILTIN)
+ fprintf (stderr, "rs6000_builtin, skip unary %s\n", d->name);
+ continue;
+ }
- if ((d->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && d->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
- || (d->code >= VSX_BUILTIN_OVERLOADED_FIRST
- && d->code <= VSX_BUILTIN_OVERLOADED_LAST))
+ if (rs6000_overloaded_builtin_p (d->code))
{
if (! (type = opaque_ftype_opaque))
type = opaque_ftype_opaque
@@ -13273,7 +12726,7 @@ rs6000_common_init_builtins (void)
d->code, d->name);
}
- def_builtin (d->mask, d->name, type, d->code);
+ def_builtin (d->name, type, d->code);
}
}
@@ -17352,11 +16805,11 @@ rs6000_expand_atomic_compare_and_swap (rtx operands[])
retval = gen_reg_rtx (SImode);
mode = SImode;
}
+ else if (reg_overlap_mentioned_p (retval, oldval))
+ oldval = copy_to_reg (oldval);
rs6000_pre_atomic_barrier (mod_s);
- emit_move_insn (boolval, const0_rtx);
-
label1 = NULL_RTX;
if (!is_weak)
{
@@ -17374,28 +16827,23 @@ rs6000_expand_atomic_compare_and_swap (rtx operands[])
NULL_RTX, 1, OPTAB_LIB_WIDEN);
}
- x = gen_rtx_NE (VOIDmode, x, oldval);
- x = rs6000_generate_compare (x, mode);
+ cond = gen_reg_rtx (CCmode);
+ x = gen_rtx_COMPARE (CCmode, x, oldval);
+ emit_insn (gen_rtx_SET (VOIDmode, cond, x));
+
+ x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
emit_unlikely_jump (x, label2);
x = newval;
if (mask)
x = rs6000_mask_atomic_subword (retval, newval, mask);
- cond = gen_reg_rtx (CCmode);
emit_store_conditional (mode, cond, mem, x);
- if (is_weak)
- {
- /* ??? It's either this or an unlikely jump over (set bool 1). */
- x = gen_rtx_EQ (SImode, cond, const0_rtx);
- emit_insn (gen_rtx_SET (VOIDmode, boolval, x));
- }
- else
+ if (!is_weak)
{
x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
emit_unlikely_jump (x, label1);
- emit_move_insn (boolval, const1_rtx);
}
if (mod_f != MEMMODEL_RELAXED)
@@ -17408,6 +16856,10 @@ rs6000_expand_atomic_compare_and_swap (rtx operands[])
if (shift)
rs6000_finish_atomic_subword (operands[1], retval, shift);
+
+ /* In all cases, CR0 contains EQ on success, and NE on failure. */
+ x = gen_rtx_EQ (SImode, cond, const0_rtx);
+ emit_insn (gen_rtx_SET (VOIDmode, boolval, x));
}
/* Expand an atomic exchange operation. */
@@ -26347,13 +25799,13 @@ rs6000_builtin_reciprocal (unsigned int fn, bool md_fn,
if (!RS6000_RECIP_AUTO_RSQRTE_P (V2DFmode))
return NULL_TREE;
- return rs6000_builtin_decls[VSX_BUILTIN_VEC_RSQRT_V2DF];
+ return rs6000_builtin_decls[VSX_BUILTIN_RSQRT_2DF];
case VSX_BUILTIN_XVSQRTSP:
if (!RS6000_RECIP_AUTO_RSQRTE_P (V4SFmode))
return NULL_TREE;
- return rs6000_builtin_decls[VSX_BUILTIN_VEC_RSQRT_V4SF];
+ return rs6000_builtin_decls[VSX_BUILTIN_RSQRT_4SF];
default:
return NULL_TREE;
@@ -27226,6 +26678,22 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] =
{ "string", MASK_STRING, false, false },
};
+/* Builtin mask mapping for printing the flags. */
+static struct rs6000_opt_mask const rs6000_builtin_mask_names[] =
+{
+ { "altivec", RS6000_BTM_ALTIVEC, false, false },
+ { "vsx", RS6000_BTM_VSX, false, false },
+ { "spe", RS6000_BTM_SPE, false, false },
+ { "paired", RS6000_BTM_PAIRED, false, false },
+ { "fre", RS6000_BTM_FRE, false, false },
+ { "fres", RS6000_BTM_FRES, false, false },
+ { "frsqrte", RS6000_BTM_FRSQRTE, false, false },
+ { "frsqrtes", RS6000_BTM_FRSQRTES, false, false },
+ { "popcntd", RS6000_BTM_POPCNTD, false, false },
+ { "powerpc", RS6000_BTM_POWERPC, false, false },
+ { "cell", RS6000_BTM_CELL, false, false },
+};
+
/* Option variables that we want to support inside attribute((target)) and
#pragma GCC target operations. */
@@ -27528,7 +26996,11 @@ rs6000_valid_attribute_p (tree fndecl,
bool
rs6000_pragma_target_parse (tree args, tree pop_target)
{
+ tree prev_tree = build_target_option_node ();
tree cur_tree;
+ struct cl_target_option *prev_opt, *cur_opt;
+ unsigned prev_bumask, cur_bumask, diff_bumask;
+ int prev_flags, cur_flags, diff_flags;
bool ret;
if (TARGET_DEBUG_TARGET)
@@ -27565,11 +27037,43 @@ rs6000_pragma_target_parse (tree args, tree pop_target)
cur_tree = build_target_option_node ();
if (!cur_tree)
- ret = false;
+ {
+ if (TARGET_DEBUG_BUILTIN || TARGET_DEBUG_TARGET)
+ fprintf (stderr, "build_target_option_node returned NULL\n");
+ return false;
+ }
}
- if (cur_tree)
- target_option_current_node = cur_tree;
+ target_option_current_node = cur_tree;
+
+ /* If we have the preprocessor linked in (i.e. C or C++ languages), possibly
+ change the macros that are defined. */
+ if (rs6000_target_modify_macros_ptr)
+ {
+ prev_opt = TREE_TARGET_OPTION (prev_tree);
+ prev_bumask = prev_opt->x_rs6000_builtin_mask;
+ prev_flags = prev_opt->x_target_flags;
+
+ cur_opt = TREE_TARGET_OPTION (cur_tree);
+ cur_flags = cur_opt->x_target_flags;
+ cur_bumask = cur_opt->x_rs6000_builtin_mask;
+
+ diff_bumask = (prev_bumask ^ cur_bumask);
+ diff_flags = (prev_flags ^ cur_flags);
+
+ if ((diff_flags != 0) || (diff_bumask != 0))
+ {
+ /* Delete old macros. */
+ rs6000_target_modify_macros_ptr (false,
+ prev_flags & diff_flags,
+ prev_bumask & diff_bumask);
+
+ /* Define new macros. */
+ rs6000_target_modify_macros_ptr (true,
+ cur_flags & diff_flags,
+ cur_bumask & diff_bumask);
+ }
+ }
return ret;
}
@@ -27678,6 +27182,7 @@ rs6000_function_specific_print (FILE *file, int indent,
{
size_t i;
int flags = ptr->x_target_flags;
+ unsigned bu_mask = ptr->x_rs6000_builtin_mask;
/* Print the various mask options. */
for (i = 0; i < ARRAY_SIZE (rs6000_opt_masks); i++)
@@ -27697,6 +27202,15 @@ rs6000_function_specific_print (FILE *file, int indent,
fprintf (file, "%*s-m%s\n", indent, "",
rs6000_opt_vars[i].name);
}
+
+ /* Print the various builtin flags. */
+ fprintf (file, "%*sbuiltin mask = 0x%x\n", indent, "", bu_mask);
+ for (i = 0; i < ARRAY_SIZE (rs6000_builtin_mask_names); i++)
+ if ((bu_mask & rs6000_builtin_mask_names[i].mask) != 0)
+ {
+ fprintf (file, "%*s%s builtins supported\n", indent, "",
+ rs6000_builtin_mask_names[i].name);
+ }
}
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index d0cfabb8449..6bd2b8d3108 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -373,12 +373,14 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define MASK_DEBUG_ADDR 0x08 /* debug memory addressing */
#define MASK_DEBUG_COST 0x10 /* debug rtx codes */
#define MASK_DEBUG_TARGET 0x20 /* debug target attribute/pragma */
+#define MASK_DEBUG_BUILTIN 0x40 /* debug builtins */
#define MASK_DEBUG_ALL (MASK_DEBUG_STACK \
| MASK_DEBUG_ARG \
| MASK_DEBUG_REG \
| MASK_DEBUG_ADDR \
| MASK_DEBUG_COST \
- | MASK_DEBUG_TARGET)
+ | MASK_DEBUG_TARGET \
+ | MASK_DEBUG_BUILTIN)
#define TARGET_DEBUG_STACK (rs6000_debug & MASK_DEBUG_STACK)
#define TARGET_DEBUG_ARG (rs6000_debug & MASK_DEBUG_ARG)
@@ -386,6 +388,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define TARGET_DEBUG_ADDR (rs6000_debug & MASK_DEBUG_ADDR)
#define TARGET_DEBUG_COST (rs6000_debug & MASK_DEBUG_COST)
#define TARGET_DEBUG_TARGET (rs6000_debug & MASK_DEBUG_TARGET)
+#define TARGET_DEBUG_BUILTIN (rs6000_debug & MASK_DEBUG_BUILTIN)
extern enum rs6000_vector rs6000_vector_unit[];
@@ -480,6 +483,24 @@ extern int rs6000_vector_align[];
#define TARGET_FCTIDUZ TARGET_POPCNTD
#define TARGET_FCTIWUZ TARGET_POPCNTD
+/* For power systems, we want to enable Altivec and VSX builtins even if the
+ user did not use -maltivec or -mvsx to allow the builtins to be used inside
+ of #pragma GCC target or the target attribute to change the code level for a
+ given system. The SPE and Paired builtins are only enabled if you configure
+ the compiler for those builtins, and those machines don't support altivec or
+ VSX. */
+
+#define TARGET_EXTRA_BUILTINS (!TARGET_SPE && !TARGET_PAIRED_FLOAT \
+ && ((TARGET_POWERPC64 \
+ || TARGET_PPC_GPOPT /* 970 */ \
+ || TARGET_POPCNTB /* ISA 2.02 */ \
+ || TARGET_CMPB /* ISA 2.05 */ \
+ || TARGET_POPCNTD /* ISA 2.06 */ \
+ || TARGET_ALTIVEC \
+ || TARGET_VSX)))
+
+
+
/* E500 processors only support plain "sync", not lwsync. */
#define TARGET_NO_LWSYNC TARGET_E500
@@ -531,6 +552,7 @@ extern unsigned char rs6000_recip_bits[];
c_register_pragma (0, "longcall", rs6000_pragma_longcall); \
targetm.target_option.pragma_parse = rs6000_pragma_target_parse; \
targetm.resolve_overloaded_builtin = altivec_resolve_overloaded_builtin; \
+ rs6000_target_modify_macros_ptr = rs6000_target_modify_macros; \
} while (0)
/* Target #defines. */
@@ -2271,24 +2293,83 @@ extern char rs6000_reg_names[][8]; /* register names (0 vs. %r0). */
/* General flags. */
extern int frame_pointer_needed;
-/* Classification of the builtin functions to properly set the declaration tree
- flags. */
-enum rs6000_btc
-{
- RS6000_BTC_MISC, /* assume builtin can do anything */
- RS6000_BTC_CONST, /* builtin is a 'const' function. */
- RS6000_BTC_PURE, /* builtin is a 'pure' function. */
- RS6000_BTC_FP_PURE /* builtin is 'pure' if rounding math. */
-};
+/* Classification of the builtin functions as to which switches enable the
+ builtin, and what attributes it should have. We used to use the target
+ flags macros, but we've run out of bits, so we now map the options into new
+ settings used here. */
+
+/* Builtin attributes. */
+#define RS6000_BTC_SPECIAL 0x00000000 /* Special function. */
+#define RS6000_BTC_UNARY 0x00000001 /* normal unary function. */
+#define RS6000_BTC_BINARY 0x00000002 /* normal binary function. */
+#define RS6000_BTC_TERNARY 0x00000003 /* normal ternary function. */
+#define RS6000_BTC_PREDICATE 0x00000004 /* predicate function. */
+#define RS6000_BTC_ABS 0x00000005 /* Altivec/VSX ABS function. */
+#define RS6000_BTC_EVSEL 0x00000006 /* SPE EVSEL function. */
+#define RS6000_BTC_DST 0x00000007 /* Altivec DST function. */
+#define RS6000_BTC_TYPE_MASK 0x0000000f /* Mask to isolate types */
+
+#define RS6000_BTC_MISC 0x00000000 /* No special attributes. */
+#define RS6000_BTC_CONST 0x00000100 /* uses no global state. */
+#define RS6000_BTC_PURE 0x00000200 /* reads global state/mem. */
+#define RS6000_BTC_FP 0x00000400 /* depends on rounding mode. */
+#define RS6000_BTC_ATTR_MASK 0x00000700 /* Mask of the attributes. */
+
+/* Miscellaneous information. */
+#define RS6000_BTC_OVERLOADED 0x4000000 /* function is overloaded. */
/* Convenience macros to document the instruction type. */
-#define RS6000_BTC_MEM RS6000_BTC_MISC /* load/store touches memory */
-#define RS6000_BTC_SAT RS6000_BTC_MISC /* VMX saturate sets VSCR register */
-
-#undef RS6000_BUILTIN
-#undef RS6000_BUILTIN_EQUATE
-#define RS6000_BUILTIN(NAME, TYPE) NAME,
-#define RS6000_BUILTIN_EQUATE(NAME, VALUE) NAME = VALUE,
+#define RS6000_BTC_MEM RS6000_BTC_MISC /* load/store touches mem. */
+#define RS6000_BTC_SAT RS6000_BTC_MISC /* saturate sets VSCR. */
+
+/* Builtin targets. For now, we reuse the masks for those options that are in
+ target flags, and pick two random bits for SPE and paired which aren't in
+ target_flags. */
+#define RS6000_BTM_ALTIVEC MASK_ALTIVEC /* VMX/altivec vectors. */
+#define RS6000_BTM_VSX MASK_VSX /* VSX (vector/scalar). */
+#define RS6000_BTM_SPE MASK_STRING /* E500 */
+#define RS6000_BTM_PAIRED MASK_MULHW /* 750CL paired insns. */
+#define RS6000_BTM_FRE MASK_POPCNTB /* FRE instruction. */
+#define RS6000_BTM_FRES MASK_PPC_GFXOPT /* FRES instruction. */
+#define RS6000_BTM_FRSQRTE MASK_PPC_GFXOPT /* FRSQRTE instruction. */
+#define RS6000_BTM_FRSQRTES MASK_POPCNTB /* FRSQRTES instruction. */
+#define RS6000_BTM_POPCNTD MASK_POPCNTD /* Target supports ISA 2.06. */
+#define RS6000_BTM_POWERPC MASK_POWERPC /* Target is powerpc. */
+#define RS6000_BTM_CELL MASK_FPRND /* Target is cell powerpc. */
+
+#define RS6000_BTM_COMMON (RS6000_BTM_ALTIVEC \
+ | RS6000_BTM_VSX \
+ | RS6000_BTM_FRE \
+ | RS6000_BTM_FRES \
+ | RS6000_BTM_FRSQRTE \
+ | RS6000_BTM_FRSQRTES \
+ | RS6000_BTM_POPCNTD \
+ | RS6000_BTM_POWERPC \
+ | RS6000_BTM_CELL)
+
+/* Define builtin enum index. */
+
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
+
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
enum rs6000_builtins
{
@@ -2297,8 +2378,16 @@ enum rs6000_builtins
RS6000_BUILTIN_COUNT
};
-#undef RS6000_BUILTIN
-#undef RS6000_BUILTIN_EQUATE
+#undef RS6000_BUILTIN_1
+#undef RS6000_BUILTIN_2
+#undef RS6000_BUILTIN_3
+#undef RS6000_BUILTIN_A
+#undef RS6000_BUILTIN_D
+#undef RS6000_BUILTIN_E
+#undef RS6000_BUILTIN_P
+#undef RS6000_BUILTIN_Q
+#undef RS6000_BUILTIN_S
+#undef RS6000_BUILTIN_X
enum rs6000_builtin_type_index
{
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index fba4f1bcf98..d428133cc74 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -79,6 +79,10 @@ enum rs6000_cmodel rs6000_current_cmodel = CMODEL_SMALL
TargetVariable
unsigned int rs6000_recip_control
+;; Mask of what builtin functions are allowed
+TargetVariable
+unsigned int rs6000_builtin_mask
+
;; Debug flags
TargetVariable
unsigned int rs6000_debug
diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
index fc3f3e176c2..4930f8c3733 100644
--- a/gcc/config/rs6000/vector.md
+++ b/gcc/config/rs6000/vector.md
@@ -677,7 +677,7 @@
}
}")
-(define_expand "unsigned_float<VEC_int><mode>2"
+(define_expand "floatuns<VEC_int><mode>2"
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(unsigned_float:VEC_F (match_operand:<VEC_INT> 1 "vint_operand" "")))]
"VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
diff --git a/gcc/config/sh/constraints.md b/gcc/config/sh/constraints.md
index 40d0d0b4b99..59e7de66662 100644
--- a/gcc/config/sh/constraints.md
+++ b/gcc/config/sh/constraints.md
@@ -75,6 +75,9 @@
(define_register_constraint "t" "T_REGS"
"T register.")
+(define_register_constraint "u" "NON_SP_REGS"
+ "Non-stack-pointer register.")
+
(define_register_constraint "w" "FP0_REGS"
"Floating-point register 0.")
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 2545a63e724..870c39f2602 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -12432,6 +12432,14 @@ sh_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
if (rclass != GENERAL_REGS && REG_P (x)
&& TARGET_REGISTER_P (REGNO (x)))
return GENERAL_REGS;
+
+ /* If here fall back to loading FPUL register through general registers.
+ This case can happen when movsi_ie insn is picked initially to
+ load/store the FPUL register from/to another register, and then the
+ other register is allocated on the stack. */
+ if (rclass == FPUL_REGS && true_regnum (x) == -1)
+ return GENERAL_REGS;
+
return NO_REGS;
}
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 1b98745866e..8ab1f10e31e 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1059,6 +1059,7 @@ enum reg_class
MAC_REGS,
FPUL_REGS,
SIBCALL_REGS,
+ NON_SP_REGS,
GENERAL_REGS,
FP0_REGS,
FP_REGS,
@@ -1084,6 +1085,7 @@ enum reg_class
"MAC_REGS", \
"FPUL_REGS", \
"SIBCALL_REGS", \
+ "NON_SP_REGS", \
"GENERAL_REGS", \
"FP0_REGS", \
"FP_REGS", \
@@ -1116,6 +1118,8 @@ enum reg_class
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00400000 }, \
/* SIBCALL_REGS: Initialized in TARGET_CONDITIONAL_REGISTER_USAGE. */ \
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, \
+/* NON_SP_REGS: */ \
+ { 0xffff7fff, 0xffffffff, 0x00000000, 0x00000000, 0x03020000 }, \
/* GENERAL_REGS: */ \
{ 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x03020000 }, \
/* FP0_REGS: */ \
@@ -2072,7 +2076,7 @@ struct sh_args {
register information here is not used for SFmode. */
#define REGCLASS_HAS_GENERAL_REG(CLASS) \
- ((CLASS) == GENERAL_REGS || (CLASS) == R0_REGS \
+ ((CLASS) == GENERAL_REGS || (CLASS) == R0_REGS || (CLASS) == NON_SP_REGS \
|| (! TARGET_SHMEDIA && (CLASS) == SIBCALL_REGS))
#define REGCLASS_HAS_FP_REG(CLASS) \
diff --git a/gcc/config/sparc/constraints.md b/gcc/config/sparc/constraints.md
index 317602c6e95..472490f2624 100644
--- a/gcc/config/sparc/constraints.md
+++ b/gcc/config/sparc/constraints.md
@@ -19,7 +19,7 @@
;;; Unused letters:
;;; AB
-;;; a jkl q tuvwxyz
+;;; a jkl q tuv xyz
;; Register constraints
@@ -44,6 +44,9 @@
(define_register_constraint "h" "(TARGET_V9 && TARGET_V8PLUS ? I64_REGS : NO_REGS)"
"64-bit global or out register in V8+ mode")
+(define_memory_constraint "w"
+ "A memory with only a base register"
+ (match_operand 0 "mem_noofs_operand"))
;; Floating-point constant constraints
diff --git a/gcc/config/sparc/predicates.md b/gcc/config/sparc/predicates.md
index 4dd734f047e..81e53206498 100644
--- a/gcc/config/sparc/predicates.md
+++ b/gcc/config/sparc/predicates.md
@@ -111,6 +111,10 @@
(define_predicate "const_double_or_vector_operand"
(match_code "const_double,const_vector"))
+;; Return true if OP is Zero, or if the target is V7.
+(define_predicate "zero_or_v7_operand"
+ (ior (match_test "op == const0_rtx")
+ (match_test "!TARGET_V8 && !TARGET_V9")))
;; Predicates for symbolic constants.
@@ -235,6 +239,11 @@
(ior (match_operand 0 "register_operand")
(match_operand 0 "const_zero_operand")))
+(define_predicate "register_or_v9_zero_operand"
+ (ior (match_operand 0 "register_operand")
+ (and (match_test "TARGET_V9")
+ (match_operand 0 "const_zero_operand"))))
+
;; Return true if OP is either the zero constant, the all-ones
;; constant, or a register.
(define_predicate "register_or_zero_or_all_ones_operand"
@@ -462,6 +471,10 @@
(match_test "call_address_operand (XEXP (op, 0), mode)")))
+(define_predicate "mem_noofs_operand"
+ (and (match_code "mem")
+ (match_code "reg" "0")))
+
;; Predicates for operators.
;; Return true if OP is a comparison operator. This allows the use of
diff --git a/gcc/config/sparc/sparc-opts.h b/gcc/config/sparc/sparc-opts.h
index 266cb1403ac..7682eb9d452 100644
--- a/gcc/config/sparc/sparc-opts.h
+++ b/gcc/config/sparc/sparc-opts.h
@@ -47,4 +47,14 @@ enum processor_type {
PROCESSOR_NATIVE
};
+/* Sparc system memory model. See Appendix D in the Sparc V9 manual
+ for formal specification, and Appendix J for more discussion. */
+enum sparc_memory_model_type {
+ SMM_DEFAULT, /* Uninitialized. */
+ SMM_RMO, /* Relaxed Memory Order. */
+ SMM_PSO, /* Partial Store Order. */
+ SMM_TSO, /* Total Store Order. */
+ SMM_SC /* Sequential Consistency. */
+};
+
#endif
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index 10fa5edbb66..52acc096ce3 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -104,7 +104,7 @@ extern int v9_regcmp_p (enum rtx_code);
32 bits of REG are 0 before INSN. */
extern int sparc_check_64 (rtx, rtx);
extern rtx gen_df_reg (rtx, int);
-extern void sparc_expand_compare_and_swap_12 (rtx, rtx, rtx, rtx);
+extern void sparc_expand_compare_and_swap (rtx op[]);
extern void sparc_expand_vector_init (rtx, rtx);
extern void sparc_expand_vec_perm_bmask(enum machine_mode, rtx);
extern bool sparc_expand_conditional_move (enum machine_mode, rtx *);
@@ -113,4 +113,6 @@ unsigned int sparc_regmode_natural_size (enum machine_mode);
bool sparc_modes_tieable_p (enum machine_mode, enum machine_mode);
#endif /* RTX_CODE */
+extern void sparc_emit_membar_for_model (enum memmodel, int, int);
+
#endif /* __SPARC_PROTOS_H__ */
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index b315698bc94..713db26ee0b 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1160,6 +1160,17 @@ sparc_option_override (void)
gcc_unreachable ();
};
+ if (sparc_memory_model == SMM_DEFAULT)
+ {
+ /* Choose the most relaxed model for the processor. */
+ if (TARGET_V9)
+ sparc_memory_model = SMM_RMO;
+ else if (TARGET_V8)
+ sparc_memory_model = SMM_PSO;
+ else
+ sparc_memory_model = SMM_SC;
+ }
+
#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
target_flags |= MASK_LONG_DOUBLE_128;
@@ -10849,11 +10860,95 @@ sparc_mangle_type (const_tree type)
}
#endif
+/* Expand a membar instruction for various use cases. Both the LOAD_STORE
+ and BEFORE_AFTER arguments of the form X_Y. They are two-bit masks where
+ bit 0 indicates that X is true, and bit 1 indicates Y is true. */
+
+void
+sparc_emit_membar_for_model (enum memmodel model,
+ int load_store, int before_after)
+{
+ /* Bits for the MEMBAR mmask field. */
+ const int LoadLoad = 1;
+ const int StoreLoad = 2;
+ const int LoadStore = 4;
+ const int StoreStore = 8;
+
+ int mm = 0, implied = 0;
+
+ switch (sparc_memory_model)
+ {
+ case SMM_SC:
+ /* Sequential Consistency. All memory transactions are immediately
+ visible in sequential execution order. No barriers needed. */
+ implied = LoadLoad | StoreLoad | LoadStore | StoreStore;
+ break;
+
+ case SMM_TSO:
+ /* Total Store Ordering: all memory transactions with store semantics
+ are followed by an implied StoreStore. */
+ implied |= StoreStore;
+ /* FALLTHRU */
+
+ case SMM_PSO:
+ /* Partial Store Ordering: all memory transactions with load semantics
+ are followed by an implied LoadLoad | LoadStore. */
+ implied |= LoadLoad | LoadStore;
+
+ /* If we're not looking for a raw barrer (before+after), then atomic
+ operations get the benefit of being both load and store. */
+ if (load_store == 3 && before_after == 2)
+ implied |= StoreLoad | StoreStore;
+ /* FALLTHRU */
+
+ case SMM_RMO:
+ /* Relaxed Memory Ordering: no implicit bits. */
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ if (before_after & 1)
+ {
+ if (model == MEMMODEL_ACQUIRE
+ || model == MEMMODEL_ACQ_REL
+ || model == MEMMODEL_SEQ_CST)
+ {
+ if (load_store & 1)
+ mm |= LoadLoad | LoadStore;
+ if (load_store & 2)
+ mm |= StoreLoad | StoreStore;
+ }
+ }
+ if (before_after & 2)
+ {
+ if (model == MEMMODEL_RELEASE
+ || model == MEMMODEL_ACQ_REL
+ || model == MEMMODEL_SEQ_CST)
+ {
+ if (load_store & 1)
+ mm |= LoadLoad | StoreLoad;
+ if (load_store & 2)
+ mm |= LoadStore | StoreStore;
+ }
+ }
+
+ /* Remove the bits implied by the system memory model. */
+ mm &= ~implied;
+
+ /* For raw barriers (before+after), always emit a barrier.
+ This will become a compile-time barrier if needed. */
+ if (mm || before_after == 3)
+ emit_insn (gen_membar (GEN_INT (mm)));
+}
+
/* Expand code to perform a 8 or 16-bit compare and swap by doing 32-bit
compare and swap on the word containing the byte or half-word. */
-void
-sparc_expand_compare_and_swap_12 (rtx result, rtx mem, rtx oldval, rtx newval)
+static void
+sparc_expand_compare_and_swap_12 (rtx bool_result, rtx result, rtx mem,
+ rtx oldval, rtx newval)
{
rtx addr1 = force_reg (Pmode, XEXP (mem, 0));
rtx addr = gen_reg_rtx (Pmode);
@@ -10878,7 +10973,7 @@ sparc_expand_compare_and_swap_12 (rtx result, rtx mem, rtx oldval, rtx newval)
set_mem_alias_set (memsi, ALIAS_SET_MEMORY_BARRIER);
MEM_VOLATILE_P (memsi) = MEM_VOLATILE_P (mem);
- val = force_reg (SImode, memsi);
+ val = copy_to_reg (memsi);
emit_insn (gen_rtx_SET (VOIDmode, off,
gen_rtx_XOR (SImode, off,
@@ -10924,7 +11019,9 @@ sparc_expand_compare_and_swap_12 (rtx result, rtx mem, rtx oldval, rtx newval)
emit_insn (gen_rtx_SET (VOIDmode, newvalue,
gen_rtx_IOR (SImode, newv, val)));
- emit_insn (gen_sync_compare_and_swapsi (res, memsi, oldvalue, newvalue));
+ emit_move_insn (bool_result, const1_rtx);
+
+ emit_insn (gen_atomic_compare_and_swapsi_1 (res, memsi, oldvalue, newvalue));
emit_cmp_and_jump_insns (res, oldvalue, EQ, NULL, SImode, 0, end_label);
@@ -10932,6 +11029,8 @@ sparc_expand_compare_and_swap_12 (rtx result, rtx mem, rtx oldval, rtx newval)
gen_rtx_AND (SImode, gen_rtx_NOT (SImode, mask),
res)));
+ emit_move_insn (bool_result, const0_rtx);
+
cc = gen_compare_reg_1 (NE, resv, val);
emit_insn (gen_rtx_SET (VOIDmode, val, resv));
@@ -10950,6 +11049,49 @@ sparc_expand_compare_and_swap_12 (rtx result, rtx mem, rtx oldval, rtx newval)
emit_move_insn (result, gen_lowpart (GET_MODE (result), res));
}
+/* Expand code to perform a compare-and-swap. */
+
+void
+sparc_expand_compare_and_swap (rtx operands[])
+{
+ rtx bval, retval, mem, oldval, newval;
+ enum machine_mode mode;
+ enum memmodel model;
+
+ bval = operands[0];
+ retval = operands[1];
+ mem = operands[2];
+ oldval = operands[3];
+ newval = operands[4];
+ model = (enum memmodel) INTVAL (operands[6]);
+ mode = GET_MODE (mem);
+
+ sparc_emit_membar_for_model (model, 3, 1);
+
+ if (reg_overlap_mentioned_p (retval, oldval))
+ oldval = copy_to_reg (oldval);
+
+ if (mode == QImode || mode == HImode)
+ sparc_expand_compare_and_swap_12 (bval, retval, mem, oldval, newval);
+ else
+ {
+ rtx (*gen) (rtx, rtx, rtx, rtx);
+ rtx x;
+
+ if (mode == SImode)
+ gen = gen_atomic_compare_and_swapsi_1;
+ else
+ gen = gen_atomic_compare_and_swapdi_1;
+ emit_insn (gen (retval, mem, oldval, newval));
+
+ x = emit_store_flag (bval, EQ, retval, oldval, mode, 1, 1);
+ if (x != bval)
+ convert_move (bval, x, 1);
+ }
+
+ sparc_emit_membar_for_model (model, 3, 2);
+}
+
void
sparc_expand_vec_perm_bmask (enum machine_mode vmode, rtx sel)
{
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index c059dc5e730..37ac1701b69 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -41,6 +41,7 @@
(UNSPEC_MOVE_GOTDATA 19)
(UNSPEC_MEMBAR 20)
+ (UNSPEC_ATOMIC 21)
(UNSPEC_TLSGD 30)
(UNSPEC_TLSLDM 31)
diff --git a/gcc/config/sparc/sparc.opt b/gcc/config/sparc/sparc.opt
index cb807fdad65..01f3d43b2ca 100644
--- a/gcc/config/sparc/sparc.opt
+++ b/gcc/config/sparc/sparc.opt
@@ -215,3 +215,25 @@ Mask(V9)
Mask(DEPRECATED_V8_INSNS)
;; Generate code that uses the V8 instructions deprecated
;; in the V9 architecture.
+
+mmemory-model=
+Target RejectNegative Joined Var(sparc_memory_model) Enum(sparc_memory_model) Init(SMM_DEFAULT)
+Specify the memory model in effect for the program.
+
+Enum
+Name(sparc_memory_model) Type(enum sparc_memory_model_type)
+
+EnumValue
+Enum(sparc_memory_model) String(default) Value(SMM_DEFAULT)
+
+EnumValue
+Enum(sparc_memory_model) String(rmo) Value(SMM_RMO)
+
+EnumValue
+Enum(sparc_memory_model) String(pso) Value(SMM_PSO)
+
+EnumValue
+Enum(sparc_memory_model) String(tso) Value(SMM_TSO)
+
+EnumValue
+Enum(sparc_memory_model) String(sc) Value(SMM_SC)
diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index a7380ab3c70..be8c4c4783a 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -1,5 +1,5 @@
;; GCC machine description for SPARC synchronization instructions.
-;; Copyright (C) 2005, 2007, 2009, 2010
+;; Copyright (C) 2005, 2007, 2009, 2010, 2011
;; Free Software Foundation, Inc.
;;
;; This file is part of GCC.
@@ -19,87 +19,184 @@
;; <http://www.gnu.org/licenses/>.
(define_mode_iterator I12MODE [QI HI])
+(define_mode_iterator I124MODE [QI HI SI])
(define_mode_iterator I24MODE [HI SI])
(define_mode_iterator I48MODE [SI (DI "TARGET_ARCH64 || TARGET_V8PLUS")])
(define_mode_attr modesuffix [(SI "") (DI "x")])
-(define_expand "memory_barrier"
- [(set (match_dup 0)
- (unspec:BLK [(match_dup 0)] UNSPEC_MEMBAR))]
+(define_expand "mem_thread_fence"
+ [(match_operand:SI 0 "const_int_operand")]
"TARGET_V8 || TARGET_V9"
{
- operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
- MEM_VOLATILE_P (operands[0]) = 1;
+ enum memmodel model = (enum memmodel) INTVAL (operands[0]);
+ sparc_emit_membar_for_model (model, 3, 3);
+ DONE;
+})
+
+(define_expand "membar"
+ [(set (match_dup 1)
+ (unspec:BLK [(match_dup 1)
+ (match_operand:SI 0 "const_int_operand")]
+ UNSPEC_MEMBAR))]
+ "TARGET_V8 || TARGET_V9"
+{
+ operands[1] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+ MEM_VOLATILE_P (operands[1]) = 1;
})
-;; In V8, loads are blocking and ordered wrt earlier loads, i.e. every load
-;; is virtually followed by a load barrier (membar #LoadStore | #LoadLoad).
-;; In PSO, stbar orders the stores (membar #StoreStore).
-;; In TSO, ldstub orders the stores wrt subsequent loads (membar #StoreLoad).
-;; The combination of the three yields a full memory barrier in all cases.
+;; A compiler-only memory barrier. Generic code, when checking for the
+;; existance of various named patterns, uses asm("":::"memory") when we
+;; don't need an actual instruction. Here, it's easiest to pretend that
+;; membar 0 is such a barrier. Further, this gives us a nice hook to
+;; ignore all such barriers on Sparc V7.
+(define_insn "*membar_empty"
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_dup 0) (match_operand:SI 1 "zero_or_v7_operand")]
+ UNSPEC_MEMBAR))]
+ ""
+ ""
+ [(set_attr "type" "multi")
+ (set_attr "length" "0")])
+
+;; For V8, STBAR is exactly membar #StoreStore, by definition.
+(define_insn "*membar_storestore"
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_dup 0) (const_int 8)] UNSPEC_MEMBAR))]
+ "TARGET_V8"
+ "stbar"
+ [(set_attr "type" "multi")])
+
+;; For V8, LDSTUB has the effect of membar #StoreLoad
+(define_insn "*membar_storeload"
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))]
+ "TARGET_V8"
+ "ldstub\t[%%sp-1], %%g0"
+ [(set_attr "type" "multi")])
+
+;; Put the two together, in combination with the fact that V8 implements PSO
+;; as its weakest memory model, means a full barrier. Match all remaining
+;; instances of the membar pattern for Sparc V8.
(define_insn "*membar_v8"
[(set (match_operand:BLK 0 "" "")
- (unspec:BLK [(match_dup 0)] UNSPEC_MEMBAR))]
+ (unspec:BLK [(match_dup 0) (match_operand:SI 1 "const_int_operand")]
+ UNSPEC_MEMBAR))]
"TARGET_V8"
"stbar\n\tldstub\t[%%sp-1], %%g0"
[(set_attr "type" "multi")
(set_attr "length" "2")])
-;; membar #StoreStore | #LoadStore | #StoreLoad | #LoadLoad
+;; For V9, we have the full membar instruction.
(define_insn "*membar"
[(set (match_operand:BLK 0 "" "")
- (unspec:BLK [(match_dup 0)] UNSPEC_MEMBAR))]
+ (unspec:BLK [(match_dup 0) (match_operand:SI 1 "const_int_operand")]
+ UNSPEC_MEMBAR))]
"TARGET_V9"
- "membar\t15"
+ "membar\t%1"
[(set_attr "type" "multi")])
-(define_expand "sync_compare_and_swap<mode>"
- [(match_operand:I12MODE 0 "register_operand" "")
- (match_operand:I12MODE 1 "memory_operand" "")
- (match_operand:I12MODE 2 "register_operand" "")
- (match_operand:I12MODE 3 "register_operand" "")]
- "TARGET_V9"
+(define_expand "atomic_load<mode>"
+ [(match_operand:I 0 "register_operand" "")
+ (match_operand:I 1 "memory_operand" "")
+ (match_operand:SI 2 "const_int_operand" "")]
+ ""
+{
+ enum memmodel model = (enum memmodel) INTVAL (operands[2]);
+
+ sparc_emit_membar_for_model (model, 1, 1);
+
+ if (TARGET_ARCH64 || <MODE>mode != DImode)
+ emit_move_insn (operands[0], operands[1]);
+ else
+ emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1]));
+
+ sparc_emit_membar_for_model (model, 1, 2);
+ DONE;
+})
+
+(define_insn "atomic_loaddi_1"
+ [(set (match_operand:DI 0 "register_operand" "=U,?*f")
+ (unspec:DI [(match_operand:DI 1 "memory_operand" "m,m")]
+ UNSPEC_ATOMIC))]
+ "!TARGET_ARCH64"
+ "ldd\t%1, %0"
+ [(set_attr "type" "load,fpload")])
+
+(define_expand "atomic_store<mode>"
+ [(match_operand:I 0 "register_operand" "")
+ (match_operand:I 1 "memory_operand" "")
+ (match_operand:SI 2 "const_int_operand" "")]
+ ""
+{
+ enum memmodel model = (enum memmodel) INTVAL (operands[2]);
+
+ sparc_emit_membar_for_model (model, 2, 1);
+
+ if (TARGET_ARCH64 || <MODE>mode != DImode)
+ emit_move_insn (operands[0], operands[1]);
+ else
+ emit_insn (gen_atomic_storedi_1 (operands[0], operands[1]));
+
+ sparc_emit_membar_for_model (model, 2, 2);
+ DONE;
+})
+
+(define_insn "atomic_storedi_1"
+ [(set (match_operand:DI 0 "memory_operand" "=m,m,m")
+ (unspec:DI
+ [(match_operand:DI 1 "register_or_v9_zero_operand" "J,U,?*f")]
+ UNSPEC_ATOMIC))]
+ "!TARGET_ARCH64"
+ "@
+ stx\t%r1, %0
+ std\t%1, %0
+ std\t%1, %0"
+ [(set_attr "type" "store,store,fpstore")
+ (set_attr "cpu_feature" "v9,*,*")])
+
+(define_expand "atomic_compare_and_swap<mode>"
+ [(match_operand:SI 0 "register_operand" "") ;; bool output
+ (match_operand:I 1 "register_operand" "") ;; val output
+ (match_operand:I 2 "mem_noofs_operand" "") ;; memory
+ (match_operand:I 3 "register_operand" "") ;; expected
+ (match_operand:I 4 "register_operand" "") ;; desired
+ (match_operand:SI 5 "const_int_operand" "") ;; is_weak
+ (match_operand:SI 6 "const_int_operand" "") ;; mod_s
+ (match_operand:SI 7 "const_int_operand" "")] ;; mod_f
+ "TARGET_V9 && (<MODE>mode != DImode || TARGET_ARCH64 || TARGET_V8PLUS)"
{
- sparc_expand_compare_and_swap_12 (operands[0], operands[1],
- operands[2], operands[3]);
+ sparc_expand_compare_and_swap (operands);
DONE;
})
-(define_expand "sync_compare_and_swap<mode>"
+(define_expand "atomic_compare_and_swap<mode>_1"
[(parallel
[(set (match_operand:I48MODE 0 "register_operand" "")
- (match_operand:I48MODE 1 "memory_operand" ""))
+ (match_operand:I48MODE 1 "mem_noofs_operand" ""))
(set (match_dup 1)
(unspec_volatile:I48MODE
[(match_operand:I48MODE 2 "register_operand" "")
(match_operand:I48MODE 3 "register_operand" "")]
UNSPECV_CAS))])]
"TARGET_V9"
-{
- if (!REG_P (XEXP (operands[1], 0)))
- {
- rtx addr = force_reg (Pmode, XEXP (operands[1], 0));
- operands[1] = replace_equiv_address (operands[1], addr);
- }
- emit_insn (gen_memory_barrier ());
-})
+ "")
-(define_insn "*sync_compare_and_swap<mode>"
+(define_insn "*atomic_compare_and_swap<mode>_1"
[(set (match_operand:I48MODE 0 "register_operand" "=r")
- (mem:I48MODE (match_operand 1 "register_operand" "r")))
- (set (mem:I48MODE (match_dup 1))
+ (match_operand:I48MODE 1 "mem_noofs_operand" "+w"))
+ (set (match_dup 1)
(unspec_volatile:I48MODE
[(match_operand:I48MODE 2 "register_operand" "r")
(match_operand:I48MODE 3 "register_operand" "0")]
UNSPECV_CAS))]
"TARGET_V9 && (<MODE>mode == SImode || TARGET_ARCH64)"
- "cas<modesuffix>\t[%1], %2, %0"
+ "cas<modesuffix>\t%1, %2, %0"
[(set_attr "type" "multi")])
-(define_insn "*sync_compare_and_swapdi_v8plus"
+(define_insn "*atomic_compare_and_swapdi_v8plus"
[(set (match_operand:DI 0 "register_operand" "=h")
- (mem:DI (match_operand 1 "register_operand" "r")))
- (set (mem:DI (match_dup 1))
+ (match_operand:DI 1 "mem_noofs_operand" "+w"))
+ (set (match_dup 1)
(unspec_volatile:DI
[(match_operand:DI 2 "register_operand" "h")
(match_operand:DI 3 "register_operand" "0")]
@@ -114,50 +211,28 @@
output_asm_insn ("srl\t%L2, 0, %L2", operands);
output_asm_insn ("sllx\t%H2, 32, %H3", operands);
output_asm_insn ("or\t%L2, %H3, %H3", operands);
- output_asm_insn ("casx\t[%1], %H3, %L3", operands);
+ output_asm_insn ("casx\t%1, %H3, %L3", operands);
return "srlx\t%L3, 32, %H3";
}
[(set_attr "type" "multi")
(set_attr "length" "8")])
-(define_expand "sync_lock_test_and_set<mode>"
- [(match_operand:I12MODE 0 "register_operand" "")
- (match_operand:I12MODE 1 "memory_operand" "")
- (match_operand:I12MODE 2 "arith_operand" "")]
- "!TARGET_V9"
+(define_expand "atomic_exchangesi"
+ [(match_operand:SI 0 "register_operand" "")
+ (match_operand:SI 1 "memory_operand" "")
+ (match_operand:SI 2 "register_operand" "")
+ (match_operand:SI 3 "const_int_operand" "")]
+ "TARGET_V8 || TARGET_V9"
{
- if (operands[2] != const1_rtx)
- FAIL;
- if (TARGET_V8)
- emit_insn (gen_memory_barrier ());
- if (<MODE>mode != QImode)
- operands[1] = adjust_address (operands[1], QImode, 0);
- emit_insn (gen_ldstub<mode> (operands[0], operands[1]));
- DONE;
-})
+ enum memmodel model = (enum memmodel) INTVAL (operands[3]);
-(define_expand "sync_lock_test_and_setsi"
- [(parallel
- [(set (match_operand:SI 0 "register_operand" "")
- (unspec_volatile:SI [(match_operand:SI 1 "memory_operand" "")]
- UNSPECV_SWAP))
- (set (match_dup 1)
- (match_operand:SI 2 "arith_operand" ""))])]
- ""
-{
- if (! TARGET_V8 && ! TARGET_V9)
- {
- if (operands[2] != const1_rtx)
- FAIL;
- operands[1] = adjust_address (operands[1], QImode, 0);
- emit_insn (gen_ldstubsi (operands[0], operands[1]));
- DONE;
- }
- emit_insn (gen_memory_barrier ());
- operands[2] = force_reg (SImode, operands[2]);
+ sparc_emit_membar_for_model (model, 3, 1);
+ emit_insn (gen_swapsi (operands[0], operands[1], operands[2]));
+ sparc_emit_membar_for_model (model, 3, 2);
+ DONE;
})
-(define_insn "*swapsi"
+(define_insn "swapsi"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec_volatile:SI [(match_operand:SI 1 "memory_operand" "+m")]
UNSPECV_SWAP))
@@ -167,24 +242,25 @@
"swap\t%1, %0"
[(set_attr "type" "multi")])
-(define_expand "ldstubqi"
- [(parallel [(set (match_operand:QI 0 "register_operand" "")
- (unspec_volatile:QI [(match_operand:QI 1 "memory_operand" "")]
- UNSPECV_LDSTUB))
- (set (match_dup 1) (const_int -1))])]
+(define_expand "atomic_test_and_set<mode>"
+ [(match_operand:I124MODE 0 "register_operand" "")
+ (match_operand:I124MODE 1 "memory_operand" "")
+ (match_operand:SI 2 "const_int_operand" "")]
""
- "")
+{
+ enum memmodel model = (enum memmodel) INTVAL (operands[2]);
-(define_expand "ldstub<mode>"
- [(parallel [(set (match_operand:I24MODE 0 "register_operand" "")
- (zero_extend:I24MODE
- (unspec_volatile:QI [(match_operand:QI 1 "memory_operand" "")]
- UNSPECV_LDSTUB)))
- (set (match_dup 1) (const_int -1))])]
- ""
- "")
+ sparc_emit_membar_for_model (model, 3, 1);
+
+ if (<MODE>mode != QImode)
+ operands[1] = adjust_address (operands[1], QImode, 0);
+ emit_insn (gen_ldstub<mode> (operands[0], operands[1]));
+
+ sparc_emit_membar_for_model (model, 3, 2);
+ DONE;
+})
-(define_insn "*ldstubqi"
+(define_insn "ldstubqi"
[(set (match_operand:QI 0 "register_operand" "=r")
(unspec_volatile:QI [(match_operand:QI 1 "memory_operand" "+m")]
UNSPECV_LDSTUB))
@@ -193,7 +269,7 @@
"ldstub\t%1, %0"
[(set_attr "type" "multi")])
-(define_insn "*ldstub<mode>"
+(define_insn "ldstub<mode>"
[(set (match_operand:I24MODE 0 "register_operand" "=r")
(zero_extend:I24MODE
(unspec_volatile:QI [(match_operand:QI 1 "memory_operand" "+m")]
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0772ee9715c..55addacfe46 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,17 @@
+2011-11-30 Jason Merrill <jason@redhat.com>
+
+ PR c++/51009
+ * name-lookup.c (push_to_top_level): Set stmts_are_full_exprs_p.
+ * decl.c (build_aggr_init_full_exprs): Just assert that it's true.
+ (check_initializer): Here too.
+
+2011-11-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51299
+ * rtti.c (ifnonnull): Use nullptr_node.
+ (build_dynamic_cast_1): Call cp_truthvalue_conversion instead
+ of c_common_truthvalue_conversion.
+
2011-11-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51227
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 84064326f4d..055c1b2020f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5367,17 +5367,8 @@ static tree
build_aggr_init_full_exprs (tree decl, tree init, int flags)
{
- int saved_stmts_are_full_exprs_p = 0;
- if (building_stmt_list_p ())
- {
- saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
- current_stmt_tree ()->stmts_are_full_exprs_p = 1;
- }
- init = build_aggr_init (decl, init, flags, tf_warning_or_error);
- if (building_stmt_list_p ())
- current_stmt_tree ()->stmts_are_full_exprs_p =
- saved_stmts_are_full_exprs_p;
- return init;
+ gcc_assert (stmts_are_full_exprs_p ());
+ return build_aggr_init (decl, init, flags, tf_warning_or_error);
}
/* Verify INIT (the initializer for DECL), and record the
@@ -5550,7 +5541,13 @@ check_initializer (tree decl, tree init, int flags, VEC(tree,gc) **cleanups)
if (init && TREE_CODE (init) != TREE_VEC)
{
+ /* In aggregate initialization of a variable, each element
+ initialization is a full-expression because there is no
+ enclosing expression. */
+ gcc_assert (stmts_are_full_exprs_p ());
+
init_code = store_init_value (decl, init, cleanups, flags);
+
if (pedantic && TREE_CODE (type) == ARRAY_TYPE
&& DECL_INITIAL (decl)
&& TREE_CODE (DECL_INITIAL (decl)) == STRING_CST
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 7f6b8cdcf29..ceecdef3e8d 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5916,6 +5916,7 @@ push_to_top_level (void)
s->function_decl = current_function_decl;
s->unevaluated_operand = cp_unevaluated_operand;
s->inhibit_evaluation_warnings = c_inhibit_evaluation_warnings;
+ s->x_stmt_tree.stmts_are_full_exprs_p = true;
scope_chain = s;
current_function_decl = NULL_TREE;
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 818b8d0eee4..4494fddc03e 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -503,8 +503,8 @@ ifnonnull (tree test, tree result)
{
return build3 (COND_EXPR, TREE_TYPE (result),
build2 (EQ_EXPR, boolean_type_node, test,
- cp_convert (TREE_TYPE (test), integer_zero_node)),
- cp_convert (TREE_TYPE (result), integer_zero_node),
+ cp_convert (TREE_TYPE (test), nullptr_node)),
+ cp_convert (TREE_TYPE (result), nullptr_node),
result);
}
@@ -747,7 +747,7 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain)
tree neq;
result = save_expr (result);
- neq = c_common_truthvalue_conversion (input_location, result);
+ neq = cp_truthvalue_conversion (result);
return cp_convert (type,
build3 (COND_EXPR, TREE_TYPE (result),
neq, result, bad));
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 40e3263c9e1..0e9e2b497ba 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -793,6 +793,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define ACCUMULATE_OUTGOING_ARGS 0
#endif
+/* By default, use the GNU runtime for Objective C. */
+#ifndef NEXT_OBJC_RUNTIME
+#define NEXT_OBJC_RUNTIME 0
+#endif
+
/* Supply a default definition for PUSH_ARGS. */
#ifndef PUSH_ARGS
#ifdef PUSH_ROUNDING
diff --git a/gcc/doc/contrib.texi b/gcc/doc/contrib.texi
index ffefecc8607..37e24f06a1d 100644
--- a/gcc/doc/contrib.texi
+++ b/gcc/doc/contrib.texi
@@ -220,7 +220,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 and MeP ports.
+various bug fixes, and the M32C, MeP, 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 d52f9a0cf29..7f39a61fdb2 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1220,11 +1220,12 @@ Fixed-point types are supported by the DWARF2 debug information format.
As an extension, the GNU C compiler supports named address spaces as
defined in the N1275 draft of ISO/IEC DTR 18037. Support for named
-address spaces in GCC will evolve as the draft technical report changes.
-Calling conventions for any target might also change. At present, only
-the SPU and M32C targets support other address spaces. On the SPU target, for
-example, variables may be declared as belonging to another address space
-by qualifying the type with the @code{__ea} address space identifier:
+address spaces in GCC will evolve as the draft technical report
+changes. Calling conventions for any target might also change. At
+present, only the SPU, M32C, and RL78 targets support other address
+spaces. On the SPU target, for example, variables may be declared as
+belonging to another address space by qualifying the type with the
+@code{__ea} address space identifier:
@smallexample
extern int __ea i;
@@ -1244,6 +1245,11 @@ qualified with @code{__far} are accessed using 32-bit addresses in
order to access memory beyond the first 64k bytes. If @code{__far} is
used with the M32CM or M32C cpu variants, it has no effect.
+On the RL78 target, variables qualified with @code{__far} are accessed
+with 32-bit pointers (20-bit addresses) rather than the default 16-bit
+addresses. Non-far variables are assumed to appear in the topmost 64
+kB of the address space.
+
@node Zero Length
@section Arrays of Length Zero
@cindex arrays of length zero
@@ -2553,7 +2559,7 @@ This attribute is ignored for R8C target.
@item interrupt
@cindex interrupt handler functions
Use this attribute on the ARM, AVR, Epiphany, M32C, M32R/D, m68k, MeP, MIPS,
-RX and Xstormy16 ports to indicate that the specified function is an
+RL78, RX and Xstormy16 ports to indicate that the specified function is an
interrupt handler. The compiler will generate function entry and exit
sequences suitable for use in an interrupt handler when this attribute
is present.
@@ -2611,6 +2617,10 @@ void __attribute__ ((interrupt, use_shadow_register_set,
use_debug_exception_return)) v7 ();
@end smallexample
+On RL78, use @code{brk_interrupt} instead of @code{interrupt} for
+handlers intended to be used with the @code{BRK} opcode (i.e. those
+that must end with @code{RETB} instead of @code{RETI}).
+
@item ifunc ("@var{resolver}")
@cindex @code{ifunc} attribute
The @code{ifunc} attribute is used to mark a function as an indirect
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 46c5824cc71..da84758f254 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -4140,6 +4140,13 @@ Embedded PowerPC system in little endian mode.
@html
<hr />
@end html
+@heading @anchor{rl78-x-elf}rl78-*-elf
+The Renesas RL78 processor.
+This configuration is intended for embedded systems.
+
+@html
+<hr />
+@end html
@heading @anchor{rx-x-elf}rx-*-elf
The Renesas RX processor. See
@uref{http://eu.renesas.com/fmwk.jsp?cnt=rx600_series_landing.jsp&fp=/products/mpumcu/rx_family/rx600_series}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 435db4980db..b4c1616fe24 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -779,6 +779,9 @@ Objective-C and Objective-C++ Dialects}.
@emph{PowerPC Options}
See RS/6000 and PowerPC Options.
+@emph{RL78 Options}
+@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78}
+
@emph{RS/6000 and PowerPC Options}
@gccoptlist{-mcpu=@var{cpu-type} @gol
-mtune=@var{cpu-type} @gol
@@ -885,6 +888,7 @@ See RS/6000 and PowerPC Options.
@gccoptlist{-mcpu=@var{cpu-type} @gol
-mtune=@var{cpu-type} @gol
-mcmodel=@var{code-model} @gol
+-mmemory-model=@var{mem-model} @gol
-m32 -m64 -mapp-regs -mno-app-regs @gol
-mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
-mfpu -mno-fpu -mhard-float -msoft-float @gol
@@ -10309,6 +10313,7 @@ platform.
* PDP-11 Options::
* picoChip Options::
* PowerPC Options::
+* RL78 Options::
* RS/6000 and PowerPC Options::
* RX Options::
* S/390 and zSeries Options::
@@ -15937,6 +15942,29 @@ the warning to be turned off.
These are listed under @xref{RS/6000 and PowerPC Options}.
+@node RL78 Options
+@subsection RL78 Options
+@cindex RL78 Options
+
+@table @gcctabopt
+
+@item -msim
+@opindex msim
+Links in additional target libraries to support operation within a
+simulator.
+
+@item -mmul=none
+@itemx -mmul=g13
+@itemx -mmul=rl78
+@opindex mmul
+Specifies the type of hardware multiplication support to be used. The
+default is @code{none}, which uses software multiplication functions.
+The @code{g13} option is for the hardware multiply/divide peripheral
+only on the RL78/G13 targets. The @code{rl78} option is for the
+standard hardware multiplication defined in the RL78 software manual.
+
+@end table
+
@node RS/6000 and PowerPC Options
@subsection IBM RS/6000 and PowerPC Options
@cindex RS/6000 and PowerPC Options
@@ -17817,13 +17845,22 @@ an architecture and not an implementation. These are @samp{v7}, @samp{v8},
Here is a list of each supported architecture and their supported
implementations.
-@smallexample
- v7: cypress
- v8: supersparc, hypersparc, leon
- sparclite: f930, f934, sparclite86x
- sparclet: tsc701
- v9: ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
-@end smallexample
+@table @asis
+@item v7
+cypress
+
+@item v8
+supersparc, hypersparc, leon
+
+@item sparclite
+f930, f934, sparclite86x
+
+@item sparclet
+tsc701
+
+@item v9
+ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
+@end table
By default (unless configured otherwise), GCC generates code for the V7
variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
@@ -17958,33 +17995,59 @@ The 32-bit environment sets int, long and pointer to 32 bits.
The 64-bit environment sets int to 32 bits and long and pointer
to 64 bits.
-@item -mcmodel=medlow
-@opindex mcmodel=medlow
-Generate code for the Medium/Low code model: 64-bit addresses, programs
+@item -mcmodel=@var{which}
+@opindex mcmodel
+Set the code model to one of
+
+@table @samp
+@item medlow
+The Medium/Low code model: 64-bit addresses, programs
must be linked in the low 32 bits of memory. Programs can be statically
or dynamically linked.
-@item -mcmodel=medmid
-@opindex mcmodel=medmid
-Generate code for the Medium/Middle code model: 64-bit addresses, programs
+@item medmid
+The Medium/Middle code model: 64-bit addresses, programs
must be linked in the low 44 bits of memory, the text and data segments must
be less than 2GB in size and the data segment must be located within 2GB of
the text segment.
-@item -mcmodel=medany
-@opindex mcmodel=medany
-Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
+@item medany
+The Medium/Anywhere code model: 64-bit addresses, programs
may be linked anywhere in memory, the text and data segments must be less
than 2GB in size and the data segment must be located within 2GB of the
text segment.
-@item -mcmodel=embmedany
-@opindex mcmodel=embmedany
-Generate code for the Medium/Anywhere code model for embedded systems:
+@item embmedany
+The Medium/Anywhere code model for embedded systems:
64-bit addresses, the text and data segments must be less than 2GB in
size, both starting anywhere in memory (determined at link time). The
global register %g4 points to the base of the data segment. Programs
are statically linked and PIC is not supported.
+@end table
+
+@item -mmemory-model=@var{mem-model}
+@opindex mmemory-model
+Set the memory model in force on the processor to one of
+
+@table @samp
+@item default
+The default memory model for the processor and operating system.
+
+@item rmo
+Relaxed Memory Order
+
+@item pso
+Partial Store Order
+
+@item tso
+Total Store Order
+
+@item sc
+Sequential Consistency
+@end table
+
+These memory models are formally defined in Appendix D of the Sparc V9
+architecture manual, as set in the processor's @code{PSTATE.MM} field.
@item -mstack-bias
@itemx -mno-stack-bias
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 64ad83302f5..dc87ca732d3 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -2979,6 +2979,96 @@ A memory reference that is encoded within the opcode.
@end table
+@item RL78---@file{config/rl78/constraints.md}
+@table @code
+
+@item Int3
+An integer constant in the range 1 @dots{} 7.
+@item Int8
+An integer constant in the range 0 @dots{} 255.
+@item J
+An integer constant in the range @minus{}255 @dots{} 0
+@item K
+The integer constant 1.
+@item L
+The integer constant -1.
+@item M
+The integer constant 0.
+@item N
+The integer constant 2.
+@item O
+The integer constant -2.
+@item P
+An integer constant in the range 1 @dots{} 15.
+@item Qbi
+The built-in compare types--eq, ne, gtu, ltu, geu, and leu.
+@item Qsc
+The synthetic compare types--gt, lt, ge, and le.
+@item Wab
+A memory reference with an absolute address.
+@item Wbc
+A memory reference using @code{BC} as a base register, with an optional offset.
+@item Wca
+A memory reference using @code{AX}, @code{BC}, @code{DE}, or @code{HL} for the address, for calls.
+@item Wcv
+A memory reference using any 16-bit register pair for the address, for calls.
+@item Wd2
+A memory reference using @code{DE} as a base register, with an optional offset.
+@item Wde
+A memory reference using @code{DE} as a base register, without any offset.
+@item Wfr
+Any memory reference to an address in the far address space.
+@item Wh1
+A memory reference using @code{HL} as a base register, with an optional one-byte offset.
+@item Whb
+A memory reference using @code{HL} as a base register, with @code{B} or @code{C} as the index register.
+@item Whl
+A memory reference using @code{HL} as a base register, without any offset.
+@item Ws1
+A memory reference using @code{SP} as a base register, with an optional one-byte offset.
+@item Y
+Any memory reference to an address in the near address space.
+@item A
+The @code{AX} register.
+@item B
+The @code{BC} register.
+@item D
+The @code{DE} register.
+@item R
+@code{A} through @code{L} registers.
+@item S
+The @code{SP} register.
+@item T
+The @code{HL} register.
+@item Z08W
+The 16-bit @code{R8} register.
+@item Z10W
+The 16-bit @code{R10} register.
+@item Zint
+The registers reserved for interrupts (@code{R24} to @code{R31}).
+@item a
+The @code{A} register.
+@item b
+The @code{B} register.
+@item c
+The @code{C} register.
+@item d
+The @code{D} register.
+@item e
+The @code{E} register.
+@item h
+The @code{H} register.
+@item l
+The @code{L} register.
+@item v
+The virtual registers.
+@item w
+The @code{PSW} register.
+@item x
+The @code{X} register.
+
+@end table
+
@item RX---@file{config/rx/constraints.md}
@table @code
@item Q
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index c079ce29b7e..c98b93c985b 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5351,13 +5351,18 @@ void sincosl(long double x, long double *sin, long double *cos);
@end defmac
@defmac NEXT_OBJC_RUNTIME
-Define this macro to generate code for Objective-C message sending using
-the calling convention of the NeXT system. This calling convention
-involves passing the object, the selector and the method arguments all
-at once to the method-lookup library function.
-
-The default calling convention passes just the object and the selector
-to the lookup function, which returns a pointer to the method.
+Set this macro to 1 to use the "NeXT" Objective-C message sending conventions
+by default. This calling convention involves passing the object, the selector
+and the method arguments all at once to the method-lookup library function.
+This is the usual setting when targeting Darwin/Mac OS X systems, which have
+the NeXT runtime installed.
+
+If the macro is set to 0, the "GNU" Objective-C message sending convention
+will be used by default. This convention passes just the object and the
+selector to the method-lookup function, which returns a pointer to the method.
+
+In either case, it remains possible to select code-generation for the alternate
+scheme, by means of compiler command line switches.
@end defmac
@node Addressing Modes
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index d03d7f656a2..d5a7d3978e3 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -5289,13 +5289,18 @@ void sincosl(long double x, long double *sin, long double *cos);
@end defmac
@defmac NEXT_OBJC_RUNTIME
-Define this macro to generate code for Objective-C message sending using
-the calling convention of the NeXT system. This calling convention
-involves passing the object, the selector and the method arguments all
-at once to the method-lookup library function.
-
-The default calling convention passes just the object and the selector
-to the lookup function, which returns a pointer to the method.
+Set this macro to 1 to use the "NeXT" Objective-C message sending conventions
+by default. This calling convention involves passing the object, the selector
+and the method arguments all at once to the method-lookup library function.
+This is the usual setting when targeting Darwin/Mac OS X systems, which have
+the NeXT runtime installed.
+
+If the macro is set to 0, the "GNU" Objective-C message sending convention
+will be used by default. This convention passes just the object and the
+selector to the method-lookup function, which returns a pointer to the method.
+
+In either case, it remains possible to select code-generation for the alternate
+scheme, by means of compiler command line switches.
@end defmac
@node Addressing Modes
diff --git a/gcc/dse.c b/gcc/dse.c
index ddabd3de0c6..13d2f27ca23 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -895,7 +895,12 @@ emit_inc_dec_insn_before (rtx mem ATTRIBUTE_UNUSED,
/* We can reuse all operands without copying, because we are about
to delete the insn that contained it. */
if (srcoff)
- new_insn = gen_add3_insn (dest, src, srcoff);
+ {
+ start_sequence ();
+ emit_insn (gen_add3_insn (dest, src, srcoff));
+ new_insn = get_insns ();
+ end_sequence ();
+ }
else
new_insn = gen_move_insn (dest, src);
info.first = new_insn;
diff --git a/gcc/expr.c b/gcc/expr.c
index 8d3a0f671a8..6722af01616 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7452,7 +7452,8 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
}
if (modifier != EXPAND_INITIALIZER
- && modifier != EXPAND_CONST_ADDRESS)
+ && modifier != EXPAND_CONST_ADDRESS
+ && modifier != EXPAND_SUM)
result = force_operand (result, target);
return result;
}
diff --git a/gcc/flags.h b/gcc/flags.h
index 8cc6670ef1b..9791e1b2344 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -56,10 +56,6 @@ extern bool final_insns_dump_p;
/* Nonzero means make permerror produce warnings instead of errors. */
extern int flag_permissive;
-
-/* Generate code for GNU or NeXT Objective-C runtime environment. */
-
-extern int flag_next_runtime;
/* Other basic status info about current function. */
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 4ee062c23e7..170c6fbdeff 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,33 @@
+2011-11-29 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/40958
+ * module.c (prev_module_line): New variable.
+ (prev_module_column): New variable.
+ (prev_character): New variable.
+ (module_char): Update the new variables.
+ (module_unget_char): New function.
+ (parse_string): Use module_unget_char.
+ (parse_integer): Likewise.
+ (parse_name): Likewise.
+
+2011-11-29 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51306
+ PR fortran/48700
+ * check.c (gfc_check_move_alloc): Make sure that from/to
+ are both polymorphic or neither.
+ * trans-intrinsic.c (conv_intrinsic_move_alloc): Cleanup,
+ generate inline code.
+
+2011-11-28 Tobias Burnus <burnus@net-b.de>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/51308
+ * symbol.c (check_conflict): Ignore BIND(C) + PARAMETER
+ conflicts for ISO_C_BINDING variables.
+ (gen_special_c_interop_ptr): Don't mark c_ptr_null/c_funptr_null
+ as SAVE.
+
2011-11-25 Mikael Morin <mikael@gcc.gnu.org>
* trans-array.c (set_loop_bounds): Remove dead conditions.
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index d9b9a9cd580..832eb6486ec 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -2691,6 +2691,14 @@ gfc_check_move_alloc (gfc_expr *from, gfc_expr *to)
if (same_type_check (to, 1, from, 0) == FAILURE)
return FAILURE;
+ if (to->ts.type != from->ts.type)
+ {
+ gfc_error ("The FROM and TO arguments in MOVE_ALLOC call at %L must be "
+ "either both polymorphic or both nonpolymorphic",
+ &from->where);
+ return FAILURE;
+ }
+
if (to->rank != from->rank)
{
gfc_error ("the '%s' and '%s' arguments of '%s' intrinsic at %L must "
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 7c28e8bb97c..70f8565c150 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -194,6 +194,8 @@ static char module_name[GFC_MAX_SYMBOL_LEN + 1];
static bool specified_nonint, specified_int;
static int module_line, module_column, only_flag;
+static int prev_module_line, prev_module_column, prev_character;
+
static enum
{ IO_INPUT, IO_OUTPUT }
iomode;
@@ -1036,6 +1038,10 @@ module_char (void)
if (c == EOF)
bad_module ("Unexpected EOF");
+ prev_module_line = module_line;
+ prev_module_column = module_column;
+ prev_character = c;
+
if (c == '\n')
{
module_line++;
@@ -1046,6 +1052,16 @@ module_char (void)
return c;
}
+/* Unget a character while remembering the line and column. Works for
+ a single character only. */
+
+static void
+module_unget_char (void)
+{
+ module_line = prev_module_line;
+ module_column = prev_module_column;
+ ungetc (prev_character, module_fp);
+}
/* Parse a string constant. The delimiter is guaranteed to be a
single quote. */
@@ -1106,24 +1122,22 @@ parse_string (void)
static void
parse_integer (int c)
{
- module_locus m;
-
atom_int = c - '0';
for (;;)
{
- get_module_locus (&m);
-
c = module_char ();
if (!ISDIGIT (c))
- break;
+ {
+ module_unget_char ();
+ break;
+ }
atom_int = 10 * atom_int + c - '0';
if (atom_int > 99999999)
bad_module ("Integer overflow");
}
- set_module_locus (&m);
}
@@ -1132,7 +1146,6 @@ parse_integer (int c)
static void
parse_name (int c)
{
- module_locus m;
char *p;
int len;
@@ -1141,13 +1154,14 @@ parse_name (int c)
*p++ = c;
len = 1;
- get_module_locus (&m);
-
for (;;)
{
c = module_char ();
if (!ISALNUM (c) && c != '_' && c != '-')
- break;
+ {
+ module_unget_char ();
+ break;
+ }
*p++ = c;
if (++len > GFC_MAX_SYMBOL_LEN)
@@ -1156,11 +1170,6 @@ parse_name (int c)
*p = '\0';
- fseek (module_fp, -1, SEEK_CUR);
- module_column = m.column + len - 1;
-
- if (c == '\n')
- module_line--;
}
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 9bd6ed489f3..de42297981e 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -742,9 +742,10 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf2 (asynchronous);
conf2 (threadprivate);
conf2 (value);
- conf2 (is_bind_c);
conf2 (codimension);
conf2 (result);
+ if (!attr->is_iso_c)
+ conf2 (is_bind_c);
break;
default:
@@ -3763,13 +3764,11 @@ gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
"create symbol for %s", ptr_name);
}
- /* Set up the symbol's important fields. Save attr required so we can
- initialize the ptr to NULL. */
- tmp_sym->attr.save = SAVE_EXPLICIT;
tmp_sym->ts.is_c_interop = 1;
tmp_sym->attr.is_c_interop = 1;
tmp_sym->ts.is_iso_c = 1;
tmp_sym->ts.type = BT_DERIVED;
+ tmp_sym->attr.flavor = FL_PARAMETER;
/* The c_ptr and c_funptr derived types will provide the
definition for c_null_ptr and c_null_funptr, respectively. */
@@ -3817,9 +3816,6 @@ gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
c->expr = gfc_get_expr ();
c->expr->expr_type = EXPR_NULL;
c->expr->ts.is_iso_c = 1;
- /* Must declare c_null_ptr and c_null_funptr as having the
- PARAMETER attribute so they can be used in init expressions. */
- tmp_sym->attr.flavor = FL_PARAMETER;
return SUCCESS;
}
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 4244570a7e9..d055275614b 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -5892,7 +5892,7 @@ gfc_conv_intrinsic_si_kind (gfc_se *se, gfc_expr *expr)
}
-/* Generate code for SELECTED_REAL_KIND (P, R) intrinsic function. */
+/* Generate code for SELECTED_REAL_KIND (P, R, RADIX) intrinsic function. */
static void
gfc_conv_intrinsic_sr_kind (gfc_se *se, gfc_expr *expr)
@@ -7182,50 +7182,123 @@ conv_intrinsic_atomic_ref (gfc_code *code)
static tree
conv_intrinsic_move_alloc (gfc_code *code)
{
- if (code->ext.actual->expr->rank == 0)
- {
- /* Scalar arguments: Generate pointer assignments. */
- gfc_expr *from, *to, *deal;
- stmtblock_t block;
- tree tmp;
- gfc_se se;
+ stmtblock_t block;
+ gfc_expr *from_expr, *to_expr;
+ gfc_expr *to_expr2, *from_expr2;
+ gfc_se from_se, to_se;
+ gfc_ss *from_ss, *to_ss;
+ tree tmp;
- from = code->ext.actual->expr;
- to = code->ext.actual->next->expr;
+ gfc_start_block (&block);
- gfc_start_block (&block);
+ from_expr = code->ext.actual->expr;
+ to_expr = code->ext.actual->next->expr;
- /* Deallocate 'TO' argument. */
- gfc_init_se (&se, NULL);
- se.want_pointer = 1;
- deal = gfc_copy_expr (to);
- if (deal->ts.type == BT_CLASS)
- gfc_add_data_component (deal);
- gfc_conv_expr (&se, deal);
- tmp = gfc_deallocate_scalar_with_status (se.expr, NULL, true,
- deal, deal->ts);
- gfc_add_expr_to_block (&block, tmp);
- gfc_free_expr (deal);
+ gfc_init_se (&from_se, NULL);
+ gfc_init_se (&to_se, NULL);
- if (to->ts.type == BT_CLASS)
- tmp = gfc_trans_class_assign (to, from, EXEC_POINTER_ASSIGN);
+ if (from_expr->rank == 0)
+ {
+ if (from_expr->ts.type != BT_CLASS)
+ {
+ from_expr2 = to_expr;
+ to_expr2 = to_expr;
+ }
else
- tmp = gfc_trans_pointer_assignment (to, from);
- gfc_add_expr_to_block (&block, tmp);
+ {
+ to_expr2 = gfc_copy_expr (to_expr);
+ from_expr2 = gfc_copy_expr (from_expr);
+ gfc_add_data_component (from_expr2);
+ gfc_add_data_component (to_expr2);
+ }
- if (from->ts.type == BT_CLASS)
- tmp = gfc_trans_class_assign (from, gfc_get_null_expr (NULL),
- EXEC_POINTER_ASSIGN);
- else
- tmp = gfc_trans_pointer_assignment (from,
- gfc_get_null_expr (NULL));
+ from_se.want_pointer = 1;
+ to_se.want_pointer = 1;
+ gfc_conv_expr (&from_se, from_expr2);
+ gfc_conv_expr (&to_se, to_expr2);
+ gfc_add_block_to_block (&block, &from_se.pre);
+ gfc_add_block_to_block (&block, &to_se.pre);
+
+ /* Deallocate "to". */
+ tmp = gfc_deallocate_scalar_with_status (to_se.expr, NULL_TREE, true,
+ to_expr2, to_expr->ts);
gfc_add_expr_to_block (&block, tmp);
+ /* Assign (_data) pointers. */
+ gfc_add_modify_loc (input_location, &block, to_se.expr,
+ fold_convert (TREE_TYPE (to_se.expr), from_se.expr));
+
+ /* Set "from" to NULL. */
+ gfc_add_modify_loc (input_location, &block, from_se.expr,
+ fold_convert (TREE_TYPE (from_se.expr), null_pointer_node));
+
+ gfc_add_block_to_block (&block, &from_se.post);
+ gfc_add_block_to_block (&block, &to_se.post);
+
+ /* Set _vptr. */
+ if (from_expr->ts.type == BT_CLASS)
+ {
+ gfc_free_expr (from_expr2);
+ gfc_free_expr (to_expr2);
+
+ gfc_init_se (&from_se, NULL);
+ gfc_init_se (&to_se, NULL);
+ from_se.want_pointer = 1;
+ to_se.want_pointer = 1;
+ gfc_add_vptr_component (from_expr);
+ gfc_add_vptr_component (to_expr);
+
+ gfc_conv_expr (&from_se, from_expr);
+ gfc_conv_expr (&to_se, to_expr);
+ gfc_add_modify_loc (input_location, &block, to_se.expr,
+ fold_convert (TREE_TYPE (to_se.expr), from_se.expr));
+ }
+
return gfc_finish_block (&block);
}
- else
- /* Array arguments: Generate library code. */
- return gfc_trans_call (code, false, NULL_TREE, NULL_TREE, false);
+
+ /* Update _vptr component. */
+ if (from_expr->ts.type == BT_CLASS)
+ {
+ from_se.want_pointer = 1;
+ to_se.want_pointer = 1;
+
+ from_expr2 = gfc_copy_expr (from_expr);
+ to_expr2 = gfc_copy_expr (to_expr);
+ gfc_add_vptr_component (from_expr2);
+ gfc_add_vptr_component (to_expr2);
+
+ gfc_conv_expr (&from_se, from_expr2);
+ gfc_conv_expr (&to_se, to_expr2);
+
+ gfc_add_modify_loc (input_location, &block, to_se.expr,
+ fold_convert (TREE_TYPE (to_se.expr), from_se.expr));
+ gfc_free_expr (to_expr2);
+ gfc_free_expr (from_expr2);
+
+ gfc_init_se (&from_se, NULL);
+ gfc_init_se (&to_se, NULL);
+ }
+
+ /* Deallocate "to". */
+ to_ss = gfc_walk_expr (to_expr);
+ from_ss = gfc_walk_expr (from_expr);
+ gfc_conv_expr_descriptor (&to_se, to_expr, to_ss);
+ gfc_conv_expr_descriptor (&from_se, from_expr, from_ss);
+
+ tmp = gfc_conv_descriptor_data_get (to_se.expr);
+ tmp = gfc_deallocate_with_status (tmp, NULL_TREE, true, to_expr);
+ gfc_add_expr_to_block (&block, tmp);
+
+ /* Move the pointer and update the array descriptor data. */
+ gfc_add_modify_loc (input_location, &block, to_se.expr, from_se.expr);
+
+ /* Set "to" to NULL. */
+ tmp = gfc_conv_descriptor_data_get (from_se.expr);
+ gfc_add_modify_loc (input_location, &block, tmp,
+ fold_convert (TREE_TYPE (tmp), null_pointer_node));
+
+ return gfc_finish_block (&block);
}
diff --git a/gcc/function.c b/gcc/function.c
index 664858a29e3..fa9236ce4b8 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5670,6 +5670,7 @@ convert_jumps_to_returns (basic_block last_bb, bool simple_p,
/* Fix up the CFG for the successful change we just made. */
redirect_edge_succ (e, EXIT_BLOCK_PTR);
+ e->flags &= ~EDGE_CROSSING;
}
VEC_free (basic_block, heap, src_bbs);
return unconverted;
@@ -5892,6 +5893,9 @@ thread_prologue_and_epilogue_insns (void)
if (pic_offset_table_rtx)
add_to_hard_reg_set (&set_up_by_prologue, Pmode,
PIC_OFFSET_TABLE_REGNUM);
+ if (stack_realign_drap && crtl->drap_reg)
+ add_to_hard_reg_set (&set_up_by_prologue, GET_MODE (crtl->drap_reg),
+ REGNO (crtl->drap_reg));
/* We don't use a different max size depending on
optimize_bb_for_speed_p because increasing shrink-wrapping
diff --git a/gcc/gccspec.c b/gcc/gccspec.c
index 746ebf0c420..e1613594fc4 100644
--- a/gcc/gccspec.c
+++ b/gcc/gccspec.c
@@ -33,7 +33,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options ATTRIBUTE_UN
/* Systems which use the NeXT runtime by default should arrange
for the shared libgcc to be used when -fgnu-runtime is passed
through specs. */
-#if defined(ENABLE_SHARED_LIBGCC) && ! defined(NEXT_OBJC_RUNTIME)
+#if defined(ENABLE_SHARED_LIBGCC) && ! NEXT_OBJC_RUNTIME
unsigned int i;
/* The new argument list will be contained in this. */
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 071c6515b4c..d27e94b218c 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -5558,4 +5558,34 @@ gimple_asm_clobbers_memory_p (const_gimple stmt)
return false;
}
+
+
+/* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
+
+void
+gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
+{
+ bool prev_inlinable_p;
+
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+
+ prev_inlinable_p = gimple_call_cannot_inline_p (s);
+
+ if (inlinable_p)
+ s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
+ else
+ s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
+
+ /* If we have changed the inlinable attribute, and there is a call
+ graph edge going out of this statement, update its inlinable
+ attribute as well. */
+ if (current_function_decl && prev_inlinable_p != inlinable_p)
+ {
+ struct cgraph_node *n = cgraph_get_node (current_function_decl);
+ struct cgraph_edge *e = cgraph_edge (n, s);
+ if (e)
+ e->call_stmt_cannot_inline_p = inlinable_p;
+ }
+}
+
#include "gt-gimple.h"
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 8536c70e87e..df31bf3c23a 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1035,6 +1035,7 @@ extern bool walk_stmt_load_store_ops (gimple, void *,
extern bool gimple_ior_addresses_taken (bitmap, gimple);
extern bool gimple_call_builtin_p (gimple, enum built_in_function);
extern bool gimple_asm_clobbers_memory_p (const_gimple);
+extern void gimple_call_set_cannot_inline (gimple, bool);
/* In gimplify.c */
extern tree create_tmp_var_raw (tree, const char *);
@@ -2343,19 +2344,6 @@ gimple_call_tail_p (gimple s)
}
-/* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
-
-static inline void
-gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
-{
- GIMPLE_CHECK (s, GIMPLE_CALL);
- if (inlinable_p)
- s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
- else
- s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
-}
-
-
/* Return true if GIMPLE_CALL S cannot be inlined. */
static inline bool
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index 2eaf210c94f..47910fd75a9 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,15 @@
+2011-11-29 Sanjoy Das <thedigitalangel@gmail.com>
+ Ian Lance Taylor <iant@google.com>
+
+ * go-location.h: New file.
+ * go-linemap.cc: New file.
+ * go-gcc.cc: Change all uses of source_location to Location.
+ * Make-lang.in (GO_OBJS): Add go/go-linemap.o.
+ (GO_LINEMAP_H): New variable.
+ (GO_LEX_H): Use $(GO_LINEMAP_H).
+ (GO_GOGO_H, GO_TYPES_H, GO_IMPORT_H): Likewise.
+ (go/go-linemap.o): New target.
+
2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* Make-lang.in (gospec.o): Pass SHLIB instead of SHLIB_LINK.
diff --git a/gcc/go/Make-lang.in b/gcc/go/Make-lang.in
index 62a4d6f0dee..08aaafbe045 100644
--- a/gcc/go/Make-lang.in
+++ b/gcc/go/Make-lang.in
@@ -54,6 +54,7 @@ GO_OBJS = \
go/go-dump.o \
go/go-gcc.o \
go/go-lang.o \
+ go/go-linemap.o \
go/go-optimize.o \
go/go.o \
go/gogo-tree.o \
@@ -217,14 +218,15 @@ 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_LEX_H = go/gofrontend/lex.h go/gofrontend/operator.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_TYPES_H = go/gofrontend/types.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_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
@@ -247,6 +249,9 @@ go/go-gcc.o: go/go-gcc.cc $(GO_SYSTEM_H) $(TREE_H) tree-iterator.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)
+
go/%.o: go/gofrontend/%.cc
$(CXX) -c $(GOINCLUDES) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $< $(OUTPUT_OPTION)
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index dbdf95f2e7b..f5214dbbb36 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -156,7 +156,7 @@ class Gcc_backend : public Backend
function_type(const Btyped_identifier&,
const std::vector<Btyped_identifier>&,
const std::vector<Btyped_identifier>&,
- source_location);
+ const Location);
Btype*
struct_type(const std::vector<Btyped_identifier>&);
@@ -165,7 +165,7 @@ class Gcc_backend : public Backend
array_type(Btype*, Bexpression*);
Btype*
- placeholder_pointer_type(const std::string&, source_location, bool);
+ placeholder_pointer_type(const std::string&, Location, bool);
bool
set_placeholder_pointer_type(Btype*, Btype*);
@@ -174,20 +174,20 @@ class Gcc_backend : public Backend
set_placeholder_function_type(Btype*, Btype*);
Btype*
- placeholder_struct_type(const std::string&, source_location);
+ placeholder_struct_type(const std::string&, Location);
bool
set_placeholder_struct_type(Btype* placeholder,
const std::vector<Btyped_identifier>&);
Btype*
- placeholder_array_type(const std::string&, source_location);
+ placeholder_array_type(const std::string&, Location);
bool
set_placeholder_array_type(Btype*, Btype*, Bexpression*);
Btype*
- named_type(const std::string&, Btype*, source_location);
+ named_type(const std::string&, Btype*, Location);
Btype*
circular_pointer_type(Btype*, bool);
@@ -213,21 +213,21 @@ class Gcc_backend : public Backend
init_statement(Bvariable* var, Bexpression* init);
Bstatement*
- assignment_statement(Bexpression* lhs, Bexpression* rhs, source_location);
+ assignment_statement(Bexpression* lhs, Bexpression* rhs, Location);
Bstatement*
return_statement(Bfunction*, const std::vector<Bexpression*>&,
- source_location);
+ Location);
Bstatement*
if_statement(Bexpression* condition, Bblock* then_block, Bblock* else_block,
- source_location);
+ Location);
Bstatement*
switch_statement(Bexpression* value,
const std::vector<std::vector<Bexpression*> >& cases,
const std::vector<Bstatement*>& statements,
- source_location);
+ Location);
Bstatement*
compound_statement(Bstatement*, Bstatement*);
@@ -239,7 +239,7 @@ class Gcc_backend : public Backend
Bblock*
block(Bfunction*, Bblock*, const std::vector<Bvariable*>&,
- source_location, source_location);
+ Location, Location);
void
block_add_statements(Bblock*, const std::vector<Bstatement*>&);
@@ -260,46 +260,46 @@ class Gcc_backend : public Backend
Btype* btype,
bool is_external,
bool is_hidden,
- source_location location);
+ Location location);
void
global_variable_set_init(Bvariable*, Bexpression*);
Bvariable*
local_variable(Bfunction*, const std::string&, Btype*, bool,
- source_location);
+ Location);
Bvariable*
parameter_variable(Bfunction*, const std::string&, Btype*, bool,
- source_location);
+ Location);
Bvariable*
temporary_variable(Bfunction*, Bblock*, Btype*, Bexpression*, bool,
- source_location, Bstatement**);
+ Location, Bstatement**);
Bvariable*
- immutable_struct(const std::string&, bool, Btype*, source_location);
+ immutable_struct(const std::string&, bool, Btype*, Location);
void
immutable_struct_set_init(Bvariable*, const std::string&, bool, Btype*,
- source_location, Bexpression*);
+ Location, Bexpression*);
Bvariable*
- immutable_struct_reference(const std::string&, Btype*, source_location);
+ immutable_struct_reference(const std::string&, Btype*, Location);
// Labels.
Blabel*
- label(Bfunction*, const std::string& name, source_location);
+ label(Bfunction*, const std::string& name, Location);
Bstatement*
label_definition_statement(Blabel*);
Bstatement*
- goto_statement(Blabel*, source_location);
+ goto_statement(Blabel*, Location);
Bexpression*
- label_address(Blabel*, source_location);
+ label_address(Blabel*, Location);
private:
// Make a Bexpression from a tree.
@@ -432,7 +432,7 @@ Btype*
Gcc_backend::function_type(const Btyped_identifier& receiver,
const std::vector<Btyped_identifier>& parameters,
const std::vector<Btyped_identifier>& results,
- source_location location)
+ Location location)
{
tree args = NULL_TREE;
tree* pp = &args;
@@ -482,8 +482,8 @@ Gcc_backend::function_type(const Btyped_identifier& receiver,
if (field_type_tree == error_mark_node)
return this->error_type();
gcc_assert(TYPE_SIZE(field_type_tree) != NULL_TREE);
- tree field = build_decl(location, FIELD_DECL, name_tree,
- field_type_tree);
+ tree field = build_decl(location.gcc_location(), FIELD_DECL,
+ name_tree, field_type_tree);
DECL_CONTEXT(field) = result;
*pp = field;
pp = &DECL_CHAIN(field);
@@ -526,7 +526,8 @@ Gcc_backend::fill_in_struct(Btype* fill,
tree type_tree = p->btype->get_tree();
if (type_tree == error_mark_node)
return this->error_type();
- tree field = build_decl(p->location, FIELD_DECL, name_tree, type_tree);
+ tree field = build_decl(p->location.gcc_location(), FIELD_DECL, name_tree,
+ type_tree);
DECL_CONTEXT(field) = fill_tree;
*pp = field;
pp = &DECL_CHAIN(field);
@@ -587,12 +588,12 @@ Gcc_backend::fill_in_array(Btype* fill, Btype* element_type,
Btype*
Gcc_backend::placeholder_pointer_type(const std::string& name,
- source_location location, bool)
+ Location location, bool)
{
tree ret = build_variant_type_copy(ptr_type_node);
if (!name.empty())
{
- tree decl = build_decl(location, TYPE_DECL,
+ tree decl = build_decl(location.gcc_location(), TYPE_DECL,
get_identifier_from_string(name),
ret);
TYPE_NAME(ret) = decl;
@@ -633,10 +634,10 @@ Gcc_backend::set_placeholder_function_type(Btype* placeholder, Btype* ft)
Btype*
Gcc_backend::placeholder_struct_type(const std::string& name,
- source_location location)
+ Location location)
{
tree ret = make_node(RECORD_TYPE);
- tree decl = build_decl(location, TYPE_DECL,
+ tree decl = build_decl(location.gcc_location(), TYPE_DECL,
get_identifier_from_string(name),
ret);
TYPE_NAME(ret) = decl;
@@ -660,10 +661,10 @@ Gcc_backend::set_placeholder_struct_type(
Btype*
Gcc_backend::placeholder_array_type(const std::string& name,
- source_location location)
+ Location location)
{
tree ret = make_node(ARRAY_TYPE);
- tree decl = build_decl(location, TYPE_DECL,
+ tree decl = build_decl(location.gcc_location(), TYPE_DECL,
get_identifier_from_string(name),
ret);
TYPE_NAME(ret) = decl;
@@ -687,13 +688,13 @@ Gcc_backend::set_placeholder_array_type(Btype* placeholder,
Btype*
Gcc_backend::named_type(const std::string& name, Btype* btype,
- source_location location)
+ Location location)
{
tree type = btype->get_tree();
if (type == error_mark_node)
return this->error_type();
type = build_variant_type_copy(type);
- tree decl = build_decl(location, TYPE_DECL,
+ tree decl = build_decl(location.gcc_location(), TYPE_DECL,
get_identifier_from_string(name),
type);
TYPE_NAME(type) = decl;
@@ -757,13 +758,14 @@ Gcc_backend::init_statement(Bvariable* var, Bexpression* init)
Bstatement*
Gcc_backend::assignment_statement(Bexpression* lhs, Bexpression* rhs,
- source_location location)
+ Location location)
{
tree lhs_tree = lhs->get_tree();
tree rhs_tree = rhs->get_tree();
if (lhs_tree == error_mark_node || rhs_tree == error_mark_node)
return this->error_statement();
- return this->make_statement(fold_build2_loc(location, MODIFY_EXPR,
+ return this->make_statement(fold_build2_loc(location.gcc_location(),
+ MODIFY_EXPR,
void_type_node,
lhs_tree, rhs_tree));
}
@@ -773,7 +775,7 @@ Gcc_backend::assignment_statement(Bexpression* lhs, Bexpression* rhs,
Bstatement*
Gcc_backend::return_statement(Bfunction* bfunction,
const std::vector<Bexpression*>& vals,
- source_location location)
+ Location location)
{
tree fntree = bfunction->get_tree();
if (fntree == error_mark_node)
@@ -783,15 +785,18 @@ Gcc_backend::return_statement(Bfunction* bfunction,
return this->error_statement();
tree ret;
if (vals.empty())
- ret = fold_build1_loc(location, RETURN_EXPR, void_type_node, NULL_TREE);
+ ret = fold_build1_loc(location.gcc_location(), RETURN_EXPR, void_type_node,
+ NULL_TREE);
else if (vals.size() == 1)
{
tree val = vals.front()->get_tree();
if (val == error_mark_node)
return this->error_statement();
- tree set = fold_build2_loc(location, MODIFY_EXPR, void_type_node,
- result, vals.front()->get_tree());
- ret = fold_build1_loc(location, RETURN_EXPR, void_type_node, set);
+ tree set = fold_build2_loc(location.gcc_location(), MODIFY_EXPR,
+ void_type_node, result,
+ vals.front()->get_tree());
+ ret = fold_build1_loc(location.gcc_location(), RETURN_EXPR,
+ void_type_node, set);
}
else
{
@@ -808,20 +813,23 @@ Gcc_backend::return_statement(Bfunction* bfunction,
p++, field = DECL_CHAIN(field))
{
gcc_assert(field != NULL_TREE);
- tree ref = fold_build3_loc(location, COMPONENT_REF, TREE_TYPE(field),
- rettmp, field, NULL_TREE);
+ tree ref = fold_build3_loc(location.gcc_location(), COMPONENT_REF,
+ TREE_TYPE(field), rettmp, field,
+ NULL_TREE);
tree val = (*p)->get_tree();
if (val == error_mark_node)
return this->error_statement();
- tree set = fold_build2_loc(location, MODIFY_EXPR, void_type_node,
+ tree set = fold_build2_loc(location.gcc_location(), MODIFY_EXPR,
+ void_type_node,
ref, (*p)->get_tree());
append_to_statement_list(set, &stmt_list);
}
gcc_assert(field == NULL_TREE);
- tree set = fold_build2_loc(location, MODIFY_EXPR, void_type_node,
+ tree set = fold_build2_loc(location.gcc_location(), MODIFY_EXPR,
+ void_type_node,
result, rettmp);
- tree ret_expr = fold_build1_loc(location, RETURN_EXPR, void_type_node,
- set);
+ tree ret_expr = fold_build1_loc(location.gcc_location(), RETURN_EXPR,
+ void_type_node, set);
append_to_statement_list(ret_expr, &stmt_list);
ret = stmt_list;
}
@@ -832,7 +840,7 @@ Gcc_backend::return_statement(Bfunction* bfunction,
Bstatement*
Gcc_backend::if_statement(Bexpression* condition, Bblock* then_block,
- Bblock* else_block, source_location location)
+ Bblock* else_block, Location location)
{
tree cond_tree = condition->get_tree();
tree then_tree = then_block->get_tree();
@@ -841,8 +849,8 @@ Gcc_backend::if_statement(Bexpression* condition, Bblock* then_block,
|| then_tree == error_mark_node
|| else_tree == error_mark_node)
return this->error_statement();
- tree ret = build3_loc(location, COND_EXPR, void_type_node, cond_tree,
- then_tree, else_tree);
+ tree ret = build3_loc(location.gcc_location(), COND_EXPR, void_type_node,
+ cond_tree, then_tree, else_tree);
return this->make_statement(ret);
}
@@ -853,7 +861,7 @@ Gcc_backend::switch_statement(
Bexpression* value,
const std::vector<std::vector<Bexpression*> >& cases,
const std::vector<Bstatement*>& statements,
- source_location switch_location)
+ Location switch_location)
{
gcc_assert(cases.size() == statements.size());
@@ -866,8 +874,8 @@ Gcc_backend::switch_statement(
if (pc->empty())
{
source_location loc = (*ps != NULL
- ? EXPR_LOCATION((*ps)->get_tree())
- : UNKNOWN_LOCATION);
+ ? EXPR_LOCATION((*ps)->get_tree())
+ : UNKNOWN_LOCATION);
tree label = create_artificial_label(loc);
tree c = build_case_label(NULL_TREE, NULL_TREE, label);
append_to_statement_list(c, &stmt_list);
@@ -900,8 +908,8 @@ Gcc_backend::switch_statement(
tree tv = value->get_tree();
if (tv == error_mark_node)
return this->error_statement();
- tree t = build3_loc(switch_location, SWITCH_EXPR, void_type_node,
- tv, stmt_list, NULL_TREE);
+ tree t = build3_loc(switch_location.gcc_location(), SWITCH_EXPR,
+ void_type_node, tv, stmt_list, NULL_TREE);
return this->make_statement(t);
}
@@ -948,8 +956,8 @@ Gcc_backend::statement_list(const std::vector<Bstatement*>& statements)
Bblock*
Gcc_backend::block(Bfunction* function, Bblock* enclosing,
const std::vector<Bvariable*>& vars,
- source_location start_location,
- source_location)
+ Location start_location,
+ Location)
{
tree block_tree = make_node(BLOCK);
if (enclosing == NULL)
@@ -1010,8 +1018,9 @@ Gcc_backend::block(Bfunction* function, Bblock* enclosing,
TREE_USED(block_tree) = 1;
- tree bind_tree = build3_loc(start_location, BIND_EXPR, void_type_node,
- BLOCK_VARS(block_tree), NULL_TREE, block_tree);
+ tree bind_tree = build3_loc(start_location.gcc_location(), BIND_EXPR,
+ void_type_node, BLOCK_VARS(block_tree),
+ NULL_TREE, block_tree);
TREE_SIDE_EFFECTS(bind_tree) = 1;
return new Bblock(bind_tree);
@@ -1057,7 +1066,7 @@ Gcc_backend::global_variable(const std::string& package_name,
Btype* btype,
bool is_external,
bool is_hidden,
- source_location location)
+ Location location)
{
tree type_tree = btype->get_tree();
if (type_tree == error_mark_node)
@@ -1066,7 +1075,7 @@ Gcc_backend::global_variable(const std::string& package_name,
std::string var_name(package_name);
var_name.push_back('.');
var_name.append(name);
- tree decl = build_decl(location, VAR_DECL,
+ tree decl = build_decl(location.gcc_location(), VAR_DECL,
get_identifier_from_string(var_name),
type_tree);
if (is_external)
@@ -1109,12 +1118,12 @@ Gcc_backend::global_variable_set_init(Bvariable* var, Bexpression* expr)
Bvariable*
Gcc_backend::local_variable(Bfunction* function, const std::string& name,
Btype* btype, bool is_address_taken,
- source_location location)
+ Location location)
{
tree type_tree = btype->get_tree();
if (type_tree == error_mark_node)
return this->error_variable();
- tree decl = build_decl(location, VAR_DECL,
+ tree decl = build_decl(location.gcc_location(), VAR_DECL,
get_identifier_from_string(name),
type_tree);
DECL_CONTEXT(decl) = function->get_tree();
@@ -1130,12 +1139,12 @@ Gcc_backend::local_variable(Bfunction* function, const std::string& name,
Bvariable*
Gcc_backend::parameter_variable(Bfunction* function, const std::string& name,
Btype* btype, bool is_address_taken,
- source_location location)
+ Location location)
{
tree type_tree = btype->get_tree();
if (type_tree == error_mark_node)
return this->error_variable();
- tree decl = build_decl(location, PARM_DECL,
+ tree decl = build_decl(location.gcc_location(), PARM_DECL,
get_identifier_from_string(name),
type_tree);
DECL_CONTEXT(decl) = function->get_tree();
@@ -1153,7 +1162,7 @@ Bvariable*
Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock,
Btype* btype, Bexpression* binit,
bool is_address_taken,
- source_location location,
+ Location location,
Bstatement** pstatement)
{
tree type_tree = btype->get_tree();
@@ -1171,7 +1180,7 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock,
else
{
gcc_assert(bblock != NULL);
- var = build_decl(location, VAR_DECL,
+ var = build_decl(location.gcc_location(), VAR_DECL,
create_tmp_var_name("GOTMP"),
type_tree);
DECL_ARTIFICIAL(var) = 1;
@@ -1199,12 +1208,14 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock,
}
if (init_tree != NULL_TREE)
- DECL_INITIAL(var) = fold_convert_loc(location, type_tree, init_tree);
+ DECL_INITIAL(var) = fold_convert_loc(location.gcc_location(), type_tree,
+ init_tree);
if (is_address_taken)
TREE_ADDRESSABLE(var) = 1;
- *pstatement = this->make_statement(build1_loc(location, DECL_EXPR,
+ *pstatement = this->make_statement(build1_loc(location.gcc_location(),
+ DECL_EXPR,
void_type_node, var));
return new Bvariable(var);
}
@@ -1213,13 +1224,13 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock,
Bvariable*
Gcc_backend::immutable_struct(const std::string& name, bool, Btype* btype,
- source_location location)
+ Location location)
{
tree type_tree = btype->get_tree();
if (type_tree == error_mark_node)
return this->error_variable();
gcc_assert(TREE_CODE(type_tree) == RECORD_TYPE);
- tree decl = build_decl(location, VAR_DECL,
+ tree decl = build_decl(location.gcc_location(), VAR_DECL,
get_identifier_from_string(name),
build_qualified_type(type_tree, TYPE_QUAL_CONST));
TREE_STATIC(decl) = 1;
@@ -1241,7 +1252,7 @@ Gcc_backend::immutable_struct(const std::string& name, bool, Btype* btype,
void
Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&,
bool is_common, Btype*,
- source_location,
+ Location,
Bexpression* initializer)
{
tree decl = var->get_tree();
@@ -1268,13 +1279,13 @@ Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&,
Bvariable*
Gcc_backend::immutable_struct_reference(const std::string& name, Btype* btype,
- source_location location)
+ Location location)
{
tree type_tree = btype->get_tree();
if (type_tree == error_mark_node)
return this->error_variable();
gcc_assert(TREE_CODE(type_tree) == RECORD_TYPE);
- tree decl = build_decl(location, VAR_DECL,
+ tree decl = build_decl(location.gcc_location(), VAR_DECL,
get_identifier_from_string(name),
build_qualified_type(type_tree, TYPE_QUAL_CONST));
TREE_READONLY(decl) = 1;
@@ -1290,15 +1301,16 @@ Gcc_backend::immutable_struct_reference(const std::string& name, Btype* btype,
Blabel*
Gcc_backend::label(Bfunction* function, const std::string& name,
- source_location location)
+ Location location)
{
tree decl;
if (name.empty())
- decl = create_artificial_label(location);
+ decl = create_artificial_label(location.gcc_location());
else
{
tree id = get_identifier_from_string(name);
- decl = build_decl(location, LABEL_DECL, id, void_type_node);
+ decl = build_decl(location.gcc_location(), LABEL_DECL, id,
+ void_type_node);
DECL_CONTEXT(decl) = function->get_tree();
}
return new Blabel(decl);
@@ -1318,23 +1330,25 @@ Gcc_backend::label_definition_statement(Blabel* label)
// Make a goto statement.
Bstatement*
-Gcc_backend::goto_statement(Blabel* label, source_location location)
+Gcc_backend::goto_statement(Blabel* label, Location location)
{
tree lab = label->get_tree();
- tree ret = fold_build1_loc(location, GOTO_EXPR, void_type_node, lab);
+ tree ret = fold_build1_loc(location.gcc_location(), GOTO_EXPR, void_type_node,
+ lab);
return this->make_statement(ret);
}
// Get the address of a label.
Bexpression*
-Gcc_backend::label_address(Blabel* label, source_location location)
+Gcc_backend::label_address(Blabel* label, Location location)
{
tree lab = label->get_tree();
TREE_USED(lab) = 1;
TREE_ADDRESSABLE(lab) = 1;
- tree ret = fold_convert_loc(location, ptr_type_node,
- build_fold_addr_expr_loc(location, lab));
+ tree ret = fold_convert_loc(location.gcc_location(), ptr_type_node,
+ build_fold_addr_expr_loc(location.gcc_location(),
+ lab));
return this->make_expression(ret);
}
diff --git a/gcc/go/go-linemap.cc b/gcc/go/go-linemap.cc
new file mode 100644
index 00000000000..b41559ed4ca
--- /dev/null
+++ b/gcc/go/go-linemap.cc
@@ -0,0 +1,126 @@
+// go-linemap.cc -- GCC implementation of Linemap.
+
+// Copyright 2011 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.
+
+#include "go-linemap.h"
+
+// This class implements the Linemap interface defined by the
+// frontend.
+
+class Gcc_linemap : public Linemap
+{
+ public:
+ Gcc_linemap()
+ : Linemap(),
+ in_file_(false)
+ { }
+
+ void
+ start_file(const char* file_name, unsigned int line_begin);
+
+ void
+ start_line(unsigned int line_number, unsigned int line_size);
+
+ Location
+ get_location(unsigned int column);
+
+ void
+ stop();
+
+ protected:
+ Location
+ get_predeclared_location();
+
+ Location
+ get_unknown_location();
+
+ bool
+ is_predeclared(Location);
+
+ bool
+ is_unknown(Location);
+
+ private:
+ // Whether we are currently reading a file.
+ bool in_file_;
+};
+
+Linemap* Linemap::instance_ = NULL;
+
+// Start getting locations from a new file.
+
+void
+Gcc_linemap::start_file(const char *file_name, unsigned line_begin)
+{
+ if (this->in_file_)
+ linemap_add(line_table, LC_LEAVE, 0, NULL, 0);
+ linemap_add(line_table, LC_ENTER, 0, file_name, line_begin);
+ this->in_file_ = true;
+}
+
+// Stop getting locations.
+
+void
+Gcc_linemap::stop()
+{
+ linemap_add(line_table, LC_LEAVE, 0, NULL, 0);
+ this->in_file_ = false;
+}
+
+// Start a new line.
+
+void
+Gcc_linemap::start_line(unsigned lineno, unsigned linesize)
+{
+ linemap_line_start(line_table, lineno, linesize);
+}
+
+// Get a location.
+
+Location
+Gcc_linemap::get_location(unsigned column)
+{
+ return Location(linemap_position_for_column(line_table, column));
+}
+
+// Get the unknown location.
+
+Location
+Gcc_linemap::get_unknown_location()
+{
+ return Location(UNKNOWN_LOCATION);
+}
+
+// Get the predeclared location.
+
+Location
+Gcc_linemap::get_predeclared_location()
+{
+ return Location(BUILTINS_LOCATION);
+}
+
+// Return whether a location is the predeclared location.
+
+bool
+Gcc_linemap::is_predeclared(Location loc)
+{
+ return loc.gcc_location() == BUILTINS_LOCATION;
+}
+
+// Return whether a location is the unknown location.
+
+bool
+Gcc_linemap::is_unknown(Location loc)
+{
+ return loc.gcc_location() == UNKNOWN_LOCATION;
+}
+
+// Return the Linemap to use for the gcc backend.
+
+Linemap*
+go_get_linemap()
+{
+ return new Gcc_linemap;
+}
diff --git a/gcc/go/go-location.h b/gcc/go/go-location.h
new file mode 100644
index 00000000000..f2731d96862
--- /dev/null
+++ b/gcc/go/go-location.h
@@ -0,0 +1,45 @@
+// go-location.h -- GCC specific Location declaration. -*- C++ -*-
+
+// Copyright 2011 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.
+
+#ifndef GO_LOCATION_H
+#define GO_LOCATION_H
+
+#include "go-system.h"
+
+// A location in an input source file.
+
+class Location
+{
+ public:
+ Location()
+ : gcc_loc_(UNKNOWN_LOCATION)
+ { }
+
+ explicit Location(source_location loc)
+ : gcc_loc_(loc)
+ { }
+
+ source_location
+ gcc_location() const
+ { return this->gcc_loc_; }
+
+ // Temporary hack till error_at and warning_at can deal with a Location.
+ operator source_location() const
+ { return this->gcc_loc_; }
+
+ private:
+ source_location gcc_loc_;
+};
+
+// The Go frontend requires the ability to compare Locations.
+
+inline bool
+operator<(Location loca, Location locb)
+{
+ return loca.gcc_location() < locb.gcc_location();
+}
+
+#endif // !defined(GO_LOCATION_H)
diff --git a/gcc/go/gofrontend/backend.h b/gcc/go/gofrontend/backend.h
index b18c18c763f..24a0132da99 100644
--- a/gcc/go/gofrontend/backend.h
+++ b/gcc/go/gofrontend/backend.h
@@ -46,14 +46,14 @@ class Backend
{
std::string name;
Btype* btype;
- source_location location;
+ Location location;
Btyped_identifier()
: name(), btype(NULL), location(UNKNOWN_LOCATION)
{ }
Btyped_identifier(const std::string& a_name, Btype* a_btype,
- source_location a_location)
+ Location a_location)
: name(a_name), btype(a_btype), location(a_location)
{ }
};
@@ -100,7 +100,7 @@ class Backend
function_type(const Btyped_identifier& receiver,
const std::vector<Btyped_identifier>& parameters,
const std::vector<Btyped_identifier>& results,
- source_location location) = 0;
+ Location location) = 0;
// Get a struct type.
virtual Btype*
@@ -121,7 +121,7 @@ class Backend
// parameter to set_placeholder_pointer_type or
// set_placeholder_function_type.
virtual Btype*
- placeholder_pointer_type(const std::string& name, source_location,
+ placeholder_pointer_type(const std::string& name, Location,
bool for_function) = 0;
// Fill in a placeholder pointer type as a pointer. This takes a
@@ -141,7 +141,7 @@ class Backend
// Create a placeholder struct type. This is used for a named
// struct type, as with placeholder_pointer_type.
virtual Btype*
- placeholder_struct_type(const std::string& name, source_location) = 0;
+ placeholder_struct_type(const std::string& name, Location) = 0;
// Fill in a placeholder struct type. This takes a type returned by
// placeholder_struct_type and arranges for it to become a real
@@ -156,7 +156,7 @@ class Backend
// type, as with placeholder_pointer_type, to handle cases like
// type A []*A.
virtual Btype*
- placeholder_array_type(const std::string& name, source_location) = 0;
+ placeholder_array_type(const std::string& name, Location) = 0;
// Fill in a placeholder array type. This takes a type returned by
// placeholder_array_type and arranges for it to become a real array
@@ -172,7 +172,7 @@ class Backend
// placeholder_array_type.. (It may be called for a pointer,
// struct, or array type in a case like "type P *byte; type Q P".)
virtual Btype*
- named_type(const std::string& name, Btype*, source_location) = 0;
+ named_type(const std::string& name, Btype*, Location) = 0;
// Create a marker for a circular pointer type. Go pointer and
// function types can refer to themselves in ways that are not
@@ -227,18 +227,18 @@ class Backend
// Create an assignment statement.
virtual Bstatement*
assignment_statement(Bexpression* lhs, Bexpression* rhs,
- source_location) = 0;
+ Location) = 0;
// Create a return statement, passing the representation of the
// function and the list of values to return.
virtual Bstatement*
return_statement(Bfunction*, const std::vector<Bexpression*>&,
- source_location) = 0;
+ Location) = 0;
// Create an if statement. ELSE_BLOCK may be NULL.
virtual Bstatement*
if_statement(Bexpression* condition, Bblock* then_block, Bblock* else_block,
- source_location) = 0;
+ Location) = 0;
// Create a switch statement where the case values are constants.
// CASES and STATEMENTS must have the same number of entries. If
@@ -251,7 +251,7 @@ class Backend
switch_statement(Bexpression* value,
const std::vector<std::vector<Bexpression*> >& cases,
const std::vector<Bstatement*>& statements,
- source_location) = 0;
+ Location) = 0;
// Create a single statement from two statements.
virtual Bstatement*
@@ -276,7 +276,7 @@ class Backend
virtual Bblock*
block(Bfunction* function, Bblock* enclosing,
const std::vector<Bvariable*>& vars,
- source_location start_location, source_location end_location) = 0;
+ Location start_location, Location end_location) = 0;
// Add the statements to a block. The block is created first. Then
// the statements are created. Then the statements are added to the
@@ -313,7 +313,7 @@ class Backend
Btype* btype,
bool is_external,
bool is_hidden,
- source_location location) = 0;
+ Location location) = 0;
// A global variable will 1) be initialized to zero, or 2) be
// initialized to a constant value, or 3) be initialized in the init
@@ -335,7 +335,7 @@ class Backend
// init_statement to set the initial value.
virtual Bvariable*
local_variable(Bfunction* function, const std::string& name, Btype* type,
- bool is_address_taken, source_location location) = 0;
+ bool is_address_taken, Location location) = 0;
// Create a function parameter. This is an incoming parameter, not
// a result parameter (result parameters are treated as local
@@ -343,7 +343,7 @@ class Backend
virtual Bvariable*
parameter_variable(Bfunction* function, const std::string& name,
Btype* type, bool is_address_taken,
- source_location location) = 0;
+ Location location) = 0;
// Create a temporary variable. A temporary variable has no name,
// just a type. We pass in FUNCTION and BLOCK in case they are
@@ -358,7 +358,7 @@ class Backend
// *PSTATEMENT to a statement which initializes the variable.
virtual Bvariable*
temporary_variable(Bfunction*, Bblock*, Btype*, Bexpression* init,
- bool address_is_taken, source_location location,
+ bool address_is_taken, Location location,
Bstatement** pstatement) = 0;
// Create a named immutable initialized data structure. This is
@@ -384,7 +384,7 @@ class Backend
// set_immutable_struct_initializer.
virtual Bvariable*
immutable_struct(const std::string& name, bool is_common, Btype* type,
- source_location) = 0;
+ Location) = 0;
// Set the initial value of a variable created by immutable_struct.
// The NAME, IS_COMMON, TYPE, and location parameters are the same
@@ -395,7 +395,7 @@ class Backend
// immutable_struct.
virtual void
immutable_struct_set_init(Bvariable*, const std::string& name,
- bool is_common, Btype* type, source_location,
+ bool is_common, Btype* type, Location,
Bexpression* initializer) = 0;
// Create a reference to a named immutable initialized data
@@ -405,7 +405,7 @@ class Backend
// corresponds to an extern const global variable in C.
virtual Bvariable*
immutable_struct_reference(const std::string& name, Btype* type,
- source_location) = 0;
+ Location) = 0;
// Labels.
@@ -413,7 +413,7 @@ class Backend
// created by the frontend for a loop construct. The location is
// where the the label is defined.
virtual Blabel*
- label(Bfunction*, const std::string& name, source_location) = 0;
+ label(Bfunction*, const std::string& name, Location) = 0;
// Create a statement which defines a label. This statement will be
// put into the codestream at the point where the label should be
@@ -423,13 +423,13 @@ class Backend
// Create a goto statement to a label.
virtual Bstatement*
- goto_statement(Blabel*, source_location) = 0;
+ goto_statement(Blabel*, Location) = 0;
// Create an expression for the address of a label. This is used to
// get the return address of a deferred function which may call
// recover.
virtual Bexpression*
- label_address(Blabel*, source_location) = 0;
+ label_address(Blabel*, Location) = 0;
};
// The backend interface has to define this function.
diff --git a/gcc/go/gofrontend/dataflow.cc b/gcc/go/gofrontend/dataflow.cc
index a4661b73cbc..572ab3631cd 100644
--- a/gcc/go/gofrontend/dataflow.cc
+++ b/gcc/go/gofrontend/dataflow.cc
@@ -189,8 +189,8 @@ Dataflow::Compare_vars::operator()(const Named_object* no1,
return false;
// We can have two different variables with the same name.
- source_location loc1 = no1->location();
- source_location loc2 = no2->location();
+ Location loc1 = no1->location();
+ Location loc2 = no2->location();
if (loc1 < loc2)
return false;
if (loc1 > loc2)
diff --git a/gcc/go/gofrontend/export.cc b/gcc/go/gofrontend/export.cc
index 48088adddd3..0832055510c 100644
--- a/gcc/go/gofrontend/export.cc
+++ b/gcc/go/gofrontend/export.cc
@@ -279,7 +279,7 @@ Export::write_type(const Type* type)
if (named_type != NULL)
{
// The builtin types should have been predefined.
- go_assert(named_type->location() != BUILTINS_LOCATION
+ go_assert(!Linemap::is_predeclared_location(named_type->location())
|| (named_type->named_object()->package()->name()
== "unsafe"));
named_object = named_type->named_object();
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index e308b9a4c31..a2cf33eb67b 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -41,7 +41,7 @@ extern "C"
// Class Expression.
Expression::Expression(Expression_classification classification,
- source_location location)
+ Location location)
: classification_(classification), location_(location)
{
}
@@ -203,7 +203,7 @@ Expression::determine_type_no_context()
tree
Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
Type* rhs_type, tree rhs_tree,
- source_location location)
+ Location location)
{
if (lhs_type == rhs_type)
return rhs_tree;
@@ -283,7 +283,7 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
|| INTEGRAL_TYPE_P(lhs_type_tree)
|| SCALAR_FLOAT_TYPE_P(lhs_type_tree)
|| COMPLEX_FLOAT_TYPE_P(lhs_type_tree))
- return fold_convert_loc(location, lhs_type_tree, rhs_tree);
+ return fold_convert_loc(location.gcc_location(), lhs_type_tree, rhs_tree);
else if (TREE_CODE(lhs_type_tree) == RECORD_TYPE
&& TREE_CODE(TREE_TYPE(rhs_tree)) == RECORD_TYPE)
{
@@ -291,8 +291,8 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
// gotten here.
go_assert(int_size_in_bytes(lhs_type_tree)
== int_size_in_bytes(TREE_TYPE(rhs_tree)));
- return fold_build1_loc(location, VIEW_CONVERT_EXPR, lhs_type_tree,
- rhs_tree);
+ return fold_build1_loc(location.gcc_location(), VIEW_CONVERT_EXPR,
+ lhs_type_tree, rhs_tree);
}
else
{
@@ -307,7 +307,7 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
tree
Expression::convert_type_to_interface(Translate_context* context,
Type* lhs_type, Type* rhs_type,
- tree rhs_tree, source_location location)
+ tree rhs_tree, Location location)
{
Gogo* gogo = context->gogo();
Interface_type* lhs_interface_type = lhs_type->interface_type();
@@ -356,8 +356,8 @@ Expression::convert_type_to_interface(Translate_context* context,
method_table =
rhs_named_type->interface_method_table(gogo, lhs_interface_type,
is_pointer);
- first_field_value = fold_convert_loc(location, const_ptr_type_node,
- method_table);
+ first_field_value = fold_convert_loc(location.gcc_location(),
+ const_ptr_type_node, method_table);
}
if (first_field_value == error_mark_node)
return error_mark_node;
@@ -371,7 +371,8 @@ Expression::convert_type_to_interface(Translate_context* context,
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
(lhs_is_empty ? "__type_descriptor" : "__methods")) == 0);
elt->index = field;
- elt->value = fold_convert_loc(location, TREE_TYPE(field), first_field_value);
+ elt->value = fold_convert_loc(location.gcc_location(), TREE_TYPE(field),
+ first_field_value);
elt = VEC_quick_push(constructor_elt, init, NULL);
field = DECL_CHAIN(field);
@@ -392,16 +393,17 @@ Expression::convert_type_to_interface(Translate_context* context,
tree object_size = TYPE_SIZE_UNIT(TREE_TYPE(rhs_tree));
tree space = gogo->allocate_memory(rhs_type, object_size, location);
- space = fold_convert_loc(location, build_pointer_type(TREE_TYPE(rhs_tree)),
- space);
+ space = fold_convert_loc(location.gcc_location(),
+ build_pointer_type(TREE_TYPE(rhs_tree)), space);
space = save_expr(space);
- tree ref = build_fold_indirect_ref_loc(location, space);
+ tree ref = build_fold_indirect_ref_loc(location.gcc_location(), space);
TREE_THIS_NOTRAP(ref) = 1;
- tree set = fold_build2_loc(location, MODIFY_EXPR, void_type_node,
- ref, rhs_tree);
+ tree set = fold_build2_loc(location.gcc_location(), MODIFY_EXPR,
+ void_type_node, ref, rhs_tree);
- elt->value = fold_convert_loc(location, TREE_TYPE(field), space);
+ elt->value = fold_convert_loc(location.gcc_location(), TREE_TYPE(field),
+ space);
return build2(COMPOUND_EXPR, lhs_type_tree, set,
build_constructor(lhs_type_tree, init));
@@ -414,7 +416,7 @@ Expression::convert_type_to_interface(Translate_context* context,
tree
Expression::get_interface_type_descriptor(Translate_context*,
Type* rhs_type, tree rhs_tree,
- source_location location)
+ Location location)
{
tree rhs_type_tree = TREE_TYPE(rhs_tree);
go_assert(TREE_CODE(rhs_type_tree) == RECORD_TYPE);
@@ -432,18 +434,20 @@ Expression::get_interface_type_descriptor(Translate_context*,
== 0);
go_assert(POINTER_TYPE_P(TREE_TYPE(v)));
v = save_expr(v);
- tree v1 = build_fold_indirect_ref_loc(location, v);
+ tree v1 = build_fold_indirect_ref_loc(location.gcc_location(), v);
go_assert(TREE_CODE(TREE_TYPE(v1)) == RECORD_TYPE);
tree f = TYPE_FIELDS(TREE_TYPE(v1));
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(f)), "__type_descriptor")
== 0);
v1 = build3(COMPONENT_REF, TREE_TYPE(f), v1, f, NULL_TREE);
- tree eq = fold_build2_loc(location, EQ_EXPR, boolean_type_node, v,
- fold_convert_loc(location, TREE_TYPE(v),
- null_pointer_node));
- tree n = fold_convert_loc(location, TREE_TYPE(v1), null_pointer_node);
- return fold_build3_loc(location, COND_EXPR, TREE_TYPE(v1),
+ tree eq = fold_build2_loc(location.gcc_location(), EQ_EXPR, boolean_type_node,
+ v, fold_convert_loc(location.gcc_location(),
+ TREE_TYPE(v),
+ null_pointer_node));
+ tree n = fold_convert_loc(location.gcc_location(), TREE_TYPE(v1),
+ null_pointer_node);
+ return fold_build3_loc(location.gcc_location(), COND_EXPR, TREE_TYPE(v1),
eq, n, v1);
}
@@ -454,7 +458,7 @@ tree
Expression::convert_interface_to_interface(Translate_context* context,
Type *lhs_type, Type *rhs_type,
tree rhs_tree, bool for_type_guard,
- source_location location)
+ Location location)
{
Gogo* gogo = context->gogo();
Interface_type* lhs_interface_type = lhs_type->interface_type();
@@ -509,7 +513,8 @@ Expression::convert_interface_to_interface(Translate_context* context,
return error_mark_node;
// This will panic if the interface conversion fails.
TREE_NOTHROW(assert_interface_decl) = 0;
- elt->value = fold_convert_loc(location, TREE_TYPE(field), call);
+ elt->value = fold_convert_loc(location.gcc_location(), TREE_TYPE(field),
+ call);
}
else if (lhs_is_empty)
{
@@ -542,7 +547,8 @@ Expression::convert_interface_to_interface(Translate_context* context,
return error_mark_node;
// This will panic if the interface conversion fails.
TREE_NOTHROW(convert_interface_decl) = 0;
- elt->value = fold_convert_loc(location, TREE_TYPE(field), call);
+ elt->value = fold_convert_loc(location.gcc_location(), TREE_TYPE(field),
+ call);
}
// The second field is simply the object pointer.
@@ -568,7 +574,7 @@ Expression::convert_interface_to_interface(Translate_context* context,
tree
Expression::convert_interface_to_type(Translate_context* context,
Type *lhs_type, Type* rhs_type,
- tree rhs_tree, source_location location)
+ tree rhs_tree, Location location)
{
Gogo* gogo = context->gogo();
tree rhs_type_tree = TREE_TYPE(rhs_tree);
@@ -621,12 +627,13 @@ Expression::convert_interface_to_type(Translate_context* context,
// Otherwise it points to the value.
if (lhs_type->points_to() == NULL)
{
- val = fold_convert_loc(location, build_pointer_type(lhs_type_tree), val);
- val = build_fold_indirect_ref_loc(location, val);
+ val = fold_convert_loc(location.gcc_location(),
+ build_pointer_type(lhs_type_tree), val);
+ val = build_fold_indirect_ref_loc(location.gcc_location(), val);
}
return build2(COMPOUND_EXPR, lhs_type_tree, call,
- fold_convert_loc(location, lhs_type_tree, val));
+ fold_convert_loc(location.gcc_location(), lhs_type_tree, val));
}
// Convert an expression to a tree. This is implemented by the child
@@ -748,14 +755,14 @@ Expression::complex_constant_tree(mpfr_t real, mpfr_t imag, tree type)
tree
Expression::check_bounds(tree val, tree bound_type, tree sofar,
- source_location loc)
+ Location loc)
{
tree val_type = TREE_TYPE(val);
tree ret = NULL_TREE;
if (!TYPE_UNSIGNED(val_type))
{
- ret = fold_build2_loc(loc, LT_EXPR, boolean_type_node, val,
+ ret = fold_build2_loc(loc.gcc_location(), LT_EXPR, boolean_type_node, val,
build_int_cst(val_type, 0));
if (ret == boolean_false_node)
ret = NULL_TREE;
@@ -770,15 +777,16 @@ Expression::check_bounds(tree val, tree bound_type, tree sofar,
&& !TYPE_UNSIGNED(bound_type)))
{
tree max = TYPE_MAX_VALUE(bound_type);
- tree big = fold_build2_loc(loc, GT_EXPR, boolean_type_node, val,
- fold_convert_loc(loc, val_type, max));
+ tree big = fold_build2_loc(loc.gcc_location(), GT_EXPR, boolean_type_node,
+ val, fold_convert_loc(loc.gcc_location(),
+ val_type, max));
if (big == boolean_false_node)
;
else if (ret == NULL_TREE)
ret = big;
else
- ret = fold_build2_loc(loc, TRUTH_OR_EXPR, boolean_type_node,
- ret, big);
+ ret = fold_build2_loc(loc.gcc_location(), TRUTH_OR_EXPR,
+ boolean_type_node, ret, big);
}
if (ret == NULL_TREE)
@@ -786,7 +794,7 @@ Expression::check_bounds(tree val, tree bound_type, tree sofar,
else if (sofar == NULL_TREE)
return ret;
else
- return fold_build2_loc(loc, TRUTH_OR_EXPR, boolean_type_node,
+ return fold_build2_loc(loc.gcc_location(), TRUTH_OR_EXPR, boolean_type_node,
sofar, ret);
}
@@ -801,7 +809,7 @@ Expression::dump_expression(Ast_dump_context* ast_dump_context) const
class Error_expression : public Expression
{
public:
- Error_expression(source_location location)
+ Error_expression(Location location)
: Expression(EXPRESSION_ERROR, location)
{ }
@@ -869,7 +877,7 @@ Error_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
}
Expression*
-Expression::make_error(source_location location)
+Expression::make_error(Location location)
{
return new Error_expression(location);
}
@@ -881,7 +889,7 @@ class
Type_expression : public Expression
{
public:
- Type_expression(Type* type, source_location location)
+ Type_expression(Type* type, Location location)
: Expression(EXPRESSION_TYPE, location),
type_(type)
{ }
@@ -925,7 +933,7 @@ Type_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
}
Expression*
-Expression::make_type(Type* type, source_location location)
+Expression::make_type(Type* type, Location location)
{
return new Type_expression(type, location);
}
@@ -1037,7 +1045,7 @@ Var_expression::do_get_tree(Translate_context* context)
go_unreachable();
if (is_in_heap)
{
- ret = build_fold_indirect_ref_loc(this->location(), ret);
+ ret = build_fold_indirect_ref_loc(this->location().gcc_location(), ret);
TREE_THIS_NOTRAP(ret) = 1;
}
return ret;
@@ -1054,7 +1062,7 @@ Var_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
// Make a reference to a variable in an expression.
Expression*
-Expression::make_var_reference(Named_object* var, source_location location)
+Expression::make_var_reference(Named_object* var, Location location)
{
if (var->is_sink())
return Expression::make_sink(location);
@@ -1104,7 +1112,7 @@ Temporary_reference_expression::do_get_tree(Translate_context* context)
{
Btype* type_btype = this->type()->base()->get_backend(context->gogo());
tree type_tree = type_to_tree(type_btype);
- ret = fold_convert_loc(this->location(), type_tree, ret);
+ ret = fold_convert_loc(this->location().gcc_location(), type_tree, ret);
}
return ret;
}
@@ -1122,7 +1130,7 @@ Temporary_reference_expression::do_dump_expression(
Temporary_reference_expression*
Expression::make_temporary_reference(Temporary_statement* statement,
- source_location location)
+ Location location)
{
return new Temporary_reference_expression(statement, location);
}
@@ -1132,7 +1140,7 @@ Expression::make_temporary_reference(Temporary_statement* statement,
class Sink_expression : public Expression
{
public:
- Sink_expression(source_location location)
+ Sink_expression(Location location)
: Expression(EXPRESSION_SINK, location),
type_(NULL), var_(NULL_TREE)
{ }
@@ -1210,7 +1218,7 @@ Sink_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
// Make a sink expression.
Expression*
-Expression::make_sink(source_location location)
+Expression::make_sink(Location location)
{
return new Sink_expression(location);
}
@@ -1285,7 +1293,7 @@ Func_expression::get_tree_without_closure(Gogo* gogo)
if (fndecl == error_mark_node)
return error_mark_node;
- return build_fold_addr_expr_loc(this->location(), fndecl);
+ return build_fold_addr_expr_loc(this->location().gcc_location(), fndecl);
}
// Get the tree for a function expression. This is used when we take
@@ -1357,7 +1365,7 @@ Func_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
Expression*
Expression::make_func_reference(Named_object* function, Expression* closure,
- source_location location)
+ Location location)
{
return new Func_expression(function, closure, location);
}
@@ -1377,7 +1385,7 @@ Unknown_expression::name() const
Expression*
Unknown_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
{
- source_location location = this->location();
+ Location location = this->location();
Named_object* no = this->named_object_;
Named_object* real;
if (!no->is_unknown())
@@ -1433,7 +1441,7 @@ Unknown_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
// Make a reference to an unknown name.
Expression*
-Expression::make_unknown_reference(Named_object* no, source_location location)
+Expression::make_unknown_reference(Named_object* no, Location location)
{
return new Unknown_expression(no, location);
}
@@ -1443,7 +1451,7 @@ Expression::make_unknown_reference(Named_object* no, source_location location)
class Boolean_expression : public Expression
{
public:
- Boolean_expression(bool val, source_location location)
+ Boolean_expression(bool val, Location location)
: Expression(EXPRESSION_BOOLEAN, location),
val_(val), type_(NULL)
{ }
@@ -1528,7 +1536,7 @@ Boolean_expression::do_import(Import* imp)
// Make a boolean expression.
Expression*
-Expression::make_boolean(bool val, source_location location)
+Expression::make_boolean(bool val, Location location)
{
return new Boolean_expression(val, location);
}
@@ -1665,7 +1673,7 @@ String_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
// Make a string expression.
Expression*
-Expression::make_string(const std::string& val, source_location location)
+Expression::make_string(const std::string& val, Location location)
{
return new String_expression(val, location);
}
@@ -1675,7 +1683,7 @@ Expression::make_string(const std::string& val, source_location location)
class Integer_expression : public Expression
{
public:
- Integer_expression(const mpz_t* val, Type* type, source_location location)
+ Integer_expression(const mpz_t* val, Type* type, Location location)
: Expression(EXPRESSION_INTEGER, location),
type_(type)
{ mpz_init_set(this->val_, *val); }
@@ -1685,7 +1693,7 @@ class Integer_expression : public Expression
// Return whether VAL fits in the type.
static bool
- check_constant(mpz_t val, Type*, source_location);
+ check_constant(mpz_t val, Type*, Location);
// Write VAL to string dump.
static void
@@ -1778,7 +1786,7 @@ Integer_expression::do_determine_type(const Type_context* context)
bool
Integer_expression::check_constant(mpz_t val, Type* type,
- source_location location)
+ Location location)
{
if (type == NULL)
return true;
@@ -1985,7 +1993,7 @@ Integer_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
Expression*
Expression::make_integer(const mpz_t* val, Type* type,
- source_location location)
+ Location location)
{
return new Integer_expression(val, type, location);
}
@@ -1995,7 +2003,7 @@ Expression::make_integer(const mpz_t* val, Type* type,
class Float_expression : public Expression
{
public:
- Float_expression(const mpfr_t* val, Type* type, source_location location)
+ Float_expression(const mpfr_t* val, Type* type, Location location)
: Expression(EXPRESSION_FLOAT, location),
type_(type)
{
@@ -2008,7 +2016,7 @@ class Float_expression : public Expression
// Return whether VAL fits in the type.
static bool
- check_constant(mpfr_t val, Type*, source_location);
+ check_constant(mpfr_t val, Type*, Location);
// Write VAL to export data.
static void
@@ -2111,7 +2119,7 @@ Float_expression::do_determine_type(const Type_context* context)
bool
Float_expression::check_constant(mpfr_t val, Type* type,
- source_location location)
+ Location location)
{
if (type == NULL)
return true;
@@ -2237,7 +2245,7 @@ Float_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
// Make a float expression.
Expression*
-Expression::make_float(const mpfr_t* val, Type* type, source_location location)
+Expression::make_float(const mpfr_t* val, Type* type, Location location)
{
return new Float_expression(val, type, location);
}
@@ -2248,7 +2256,7 @@ class Complex_expression : public Expression
{
public:
Complex_expression(const mpfr_t* real, const mpfr_t* imag, Type* type,
- source_location location)
+ Location location)
: Expression(EXPRESSION_COMPLEX, location),
type_(type)
{
@@ -2262,7 +2270,7 @@ class Complex_expression : public Expression
// Return whether REAL/IMAG fits in the type.
static bool
- check_constant(mpfr_t real, mpfr_t imag, Type*, source_location);
+ check_constant(mpfr_t real, mpfr_t imag, Type*, Location);
// Write REAL/IMAG to string dump.
static void
@@ -2373,7 +2381,7 @@ Complex_expression::do_determine_type(const Type_context* context)
bool
Complex_expression::check_constant(mpfr_t real, mpfr_t imag, Type* type,
- source_location location)
+ Location location)
{
if (type == NULL)
return true;
@@ -2489,7 +2497,7 @@ Complex_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
Expression*
Expression::make_complex(const mpfr_t* real, const mpfr_t* imag, Type* type,
- source_location location)
+ Location location)
{
return new Complex_expression(real, imag, type, location);
}
@@ -2525,7 +2533,7 @@ class Find_named_object : public Traverse
class Const_expression : public Expression
{
public:
- Const_expression(Named_object* constant, source_location location)
+ Const_expression(Named_object* constant, Location location)
: Expression(EXPRESSION_CONST_REFERENCE, location),
constant_(constant), type_(NULL), seen_(false)
{ }
@@ -2982,7 +2990,7 @@ Const_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
Expression*
Expression::make_const_reference(Named_object* constant,
- source_location location)
+ Location location)
{
return new Const_expression(constant, location);
}
@@ -3028,7 +3036,7 @@ Find_named_object::expression(Expression** pexpr)
class Nil_expression : public Expression
{
public:
- Nil_expression(source_location location)
+ Nil_expression(Location location)
: Expression(EXPRESSION_NIL, location)
{ }
@@ -3077,7 +3085,7 @@ Nil_expression::do_import(Import* imp)
// Make a nil expression.
Expression*
-Expression::make_nil(source_location location)
+Expression::make_nil(Location location)
{
return new Nil_expression(location);
}
@@ -3090,7 +3098,7 @@ Expression::make_nil(source_location location)
class Iota_expression : public Parser_expression
{
public:
- Iota_expression(source_location location)
+ Iota_expression(Location location)
: Parser_expression(EXPRESSION_IOTA, location)
{ }
@@ -3115,7 +3123,7 @@ class Iota_expression : public Parser_expression
Expression*
Expression::make_iota()
{
- static Iota_expression iota_expression(UNKNOWN_LOCATION);
+ static Iota_expression iota_expression(Linemap::unknown_location());
return &iota_expression;
}
@@ -3125,7 +3133,7 @@ class Type_conversion_expression : public Expression
{
public:
Type_conversion_expression(Type* type, Expression* expr,
- source_location location)
+ Location location)
: Expression(EXPRESSION_CONVERSION, location),
type_(type), expr_(expr), may_convert_function_types_(false)
{ }
@@ -3234,7 +3242,7 @@ Type_conversion_expression::do_lower(Gogo*, Named_object*,
{
Type* type = this->type_;
Expression* val = this->expr_;
- source_location location = this->location();
+ Location location = this->location();
if (type->integer_type() != NULL)
{
@@ -3632,7 +3640,8 @@ Type_conversion_expression::do_get_tree(Translate_context* context)
tree valptr = fold_convert(const_ptr_type_node,
a->value_pointer_tree(gogo, expr_tree));
tree len = a->length_tree(gogo, expr_tree);
- len = fold_convert_loc(this->location(), integer_type_node, len);
+ len = fold_convert_loc(this->location().gcc_location(), integer_type_node,
+ len);
if (e->integer_type()->is_unsigned()
&& e->integer_type()->bits() == 8)
{
@@ -3702,7 +3711,8 @@ Type_conversion_expression::do_get_tree(Translate_context* context)
else if (this->may_convert_function_types_
&& type->function_type() != NULL
&& expr_type->function_type() != NULL)
- ret = fold_convert_loc(this->location(), type_tree, expr_tree);
+ ret = fold_convert_loc(this->location().gcc_location(), type_tree,
+ expr_tree);
else
ret = Expression::convert_for_assignment(context, type, expr_type,
expr_tree, this->location());
@@ -3750,7 +3760,7 @@ Type_conversion_expression::do_dump_expression(
// Make a type cast expression.
Expression*
-Expression::make_cast(Type* type, Expression* val, source_location location)
+Expression::make_cast(Type* type, Expression* val, Location location)
{
if (type->is_error_type() || val->is_error_expression())
return Expression::make_error(location);
@@ -3763,7 +3773,7 @@ class Unsafe_type_conversion_expression : public Expression
{
public:
Unsafe_type_conversion_expression(Type* type, Expression* expr,
- source_location location)
+ Location location)
: Expression(EXPRESSION_UNSAFE_CONVERSION, location),
type_(type), expr_(expr)
{ }
@@ -3827,7 +3837,7 @@ Unsafe_type_conversion_expression::do_get_tree(Translate_context* context)
if (type_tree == error_mark_node || expr_tree == error_mark_node)
return error_mark_node;
- source_location loc = this->location();
+ Location loc = this->location();
bool use_view_convert = false;
if (t->is_slice_type())
@@ -3873,9 +3883,10 @@ Unsafe_type_conversion_expression::do_get_tree(Translate_context* context)
go_unreachable();
if (use_view_convert)
- return fold_build1_loc(loc, VIEW_CONVERT_EXPR, type_tree, expr_tree);
+ return fold_build1_loc(loc.gcc_location(), VIEW_CONVERT_EXPR, type_tree,
+ expr_tree);
else
- return fold_convert_loc(loc, type_tree, expr_tree);
+ return fold_convert_loc(loc.gcc_location(), type_tree, expr_tree);
}
// Dump ast representation for an unsafe type conversion expression.
@@ -3894,7 +3905,7 @@ Unsafe_type_conversion_expression::do_dump_expression(
Expression*
Expression::make_unsafe_cast(Type* type, Expression* expr,
- source_location location)
+ Location location)
{
return new Unsafe_type_conversion_expression(type, expr, location);
}
@@ -3904,7 +3915,7 @@ Expression::make_unsafe_cast(Type* type, Expression* expr,
class Unary_expression : public Expression
{
public:
- Unary_expression(Operator op, Expression* expr, source_location location)
+ Unary_expression(Operator op, Expression* expr, Location location)
: Expression(EXPRESSION_UNARY, location),
op_(op), escapes_(true), create_temp_(false), expr_(expr)
{ }
@@ -3940,7 +3951,7 @@ class Unary_expression : public Expression
// could be done, false if not.
static bool
eval_integer(Operator op, Type* utype, mpz_t uval, mpz_t val,
- source_location);
+ Location);
// Apply unary opcode OP to UVAL, setting VAL. Return true if this
// could be done, false if not.
@@ -4029,7 +4040,7 @@ class Unary_expression : public Expression
Expression*
Unary_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
{
- source_location loc = this->location();
+ Location loc = this->location();
Operator op = this->op_;
Expression* expr = this->expr_;
@@ -4170,7 +4181,7 @@ Unary_expression::do_is_constant() const
bool
Unary_expression::eval_integer(Operator op, Type* utype, mpz_t uval, mpz_t val,
- source_location location)
+ Location location)
{
switch (op)
{
@@ -4470,7 +4481,7 @@ Unary_expression::do_get_tree(Translate_context* context)
if (expr == error_mark_node)
return error_mark_node;
- source_location loc = this->location();
+ Location loc = this->location();
switch (this->op_)
{
case OPERATOR_PLUS:
@@ -4482,7 +4493,7 @@ Unary_expression::do_get_tree(Translate_context* context)
tree compute_type = excess_precision_type(type);
if (compute_type != NULL_TREE)
expr = ::convert(compute_type, expr);
- tree ret = fold_build1_loc(loc, NEGATE_EXPR,
+ tree ret = fold_build1_loc(loc.gcc_location(), NEGATE_EXPR,
(compute_type != NULL_TREE
? compute_type
: type),
@@ -4494,13 +4505,15 @@ Unary_expression::do_get_tree(Translate_context* context)
case OPERATOR_NOT:
if (TREE_CODE(TREE_TYPE(expr)) == BOOLEAN_TYPE)
- return fold_build1_loc(loc, TRUTH_NOT_EXPR, TREE_TYPE(expr), expr);
+ return fold_build1_loc(loc.gcc_location(), TRUTH_NOT_EXPR,
+ TREE_TYPE(expr), expr);
else
- return fold_build2_loc(loc, NE_EXPR, boolean_type_node, expr,
- build_int_cst(TREE_TYPE(expr), 0));
+ return fold_build2_loc(loc.gcc_location(), NE_EXPR, boolean_type_node,
+ expr, build_int_cst(TREE_TYPE(expr), 0));
case OPERATOR_XOR:
- return fold_build1_loc(loc, BIT_NOT_EXPR, TREE_TYPE(expr), expr);
+ return fold_build1_loc(loc.gcc_location(), BIT_NOT_EXPR, TREE_TYPE(expr),
+ expr);
case OPERATOR_AND:
if (!this->create_temp_)
@@ -4516,7 +4529,7 @@ Unary_expression::do_get_tree(Translate_context* context)
// Build a decl for a constant constructor.
if (TREE_CODE(expr) == CONSTRUCTOR && TREE_CONSTANT(expr))
{
- tree decl = build_decl(this->location(), VAR_DECL,
+ tree decl = build_decl(this->location().gcc_location(), VAR_DECL,
create_tmp_var_name("C"), TREE_TYPE(expr));
DECL_EXTERNAL(decl) = 0;
TREE_PUBLIC(decl) = 0;
@@ -4540,13 +4553,14 @@ Unary_expression::do_get_tree(Translate_context* context)
DECL_IGNORED_P(tmp) = 1;
DECL_INITIAL(tmp) = expr;
TREE_ADDRESSABLE(tmp) = 1;
- return build2_loc(loc, COMPOUND_EXPR,
+ return build2_loc(loc.gcc_location(), COMPOUND_EXPR,
build_pointer_type(TREE_TYPE(expr)),
- build1_loc(loc, DECL_EXPR, void_type_node, tmp),
- build_fold_addr_expr_loc(loc, tmp));
+ build1_loc(loc.gcc_location(), DECL_EXPR,
+ void_type_node, tmp),
+ build_fold_addr_expr_loc(loc.gcc_location(), tmp));
}
- return build_fold_addr_expr_loc(loc, expr);
+ return build_fold_addr_expr_loc(loc.gcc_location(), expr);
case OPERATOR_MULT:
{
@@ -4561,15 +4575,18 @@ Unary_expression::do_get_tree(Translate_context* context)
{
if (!DECL_P(expr))
expr = save_expr(expr);
- tree compare = fold_build2_loc(loc, EQ_EXPR, boolean_type_node,
+ tree compare = fold_build2_loc(loc.gcc_location(), EQ_EXPR,
+ boolean_type_node,
expr,
fold_convert(TREE_TYPE(expr),
null_pointer_node));
tree crash = Gogo::runtime_error(RUNTIME_ERROR_NIL_DEREFERENCE,
loc);
- expr = fold_build2_loc(loc, COMPOUND_EXPR, TREE_TYPE(expr),
- build3(COND_EXPR, void_type_node,
- compare, crash, NULL_TREE),
+ expr = fold_build2_loc(loc.gcc_location(), COMPOUND_EXPR,
+ TREE_TYPE(expr), build3(COND_EXPR,
+ void_type_node,
+ compare, crash,
+ NULL_TREE),
expr);
}
@@ -4579,10 +4596,11 @@ Unary_expression::do_get_tree(Translate_context* context)
{
Type* pt = this->expr_->type()->points_to();
tree ind = type_to_tree(pt->get_backend(context->gogo()));
- expr = fold_convert_loc(loc, build_pointer_type(ind), expr);
+ expr = fold_convert_loc(loc.gcc_location(),
+ build_pointer_type(ind), expr);
}
- return build_fold_indirect_ref_loc(loc, expr);
+ return build_fold_indirect_ref_loc(loc.gcc_location(), expr);
}
default:
@@ -4659,7 +4677,7 @@ Unary_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
// Make a unary expression.
Expression*
-Expression::make_unary(Operator op, Expression* expr, source_location location)
+Expression::make_unary(Operator op, Expression* expr, Location location)
{
return new Unary_expression(op, expr, location);
}
@@ -4807,7 +4825,7 @@ Binary_expression::compare_complex(Operator op, Type* type,
bool
Binary_expression::eval_integer(Operator op, Type* left_type, mpz_t left_val,
Type* right_type, mpz_t right_val,
- source_location location, mpz_t val)
+ Location location, mpz_t val)
{
bool is_shift_op = false;
switch (op)
@@ -4947,7 +4965,7 @@ Binary_expression::eval_integer(Operator op, Type* left_type, mpz_t left_val,
bool
Binary_expression::eval_float(Operator op, Type* left_type, mpfr_t left_val,
Type* right_type, mpfr_t right_val,
- mpfr_t val, source_location location)
+ mpfr_t val, Location location)
{
switch (op)
{
@@ -5030,7 +5048,7 @@ Binary_expression::eval_complex(Operator op, Type* left_type,
Type *right_type,
mpfr_t right_real, mpfr_t right_imag,
mpfr_t real, mpfr_t imag,
- source_location location)
+ Location location)
{
switch (op)
{
@@ -5391,7 +5409,7 @@ Binary_expression::eval_complex(Operator op, Type* left_type,
Expression*
Binary_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
{
- source_location location = this->location();
+ Location location = this->location();
Operator op = this->op_;
Expression* left = this->left_;
Expression* right = this->right_;
@@ -6048,7 +6066,7 @@ Binary_expression::do_determine_type(const Type_context* context)
bool
Binary_expression::check_operator_type(Operator op, Type* type,
- source_location location)
+ Location location)
{
switch (op)
{
@@ -6222,7 +6240,7 @@ Binary_expression::do_check_types(Gogo*)
{
this->report_error(_("negative shift count"));
mpz_set_ui(val, 0);
- source_location rloc = this->right_->location();
+ Location rloc = this->right_->location();
this->right_ = Expression::make_integer(&val, right_type,
rloc);
}
@@ -6354,12 +6372,13 @@ Binary_expression::do_get_tree(Translate_context* context)
if (eval_saved == NULL_TREE)
eval_saved = right;
else
- eval_saved = fold_build2_loc(this->location(), COMPOUND_EXPR,
+ eval_saved = fold_build2_loc(this->location().gcc_location(),
+ COMPOUND_EXPR,
void_type_node, eval_saved, right);
}
}
- tree ret = fold_build2_loc(this->location(),
+ tree ret = fold_build2_loc(this->location().gcc_location(),
code,
compute_type != NULL_TREE ? compute_type : type,
left, right);
@@ -6378,35 +6397,38 @@ Binary_expression::do_get_tree(Translate_context* context)
tree compare = fold_build2(LT_EXPR, boolean_type_node, right,
build_int_cst_type(TREE_TYPE(right), bits));
- tree overflow_result = fold_convert_loc(this->location(),
+ tree overflow_result = fold_convert_loc(this->location().gcc_location(),
TREE_TYPE(left),
integer_zero_node);
if (this->op_ == OPERATOR_RSHIFT
&& !this->left_->type()->integer_type()->is_unsigned())
{
- tree neg = fold_build2_loc(this->location(), LT_EXPR,
- boolean_type_node, left,
- fold_convert_loc(this->location(),
- TREE_TYPE(left),
- integer_zero_node));
- tree neg_one = fold_build2_loc(this->location(),
- MINUS_EXPR, TREE_TYPE(left),
- fold_convert_loc(this->location(),
- TREE_TYPE(left),
- integer_zero_node),
- fold_convert_loc(this->location(),
- TREE_TYPE(left),
- integer_one_node));
- overflow_result = fold_build3_loc(this->location(), COND_EXPR,
- TREE_TYPE(left), neg, neg_one,
- overflow_result);
- }
-
- ret = fold_build3_loc(this->location(), COND_EXPR, TREE_TYPE(left),
- compare, ret, overflow_result);
+ tree neg =
+ fold_build2_loc(this->location().gcc_location(), LT_EXPR,
+ boolean_type_node, left,
+ fold_convert_loc(this->location().gcc_location(),
+ TREE_TYPE(left),
+ integer_zero_node));
+ tree neg_one =
+ fold_build2_loc(this->location().gcc_location(),
+ MINUS_EXPR, TREE_TYPE(left),
+ fold_convert_loc(this->location().gcc_location(),
+ TREE_TYPE(left),
+ integer_zero_node),
+ fold_convert_loc(this->location().gcc_location(),
+ TREE_TYPE(left),
+ integer_one_node));
+ overflow_result =
+ fold_build3_loc(this->location().gcc_location(), COND_EXPR,
+ TREE_TYPE(left), neg, neg_one,
+ overflow_result);
+ }
+
+ ret = fold_build3_loc(this->location().gcc_location(), COND_EXPR,
+ TREE_TYPE(left), compare, ret, overflow_result);
if (eval_saved != NULL_TREE)
- ret = fold_build2_loc(this->location(), COMPOUND_EXPR,
+ ret = fold_build2_loc(this->location().gcc_location(), COMPOUND_EXPR,
TREE_TYPE(ret), eval_saved, ret);
}
@@ -6622,7 +6644,7 @@ Binary_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
Expression*
Expression::make_binary(Operator op, Expression* left, Expression* right,
- source_location location)
+ Location location)
{
return new Binary_expression(op, left, right, location);
}
@@ -6633,7 +6655,7 @@ tree
Expression::comparison_tree(Translate_context* context, Operator op,
Type* left_type, tree left_tree,
Type* right_type, tree right_tree,
- source_location location)
+ Location location)
{
enum tree_code code;
switch (op)
@@ -6702,7 +6724,7 @@ Expression::comparison_tree(Translate_context* context, Operator op,
else if (TREE_ADDRESSABLE(TREE_TYPE(right_tree)) || DECL_P(right_tree))
{
make_tmp = NULL_TREE;
- arg = build_fold_addr_expr_loc(location, right_tree);
+ arg = build_fold_addr_expr_loc(location.gcc_location(), right_tree);
if (DECL_P(right_tree))
TREE_ADDRESSABLE(right_tree) = 1;
}
@@ -6714,10 +6736,10 @@ Expression::comparison_tree(Translate_context* context, Operator op,
DECL_INITIAL(tmp) = right_tree;
TREE_ADDRESSABLE(tmp) = 1;
make_tmp = build1(DECL_EXPR, void_type_node, tmp);
- SET_EXPR_LOCATION(make_tmp, location);
- arg = build_fold_addr_expr_loc(location, tmp);
+ SET_EXPR_LOCATION(make_tmp, location.gcc_location());
+ arg = build_fold_addr_expr_loc(location.gcc_location(), tmp);
}
- arg = fold_convert_loc(location, ptr_type_node, arg);
+ arg = fold_convert_loc(location.gcc_location(), ptr_type_node, arg);
tree descriptor = right_type->type_descriptor_pointer(context->gogo(),
location);
@@ -6872,7 +6894,7 @@ Expression::comparison_tree(Translate_context* context, Operator op,
tree ret = fold_build2(code, boolean_type_node, left_tree, right_tree);
if (CAN_HAVE_LOCATION_P(ret))
- SET_EXPR_LOCATION(ret, location);
+ SET_EXPR_LOCATION(ret, location.gcc_location());
return ret;
}
@@ -6972,7 +6994,7 @@ Bound_method_expression::do_dump_expression(Ast_dump_context* ast_dump_context)
Bound_method_expression*
Expression::make_bound_method(Expression* expr, Named_object* method,
- source_location location)
+ Location location)
{
return new Bound_method_expression(expr, method, location);
}
@@ -6984,7 +7006,7 @@ class Builtin_call_expression : public Call_expression
{
public:
Builtin_call_expression(Gogo* gogo, Expression* fn, Expression_list* args,
- bool is_varargs, source_location location);
+ bool is_varargs, Location location);
protected:
// This overrides Call_expression::do_lower.
@@ -7097,7 +7119,7 @@ Builtin_call_expression::Builtin_call_expression(Gogo* gogo,
Expression* fn,
Expression_list* args,
bool is_varargs,
- source_location location)
+ Location location)
: Call_expression(fn, args, is_varargs, location),
gogo_(gogo), code_(BUILTIN_INVALID), seen_(false)
{
@@ -7209,7 +7231,7 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function,
if (this->classification() == EXPRESSION_ERROR)
return this;
- source_location loc = this->location();
+ Location loc = this->location();
if (this->is_varargs() && this->code_ != BUILTIN_APPEND)
{
@@ -7369,7 +7391,7 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function,
Expression*
Builtin_call_expression::lower_make()
{
- source_location loc = this->location();
+ Location loc = this->location();
const Expression_list* args = this->args();
if (args == NULL || args->size() < 1)
@@ -7448,7 +7470,7 @@ Builtin_call_expression::lower_make()
return Expression::make_error(this->location());
}
- source_location type_loc = first_arg->location();
+ Location type_loc = first_arg->location();
Expression* type_arg;
if (is_slice || is_chan)
type_arg = Expression::make_type_descriptor(type, type_loc);
@@ -7937,7 +7959,7 @@ Builtin_call_expression::do_type()
return Type::make_void_type();
case BUILTIN_RECOVER:
- return Type::make_interface_type(NULL, BUILTINS_LOCATION);
+ return Type::make_interface_type(NULL, Linemap::predeclared_location());
case BUILTIN_APPEND:
{
@@ -8352,7 +8374,7 @@ tree
Builtin_call_expression::do_get_tree(Translate_context* context)
{
Gogo* gogo = context->gogo();
- source_location location = this->location();
+ Location location = this->location();
switch (this->code_)
{
case BUILTIN_INVALID:
@@ -8523,7 +8545,8 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
fnname = "__go_print_uint64";
Type* itype = Type::lookup_integer_type("uint64");
Btype* bitype = itype->get_backend(gogo);
- arg = fold_convert_loc(location, type_to_tree(bitype), arg);
+ arg = fold_convert_loc(location.gcc_location(),
+ type_to_tree(bitype), arg);
}
else if (type->integer_type() != NULL)
{
@@ -8532,22 +8555,24 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
fnname = "__go_print_int64";
Type* itype = Type::lookup_integer_type("int64");
Btype* bitype = itype->get_backend(gogo);
- arg = fold_convert_loc(location, type_to_tree(bitype), arg);
+ arg = fold_convert_loc(location.gcc_location(),
+ type_to_tree(bitype), arg);
}
else if (type->float_type() != NULL)
{
static tree print_double_fndecl;
pfndecl = &print_double_fndecl;
fnname = "__go_print_double";
- arg = fold_convert_loc(location, double_type_node, arg);
+ arg = fold_convert_loc(location.gcc_location(),
+ double_type_node, arg);
}
else if (type->complex_type() != NULL)
{
static tree print_complex_fndecl;
pfndecl = &print_complex_fndecl;
fnname = "__go_print_complex";
- arg = fold_convert_loc(location, complex_double_type_node,
- arg);
+ arg = fold_convert_loc(location.gcc_location(),
+ complex_double_type_node, arg);
}
else if (type->is_boolean_type())
{
@@ -8563,7 +8588,8 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
static tree print_pointer_fndecl;
pfndecl = &print_pointer_fndecl;
fnname = "__go_print_pointer";
- arg = fold_convert_loc(location, ptr_type_node, arg);
+ arg = fold_convert_loc(location.gcc_location(),
+ ptr_type_node, arg);
}
else if (type->interface_type() != NULL)
{
@@ -8626,7 +8652,8 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
tree arg_tree = arg->get_tree(context);
if (arg_tree == error_mark_node)
return error_mark_node;
- Type *empty = Type::make_interface_type(NULL, BUILTINS_LOCATION);
+ Type *empty =
+ Type::make_interface_type(NULL, Linemap::predeclared_location());
arg_tree = Expression::convert_for_assignment(context, empty,
arg->type(),
arg_tree, location);
@@ -8658,7 +8685,8 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
if (arg_tree == error_mark_node)
return error_mark_node;
- Type *empty = Type::make_interface_type(NULL, BUILTINS_LOCATION);
+ Type *empty =
+ Type::make_interface_type(NULL, Linemap::predeclared_location());
tree empty_tree = type_to_tree(empty->get_backend(context->gogo()));
Type* nil_type = Type::make_nil_type();
@@ -8694,8 +8722,8 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
}
if (call == error_mark_node)
return error_mark_node;
- return fold_build3_loc(location, COND_EXPR, empty_tree, arg_tree,
- call, empty_nil_tree);
+ return fold_build3_loc(location.gcc_location(), COND_EXPR, empty_tree,
+ arg_tree, call, empty_nil_tree);
}
case BUILTIN_CLOSE:
@@ -8777,9 +8805,10 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
arg1_len = save_expr(arg1_len);
arg2_len = save_expr(arg2_len);
- tree len = fold_build3_loc(location, COND_EXPR, TREE_TYPE(arg1_len),
- fold_build2_loc(location, LT_EXPR,
- boolean_type_node,
+ tree len = fold_build3_loc(location.gcc_location(), COND_EXPR,
+ TREE_TYPE(arg1_len),
+ fold_build2_loc(location.gcc_location(),
+ LT_EXPR, boolean_type_node,
arg1_len, arg2_len),
arg1_len, arg2_len);
len = save_expr(len);
@@ -8790,15 +8819,18 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
if (element_type_tree == error_mark_node)
return error_mark_node;
tree element_size = TYPE_SIZE_UNIT(element_type_tree);
- tree bytecount = fold_convert_loc(location, TREE_TYPE(element_size),
- len);
- bytecount = fold_build2_loc(location, MULT_EXPR,
+ tree bytecount = fold_convert_loc(location.gcc_location(),
+ TREE_TYPE(element_size), len);
+ bytecount = fold_build2_loc(location.gcc_location(), MULT_EXPR,
TREE_TYPE(element_size),
bytecount, element_size);
- bytecount = fold_convert_loc(location, size_type_node, bytecount);
+ bytecount = fold_convert_loc(location.gcc_location(), size_type_node,
+ bytecount);
- arg1_val = fold_convert_loc(location, ptr_type_node, arg1_val);
- arg2_val = fold_convert_loc(location, ptr_type_node, arg2_val);
+ arg1_val = fold_convert_loc(location.gcc_location(), ptr_type_node,
+ arg1_val);
+ arg2_val = fold_convert_loc(location.gcc_location(), ptr_type_node,
+ arg2_val);
static tree copy_fndecl;
tree call = Gogo::call_builtin(&copy_fndecl,
@@ -8815,8 +8847,8 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
if (call == error_mark_node)
return error_mark_node;
- return fold_build2_loc(location, COMPOUND_EXPR, TREE_TYPE(len),
- call, len);
+ return fold_build2_loc(location.gcc_location(), COMPOUND_EXPR,
+ TREE_TYPE(len), call, len);
}
case BUILTIN_APPEND:
@@ -8866,9 +8898,11 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
element_size = TYPE_SIZE_UNIT(element_type_tree);
}
- arg2_val = fold_convert_loc(location, ptr_type_node, arg2_val);
- arg2_len = fold_convert_loc(location, size_type_node, arg2_len);
- element_size = fold_convert_loc(location, size_type_node,
+ arg2_val = fold_convert_loc(location.gcc_location(), ptr_type_node,
+ arg2_val);
+ arg2_len = fold_convert_loc(location.gcc_location(), size_type_node,
+ arg2_len);
+ element_size = fold_convert_loc(location.gcc_location(), size_type_node,
element_size);
if (arg2_val == error_mark_node
@@ -8905,11 +8939,11 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
return error_mark_node;
go_assert(COMPLEX_FLOAT_TYPE_P(TREE_TYPE(arg_tree)));
if (this->code_ == BUILTIN_REAL)
- return fold_build1_loc(location, REALPART_EXPR,
+ return fold_build1_loc(location.gcc_location(), REALPART_EXPR,
TREE_TYPE(TREE_TYPE(arg_tree)),
arg_tree);
else
- return fold_build1_loc(location, IMAGPART_EXPR,
+ return fold_build1_loc(location.gcc_location(), IMAGPART_EXPR,
TREE_TYPE(TREE_TYPE(arg_tree)),
arg_tree);
}
@@ -8925,7 +8959,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
go_assert(TYPE_MAIN_VARIANT(TREE_TYPE(r))
== TYPE_MAIN_VARIANT(TREE_TYPE(i)));
go_assert(SCALAR_FLOAT_TYPE_P(TREE_TYPE(r)));
- return fold_build2_loc(location, COMPLEX_EXPR,
+ return fold_build2_loc(location.gcc_location(), COMPLEX_EXPR,
build_complex_type(TREE_TYPE(r)),
r, i);
}
@@ -9013,7 +9047,7 @@ Expression*
Call_expression::do_lower(Gogo* gogo, Named_object* function,
Statement_inserter* inserter, int)
{
- source_location loc = this->location();
+ Location loc = this->location();
// A type cast can look like a function call.
if (this->fn_->is_type_expression()
@@ -9160,7 +9194,7 @@ Call_expression::lower_varargs(Gogo* gogo, Named_object* function,
if (this->varargs_are_lowered_)
return;
- source_location loc = this->location();
+ Location loc = this->location();
go_assert(param_count > 0);
go_assert(varargs_type->is_slice_type());
@@ -9211,7 +9245,7 @@ Call_expression::lower_varargs(Gogo* gogo, Named_object* function,
{
// Check types here so that we get a better message.
Type* patype = (*pa)->type();
- source_location paloc = (*pa)->location();
+ Location paloc = (*pa)->location();
if (!this->check_argument_type(i, element_type, patype,
paloc, issued_error))
continue;
@@ -9410,7 +9444,7 @@ Call_expression::determining_types()
bool
Call_expression::check_argument_type(int i, const Type* parameter_type,
const Type* argument_type,
- source_location argument_location,
+ Location argument_location,
bool issued_error)
{
std::string reason;
@@ -9559,7 +9593,7 @@ Call_expression::do_get_tree(Translate_context* context)
return error_mark_node;
Gogo* gogo = context->gogo();
- source_location location = this->location();
+ Location location = this->location();
Func_expression* func = this->fn_->func_expression();
Interface_field_reference_expression* interface_method =
@@ -9652,7 +9686,7 @@ Call_expression::do_get_tree(Translate_context* context)
tree fnt = type_to_tree(fntype->get_backend(gogo));
if (fnt == error_mark_node)
return error_mark_node;
- fn = fold_convert_loc(location, fnt, fn);
+ fn = fold_convert_loc(location.gcc_location(), fnt, fn);
}
// This is to support builtin math functions when using 80387 math.
@@ -9675,7 +9709,8 @@ Call_expression::do_get_tree(Translate_context* context)
excess_type = NULL_TREE;
else
{
- fn = build_fold_addr_expr_loc(location, excess_fndecl);
+ fn = build_fold_addr_expr_loc(location.gcc_location(),
+ excess_fndecl);
for (int i = 0; i < nargs; ++i)
args[i] = ::convert(excess_type, args[i]);
}
@@ -9686,7 +9721,7 @@ Call_expression::do_get_tree(Translate_context* context)
fn, nargs, args);
delete[] args;
- SET_EXPR_LOCATION(ret, location);
+ SET_EXPR_LOCATION(ret, location.gcc_location());
if (has_closure)
{
@@ -9702,7 +9737,7 @@ Call_expression::do_get_tree(Translate_context* context)
if (TREE_TYPE(ret) == ptr_type_node)
{
tree t = type_to_tree(this->type()->base()->get_backend(gogo));
- ret = fold_convert_loc(location, t, ret);
+ ret = fold_convert_loc(location.gcc_location(), t, ret);
}
if (excess_type != NULL_TREE)
@@ -9735,7 +9770,7 @@ Call_expression::set_results(Translate_context* context, tree call_tree)
return call_tree;
}
- source_location loc = this->location();
+ Location loc = this->location();
tree field = TYPE_FIELDS(TREE_TYPE(call_tree));
size_t rc = this->result_count();
for (size_t i = 0; i < rc; ++i, field = DECL_CHAIN(field))
@@ -9750,10 +9785,10 @@ Call_expression::set_results(Translate_context* context, tree call_tree)
if (temp_tree == error_mark_node)
continue;
- tree val_tree = build3_loc(loc, COMPONENT_REF, TREE_TYPE(field),
- call_tree, field, NULL_TREE);
- tree set_tree = build2_loc(loc, MODIFY_EXPR, void_type_node, temp_tree,
- val_tree);
+ tree val_tree = build3_loc(loc.gcc_location(), COMPONENT_REF,
+ TREE_TYPE(field), call_tree, field, NULL_TREE);
+ tree set_tree = build2_loc(loc.gcc_location(), MODIFY_EXPR,
+ void_type_node, temp_tree, val_tree);
append_to_statement_list(set_tree, &stmt_list);
}
@@ -9779,7 +9814,7 @@ Call_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
Call_expression*
Expression::make_call(Expression* fn, Expression_list* args, bool is_varargs,
- source_location location)
+ Location location)
{
return new Call_expression(fn, args, is_varargs, location);
}
@@ -9971,7 +10006,7 @@ Index_expression::do_traverse(Traverse* traverse)
Expression*
Index_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
{
- source_location location = this->location();
+ Location location = this->location();
Expression* left = this->left_;
Expression* start = this->start_;
Expression* end = this->end_;
@@ -10051,7 +10086,7 @@ Index_expression::do_dump_expression(Ast_dump_context* ast_dump_context)
Expression*
Expression::make_index(Expression* left, Expression* start, Expression* end,
- source_location location)
+ Location location)
{
return new Index_expression(left, start, end, location);
}
@@ -10062,7 +10097,7 @@ class Array_index_expression : public Expression
{
public:
Array_index_expression(Expression* array, Expression* start,
- Expression* end, source_location location)
+ Expression* end, Location location)
: Expression(EXPRESSION_ARRAY_INDEX, location),
array_(array), start_(start), end_(end), type_(NULL)
{ }
@@ -10275,7 +10310,7 @@ tree
Array_index_expression::do_get_tree(Translate_context* context)
{
Gogo* gogo = context->gogo();
- source_location loc = this->location();
+ Location loc = this->location();
Array_type* array_type = this->array_->type()->array_type();
if (array_type == NULL)
@@ -10313,9 +10348,10 @@ Array_index_expression::do_get_tree(Translate_context* context)
bad_index = Expression::check_bounds(start_tree, length_type, bad_index,
loc);
- start_tree = fold_convert_loc(loc, length_type, start_tree);
- bad_index = fold_build2_loc(loc, TRUTH_OR_EXPR, boolean_type_node, bad_index,
- fold_build2_loc(loc,
+ start_tree = fold_convert_loc(loc.gcc_location(), length_type, start_tree);
+ bad_index = fold_build2_loc(loc.gcc_location(), TRUTH_OR_EXPR,
+ boolean_type_node, bad_index,
+ fold_build2_loc(loc.gcc_location(),
(this->end_ == NULL
? GE_EXPR
: GT_EXPR),
@@ -10339,7 +10375,7 @@ Array_index_expression::do_get_tree(Translate_context* context)
build3(COND_EXPR, void_type_node,
bad_index, crash, NULL_TREE),
start_tree);
- start_tree = fold_convert_loc(loc, sizetype, start_tree);
+ start_tree = fold_convert_loc(loc.gcc_location(), sizetype, start_tree);
if (array_type->length() != NULL)
{
@@ -10357,9 +10393,9 @@ Array_index_expression::do_get_tree(Translate_context* context)
if (element_type_tree == error_mark_node)
return error_mark_node;
tree element_size = TYPE_SIZE_UNIT(element_type_tree);
- tree offset = fold_build2_loc(loc, MULT_EXPR, sizetype,
+ tree offset = fold_build2_loc(loc.gcc_location(), MULT_EXPR, sizetype,
start_tree, element_size);
- tree ptr = fold_build2_loc(loc, POINTER_PLUS_EXPR,
+ tree ptr = fold_build2_loc(loc.gcc_location(), POINTER_PLUS_EXPR,
TREE_TYPE(values), values, offset);
return build_fold_indirect_ref(ptr);
}
@@ -10370,7 +10406,8 @@ Array_index_expression::do_get_tree(Translate_context* context)
tree capacity_tree = array_type->capacity_tree(gogo, array_tree);
if (capacity_tree == error_mark_node)
return error_mark_node;
- capacity_tree = fold_convert_loc(loc, length_type, capacity_tree);
+ capacity_tree = fold_convert_loc(loc.gcc_location(), length_type,
+ capacity_tree);
tree end_tree;
if (this->end_->is_nil_expression())
@@ -10388,18 +10425,19 @@ Array_index_expression::do_get_tree(Translate_context* context)
bad_index = Expression::check_bounds(end_tree, length_type, bad_index,
loc);
- end_tree = fold_convert_loc(loc, length_type, end_tree);
+ end_tree = fold_convert_loc(loc.gcc_location(), length_type, end_tree);
capacity_tree = save_expr(capacity_tree);
- tree bad_end = fold_build2_loc(loc, TRUTH_OR_EXPR, boolean_type_node,
- fold_build2_loc(loc, LT_EXPR,
- boolean_type_node,
+ tree bad_end = fold_build2_loc(loc.gcc_location(), TRUTH_OR_EXPR,
+ boolean_type_node,
+ fold_build2_loc(loc.gcc_location(),
+ LT_EXPR, boolean_type_node,
end_tree, start_tree),
- fold_build2_loc(loc, GT_EXPR,
- boolean_type_node,
+ fold_build2_loc(loc.gcc_location(),
+ GT_EXPR, boolean_type_node,
end_tree, capacity_tree));
- bad_index = fold_build2_loc(loc, TRUTH_OR_EXPR, boolean_type_node,
- bad_index, bad_end);
+ bad_index = fold_build2_loc(loc.gcc_location(), TRUTH_OR_EXPR,
+ boolean_type_node, bad_index, bad_end);
}
Type* element_type = array_type->element_type();
@@ -10408,23 +10446,25 @@ Array_index_expression::do_get_tree(Translate_context* context)
return error_mark_node;
tree element_size = TYPE_SIZE_UNIT(element_type_tree);
- tree offset = fold_build2_loc(loc, MULT_EXPR, sizetype,
- fold_convert_loc(loc, sizetype, start_tree),
+ tree offset = fold_build2_loc(loc.gcc_location(), MULT_EXPR, sizetype,
+ fold_convert_loc(loc.gcc_location(), sizetype,
+ start_tree),
element_size);
tree value_pointer = array_type->value_pointer_tree(gogo, array_tree);
if (value_pointer == error_mark_node)
return error_mark_node;
- value_pointer = fold_build2_loc(loc, POINTER_PLUS_EXPR,
+ value_pointer = fold_build2_loc(loc.gcc_location(), POINTER_PLUS_EXPR,
TREE_TYPE(value_pointer),
value_pointer, offset);
- tree result_length_tree = fold_build2_loc(loc, MINUS_EXPR, length_type,
- end_tree, start_tree);
+ tree result_length_tree = fold_build2_loc(loc.gcc_location(), MINUS_EXPR,
+ length_type, end_tree, start_tree);
- tree result_capacity_tree = fold_build2_loc(loc, MINUS_EXPR, length_type,
- capacity_tree, start_tree);
+ tree result_capacity_tree = fold_build2_loc(loc.gcc_location(), MINUS_EXPR,
+ length_type, capacity_tree,
+ start_tree);
tree struct_tree = type_to_tree(this->type()->get_backend(gogo));
go_assert(TREE_CODE(struct_tree) == RECORD_TYPE);
@@ -10441,13 +10481,15 @@ Array_index_expression::do_get_tree(Translate_context* context)
field = DECL_CHAIN(field);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0);
elt->index = field;
- elt->value = fold_convert_loc(loc, TREE_TYPE(field), result_length_tree);
+ elt->value = fold_convert_loc(loc.gcc_location(), TREE_TYPE(field),
+ result_length_tree);
elt = VEC_quick_push(constructor_elt, init, NULL);
field = DECL_CHAIN(field);
go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__capacity") == 0);
elt->index = field;
- elt->value = fold_convert_loc(loc, TREE_TYPE(field), result_capacity_tree);
+ elt->value = fold_convert_loc(loc.gcc_location(), TREE_TYPE(field),
+ result_capacity_tree);
tree constructor = build_constructor(struct_tree, init);
@@ -10456,7 +10498,8 @@ Array_index_expression::do_get_tree(Translate_context* context)
&& TREE_CONSTANT(result_capacity_tree))
TREE_CONSTANT(constructor) = 1;
- return fold_build2_loc(loc, COMPOUND_EXPR, TREE_TYPE(constructor),
+ return fold_build2_loc(loc.gcc_location(), COMPOUND_EXPR,
+ TREE_TYPE(constructor),
build3(COND_EXPR, void_type_node,
bad_index, crash, NULL_TREE),
constructor);
@@ -10476,7 +10519,7 @@ Array_index_expression::do_dump_expression(Ast_dump_context* ast_dump_context)
Expression*
Expression::make_array_index(Expression* array, Expression* start,
- Expression* end, source_location location)
+ Expression* end, Location location)
{
// Taking a slice of a composite literal requires moving the literal
// onto the heap.
@@ -10494,7 +10537,7 @@ class String_index_expression : public Expression
{
public:
String_index_expression(Expression* string, Expression* start,
- Expression* end, source_location location)
+ Expression* end, Location location)
: Expression(EXPRESSION_STRING_INDEX, location),
string_(string), start_(start), end_(end)
{ }
@@ -10632,7 +10675,7 @@ String_index_expression::do_check_types(Gogo*)
tree
String_index_expression::do_get_tree(Translate_context* context)
{
- source_location loc = this->location();
+ Location loc = this->location();
tree string_tree = this->string_->get_tree(context);
if (string_tree == error_mark_node)
@@ -10661,7 +10704,7 @@ String_index_expression::do_get_tree(Translate_context* context)
bad_index = Expression::check_bounds(start_tree, length_type, bad_index,
loc);
- start_tree = fold_convert_loc(loc, length_type, start_tree);
+ start_tree = fold_convert_loc(loc.gcc_location(), length_type, start_tree);
int code = (this->end_ == NULL
? RUNTIME_ERROR_STRING_INDEX_OUT_OF_BOUNDS
@@ -10670,17 +10713,19 @@ String_index_expression::do_get_tree(Translate_context* context)
if (this->end_ == NULL)
{
- bad_index = fold_build2_loc(loc, TRUTH_OR_EXPR, boolean_type_node,
- bad_index,
- fold_build2_loc(loc, GE_EXPR,
+ bad_index = fold_build2_loc(loc.gcc_location(), TRUTH_OR_EXPR,
+ boolean_type_node, bad_index,
+ fold_build2_loc(loc.gcc_location(), GE_EXPR,
boolean_type_node,
start_tree, length_tree));
tree bytes_tree = String_type::bytes_tree(context->gogo(), string_tree);
- tree ptr = fold_build2_loc(loc, POINTER_PLUS_EXPR, TREE_TYPE(bytes_tree),
+ tree ptr = fold_build2_loc(loc.gcc_location(), POINTER_PLUS_EXPR,
+ TREE_TYPE(bytes_tree),
bytes_tree,
- fold_convert_loc(loc, sizetype, start_tree));
- tree index = build_fold_indirect_ref_loc(loc, ptr);
+ fold_convert_loc(loc.gcc_location(), sizetype,
+ start_tree));
+ tree index = build_fold_indirect_ref_loc(loc.gcc_location(), ptr);
return build2(COMPOUND_EXPR, TREE_TYPE(index),
build3(COND_EXPR, void_type_node,
@@ -10705,7 +10750,8 @@ String_index_expression::do_get_tree(Translate_context* context)
bad_index = Expression::check_bounds(end_tree, length_type,
bad_index, loc);
- end_tree = fold_convert_loc(loc, length_type, end_tree);
+ end_tree = fold_convert_loc(loc.gcc_location(), length_type,
+ end_tree);
}
static tree strslice_fndecl;
@@ -10750,7 +10796,7 @@ String_index_expression::do_dump_expression(Ast_dump_context* ast_dump_context)
Expression*
Expression::make_string_index(Expression* string, Expression* start,
- Expression* end, source_location location)
+ Expression* end, Location location)
{
return new String_index_expression(string, start, end, location);
}
@@ -10906,14 +10952,16 @@ Map_index_expression::get_value_pointer(Translate_context* context,
}
else
{
- tmp = build_decl(this->location(), VAR_DECL, create_tmp_var_name("M"),
+ tmp = build_decl(this->location().gcc_location(), VAR_DECL,
+ create_tmp_var_name("M"),
TREE_TYPE(index_tree));
DECL_EXTERNAL(tmp) = 0;
TREE_PUBLIC(tmp) = 0;
TREE_STATIC(tmp) = 1;
DECL_ARTIFICIAL(tmp) = 1;
if (!TREE_CONSTANT(index_tree))
- make_tmp = fold_build2_loc(this->location(), INIT_EXPR, void_type_node,
+ make_tmp = fold_build2_loc(this->location().gcc_location(),
+ INIT_EXPR, void_type_node,
tmp, index_tree);
else
{
@@ -10924,9 +10972,10 @@ Map_index_expression::get_value_pointer(Translate_context* context,
}
rest_of_decl_compilation(tmp, 1, 0);
}
- tree tmpref = fold_convert_loc(this->location(), const_ptr_type_node,
- build_fold_addr_expr_loc(this->location(),
- tmp));
+ tree tmpref =
+ fold_convert_loc(this->location().gcc_location(), const_ptr_type_node,
+ build_fold_addr_expr_loc(this->location().gcc_location(),
+ tmp));
static tree map_index_fndecl;
tree call = Gogo::call_builtin(&map_index_fndecl,
@@ -10954,7 +11003,8 @@ Map_index_expression::get_value_pointer(Translate_context* context,
return error_mark_node;
tree ptr_val_type_tree = build_pointer_type(val_type_tree);
- tree ret = fold_convert_loc(this->location(), ptr_val_type_tree, call);
+ tree ret = fold_convert_loc(this->location().gcc_location(),
+ ptr_val_type_tree, call);
if (make_tmp != NULL_TREE)
ret = build2(COMPOUND_EXPR, ptr_val_type_tree, make_tmp, ret);
return ret;
@@ -10974,7 +11024,7 @@ Map_index_expression::do_dump_expression(Ast_dump_context* ast_dump_context)
Map_index_expression*
Expression::make_map_index(Expression* map, Expression* index,
- source_location location)
+ Location location)
{
return new Map_index_expression(map, index, location);
}
@@ -11050,7 +11100,7 @@ Field_reference_expression::do_dump_expression(
Field_reference_expression*
Expression::make_field_reference(Expression* expr, unsigned int field_index,
- source_location location)
+ Location location)
{
return new Field_reference_expression(expr, field_index, location);
}
@@ -11207,7 +11257,7 @@ Interface_field_reference_expression::do_dump_expression(
Expression*
Expression::make_interface_field_reference(Expression* expr,
const std::string& field,
- source_location location)
+ Location location)
{
return new Interface_field_reference_expression(expr, field, location);
}
@@ -11219,7 +11269,7 @@ class Selector_expression : public Parser_expression
{
public:
Selector_expression(Expression* left, const std::string& name,
- source_location location)
+ Location location)
: Parser_expression(EXPRESSION_SELECTOR, location),
left_(left), name_(name)
{ }
@@ -11272,7 +11322,7 @@ Selector_expression::do_lower(Gogo* gogo, Named_object*, Statement_inserter*,
Expression*
Selector_expression::lower_method_expression(Gogo* gogo)
{
- source_location location = this->location();
+ Location location = this->location();
Type* type = this->left_->type();
const std::string& name(this->name_);
@@ -11477,7 +11527,7 @@ Selector_expression::do_dump_expression(Ast_dump_context* ast_dump_context)
Expression*
Expression::make_selector(Expression* left, const std::string& name,
- source_location location)
+ Location location)
{
return new Selector_expression(left, name, location);
}
@@ -11487,7 +11537,7 @@ Expression::make_selector(Expression* left, const std::string& name,
class Allocation_expression : public Expression
{
public:
- Allocation_expression(Type* type, source_location location)
+ Allocation_expression(Type* type, Location location)
: Expression(EXPRESSION_ALLOCATION, location),
type_(type)
{ }
@@ -11550,7 +11600,7 @@ Allocation_expression::do_dump_expression(Ast_dump_context* ast_dump_context)
// Make an allocation expression.
Expression*
-Expression::make_allocation(Type* type, source_location location)
+Expression::make_allocation(Type* type, Location location)
{
return new Allocation_expression(type, location);
}
@@ -11561,7 +11611,7 @@ class Struct_construction_expression : public Expression
{
public:
Struct_construction_expression(Type* type, Expression_list* vals,
- source_location location)
+ Location location)
: Expression(EXPRESSION_STRUCT_CONSTRUCTION, location),
type_(type), vals_(vals)
{ }
@@ -11832,7 +11882,7 @@ Struct_construction_expression::do_dump_expression(
Expression*
Expression::make_struct_composite_literal(Type* type, Expression_list* vals,
- source_location location)
+ Location location)
{
go_assert(type->struct_type() != NULL);
return new Struct_construction_expression(type, vals, location);
@@ -11847,7 +11897,7 @@ class Array_construction_expression : public Expression
protected:
Array_construction_expression(Expression_classification classification,
Type* type, Expression_list* vals,
- source_location location)
+ Location location)
: Expression(classification, location),
type_(type), vals_(vals)
{ }
@@ -12097,7 +12147,7 @@ class Fixed_array_construction_expression :
{
public:
Fixed_array_construction_expression(Type* type, Expression_list* vals,
- source_location location)
+ Location location)
: Array_construction_expression(EXPRESSION_FIXED_ARRAY_CONSTRUCTION,
type, vals, location)
{
@@ -12155,7 +12205,7 @@ class Open_array_construction_expression : public Array_construction_expression
{
public:
Open_array_construction_expression(Type* type, Expression_list* vals,
- source_location location)
+ Location location)
: Array_construction_expression(EXPRESSION_OPEN_ARRAY_CONSTRUCTION,
type, vals, location)
{
@@ -12246,7 +12296,7 @@ Open_array_construction_expression::do_get_tree(Translate_context* context)
if (is_constant_initializer)
{
- tree tmp = build_decl(this->location(), VAR_DECL,
+ tree tmp = build_decl(this->location().gcc_location(), VAR_DECL,
create_tmp_var_name("C"), TREE_TYPE(values));
DECL_EXTERNAL(tmp) = 0;
TREE_PUBLIC(tmp) = 0;
@@ -12282,7 +12332,8 @@ Open_array_construction_expression::do_get_tree(Translate_context* context)
space = save_expr(space);
tree s = fold_convert(build_pointer_type(TREE_TYPE(values)), space);
- tree ref = build_fold_indirect_ref_loc(this->location(), s);
+ tree ref = build_fold_indirect_ref_loc(this->location().gcc_location(),
+ s);
TREE_THIS_NOTRAP(ref) = 1;
set = build2(MODIFY_EXPR, void_type_node, ref, values);
}
@@ -12331,7 +12382,7 @@ Open_array_construction_expression::do_get_tree(Translate_context* context)
Expression*
Expression::make_slice_composite_literal(Type* type, Expression_list* vals,
- source_location location)
+ Location location)
{
go_assert(type->is_slice_type());
return new Open_array_construction_expression(type, vals, location);
@@ -12343,7 +12394,7 @@ class Map_construction_expression : public Expression
{
public:
Map_construction_expression(Type* type, Expression_list* vals,
- source_location location)
+ Location location)
: Expression(EXPRESSION_MAP_CONSTRUCTION, location),
type_(type), vals_(vals)
{ go_assert(vals == NULL || vals->size() % 2 == 0); }
@@ -12460,7 +12511,7 @@ tree
Map_construction_expression::do_get_tree(Translate_context* context)
{
Gogo* gogo = context->gogo();
- source_location loc = this->location();
+ Location loc = this->location();
Map_type* mt = this->type_->map_type();
@@ -12472,7 +12523,8 @@ Map_construction_expression::do_get_tree(Translate_context* context)
tree key_type_tree = type_to_tree(key_type->get_backend(gogo));
if (key_type_tree == error_mark_node)
return error_mark_node;
- tree key_field = build_decl(loc, FIELD_DECL, id, key_type_tree);
+ tree key_field = build_decl(loc.gcc_location(), FIELD_DECL, id,
+ key_type_tree);
DECL_CONTEXT(key_field) = struct_type;
TYPE_FIELDS(struct_type) = key_field;
@@ -12481,7 +12533,8 @@ Map_construction_expression::do_get_tree(Translate_context* context)
tree val_type_tree = type_to_tree(val_type->get_backend(gogo));
if (val_type_tree == error_mark_node)
return error_mark_node;
- tree val_field = build_decl(loc, FIELD_DECL, id, val_type_tree);
+ tree val_field = build_decl(loc.gcc_location(), FIELD_DECL, id,
+ val_type_tree);
DECL_CONTEXT(val_field) = struct_type;
DECL_CHAIN(key_field) = val_field;
@@ -12553,19 +12606,21 @@ Map_construction_expression::do_get_tree(Translate_context* context)
{
tmp = create_tmp_var(array_type, get_name(array_type));
DECL_INITIAL(tmp) = init;
- make_tmp = fold_build1_loc(loc, DECL_EXPR, void_type_node, tmp);
+ make_tmp = fold_build1_loc(loc.gcc_location(), DECL_EXPR,
+ void_type_node, tmp);
TREE_ADDRESSABLE(tmp) = 1;
}
else
{
- tmp = build_decl(loc, VAR_DECL, create_tmp_var_name("M"), array_type);
+ tmp = build_decl(loc.gcc_location(), VAR_DECL,
+ create_tmp_var_name("M"), array_type);
DECL_EXTERNAL(tmp) = 0;
TREE_PUBLIC(tmp) = 0;
TREE_STATIC(tmp) = 1;
DECL_ARTIFICIAL(tmp) = 1;
if (!TREE_CONSTANT(init))
- make_tmp = fold_build2_loc(loc, INIT_EXPR, void_type_node, tmp,
- init);
+ make_tmp = fold_build2_loc(loc.gcc_location(), INIT_EXPR,
+ void_type_node, tmp, init);
else
{
TREE_READONLY(tmp) = 1;
@@ -12610,7 +12665,8 @@ Map_construction_expression::do_get_tree(Translate_context* context)
if (make_tmp == NULL)
ret = call;
else
- ret = fold_build2_loc(loc, COMPOUND_EXPR, type_tree, make_tmp, call);
+ ret = fold_build2_loc(loc.gcc_location(), COMPOUND_EXPR, type_tree,
+ make_tmp, call);
return ret;
}
@@ -12649,7 +12705,7 @@ class Composite_literal_expression : public Parser_expression
{
public:
Composite_literal_expression(Type* type, int depth, bool has_keys,
- Expression_list* vals, source_location location)
+ Expression_list* vals, Location location)
: Parser_expression(EXPRESSION_COMPOSITE_LITERAL, location),
type_(type), depth_(depth), vals_(vals), has_keys_(has_keys)
{ }
@@ -12758,7 +12814,7 @@ Composite_literal_expression::do_lower(Gogo* gogo, Named_object* function,
Expression*
Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
{
- source_location location = this->location();
+ Location location = this->location();
Struct_type* st = type->struct_type();
if (this->vals_ == NULL || !this->has_keys_)
return new Struct_construction_expression(type, this->vals_, location);
@@ -12924,7 +12980,7 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
Expression*
Composite_literal_expression::lower_array(Type* type)
{
- source_location location = this->location();
+ Location location = this->location();
if (this->vals_ == NULL || !this->has_keys_)
return this->make_array(type, this->vals_);
@@ -13035,7 +13091,7 @@ Composite_literal_expression::lower_array(Type* type)
Expression*
Composite_literal_expression::make_array(Type* type, Expression_list* vals)
{
- source_location location = this->location();
+ Location location = this->location();
Array_type* at = type->array_type();
if (at->length() != NULL && at->length()->is_nil_expression())
{
@@ -13060,7 +13116,7 @@ Composite_literal_expression::lower_map(Gogo* gogo, Named_object* function,
Statement_inserter* inserter,
Type* type)
{
- source_location location = this->location();
+ Location location = this->location();
if (this->vals_ != NULL)
{
if (!this->has_keys_)
@@ -13114,7 +13170,7 @@ Composite_literal_expression::do_dump_expression(
Expression*
Expression::make_composite_literal(Type* type, int depth, bool has_keys,
Expression_list* vals,
- source_location location)
+ Location location)
{
return new Composite_literal_expression(type, depth, has_keys, vals,
location);
@@ -13298,7 +13354,7 @@ Type_guard_expression::do_dump_expression(Ast_dump_context* ast_dump_context)
Expression*
Expression::make_type_guard(Expression* expr, Type* type,
- source_location location)
+ Location location)
{
return new Type_guard_expression(expr, type, location);
}
@@ -13311,7 +13367,7 @@ Expression::make_type_guard(Expression* expr, Type* type,
class Heap_composite_expression : public Expression
{
public:
- Heap_composite_expression(Expression* expr, source_location location)
+ Heap_composite_expression(Expression* expr, Location location)
: Expression(EXPRESSION_HEAP_COMPOSITE, location),
expr_(expr)
{ }
@@ -13367,12 +13423,13 @@ Heap_composite_expression::do_get_tree(Translate_context* context)
expr_size, this->location());
space = fold_convert(build_pointer_type(TREE_TYPE(expr_tree)), space);
space = save_expr(space);
- tree ref = build_fold_indirect_ref_loc(this->location(), space);
+ tree ref = build_fold_indirect_ref_loc(this->location().gcc_location(),
+ space);
TREE_THIS_NOTRAP(ref) = 1;
tree ret = build2(COMPOUND_EXPR, TREE_TYPE(space),
build2(MODIFY_EXPR, void_type_node, ref, expr_tree),
space);
- SET_EXPR_LOCATION(ret, this->location());
+ SET_EXPR_LOCATION(ret, this->location().gcc_location());
return ret;
}
@@ -13390,7 +13447,7 @@ Heap_composite_expression::do_dump_expression(
// Allocate a composite literal on the heap.
Expression*
-Expression::make_heap_composite(Expression* expr, source_location location)
+Expression::make_heap_composite(Expression* expr, Location location)
{
return new Heap_composite_expression(expr, location);
}
@@ -13466,7 +13523,7 @@ Receive_expression::do_dump_expression(Ast_dump_context* ast_dump_context) const
// Make a receive expression.
Receive_expression*
-Expression::make_receive(Expression* channel, source_location location)
+Expression::make_receive(Expression* channel, Location location)
{
return new Receive_expression(channel, location);
}
@@ -13477,7 +13534,7 @@ Expression::make_receive(Expression* channel, source_location location)
class Type_descriptor_expression : public Expression
{
public:
- Type_descriptor_expression(Type* type, source_location location)
+ Type_descriptor_expression(Type* type, Location location)
: Expression(EXPRESSION_TYPE_DESCRIPTOR, location),
type_(type)
{ }
@@ -13522,7 +13579,7 @@ Type_descriptor_expression::do_dump_expression(
// Make a type descriptor expression.
Expression*
-Expression::make_type_descriptor(Type* type, source_location location)
+Expression::make_type_descriptor(Type* type, Location location)
{
return new Type_descriptor_expression(type, location);
}
@@ -13537,7 +13594,7 @@ class Type_info_expression : public Expression
{
public:
Type_info_expression(Type* type, Type_info type_info)
- : Expression(EXPRESSION_TYPE_INFO, BUILTINS_LOCATION),
+ : Expression(EXPRESSION_TYPE_INFO, Linemap::predeclared_location()),
type_(type), type_info_(type_info)
{ }
@@ -13643,7 +13700,8 @@ class Struct_field_offset_expression : public Expression
{
public:
Struct_field_offset_expression(Struct_type* type, const Struct_field* field)
- : Expression(EXPRESSION_STRUCT_FIELD_OFFSET, BUILTINS_LOCATION),
+ : Expression(EXPRESSION_STRUCT_FIELD_OFFSET,
+ Linemap::predeclared_location()),
type_(type), field_(field)
{ }
@@ -13731,7 +13789,7 @@ Expression::make_struct_field_offset(Struct_type* type,
class Map_descriptor_expression : public Expression
{
public:
- Map_descriptor_expression(Map_type* type, source_location location)
+ Map_descriptor_expression(Map_type* type, Location location)
: Expression(EXPRESSION_MAP_DESCRIPTOR, location),
type_(type)
{ }
@@ -13778,7 +13836,7 @@ Map_descriptor_expression::do_dump_expression(
// Make a map descriptor expression.
Expression*
-Expression::make_map_descriptor(Map_type* type, source_location location)
+Expression::make_map_descriptor(Map_type* type, Location location)
{
return new Map_descriptor_expression(type, location);
}
@@ -13788,7 +13846,7 @@ Expression::make_map_descriptor(Map_type* type, source_location location)
class Label_addr_expression : public Expression
{
public:
- Label_addr_expression(Label* label, source_location location)
+ Label_addr_expression(Label* label, Location location)
: Expression(EXPRESSION_LABEL_ADDR, location),
label_(label)
{ }
@@ -13824,7 +13882,7 @@ class Label_addr_expression : public Expression
// Make an expression for the address of an unnamed label.
Expression*
-Expression::make_label_addr(Label* label, source_location location)
+Expression::make_label_addr(Label* label, Location location)
{
return new Label_addr_expression(label, location);
}
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index a1f03c429fc..74d1281e17c 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -98,81 +98,81 @@ class Expression
EXPRESSION_LABEL_ADDR
};
- Expression(Expression_classification, source_location);
+ Expression(Expression_classification, Location);
virtual ~Expression();
// Make an error expression. This is used when a parse error occurs
// to prevent cascading errors.
static Expression*
- make_error(source_location);
+ make_error(Location);
// Make an expression which is really a type. This is used during
// parsing.
static Expression*
- make_type(Type*, source_location);
+ make_type(Type*, Location);
// Make a unary expression.
static Expression*
- make_unary(Operator, Expression*, source_location);
+ make_unary(Operator, Expression*, Location);
// Make a binary expression.
static Expression*
- make_binary(Operator, Expression*, Expression*, source_location);
+ make_binary(Operator, Expression*, Expression*, Location);
// Make a reference to a constant in an expression.
static Expression*
- make_const_reference(Named_object*, source_location);
+ make_const_reference(Named_object*, Location);
// Make a reference to a variable in an expression.
static Expression*
- make_var_reference(Named_object*, source_location);
+ make_var_reference(Named_object*, Location);
// Make a reference to a temporary variable. Temporary variables
// are always created by a single statement, which is what we use to
// refer to them.
static Temporary_reference_expression*
- make_temporary_reference(Temporary_statement*, source_location);
+ make_temporary_reference(Temporary_statement*, Location);
// Make a sink expression--a reference to the blank identifier _.
static Expression*
- make_sink(source_location);
+ make_sink(Location);
// Make a reference to a function in an expression.
static Expression*
- make_func_reference(Named_object*, Expression* closure, source_location);
+ make_func_reference(Named_object*, Expression* closure, Location);
// Make a reference to an unknown name. In a correct program this
// will always be lowered to a real const/var/func reference.
static Expression*
- make_unknown_reference(Named_object*, source_location);
+ make_unknown_reference(Named_object*, Location);
// Make a constant bool expression.
static Expression*
- make_boolean(bool val, source_location);
+ make_boolean(bool val, Location);
// Make a constant string expression.
static Expression*
- make_string(const std::string&, source_location);
+ make_string(const std::string&, Location);
// Make a constant integer expression. TYPE should be NULL for an
// abstract type.
static Expression*
- make_integer(const mpz_t*, Type*, source_location);
+ make_integer(const mpz_t*, Type*, Location);
// Make a constant float expression. TYPE should be NULL for an
// abstract type.
static Expression*
- make_float(const mpfr_t*, Type*, source_location);
+ make_float(const mpfr_t*, Type*, Location);
// Make a constant complex expression. TYPE should be NULL for an
// abstract type.
static Expression*
- make_complex(const mpfr_t* real, const mpfr_t* imag, Type*, source_location);
+ make_complex(const mpfr_t* real, const mpfr_t* imag, Type*, Location);
// Make a nil expression.
static Expression*
- make_nil(source_location);
+ make_nil(Location);
// Make an iota expression. This is used for the predeclared
// constant iota.
@@ -182,7 +182,7 @@ class Expression
// Make a call expression.
static Call_expression*
make_call(Expression* func, Expression_list* args, bool is_varargs,
- source_location);
+ Location);
// Make a reference to a specific result of a call expression which
// returns a tuple.
@@ -192,7 +192,7 @@ class Expression
// Make an expression which is a method bound to its first
// parameter.
static Bound_method_expression*
- make_bound_method(Expression* object, Named_object* method, source_location);
+ make_bound_method(Expression* object, Named_object* method, Location);
// Make an index or slice expression. This is a parser expression
// which represents LEFT[START:END]. END may be NULL, meaning an
@@ -201,84 +201,84 @@ class Expression
// string index, or a map index.
static Expression*
make_index(Expression* left, Expression* start, Expression* end,
- source_location);
+ Location);
// Make an array index expression. END may be NULL, in which case
// this is an lvalue.
static Expression*
make_array_index(Expression* array, Expression* start, Expression* end,
- source_location);
+ Location);
// Make a string index expression. END may be NULL. This is never
// an lvalue.
static Expression*
make_string_index(Expression* string, Expression* start, Expression* end,
- source_location);
+ Location);
// Make a map index expression. This is an lvalue.
static Map_index_expression*
- make_map_index(Expression* map, Expression* val, source_location);
+ make_map_index(Expression* map, Expression* val, Location);
// Make a selector. This is a parser expression which represents
// LEFT.NAME. At parse time we may not know the type of the left
// hand side.
static Expression*
- make_selector(Expression* left, const std::string& name, source_location);
+ make_selector(Expression* left, const std::string& name, Location);
// Make a reference to a field in a struct.
static Field_reference_expression*
- make_field_reference(Expression*, unsigned int field_index, source_location);
+ make_field_reference(Expression*, unsigned int field_index, Location);
// Make a reference to a field of an interface, with an associated
// object.
static Expression*
make_interface_field_reference(Expression*, const std::string&,
- source_location);
+ Location);
// Make an allocation expression.
static Expression*
- make_allocation(Type*, source_location);
+ make_allocation(Type*, Location);
// Make a type guard expression.
static Expression*
- make_type_guard(Expression*, Type*, source_location);
+ make_type_guard(Expression*, Type*, Location);
// Make a type cast expression.
static Expression*
- make_cast(Type*, Expression*, source_location);
+ make_cast(Type*, Expression*, Location);
// Make an unsafe type cast expression. This is only used when
// passing parameter to builtin functions that are part of the Go
// runtime.
static Expression*
- make_unsafe_cast(Type*, Expression*, source_location);
+ make_unsafe_cast(Type*, Expression*, Location);
// Make a composite literal. The DEPTH parameter is how far down we
// are in a list of composite literals with omitted types.
static Expression*
make_composite_literal(Type*, int depth, bool has_keys, Expression_list*,
- source_location);
+ Location);
// Make a struct composite literal.
static Expression*
- make_struct_composite_literal(Type*, Expression_list*, source_location);
+ make_struct_composite_literal(Type*, Expression_list*, Location);
// Make a slice composite literal.
static Expression*
- make_slice_composite_literal(Type*, Expression_list*, source_location);
+ make_slice_composite_literal(Type*, Expression_list*, Location);
// Take a composite literal and allocate it on the heap.
static Expression*
- make_heap_composite(Expression*, source_location);
+ make_heap_composite(Expression*, Location);
// Make a receive expression. VAL is NULL for a unary receive.
static Receive_expression*
- make_receive(Expression* channel, source_location);
+ make_receive(Expression* channel, Location);
// Make an expression which evaluates to the address of the type
// descriptor for TYPE.
static Expression*
- make_type_descriptor(Type* type, source_location);
+ make_type_descriptor(Type* type, Location);
// Make an expression which evaluates to some characteristic of a
// type. These are only used for type descriptors, so there is no
@@ -306,12 +306,12 @@ class Expression
// Make an expression which evaluates to the address of the map
// descriptor for TYPE.
static Expression*
- make_map_descriptor(Map_type* type, source_location);
+ make_map_descriptor(Map_type* type, Location);
// Make an expression which evaluates to the address of an unnamed
// label.
static Expression*
- make_label_addr(Label*, source_location);
+ make_label_addr(Label*, Location);
// Return the expression classification.
Expression_classification
@@ -319,7 +319,7 @@ class Expression
{ return this->classification_; }
// Return the location of the expression.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -602,7 +602,7 @@ class Expression
// assignment.
static tree
convert_for_assignment(Translate_context*, Type* lhs_type, Type* rhs_type,
- tree rhs_tree, source_location location);
+ tree rhs_tree, Location location);
// Return a tree converting a value of one interface type to another
// interface type. If FOR_TYPE_GUARD is true this is for a type
@@ -610,14 +610,14 @@ class Expression
static tree
convert_interface_to_interface(Translate_context*, Type* lhs_type,
Type* rhs_type, tree rhs_tree,
- bool for_type_guard, source_location);
+ bool for_type_guard, Location);
// Return a tree implementing the comparison LHS_TREE OP RHS_TREE.
// TYPE is the type of both sides.
static tree
comparison_tree(Translate_context*, Operator op, Type* left_type,
tree left_tree, Type* right_type, tree right_tree,
- source_location);
+ Location);
// Return a tree for the multi-precision integer VAL in TYPE.
static tree
@@ -647,7 +647,7 @@ class Expression
// BOUND_TYPE. If SOFAR is not NULL, it is or'red into the result.
// The return value may be NULL if SOFAR is NULL.
static tree
- check_bounds(tree val, tree bound_type, tree sofar, source_location);
+ check_bounds(tree val, tree bound_type, tree sofar, Location);
// Dump an expression to a dump constext.
void
@@ -785,20 +785,20 @@ class Expression
static tree
convert_type_to_interface(Translate_context*, Type*, Type*, tree,
- source_location);
+ Location);
static tree
get_interface_type_descriptor(Translate_context*, Type*, tree,
- source_location);
+ Location);
static tree
convert_interface_to_type(Translate_context*, Type*, Type*, tree,
- source_location);
+ Location);
// The expression classification.
Expression_classification classification_;
// The location in the input file.
- source_location location_;
+ Location location_;
};
// A list of Expressions.
@@ -900,7 +900,7 @@ class Parser_expression : public Expression
{
public:
Parser_expression(Expression_classification classification,
- source_location location)
+ Location location)
: Expression(classification, location)
{ }
@@ -929,7 +929,7 @@ class Parser_expression : public Expression
class Var_expression : public Expression
{
public:
- Var_expression(Named_object* variable, source_location location)
+ Var_expression(Named_object* variable, Location location)
: Expression(EXPRESSION_VAR_REFERENCE, location),
variable_(variable)
{ }
@@ -977,7 +977,7 @@ class Temporary_reference_expression : public Expression
{
public:
Temporary_reference_expression(Temporary_statement* statement,
- source_location location)
+ Location location)
: Expression(EXPRESSION_TEMPORARY_REFERENCE, location),
statement_(statement), is_lvalue_(false)
{ }
@@ -1026,7 +1026,7 @@ class Temporary_reference_expression : public Expression
class String_expression : public Expression
{
public:
- String_expression(const std::string& val, source_location location)
+ String_expression(const std::string& val, Location location)
: Expression(EXPRESSION_STRING, location),
val_(val), type_(NULL)
{ }
@@ -1086,7 +1086,7 @@ class Binary_expression : public Expression
{
public:
Binary_expression(Operator op, Expression* left, Expression* right,
- source_location location)
+ Location location)
: Expression(EXPRESSION_BINARY, location),
op_(op), left_(left), right_(right)
{ }
@@ -1112,7 +1112,7 @@ class Binary_expression : public Expression
// if this could be done, false if not.
static bool
eval_integer(Operator op, Type* left_type, mpz_t left_val,
- Type* right_type, mpz_t right_val, source_location,
+ Type* right_type, mpz_t right_val, Location,
mpz_t val);
// Apply binary opcode OP to LEFT_VAL and RIGHT_VAL, setting VAL.
@@ -1120,7 +1120,7 @@ class Binary_expression : public Expression
static bool
eval_float(Operator op, Type* left_type, mpfr_t left_val,
Type* right_type, mpfr_t right_val, mpfr_t val,
- source_location);
+ Location);
// Apply binary opcode OP to LEFT_REAL/LEFT_IMAG and
// RIGHT_REAL/RIGHT_IMAG, setting REAL/IMAG. Return true if this
@@ -1128,7 +1128,7 @@ class Binary_expression : public Expression
static bool
eval_complex(Operator op, Type* left_type, mpfr_t left_real,
mpfr_t left_imag, Type* right_type, mpfr_t right_real,
- mpfr_t right_imag, mpfr_t real, mpfr_t imag, source_location);
+ mpfr_t right_imag, mpfr_t real, mpfr_t imag, Location);
// Compare integer constants according to OP.
static bool
@@ -1149,7 +1149,7 @@ class Binary_expression : public Expression
// Report an error if OP can not be applied to TYPE. Return whether
// it can.
static bool
- check_operator_type(Operator op, Type* type, source_location);
+ check_operator_type(Operator op, Type* type, Location);
protected:
int
@@ -1214,7 +1214,7 @@ class Call_expression : public Expression
{
public:
Call_expression(Expression* fn, Expression_list* args, bool is_varargs,
- source_location location)
+ Location location)
: Expression(EXPRESSION_CALL, location),
fn_(fn), args_(args), type_(NULL), results_(NULL), tree_(NULL),
is_varargs_(is_varargs), are_hidden_fields_ok_(false),
@@ -1352,7 +1352,7 @@ class Call_expression : public Expression
private:
bool
- check_argument_type(int, const Type*, const Type*, source_location, bool);
+ check_argument_type(int, const Type*, const Type*, Location, bool);
tree
interface_method_function(Translate_context*,
@@ -1397,7 +1397,7 @@ class Func_expression : public Expression
{
public:
Func_expression(Named_object* function, Expression* closure,
- source_location location)
+ Location location)
: Expression(EXPRESSION_FUNC_REFERENCE, location),
function_(function), closure_(closure)
{ }
@@ -1461,7 +1461,7 @@ class Func_expression : public Expression
class Unknown_expression : public Parser_expression
{
public:
- Unknown_expression(Named_object* named_object, source_location location)
+ Unknown_expression(Named_object* named_object, Location location)
: Parser_expression(EXPRESSION_UNKNOWN_REFERENCE, location),
named_object_(named_object), is_composite_literal_key_(false)
{ }
@@ -1512,7 +1512,7 @@ class Index_expression : public Parser_expression
{
public:
Index_expression(Expression* left, Expression* start, Expression* end,
- source_location location)
+ Location location)
: Parser_expression(EXPRESSION_INDEX, location),
left_(left), start_(start), end_(end), is_lvalue_(false)
{ }
@@ -1574,7 +1574,7 @@ class Map_index_expression : public Expression
{
public:
Map_index_expression(Expression* map, Expression* index,
- source_location location)
+ Location location)
: Expression(EXPRESSION_MAP_INDEX, location),
map_(map), index_(index), is_lvalue_(false),
is_in_tuple_assignment_(false)
@@ -1682,7 +1682,7 @@ class Bound_method_expression : public Expression
{
public:
Bound_method_expression(Expression* expr, Named_object* method,
- source_location location)
+ Location location)
: Expression(EXPRESSION_BOUND_METHOD, location),
expr_(expr), expr_type_(NULL), method_(method)
{ }
@@ -1753,7 +1753,7 @@ class Field_reference_expression : public Expression
{
public:
Field_reference_expression(Expression* expr, unsigned int field_index,
- source_location location)
+ Location location)
: Expression(EXPRESSION_FIELD_REFERENCE, location),
expr_(expr), field_index_(field_index)
{ }
@@ -1824,7 +1824,7 @@ class Interface_field_reference_expression : public Expression
public:
Interface_field_reference_expression(Expression* expr,
const std::string& name,
- source_location location)
+ Location location)
: Expression(EXPRESSION_INTERFACE_FIELD_REFERENCE, location),
expr_(expr), name_(name)
{ }
@@ -1890,7 +1890,7 @@ class Interface_field_reference_expression : public Expression
class Type_guard_expression : public Expression
{
public:
- Type_guard_expression(Expression* expr, Type* type, source_location location)
+ Type_guard_expression(Expression* expr, Type* type, Location location)
: Expression(EXPRESSION_TYPE_GUARD, location),
expr_(expr), type_(type)
{ }
@@ -1945,7 +1945,7 @@ class Type_guard_expression : public Expression
class Receive_expression : public Expression
{
public:
- Receive_expression(Expression* channel, source_location location)
+ Receive_expression(Expression* channel, Location location)
: Expression(EXPRESSION_RECEIVE, location),
channel_(channel), for_select_(false)
{ }
diff --git a/gcc/go/gofrontend/go-linemap.h b/gcc/go/gofrontend/go-linemap.h
new file mode 100644
index 00000000000..ffbcbe7781b
--- /dev/null
+++ b/gcc/go/gofrontend/go-linemap.h
@@ -0,0 +1,131 @@
+// go-linemap.h -- interface to location tracking -*- C++ -*-
+
+// Copyright 2011 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.
+
+#ifndef GO_LINEMAP_H
+#define GO_LINEMAP_H
+
+#include "go-system.h"
+
+// The backend must define a type named Location which holds
+// information about a location in a source file. The only thing the
+// frontend does with instances of Location is pass them back to the
+// backend interface. The Location type must be assignable, and it
+// must be comparable: i.e., it must support operator= and operator<.
+// The type is normally passed by value rather than by reference, and
+// it should support that efficiently. The type should be defined in
+// "go-location.h".
+
+#include "go-location.h"
+
+// The Linemap class is a pure abstract interface, plus some static
+// convenience functions. The backend must implement the interface.
+
+class Linemap
+{
+ public:
+ Linemap()
+ {
+ // Only one instance of Linemap is allowed to exist.
+ go_assert(Linemap::instance_ == NULL);
+ Linemap::instance_ = this;
+ }
+
+ virtual
+ ~Linemap() { Linemap::instance_ = NULL; }
+
+ // Subsequent Location values will come from the file named
+ // FILE_NAME, starting at LINE_BEGIN. Normally LINE_BEGIN will be
+ // 0, but it will be non-zero if the Go source has a //line comment.
+ virtual void
+ start_file(const char* file_name, unsigned int line_begin) = 0;
+
+ // Subsequent Location values will come from the line LINE_NUMBER,
+ // in the current file. LINE_SIZE is the size of the line in bytes.
+ // This will normally be called for every line in a source file.
+ virtual void
+ start_line(unsigned int line_number, unsigned int line_size) = 0;
+
+ // Get a Location representing column position COLUMN on the current
+ // line in the current file.
+ virtual Location
+ get_location(unsigned int column) = 0;
+
+ // Stop generating Location values. This will be called after all
+ // input files have been read, in case any cleanup is required.
+ virtual void
+ stop() = 0;
+
+ protected:
+ // Return a special Location used for predeclared identifiers. This
+ // Location should be different from that for any actual source
+ // file. This location will be used for various different types,
+ // functions, and objects created by the frontend.
+ virtual Location
+ get_predeclared_location() = 0;
+
+ // Return a special Location which indicates that no actual location
+ // is known. This is used for undefined objects and for errors.
+ virtual Location
+ get_unknown_location() = 0;
+
+ // Return whether the argument is the Location returned by
+ // get_predeclared_location.
+ virtual bool
+ is_predeclared(Location) = 0;
+
+ // Return whether the argument is the Location returned by
+ // get_unknown_location.
+ virtual bool
+ is_unknown(Location) = 0;
+
+ // The single existing instance of Linemap.
+ static Linemap *instance_;
+
+ public:
+ // Following are convenience static functions, which allow us to
+ // access some virtual functions without explicitly passing around
+ // an instance of Linemap.
+
+ // Return the special Location used for predeclared identifiers.
+ static Location
+ predeclared_location()
+ {
+ go_assert(Linemap::instance_ != NULL);
+ return Linemap::instance_->get_predeclared_location();
+ }
+
+ // Return the special Location used when no location is known.
+ static Location
+ unknown_location()
+ {
+ go_assert(Linemap::instance_ != NULL);
+ return Linemap::instance_->get_unknown_location();
+ }
+
+ // Return whether the argument is the special location used for
+ // predeclared identifiers.
+ static bool
+ is_predeclared_location(Location loc)
+ {
+ go_assert(Linemap::instance_ != NULL);
+ return Linemap::instance_->is_predeclared(loc);
+ }
+
+ // Return whether the argument is the special location used when no
+ // location is known.
+ static bool
+ is_unknown_location(Location loc)
+ {
+ go_assert(Linemap::instance_ != NULL);
+ return Linemap::instance_->is_unknown(loc);
+ }
+};
+
+// The backend interface must define this function. It should return
+// a fully implemented instance of Linemap.
+extern Linemap* go_get_linemap();
+
+#endif // !defined(GO_LINEMAP_H)
diff --git a/gcc/go/gofrontend/go.cc b/gcc/go/gofrontend/go.cc
index 4ab0f8ee7cf..39af54999ed 100644
--- a/gcc/go/gofrontend/go.cc
+++ b/gcc/go/gofrontend/go.cc
@@ -28,7 +28,8 @@ void
go_create_gogo(int int_type_size, int pointer_size)
{
go_assert(::gogo == NULL);
- ::gogo = new Gogo(go_get_backend(), int_type_size, pointer_size);
+ Linemap* linemap = go_get_linemap();
+ ::gogo = new Gogo(go_get_backend(), linemap, int_type_size, pointer_size);
if (!unique_prefix.empty())
::gogo->set_unique_prefix(unique_prefix);
@@ -64,6 +65,7 @@ go_parse_input_files(const char** filenames, unsigned int filename_count,
bool only_check_syntax, bool require_return_statement)
{
go_assert(filename_count > 0);
+
for (unsigned int i = 0; i < filename_count; ++i)
{
if (i > 0)
@@ -80,7 +82,7 @@ go_parse_input_files(const char** filenames, unsigned int filename_count,
fatal_error("cannot open %s: %m", filename);
}
- Lex lexer(filename, file);
+ Lex lexer(filename, file, ::gogo->linemap());
Parse parse(&lexer, ::gogo);
parse.program();
@@ -89,6 +91,8 @@ go_parse_input_files(const char** filenames, unsigned int filename_count,
fclose(file);
}
+ ::gogo->linemap()->stop();
+
::gogo->clear_file_scope();
// If the global predeclared names are referenced but not defined,
diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc
index 349ee255382..0e77f5dcd61 100644
--- a/gcc/go/gofrontend/gogo-tree.cc
+++ b/gcc/go/gofrontend/gogo-tree.cc
@@ -336,8 +336,9 @@ Gogo::register_gc_vars(const std::vector<Named_object*>& var_gc,
rest_of_decl_compilation(decl, 1, 0);
static tree register_gc_fndecl;
- tree call = Gogo::call_builtin(&register_gc_fndecl, BUILTINS_LOCATION,
- "__go_register_gc_roots",
+ tree call = Gogo::call_builtin(&register_gc_fndecl,
+ Linemap::predeclared_location(),
+ "__go_register_gc_roots",
1,
void_type_node,
build_pointer_type(root_list_type),
@@ -746,8 +747,9 @@ Gogo::write_globals()
else if (is_sink)
var_init_tree = init;
else
- var_init_tree = fold_build2_loc(no->location(), MODIFY_EXPR,
- void_type_node, vec[i], init);
+ var_init_tree = fold_build2_loc(no->location().gcc_location(),
+ MODIFY_EXPR, void_type_node,
+ vec[i], init);
}
else
{
@@ -843,7 +845,7 @@ Named_object::get_id(Gogo* gogo)
&& !this->func_declaration_value()->asm_name().empty())
decl_name = this->func_declaration_value()->asm_name();
else if (this->is_type()
- && this->type_value()->location() == BUILTINS_LOCATION)
+ && Linemap::is_predeclared_location(this->type_value()->location()))
{
// We don't need the package name for builtin types.
decl_name = Gogo::unpack_hidden_name(this->name_);
@@ -920,8 +922,8 @@ Named_object::get_tree(Gogo* gogo, Named_object* function)
decl = error_mark_node;
else if (INTEGRAL_TYPE_P(TREE_TYPE(expr_tree)))
{
- decl = build_decl(named_constant->location(), CONST_DECL,
- name, TREE_TYPE(expr_tree));
+ decl = build_decl(named_constant->location().gcc_location(),
+ CONST_DECL, name, TREE_TYPE(expr_tree));
DECL_INITIAL(decl) = expr_tree;
TREE_CONSTANT(decl) = 1;
TREE_READONLY(decl) = 1;
@@ -958,9 +960,12 @@ Named_object::get_tree(Gogo* gogo, Named_object* function)
// descriptor, even though we don't do anything with it.
if (this->package_ == NULL)
{
- named_type->type_descriptor_pointer(gogo, BUILTINS_LOCATION);
+ named_type->
+ type_descriptor_pointer(gogo,
+ Linemap::predeclared_location());
Type* pn = Type::make_pointer_type(named_type);
- pn->type_descriptor_pointer(gogo, BUILTINS_LOCATION);
+ pn->type_descriptor_pointer(gogo,
+ Linemap::predeclared_location());
}
}
}
@@ -989,7 +994,8 @@ Named_object::get_tree(Gogo* gogo, Named_object* function)
else
push_cfun(DECL_STRUCT_FUNCTION(decl));
- cfun->function_end_locus = func->block()->end_location();
+ cfun->function_end_locus =
+ func->block()->end_location().gcc_location();
current_function_decl = decl;
@@ -1091,8 +1097,9 @@ Variable::get_init_block(Gogo* gogo, Named_object* function, tree var_decl)
this->location());
if (val == error_mark_node)
return error_mark_node;
- tree set = fold_build2_loc(this->location(), MODIFY_EXPR,
- void_type_node, var_decl, val);
+ tree set = fold_build2_loc(this->location().gcc_location(),
+ MODIFY_EXPR, void_type_node, var_decl,
+ val);
append_to_statement_list(set, &statements);
}
}
@@ -1116,7 +1123,8 @@ Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)
// want the real function type for a function declaration.
go_assert(POINTER_TYPE_P(functype));
functype = TREE_TYPE(functype);
- tree decl = build_decl(this->location(), FUNCTION_DECL, id, functype);
+ tree decl = build_decl(this->location().gcc_location(), FUNCTION_DECL,
+ id, functype);
this->fndecl_ = decl;
@@ -1146,8 +1154,9 @@ Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)
// Why do we have to do this in the frontend?
tree restype = TREE_TYPE(functype);
- tree resdecl = build_decl(this->location(), RESULT_DECL, NULL_TREE,
- restype);
+ tree resdecl =
+ build_decl(this->location().gcc_location(), RESULT_DECL, NULL_TREE,
+ restype);
DECL_ARTIFICIAL(resdecl) = 1;
DECL_IGNORED_P(resdecl) = 1;
DECL_CONTEXT(resdecl) = decl;
@@ -1233,7 +1242,8 @@ Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)
// want the real function type for a function declaration.
go_assert(POINTER_TYPE_P(functype));
functype = TREE_TYPE(functype);
- decl = build_decl(this->location(), FUNCTION_DECL, id, functype);
+ decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, id,
+ functype);
TREE_PUBLIC(decl) = 1;
DECL_EXTERNAL(decl) = 1;
@@ -1292,7 +1302,8 @@ Function::make_receiver_parm_decl(Gogo* gogo, Named_object* no, tree var_decl)
no->location());
space = save_expr(space);
space = fold_convert(build_pointer_type(val_type), space);
- tree spaceref = build_fold_indirect_ref_loc(no->location(), space);
+ tree spaceref = build_fold_indirect_ref_loc(no->location().gcc_location(),
+ space);
TREE_THIS_NOTRAP(spaceref) = 1;
tree set = fold_build2_loc(loc, MODIFY_EXPR, void_type_node,
spaceref, init);
@@ -1314,7 +1325,7 @@ Function::copy_parm_to_heap(Gogo* gogo, Named_object* no, tree var_decl)
if (var_decl == error_mark_node)
return error_mark_node;
go_assert(TREE_CODE(var_decl) == VAR_DECL);
- source_location loc = DECL_SOURCE_LOCATION(var_decl);
+ Location loc(DECL_SOURCE_LOCATION(var_decl));
std::string name = IDENTIFIER_POINTER(DECL_NAME(var_decl));
name += ".param";
@@ -1324,7 +1335,7 @@ Function::copy_parm_to_heap(Gogo* gogo, Named_object* no, tree var_decl)
go_assert(POINTER_TYPE_P(type));
type = TREE_TYPE(type);
- tree parm_decl = build_decl(loc, PARM_DECL, id, type);
+ tree parm_decl = build_decl(loc.gcc_location(), PARM_DECL, id, type);
DECL_CONTEXT(parm_decl) = current_function_decl;
DECL_ARG_TYPE(parm_decl) = type;
@@ -1332,7 +1343,7 @@ Function::copy_parm_to_heap(Gogo* gogo, Named_object* no, tree var_decl)
tree space = gogo->allocate_memory(no->var_value()->type(), size, loc);
space = save_expr(space);
space = fold_convert(TREE_TYPE(var_decl), space);
- tree spaceref = build_fold_indirect_ref_loc(loc, space);
+ tree spaceref = build_fold_indirect_ref_loc(loc.gcc_location(), space);
TREE_THIS_NOTRAP(spaceref) = 1;
tree init = build2(COMPOUND_EXPR, TREE_TYPE(space),
build2(MODIFY_EXPR, void_type_node, spaceref, parm_decl),
@@ -1415,13 +1426,13 @@ Function::build_tree(Gogo* gogo, Named_object* named_function)
}
else
{
- source_location loc = (*p)->location();
+ Location loc = (*p)->location();
tree type_tree = type_to_tree(type->get_backend(gogo));
tree space = gogo->allocate_memory(type,
TYPE_SIZE_UNIT(type_tree),
loc);
tree ptr_type_tree = build_pointer_type(type_tree);
- init = fold_convert_loc(loc, ptr_type_tree, space);
+ init = fold_convert_loc(loc.gcc_location(), ptr_type_tree, space);
}
if (var_decl != error_mark_node)
@@ -1486,7 +1497,8 @@ Function::build_tree(Gogo* gogo, Named_object* named_function)
// function.
if (defer_init != NULL_TREE && defer_init != error_mark_node)
{
- SET_EXPR_LOCATION(defer_init, this->block_->start_location());
+ SET_EXPR_LOCATION(defer_init,
+ this->block_->start_location().gcc_location());
append_to_statement_list(defer_init, &init);
// Clean up the defer stack when we leave the function.
@@ -1524,7 +1536,7 @@ void
Function::build_defer_wrapper(Gogo* gogo, Named_object* named_function,
tree *except, tree *fini)
{
- source_location end_loc = this->block_->end_location();
+ Location end_loc = this->block_->end_location();
// Add an exception handler. This is used if a panic occurs. Its
// purpose is to stop the stack unwinding if a deferred function
@@ -1545,9 +1557,10 @@ Function::build_defer_wrapper(Gogo* gogo, Named_object* named_function,
if (retval == NULL_TREE)
set = NULL_TREE;
else
- set = fold_build2_loc(end_loc, MODIFY_EXPR, void_type_node,
+ set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node,
DECL_RESULT(this->fndecl_), retval);
- tree ret_stmt = fold_build1_loc(end_loc, RETURN_EXPR, void_type_node, set);
+ tree ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR,
+ void_type_node, set);
append_to_statement_list(ret_stmt, &stmt_list);
go_assert(*except == NULL_TREE);
@@ -1564,9 +1577,9 @@ Function::build_defer_wrapper(Gogo* gogo, Named_object* named_function,
stmt_list = NULL;
- tree label = create_artificial_label(end_loc);
- tree define_label = fold_build1_loc(end_loc, LABEL_EXPR, void_type_node,
- label);
+ tree label = create_artificial_label(end_loc.gcc_location());
+ tree define_label = fold_build1_loc(end_loc.gcc_location(), LABEL_EXPR,
+ void_type_node, label);
append_to_statement_list(define_label, &stmt_list);
call = Runtime::make_call(Runtime::UNDEFER, end_loc, 1,
@@ -1580,7 +1593,8 @@ Function::build_defer_wrapper(Gogo* gogo, Named_object* named_function,
if (undefer == error_mark_node || defer == error_mark_node)
return;
- tree jump = fold_build1_loc(end_loc, GOTO_EXPR, void_type_node, label);
+ tree jump = fold_build1_loc(end_loc.gcc_location(), GOTO_EXPR, void_type_node,
+ label);
tree catch_body = build2(COMPOUND_EXPR, void_type_node, defer, jump);
catch_body = build2(CATCH_EXPR, void_type_node, NULL, catch_body);
tree try_catch = build2(TRY_CATCH_EXPR, void_type_node, undefer, catch_body);
@@ -1598,15 +1612,16 @@ Function::build_defer_wrapper(Gogo* gogo, Named_object* named_function,
// variable to true if we are returning from this function.
retval = this->return_value(gogo, named_function, end_loc,
&stmt_list);
- set = fold_build2_loc(end_loc, MODIFY_EXPR, void_type_node,
+ set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node,
DECL_RESULT(this->fndecl_), retval);
- ret_stmt = fold_build1_loc(end_loc, RETURN_EXPR, void_type_node, set);
+ ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR,
+ void_type_node, set);
Expression* ref =
Expression::make_temporary_reference(this->defer_stack_, end_loc);
tree tref = ref->get_tree(&context);
- tree s = build3_loc(end_loc, COND_EXPR, void_type_node, tref,
- ret_stmt, NULL_TREE);
+ tree s = build3_loc(end_loc.gcc_location(), COND_EXPR, void_type_node,
+ tref, ret_stmt, NULL_TREE);
append_to_statement_list(s, &stmt_list);
@@ -1623,7 +1638,7 @@ Function::build_defer_wrapper(Gogo* gogo, Named_object* named_function,
tree
Function::return_value(Gogo* gogo, Named_object* named_function,
- source_location location, tree* stmt_list) const
+ Location location, tree* stmt_list) const
{
const Typed_identifier_list* results = this->type_->results();
if (results == NULL || results->empty())
@@ -1644,7 +1659,7 @@ Function::return_value(Gogo* gogo, Named_object* named_function,
named_function);
tree ret = var_to_tree(bvar);
if (this->results_->front()->result_var_value()->is_in_heap())
- ret = build_fold_indirect_ref_loc(location, ret);
+ ret = build_fold_indirect_ref_loc(location.gcc_location(), ret);
return ret;
}
else
@@ -1662,8 +1677,9 @@ Function::return_value(Gogo* gogo, Named_object* named_function,
Bvariable* bvar = no->get_backend_variable(gogo, named_function);
tree val = var_to_tree(bvar);
if (no->result_var_value()->is_in_heap())
- val = build_fold_indirect_ref_loc(location, val);
- tree set = fold_build2_loc(location, MODIFY_EXPR, void_type_node,
+ val = build_fold_indirect_ref_loc(location.gcc_location(), val);
+ tree set = fold_build2_loc(location.gcc_location(), MODIFY_EXPR,
+ void_type_node,
build3(COMPONENT_REF, TREE_TYPE(field),
retval, field, NULL_TREE),
val);
@@ -1762,7 +1778,7 @@ go_type_for_mode(enum machine_mode mode, int unsignedp)
// type TYPE.
tree
-Gogo::allocate_memory(Type* type, tree size, source_location location)
+Gogo::allocate_memory(Type* type, tree size, Location location)
{
// If the package imports unsafe, then it may play games with
// pointers that look like integers.
@@ -2028,7 +2044,8 @@ Gogo::interface_method_table_for_type(const Interface_type* interface,
td_type = type;
else
td_type = Type::make_pointer_type(type);
- tree tdp = td_type->type_descriptor_pointer(this, BUILTINS_LOCATION);
+ tree tdp = td_type->type_descriptor_pointer(this,
+ Linemap::predeclared_location());
elt->value = fold_convert(const_ptr_type_node, tdp);
size_t i = 1;
@@ -2105,7 +2122,7 @@ Gogo::mark_fndecl_as_builtin_library(tree fndecl)
// Build a call to a builtin function.
tree
-Gogo::call_builtin(tree* pdecl, source_location location, const char* name,
+Gogo::call_builtin(tree* pdecl, Location location, const char* name,
int nargs, tree rettype, ...)
{
if (rettype == error_mark_node)
@@ -2151,10 +2168,10 @@ Gogo::call_builtin(tree* pdecl, source_location location, const char* name,
tree fnptr = build_fold_addr_expr(*pdecl);
if (CAN_HAVE_LOCATION_P(fnptr))
- SET_EXPR_LOCATION(fnptr, location);
+ SET_EXPR_LOCATION(fnptr, location.gcc_location());
tree ret = build_call_array(rettype, fnptr, nargs, args);
- SET_EXPR_LOCATION(ret, location);
+ SET_EXPR_LOCATION(ret, location.gcc_location());
delete[] types;
delete[] args;
@@ -2165,7 +2182,7 @@ Gogo::call_builtin(tree* pdecl, source_location location, const char* name,
// Build a call to the runtime error function.
tree
-Gogo::runtime_error(int code, source_location location)
+Gogo::runtime_error(int code, Location location)
{
static tree runtime_error_fndecl;
tree ret = Gogo::call_builtin(&runtime_error_fndecl,
@@ -2190,7 +2207,7 @@ Gogo::runtime_error(int code, source_location location)
tree
Gogo::receive_from_channel(tree type_tree, tree channel, bool for_select,
- source_location location)
+ Location location)
{
if (type_tree == error_mark_node || channel == error_mark_node)
return error_mark_node;
@@ -2218,9 +2235,9 @@ Gogo::receive_from_channel(tree type_tree, tree channel, bool for_select,
TREE_NOTHROW(receive_small_fndecl) = 0;
int bitsize = GET_MODE_BITSIZE(TYPE_MODE(type_tree));
tree int_type_tree = go_type_for_size(bitsize, 1);
- return fold_convert_loc(location, type_tree,
- fold_convert_loc(location, int_type_tree,
- call));
+ return fold_convert_loc(location.gcc_location(), type_tree,
+ fold_convert_loc(location.gcc_location(),
+ int_type_tree, call));
}
else
{
@@ -2228,7 +2245,7 @@ Gogo::receive_from_channel(tree type_tree, tree channel, bool for_select,
DECL_IGNORED_P(tmp) = 0;
TREE_ADDRESSABLE(tmp) = 1;
tree make_tmp = build1(DECL_EXPR, void_type_node, tmp);
- SET_EXPR_LOCATION(make_tmp, location);
+ SET_EXPR_LOCATION(make_tmp, location.gcc_location());
tree tmpaddr = build_fold_addr_expr(tmp);
tmpaddr = fold_convert(ptr_type_node, tmpaddr);
static tree receive_big_fndecl;
@@ -2284,7 +2301,7 @@ Gogo::trampoline_type_tree()
// Make a trampoline which calls FNADDR passing CLOSURE.
tree
-Gogo::make_trampoline(tree fnaddr, tree closure, source_location location)
+Gogo::make_trampoline(tree fnaddr, tree closure, Location location)
{
tree trampoline_type = Gogo::trampoline_type_tree();
tree trampoline_size = TYPE_SIZE_UNIT(trampoline_type);
@@ -2302,8 +2319,8 @@ Gogo::make_trampoline(tree fnaddr, tree closure, source_location location)
size_type_node,
trampoline_size,
ptr_type_node,
- fold_convert_loc(location, ptr_type_node,
- closure));
+ fold_convert_loc(location.gcc_location(),
+ ptr_type_node, closure));
if (x == error_mark_node)
return error_mark_node;
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index e20063b817f..dc5ac75268a 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -21,8 +21,10 @@
// Class Gogo.
-Gogo::Gogo(Backend* backend, int int_type_size, int pointer_size)
+Gogo::Gogo(Backend* backend, Linemap* linemap, int int_type_size,
+ int pointer_size)
: backend_(backend),
+ linemap_(linemap),
package_(NULL),
functions_(),
globals_(new Bindings(NULL)),
@@ -38,7 +40,7 @@ Gogo::Gogo(Backend* backend, int int_type_size, int pointer_size)
interface_types_(),
named_types_are_converted_(false)
{
- const source_location loc = BUILTINS_LOCATION;
+ const Location loc = Linemap::predeclared_location();
Named_type* uint8_type = Type::make_integer_type("uint8", true, 8,
RUNTIME_TYPE_KIND_UINT8);
@@ -97,6 +99,18 @@ Gogo::Gogo(Backend* backend, int int_type_size, int pointer_size)
this->add_named_type(Type::make_named_string_type());
+ // "error" is interface { Error() string }.
+ {
+ Typed_identifier_list *methods = new Typed_identifier_list;
+ Typed_identifier_list *results = new Typed_identifier_list;
+ results->push_back(Typed_identifier("", Type::lookup_string_type(), loc));
+ Type *method_type = Type::make_function_type(NULL, NULL, results, loc);
+ methods->push_back(Typed_identifier("Error", method_type, loc));
+ Type *error_iface = Type::make_interface_type(methods, loc);
+ Named_type *error_type = Named_object::make_type("error", NULL, error_iface, loc)->type_value();
+ this->add_named_type(error_type);
+ }
+
this->globals_->add_constant(Typed_identifier("true",
Type::make_boolean_type(),
loc),
@@ -233,7 +247,7 @@ Gogo::package_name() const
void
Gogo::set_package_name(const std::string& package_name,
- source_location location)
+ Location location)
{
if (this->package_ != NULL && this->package_->name() != package_name)
{
@@ -258,10 +272,10 @@ Gogo::set_package_name(const std::string& package_name,
{
// Declare "main" as a function which takes no parameters and
// returns no value.
+ Location uloc = Linemap::unknown_location();
this->declare_function("main",
- Type::make_function_type(NULL, NULL, NULL,
- BUILTINS_LOCATION),
- BUILTINS_LOCATION);
+ Type::make_function_type (NULL, NULL, NULL, uloc),
+ uloc);
}
}
@@ -280,7 +294,7 @@ void
Gogo::import_package(const std::string& filename,
const std::string& local_name,
bool is_local_name_exported,
- source_location location)
+ Location location)
{
if (filename == "unsafe")
{
@@ -490,7 +504,7 @@ Gogo::add_imported_package(const std::string& real_name,
const std::string& alias_arg,
bool is_alias_exported,
const std::string& unique_prefix,
- source_location location,
+ Location location,
bool* padd_to_globals)
{
// FIXME: Now that we compile packages as a whole, should we permit
@@ -540,7 +554,7 @@ Gogo::add_imported_package(const std::string& real_name,
Named_object*
Gogo::add_package(const std::string& real_name, const std::string& alias,
- const std::string& unique_prefix, source_location location)
+ const std::string& unique_prefix, Location location)
{
go_assert(this->in_global_scope());
@@ -558,7 +572,7 @@ Gogo::add_package(const std::string& real_name, const std::string& alias,
Package*
Gogo::register_package(const std::string& package_name,
const std::string& unique_prefix,
- source_location location)
+ Location location)
{
go_assert(!unique_prefix.empty() && !package_name.empty());
std::string name = unique_prefix + '.' + package_name;
@@ -572,7 +586,7 @@ Gogo::register_package(const std::string& package_name,
go_assert(package != NULL);
go_assert(package->name() == package_name
&& package->unique_prefix() == unique_prefix);
- if (package->location() == UNKNOWN_LOCATION)
+ if (Linemap::is_unknown_location(package->location()))
package->set_location(location);
}
else
@@ -590,7 +604,7 @@ Gogo::register_package(const std::string& package_name,
Named_object*
Gogo::start_function(const std::string& name, Function_type* type,
- bool add_method_to_type, source_location location)
+ bool add_method_to_type, Location location)
{
bool at_top_level = this->functions_.empty();
@@ -775,7 +789,7 @@ Gogo::start_function(const std::string& name, Function_type* type,
// Finish compiling a function.
void
-Gogo::finish_function(source_location location)
+Gogo::finish_function(Location location)
{
this->finish_block(location);
go_assert(this->functions_.back().blocks.empty());
@@ -794,7 +808,7 @@ Gogo::current_function() const
// Start a new block.
void
-Gogo::start_block(source_location location)
+Gogo::start_block(Location location)
{
go_assert(!this->functions_.empty());
Block* block = new Block(this->current_block(), location);
@@ -804,7 +818,7 @@ Gogo::start_block(source_location location)
// Finish a block.
Block*
-Gogo::finish_block(source_location location)
+Gogo::finish_block(Location location)
{
go_assert(!this->functions_.empty());
go_assert(!this->functions_.back().blocks.empty());
@@ -817,7 +831,7 @@ Gogo::finish_block(source_location location)
// Add an unknown name.
Named_object*
-Gogo::add_unknown_name(const std::string& name, source_location location)
+Gogo::add_unknown_name(const std::string& name, Location location)
{
return this->package_->bindings()->add_unknown_name(name, location);
}
@@ -826,7 +840,7 @@ Gogo::add_unknown_name(const std::string& name, source_location location)
Named_object*
Gogo::declare_function(const std::string& name, Function_type* type,
- source_location location)
+ Location location)
{
if (!type->is_method())
return this->current_bindings()->add_function_declaration(name, NULL, type,
@@ -862,7 +876,7 @@ Gogo::declare_function(const std::string& name, Function_type* type,
Label*
Gogo::add_label_definition(const std::string& label_name,
- source_location location)
+ Location location)
{
go_assert(!this->functions_.empty());
Function* func = this->functions_.back().function->func_value();
@@ -875,7 +889,7 @@ Gogo::add_label_definition(const std::string& label_name,
Label*
Gogo::add_label_reference(const std::string& label_name,
- source_location location, bool issue_goto_errors)
+ Location location, bool issue_goto_errors)
{
go_assert(!this->functions_.empty());
Function* func = this->functions_.back().function->func_value();
@@ -886,7 +900,7 @@ Gogo::add_label_reference(const std::string& label_name,
// Return the current binding state.
Bindings_snapshot*
-Gogo::bindings_snapshot(source_location location)
+Gogo::bindings_snapshot(Location location)
{
return new Bindings_snapshot(this->current_block(), location);
}
@@ -904,7 +918,7 @@ Gogo::add_statement(Statement* statement)
// Add a block.
void
-Gogo::add_block(Block* block, source_location location)
+Gogo::add_block(Block* block, Location location)
{
go_assert(!this->functions_.empty()
&& !this->functions_.back().blocks.empty());
@@ -924,7 +938,7 @@ Gogo::add_constant(const Typed_identifier& tid, Expression* expr,
// Add a type.
void
-Gogo::add_type(const std::string& name, Type* type, source_location location)
+Gogo::add_type(const std::string& name, Type* type, Location location)
{
Named_object* no = this->current_bindings()->add_type(name, NULL, type,
location);
@@ -944,7 +958,7 @@ Gogo::add_named_type(Named_type* type)
// Declare a type.
Named_object*
-Gogo::declare_type(const std::string& name, source_location location)
+Gogo::declare_type(const std::string& name, Location location)
{
Bindings* bindings = this->current_bindings();
Named_object* no = bindings->add_type_declaration(name, NULL, location);
@@ -959,7 +973,7 @@ Gogo::declare_type(const std::string& name, source_location location)
// Declare a type at the package level.
Named_object*
-Gogo::declare_package_type(const std::string& name, source_location location)
+Gogo::declare_package_type(const std::string& name, Location location)
{
return this->package_->bindings()->add_type_declaration(name, NULL, location);
}
@@ -1065,9 +1079,9 @@ Gogo::define_global_names()
{
error_at(no->location(), "expected type");
Type* errtype = Type::make_error_type();
- Named_object* err = Named_object::make_type("error", NULL,
- errtype,
- BUILTINS_LOCATION);
+ Named_object* err =
+ Named_object::make_type("erroneous_type", NULL, errtype,
+ Linemap::predeclared_location());
no->set_type_value(err->type_value());
}
}
@@ -1827,7 +1841,7 @@ Shortcuts::convert_shortcut(Block* enclosing, Expression** pshortcut)
Binary_expression* shortcut = (*pshortcut)->binary_expression();
Expression* left = shortcut->left();
Expression* right = shortcut->right();
- source_location loc = shortcut->location();
+ Location loc = shortcut->location();
Block* retblock = new Block(enclosing, loc);
retblock->set_end_location(loc);
@@ -2020,7 +2034,7 @@ Order_eval::statement(Block* block, size_t* pindex, Statement* s)
if (is_thunk && p + 1 == find_eval_ordering.end())
break;
- source_location loc = (*pexpr)->location();
+ Location loc = (*pexpr)->location();
Statement* s;
if ((*pexpr)->call_expression() == NULL
|| (*pexpr)->call_expression()->result_count() < 2)
@@ -2079,7 +2093,7 @@ Order_eval::variable(Named_object* no)
++p)
{
Expression** pexpr = *p;
- source_location loc = (*pexpr)->location();
+ Location loc = (*pexpr)->location();
Statement* s;
if ((*pexpr)->call_expression() == NULL
|| (*pexpr)->call_expression()->result_count() < 2)
@@ -2161,7 +2175,7 @@ class Build_recover_thunks : public Traverse
private:
Expression*
- can_recover_arg(source_location);
+ can_recover_arg(Location);
// General IR.
Gogo* gogo_;
@@ -2179,7 +2193,7 @@ Build_recover_thunks::function(Named_object* orig_no)
return TRAVERSE_CONTINUE;
Gogo* gogo = this->gogo_;
- source_location location = orig_func->location();
+ Location location = orig_func->location();
static int count;
char buf[50];
@@ -2377,12 +2391,12 @@ Build_recover_thunks::function(Named_object* orig_no)
// __go_can_recover(__builtin_return_address()).
Expression*
-Build_recover_thunks::can_recover_arg(source_location location)
+Build_recover_thunks::can_recover_arg(Location location)
{
static Named_object* builtin_return_address;
if (builtin_return_address == NULL)
{
- const source_location bloc = BUILTINS_LOCATION;
+ const Location bloc = Linemap::predeclared_location();
Typed_identifier_list* param_types = new Typed_identifier_list();
Type* uint_type = Type::lookup_integer_type("uint");
@@ -2404,7 +2418,7 @@ Build_recover_thunks::can_recover_arg(source_location location)
static Named_object* can_recover;
if (can_recover == NULL)
{
- const source_location bloc = BUILTINS_LOCATION;
+ const Location bloc = Linemap::predeclared_location();
Typed_identifier_list* param_types = new Typed_identifier_list();
Type* voidptr_type = Type::make_pointer_type(Type::make_void_type());
param_types->push_back(Typed_identifier("a", voidptr_type, bloc));
@@ -2736,7 +2750,7 @@ Gogo::convert_named_types_in_bindings(Bindings* bindings)
// Class Function.
Function::Function(Function_type* type, Function* enclosing, Block* block,
- source_location location)
+ Location location)
: type_(type), enclosing_(enclosing), results_(NULL),
closure_var_(NULL), block_(block), location_(location), fndecl_(NULL),
defer_stack_(NULL), results_are_named_(false), calls_recover_(false),
@@ -2817,7 +2831,7 @@ Function::closure_var()
{
// We don't know the type of the variable yet. We add fields as
// we find them.
- source_location loc = this->type_->location();
+ Location loc = this->type_->location();
Struct_field_list* sfl = new Struct_field_list;
Type* struct_type = Type::make_struct_type(sfl, loc);
Variable* var = new Variable(Type::make_pointer_type(struct_type),
@@ -2868,7 +2882,7 @@ Function::is_method() const
Label*
Function::add_label_definition(Gogo* gogo, const std::string& label_name,
- source_location location)
+ Location location)
{
Label* lnull = NULL;
std::pair<Labels::iterator, bool> ins =
@@ -2912,7 +2926,7 @@ Function::add_label_definition(Gogo* gogo, const std::string& label_name,
Label*
Function::add_label_reference(Gogo* gogo, const std::string& label_name,
- source_location location, bool issue_goto_errors)
+ Location location, bool issue_goto_errors)
{
Label* lnull = NULL;
std::pair<Labels::iterator, bool> ins =
@@ -3027,7 +3041,7 @@ Function::determine_types()
// function which uses defer.
Expression*
-Function::defer_stack(source_location location)
+Function::defer_stack(Location location)
{
if (this->defer_stack_ == NULL)
{
@@ -3206,7 +3220,7 @@ Function::import_func(Import* imp, std::string* pname,
// Class Block.
-Block::Block(Block* enclosing, source_location location)
+Block::Block(Block* enclosing, Location location)
: enclosing_(enclosing), statements_(),
bindings_(new Bindings(enclosing == NULL
? NULL
@@ -3451,7 +3465,7 @@ Block::get_backend(Translate_context* context)
// Class Bindings_snapshot.
-Bindings_snapshot::Bindings_snapshot(const Block* b, source_location location)
+Bindings_snapshot::Bindings_snapshot(const Block* b, Location location)
: block_(b), counts_(), location_(location)
{
while (b != NULL)
@@ -3464,7 +3478,7 @@ Bindings_snapshot::Bindings_snapshot(const Block* b, source_location location)
// Report errors appropriate for a goto from B to this.
void
-Bindings_snapshot::check_goto_from(const Block* b, source_location loc)
+Bindings_snapshot::check_goto_from(const Block* b, Location loc)
{
size_t dummy;
if (!this->check_goto_block(loc, b, this->block_, &dummy))
@@ -3492,7 +3506,7 @@ Bindings_snapshot::check_goto_to(const Block* b)
// BFROM.
bool
-Bindings_snapshot::check_goto_block(source_location loc, const Block* bfrom,
+Bindings_snapshot::check_goto_block(Location loc, const Block* bfrom,
const Block* bto, size_t* pindex)
{
// It is an error if BTO is not either BFROM or above BFROM.
@@ -3515,7 +3529,7 @@ Bindings_snapshot::check_goto_block(source_location loc, const Block* bfrom,
// CTO is the number of names defined at the point of the label.
void
-Bindings_snapshot::check_goto_defs(source_location loc, const Block* block,
+Bindings_snapshot::check_goto_defs(Location loc, const Block* block,
size_t cfrom, size_t cto)
{
if (cfrom < cto)
@@ -3539,7 +3553,7 @@ Bindings_snapshot::check_goto_defs(source_location loc, const Block* block,
Variable::Variable(Type* type, Expression* init, bool is_global,
bool is_parameter, bool is_receiver,
- source_location location)
+ Location location)
: type_(type), init_(init), preinit_(NULL), location_(location),
backend_(NULL), is_global_(is_global), is_parameter_(is_parameter),
is_receiver_(is_receiver), is_varargs_parameter_(false),
@@ -4086,7 +4100,7 @@ Type_declaration::add_method(const std::string& name, Function* function)
Named_object*
Type_declaration::add_method_declaration(const std::string& name,
Function_type* type,
- source_location location)
+ Location location)
{
Named_object* ret = Named_object::make_function_declaration(name, NULL, type,
location);
@@ -4153,7 +4167,7 @@ Named_object::Named_object(const std::string& name,
Named_object*
Named_object::make_unknown_name(const std::string& name,
- source_location location)
+ Location location)
{
Named_object* named_object = new Named_object(name, NULL,
NAMED_OBJECT_UNKNOWN);
@@ -4182,7 +4196,7 @@ Named_object::make_constant(const Typed_identifier& tid,
Named_object*
Named_object::make_type(const std::string& name, const Package* package,
- Type* type, source_location location)
+ Type* type, Location location)
{
Named_object* named_object = new Named_object(name, package,
NAMED_OBJECT_TYPE);
@@ -4196,7 +4210,7 @@ Named_object::make_type(const std::string& name, const Package* package,
Named_object*
Named_object::make_type_declaration(const std::string& name,
const Package* package,
- source_location location)
+ Location location)
{
Named_object* named_object = new Named_object(name, package,
NAMED_OBJECT_TYPE_DECLARATION);
@@ -4255,7 +4269,7 @@ Named_object*
Named_object::make_function_declaration(const std::string& name,
const Package* package,
Function_type* fntype,
- source_location location)
+ Location location)
{
Named_object* named_object = new Named_object(name, package,
NAMED_OBJECT_FUNC_DECLARATION);
@@ -4329,7 +4343,7 @@ Named_object::declare_as_type()
// Return the location of a named object.
-source_location
+Location
Named_object::location() const
{
switch (this->classification_)
@@ -4705,7 +4719,7 @@ Named_object*
Bindings::add_function_declaration(const std::string& name,
const Package* package,
Function_type* type,
- source_location location)
+ Location location)
{
Named_object* no = Named_object::make_function_declaration(name, package,
type, location);
@@ -4857,7 +4871,7 @@ Label::get_backend_label(Translate_context* context)
// Return an expression for the address of this label.
Bexpression*
-Label::get_addr(Translate_context* context, source_location location)
+Label::get_addr(Translate_context* context, Location location)
{
Blabel* label = this->get_backend_label(context);
return context->backend()->label_address(label, location);
@@ -4893,7 +4907,7 @@ Unnamed_label::get_definition(Translate_context* context)
// Return a goto statement to this unnamed label.
Bstatement*
-Unnamed_label::get_goto(Translate_context* context, source_location location)
+Unnamed_label::get_goto(Translate_context* context, Location location)
{
Blabel* blabel = this->get_blabel(context);
return context->backend()->goto_statement(blabel, location);
@@ -4902,7 +4916,7 @@ Unnamed_label::get_goto(Translate_context* context, source_location location)
// Class Package.
Package::Package(const std::string& name, const std::string& unique_prefix,
- source_location location)
+ Location location)
: name_(name), unique_prefix_(unique_prefix), bindings_(new Bindings(NULL)),
priority_(0), location_(location), used_(false), is_imported_(false),
uses_sink_alias_(false)
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 91e814c31d8..9d3b37ae857 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -7,6 +7,8 @@
#ifndef GO_GOGO_H
#define GO_GOGO_H
+#include "go-linemap.h"
+
class Traverse;
class Statement_inserter;
class Type;
@@ -111,20 +113,25 @@ class Gogo
public:
// Create the IR, passing in the sizes of the types "int" and
// "uintptr" in bits.
- Gogo(Backend* backend, int int_type_size, int pointer_size);
+ Gogo(Backend* backend, Linemap *linemap, int int_type_size, int pointer_size);
// Get the backend generator.
Backend*
backend()
{ return this->backend_; }
+ // Get the Location generator.
+ Linemap*
+ linemap()
+ { return this->linemap_; }
+
// Get the package name.
const std::string&
package_name() const;
// Set the package name.
void
- set_package_name(const std::string&, source_location);
+ set_package_name(const std::string&, Location);
// Return whether this is the "main" package.
bool
@@ -195,7 +202,7 @@ class Gogo
// the declarations are added to the global scope.
void
import_package(const std::string& filename, const std::string& local_name,
- bool is_local_name_exported, source_location);
+ bool is_local_name_exported, Location);
// Whether we are the global binding level.
bool
@@ -223,7 +230,7 @@ class Gogo
add_imported_package(const std::string& real_name, const std::string& alias,
bool is_alias_exported,
const std::string& unique_prefix,
- source_location location,
+ Location location,
bool* padd_to_globals);
// Register a package. This package may or may not be imported.
@@ -231,17 +238,17 @@ class Gogo
// it necessary.
Package*
register_package(const std::string& name, const std::string& unique_prefix,
- source_location);
+ Location);
// Start compiling a function. ADD_METHOD_TO_TYPE is true if a
// method function should be added to the type of its receiver.
Named_object*
start_function(const std::string& name, Function_type* type,
- bool add_method_to_type, source_location);
+ bool add_method_to_type, Location);
// Finish compiling a function.
void
- finish_function(source_location);
+ finish_function(Location);
// Return the current function.
Named_object*
@@ -254,36 +261,36 @@ class Gogo
// Start a new block. This is not initially associated with a
// function.
void
- start_block(source_location);
+ start_block(Location);
// Finish the current block and return it.
Block*
- finish_block(source_location);
+ finish_block(Location);
// Declare an unknown name. This is used while parsing. The name
// must be resolved by the end of the parse. Unknown names are
// always added at the package level.
Named_object*
- add_unknown_name(const std::string& name, source_location);
+ add_unknown_name(const std::string& name, Location);
// Declare a function.
Named_object*
- declare_function(const std::string&, Function_type*, source_location);
+ declare_function(const std::string&, Function_type*, Location);
// Add a label.
Label*
- add_label_definition(const std::string&, source_location);
+ add_label_definition(const std::string&, Location);
// Add a label reference. ISSUE_GOTO_ERRORS is true if we should
// report errors for a goto from the current location to the label
// location.
Label*
- add_label_reference(const std::string&, source_location,
+ add_label_reference(const std::string&, Location,
bool issue_goto_errors);
// Return a snapshot of the current binding state.
Bindings_snapshot*
- bindings_snapshot(source_location);
+ bindings_snapshot(Location);
// Add a statement to the current block.
void
@@ -291,7 +298,7 @@ class Gogo
// Add a block to the current block.
void
- add_block(Block*, source_location);
+ add_block(Block*, Location);
// Add a constant.
Named_object*
@@ -299,7 +306,7 @@ class Gogo
// Add a type.
void
- add_type(const std::string&, Type*, source_location);
+ add_type(const std::string&, Type*, Location);
// Add a named type. This is used for builtin types, and to add an
// imported type to the global scope.
@@ -308,12 +315,12 @@ class Gogo
// Declare a type.
Named_object*
- declare_type(const std::string&, source_location);
+ declare_type(const std::string&, Location);
// Declare a type at the package level. This is used when the
// parser sees an unknown name where a type name is required.
Named_object*
- declare_package_type(const std::string&, source_location);
+ declare_package_type(const std::string&, Location);
// Define a type which was already declared.
void
@@ -466,12 +473,12 @@ class Gogo
// RETTYPE is the return type. It is followed by NARGS pairs of
// type and argument (both trees).
static tree
- call_builtin(tree* pdecl, source_location, const char* name, int nargs,
+ call_builtin(tree* pdecl, Location, const char* name, int nargs,
tree rettype, ...);
// Build a call to the runtime error function.
static tree
- runtime_error(int code, source_location);
+ runtime_error(int code, Location);
// Build a builtin struct with a list of fields.
static tree
@@ -503,7 +510,7 @@ class Gogo
// Return a tree which allocate SIZE bytes to hold values of type
// TYPE.
tree
- allocate_memory(Type *type, tree size, source_location);
+ allocate_memory(Type *type, tree size, Location);
// Return a type to use for pointer to const char.
static tree
@@ -521,7 +528,7 @@ class Gogo
// Receive a value from a channel.
static tree
receive_from_channel(tree type_tree, tree channel, bool for_select,
- source_location);
+ Location);
// Return a tree for receiving an integer on a channel.
static tree
@@ -530,7 +537,7 @@ class Gogo
// Make a trampoline which calls FNADDR passing CLOSURE.
tree
- make_trampoline(tree fnaddr, tree closure, source_location);
+ make_trampoline(tree fnaddr, tree closure, Location);
private:
// During parsing, we keep a stack of functions. Each function on
@@ -549,12 +556,12 @@ class Gogo
// Set up the built-in unsafe package.
void
- import_unsafe(const std::string&, bool is_exported, source_location);
+ import_unsafe(const std::string&, bool is_exported, Location);
// Add a new imported package.
Named_object*
add_package(const std::string& real_name, const std::string& alias,
- const std::string& unique_prefix, source_location location);
+ const std::string& unique_prefix, Location location);
// Return the current binding contour.
Bindings*
@@ -603,6 +610,8 @@ class Gogo
// The backend generator.
Backend* backend_;
+ // The object used to keep track of file names and line numbers.
+ Linemap* linemap_;
// The package we are compiling.
Package* package_;
// The list of currently open functions during parsing.
@@ -640,7 +649,7 @@ class Gogo
class Block
{
public:
- Block(Block* enclosing, source_location);
+ Block(Block* enclosing, Location);
// Return the enclosing block.
const Block*
@@ -663,13 +672,13 @@ class Block
// Return the start location. This is normally the location of the
// left curly brace which starts the block.
- source_location
+ Location
start_location() const
{ return this->start_location_; }
// Return the end location. This is normally the location of the
// right curly brace which ends the block.
- source_location
+ Location
end_location() const
{ return this->end_location_; }
@@ -695,7 +704,7 @@ class Block
// Set the end location of the block.
void
- set_end_location(source_location location)
+ set_end_location(Location location)
{ this->end_location_ = location; }
// Traverse the tree.
@@ -735,9 +744,9 @@ class Block
// Binding contour.
Bindings* bindings_;
// Location of start of block.
- source_location start_location_;
+ Location start_location_;
// Location of end of block.
- source_location end_location_;
+ Location end_location_;
};
// A function.
@@ -745,7 +754,7 @@ class Block
class Function
{
public:
- Function(Function_type* type, Function*, Block*, source_location);
+ Function(Function_type* type, Function*, Block*, Location);
// Return the function's type.
Function_type*
@@ -790,7 +799,7 @@ class Function
// Add a new field to the closure variable.
void
- add_closure_field(Named_object* var, source_location loc)
+ add_closure_field(Named_object* var, Location loc)
{ this->closure_fields_.push_back(std::make_pair(var, loc)); }
// Whether this function needs a closure.
@@ -831,7 +840,7 @@ class Function
{ return this->block_; }
// Get the location of the start of the function.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -841,14 +850,14 @@ class Function
// Add a label definition to the function.
Label*
- add_label_definition(Gogo*, const std::string& label_name, source_location);
+ add_label_definition(Gogo*, const std::string& label_name, Location);
// Add a label reference to a function. ISSUE_GOTO_ERRORS is true
// if we should report errors for a goto from the current location
// to the label location.
Label*
add_label_reference(Gogo*, const std::string& label_name,
- source_location, bool issue_goto_errors);
+ Location, bool issue_goto_errors);
// Warn about labels that are defined but not used.
void
@@ -918,11 +927,11 @@ class Function
// Get the value to return when not explicitly specified. May also
// add statements to execute first to STMT_LIST.
tree
- return_value(Gogo*, Named_object*, source_location, tree* stmt_list) const;
+ return_value(Gogo*, Named_object*, Location, tree* stmt_list) const;
// Get a tree for the variable holding the defer stack.
Expression*
- defer_stack(source_location);
+ defer_stack(Location);
// Export the function.
void
@@ -953,7 +962,7 @@ class Function
build_defer_wrapper(Gogo*, Named_object*, tree*, tree*);
typedef std::vector<std::pair<Named_object*,
- source_location> > Closure_fields;
+ Location> > Closure_fields;
// The function's type.
Function_type* type_;
@@ -972,7 +981,7 @@ class Function
// The outer block of statements in the function.
Block* block_;
// The source location of the start of the function.
- source_location location_;
+ Location location_;
// Labels defined or referenced in the function.
Labels labels_;
// The function decl.
@@ -996,12 +1005,12 @@ class Function
class Bindings_snapshot
{
public:
- Bindings_snapshot(const Block*, source_location);
+ Bindings_snapshot(const Block*, Location);
// Report any errors appropriate for a goto from the current binding
// state of B to this one.
void
- check_goto_from(const Block* b, source_location);
+ check_goto_from(const Block* b, Location);
// Report any errors appropriate for a goto from this binding state
// to the current state of B.
@@ -1010,10 +1019,10 @@ class Bindings_snapshot
private:
bool
- check_goto_block(source_location, const Block*, const Block*, size_t*);
+ check_goto_block(Location, const Block*, const Block*, size_t*);
void
- check_goto_defs(source_location, const Block*, size_t, size_t);
+ check_goto_defs(Location, const Block*, size_t, size_t);
// The current block.
const Block* block_;
@@ -1022,7 +1031,7 @@ class Bindings_snapshot
// this->block_->enclosing(), etc.
std::vector<size_t> counts_;
// The location where this snapshot was taken.
- source_location location_;
+ Location location_;
};
// A function declaration.
@@ -1030,7 +1039,7 @@ class Bindings_snapshot
class Function_declaration
{
public:
- Function_declaration(Function_type* fntype, source_location location)
+ Function_declaration(Function_type* fntype, Location location)
: fntype_(fntype), location_(location), asm_name_(), fndecl_(NULL)
{ }
@@ -1038,7 +1047,7 @@ class Function_declaration
type() const
{ return this->fntype_; }
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1064,7 +1073,7 @@ class Function_declaration
// The type of the function.
Function_type* fntype_;
// The location of the declaration.
- source_location location_;
+ Location location_;
// The assembler name: this is the name to use in references to the
// function. This is normally empty.
std::string asm_name_;
@@ -1078,7 +1087,7 @@ class Variable
{
public:
Variable(Type*, Expression*, bool is_global, bool is_parameter,
- bool is_receiver, source_location);
+ bool is_receiver, Location);
// Get the type of the variable.
Type*
@@ -1172,7 +1181,7 @@ class Variable
{ this->is_non_escaping_address_taken_ = true; }
// Get the source location of the variable's declaration.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1309,7 +1318,7 @@ class Variable
// Statements to run before the init statement.
Block* preinit_;
// Location of variable definition.
- source_location location_;
+ Location location_;
// Backend representation.
Bvariable* backend_;
// Whether this is a global variable.
@@ -1352,7 +1361,7 @@ class Result_variable
{
public:
Result_variable(Type* type, Function* function, int index,
- source_location location)
+ Location location)
: type_(type), function_(function), index_(index), location_(location),
backend_(NULL), is_address_taken_(false),
is_non_escaping_address_taken_(false)
@@ -1374,7 +1383,7 @@ class Result_variable
{ return this->index_; }
// The location of the variable definition.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1422,7 +1431,7 @@ class Result_variable
// Index in list of results.
int index_;
// Where the result variable is defined.
- source_location location_;
+ Location location_;
// Backend representation.
Bvariable* backend_;
// Whether something takes the address of this variable.
@@ -1439,7 +1448,7 @@ class Named_constant
{
public:
Named_constant(Type* type, Expression* expr, int iota_value,
- source_location location)
+ Location location)
: type_(type), expr_(expr), iota_value_(iota_value), location_(location),
lowering_(false)
{ }
@@ -1456,7 +1465,7 @@ class Named_constant
iota_value() const
{ return this->iota_value_; }
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1507,7 +1516,7 @@ class Named_constant
// we lower.
int iota_value_;
// The location of the definition.
- source_location location_;
+ Location location_;
// Whether we are currently lowering this constant.
bool lowering_;
};
@@ -1517,13 +1526,13 @@ class Named_constant
class Type_declaration
{
public:
- Type_declaration(source_location location)
+ Type_declaration(Location location)
: location_(location), in_function_(NULL), methods_(),
issued_warning_(false)
{ }
// Return the location.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1546,7 +1555,7 @@ class Type_declaration
// Add a method declaration to this type.
Named_object*
add_method_declaration(const std::string& name, Function_type* type,
- source_location location);
+ Location location);
// Return whether any methods were defined.
bool
@@ -1565,7 +1574,7 @@ class Type_declaration
typedef std::vector<Named_object*> Methods;
// The location of the type declaration.
- source_location location_;
+ Location location_;
// If this type is declared in a function, a pointer back to the
// function in which it is defined.
Named_object* in_function_;
@@ -1585,12 +1594,12 @@ class Type_declaration
class Unknown_name
{
public:
- Unknown_name(source_location location)
+ Unknown_name(Location location)
: location_(location), real_named_object_(NULL)
{ }
// Return the location where this name was first seen.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1606,7 +1615,7 @@ class Unknown_name
private:
// The location where this name was first seen.
- source_location location_;
+ Location location_;
// The real named object when it is known.
Named_object*
real_named_object_;
@@ -1697,17 +1706,17 @@ class Named_object
// Creators.
static Named_object*
- make_unknown_name(const std::string& name, source_location);
+ make_unknown_name(const std::string& name, Location);
static Named_object*
make_constant(const Typed_identifier&, const Package*, Expression*,
int iota_value);
static Named_object*
- make_type(const std::string&, const Package*, Type*, source_location);
+ make_type(const std::string&, const Package*, Type*, Location);
static Named_object*
- make_type_declaration(const std::string&, const Package*, source_location);
+ make_type_declaration(const std::string&, const Package*, Location);
static Named_object*
make_variable(const std::string&, const Package*, Variable*);
@@ -1723,7 +1732,7 @@ class Named_object
static Named_object*
make_function_declaration(const std::string&, const Package*, Function_type*,
- source_location);
+ Location);
static Named_object*
make_package(const std::string& alias, Package* package);
@@ -1899,7 +1908,7 @@ class Named_object
}
// The location where this object was defined or referenced.
- source_location
+ Location
location() const;
// Convert a variable to the backend representation.
@@ -1969,7 +1978,7 @@ class Bindings
// Add an unknown name.
Named_object*
- add_unknown_name(const std::string& name, source_location location)
+ add_unknown_name(const std::string& name, Location location)
{
return this->add_named_object(Named_object::make_unknown_name(name,
location));
@@ -1988,7 +1997,7 @@ class Bindings
// Add a type.
Named_object*
add_type(const std::string& name, const Package* package, Type* type,
- source_location location)
+ Location location)
{
return this->add_named_object(Named_object::make_type(name, package, type,
location));
@@ -2002,7 +2011,7 @@ class Bindings
// Add a type declaration.
Named_object*
add_type_declaration(const std::string& name, const Package* package,
- source_location location)
+ Location location)
{
Named_object* no = Named_object::make_type_declaration(name, package,
location);
@@ -2033,7 +2042,7 @@ class Bindings
// Add a function declaration.
Named_object*
add_function_declaration(const std::string& name, const Package* package,
- Function_type* type, source_location location);
+ Function_type* type, Location location);
// Add a package. The location is the location of the import
// statement.
@@ -2153,8 +2162,8 @@ class Label
{
public:
Label(const std::string& name)
- : name_(name), location_(0), snapshot_(NULL), refs_(), is_used_(false),
- blabel_(NULL)
+ : name_(name), location_(Linemap::unknown_location()), snapshot_(NULL),
+ refs_(), is_used_(false), blabel_(NULL)
{ }
// Return the label's name.
@@ -2165,7 +2174,7 @@ class Label
// Return whether the label has been defined.
bool
is_defined() const
- { return this->location_ != 0; }
+ { return !Linemap::is_unknown_location(this->location_); }
// Return whether the label has been used.
bool
@@ -2178,7 +2187,7 @@ class Label
{ this->is_used_ = true; }
// Return the location of the definition.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -2191,7 +2200,7 @@ class Label
void
add_snapshot_ref(Bindings_snapshot* snapshot)
{
- go_assert(this->location_ == 0);
+ go_assert(Linemap::is_unknown_location(this->location_));
this->refs_.push_back(snapshot);
}
@@ -2207,9 +2216,10 @@ class Label
// Define the label at LOCATION with the given bindings snapshot.
void
- define(source_location location, Bindings_snapshot* snapshot)
+ define(Location location, Bindings_snapshot* snapshot)
{
- go_assert(this->location_ == 0 && this->snapshot_ == NULL);
+ go_assert(Linemap::is_unknown_location(this->location_)
+ && this->snapshot_ == NULL);
this->location_ = location;
this->snapshot_ = snapshot;
}
@@ -2222,14 +2232,14 @@ class Label
// to get the return address of a deferred function to see whether
// the function may call recover.
Bexpression*
- get_addr(Translate_context*, source_location location);
+ get_addr(Translate_context*, Location location);
private:
// The name of the label.
std::string name_;
// The location of the definition. This is 0 if the label has not
// yet been defined.
- source_location location_;
+ Location location_;
// A snapshot of the set of bindings defined at this label, used to
// issue errors about invalid goto statements.
Bindings_snapshot* snapshot_;
@@ -2246,18 +2256,18 @@ class Label
class Unnamed_label
{
public:
- Unnamed_label(source_location location)
+ Unnamed_label(Location location)
: location_(location), blabel_(NULL)
{ }
// Get the location where the label is defined.
- source_location
+ Location
location() const
{ return this->location_; }
// Set the location where the label is defined.
void
- set_location(source_location location)
+ set_location(Location location)
{ this->location_ = location; }
// Return a statement which defines this label.
@@ -2266,7 +2276,7 @@ class Unnamed_label
// Return a goto to this label from LOCATION.
Bstatement*
- get_goto(Translate_context*, source_location location);
+ get_goto(Translate_context*, Location location);
private:
// Return the backend representation.
@@ -2274,7 +2284,7 @@ class Unnamed_label
get_blabel(Translate_context*);
// The location where the label is defined.
- source_location location_;
+ Location location_;
// The backend representation of this label.
Blabel* blabel_;
};
@@ -2285,7 +2295,7 @@ class Package
{
public:
Package(const std::string& name, const std::string& unique_prefix,
- source_location location);
+ Location location);
// The real name of this package. This may be different from the
// name in the associated Named_object if the import statement used
@@ -2295,7 +2305,7 @@ class Package
{ return this->name_; }
// Return the location of the import statement.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -2378,7 +2388,7 @@ class Package
// Set the location of the package. This is used if it is seen in a
// different import before it is really imported.
void
- set_location(source_location location)
+ set_location(Location location)
{ this->location_ = location; }
// Add a constant to the package.
@@ -2388,12 +2398,12 @@ class Package
// Add a type to the package.
Named_object*
- add_type(const std::string& name, Type* type, source_location location)
+ add_type(const std::string& name, Type* type, Location location)
{ return this->bindings_->add_type(name, this, type, location); }
// Add a type declaration to the package.
Named_object*
- add_type_declaration(const std::string& name, source_location location)
+ add_type_declaration(const std::string& name, Location location)
{ return this->bindings_->add_type_declaration(name, this, location); }
// Add a variable to the package.
@@ -2404,7 +2414,7 @@ class Package
// Add a function declaration to the package.
Named_object*
add_function_declaration(const std::string& name, Function_type* type,
- source_location loc)
+ Location loc)
{ return this->bindings_->add_function_declaration(name, this, type, loc); }
// Determine types of constants.
@@ -2423,7 +2433,7 @@ class Package
// is used to run init functions in the right order.
int priority_;
// The location of the import statement.
- source_location location_;
+ Location location_;
// True if some name from this package was used. This is mutable
// because we can use a package even if we have a const pointer to
// it.
diff --git a/gcc/go/gofrontend/import-archive.cc b/gcc/go/gofrontend/import-archive.cc
index 07ac01a44ba..032c6a0c1b5 100644
--- a/gcc/go/gofrontend/import-archive.cc
+++ b/gcc/go/gofrontend/import-archive.cc
@@ -66,7 +66,7 @@ Import::is_archive_magic(const char* bytes)
class Archive_file
{
public:
- Archive_file(const std::string& filename, int fd, source_location location)
+ Archive_file(const std::string& filename, int fd, Location location)
: filename_(filename), fd_(fd), filesize_(-1), extended_names_(),
is_thin_archive_(false), location_(location), nested_archives_()
{ }
@@ -91,7 +91,7 @@ class Archive_file
{ return this->is_thin_archive_; }
// Return the location of the import statement.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -133,7 +133,7 @@ class Archive_file
// Whether this is a thin archive.
bool is_thin_archive_;
// The location of the import statements.
- source_location location_;
+ Location location_;
// Table of nested archives.
Nested_archive_table nested_archives_;
};
@@ -613,7 +613,7 @@ Stream_concatenate::do_advance(size_t skip)
Import::Stream*
Import::find_archive_export_data(const std::string& filename, int fd,
- source_location location)
+ Location location)
{
Archive_file afile(filename, fd, location);
if (!afile.initialize())
diff --git a/gcc/go/gofrontend/import.cc b/gcc/go/gofrontend/import.cc
index 4aca1a3f9cb..d3405c191c9 100644
--- a/gcc/go/gofrontend/import.cc
+++ b/gcc/go/gofrontend/import.cc
@@ -59,7 +59,7 @@ const char* const Import::import_marker = "*imported*";
// later in the search path.
Import::Stream*
-Import::open_package(const std::string& filename, source_location location)
+Import::open_package(const std::string& filename, Location location)
{
if (!IS_ABSOLUTE_PATH(filename))
{
@@ -88,7 +88,7 @@ Import::open_package(const std::string& filename, source_location location)
Import::Stream*
Import::try_package_in_directory(const std::string& filename,
- source_location location)
+ Location location)
{
std::string found_filename = filename;
int fd = open(found_filename.c_str(), O_RDONLY | O_BINARY);
@@ -175,7 +175,7 @@ Import::try_suffixes(std::string* pfilename)
Import::Stream*
Import::find_export_data(const std::string& filename, int fd,
- source_location location)
+ Location location)
{
// See if we can read this as an object file.
Import::Stream* stream = Import::find_object_export_data(filename, fd, 0,
@@ -213,7 +213,7 @@ Import::Stream*
Import::find_object_export_data(const std::string& filename,
int fd,
off_t offset,
- source_location location)
+ Location location)
{
const char* errmsg;
int err;
@@ -262,7 +262,7 @@ Import::find_object_export_data(const std::string& filename,
// Construct an Import object. We make the builtin_types_ vector
// large enough to hold all the builtin types.
-Import::Import(Stream* stream, source_location location)
+Import::Import(Stream* stream, Location location)
: gogo_(NULL), stream_(stream), location_(location), package_(NULL),
add_to_globals_(false),
builtin_types_((- SMALLEST_BUILTIN_CODE) + 1),
@@ -448,7 +448,7 @@ Import::import_func(Package* package)
if (is_varargs)
fntype->set_is_varargs();
- source_location loc = this->location_;
+ Location loc = this->location_;
Named_object* no;
if (fntype->is_method())
{
@@ -603,7 +603,7 @@ Import::read_type()
package = this->package_;
else
package = this->gogo_->register_package(package_name, unique_prefix,
- UNKNOWN_LOCATION);
+ Linemap::unknown_location());
Named_object* no = package->bindings()->lookup(type_name);
if (no == NULL)
@@ -798,7 +798,7 @@ Import::Stream::match_bytes(const char* bytes, size_t length)
// Require that the next LENGTH bytes from the stream match BYTES.
void
-Import::Stream::require_bytes(source_location location, const char* bytes,
+Import::Stream::require_bytes(Location location, const char* bytes,
size_t length)
{
const char* read;
diff --git a/gcc/go/gofrontend/import.h b/gcc/go/gofrontend/import.h
index 0101a40c963..f5b4b3d2be3 100644
--- a/gcc/go/gofrontend/import.h
+++ b/gcc/go/gofrontend/import.h
@@ -8,6 +8,7 @@
#define GO_IMPORT_H
#include "export.h"
+#include "go-linemap.h"
class Gogo;
class Package;
@@ -78,13 +79,13 @@ class Import
// Give an error if the next bytes do not match STR. Advance the
// read position by the length of STR.
void
- require_c_string(source_location location, const char* str)
+ require_c_string(Location location, const char* str)
{ this->require_bytes(location, str, strlen(str)); }
// Given an error if the next LENGTH bytes do not match BYTES.
// Advance the read position by LENGTH.
void
- require_bytes(source_location, const char* bytes, size_t length);
+ require_bytes(Location, const char* bytes, size_t length);
// Advance the read position by SKIP bytes.
void
@@ -124,10 +125,10 @@ class Import
// returns a pointer to a Stream object to read the data that it
// exports. LOCATION is the location of the import statement.
static Stream*
- open_package(const std::string& filename, source_location location);
+ open_package(const std::string& filename, Location location);
// Constructor.
- Import(Stream*, source_location);
+ Import(Stream*, Location);
// Register the builtin types.
void
@@ -142,7 +143,7 @@ class Import
import(Gogo*, const std::string& local_name, bool is_local_name_exported);
// The location of the import statement.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -190,17 +191,17 @@ class Import
private:
static Stream*
- try_package_in_directory(const std::string&, source_location);
+ try_package_in_directory(const std::string&, Location);
static int
try_suffixes(std::string*);
static Stream*
- find_export_data(const std::string& filename, int fd, source_location);
+ find_export_data(const std::string& filename, int fd, Location);
static Stream*
find_object_export_data(const std::string& filename, int fd,
- off_t offset, source_location);
+ off_t offset, Location);
static const int archive_magic_len = 8;
@@ -209,7 +210,7 @@ class Import
static Stream*
find_archive_export_data(const std::string& filename, int fd,
- source_location);
+ Location);
// Read the import control functions.
void
@@ -244,7 +245,7 @@ class Import
// The stream from which to read import data.
Stream* stream_;
// The location of the import statement we are processing.
- source_location location_;
+ Location location_;
// The package we are importing.
Package* package_;
// Whether to add new objects to the global scope, rather than to a
diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc
index 167c7ddffc0..effa0871699 100644
--- a/gcc/go/gofrontend/lex.cc
+++ b/gcc/go/gofrontend/lex.cc
@@ -146,7 +146,7 @@ static Keywords keywords;
// Make a general token.
-Token::Token(Classification classification, source_location location)
+Token::Token(Classification classification, Location location)
: classification_(classification), location_(location)
{
}
@@ -432,19 +432,18 @@ Token::print(FILE* file) const
// Class Lex.
-Lex::Lex(const char* input_file_name, FILE* input_file)
+Lex::Lex(const char* input_file_name, FILE* input_file, Linemap* linemap)
: input_file_name_(input_file_name), input_file_(input_file),
- linebuf_(NULL), linebufsize_(120), linesize_(0), lineoff_(0),
- lineno_(0), add_semi_at_eol_(false)
+ linemap_(linemap), linebuf_(NULL), linebufsize_(120), linesize_(0),
+ lineoff_(0), lineno_(0), add_semi_at_eol_(false)
{
this->linebuf_ = new char[this->linebufsize_];
- linemap_add(line_table, LC_ENTER, 0, input_file_name, 1);
+ this->linemap_->start_file(input_file_name, 0);
}
Lex::~Lex()
{
delete[] this->linebuf_;
- linemap_add(line_table, LC_LEAVE, 0, NULL, 0);
}
// Read a new line from the file.
@@ -508,26 +507,26 @@ Lex::require_line()
this->linesize_= got;
this->lineoff_ = 0;
- linemap_line_start(line_table, this->lineno_, this->linesize_);
+ this->linemap_->start_line(this->lineno_, this->linesize_);
return true;
}
// Get the current location.
-source_location
+Location
Lex::location() const
{
- return linemap_position_for_column (line_table, this->lineoff_ + 1);
+ return this->linemap_->get_location(this->lineoff_ + 1);
}
// Get a location slightly before the current one. This is used for
// slightly more efficient handling of operator tokens.
-source_location
+Location
Lex::earlier_location(int chars) const
{
- return linemap_position_for_column (line_table, this->lineoff_ + 1 - chars);
+ return this->linemap_->get_location(this->lineoff_ + 1 - chars);
}
// Get the next token.
@@ -586,7 +585,7 @@ Lex::next_token()
else if (p[1] == '*')
{
this->lineoff_ = p - this->linebuf_;
- source_location location = this->location();
+ Location location = this->location();
if (!this->skip_c_comment())
return Token::make_invalid_token(location);
p = this->linebuf_ + this->lineoff_;
@@ -889,7 +888,7 @@ Lex::gather_identifier()
buf.append(ubuf);
}
}
- source_location location = this->location();
+ Location location = this->location();
this->add_semi_at_eol_ = true;
this->lineoff_ = p - this->linebuf_;
if (has_non_ascii_char)
@@ -956,7 +955,7 @@ Lex::gather_number()
const char* p = pstart;
const char* pend = this->linebuf_ + this->linesize_;
- source_location location = this->location();
+ Location location = this->location();
bool neg = false;
if (*p == '+')
@@ -1253,7 +1252,7 @@ Lex::advance_one_char(const char* p, bool is_single_quote, unsigned int* value,
void
Lex::append_char(unsigned int v, bool is_character, std::string* str,
- source_location location)
+ Location location)
{
char buf[4];
size_t len;
@@ -1319,7 +1318,7 @@ Lex::gather_character()
mpz_t val;
mpz_init_set_ui(val, value);
- source_location location = this->location();
+ Location location = this->location();
this->lineoff_ = p + 1 - this->linebuf_;
Token ret = Token::make_integer_token(val, location);
mpz_clear(val);
@@ -1338,7 +1337,7 @@ Lex::gather_string()
std::string value;
while (*p != '"')
{
- source_location loc = this->location();
+ Location loc = this->location();
unsigned int c;
bool is_character;
this->lineoff_ = p - this->linebuf_;
@@ -1352,7 +1351,7 @@ Lex::gather_string()
Lex::append_char(c, is_character, &value, loc);
}
- source_location location = this->location();
+ Location location = this->location();
this->lineoff_ = p + 1 - this->linebuf_;
return Token::make_string_token(value, location);
}
@@ -1364,7 +1363,7 @@ Lex::gather_raw_string()
{
const char* p = this->linebuf_ + this->lineoff_ + 1;
const char* pend = this->linebuf_ + this->linesize_;
- source_location location = this->location();
+ Location location = this->location();
std::string value;
while (true)
@@ -1376,7 +1375,7 @@ Lex::gather_raw_string()
this->lineoff_ = p + 1 - this->linebuf_;
return Token::make_string_token(value, location);
}
- source_location loc = this->location();
+ Location loc = this->location();
unsigned int c;
bool issued_error;
this->lineoff_ = p - this->linebuf_;
@@ -1630,8 +1629,7 @@ Lex::skip_cpp_comment()
memcpy(file, p, filelen);
file[filelen] = '\0';
- linemap_add(line_table, LC_LEAVE, 0, NULL, 0);
- linemap_add(line_table, LC_ENTER, 0, file, lineno);
+ this->linemap_->start_file(file, lineno);
this->lineno_ = lineno - 1;
p = plend;
diff --git a/gcc/go/gofrontend/lex.h b/gcc/go/gofrontend/lex.h
index bda07f1f8b0..6341e1e34e1 100644
--- a/gcc/go/gofrontend/lex.h
+++ b/gcc/go/gofrontend/lex.h
@@ -11,6 +11,7 @@
#include <mpfr.h>
#include "operator.h"
+#include "go-linemap.h"
struct Unicode_range;
@@ -88,17 +89,17 @@ class Token
// Make a token for an invalid value.
static Token
- make_invalid_token(source_location location)
+ make_invalid_token(Location location)
{ return Token(TOKEN_INVALID, location); }
// Make a token representing end of file.
static Token
- make_eof_token(source_location location)
+ make_eof_token(Location location)
{ return Token(TOKEN_EOF, location); }
// Make a keyword token.
static Token
- make_keyword_token(Keyword keyword, source_location location)
+ make_keyword_token(Keyword keyword, Location location)
{
Token tok(TOKEN_KEYWORD, location);
tok.u_.keyword = keyword;
@@ -108,7 +109,7 @@ class Token
// Make an identifier token.
static Token
make_identifier_token(const std::string& value, bool is_exported,
- source_location location)
+ Location location)
{
Token tok(TOKEN_IDENTIFIER, location);
tok.u_.identifier_value.name = new std::string(value);
@@ -118,7 +119,7 @@ class Token
// Make a quoted string token.
static Token
- make_string_token(const std::string& value, source_location location)
+ make_string_token(const std::string& value, Location location)
{
Token tok(TOKEN_STRING, location);
tok.u_.string_value = new std::string(value);
@@ -127,7 +128,7 @@ class Token
// Make an operator token.
static Token
- make_operator_token(Operator op, source_location location)
+ make_operator_token(Operator op, Location location)
{
Token tok(TOKEN_OPERATOR, location);
tok.u_.op = op;
@@ -136,7 +137,7 @@ class Token
// Make an integer token.
static Token
- make_integer_token(mpz_t val, source_location location)
+ make_integer_token(mpz_t val, Location location)
{
Token tok(TOKEN_INTEGER, location);
mpz_init(tok.u_.integer_value);
@@ -146,7 +147,7 @@ class Token
// Make a float token.
static Token
- make_float_token(mpfr_t val, source_location location)
+ make_float_token(mpfr_t val, Location location)
{
Token tok(TOKEN_FLOAT, location);
mpfr_init(tok.u_.float_value);
@@ -156,7 +157,7 @@ class Token
// Make a token for an imaginary number.
static Token
- make_imaginary_token(mpfr_t val, source_location location)
+ make_imaginary_token(mpfr_t val, Location location)
{
Token tok(TOKEN_IMAGINARY, location);
mpfr_init(tok.u_.float_value);
@@ -165,7 +166,7 @@ class Token
}
// Get the location of the token.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -275,7 +276,7 @@ class Token
private:
// Private constructor used by make_..._token functions above.
- Token(Classification, source_location);
+ Token(Classification, Location);
// Clear the token.
void
@@ -307,7 +308,7 @@ class Token
Operator op;
} u_;
// The source location.
- source_location location_;
+ Location location_;
};
// The lexer itself.
@@ -315,7 +316,7 @@ class Token
class Lex
{
public:
- Lex(const char* input_file_name, FILE* input_file);
+ Lex(const char* input_file_name, FILE* input_file, Linemap *linemap);
~Lex();
@@ -334,7 +335,7 @@ class Lex
// location is used to warn about an out of range character.
static void
append_char(unsigned int v, bool is_charater, std::string* str,
- source_location);
+ Location);
// A helper function. Fetch a UTF-8 character from STR and store it
// in *VALUE. Return the number of bytes read from STR. Return 0
@@ -350,11 +351,11 @@ class Lex
require_line();
// The current location.
- source_location
+ Location
location() const;
// A position CHARS column positions before the current location.
- source_location
+ Location
earlier_location(int chars) const;
static bool
@@ -432,6 +433,8 @@ class Lex
const char* input_file_name_;
// The input file.
FILE* input_file_;
+ // The object used to keep track of file names and line numbers.
+ Linemap* linemap_;
// The line buffer. This holds the current line.
char* linebuf_;
// The size of the line buffer.
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index 6f7b8f21b24..62288687662 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -42,8 +42,8 @@ Parse::Enclosing_var_comparison::operator()(const Enclosing_var& v1,
Parse::Parse(Lex* lex, Gogo* gogo)
: lex_(lex),
- token_(Token::make_invalid_token(0)),
- unget_token_(Token::make_invalid_token(0)),
+ token_(Token::make_invalid_token(Linemap::unknown_location())),
+ unget_token_(Token::make_invalid_token(Linemap::unknown_location())),
unget_token_valid_(false),
gogo_(gogo),
break_stack_(NULL),
@@ -92,7 +92,7 @@ Parse::unget_token(const Token& token)
// The location of the current token.
-source_location
+Location
Parse::location()
{
return this->peek_token()->location();
@@ -142,7 +142,7 @@ Parse::expression_list(Expression* first, bool may_be_sink)
return ret;
// Most expression lists permit a trailing comma.
- source_location location = token->location();
+ Location location = token->location();
this->advance_token();
if (!this->expression_may_start_here())
{
@@ -242,7 +242,7 @@ Parse::type()
return this->interface_type();
else if (token->is_keyword(KEYWORD_FUNC))
{
- source_location location = token->location();
+ Location location = token->location();
this->advance_token();
Type* type = this->signature(NULL, location);
if (type == NULL)
@@ -299,7 +299,7 @@ Parse::type_may_start_here()
Type*
Parse::type_name(bool issue_error)
{
- source_location location = this->location();
+ Location location = this->location();
std::string name;
Named_object* package;
@@ -425,7 +425,7 @@ Parse::array_type(bool may_use_ellipsis)
Type*
Parse::map_type()
{
- source_location location = this->location();
+ Location location = this->location();
go_assert(this->peek_token()->is_keyword(KEYWORD_MAP));
if (!this->advance_token()->is_op(OPERATOR_LSQUARE))
{
@@ -457,10 +457,10 @@ Type*
Parse::struct_type()
{
go_assert(this->peek_token()->is_keyword(KEYWORD_STRUCT));
- source_location location = this->location();
+ Location location = this->location();
if (!this->advance_token()->is_op(OPERATOR_LCURLY))
{
- source_location token_loc = this->location();
+ Location token_loc = this->location();
if (this->peek_token()->is_op(OPERATOR_SEMICOLON)
&& this->advance_token()->is_op(OPERATOR_LCURLY))
error_at(token_loc, "unexpected semicolon or newline before %<{%>");
@@ -514,7 +514,7 @@ void
Parse::field_decl(Struct_field_list* sfl)
{
const Token* token = this->peek_token();
- source_location location = token->location();
+ Location location = token->location();
bool is_anonymous;
bool is_anonymous_pointer;
if (token->is_op(OPERATOR_MULT))
@@ -526,7 +526,7 @@ Parse::field_decl(Struct_field_list* sfl)
{
std::string id = token->identifier();
bool is_id_exported = token->is_identifier_exported();
- source_location id_location = token->location();
+ Location id_location = token->location();
token = this->advance_token();
is_anonymous = (token->is_op(OPERATOR_SEMICOLON)
|| token->is_op(OPERATOR_RCURLY)
@@ -718,7 +718,7 @@ Parse::check_signature_names(const Typed_identifier_list* params,
// This returns NULL on a parse error.
Function_type*
-Parse::signature(Typed_identifier* receiver, source_location location)
+Parse::signature(Typed_identifier* receiver, Location location)
{
bool is_varargs = false;
Typed_identifier_list* params;
@@ -801,7 +801,7 @@ Parse::parameters(Typed_identifier_list** pparams, bool* is_varargs)
Typed_identifier_list*
Parse::parameter_list(bool* is_varargs)
{
- source_location location = this->location();
+ Location location = this->location();
Typed_identifier_list* ret = new Typed_identifier_list();
bool saw_error = false;
@@ -822,7 +822,7 @@ Parse::parameter_list(bool* is_varargs)
{
std::string name = token->identifier();
bool is_exported = token->is_identifier_exported();
- source_location location = token->location();
+ Location location = token->location();
token = this->advance_token();
if (!token->is_op(OPERATOR_COMMA))
{
@@ -1000,7 +1000,7 @@ Parse::parameter_decl(bool parameters_have_names,
if (!parameters_have_names)
{
Type* type;
- source_location location = this->location();
+ Location location = this->location();
if (!this->peek_token()->is_identifier())
{
if (!this->peek_token()->is_op(OPERATOR_ELLIPSIS))
@@ -1078,7 +1078,7 @@ Parse::result(Typed_identifier_list** presults)
return this->parameters(presults, NULL);
else
{
- source_location location = this->location();
+ Location location = this->location();
Type* type = this->type();
if (type->is_error_type())
{
@@ -1096,19 +1096,19 @@ Parse::result(Typed_identifier_list** presults)
// Returns the location of the closing brace.
-source_location
+Location
Parse::block()
{
if (!this->peek_token()->is_op(OPERATOR_LCURLY))
{
- source_location loc = this->location();
+ Location loc = this->location();
if (this->peek_token()->is_op(OPERATOR_SEMICOLON)
&& this->advance_token()->is_op(OPERATOR_LCURLY))
error_at(loc, "unexpected semicolon or newline before %<{%>");
else
{
error_at(this->location(), "expected %<{%>");
- return UNKNOWN_LOCATION;
+ return Linemap::unknown_location();
}
}
@@ -1125,7 +1125,7 @@ Parse::block()
// Skip ahead to the end of the block, in hopes of avoiding
// lots of meaningless errors.
- source_location ret = token->location();
+ Location ret = token->location();
int nest = 0;
while (!token->is_eof())
{
@@ -1147,7 +1147,7 @@ Parse::block()
}
}
- source_location ret = token->location();
+ Location ret = token->location();
this->advance_token();
return ret;
}
@@ -1159,11 +1159,11 @@ Type*
Parse::interface_type()
{
go_assert(this->peek_token()->is_keyword(KEYWORD_INTERFACE));
- source_location location = this->location();
+ Location location = this->location();
if (!this->advance_token()->is_op(OPERATOR_LCURLY))
{
- source_location token_loc = this->location();
+ Location token_loc = this->location();
if (this->peek_token()->is_op(OPERATOR_SEMICOLON)
&& this->advance_token()->is_op(OPERATOR_LCURLY))
error_at(token_loc, "unexpected semicolon or newline before %<{%>");
@@ -1224,7 +1224,7 @@ Parse::method_spec(Typed_identifier_list* methods)
std::string name = token->identifier();
bool is_exported = token->is_identifier_exported();
- source_location location = token->location();
+ Location location = token->location();
if (this->advance_token()->is_op(OPERATOR_LPAREN))
{
@@ -1472,7 +1472,7 @@ Parse::type_spec(void*)
}
std::string name = token->identifier();
bool is_exported = token->is_identifier_exported();
- source_location location = token->location();
+ Location location = token->location();
token = this->advance_token();
// The scope of the type name starts at the point where the
@@ -1549,7 +1549,7 @@ Parse::var_spec(void*)
Typed_identifier_list til;
this->identifier_list(&til);
- source_location location = this->location();
+ Location location = this->location();
Type* type = NULL;
Expression_list* init = NULL;
@@ -1588,7 +1588,7 @@ Parse::var_spec(void*)
void
Parse::init_vars(const Typed_identifier_list* til, Type* type,
Expression_list* init, bool is_coloneq,
- source_location location)
+ Location location)
{
// Check for an initialization which can yield multiple values.
if (init != NULL && init->size() == 1 && til->size() > 1)
@@ -1648,7 +1648,7 @@ Parse::init_vars(const Typed_identifier_list* til, Type* type,
bool
Parse::init_vars_from_call(const Typed_identifier_list* vars, Type* type,
Expression* expr, bool is_coloneq,
- source_location location)
+ Location location)
{
Call_expression* call = expr->call_expression();
if (call == NULL)
@@ -1681,7 +1681,7 @@ Parse::init_vars_from_call(const Typed_identifier_list* vars, Type* type,
bool
Parse::init_vars_from_map(const Typed_identifier_list* vars, Type* type,
Expression* expr, bool is_coloneq,
- source_location location)
+ Location location)
{
Index_expression* index = expr->index_expression();
if (index == NULL)
@@ -1746,7 +1746,7 @@ Parse::init_vars_from_map(const Typed_identifier_list* vars, Type* type,
bool
Parse::init_vars_from_receive(const Typed_identifier_list* vars, Type* type,
Expression* expr, bool is_coloneq,
- source_location location)
+ Location location)
{
Receive_expression* receive = expr->receive_expression();
if (receive == NULL)
@@ -1812,7 +1812,7 @@ Parse::init_vars_from_receive(const Typed_identifier_list* vars, Type* type,
bool
Parse::init_vars_from_type_guard(const Typed_identifier_list* vars,
Type* type, Expression* expr,
- bool is_coloneq, source_location location)
+ bool is_coloneq, Location location)
{
Type_guard_expression* type_guard = expr->type_guard_expression();
if (type_guard == NULL)
@@ -1878,7 +1878,7 @@ Named_object*
Parse::init_var(const Typed_identifier& tid, Type* type, Expression* init,
bool is_coloneq, bool type_from_init, bool* is_new)
{
- source_location location = tid.location();
+ Location location = tid.location();
if (Gogo::is_sink_name(tid.name()))
{
@@ -1927,7 +1927,7 @@ Parse::init_var(const Typed_identifier& tid, Type* type, Expression* init,
Named_object*
Parse::create_dummy_global(Type* type, Expression* init,
- source_location location)
+ Location location)
{
if (type == NULL && init == NULL)
type = Type::lookup_bool_type();
@@ -1956,7 +1956,7 @@ Parse::create_dummy_global(Type* type, Expression* init,
void
Parse::simple_var_decl_or_assignment(const std::string& name,
- source_location location,
+ Location location,
Range_clause* p_range_clause,
Type_switch* p_type_switch)
{
@@ -1976,7 +1976,7 @@ Parse::simple_var_decl_or_assignment(const std::string& name,
std::string id = token->identifier();
bool is_id_exported = token->is_identifier_exported();
- source_location id_location = token->location();
+ Location id_location = token->location();
token = this->advance_token();
if (!token->is_op(OPERATOR_COMMA))
@@ -2079,7 +2079,7 @@ void
Parse::function_decl()
{
go_assert(this->peek_token()->is_keyword(KEYWORD_FUNC));
- source_location location = this->location();
+ Location location = this->location();
const Token* token = this->advance_token();
Typed_identifier* rec = NULL;
@@ -2138,7 +2138,7 @@ Parse::function_decl()
// Check for the easy error of a newline before the opening brace.
if (this->peek_token()->is_op(OPERATOR_SEMICOLON))
{
- source_location semi_loc = this->location();
+ Location semi_loc = this->location();
if (this->advance_token()->is_op(OPERATOR_LCURLY))
error_at(this->location(),
"unexpected semicolon or newline before %<{%>");
@@ -2155,7 +2155,7 @@ Parse::function_decl()
else
{
this->gogo_->start_function(name, fntype, true, location);
- source_location end_loc = this->block();
+ Location end_loc = this->block();
this->gogo_->finish_function(end_loc);
}
}
@@ -2170,7 +2170,7 @@ Parse::receiver()
std::string name;
const Token* token = this->advance_token();
- source_location location = token->location();
+ Location location = token->location();
if (!token->is_op(OPERATOR_MULT))
{
if (!token->is_identifier())
@@ -2271,7 +2271,7 @@ Parse::operand(bool may_be_sink)
{
case Token::TOKEN_IDENTIFIER:
{
- source_location location = token->location();
+ Location location = token->location();
std::string id = token->identifier();
bool is_exported = token->is_identifier_exported();
std::string packed = this->gogo_->pack_hidden_name(id, is_exported);
@@ -2412,7 +2412,7 @@ Parse::operand(bool may_be_sink)
case KEYWORD_MAP:
case KEYWORD_STRUCT:
{
- source_location location = token->location();
+ Location location = token->location();
return Expression::make_type(this->type(), location);
}
default:
@@ -2435,7 +2435,7 @@ Parse::operand(bool may_be_sink)
{
// Here we call array_type directly, as this is the only
// case where an ellipsis is permitted for an array type.
- source_location location = token->location();
+ Location location = token->location();
return Expression::make_type(this->array_type(true), location);
}
break;
@@ -2455,7 +2455,7 @@ Parse::operand(bool may_be_sink)
Expression*
Parse::enclosing_var_reference(Named_object* in_function, Named_object* var,
- source_location location)
+ Location location)
{
go_assert(var->is_variable() || var->is_result_variable());
@@ -2505,7 +2505,7 @@ Parse::enclosing_var_reference(Named_object* in_function, Named_object* var,
// 1. In [][][]int{{{1}}} it will be 2.
Expression*
-Parse::composite_lit(Type* type, int depth, source_location location)
+Parse::composite_lit(Type* type, int depth, Location location)
{
go_assert(this->peek_token()->is_op(OPERATOR_LCURLY));
this->advance_token();
@@ -2530,7 +2530,7 @@ Parse::composite_lit(Type* type, int depth, source_location location)
{
std::string identifier = token->identifier();
bool is_exported = token->is_identifier_exported();
- source_location location = token->location();
+ Location location = token->location();
if (this->advance_token()->is_op(OPERATOR_COLON))
{
@@ -2656,7 +2656,7 @@ Parse::composite_lit(Type* type, int depth, source_location location)
Expression*
Parse::function_lit()
{
- source_location location = this->location();
+ Location location = this->location();
go_assert(this->peek_token()->is_keyword(KEYWORD_FUNC));
this->advance_token();
@@ -2679,7 +2679,7 @@ Parse::function_lit()
Named_object* no = this->gogo_->start_function("", type, true, location);
- source_location end_loc = this->block();
+ Location end_loc = this->block();
this->gogo_->finish_function(end_loc);
@@ -2706,7 +2706,7 @@ Parse::function_lit()
Expression*
Parse::create_closure(Named_object* function, Enclosing_vars* enclosing_vars,
- source_location location)
+ Location location)
{
if (enclosing_vars->empty())
return NULL;
@@ -2761,7 +2761,7 @@ Expression*
Parse::primary_expr(bool may_be_sink, bool may_be_composite_lit,
bool* is_type_switch)
{
- source_location start_loc = this->location();
+ Location start_loc = this->location();
bool is_parenthesized = this->peek_token()->is_op(OPERATOR_LPAREN);
Expression* ret = this->operand(may_be_sink);
@@ -2792,7 +2792,7 @@ Parse::primary_expr(bool may_be_sink, bool may_be_composite_lit,
}
else if (this->peek_token()->is_op(OPERATOR_LPAREN))
{
- source_location loc = this->location();
+ Location loc = this->location();
this->advance_token();
Expression* expr = this->expression(PRECEDENCE_NORMAL, false, true,
NULL);
@@ -2859,7 +2859,7 @@ Expression*
Parse::selector(Expression* left, bool* is_type_switch)
{
go_assert(this->peek_token()->is_op(OPERATOR_DOT));
- source_location location = this->location();
+ Location location = this->location();
const Token* token = this->advance_token();
if (token->is_identifier())
@@ -2917,7 +2917,7 @@ Parse::selector(Expression* left, bool* is_type_switch)
Expression*
Parse::index(Expression* expr)
{
- source_location location = this->location();
+ Location location = this->location();
go_assert(this->peek_token()->is_op(OPERATOR_LSQUARE));
this->advance_token();
@@ -2982,7 +2982,7 @@ Parse::call(Expression* func)
// Return an expression for a single unqualified identifier.
Expression*
-Parse::id_to_expression(const std::string& name, source_location location)
+Parse::id_to_expression(const std::string& name, Location location)
{
Named_object* in_function;
Named_object* named_object = this->gogo_->lookup(name, &in_function);
@@ -3096,7 +3096,7 @@ Parse::expression(Precedence precedence, bool may_be_sink,
}
Operator op = token->op();
- source_location binop_location = token->location();
+ Location binop_location = token->location();
if (precedence >= right_precedence)
{
@@ -3188,7 +3188,7 @@ Parse::unary_expr(bool may_be_sink, bool may_be_composite_lit,
|| token->is_op(OPERATOR_MULT)
|| token->is_op(OPERATOR_AND))
{
- source_location location = token->location();
+ Location location = token->location();
Operator op = token->op();
this->advance_token();
@@ -3288,7 +3288,7 @@ Parse::statement(Label* label)
{
std::string identifier = token->identifier();
bool is_exported = token->is_identifier_exported();
- source_location location = token->location();
+ Location location = token->location();
if (this->advance_token()->is_op(OPERATOR_COLON))
{
this->advance_token();
@@ -3307,9 +3307,9 @@ Parse::statement(Label* label)
case Token::TOKEN_OPERATOR:
if (token->is_op(OPERATOR_LCURLY))
{
- source_location location = token->location();
+ Location location = token->location();
this->gogo_->start_block(location);
- source_location end_loc = this->block();
+ Location end_loc = this->block();
this->gogo_->add_block(this->gogo_->finish_block(end_loc),
location);
}
@@ -3391,7 +3391,7 @@ Parse::statement_may_start_here()
// Label = identifier .
void
-Parse::labeled_stmt(const std::string& label_name, source_location location)
+Parse::labeled_stmt(const std::string& label_name, Location location)
{
Label* label = this->gogo_->add_label_definition(label_name, location);
@@ -3447,7 +3447,7 @@ Parse::simple_stat(bool may_be_composite_lit, bool* return_exp,
{
std::string identifier = token->identifier();
bool is_exported = token->is_identifier_exported();
- source_location location = token->location();
+ Location location = token->location();
token = this->advance_token();
if (token->is_op(OPERATOR_COLONEQ)
@@ -3576,7 +3576,7 @@ void
Parse::send_stmt(Expression* channel)
{
go_assert(this->peek_token()->is_op(OPERATOR_CHANOP));
- source_location loc = this->location();
+ Location loc = this->location();
this->advance_token();
Expression* val = this->expression(PRECEDENCE_NORMAL, false, true, NULL);
Statement* s = Statement::make_send_statement(channel, val, loc);
@@ -3655,7 +3655,7 @@ Parse::tuple_assignment(Expression_list* lhs, Range_clause* p_range_clause)
return;
}
Operator op = token->op();
- source_location location = token->location();
+ Location location = token->location();
token = this->advance_token();
@@ -3803,9 +3803,9 @@ Parse::go_or_defer_stat()
go_assert(this->peek_token()->is_keyword(KEYWORD_GO)
|| this->peek_token()->is_keyword(KEYWORD_DEFER));
bool is_go = this->peek_token()->is_keyword(KEYWORD_GO);
- source_location stat_location = this->location();
+ Location stat_location = this->location();
this->advance_token();
- source_location expr_location = this->location();
+ Location expr_location = this->location();
Expression* expr = this->expression(PRECEDENCE_NORMAL, false, true, NULL);
Call_expression* call_expr = expr->call_expression();
if (call_expr == NULL)
@@ -3833,7 +3833,7 @@ void
Parse::return_stat()
{
go_assert(this->peek_token()->is_keyword(KEYWORD_RETURN));
- source_location location = this->location();
+ Location location = this->location();
this->advance_token();
Expression_list* vals = NULL;
if (this->expression_may_start_here())
@@ -3865,7 +3865,7 @@ void
Parse::if_stat()
{
go_assert(this->peek_token()->is_keyword(KEYWORD_IF));
- source_location location = this->location();
+ Location location = this->location();
this->advance_token();
this->gogo_->start_block(location);
@@ -3911,13 +3911,13 @@ Parse::if_stat()
}
this->gogo_->start_block(this->location());
- source_location end_loc = this->block();
+ Location end_loc = this->block();
Block* then_block = this->gogo_->finish_block(end_loc);
// Check for the easy error of a newline before "else".
if (this->peek_token()->is_op(OPERATOR_SEMICOLON))
{
- source_location semi_loc = this->location();
+ Location semi_loc = this->location();
if (this->advance_token()->is_keyword(KEYWORD_ELSE))
error_at(this->location(),
"unexpected semicolon or newline before %<else%>");
@@ -3962,7 +3962,7 @@ void
Parse::switch_stat(Label* label)
{
go_assert(this->peek_token()->is_keyword(KEYWORD_SWITCH));
- source_location location = this->location();
+ Location location = this->location();
this->advance_token();
this->gogo_->start_block(location);
@@ -4004,7 +4004,7 @@ Parse::switch_stat(Label* label)
const Token* token = this->peek_token();
std::string identifier = token->identifier();
bool is_exported = token->is_identifier_exported();
- source_location id_loc = token->location();
+ Location id_loc = token->location();
token = this->advance_token();
bool is_coloneq = token->is_op(OPERATOR_COLONEQ);
@@ -4043,7 +4043,7 @@ Parse::switch_stat(Label* label)
if (!this->peek_token()->is_op(OPERATOR_LCURLY))
{
- source_location token_loc = this->location();
+ Location token_loc = this->location();
if (this->peek_token()->is_op(OPERATOR_SEMICOLON)
&& this->advance_token()->is_op(OPERATOR_LCURLY))
error_at(token_loc, "unexpected semicolon or newline before %<{%>");
@@ -4088,7 +4088,7 @@ Parse::switch_stat(Label* label)
Statement*
Parse::expr_switch_body(Label* label, Expression* switch_val,
- source_location location)
+ Location location)
{
Switch_statement* statement = Statement::make_switch_statement(switch_val,
location);
@@ -4122,7 +4122,7 @@ Parse::expr_switch_body(Label* label, Expression* switch_val,
void
Parse::expr_case_clause(Case_clauses* clauses, bool* saw_default)
{
- source_location location = this->location();
+ Location location = this->location();
bool is_default = false;
Expression_list* vals = this->expr_switch_case(&is_default);
@@ -4198,7 +4198,7 @@ Parse::expr_switch_case(bool* is_default)
Statement*
Parse::type_switch_body(Label* label, const Type_switch& type_switch,
- source_location location)
+ Location location)
{
Named_object* switch_no = NULL;
if (!type_switch.name.empty())
@@ -4243,7 +4243,7 @@ void
Parse::type_case_clause(Named_object* switch_no, Type_case_clauses* clauses,
bool* saw_default)
{
- source_location location = this->location();
+ Location location = this->location();
std::vector<Type*> types;
bool is_default = false;
@@ -4355,12 +4355,12 @@ void
Parse::select_stat(Label* label)
{
go_assert(this->peek_token()->is_keyword(KEYWORD_SELECT));
- source_location location = this->location();
+ Location location = this->location();
const Token* token = this->advance_token();
if (!token->is_op(OPERATOR_LCURLY))
{
- source_location token_loc = token->location();
+ Location token_loc = token->location();
if (token->is_op(OPERATOR_SEMICOLON)
&& this->advance_token()->is_op(OPERATOR_LCURLY))
error_at(token_loc, "unexpected semicolon or newline before %<{%>");
@@ -4402,7 +4402,7 @@ Parse::select_stat(Label* label)
void
Parse::comm_clause(Select_clauses* clauses, bool* saw_default)
{
- source_location location = this->location();
+ Location location = this->location();
bool is_send = false;
Expression* channel = NULL;
Expression* val = NULL;
@@ -4518,7 +4518,7 @@ Parse::send_or_recv_stmt(bool* is_send, Expression** channel, Expression** val,
Gogo* gogo = this->gogo_;
std::string recv_var = token->identifier();
bool is_rv_exported = token->is_identifier_exported();
- source_location recv_var_loc = token->location();
+ Location recv_var_loc = token->location();
token = this->advance_token();
if (token->is_op(OPERATOR_COLONEQ))
{
@@ -4547,7 +4547,7 @@ Parse::send_or_recv_stmt(bool* is_send, Expression** channel, Expression** val,
{
std::string recv_closed = token->identifier();
bool is_rc_exported = token->is_identifier_exported();
- source_location recv_closed_loc = token->location();
+ Location recv_closed_loc = token->location();
closed_is_id = true;
token = this->advance_token();
@@ -4673,7 +4673,7 @@ void
Parse::for_stat(Label* label)
{
go_assert(this->peek_token()->is_keyword(KEYWORD_FOR));
- source_location location = this->location();
+ Location location = this->location();
const Token* token = this->advance_token();
// Open a block to hold any variables defined in the init statement
@@ -4761,7 +4761,7 @@ Parse::for_stat(Label* label)
// For_statement.
this->gogo_->start_block(this->location());
- source_location end_loc = this->block();
+ Location end_loc = this->block();
Block* statements = this->gogo_->finish_block(end_loc);
if (sfor != NULL)
@@ -4830,7 +4830,7 @@ Parse::range_clause_decl(const Typed_identifier_list* til,
Range_clause* p_range_clause)
{
go_assert(this->peek_token()->is_keyword(KEYWORD_RANGE));
- source_location location = this->location();
+ Location location = this->location();
p_range_clause->found = true;
@@ -4956,7 +4956,7 @@ void
Parse::break_stat()
{
go_assert(this->peek_token()->is_keyword(KEYWORD_BREAK));
- source_location location = this->location();
+ Location location = this->location();
const Token* token = this->advance_token();
Statement* enclosing;
@@ -4978,7 +4978,8 @@ Parse::break_stat()
{
// If there is a label with this name, mark it as used to
// avoid a useless error about an unused label.
- this->gogo_->add_label_reference(token->identifier(), 0, false);
+ this->gogo_->add_label_reference(token->identifier(),
+ Linemap::unknown_location(), false);
error_at(token->location(), "invalid break label %qs",
Gogo::message_name(token->identifier()).c_str());
@@ -5012,7 +5013,7 @@ void
Parse::continue_stat()
{
go_assert(this->peek_token()->is_keyword(KEYWORD_CONTINUE));
- source_location location = this->location();
+ Location location = this->location();
const Token* token = this->advance_token();
Statement* enclosing;
@@ -5033,7 +5034,8 @@ Parse::continue_stat()
{
// If there is a label with this name, mark it as used to
// avoid a useless error about an unused label.
- this->gogo_->add_label_reference(token->identifier(), 0, false);
+ this->gogo_->add_label_reference(token->identifier(),
+ Linemap::unknown_location(), false);
error_at(token->location(), "invalid continue label %qs",
Gogo::message_name(token->identifier()).c_str());
@@ -5061,7 +5063,7 @@ void
Parse::goto_stat()
{
go_assert(this->peek_token()->is_keyword(KEYWORD_GOTO));
- source_location location = this->location();
+ Location location = this->location();
const Token* token = this->advance_token();
if (!token->is_identifier())
error_at(this->location(), "expected label for goto");
@@ -5081,7 +5083,7 @@ void
Parse::package_clause()
{
const Token* token = this->peek_token();
- source_location location = token->location();
+ Location location = token->location();
std::string name;
if (!token->is_keyword(KEYWORD_PACKAGE))
{
@@ -5126,7 +5128,7 @@ void
Parse::import_spec(void*)
{
const Token* token = this->peek_token();
- source_location location = token->location();
+ Location location = token->location();
std::string local_name;
bool is_local_name_exported = false;
diff --git a/gcc/go/gofrontend/parse.h b/gcc/go/gofrontend/parse.h
index 0da86fbae42..0a3fe64cdd6 100644
--- a/gcc/go/gofrontend/parse.h
+++ b/gcc/go/gofrontend/parse.h
@@ -75,7 +75,7 @@ class Parse
// The variable name.
std::string name;
// The location of the variable.
- source_location location;
+ Location location;
// The expression.
Expression* expr;
@@ -147,7 +147,7 @@ class Parse
unget_token(const Token&);
// The location of the current token.
- source_location
+ Location
location();
// For break and continue we keep a stack of statements with
@@ -169,12 +169,12 @@ class Parse
Type* pointer_type();
Type* channel_type();
void check_signature_names(const Typed_identifier_list*, Names*);
- Function_type* signature(Typed_identifier*, source_location);
+ Function_type* signature(Typed_identifier*, Location);
bool parameters(Typed_identifier_list**, bool* is_varargs);
Typed_identifier_list* parameter_list(bool* is_varargs);
void parameter_decl(bool, Typed_identifier_list*, bool*, bool*);
bool result(Typed_identifier_list**);
- source_location block();
+ Location block();
Type* interface_type();
void method_spec(Typed_identifier_list*);
void declaration();
@@ -188,30 +188,30 @@ class Parse
void var_decl();
void var_spec(void*);
void init_vars(const Typed_identifier_list*, Type*, Expression_list*,
- bool is_coloneq, source_location);
+ bool is_coloneq, Location);
bool init_vars_from_call(const Typed_identifier_list*, Type*, Expression*,
- bool is_coloneq, source_location);
+ bool is_coloneq, Location);
bool init_vars_from_map(const Typed_identifier_list*, Type*, Expression*,
- bool is_coloneq, source_location);
+ bool is_coloneq, Location);
bool init_vars_from_receive(const Typed_identifier_list*, Type*,
- Expression*, bool is_coloneq, source_location);
+ Expression*, bool is_coloneq, Location);
bool init_vars_from_type_guard(const Typed_identifier_list*, Type*,
Expression*, bool is_coloneq,
- source_location);
+ Location);
Named_object* init_var(const Typed_identifier&, Type*, Expression*,
bool is_coloneq, bool type_from_init, bool* is_new);
- Named_object* create_dummy_global(Type*, Expression*, source_location);
- void simple_var_decl_or_assignment(const std::string&, source_location,
+ Named_object* create_dummy_global(Type*, Expression*, Location);
+ void simple_var_decl_or_assignment(const std::string&, Location,
Range_clause*, Type_switch*);
void function_decl();
Typed_identifier* receiver();
Expression* operand(bool may_be_sink);
Expression* enclosing_var_reference(Named_object*, Named_object*,
- source_location);
- Expression* composite_lit(Type*, int depth, source_location);
+ Location);
+ Expression* composite_lit(Type*, int depth, Location);
Expression* function_lit();
Expression* create_closure(Named_object* function, Enclosing_vars*,
- source_location);
+ Location);
Expression* primary_expr(bool may_be_sink, bool may_be_composite_lit,
bool* is_type_switch);
Expression* selector(Expression*, bool* is_type_switch);
@@ -222,11 +222,11 @@ class Parse
bool expression_may_start_here();
Expression* unary_expr(bool may_be_sink, bool may_be_composite_lit,
bool* is_type_switch);
- Expression* qualified_expr(Expression*, source_location);
- Expression* id_to_expression(const std::string&, source_location);
+ Expression* qualified_expr(Expression*, Location);
+ Expression* id_to_expression(const std::string&, Location);
void statement(Label*);
bool statement_may_start_here();
- void labeled_stmt(const std::string&, source_location);
+ void labeled_stmt(const std::string&, Location);
Expression* simple_stat(bool, bool*, Range_clause*, Type_switch*);
bool simple_stat_may_start_here();
void statement_list();
@@ -241,10 +241,10 @@ class Parse
void return_stat();
void if_stat();
void switch_stat(Label*);
- Statement* expr_switch_body(Label*, Expression*, source_location);
+ Statement* expr_switch_body(Label*, Expression*, Location);
void expr_case_clause(Case_clauses*, bool* saw_default);
Expression_list* expr_switch_case(bool*);
- Statement* type_switch_body(Label*, const Type_switch&, source_location);
+ Statement* type_switch_body(Label*, const Type_switch&, Location);
void type_case_clause(Named_object*, Type_case_clauses*, bool* saw_default);
void type_switch_case(std::vector<Type*>*, bool*);
void select_stat(Label*);
diff --git a/gcc/go/gofrontend/runtime.cc b/gcc/go/gofrontend/runtime.cc
index 2ecfbf5b155..42f1e787a8f 100644
--- a/gcc/go/gofrontend/runtime.cc
+++ b/gcc/go/gofrontend/runtime.cc
@@ -82,7 +82,7 @@ runtime_function_type(Runtime_function_type bft)
go_assert(bft < NUMBER_OF_RUNTIME_FUNCTION_TYPES);
if (runtime_function_types[bft] == NULL)
{
- const source_location bloc = BUILTINS_LOCATION;
+ const Location bloc = Linemap::predeclared_location();
Type* t;
switch (bft)
{
@@ -193,7 +193,7 @@ runtime_function_type(Runtime_function_type bft)
static Expression*
convert_to_runtime_function_type(Runtime_function_type bft, Expression* e,
- source_location loc)
+ Location loc)
{
switch (bft)
{
@@ -295,7 +295,7 @@ Runtime::runtime_declaration(Function code)
{
const Runtime_function* pb = &runtime_functions[code];
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Typed_identifier_list* param_types = NULL;
if (pb->parameter_types[0] != RFT_VOID)
@@ -347,7 +347,7 @@ Runtime::runtime_declaration(Function code)
// Make a call to a runtime function.
Call_expression*
-Runtime::make_call(Runtime::Function code, source_location loc,
+Runtime::make_call(Runtime::Function code, Location loc,
int param_count, ...)
{
go_assert(code < Runtime::NUMBER_OF_FUNCTIONS);
@@ -387,7 +387,8 @@ Runtime::map_iteration_type()
mpz_t ival;
mpz_init_set_ui(ival, map_iteration_size);
- Expression* iexpr = Expression::make_integer(&ival, NULL, BUILTINS_LOCATION);
+ Expression* iexpr = Expression::make_integer(&ival, NULL,
+ Linemap::predeclared_location());
mpz_clear(ival);
return Type::make_array_type(runtime_function_type(RFT_POINTER), iexpr);
diff --git a/gcc/go/gofrontend/runtime.h b/gcc/go/gofrontend/runtime.h
index f7c878e73b9..3cd40348cbe 100644
--- a/gcc/go/gofrontend/runtime.h
+++ b/gcc/go/gofrontend/runtime.h
@@ -32,7 +32,7 @@ class Runtime
// Make a call to a runtime function.
static Call_expression*
- make_call(Function, source_location, int, ...);
+ make_call(Function, Location, int, ...);
// Convert all the types used by runtime functions to the backend
// representation.
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index 156977d3f5d..835a0cca239 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -20,7 +20,7 @@
// Class Statement.
Statement::Statement(Statement_classification classification,
- source_location location)
+ Location location)
: classification_(classification), location_(location)
{
}
@@ -175,7 +175,7 @@ Statement::report_error(const char* msg)
class Error_statement : public Statement
{
public:
- Error_statement(source_location location)
+ Error_statement(Location location)
: Statement(STATEMENT_ERROR, location)
{ }
@@ -204,7 +204,7 @@ Error_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
// Make an error statement.
Statement*
-Statement::make_error_statement(source_location location)
+Statement::make_error_statement(Location location)
{
return new Error_statement(location);
}
@@ -268,7 +268,7 @@ Variable_declaration_statement::do_get_backend(Translate_context* context)
// Something takes the address of this variable, so the value is
// stored in the heap. Initialize it to newly allocated memory
// space, and assign the initial value to the new space.
- source_location loc = this->location();
+ Location loc = this->location();
Named_object* newfn = context->gogo()->lookup_global("new");
go_assert(newfn != NULL && newfn->is_function_declaration());
Expression* func = Expression::make_func_reference(newfn, NULL, loc);
@@ -497,7 +497,7 @@ Temporary_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
Temporary_statement*
Statement::make_temporary(Type* type, Expression* init,
- source_location location)
+ Location location)
{
return new Temporary_statement(type, init, location);
}
@@ -508,7 +508,7 @@ class Assignment_statement : public Statement
{
public:
Assignment_statement(Expression* lhs, Expression* rhs,
- source_location location)
+ Location location)
: Statement(STATEMENT_ASSIGNMENT, location),
lhs_(lhs), rhs_(rhs), are_hidden_fields_ok_(false)
{ }
@@ -647,7 +647,7 @@ Assignment_statement::do_dump_statement(Ast_dump_context* ast_dump_context)
Statement*
Statement::make_assignment(Expression* lhs, Expression* rhs,
- source_location location)
+ Location location)
{
return new Assignment_statement(lhs, rhs, location);
}
@@ -684,7 +684,7 @@ Move_subexpressions::expression(Expression** pexpr)
--this->skip_;
else if ((*pexpr)->temporary_reference_expression() == NULL)
{
- source_location loc = (*pexpr)->location();
+ Location loc = (*pexpr)->location();
Temporary_statement* temp = Statement::make_temporary(NULL, *pexpr, loc);
this->block_->add_statement(temp);
*pexpr = Expression::make_temporary_reference(temp, loc);
@@ -731,7 +731,7 @@ Move_ordered_evals::expression(Expression** pexpr)
if ((*pexpr)->must_eval_in_order())
{
- source_location loc = (*pexpr)->location();
+ Location loc = (*pexpr)->location();
Temporary_statement* temp = Statement::make_temporary(NULL, *pexpr, loc);
this->block_->add_statement(temp);
*pexpr = Expression::make_temporary_reference(temp, loc);
@@ -745,7 +745,7 @@ class Assignment_operation_statement : public Statement
{
public:
Assignment_operation_statement(Operator op, Expression* lhs, Expression* rhs,
- source_location location)
+ Location location)
: Statement(STATEMENT_ASSIGNMENT_OPERATION, location),
op_(op), lhs_(lhs), rhs_(rhs)
{ }
@@ -794,7 +794,7 @@ Statement*
Assignment_operation_statement::do_lower(Gogo*, Named_object*,
Block* enclosing, Statement_inserter*)
{
- source_location loc = this->location();
+ Location loc = this->location();
// We have to evaluate the left hand side expression only once. We
// do this by moving out any expression with side effects.
@@ -875,7 +875,7 @@ Assignment_operation_statement::do_dump_statement(
Statement*
Statement::make_assignment_operation(Operator op, Expression* lhs,
- Expression* rhs, source_location location)
+ Expression* rhs, Location location)
{
return new Assignment_operation_statement(op, lhs, rhs, location);
}
@@ -888,7 +888,7 @@ class Tuple_assignment_statement : public Statement
{
public:
Tuple_assignment_statement(Expression_list* lhs, Expression_list* rhs,
- source_location location)
+ Location location)
: Statement(STATEMENT_TUPLE_ASSIGNMENT, location),
lhs_(lhs), rhs_(rhs), are_hidden_fields_ok_(false)
{ }
@@ -944,7 +944,7 @@ Statement*
Tuple_assignment_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
Statement_inserter*)
{
- source_location loc = this->location();
+ Location loc = this->location();
Block* b = new Block(enclosing, loc);
@@ -1035,7 +1035,7 @@ Tuple_assignment_statement::do_dump_statement(
Statement*
Statement::make_tuple_assignment(Expression_list* lhs, Expression_list* rhs,
- source_location location)
+ Location location)
{
return new Tuple_assignment_statement(lhs, rhs, location);
}
@@ -1048,7 +1048,7 @@ class Tuple_map_assignment_statement : public Statement
public:
Tuple_map_assignment_statement(Expression* val, Expression* present,
Expression* map_index,
- source_location location)
+ Location location)
: Statement(STATEMENT_TUPLE_MAP_ASSIGNMENT, location),
val_(val), present_(present), map_index_(map_index)
{ }
@@ -1097,7 +1097,7 @@ Statement*
Tuple_map_assignment_statement::do_lower(Gogo*, Named_object*,
Block* enclosing, Statement_inserter*)
{
- source_location loc = this->location();
+ Location loc = this->location();
Map_index_expression* map_index = this->map_index_->map_index_expression();
if (map_index == NULL)
@@ -1184,7 +1184,7 @@ Tuple_map_assignment_statement::do_dump_statement(
Statement*
Statement::make_tuple_map_assignment(Expression* val, Expression* present,
Expression* map_index,
- source_location location)
+ Location location)
{
return new Tuple_map_assignment_statement(val, present, map_index, location);
}
@@ -1197,7 +1197,7 @@ class Map_assignment_statement : public Statement
public:
Map_assignment_statement(Expression* map_index,
Expression* val, Expression* should_set,
- source_location location)
+ Location location)
: Statement(STATEMENT_MAP_ASSIGNMENT, location),
map_index_(map_index), val_(val), should_set_(should_set)
{ }
@@ -1246,7 +1246,7 @@ Statement*
Map_assignment_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
Statement_inserter*)
{
- source_location loc = this->location();
+ Location loc = this->location();
Map_index_expression* map_index = this->map_index_->map_index_expression();
if (map_index == NULL)
@@ -1318,7 +1318,7 @@ Map_assignment_statement::do_dump_statement(
Statement*
Statement::make_map_assignment(Expression* map_index,
Expression* val, Expression* should_set,
- source_location location)
+ Location location)
{
return new Map_assignment_statement(map_index, val, should_set, location);
}
@@ -1330,7 +1330,7 @@ class Tuple_receive_assignment_statement : public Statement
public:
Tuple_receive_assignment_statement(Expression* val, Expression* closed,
Expression* channel, bool for_select,
- source_location location)
+ Location location)
: Statement(STATEMENT_TUPLE_RECEIVE_ASSIGNMENT, location),
val_(val), closed_(closed), channel_(channel), for_select_(for_select)
{ }
@@ -1382,7 +1382,7 @@ Tuple_receive_assignment_statement::do_lower(Gogo*, Named_object*,
Block* enclosing,
Statement_inserter*)
{
- source_location loc = this->location();
+ Location loc = this->location();
Channel_type* channel_type = this->channel_->type()->channel_type();
if (channel_type == NULL)
@@ -1461,7 +1461,7 @@ Statement*
Statement::make_tuple_receive_assignment(Expression* val, Expression* closed,
Expression* channel,
bool for_select,
- source_location location)
+ Location location)
{
return new Tuple_receive_assignment_statement(val, closed, channel,
for_select, location);
@@ -1475,7 +1475,7 @@ class Tuple_type_guard_assignment_statement : public Statement
public:
Tuple_type_guard_assignment_statement(Expression* val, Expression* ok,
Expression* expr, Type* type,
- source_location location)
+ Location location)
: Statement(STATEMENT_TUPLE_TYPE_GUARD_ASSIGNMENT, location),
val_(val), ok_(ok), expr_(expr), type_(type)
{ }
@@ -1534,7 +1534,7 @@ Tuple_type_guard_assignment_statement::do_lower(Gogo*, Named_object*,
Block* enclosing,
Statement_inserter*)
{
- source_location loc = this->location();
+ Location loc = this->location();
Type* expr_type = this->expr_->type();
if (expr_type->interface_type() == NULL)
@@ -1599,7 +1599,7 @@ Tuple_type_guard_assignment_statement::do_lower(Gogo*, Named_object*,
Call_expression*
Tuple_type_guard_assignment_statement::lower_to_type(Runtime::Function code)
{
- source_location loc = this->location();
+ Location loc = this->location();
return Runtime::make_call(code, loc, 2,
Expression::make_type_descriptor(this->type_, loc),
this->expr_);
@@ -1612,7 +1612,7 @@ Tuple_type_guard_assignment_statement::lower_to_object_type(
Block* b,
Runtime::Function code)
{
- source_location loc = this->location();
+ Location loc = this->location();
// var val_temp TYPE
Temporary_statement* val_temp = Statement::make_temporary(this->type_,
@@ -1655,7 +1655,7 @@ Tuple_type_guard_assignment_statement::do_dump_statement(
Statement*
Statement::make_tuple_type_guard_assignment(Expression* val, Expression* ok,
Expression* expr, Type* type,
- source_location location)
+ Location location)
{
return new Tuple_type_guard_assignment_statement(val, ok, expr, type,
location);
@@ -1778,7 +1778,7 @@ Statement::make_statement(Expression* expr, bool is_ignored)
class Block_statement : public Statement
{
public:
- Block_statement(Block* block, source_location location)
+ Block_statement(Block* block, Location location)
: Statement(STATEMENT_BLOCK, location),
block_(block)
{ }
@@ -1826,7 +1826,7 @@ Block_statement::do_dump_statement(Ast_dump_context*) const
// Make a block statement.
Statement*
-Statement::make_block_statement(Block* block, source_location location)
+Statement::make_block_statement(Block* block, Location location)
{
return new Block_statement(block, location);
}
@@ -1872,7 +1872,7 @@ class Inc_dec_statement : public Statement
Statement*
Inc_dec_statement::do_lower(Gogo*, Named_object*, Block*, Statement_inserter*)
{
- source_location loc = this->location();
+ Location loc = this->location();
mpz_t oval;
mpz_init_set_ui(oval, 1UL);
@@ -1916,7 +1916,7 @@ Statement::make_dec_statement(Expression* expr)
Thunk_statement::Thunk_statement(Statement_classification classification,
Call_expression* call,
- source_location location)
+ Location location)
: Statement(classification, location),
call_(call), struct_type_(NULL)
{
@@ -2145,7 +2145,7 @@ Thunk_statement::simplify_statement(Gogo* gogo, Named_object* function,
Interface_field_reference_expression* interface_method =
fn->interface_field_reference_expression();
- source_location location = this->location();
+ Location location = this->location();
std::string thunk_name = Gogo::thunk_name();
@@ -2230,7 +2230,7 @@ Thunk_statement::thunk_field_param(int n, char* buf, size_t buflen)
Struct_type*
Thunk_statement::build_struct(Function_type* fntype)
{
- source_location location = this->location();
+ Location location = this->location();
Struct_field_list* fields = new Struct_field_list();
@@ -2288,7 +2288,7 @@ Thunk_statement::build_struct(Function_type* fntype)
void
Thunk_statement::build_thunk(Gogo* gogo, const std::string& thunk_name)
{
- source_location location = this->location();
+ Location location = this->location();
Call_expression* ce = this->call_->call_expression();
@@ -2541,7 +2541,7 @@ Go_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
// Make a go statement.
Statement*
-Statement::make_go_statement(Call_expression* call, source_location location)
+Statement::make_go_statement(Call_expression* call, Location location)
{
return new Go_statement(call, location);
}
@@ -2556,7 +2556,7 @@ Defer_statement::do_get_backend(Translate_context* context)
if (!this->get_fn_and_arg(&fn, &arg))
return context->backend()->error_statement();
- source_location loc = this->location();
+ Location loc = this->location();
Expression* ds = context->function()->func_value()->defer_stack(loc);
Expression* call = Runtime::make_call(Runtime::DEFER, loc, 3,
@@ -2581,7 +2581,7 @@ Defer_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
Statement*
Statement::make_defer_statement(Call_expression* call,
- source_location location)
+ Location location)
{
return new Defer_statement(call, location);
}
@@ -2623,7 +2623,7 @@ Return_statement::do_lower(Gogo*, Named_object* function, Block* enclosing,
this->vals_ = NULL;
this->is_lowered_ = true;
- source_location loc = this->location();
+ Location loc = this->location();
size_t vals_count = vals == NULL ? 0 : vals->size();
Function::Results* results = function->func_value()->result_variables();
@@ -2757,7 +2757,7 @@ Return_statement::do_lower(Gogo*, Named_object* function, Block* enclosing,
Bstatement*
Return_statement::do_get_backend(Translate_context* context)
{
- source_location loc = this->location();
+ Location loc = this->location();
Function* function = context->function()->func_value();
tree fndecl = function->get_decl();
@@ -2795,7 +2795,7 @@ Return_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
Return_statement*
Statement::make_return_statement(Expression_list* vals,
- source_location location)
+ Location location)
{
return new Return_statement(vals, location);
}
@@ -2805,7 +2805,7 @@ Statement::make_return_statement(Expression_list* vals,
class Bc_statement : public Statement
{
public:
- Bc_statement(bool is_break, Unnamed_label* label, source_location location)
+ Bc_statement(bool is_break, Unnamed_label* label, Location location)
: Statement(STATEMENT_BREAK_OR_CONTINUE, location),
label_(label), is_break_(is_break)
{ }
@@ -2855,7 +2855,7 @@ Bc_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
// Make a break statement.
Statement*
-Statement::make_break_statement(Unnamed_label* label, source_location location)
+Statement::make_break_statement(Unnamed_label* label, Location location)
{
return new Bc_statement(true, label, location);
}
@@ -2864,7 +2864,7 @@ Statement::make_break_statement(Unnamed_label* label, source_location location)
Statement*
Statement::make_continue_statement(Unnamed_label* label,
- source_location location)
+ Location location)
{
return new Bc_statement(false, label, location);
}
@@ -2874,7 +2874,7 @@ Statement::make_continue_statement(Unnamed_label* label,
class Goto_statement : public Statement
{
public:
- Goto_statement(Label* label, source_location location)
+ Goto_statement(Label* label, Location location)
: Statement(STATEMENT_GOTO, location),
label_(label)
{ }
@@ -2936,7 +2936,7 @@ Goto_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
// Make a goto statement.
Statement*
-Statement::make_goto_statement(Label* label, source_location location)
+Statement::make_goto_statement(Label* label, Location location)
{
return new Goto_statement(label, location);
}
@@ -2946,7 +2946,7 @@ Statement::make_goto_statement(Label* label, source_location location)
class Goto_unnamed_statement : public Statement
{
public:
- Goto_unnamed_statement(Unnamed_label* label, source_location location)
+ Goto_unnamed_statement(Unnamed_label* label, Location location)
: Statement(STATEMENT_GOTO_UNNAMED, location),
label_(label)
{ }
@@ -2987,7 +2987,7 @@ Goto_unnamed_statement::do_dump_statement(
Statement*
Statement::make_goto_unnamed_statement(Unnamed_label* label,
- source_location location)
+ Location location)
{
return new Goto_unnamed_statement(label, location);
}
@@ -3024,7 +3024,7 @@ Label_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
// Make a label statement.
Statement*
-Statement::make_label_statement(Label* label, source_location location)
+Statement::make_label_statement(Label* label, Location location)
{
return new Label_statement(label, location);
}
@@ -3081,7 +3081,7 @@ class If_statement : public Statement
{
public:
If_statement(Expression* cond, Block* then_block, Block* else_block,
- source_location location)
+ Location location)
: Statement(STATEMENT_IF, location),
cond_(cond), then_block_(then_block), else_block_(else_block)
{ }
@@ -3201,7 +3201,7 @@ If_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
Statement*
Statement::make_if_statement(Expression* cond, Block* then_block,
- Block* else_block, source_location location)
+ Block* else_block, Location location)
{
return new If_statement(cond, then_block, else_block, location);
}
@@ -3303,7 +3303,7 @@ Case_clauses::Case_clause::lower(Block* b, Temporary_statement* val_temp,
Unnamed_label* start_label,
Unnamed_label* finish_label) const
{
- source_location loc = this->location_;
+ Location loc = this->location_;
Unnamed_label* next_case_label;
if (this->cases_ == NULL || this->cases_->empty())
{
@@ -3335,7 +3335,7 @@ Case_clauses::Case_clause::lower(Block* b, Temporary_statement* val_temp,
}
Block* then_block = new Block(b, loc);
- next_case_label = new Unnamed_label(UNKNOWN_LOCATION);
+ next_case_label = new Unnamed_label(Linemap::unknown_location());
Statement* s = Statement::make_goto_unnamed_statement(next_case_label,
loc);
then_block->add_statement(s);
@@ -3693,7 +3693,7 @@ class Constant_switch_statement : public Statement
public:
Constant_switch_statement(Expression* val, Case_clauses* clauses,
Unnamed_label* break_label,
- source_location location)
+ Location location)
: Statement(STATEMENT_CONSTANT_SWITCH, location),
val_(val), clauses_(clauses), break_label_(break_label)
{ }
@@ -3838,7 +3838,7 @@ Statement*
Switch_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
Statement_inserter*)
{
- source_location loc = this->location();
+ Location loc = this->location();
if (this->val_ != NULL
&& (this->val_->is_error_expression()
@@ -3915,7 +3915,7 @@ Switch_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
// Make a switch statement.
Switch_statement*
-Statement::make_switch_statement(Expression* val, source_location location)
+Statement::make_switch_statement(Expression* val, Location location)
{
return new Switch_statement(val, location);
}
@@ -3949,7 +3949,7 @@ Type_case_clauses::Type_case_clause::lower(Block* b,
Unnamed_label* break_label,
Unnamed_label** stmts_label) const
{
- source_location loc = this->location_;
+ Location loc = this->location_;
Unnamed_label* next_case_label = NULL;
if (!this->is_default_)
@@ -3979,7 +3979,7 @@ Type_case_clauses::Type_case_clause::lower(Block* b,
if (!this->is_fallthrough_)
{
// if !COND { goto NEXT_CASE_LABEL }
- next_case_label = new Unnamed_label(UNKNOWN_LOCATION);
+ next_case_label = new Unnamed_label(Linemap::unknown_location());
dest = next_case_label;
cond = Expression::make_unary(OPERATOR_NOT, cond, loc);
}
@@ -3988,7 +3988,7 @@ Type_case_clauses::Type_case_clause::lower(Block* b,
// if COND { goto STMTS_LABEL }
go_assert(stmts_label != NULL);
if (*stmts_label == NULL)
- *stmts_label = new Unnamed_label(UNKNOWN_LOCATION);
+ *stmts_label = new Unnamed_label(Linemap::unknown_location());
dest = *stmts_label;
}
Block* then_block = new Block(b, loc);
@@ -4022,7 +4022,7 @@ Type_case_clauses::Type_case_clause::lower(Block* b,
go_assert(next_case_label == NULL);
else
{
- source_location gloc = (this->statements_ == NULL
+ Location gloc = (this->statements_ == NULL
? loc
: this->statements_->end_location());
b->add_statement(Statement::make_goto_unnamed_statement(break_label,
@@ -4169,7 +4169,7 @@ Statement*
Type_switch_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
Statement_inserter*)
{
- const source_location loc = this->location();
+ const Location loc = this->location();
if (this->clauses_ != NULL)
this->clauses_->check_duplicates();
@@ -4268,7 +4268,7 @@ Type_switch_statement::do_dump_statement(Ast_dump_context* ast_dump_context)
Type_switch_statement*
Statement::make_type_switch_statement(Named_object* var, Expression* expr,
- source_location location)
+ Location location)
{
return new Type_switch_statement(var, expr, location);
}
@@ -4334,7 +4334,7 @@ Send_statement::do_check_types(Gogo*)
Bstatement*
Send_statement::do_get_backend(Translate_context* context)
{
- source_location loc = this->location();
+ Location loc = this->location();
Channel_type* channel_type = this->channel_->type()->channel_type();
Type* element_type = channel_type->element_type();
@@ -4450,7 +4450,7 @@ Send_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
Send_statement*
Statement::make_send_statement(Expression* channel, Expression* val,
- source_location location)
+ Location location)
{
return new Send_statement(channel, val, location);
}
@@ -4505,7 +4505,7 @@ Select_clauses::Select_clause::lower(Gogo* gogo, Named_object* function,
return;
}
- source_location loc = this->location_;
+ Location loc = this->location_;
// Evaluate the channel before the select statement.
Temporary_statement* channel_temp = Statement::make_temporary(NULL,
@@ -4767,7 +4767,7 @@ Select_clauses::may_fall_through() const
Bstatement*
Select_clauses::get_backend(Translate_context* context,
Unnamed_label *break_label,
- source_location location)
+ Location location)
{
size_t count = this->clauses_.size();
@@ -4941,7 +4941,7 @@ Select_clauses::get_backend(Translate_context* context,
void
Select_clauses::add_clause_backend(
Translate_context* context,
- source_location location,
+ Location location,
int index,
int case_value,
Select_clause* clause,
@@ -4957,7 +4957,7 @@ Select_clauses::add_clause_backend(
Bstatement* s = clause->get_statements_backend(context);
- source_location gloc = (clause->statements() == NULL
+ Location gloc = (clause->statements() == NULL
? clause->location()
: clause->statements()->end_location());
Bstatement* g = bottom_label->get_goto(context, gloc);
@@ -5038,7 +5038,7 @@ Select_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
// Make a select statement.
Select_statement*
-Statement::make_select_statement(source_location location)
+Statement::make_select_statement(Location location)
{
return new Select_statement(location);
}
@@ -5076,7 +5076,7 @@ For_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
Statement_inserter*)
{
Statement* s;
- source_location loc = this->location();
+ Location loc = this->location();
Block* b = new Block(enclosing, this->location());
if (this->init_ != NULL)
@@ -5100,7 +5100,7 @@ For_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
this->statements_->start_location());
b->add_statement(s);
- source_location end_loc = this->statements_->end_location();
+ Location end_loc = this->statements_->end_location();
Unnamed_label* cont = this->continue_label_;
if (cont != NULL)
@@ -5120,7 +5120,7 @@ For_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
{
b->add_statement(Statement::make_unnamed_label_statement(entry));
- source_location cond_loc = this->cond_->location();
+ Location cond_loc = this->cond_->location();
Block* then_block = new Block(b, cond_loc);
s = Statement::make_goto_unnamed_statement(top, cond_loc);
then_block->add_statement(s);
@@ -5211,7 +5211,7 @@ For_statement::do_dump_statement(Ast_dump_context* ast_dump_context) const
For_statement*
Statement::make_for_statement(Block* init, Expression* cond, Block* post,
- source_location location)
+ Location location)
{
return new For_statement(init, cond, post, location);
}
@@ -5285,7 +5285,7 @@ For_range_statement::do_lower(Gogo* gogo, Named_object*, Block* enclosing,
return Statement::make_error_statement(this->location());
}
- source_location loc = this->location();
+ Location loc = this->location();
Block* temp_block = new Block(enclosing, loc);
Named_object* range_object = NULL;
@@ -5388,7 +5388,7 @@ For_range_statement::do_lower(Gogo* gogo, Named_object*, Block* enclosing,
Expression*
For_range_statement::make_range_ref(Named_object* range_object,
Temporary_statement* range_temp,
- source_location loc)
+ Location loc)
{
if (range_object != NULL)
return Expression::make_var_reference(range_object, loc);
@@ -5402,7 +5402,7 @@ For_range_statement::make_range_ref(Named_object* range_object,
Expression*
For_range_statement::call_builtin(Gogo* gogo, const char* funcname,
Expression* arg,
- source_location loc)
+ Location loc)
{
Named_object* no = gogo->lookup_global(funcname);
go_assert(no != NULL && no->is_function_declaration());
@@ -5427,7 +5427,7 @@ For_range_statement::lower_range_array(Gogo* gogo,
Block** piter_init,
Block** ppost)
{
- source_location loc = this->location();
+ Location loc = this->location();
// The loop we generate:
// len_temp := len(range)
@@ -5519,7 +5519,7 @@ For_range_statement::lower_range_string(Gogo*,
Block** piter_init,
Block** ppost)
{
- source_location loc = this->location();
+ Location loc = this->location();
// The loop we generate:
// var next_index_temp int
@@ -5647,7 +5647,7 @@ For_range_statement::lower_range_map(Gogo*,
Block** piter_init,
Block** ppost)
{
- source_location loc = this->location();
+ Location loc = this->location();
// The runtime uses a struct to handle ranges over a map. The
// struct is four pointers long. The first pointer is NULL when we
@@ -5752,7 +5752,7 @@ For_range_statement::lower_range_channel(Gogo*,
{
go_assert(value_temp == NULL);
- source_location loc = this->location();
+ Location loc = this->location();
// The loop we generate:
// for {
@@ -5863,7 +5863,7 @@ For_range_statement*
Statement::make_for_range_statement(Expression* index_var,
Expression* value_var,
Expression* range,
- source_location location)
+ Location location)
{
return new For_range_statement(index_var, value_var, range, location);
}
diff --git a/gcc/go/gofrontend/statements.h b/gcc/go/gofrontend/statements.h
index 86b0f305148..16914f16c37 100644
--- a/gcc/go/gofrontend/statements.h
+++ b/gcc/go/gofrontend/statements.h
@@ -123,7 +123,7 @@ class Statement
STATEMENT_TYPE_SWITCH
};
- Statement(Statement_classification, source_location);
+ Statement(Statement_classification, Location);
virtual ~Statement();
@@ -139,30 +139,30 @@ class Statement
// Either the type or the initialization expression may be NULL, but
// not both.
static Temporary_statement*
- make_temporary(Type*, Expression*, source_location);
+ make_temporary(Type*, Expression*, Location);
// Make an assignment statement.
static Statement*
- make_assignment(Expression*, Expression*, source_location);
+ make_assignment(Expression*, Expression*, Location);
// Make an assignment operation (+=, etc.).
static Statement*
make_assignment_operation(Operator, Expression*, Expression*,
- source_location);
+ Location);
// Make a tuple assignment statement.
static Statement*
- make_tuple_assignment(Expression_list*, Expression_list*, source_location);
+ make_tuple_assignment(Expression_list*, Expression_list*, Location);
// Make an assignment from a map index to a pair of variables.
static Statement*
make_tuple_map_assignment(Expression* val, Expression* present,
- Expression*, source_location);
+ Expression*, Location);
// Make a statement which assigns a pair of values to a map.
static Statement*
make_map_assignment(Expression*, Expression* val,
- Expression* should_set, source_location);
+ Expression* should_set, Location);
// Make an assignment from a nonblocking receive to a pair of
// variables. FOR_SELECT is true is this is being created for a
@@ -170,13 +170,13 @@ class Statement
static Statement*
make_tuple_receive_assignment(Expression* val, Expression* closed,
Expression* channel, bool for_select,
- source_location);
+ Location);
// Make an assignment from a type guard to a pair of variables.
static Statement*
make_tuple_type_guard_assignment(Expression* val, Expression* ok,
Expression* expr, Type* type,
- source_location);
+ Location);
// Make an expression statement from an Expression. IS_IGNORED is
// true if the value is being explicitly ignored, as in an
@@ -187,7 +187,7 @@ class Statement
// Make a block statement from a Block. This is an embedded list of
// statements which may also include variable definitions.
static Statement*
- make_block_statement(Block*, source_location);
+ make_block_statement(Block*, Location);
// Make an increment statement.
static Statement*
@@ -199,35 +199,35 @@ class Statement
// Make a go statement.
static Statement*
- make_go_statement(Call_expression* call, source_location);
+ make_go_statement(Call_expression* call, Location);
// Make a defer statement.
static Statement*
- make_defer_statement(Call_expression* call, source_location);
+ make_defer_statement(Call_expression* call, Location);
// Make a return statement.
static Return_statement*
- make_return_statement(Expression_list*, source_location);
+ make_return_statement(Expression_list*, Location);
// Make a break statement.
static Statement*
- make_break_statement(Unnamed_label* label, source_location);
+ make_break_statement(Unnamed_label* label, Location);
// Make a continue statement.
static Statement*
- make_continue_statement(Unnamed_label* label, source_location);
+ make_continue_statement(Unnamed_label* label, Location);
// Make a goto statement.
static Statement*
- make_goto_statement(Label* label, source_location);
+ make_goto_statement(Label* label, Location);
// Make a goto statement to an unnamed label.
static Statement*
- make_goto_unnamed_statement(Unnamed_label* label, source_location);
+ make_goto_unnamed_statement(Unnamed_label* label, Location);
// Make a label statement--where the label is defined.
static Statement*
- make_label_statement(Label* label, source_location);
+ make_label_statement(Label* label, Location);
// Make an unnamed label statement--where the label is defined.
static Statement*
@@ -236,33 +236,33 @@ class Statement
// Make an if statement.
static Statement*
make_if_statement(Expression* cond, Block* then_block, Block* else_block,
- source_location);
+ Location);
// Make a switch statement.
static Switch_statement*
- make_switch_statement(Expression* switch_val, source_location);
+ make_switch_statement(Expression* switch_val, Location);
// Make a type switch statement.
static Type_switch_statement*
- make_type_switch_statement(Named_object* var, Expression*, source_location);
+ make_type_switch_statement(Named_object* var, Expression*, Location);
// Make a send statement.
static Send_statement*
- make_send_statement(Expression* channel, Expression* val, source_location);
+ make_send_statement(Expression* channel, Expression* val, Location);
// Make a select statement.
static Select_statement*
- make_select_statement(source_location);
+ make_select_statement(Location);
// Make a for statement.
static For_statement*
make_for_statement(Block* init, Expression* cond, Block* post,
- source_location location);
+ Location location);
// Make a for statement with a range clause.
static For_range_statement*
make_for_range_statement(Expression* index_var, Expression* value_var,
- Expression* range, source_location);
+ Expression* range, Location);
// Return the statement classification.
Statement_classification
@@ -270,7 +270,7 @@ class Statement
{ return this->classification_; }
// Get the statement location.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -448,7 +448,7 @@ class Statement
// For children to return an error statement from lower().
static Statement*
- make_error_statement(source_location);
+ make_error_statement(Location);
private:
// Convert to the desired statement classification, or return NULL.
@@ -474,7 +474,7 @@ class Statement
// The statement classification.
Statement_classification classification_;
// The location in the input file of the start of this statement.
- source_location location_;
+ Location location_;
};
// A statement which creates and initializes a temporary variable.
@@ -482,7 +482,7 @@ class Statement
class Temporary_statement : public Statement
{
public:
- Temporary_statement(Type* type, Expression* init, source_location location)
+ Temporary_statement(Type* type, Expression* init, Location location)
: Statement(STATEMENT_TEMPORARY, location),
type_(type), init_(init), bvariable_(NULL), are_hidden_fields_ok_(false),
is_address_taken_(false)
@@ -579,7 +579,7 @@ class Variable_declaration_statement : public Statement
class Return_statement : public Statement
{
public:
- Return_statement(Expression_list* vals, source_location location)
+ Return_statement(Expression_list* vals, Location location)
: Statement(STATEMENT_RETURN, location),
vals_(vals), are_hidden_fields_ok_(false), is_lowered_(false)
{ }
@@ -632,7 +632,7 @@ class Send_statement : public Statement
{
public:
Send_statement(Expression* channel, Expression* val,
- source_location location)
+ Location location)
: Statement(STATEMENT_SEND, location),
channel_(channel), val_(val), for_select_(false)
{ }
@@ -691,7 +691,7 @@ class Select_clauses
void
add(bool is_send, Expression* channel, Expression* val, Expression* closed,
Named_object* var, Named_object* closedvar, bool is_default,
- Block* statements, source_location location)
+ Block* statements, Location location)
{
this->clauses_.push_back(Select_clause(is_send, channel, val, closed, var,
closedvar, is_default, statements,
@@ -717,7 +717,7 @@ class Select_clauses
// Convert to the backend representation.
Bstatement*
- get_backend(Translate_context*, Unnamed_label* break_label, source_location);
+ get_backend(Translate_context*, Unnamed_label* break_label, Location);
// Dump AST representation.
void
@@ -737,7 +737,7 @@ class Select_clauses
Select_clause(bool is_send, Expression* channel, Expression* val,
Expression* closed, Named_object* var,
Named_object* closedvar, bool is_default, Block* statements,
- source_location location)
+ Location location)
: channel_(channel), val_(val), closed_(closed), var_(var),
closedvar_(closedvar), statements_(statements), location_(location),
is_send_(is_send), is_default_(is_default), is_lowered_(false)
@@ -780,7 +780,7 @@ class Select_clauses
{ return this->statements_; }
// Return the location.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -813,7 +813,7 @@ class Select_clauses
// The statements to execute.
Block* statements_;
// The location of this clause.
- source_location location_;
+ Location location_;
// Whether this is a send or a receive.
bool is_send_;
// Whether this is the default.
@@ -823,7 +823,7 @@ class Select_clauses
};
void
- add_clause_backend(Translate_context*, source_location, int index,
+ add_clause_backend(Translate_context*, Location, int index,
int case_value, Select_clause*, Unnamed_label*,
std::vector<std::vector<Bexpression*> >* cases,
std::vector<Bstatement*>* clauses);
@@ -838,7 +838,7 @@ class Select_clauses
class Select_statement : public Statement
{
public:
- Select_statement(source_location location)
+ Select_statement(Location location)
: Statement(STATEMENT_SELECT, location),
clauses_(NULL), break_label_(NULL), is_lowered_(false)
{ }
@@ -892,7 +892,7 @@ class Thunk_statement : public Statement
{
public:
Thunk_statement(Statement_classification, Call_expression*,
- source_location);
+ Location);
// Return the call expression.
Expression*
@@ -955,7 +955,7 @@ class Thunk_statement : public Statement
class Go_statement : public Thunk_statement
{
public:
- Go_statement(Call_expression* call, source_location location)
+ Go_statement(Call_expression* call, Location location)
: Thunk_statement(STATEMENT_GO, call, location)
{ }
@@ -972,7 +972,7 @@ class Go_statement : public Thunk_statement
class Defer_statement : public Thunk_statement
{
public:
- Defer_statement(Call_expression* call, source_location location)
+ Defer_statement(Call_expression* call, Location location)
: Thunk_statement(STATEMENT_DEFER, call, location)
{ }
@@ -989,7 +989,7 @@ class Defer_statement : public Thunk_statement
class Label_statement : public Statement
{
public:
- Label_statement(Label* label, source_location location)
+ Label_statement(Label* label, Location location)
: Statement(STATEMENT_LABEL, location),
label_(label)
{ }
@@ -1020,7 +1020,7 @@ class For_statement : public Statement
{
public:
For_statement(Block* init, Expression* cond, Block* post,
- source_location location)
+ Location location)
: Statement(STATEMENT_FOR, location),
init_(init), cond_(cond), post_(post), statements_(NULL),
break_label_(NULL), continue_label_(NULL)
@@ -1086,7 +1086,7 @@ class For_range_statement : public Statement
{
public:
For_range_statement(Expression* index_var, Expression* value_var,
- Expression* range, source_location location)
+ Expression* range, Location location)
: Statement(STATEMENT_FOR_RANGE, location),
index_var_(index_var), value_var_(value_var), range_(range),
statements_(NULL), break_label_(NULL), continue_label_(NULL)
@@ -1128,10 +1128,10 @@ class For_range_statement : public Statement
private:
Expression*
- make_range_ref(Named_object*, Temporary_statement*, source_location);
+ make_range_ref(Named_object*, Temporary_statement*, Location);
Expression*
- call_builtin(Gogo*, const char* funcname, Expression* arg, source_location);
+ call_builtin(Gogo*, const char* funcname, Expression* arg, Location);
void
lower_range_array(Gogo*, Block*, Block*, Named_object*, Temporary_statement*,
@@ -1186,7 +1186,7 @@ class Case_clauses
// next clause.
void
add(Expression_list* cases, bool is_default, Block* statements,
- bool is_fallthrough, source_location location)
+ bool is_fallthrough, Location location)
{
this->clauses_.push_back(Case_clause(cases, is_default, statements,
is_fallthrough, location));
@@ -1252,7 +1252,7 @@ class Case_clauses
{ }
Case_clause(Expression_list* cases, bool is_default, Block* statements,
- bool is_fallthrough, source_location location)
+ bool is_fallthrough, Location location)
: cases_(cases), statements_(statements), is_default_(is_default),
is_fallthrough_(is_fallthrough), location_(location)
{ }
@@ -1268,7 +1268,7 @@ class Case_clauses
{ return this->is_default_; }
// The location of this clause.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1318,7 +1318,7 @@ class Case_clauses
// Whether this falls through after the statements.
bool is_fallthrough_;
// The location of this case clause.
- source_location location_;
+ Location location_;
};
friend class Case_clause;
@@ -1335,7 +1335,7 @@ class Case_clauses
class Switch_statement : public Statement
{
public:
- Switch_statement(Expression* val, source_location location)
+ Switch_statement(Expression* val, Location location)
: Statement(STATEMENT_SWITCH, location),
val_(val), clauses_(NULL), break_label_(NULL)
{ }
@@ -1392,7 +1392,7 @@ class Type_case_clauses
// statements; it may be NULL.
void
add(Type* type, bool is_fallthrough, bool is_default, Block* statements,
- source_location location)
+ Location location)
{
this->clauses_.push_back(Type_case_clause(type, is_fallthrough, is_default,
statements, location));
@@ -1431,7 +1431,7 @@ class Type_case_clauses
{ }
Type_case_clause(Type* type, bool is_fallthrough, bool is_default,
- Block* statements, source_location location)
+ Block* statements, Location location)
: type_(type), statements_(statements), is_fallthrough_(is_fallthrough),
is_default_(is_default), location_(location)
{ }
@@ -1447,7 +1447,7 @@ class Type_case_clauses
{ return this->is_default_; }
// The location of this type clause.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1474,7 +1474,7 @@ class Type_case_clauses
// Whether this is the default case.
bool is_default_;
// The location of this type case clause.
- source_location location_;
+ Location location_;
};
friend class Type_case_clause;
@@ -1492,7 +1492,7 @@ class Type_switch_statement : public Statement
{
public:
Type_switch_statement(Named_object* var, Expression* expr,
- source_location location)
+ Location location)
: Statement(STATEMENT_TYPE_SWITCH, location),
var_(var), expr_(expr), clauses_(NULL), break_label_(NULL)
{ go_assert(var == NULL || expr == NULL); }
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index c596de95b44..74d9765c5d9 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -853,7 +853,7 @@ Type::get_btype_without_hash(Gogo* gogo)
// Return a pointer to the type descriptor for this type.
tree
-Type::type_descriptor_pointer(Gogo* gogo, source_location location)
+Type::type_descriptor_pointer(Gogo* gogo, Location location)
{
Type* t = this->forwarded();
if (t->type_descriptor_var_ == NULL)
@@ -864,7 +864,7 @@ Type::type_descriptor_pointer(Gogo* gogo, source_location location)
tree var_tree = var_to_tree(t->type_descriptor_var_);
if (var_tree == error_mark_node)
return error_mark_node;
- return build_fold_addr_expr_loc(location, var_tree);
+ return build_fold_addr_expr_loc(location.gcc_location(), var_tree);
}
// A mapping from unnamed types to type descriptor variables.
@@ -934,7 +934,7 @@ Type::make_type_descriptor_var(Gogo* gogo)
}
}
- source_location loc = nt == NULL ? BUILTINS_LOCATION : nt->location();
+ Location loc = nt == NULL ? Linemap::predeclared_location() : nt->location();
if (is_defined_elsewhere)
{
@@ -1054,7 +1054,7 @@ Type::make_builtin_struct_type(int nfields, ...)
va_list ap;
va_start(ap, nfields);
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Struct_field_list* sfl = new Struct_field_list();
for (int i = 0; i < nfields; i++)
{
@@ -1077,7 +1077,7 @@ std::vector<Named_type*> Type::named_builtin_types;
Named_type*
Type::make_builtin_named_type(const char* name, Type* type)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Named_object* no = Named_object::make_type(name, NULL, type, bloc);
Named_type* ret = no->type_value();
Type::named_builtin_types.push_back(ret);
@@ -1110,7 +1110,7 @@ Type::make_type_descriptor_type()
static Type* ret;
if (ret == NULL)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Type* uint8_type = Type::lookup_integer_type("uint8");
Type* uint32_type = Type::lookup_integer_type("uint32");
@@ -1286,7 +1286,7 @@ Type::type_descriptor_constructor(Gogo* gogo, int runtime_type_kind,
Named_type* name, const Methods* methods,
bool only_value_methods)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Type* td_type = Type::make_type_descriptor_type();
const Struct_field_list* fields = td_type->struct_type()->fields();
@@ -1394,7 +1394,7 @@ Type::uncommon_type_constructor(Gogo* gogo, Type* uncommon_type,
Named_type* name, const Methods* methods,
bool only_value_methods) const
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
const Struct_field_list* fields = uncommon_type->struct_type()->fields();
@@ -1477,7 +1477,7 @@ Type::methods_constructor(Gogo* gogo, Type* methods_type,
const Methods* methods,
bool only_value_methods) const
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
std::vector<std::pair<std::string, const Method*> > smethods;
if (methods != NULL)
@@ -1524,7 +1524,7 @@ Type::method_constructor(Gogo*, Type* method_type,
const Method* m,
bool only_value_methods) const
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
const Struct_field_list* fields = method_type->struct_type()->fields();
@@ -1688,7 +1688,7 @@ class Error_type : public Type
Expression*
do_type_descriptor(Gogo*, Named_type*)
- { return Expression::make_error(BUILTINS_LOCATION); }
+ { return Expression::make_error(Linemap::predeclared_location()); }
void
do_reflection(Gogo*, std::string*) const
@@ -1807,9 +1807,9 @@ Named_type*
Type::make_named_bool_type()
{
Type* bool_type = Type::make_boolean_type();
- Named_object* named_object = Named_object::make_type("bool", NULL,
- bool_type,
- BUILTINS_LOCATION);
+ Named_object* named_object =
+ Named_object::make_type("bool", NULL, bool_type,
+ Linemap::predeclared_location());
Named_type* named_type = named_object->type_value();
named_bool_type = named_type;
return named_type;
@@ -1829,9 +1829,9 @@ Integer_type::create_integer_type(const char* name, bool is_unsigned,
Integer_type* integer_type = new Integer_type(false, is_unsigned, bits,
runtime_type_kind);
std::string sname(name);
- Named_object* named_object = Named_object::make_type(sname, NULL,
- integer_type,
- BUILTINS_LOCATION);
+ Named_object* named_object =
+ Named_object::make_type(sname, NULL, integer_type,
+ Linemap::predeclared_location());
Named_type* named_type = named_object->type_value();
std::pair<Named_integer_types::iterator, bool> ins =
Integer_type::named_integer_types.insert(std::make_pair(sname, named_type));
@@ -1965,8 +1965,9 @@ Float_type::create_float_type(const char* name, int bits,
{
Float_type* float_type = new Float_type(false, bits, runtime_type_kind);
std::string sname(name);
- Named_object* named_object = Named_object::make_type(sname, NULL, float_type,
- BUILTINS_LOCATION);
+ Named_object* named_object =
+ Named_object::make_type(sname, NULL, float_type,
+ Linemap::predeclared_location());
Named_type* named_type = named_object->type_value();
std::pair<Named_float_types::iterator, bool> ins =
Float_type::named_float_types.insert(std::make_pair(sname, named_type));
@@ -2089,9 +2090,9 @@ Complex_type::create_complex_type(const char* name, int bits,
Complex_type* complex_type = new Complex_type(false, bits,
runtime_type_kind);
std::string sname(name);
- Named_object* named_object = Named_object::make_type(sname, NULL,
- complex_type,
- BUILTINS_LOCATION);
+ Named_object* named_object =
+ Named_object::make_type(sname, NULL, complex_type,
+ Linemap::predeclared_location());
Named_type* named_type = named_object->type_value();
std::pair<Named_complex_types::iterator, bool> ins =
Complex_type::named_complex_types.insert(std::make_pair(sname,
@@ -2219,12 +2220,12 @@ String_type::do_get_backend(Gogo* gogo)
Type* pb = Type::make_pointer_type(b);
fields[0].name = "__data";
fields[0].btype = pb->get_backend(gogo);
- fields[0].location = UNKNOWN_LOCATION;
+ fields[0].location = Linemap::predeclared_location();
Type* int_type = Type::lookup_integer_type("int");
fields[1].name = "__length";
fields[1].btype = int_type->get_backend(gogo);
- fields[1].location = UNKNOWN_LOCATION;
+ fields[1].location = fields[0].location;
backend_string_type = gogo->backend()->struct_type(fields);
}
@@ -2317,9 +2318,9 @@ Named_type*
Type::make_named_string_type()
{
Type* string_type = Type::make_string_type();
- Named_object* named_object = Named_object::make_type("string", NULL,
- string_type,
- BUILTINS_LOCATION);
+ Named_object* named_object =
+ Named_object::make_type("string", NULL, string_type,
+ Linemap::predeclared_location());
Named_type* named_type = named_object->type_value();
named_string_type = named_type;
return named_type;
@@ -2742,7 +2743,7 @@ Function_type::make_function_type_descriptor_type()
Expression*
Function_type::do_type_descriptor(Gogo* gogo, Named_type* name)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Type* ftdt = Function_type::make_function_type_descriptor_type();
@@ -2785,7 +2786,7 @@ Function_type::type_descriptor_params(Type* params_type,
const Typed_identifier* receiver,
const Typed_identifier_list* params)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
if (receiver == NULL && params == NULL)
return Expression::make_slice_composite_literal(params_type, NULL, bloc);
@@ -3073,7 +3074,7 @@ Function_type*
Type::make_function_type(Typed_identifier* receiver,
Typed_identifier_list* parameters,
Typed_identifier_list* results,
- source_location location)
+ Location location)
{
return new Function_type(receiver, parameters, results, location);
}
@@ -3140,7 +3141,7 @@ Pointer_type::do_type_descriptor(Gogo* gogo, Named_type* name)
}
else
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
const Methods* methods;
Type* deref = this->points_to();
@@ -3302,7 +3303,7 @@ class Call_multiple_result_type : public Type
do_type_descriptor(Gogo*, Named_type*)
{
go_assert(saw_errors());
- return Expression::make_error(UNKNOWN_LOCATION);
+ return Expression::make_error(Linemap::unknown_location());
}
void
@@ -3609,7 +3610,7 @@ Struct_type::find_local_field(const std::string& name,
Field_reference_expression*
Struct_type::field_reference(Expression* struct_expr, const std::string& name,
- source_location location) const
+ Location location) const
{
unsigned int depth;
return this->field_reference_depth(struct_expr, name, location, NULL,
@@ -3622,7 +3623,7 @@ Struct_type::field_reference(Expression* struct_expr, const std::string& name,
Field_reference_expression*
Struct_type::field_reference_depth(Expression* struct_expr,
const std::string& name,
- source_location location,
+ Location location,
Saw_named_type* saw,
unsigned int* depth) const
{
@@ -3867,7 +3868,7 @@ Struct_type::make_struct_type_descriptor_type()
Expression*
Struct_type::do_type_descriptor(Gogo* gogo, Named_type* name)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Type* stdt = Struct_type::make_struct_type_descriptor_type();
@@ -4081,8 +4082,8 @@ Struct_type::do_export(Export* exp) const
if (p->has_tag())
{
exp->write_c_string(" ");
- Expression* expr = Expression::make_string(p->tag(),
- BUILTINS_LOCATION);
+ Expression* expr =
+ Expression::make_string(p->tag(), Linemap::predeclared_location());
expr->export_expression(exp);
delete expr;
}
@@ -4140,7 +4141,7 @@ Struct_type::do_import(Import* imp)
Struct_type*
Type::make_struct_type(Struct_field_list* fields,
- source_location location)
+ Location location)
{
return new Struct_type(fields, location);
}
@@ -4356,23 +4357,24 @@ get_backend_slice_fields(Gogo* gogo, Array_type* type,
Type* pet = Type::make_pointer_type(type->element_type());
Btype* pbet = pet->get_backend(gogo);
+ Location ploc = Linemap::predeclared_location();
Backend::Btyped_identifier* p = &(*bfields)[0];
p->name = "__values";
p->btype = pbet;
- p->location = UNKNOWN_LOCATION;
+ p->location = ploc;
Type* int_type = Type::lookup_integer_type("int");
p = &(*bfields)[1];
p->name = "__count";
p->btype = int_type->get_backend(gogo);
- p->location = UNKNOWN_LOCATION;
+ p->location = ploc;
p = &(*bfields)[2];
p->name = "__capacity";
p->btype = int_type->get_backend(gogo);
- p->location = UNKNOWN_LOCATION;
+ p->location = ploc;
}
// Get a tree for the type of this array. A fixed array is simply
@@ -4579,7 +4581,7 @@ Array_type::do_type_descriptor(Gogo* gogo, Named_type* name)
Expression*
Array_type::array_type_descriptor(Gogo* gogo, Named_type* name)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Type* atdt = Array_type::make_array_type_descriptor_type();
@@ -4618,7 +4620,7 @@ Array_type::array_type_descriptor(Gogo* gogo, Named_type* name)
Expression*
Array_type::slice_type_descriptor(Gogo* gogo, Named_type* name)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Type* stdt = Array_type::make_slice_type_descriptor_type();
@@ -4772,29 +4774,31 @@ Map_type::do_get_backend(Gogo* gogo)
{
std::vector<Backend::Btyped_identifier> bfields(4);
+ Location bloc = Linemap::predeclared_location();
+
Type* pdt = Type::make_type_descriptor_ptr_type();
bfields[0].name = "__descriptor";
bfields[0].btype = pdt->get_backend(gogo);
- bfields[0].location = BUILTINS_LOCATION;
+ bfields[0].location = bloc;
Type* uintptr_type = Type::lookup_integer_type("uintptr");
bfields[1].name = "__element_count";
bfields[1].btype = uintptr_type->get_backend(gogo);
- bfields[1].location = BUILTINS_LOCATION;
+ bfields[1].location = bloc;
bfields[2].name = "__bucket_count";
bfields[2].btype = bfields[1].btype;
- bfields[2].location = BUILTINS_LOCATION;
+ bfields[2].location = bloc;
Btype* bvt = gogo->backend()->void_type();
Btype* bpvt = gogo->backend()->pointer_type(bvt);
Btype* bppvt = gogo->backend()->pointer_type(bpvt);
bfields[3].name = "__buckets";
bfields[3].btype = bppvt;
- bfields[3].location = BUILTINS_LOCATION;
+ bfields[3].location = bloc;
Btype *bt = gogo->backend()->struct_type(bfields);
- bt = gogo->backend()->named_type("__go_map", bt, BUILTINS_LOCATION);
+ bt = gogo->backend()->named_type("__go_map", bt, bloc);
backend_map_type = gogo->backend()->pointer_type(bt);
}
return backend_map_type;
@@ -4828,7 +4832,7 @@ Map_type::make_map_type_descriptor_type()
Expression*
Map_type::do_type_descriptor(Gogo* gogo, Named_type* name)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Type* mtdt = Map_type::make_map_type_descriptor_type();
@@ -4864,13 +4868,13 @@ Map_type::Map_descriptors Map_type::map_descriptors;
// Build a map descriptor for this type. Return a pointer to it.
tree
-Map_type::map_descriptor_pointer(Gogo* gogo, source_location location)
+Map_type::map_descriptor_pointer(Gogo* gogo, Location location)
{
Bvariable* bvar = this->map_descriptor(gogo);
tree var_tree = var_to_tree(bvar);
if (var_tree == error_mark_node)
return error_mark_node;
- return build_fold_addr_expr_loc(location, var_tree);
+ return build_fold_addr_expr_loc(location.gcc_location(), var_tree);
}
// Build a map descriptor for this type.
@@ -4907,7 +4911,7 @@ Map_type::map_descriptor(Gogo* gogo)
Expression_list* vals = new Expression_list();
vals->reserve(4);
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Struct_field_list::const_iterator p = fields->begin();
@@ -5028,7 +5032,7 @@ Map_type::do_import(Import* imp)
// Make a map type.
Map_type*
-Type::make_map_type(Type* key_type, Type* val_type, source_location location)
+Type::make_map_type(Type* key_type, Type* val_type, Location location)
{
return new Map_type(key_type, val_type, location);
}
@@ -5075,7 +5079,8 @@ Channel_type::do_get_backend(Gogo* gogo)
{
std::vector<Backend::Btyped_identifier> bfields;
Btype* bt = gogo->backend()->struct_type(bfields);
- bt = gogo->backend()->named_type("__go_channel", bt, BUILTINS_LOCATION);
+ bt = gogo->backend()->named_type("__go_channel", bt,
+ Linemap::predeclared_location());
backend_channel_type = gogo->backend()->pointer_type(bt);
}
return backend_channel_type;
@@ -5111,7 +5116,7 @@ Channel_type::make_chan_type_descriptor_type()
Expression*
Channel_type::do_type_descriptor(Gogo* gogo, Named_type* name)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Type* ctdt = Channel_type::make_chan_type_descriptor_type();
@@ -5670,15 +5675,17 @@ Interface_type::get_backend_empty_interface_type(Gogo* gogo)
{
std::vector<Backend::Btyped_identifier> bfields(2);
+ Location bloc = Linemap::predeclared_location();
+
Type* pdt = Type::make_type_descriptor_ptr_type();
bfields[0].name = "__type_descriptor";
bfields[0].btype = pdt->get_backend(gogo);
- bfields[0].location = UNKNOWN_LOCATION;
+ bfields[0].location = bloc;
Type* vt = Type::make_pointer_type(Type::make_void_type());
bfields[1].name = "__object";
bfields[1].btype = vt->get_backend(gogo);
- bfields[1].location = UNKNOWN_LOCATION;
+ bfields[1].location = bloc;
empty_interface_type = gogo->backend()->struct_type(bfields);
}
@@ -5693,7 +5700,7 @@ static void
get_backend_interface_fields(Gogo* gogo, Interface_type* type,
std::vector<Backend::Btyped_identifier>* bfields)
{
- source_location loc = type->location();
+ Location loc = type->location();
std::vector<Backend::Btyped_identifier> mfields(type->methods()->size() + 1);
@@ -5727,7 +5734,7 @@ get_backend_interface_fields(Gogo* gogo, Interface_type* type,
Type* vt = Type::make_pointer_type(Type::make_void_type());
(*bfields)[1].name = "__object";
(*bfields)[1].btype = vt->get_backend(gogo);
- (*bfields)[1].location = UNKNOWN_LOCATION;
+ (*bfields)[1].location = Linemap::predeclared_location();
}
// Return a tree for an interface type. An interface is a pointer to
@@ -5789,7 +5796,7 @@ Interface_type::make_interface_type_descriptor_type()
Expression*
Interface_type::do_type_descriptor(Gogo* gogo, Named_type* name)
{
- source_location bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
Type* itdt = Interface_type::make_interface_type_descriptor_type();
@@ -5800,9 +5807,9 @@ Interface_type::do_type_descriptor(Gogo* gogo, Named_type* name)
Struct_field_list::const_iterator pif = ifields->begin();
go_assert(pif->is_field_name("commonType"));
- ivals->push_back(this->type_descriptor_constructor(gogo,
- RUNTIME_TYPE_KIND_INTERFACE,
- name, NULL, true));
+ const int rt = RUNTIME_TYPE_KIND_INTERFACE;
+ ivals->push_back(this->type_descriptor_constructor(gogo, rt, name, NULL,
+ true));
++pif;
go_assert(pif->is_field_name("methods"));
@@ -6095,7 +6102,7 @@ Interface_type::do_import(Import* imp)
Interface_type*
Type::make_interface_type(Typed_identifier_list* methods,
- source_location location)
+ Location location)
{
return new Interface_type(methods, location);
}
@@ -6105,7 +6112,7 @@ Type::make_interface_type(Typed_identifier_list* methods,
// Bind a method to an object.
Expression*
-Method::bind_method(Expression* expr, source_location location) const
+Method::bind_method(Expression* expr, Location location) const
{
if (this->stub_ == NULL)
{
@@ -6144,7 +6151,7 @@ Named_method::do_type() const
// Return the location of the method receiver.
-source_location
+Location
Named_method::do_receiver_location() const
{
return this->do_type()->receiver()->location();
@@ -6153,7 +6160,7 @@ Named_method::do_receiver_location() const
// Bind a method to an object.
Expression*
-Named_method::do_bind_method(Expression* expr, source_location location) const
+Named_method::do_bind_method(Expression* expr, Location location) const
{
Named_object* no = this->named_object_;
Bound_method_expression* bme = Expression::make_bound_method(expr, no,
@@ -6177,7 +6184,7 @@ Named_method::do_bind_method(Expression* expr, source_location location) const
Expression*
Interface_method::do_bind_method(Expression* expr,
- source_location location) const
+ Location location) const
{
return Expression::make_interface_field_reference(expr, this->name_,
location);
@@ -6299,7 +6306,7 @@ Named_type::add_method(const std::string& name, Function* function)
Named_object*
Named_type::add_method_declaration(const std::string& name, Package* package,
Function_type* type,
- source_location location)
+ Location location)
{
if (this->local_methods_ == NULL)
this->local_methods_ = new Bindings(NULL);
@@ -6967,7 +6974,7 @@ Named_type::do_type_descriptor(Gogo* gogo, Named_type* name)
void
Named_type::do_reflection(Gogo* gogo, std::string* ret) const
{
- if (this->location() != BUILTINS_LOCATION)
+ if (!Linemap::is_predeclared_location(this->location()))
{
const Package* package = this->named_object_->package();
if (package != NULL)
@@ -6991,7 +6998,7 @@ Named_type::do_mangled_name(Gogo* gogo, std::string* ret) const
{
Named_object* no = this->named_object_;
std::string name;
- if (this->location() == BUILTINS_LOCATION)
+ if (Linemap::is_predeclared_location(this->location()))
go_assert(this->in_function_ == NULL);
else
{
@@ -7081,7 +7088,7 @@ Named_type::do_export(Export* exp) const
Named_type*
Type::make_named_type(Named_object* named_object, Type* type,
- source_location location)
+ Location location)
{
return new Named_type(named_object, type, location);
}
@@ -7091,7 +7098,7 @@ Type::make_named_type(Named_object* named_object, Type* type,
// all required stubs.
void
-Type::finalize_methods(Gogo* gogo, const Type* type, source_location location,
+Type::finalize_methods(Gogo* gogo, const Type* type, Location location,
Methods** all_methods)
{
*all_methods = NULL;
@@ -7291,7 +7298,7 @@ Type::add_interface_methods_for_type(const Type* type,
void
Type::build_stub_methods(Gogo* gogo, const Type* type, const Methods* methods,
- source_location location)
+ Location location)
{
if (methods == NULL)
return;
@@ -7317,7 +7324,7 @@ Type::build_stub_methods(Gogo* gogo, const Type* type, const Methods* methods,
Type* receiver_type = const_cast<Type*>(type);
if (!m->is_value_method())
receiver_type = Type::make_pointer_type(receiver_type);
- source_location receiver_location = m->receiver_location();
+ Location receiver_location = m->receiver_location();
Typed_identifier* receiver = new Typed_identifier(buf, receiver_type,
receiver_location);
@@ -7397,7 +7404,7 @@ Type::build_one_stub_method(Gogo* gogo, Method* method,
const char* receiver_name,
const Typed_identifier_list* params,
bool is_varargs,
- source_location location)
+ Location location)
{
Named_object* receiver_object = gogo->lookup(receiver_name, NULL);
go_assert(receiver_object != NULL);
@@ -7460,7 +7467,7 @@ Type::build_one_stub_method(Gogo* gogo, Method* method,
Expression*
Type::apply_field_indexes(Expression* expr,
const Method::Field_indexes* field_indexes,
- source_location location)
+ Location location)
{
if (field_indexes == NULL)
return expr;
@@ -7526,7 +7533,7 @@ Type::method_function(const Methods* methods, const std::string& name,
Expression*
Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr,
const std::string& name,
- source_location location)
+ Location location)
{
if (type->deref()->is_error_type())
return Expression::make_error(location);
@@ -8040,7 +8047,7 @@ Forward_declaration_type::add_method(const std::string& name,
Named_object*
Forward_declaration_type::add_method_declaration(const std::string& name,
Function_type* type,
- source_location location)
+ Location location)
{
Named_object* no = this->named_object();
if (no->is_unknown())
@@ -8085,15 +8092,16 @@ Forward_declaration_type::do_get_backend(Gogo* gogo)
Expression*
Forward_declaration_type::do_type_descriptor(Gogo* gogo, Named_type* name)
{
+ Location ploc = Linemap::predeclared_location();
if (!this->is_defined())
- return Expression::make_nil(BUILTINS_LOCATION);
+ return Expression::make_nil(ploc);
else
{
Type* t = this->real_type();
if (name != NULL)
return this->named_type_descriptor(gogo, t, name);
else
- return Expression::make_type_descriptor(t, BUILTINS_LOCATION);
+ return Expression::make_type_descriptor(t, ploc);
}
}
diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h
index 2ec828f6b2a..035444f16af 100644
--- a/gcc/go/gofrontend/types.h
+++ b/gcc/go/gofrontend/types.h
@@ -7,6 +7,8 @@
#ifndef GO_TYPES_H
#define GO_TYPES_H
+#include "go-linemap.h"
+
class Gogo;
class Package;
class Traverse;
@@ -147,14 +149,14 @@ class Method
{ return this->do_type(); }
// Return the location of the method receiver.
- source_location
+ Location
receiver_location() const
{ return this->do_receiver_location(); }
// Return an expression which binds this method to EXPR. This is
// something which can be used with a function call.
Expression*
- bind_method(Expression* expr, source_location location) const;
+ bind_method(Expression* expr, Location location) const;
// Return the named object for this method. This may only be called
// after methods are finalized.
@@ -195,12 +197,12 @@ class Method
do_type() const = 0;
// Return the location of the method receiver.
- virtual source_location
+ virtual Location
do_receiver_location() const = 0;
// Bind a method to an object.
virtual Expression*
- do_bind_method(Expression* expr, source_location location) const = 0;
+ do_bind_method(Expression* expr, Location location) const = 0;
private:
// The sequence of field indexes used for this method. If this is
@@ -245,12 +247,12 @@ class Named_method : public Method
do_type() const;
// Return the location of the method receiver.
- source_location
+ Location
do_receiver_location() const;
// Bind a method to an object.
Expression*
- do_bind_method(Expression* expr, source_location location) const;
+ do_bind_method(Expression* expr, Location location) const;
private:
// The method itself. For a method which needs a stub, this starts
@@ -265,7 +267,7 @@ class Named_method : public Method
class Interface_method : public Method
{
public:
- Interface_method(const std::string& name, source_location location,
+ Interface_method(const std::string& name, Location location,
Function_type* fntype, const Field_indexes* field_indexes,
unsigned int depth)
: Method(field_indexes, depth, true, true),
@@ -285,19 +287,19 @@ class Interface_method : public Method
{ return this->fntype_; }
// Return the location of the method receiver.
- source_location
+ Location
do_receiver_location() const
{ return this->location_; }
// Bind a method to an object.
Expression*
- do_bind_method(Expression* expr, source_location location) const;
+ do_bind_method(Expression* expr, Location location) const;
private:
// The name of the interface method to call.
std::string name_;
// The location of the definition of the interface method.
- source_location location_;
+ Location location_;
// The type of the interface method.
Function_type* fntype_;
};
@@ -457,7 +459,7 @@ class Type
make_function_type(Typed_identifier* receiver,
Typed_identifier_list* parameters,
Typed_identifier_list* results,
- source_location);
+ Location);
static Pointer_type*
make_pointer_type(Type*);
@@ -469,19 +471,19 @@ class Type
make_call_multiple_result_type(Call_expression*);
static Struct_type*
- make_struct_type(Struct_field_list* fields, source_location);
+ make_struct_type(Struct_field_list* fields, Location);
static Array_type*
make_array_type(Type* element_type, Expression* length);
static Map_type*
- make_map_type(Type* key_type, Type* value_type, source_location);
+ make_map_type(Type* key_type, Type* value_type, Location);
static Channel_type*
make_channel_type(bool send, bool receive, Type*);
static Interface_type*
- make_interface_type(Typed_identifier_list* methods, source_location);
+ make_interface_type(Typed_identifier_list* methods, Location);
static Type*
make_type_descriptor_type();
@@ -490,7 +492,7 @@ class Type
make_type_descriptor_ptr_type();
static Named_type*
- make_named_type(Named_object*, Type*, source_location);
+ make_named_type(Named_object*, Type*, Location);
static Type*
make_forward_declaration(Named_object*);
@@ -806,7 +808,7 @@ class Type
// it, bound to EXPR.
static Expression*
bind_field_or_method(Gogo*, const Type* type, Expression* expr,
- const std::string& name, source_location);
+ const std::string& name, Location);
// Return true if NAME is an unexported field or method of TYPE.
static bool
@@ -825,7 +827,7 @@ class Type
// it. The location is the location which causes us to need the
// entry.
tree
- type_descriptor_pointer(Gogo* gogo, source_location);
+ type_descriptor_pointer(Gogo* gogo, Location);
// Return the type reflection string for this type.
std::string
@@ -889,7 +891,7 @@ class Type
// Finalize the methods for a type.
static void
- finalize_methods(Gogo*, const Type*, source_location, Methods**);
+ finalize_methods(Gogo*, const Type*, Location, Methods**);
// Return a method from a set of methods.
static Method*
@@ -1061,16 +1063,16 @@ class Type
// Build stub methods for a type.
static void
build_stub_methods(Gogo*, const Type* type, const Methods* methods,
- source_location);
+ Location);
static void
build_one_stub_method(Gogo*, Method*, const char* receiver_name,
const Typed_identifier_list*, bool is_varargs,
- source_location);
+ Location);
static Expression*
apply_field_indexes(Expression*, const Method::Field_indexes*,
- source_location);
+ Location);
// Look for a field or method named NAME in TYPE.
static bool
@@ -1129,7 +1131,7 @@ class Typed_identifier
{
public:
Typed_identifier(const std::string& name, Type* type,
- source_location location)
+ Location location)
: name_(name), type_(type), location_(location)
{ }
@@ -1145,7 +1147,7 @@ class Typed_identifier
// Return the location where the name was seen. This is not always
// meaningful.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1163,7 +1165,7 @@ class Typed_identifier
// Type.
Type* type_;
// The location where the name was seen.
- source_location location_;
+ Location location_;
};
// A list of Typed_identifiers.
@@ -1240,7 +1242,8 @@ class Typed_identifier_list
resize(size_t c)
{
go_assert(c <= this->entries_.size());
- this->entries_.resize(c, Typed_identifier("", NULL, UNKNOWN_LOCATION));
+ this->entries_.resize(c, Typed_identifier("", NULL,
+ Linemap::unknown_location()));
}
// Iterators.
@@ -1524,7 +1527,7 @@ class Function_type : public Type
{
public:
Function_type(Typed_identifier* receiver, Typed_identifier_list* parameters,
- Typed_identifier_list* results, source_location location)
+ Typed_identifier_list* results, Location location)
: Type(TYPE_FUNCTION),
receiver_(receiver), parameters_(parameters), results_(results),
location_(location), is_varargs_(false), is_builtin_(false)
@@ -1556,7 +1559,7 @@ class Function_type : public Type
{ return this->is_builtin_; }
// The location where this type was defined.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -1659,7 +1662,7 @@ class Function_type : public Type
// The location where this type was defined. This exists solely to
// give a location for the fields of the struct if this function
// returns multiple values.
- source_location location_;
+ Location location_;
// Whether this function takes a variable number of arguments.
bool is_varargs_;
// Whether this is a special builtin function which can not simply
@@ -1742,7 +1745,7 @@ class Struct_field
{ return this->typed_identifier_.type(); }
// The field location.
- source_location
+ Location
location() const
{ return this->typed_identifier_.location(); }
@@ -1845,7 +1848,7 @@ class Struct_field_list
class Struct_type : public Type
{
public:
- Struct_type(Struct_field_list* fields, source_location location)
+ Struct_type(Struct_field_list* fields, Location location)
: Type(TYPE_STRUCT),
fields_(fields), location_(location), all_methods_(NULL)
{ }
@@ -1882,7 +1885,7 @@ class Struct_type : public Type
// NULL if there is no field with that name.
Field_reference_expression*
field_reference(Expression* struct_expr, const std::string& name,
- source_location) const;
+ Location) const;
// Return the total number of fields, including embedded fields.
// This is the number of values which can appear in a conversion to
@@ -1979,13 +1982,13 @@ class Struct_type : public Type
Field_reference_expression*
field_reference_depth(Expression* struct_expr, const std::string& name,
- source_location, Saw_named_type*,
+ Location, Saw_named_type*,
unsigned int* depth) const;
// The fields of the struct.
Struct_field_list* fields_;
// The place where the struct was declared.
- source_location location_;
+ Location location_;
// If this struct is unnamed, a list of methods.
Methods* all_methods_;
};
@@ -2106,7 +2109,7 @@ class Array_type : public Type
class Map_type : public Type
{
public:
- Map_type(Type* key_type, Type* val_type, source_location location)
+ Map_type(Type* key_type, Type* val_type, Location location)
: Type(TYPE_MAP),
key_type_(key_type), val_type_(val_type), location_(location)
{ }
@@ -2139,7 +2142,7 @@ class Map_type : public Type
// The location is the location which causes us to need the
// descriptor.
tree
- map_descriptor_pointer(Gogo* gogo, source_location);
+ map_descriptor_pointer(Gogo* gogo, Location);
protected:
int
@@ -2184,7 +2187,7 @@ class Map_type : public Type
// The value type.
Type* val_type_;
// Where the type was defined.
- source_location location_;
+ Location location_;
};
// The type of a channel.
@@ -2267,13 +2270,13 @@ class Channel_type : public Type
class Interface_type : public Type
{
public:
- Interface_type(Typed_identifier_list* methods, source_location location)
+ Interface_type(Typed_identifier_list* methods, Location location)
: Type(TYPE_INTERFACE),
methods_(methods), location_(location)
{ go_assert(methods == NULL || !methods->empty()); }
// The location where the interface type was defined.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -2368,7 +2371,7 @@ class Interface_type : public Type
// NULL for the empty interface.
Typed_identifier_list* methods_;
// The location where the interface was defined.
- source_location location_;
+ Location location_;
};
// The value we keep for a named type. This lets us get the right
@@ -2380,7 +2383,7 @@ class Interface_type : public Type
class Named_type : public Type
{
public:
- Named_type(Named_object* named_object, Type* type, source_location location)
+ Named_type(Named_object* named_object, Type* type, Location location)
: Type(TYPE_NAMED),
named_object_(named_object), in_function_(NULL), type_(type),
local_methods_(NULL), all_methods_(NULL),
@@ -2436,7 +2439,7 @@ class Named_type : public Type
{ return this->type_; }
// Return the location.
- source_location
+ Location
location() const
{ return this->location_; }
@@ -2458,7 +2461,7 @@ class Named_type : public Type
// Whether this is a builtin type.
bool
is_builtin() const
- { return this->location_ == BUILTINS_LOCATION; }
+ { return Linemap::is_predeclared_location(this->location_); }
// Whether this is a circular type: a pointer or function type that
// refers to itself, which is not possible in C.
@@ -2484,7 +2487,7 @@ class Named_type : public Type
// Add a method declaration to this type.
Named_object*
add_method_declaration(const std::string& name, Package* package,
- Function_type* type, source_location location);
+ Function_type* type, Location location);
// Add an existing method--one defined before the type itself was
// defined--to a type.
@@ -2617,7 +2620,7 @@ class Named_type : public Type
// tables for pointers to this type.
Interface_method_tables* pointer_interface_method_tables_;
// The location where this type was defined.
- source_location location_;
+ Location location_;
// The backend representation of this type during backend
// conversion. This is used to avoid endless recursion when a named
// type refers to itself.
@@ -2691,7 +2694,7 @@ class Forward_declaration_type : public Type
// Add a method declaration to this type.
Named_object*
add_method_declaration(const std::string& name, Function_type*,
- source_location);
+ Location);
protected:
int
diff --git a/gcc/go/gofrontend/unsafe.cc b/gcc/go/gofrontend/unsafe.cc
index 434932bbeb0..eb9462e3693 100644
--- a/gcc/go/gofrontend/unsafe.cc
+++ b/gcc/go/gofrontend/unsafe.cc
@@ -15,9 +15,9 @@
void
Gogo::import_unsafe(const std::string& local_name, bool is_local_name_exported,
- source_location location)
+ Location location)
{
- location_t bloc = BUILTINS_LOCATION;
+ Location bloc = Linemap::predeclared_location();
bool add_to_globals;
Package* package = this->add_imported_package("unsafe", local_name,
@@ -41,7 +41,8 @@ Gogo::import_unsafe(const std::string& local_name, bool is_local_name_exported,
if (no == NULL)
{
Type* type = Type::make_pointer_type(Type::make_void_type());
- no = bindings->add_type("Pointer", package, type, UNKNOWN_LOCATION);
+ no = bindings->add_type("Pointer", package, type,
+ Linemap::unknown_location());
}
else
{
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index d87a608b901..4db23139b10 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1178,33 +1178,20 @@ recompute_todo_spec (rtx next)
regno = REGNO (XEXP (cond, 0));
/* Find the last scheduled insn that modifies the condition register.
- If we have a true dependency on it, it sets it to the correct value,
- otherwise it must be a later insn scheduled in-between that clobbers
- the condition. */
- FOR_EACH_VEC_ELT_REVERSE (rtx, scheduled_insns, i, prev)
- {
- sd_iterator_def sd_it;
- dep_t dep;
- HARD_REG_SET t;
- bool found;
-
- find_all_hard_reg_sets (prev, &t);
- if (!TEST_HARD_REG_BIT (t, regno))
- continue;
+ We can stop looking once we find the insn we depend on through the
+ REG_DEP_CONTROL; if the condition register isn't modified after it,
+ we know that it still has the right value. */
+ if (QUEUE_INDEX (pro) == QUEUE_SCHEDULED)
+ FOR_EACH_VEC_ELT_REVERSE (rtx, scheduled_insns, i, prev)
+ {
+ HARD_REG_SET t;
- found = false;
- FOR_EACH_DEP (next, SD_LIST_RES_BACK, sd_it, dep)
- {
- if (DEP_PRO (dep) == prev && DEP_TYPE (dep) == REG_DEP_TRUE)
- {
- found = true;
- break;
- }
- }
- if (!found)
- return HARD_DEP;
- break;
- }
+ find_all_hard_reg_sets (prev, &t);
+ if (TEST_HARD_REG_BIT (t, regno))
+ return HARD_DEP;
+ if (prev == pro)
+ break;
+ }
if (ORIG_PAT (next) == NULL_RTX)
{
ORIG_PAT (next) = PATTERN (next);
diff --git a/gcc/optabs.c b/gcc/optabs.c
index a1917cc3220..c3f81dfe2d2 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7943,6 +7943,41 @@ get_atomic_op_for_code (struct atomic_op_functions *op, enum rtx_code code)
}
}
+/* See if there is a more optimal way to implement the operation "*MEM CODE VAL"
+ using memory order MODEL. If AFTER is true the operation needs to return
+ the value of *MEM after the operation, otherwise the previous value.
+ TARGET is an optional place to place the result. The result is unused if
+ it is const0_rtx.
+ Return the result if there is a better sequence, otherwise NULL_RTX. */
+
+static rtx
+maybe_optimize_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
+ enum memmodel model, bool after)
+{
+ /* If the value is prefetched, or not used, it may be possible to replace
+ the sequence with a native exchange operation. */
+ if (!after || target == const0_rtx)
+ {
+ /* fetch_and (&x, 0, m) can be replaced with exchange (&x, 0, m). */
+ if (code == AND && val == const0_rtx)
+ {
+ if (target == const0_rtx)
+ target = gen_reg_rtx (GET_MODE (mem));
+ return maybe_emit_atomic_exchange (target, mem, val, model);
+ }
+
+ /* fetch_or (&x, -1, m) can be replaced with exchange (&x, -1, m). */
+ if (code == IOR && val == constm1_rtx)
+ {
+ if (target == const0_rtx)
+ target = gen_reg_rtx (GET_MODE (mem));
+ return maybe_emit_atomic_exchange (target, mem, val, model);
+ }
+ }
+
+ return NULL_RTX;
+}
+
/* Try to emit an instruction for a specific operation varaition.
OPTAB contains the OP functions.
TARGET is an optional place to return the result. const0_rtx means unused.
@@ -8028,6 +8063,11 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
get_atomic_op_for_code (&optab, code);
+ /* Check to see if there are any better instructions. */
+ result = maybe_optimize_fetch_op (target, mem, val, code, model, after);
+ if (result)
+ return result;
+
/* Check for the case where the result isn't used and try those patterns. */
if (unused_result)
{
diff --git a/gcc/predict.c b/gcc/predict.c
index eeca172ce45..92365317905 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1190,7 +1190,8 @@ static tree expr_expected_value (tree, bitmap);
/* Helper function for expr_expected_value. */
static tree
-expr_expected_value_1 (tree type, tree op0, enum tree_code code, tree op1, bitmap visited)
+expr_expected_value_1 (tree type, tree op0, enum tree_code code,
+ tree op1, bitmap visited)
{
gimple def;
@@ -1255,17 +1256,36 @@ expr_expected_value_1 (tree type, tree op0, enum tree_code code, tree op1, bitma
tree decl = gimple_call_fndecl (def);
if (!decl)
return NULL;
- if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (decl) == BUILT_IN_EXPECT)
- {
- tree val;
+ if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (decl))
+ {
+ case BUILT_IN_EXPECT:
+ {
+ tree val;
+ if (gimple_call_num_args (def) != 2)
+ return NULL;
+ val = gimple_call_arg (def, 0);
+ if (TREE_CONSTANT (val))
+ return val;
+ return gimple_call_arg (def, 1);
+ }
- if (gimple_call_num_args (def) != 2)
- return NULL;
- val = gimple_call_arg (def, 0);
- if (TREE_CONSTANT (val))
- return val;
- return gimple_call_arg (def, 1);
+ case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_N:
+ case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_1:
+ case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_2:
+ case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_4:
+ case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_8:
+ case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_16:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_1:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_2:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_4:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_8:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_16:
+ /* Assume that any given atomic operation has low contention,
+ and thus the compare-and-swap operation succeeds. */
+ return boolean_true_node;
}
}
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 896a68f3fc7..da7fe729be9 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -434,7 +434,8 @@ get_true_reg (rtx *pat)
break;
case UNSPEC:
- if (XINT (*pat, 1) == UNSPEC_TRUNC_NOOP)
+ if (XINT (*pat, 1) == UNSPEC_TRUNC_NOOP
+ || XINT (*pat, 1) == UNSPEC_LDA)
pat = & XVECEXP (*pat, 0, 0);
return pat;
@@ -1677,6 +1678,7 @@ subst_stack_regs_pat (rtx insn, stack regstack, rtx pat)
case UNSPEC:
switch (XINT (pat_src, 1))
{
+ case UNSPEC_STA:
case UNSPEC_FIST:
case UNSPEC_FIST_FLOOR:
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 043204a34bc..af2892d002c 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2873,7 +2873,11 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx insn)
else
sched_analyze_2 (deps, XEXP (link, 0), insn);
}
- if (find_reg_note (insn, REG_SETJMP, NULL))
+ /* Don't schedule anything after a tail call, tail call needs
+ to use at least all call-saved registers. */
+ if (SIBLING_CALL_P (insn))
+ reg_pending_barrier = TRUE_BARRIER;
+ else if (find_reg_note (insn, REG_SETJMP, NULL))
reg_pending_barrier = MOVE_BARRIER;
}
diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c
index 9a28e2bfc4b..cae9f704178 100644
--- a/gcc/sched-ebb.c
+++ b/gcc/sched-ebb.c
@@ -191,8 +191,13 @@ begin_move_insn (rtx insn, rtx last)
gcc_assert (NOTE_INSN_BASIC_BLOCK_P (BB_END (bb)));
}
else
- /* Create an empty unreachable block after the INSN. */
- bb = create_basic_block (NEXT_INSN (insn), NULL_RTX, last_bb);
+ {
+ /* Create an empty unreachable block after the INSN. */
+ rtx next = NEXT_INSN (insn);
+ if (next && BARRIER_P (next))
+ next = NEXT_INSN (next);
+ bb = create_basic_block (next, NULL_RTX, last_bb);
+ }
/* split_edge () creates BB before E->DEST. Keep in mind, that
this operation extends scheduling region till the end of BB.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7f738a0fa58..8e29dab0ade 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,85 @@
+2011-11-30 Jason Merrill <jason@redhat.com>
+
+ PR c++/51009
+ * g++.dg/init/aggr8.C: New.
+
+2011-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/50725
+ * gcc.target/i386/pr50725.c: New test.
+
+ PR middle-end/51089
+ * gfortran.dg/gomp/pr51089.f90: New test.
+
+2011-11-30 Andrew Pinski <apinski@cavium.com>
+
+ * gcc.dg/pr51321.c: New testcase.
+
+2011-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/48721
+ * gcc.target/i386/pr48721.c: New test.
+
+2011-11-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51299
+ * g++.dg/warn/Wzero-as-null-pointer-constant-4.C: New.
+
+2011-11-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/51247
+ * gcc.c-torture/compile/pr51247.c: New test.
+
+2011-11-29 Andrew MacLeod <amacleod@redhat.com>
+
+ PR target/50123
+ * gcc.dg/atomic-op-optimize.c: New. Test for optimizations.
+
+2011-11-29 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/ppc-target-4.c: New file to test target
+ specific functions enabling target specific builtins.
+
+2011-11-29 Yufeng Zhang <yufeng.zhang@arm.com>
+
+ Use complex floating-point constant in CDBL.
+
+ * gcc.dg/compat/compat-common.h (CDBL): Replace 1i with 1.0i.
+
+2011-11-29 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51306
+ PR fortran/48700
+ * gfortran.dg/move_alloc_5.f90: Add dg-error.
+ * gfortran.dg/select_type_23.f03: Add dg-error.
+ * gfortran.dg/move_alloc_6.f90: New.
+ * gfortran.dg/move_alloc_7.f90: New.
+
+2011-11-29 Ira Rosen <ira.rosen@linaro.org>
+
+ PR tree-optimization/51301
+ * gcc.dg/vect/pr51301.c: New test.
+
+2011-11-28 Uros Bizjak <ubizjak@gmail.com>
+
+ * g++.dg/cdce3.C: Use dg-additional-options.
+
+2011-11-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/50907
+ * gcc.dg/tree-prof/pr50907.c: New test.
+
+ PR tree-optimization/50078
+ * gcc.dg/pr50078.c: New test.
+
+ PR tree-optimization/50682
+ * g++.dg/opt/pr50682.C: New test.
+
+2011-11-28 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51308
+ * gfortran.dg/iso_c_binding_compiler_4.f90: New.
+
2011-11-27 Aldy Hernandez <aldyh@redhat.com>
Iain Sandoe <iains@gcc.gnu.org>
@@ -6,7 +88,7 @@
* gcc.dg/lto/trans-mem-1_0.c: Add dg-lto-do link.
* gcc.dg/lto/trans-mem-1_1.c: Add dummy functions for
_ITM_registerTMCloneTable, _ITM_deregisterTMCloneTable.
-
+
2011-11-27 Richard Sandiford <rdsandiford@googlemail.com>
* gcc.target/mips/mult-2.c, gcc.target/mips/mult-3.c,
diff --git a/gcc/testsuite/g++.dg/cdce3.C b/gcc/testsuite/g++.dg/cdce3.C
index e6ca58c46ec..1174b192684 100644
--- a/gcc/testsuite/g++.dg/cdce3.C
+++ b/gcc/testsuite/g++.dg/cdce3.C
@@ -1,13 +1,12 @@
/* { dg-do run } */
/* { dg-require-effective-target c99_runtime } */
/* { dg-skip-if "exp2* missing despite C99 runtime" { alpha*-dec-osf5* } } */
-/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -DLARGE_LONG_DOUBLE -lm" { target { pow10 && large_long_double } } } */
-/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DLARGE_LONG_DOUBLE -lm" { target { {! pow10 } && large_long_double } } } */
-/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target { pow10 && {! large_long_double } } } } */
-/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { {! pow10 } && {! large_long_double } } } } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" } */
+/* { dg-additional-options "-DLARGE_LONG_DOUBLE" { target large_long_double } } */
+/* { dg-additional-options "-DGNU_EXTENSION" { target pow10 } } */
/* { dg-add-options ieee } */
-/* { dg-final { scan-tree-dump "cdce3.C:93: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
-/* { dg-final { scan-tree-dump "cdce3.C:94: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
+/* { dg-final { scan-tree-dump "cdce3.C:93: note: function call is shrink-wrapped into error conditions\." "cdce" { target pow10 } } } */
+/* { dg-final { scan-tree-dump "cdce3.C:94: note: function call is shrink-wrapped into error conditions\." "cdce" { target pow10 } } } */
/* { dg-final { scan-tree-dump "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump "cdce3.C:97: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump "cdce3.C:98: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
@@ -23,6 +22,7 @@
/* { dg-final { scan-tree-dump "cdce3.C:108: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump "cdce3.C:109: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { cleanup-tree-dump "cdce" } } */
+
#include <stdlib.h>
#include <math.h>
#ifdef DEBUG
diff --git a/gcc/testsuite/g++.dg/init/aggr8.C b/gcc/testsuite/g++.dg/init/aggr8.C
new file mode 100644
index 00000000000..7e6edc9ad6c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/aggr8.C
@@ -0,0 +1,19 @@
+// PR c++/51009
+
+struct A
+{
+ ~A();
+};
+
+struct B
+{
+ A a;
+ B(const A& = A());
+};
+
+struct C
+{
+ B b1, b2;
+};
+
+C c = {};
diff --git a/gcc/testsuite/g++.dg/opt/pr50682.C b/gcc/testsuite/g++.dg/opt/pr50682.C
new file mode 100644
index 00000000000..b7e91f45d73
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr50682.C
@@ -0,0 +1,39 @@
+// PR tree-optimization/50682
+// { dg-do compile }
+// { dg-options "-O2 -fnon-call-exceptions -ftracer -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce" }
+
+void foo () __attribute__ ((__noreturn__));
+int baz ();
+
+const int &
+bar (const int &x, const int &y)
+{
+ if (x >= y)
+ return y;
+ return x;
+}
+
+int a, b;
+
+struct S
+{
+ ~S ();
+ bool m ()
+ {
+ int l = bar (a, b);
+ int r = baz ();
+ if (r)
+ r = l;
+ return r;
+ }
+};
+
+void
+test ()
+{
+ S s;
+ if (!s.m ())
+ foo ();
+ if (!s.m ())
+ foo ();
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-4.C b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-4.C
new file mode 100644
index 00000000000..548caac36e9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-4.C
@@ -0,0 +1,22 @@
+// PR c++/51299
+// { dg-options "-Wzero-as-null-pointer-constant" }
+
+class Base
+{
+ public:
+ virtual ~Base();
+};
+
+class Derived : public Base
+{
+};
+
+void foo(Base* b)
+{
+ Derived* d = dynamic_cast<Derived*>(b);
+}
+
+void bar(Base& b)
+{
+ Derived& d = dynamic_cast<Derived&>(b);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr51247.c b/gcc/testsuite/gcc.c-torture/compile/pr51247.c
new file mode 100644
index 00000000000..16aa7f04b1a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr51247.c
@@ -0,0 +1,16 @@
+/* PR tree-optimization/51247 */
+
+struct S { int s : 1; };
+int a;
+
+void
+foo (int x, int y)
+{
+ struct S s;
+ s.s = !!y;
+ while (1)
+ {
+ unsigned l = 94967295;
+ a = x || (s.s &= l);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-op-optimize.c b/gcc/testsuite/gcc.dg/atomic-op-optimize.c
new file mode 100644
index 00000000000..d2e960a0cee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-op-optimize.c
@@ -0,0 +1,20 @@
+/* Both these atomic operations should be optimized to an exchange operation.
+ Test that it at happens on x86 by making sure there are 2 xchg's and no
+ compare_exchange loop. */
+
+/* { dg-require-effective-target sync_int_long } */
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-final { scan-assembler-times "cmpxchg" 0 } } */
+/* { dg-final { scan-assembler-times "xchg" 2 } } */
+
+int x;
+
+int f()
+{
+ return __atomic_fetch_and (&x, 0, __ATOMIC_RELAXED);
+}
+
+int g()
+{
+ return __atomic_fetch_or (&x, -1, __ATOMIC_RELAXED);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/compat-common.h b/gcc/testsuite/gcc.dg/compat/compat-common.h
index 8a92ea3e606..4b3fb9c14ca 100644
--- a/gcc/testsuite/gcc.dg/compat/compat-common.h
+++ b/gcc/testsuite/gcc.dg/compat/compat-common.h
@@ -33,7 +33,7 @@
#ifndef SKIP_COMPLEX
#ifdef __GNUC__
#define CINT(x, y) (x + y * __extension__ 1i)
-#define CDBL(x, y) (x + y * __extension__ 1i)
+#define CDBL(x, y) (x + y * __extension__ 1.0i)
#else
#ifdef __SUNPRO_C
/* ??? Complex support without <complex.h>. */
diff --git a/gcc/testsuite/gcc.dg/pr50078.c b/gcc/testsuite/gcc.dg/pr50078.c
new file mode 100644
index 00000000000..a8aee43fb6a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr50078.c
@@ -0,0 +1,14 @@
+/* PR tree-optimization/50078 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+unsigned nonvolvar[2];
+
+void
+test (int arg)
+{
+ unsigned v = *(volatile unsigned *) (&nonvolvar[arg]);
+ *(volatile unsigned *) (&nonvolvar[arg]) = v;
+}
+
+/* { dg-final { scan-assembler-times "movl\[^\n\r\]*nonvolvar" 2 { target { { i?86-*-* x86_64-*-* } && nonpic } } } } */
diff --git a/gcc/testsuite/gcc.dg/pr51321.c b/gcc/testsuite/gcc.dg/pr51321.c
new file mode 100644
index 00000000000..0e836cfe6c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr51321.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+int main ()
+{
+ return (__builtin_types_compatible_p (char[1][], char[1][1])); /* { dg-error "array type has incomplete element type" } */
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr50907.c b/gcc/testsuite/gcc.dg/tree-prof/pr50907.c
new file mode 100644
index 00000000000..2ba26e392cb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/pr50907.c
@@ -0,0 +1,5 @@
+/* PR middle-end/50907 */
+/* { dg-require-effective-target freorder } */
+/* { dg-options "-O -freorder-blocks-and-partition -fschedule-insns -fselective-scheduling -fpic" { target { { powerpc*-*-* ia64-*-* x86_64-*-* } && fpic } } } */
+
+#include "pr45354.c"
diff --git a/gcc/testsuite/gcc.dg/vect/pr51301.c b/gcc/testsuite/gcc.dg/vect/pr51301.c
new file mode 100644
index 00000000000..c0000cad942
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr51301.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+typedef signed char int8_t;
+typedef signed long long int64_t;
+int64_t
+f0a (int8_t * __restrict__ arg1)
+{
+ int idx;
+ int64_t result = 0;
+ for (idx = 0; idx < 416; idx += 1)
+ result += arg1[idx] << (arg1[idx] == arg1[idx]);
+ return result;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr48721.c b/gcc/testsuite/gcc.target/i386/pr48721.c
new file mode 100644
index 00000000000..f37a16949ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr48721.c
@@ -0,0 +1,51 @@
+/* PR rtl-optimization/48721 */
+/* { dg-do compile } */
+/* { dg-options "-O -foptimize-sibling-calls -fsched2-use-superblocks -fschedule-insns2 -mtune=core2" } */
+
+extern unsigned char a[];
+extern int b[], d[], e[], f[], g[], *h[], m[], *n[], o[];
+extern char c[];
+
+struct S
+{
+ unsigned char s1;
+ int s2, s3, s4, s5, s6, s7, s8;
+};
+
+__attribute__((noinline, noclone)) int
+foo (int x)
+{
+ return 0;
+}
+
+int
+bar (int x, struct S *y)
+{
+ int z;
+ switch (x)
+ {
+ case 1:
+ case 2:
+ {
+ int t2, t4, t5, t6, t7, t8;
+ z = o[y->s8 * 6];
+ t8 = *n[m[x] * 5];
+ t4 = *h[y->s7];
+ t7 = z;
+ z = g[f[x] + y->s6];
+ t6 = e[y->s5];
+ t5 = d[c[x] + y->s3 * 17];
+ if (z)
+ t2 = b[z];
+ if (a[z] != y->s1)
+ return foo (x);
+ y->s8 = t8;
+ y->s4 = t4;
+ y->s7 = t7;
+ y->s6 = t6;
+ y->s5 = t5;
+ y->s2 = t2;
+ }
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr50725.c b/gcc/testsuite/gcc.target/i386/pr50725.c
new file mode 100644
index 00000000000..ef74ecb0211
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr50725.c
@@ -0,0 +1,48 @@
+/* PR target/50725 */
+/* { dg-do run { target avx_runtime } } */
+/* { dg-options "-O2 -mavx" } */
+
+extern void abort (void);
+
+typedef int __attribute__((vector_size (32))) m256i;
+
+__attribute__((noinline, noclone)) void
+foo (int *x, m256i *y)
+{
+ asm volatile ("" : : "r" (x), "r" (y) : "memory");
+}
+
+__attribute__((noinline, noclone)) int
+bar (int x)
+{
+ if (x > 20)
+ return 24;
+ m256i i;
+ foo (__builtin_alloca (x), &i);
+ return 128;
+}
+
+__attribute__((noinline, noclone)) int
+baz (int d0, int d1, int d2, int d3, int d4, int d5, int x)
+{
+ if (x > 20)
+ return 24;
+ m256i i;
+ d0 += d1 + d2 + d3 + d4 + d5; d1 += d0;
+ foo (__builtin_alloca (x), &i);
+ return 128;
+}
+
+int
+main ()
+{
+ if (bar (22) != 24 || bar (20) != 128)
+ abort ();
+#ifdef __x86_64__
+ register long r10 __asm__ ("r10") = 0xdeadbeefdeadbeefUL;
+ asm volatile ("" : "+r" (r10));
+#endif
+ if (baz (0, 0, 0, 0, 0, 0, 22) != 24 || baz (0, 0, 0, 0, 0, 0, 20) != 128)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr51089.f90 b/gcc/testsuite/gfortran.dg/gomp/pr51089.f90
new file mode 100644
index 00000000000..83b6dba7a76
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr51089.f90
@@ -0,0 +1,16 @@
+! PR middle-end/51089
+! { dg-do compile }
+! { dg-options "-O -fexceptions -fopenmp" }
+
+subroutine foo
+ real, allocatable, dimension(:) :: s
+ real, dimension(:, :, :), pointer :: t
+ call fn1 (t, s)
+ call fn2 ()
+end subroutine foo
+subroutine bar
+ integer :: i
+!$omp parallel do
+ do i = 1, 10
+ end do
+end subroutine bar
diff --git a/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_4.f90 b/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_4.f90
new file mode 100644
index 00000000000..8a87fe5f50c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_4.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR fortran/51308
+!
+! Contributed by Matthias Moeller
+!
+
+module mymod
+ use iso_c_binding
+ implicit none
+
+ private
+ public :: c_ptr
+ public :: c_null_ptr
+
+end module mymod
+
+! { dg-final { cleanup-modules "mymod" } }
diff --git a/gcc/testsuite/gfortran.dg/move_alloc_5.f90 b/gcc/testsuite/gfortran.dg/move_alloc_5.f90
index b2759de2c1d..7663275263e 100644
--- a/gcc/testsuite/gfortran.dg/move_alloc_5.f90
+++ b/gcc/testsuite/gfortran.dg/move_alloc_5.f90
@@ -1,4 +1,4 @@
-! { dg-do run }
+! { dg-do compile }
!
! PR 48699: [4.6/4.7 Regression] [OOP] MOVE_ALLOC inside SELECT TYPE
!
@@ -16,7 +16,7 @@ program testmv1
type(bar2), allocatable :: sm2
allocate (sm2)
- call move_alloc (sm2,sm)
+ call move_alloc (sm2,sm) ! { dg-error "must be either both polymorphic or both nonpolymorphic" }
if (allocated(sm2)) call abort()
if (.not. allocated(sm)) call abort()
diff --git a/gcc/testsuite/gfortran.dg/move_alloc_6.f90 b/gcc/testsuite/gfortran.dg/move_alloc_6.f90
new file mode 100644
index 00000000000..b62a023a9ea
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/move_alloc_6.f90
@@ -0,0 +1,80 @@
+! { dg-do run }
+!
+! Test move_alloc for polymorphic scalars
+!
+!
+module myalloc
+ implicit none
+
+ type :: base_type
+ integer :: i =2
+ end type base_type
+
+ type, extends(base_type) :: extended_type
+ integer :: j = 77
+ end type extended_type
+contains
+ subroutine myallocate (a)
+ class(base_type), allocatable, intent(inout) :: a
+ class(base_type), allocatable :: tmp
+
+ allocate (extended_type :: tmp)
+
+ select type(tmp)
+ type is(base_type)
+ call abort ()
+ type is(extended_type)
+ if (tmp%i /= 2 .or. tmp%j /= 77) call abort()
+ tmp%i = 5
+ tmp%j = 88
+ end select
+
+ select type(a)
+ type is(base_type)
+ if (a%i /= -44) call abort()
+ a%i = -99
+ class default
+ call abort ()
+ end select
+
+ call move_alloc (from=tmp, to=a)
+
+ select type(a)
+ type is(extended_type)
+ if (a%i /= 5) call abort()
+ if (a%j /= 88) call abort()
+ a%i = 123
+ a%j = 9498
+ class default
+ call abort ()
+ end select
+
+ if (allocated (tmp)) call abort()
+ end subroutine myallocate
+end module myalloc
+
+program main
+ use myalloc
+ implicit none
+ class(base_type), allocatable :: a
+
+ allocate (a)
+
+ select type(a)
+ type is(base_type)
+ if (a%i /= 2) call abort()
+ a%i = -44
+ class default
+ call abort ()
+ end select
+
+ call myallocate (a)
+
+ select type(a)
+ type is(extended_type)
+ if (a%i /= 123) call abort()
+ if (a%j /= 9498) call abort()
+ class default
+ call abort ()
+ end select
+end program main
diff --git a/gcc/testsuite/gfortran.dg/move_alloc_7.f90 b/gcc/testsuite/gfortran.dg/move_alloc_7.f90
new file mode 100644
index 00000000000..d2bc82c7ca0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/move_alloc_7.f90
@@ -0,0 +1,15 @@
+! { dg-do compile }
+!
+! Check that move alloc handles different, type compatible
+! declared types
+!
+type t
+end type t
+type, extends(t) :: t2
+end type t2
+
+class(t), allocatable :: x
+class(t2), allocatable :: y
+allocate(y)
+call move_alloc (y, x)
+end
diff --git a/gcc/testsuite/gfortran.dg/select_type_23.f03 b/gcc/testsuite/gfortran.dg/select_type_23.f03
index d7788d2f494..2479f1d144d 100644
--- a/gcc/testsuite/gfortran.dg/select_type_23.f03
+++ b/gcc/testsuite/gfortran.dg/select_type_23.f03
@@ -3,6 +3,10 @@
! PR 48699: [OOP] MOVE_ALLOC inside SELECT TYPE
!
! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
+!
+! Note that per Fortran 2008, 8.1.9.2, "within the block following
+! a TYPE IS type guard statement, the associating entity (16.5.5) is not polymorphic"
+!
program testmv2
@@ -16,7 +20,7 @@ program testmv2
select type(sm2)
type is (bar)
- call move_alloc(sm2,sm)
+ call move_alloc(sm2,sm) ! { dg-error "must be either both polymorphic or both nonpolymorphic" }
end select
end program testmv2
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 0604f4e4275..41c291320e1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -152,14 +152,6 @@ HOST_WIDE_INT random_seed;
/* -f flags. */
-/* Generate code for GNU or NeXT Objective-C runtime environment. */
-
-#ifdef NEXT_OBJC_RUNTIME
-int flag_next_runtime = 1;
-#else
-int flag_next_runtime = 0;
-#endif
-
/* Nonzero means make permerror produce warnings instead of errors. */
int flag_permissive = 0;
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 751572c4fb4..9751a15a4d2 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -4213,7 +4213,7 @@ ipa_tm_create_version_alias (struct cgraph_node *node, void *data)
TREE_SYMBOL_REFERENCED (tm_name) = 1;
/* Perform the same remapping to the comdat group. */
- if (DECL_COMDAT (new_decl))
+ if (DECL_ONE_ONLY (new_decl))
DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));
new_node = cgraph_same_body_alias (NULL, new_decl, info->new_decl);
@@ -4248,7 +4248,7 @@ ipa_tm_create_version (struct cgraph_node *old_node)
TREE_SYMBOL_REFERENCED (tm_name) = 1;
/* Perform the same remapping to the comdat group. */
- if (DECL_COMDAT (new_decl))
+ if (DECL_ONE_ONLY (new_decl))
DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));
new_node = cgraph_copy_node_for_versioning (old_node, new_decl, NULL, NULL);
diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c
index 53b350b5418..b4b60dc44f9 100644
--- a/gcc/tree-diagnostic.c
+++ b/gcc/tree-diagnostic.c
@@ -56,10 +56,10 @@ typedef struct
{
const struct line_map *map;
source_location where;
-} loc_t;
+} loc_map_pair;
-DEF_VEC_O (loc_t);
-DEF_VEC_ALLOC_O (loc_t, heap);
+DEF_VEC_O (loc_map_pair);
+DEF_VEC_ALLOC_O (loc_map_pair, heap);
/* Unwind the different macro expansions that lead to the token which
location is WHERE and emit diagnostics showing the resulting
@@ -111,9 +111,9 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
const struct line_map **first_exp_point_map)
{
const struct line_map *map;
- VEC(loc_t,heap) *loc_vec = NULL;
+ VEC(loc_map_pair,heap) *loc_vec = NULL;
unsigned ix;
- loc_t loc, *iter;
+ loc_map_pair loc, *iter;
map = linemap_lookup (line_table, where);
if (!linemap_macro_expansion_map_p (map))
@@ -132,7 +132,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
loc.where = where;
loc.map = map;
- VEC_safe_push (loc_t, heap, loc_vec, &loc);
+ VEC_safe_push (loc_map_pair, heap, loc_vec, &loc);
/* WHERE is the location of a token inside the expansion of a
macro. MAP is the map holding the locations of that macro
@@ -150,7 +150,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
first macro which expansion triggered this trace was expanded
inside a system header. */
if (!LINEMAP_SYSP (map))
- FOR_EACH_VEC_ELT (loc_t, loc_vec, ix, iter)
+ FOR_EACH_VEC_ELT (loc_map_pair, loc_vec, ix, iter)
{
source_location resolved_def_loc = 0, resolved_exp_loc = 0;
diagnostic_t saved_kind;
@@ -203,7 +203,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
context->printer->prefix = saved_prefix;
}
- VEC_free (loc_t, heap, loc_vec);
+ VEC_free (loc_map_pair, heap, loc_vec);
}
/* This is a diagnostic finalizer implementation that is aware of
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 440ac0f4082..57abca80e4e 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -3473,6 +3473,29 @@ remove_unreachable_handlers (void)
#endif
}
+/* Remove unreachable handlers if any landing pads have been removed after
+ last ehcleanup pass (due to gimple_purge_dead_eh_edges). */
+
+void
+maybe_remove_unreachable_handlers (void)
+{
+ eh_landing_pad lp;
+ int i;
+
+ if (cfun->eh == NULL)
+ return;
+
+ for (i = 1; VEC_iterate (eh_landing_pad, cfun->eh->lp_array, i, lp); ++i)
+ if (lp && lp->post_landing_pad)
+ {
+ if (label_to_block (lp->post_landing_pad) == NULL)
+ {
+ remove_unreachable_handlers ();
+ return;
+ }
+ }
+}
+
/* Remove regions that do not have landing pads. This assumes
that remove_unreachable_handlers has already been run, and
that we've just manipulated the landing pads since then. */
@@ -3630,6 +3653,22 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
bitmap rename_virts;
bitmap ophi_handled;
+ /* The destination block must not be a regular successor for any
+ of the preds of the landing pad. Thus, avoid turning
+ <..>
+ | \ EH
+ | <..>
+ | /
+ <..>
+ into
+ <..>
+ | | EH
+ <..>
+ which CFG verification would choke on. See PR45172 and PR51089. */
+ FOR_EACH_EDGE (e, ei, old_bb->preds)
+ if (find_edge (e->src, new_bb))
+ return false;
+
FOR_EACH_EDGE (e, ei, old_bb->preds)
redirect_edge_var_map_clear (e);
@@ -3792,8 +3831,6 @@ cleanup_empty_eh_unsplit (basic_block bb, edge e_out, eh_landing_pad lp)
{
gimple_stmt_iterator gsi;
tree lab;
- edge_iterator ei;
- edge e;
/* We really ought not have totally lost everything following
a landing pad label. Given that BB is empty, there had better
@@ -3816,22 +3853,6 @@ cleanup_empty_eh_unsplit (basic_block bb, edge e_out, eh_landing_pad lp)
return false;
}
- /* The destination block must not be a regular successor for any
- of the preds of the landing pad. Thus, avoid turning
- <..>
- | \ EH
- | <..>
- | /
- <..>
- into
- <..>
- | | EH
- <..>
- which CFG verification would choke on. See PR45172. */
- FOR_EACH_EDGE (e, ei, bb->preds)
- if (find_edge (e->src, e_out->dest))
- return false;
-
/* Attempt to move the PHIs into the successor block. */
if (cleanup_empty_eh_merge_phis (e_out->dest, bb, e_out, false))
{
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 211c1079f3c..ded7a3f9fac 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -789,6 +789,7 @@ extern bool maybe_duplicate_eh_stmt_fn (struct function *, gimple,
extern bool maybe_duplicate_eh_stmt (gimple, gimple);
extern bool verify_eh_edges (gimple);
extern bool verify_eh_dispatch_edge (gimple);
+extern void maybe_remove_unreachable_handlers (void);
/* In tree-ssa-pre.c */
struct pre_expr_d;
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 5479d9026a6..2f6b394111d 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -159,6 +159,7 @@ static unsigned int
execute_cleanup_cfg_post_optimizing (void)
{
cleanup_tree_cfg ();
+ maybe_remove_unreachable_handlers ();
cleanup_dead_labels ();
group_case_labels ();
if ((flag_compare_debug_opt || flag_compare_debug)
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index d707db520e3..6ab47317770 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -910,7 +910,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
TREE_TYPE (gimple_assign_rhs1 (use_stmt))))
{
tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0);
- tree new_offset, new_base, saved;
+ tree new_offset, new_base, saved, new_lhs;
while (handled_component_p (*def_rhs_basep))
def_rhs_basep = &TREE_OPERAND (*def_rhs_basep, 0);
saved = *def_rhs_basep;
@@ -930,8 +930,9 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
new_base, new_offset);
TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (lhs);
TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (lhs);
- gimple_assign_set_lhs (use_stmt,
- unshare_expr (TREE_OPERAND (def_rhs, 0)));
+ new_lhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
+ gimple_assign_set_lhs (use_stmt, new_lhs);
+ TREE_THIS_VOLATILE (new_lhs) = TREE_THIS_VOLATILE (lhs);
*def_rhs_basep = saved;
tidy_after_forward_propagate_addr (use_stmt);
/* Continue propagating into the RHS if this was not the
@@ -991,7 +992,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
TREE_TYPE (TREE_OPERAND (def_rhs, 0))))
{
tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0);
- tree new_offset, new_base, saved;
+ tree new_offset, new_base, saved, new_rhs;
while (handled_component_p (*def_rhs_basep))
def_rhs_basep = &TREE_OPERAND (*def_rhs_basep, 0);
saved = *def_rhs_basep;
@@ -1011,8 +1012,9 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
new_base, new_offset);
TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (rhs);
TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (rhs);
- gimple_assign_set_rhs1 (use_stmt,
- unshare_expr (TREE_OPERAND (def_rhs, 0)));
+ new_rhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
+ gimple_assign_set_rhs1 (use_stmt, new_rhs);
+ TREE_THIS_VOLATILE (new_rhs) = TREE_THIS_VOLATILE (rhs);
*def_rhs_basep = saved;
fold_stmt_inplace (use_stmt_gsi);
tidy_after_forward_propagate_addr (use_stmt);
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 8f73d9176f2..97857217ce7 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -2118,7 +2118,7 @@ execute_update_addresses_taken (void)
if (update_vops)
{
FOR_EACH_BB (bb)
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
@@ -2159,6 +2159,18 @@ execute_update_addresses_taken (void)
if (gimple_assign_lhs (stmt) != lhs)
gimple_assign_set_lhs (stmt, lhs);
+ /* For var ={v} {CLOBBER}; where var lost
+ TREE_ADDRESSABLE just remove the stmt. */
+ if (DECL_P (lhs)
+ && TREE_CLOBBER_P (rhs)
+ && symbol_marked_for_renaming (lhs))
+ {
+ unlink_stmt_vdef (stmt);
+ gsi_remove (&gsi, true);
+ release_defs (stmt);
+ continue;
+ }
+
if (gimple_assign_rhs1 (stmt) != rhs)
{
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
@@ -2205,6 +2217,8 @@ execute_update_addresses_taken (void)
if (gimple_references_memory_p (stmt)
|| is_gimple_debug (stmt))
update_stmt (stmt);
+
+ gsi_next (&gsi);
}
/* Update SSA form here, we are called as non-pass as well. */
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index d260e801bca..22414475f6f 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -1088,6 +1088,7 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts,
tree var = NULL_TREE, new_type = NULL_TREE, tmp, new_oprnd;
bool first;
struct loop *loop = (gimple_bb (stmt))->loop_father;
+ tree type = NULL;
first = true;
while (1)
@@ -1150,6 +1151,7 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts,
print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM);
}
+ type = gimple_expr_type (stmt);
prev_stmt = stmt;
stmt = use_stmt;
@@ -1165,9 +1167,11 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts,
{
use_lhs = gimple_assign_lhs (use_stmt);
use_type = TREE_TYPE (use_lhs);
- /* Support only type promotion or signedess change. */
+ /* Support only type promotion or signedess change. Check that USE_TYPE
+ is not bigger than the original type. */
if (!INTEGRAL_TYPE_P (use_type)
- || TYPE_PRECISION (new_type) > TYPE_PRECISION (use_type))
+ || TYPE_PRECISION (new_type) > TYPE_PRECISION (use_type)
+ || TYPE_PRECISION (type) < TYPE_PRECISION (use_type))
return NULL;
if (TYPE_UNSIGNED (new_type) != TYPE_UNSIGNED (use_type)
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 248bc61926f..5cbc25fcb1e 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -1693,8 +1693,13 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
/* For LT_EXPR, we create the range [MIN, MAX - 1]. */
if (cond_code == LT_EXPR)
{
- tree one = build_int_cst (TREE_TYPE (max), 1);
- max = fold_build2 (MINUS_EXPR, TREE_TYPE (max), max, one);
+ if (TYPE_PRECISION (TREE_TYPE (max)) == 1
+ && !TYPE_UNSIGNED (TREE_TYPE (max)))
+ max = fold_build2 (PLUS_EXPR, TREE_TYPE (max), max,
+ build_int_cst (TREE_TYPE (max), -1));
+ else
+ max = fold_build2 (MINUS_EXPR, TREE_TYPE (max), max,
+ build_int_cst (TREE_TYPE (max), 1));
if (EXPR_P (max))
TREE_NO_WARNING (max) = 1;
}
@@ -1728,8 +1733,13 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
/* For GT_EXPR, we create the range [MIN + 1, MAX]. */
if (cond_code == GT_EXPR)
{
- tree one = build_int_cst (TREE_TYPE (min), 1);
- min = fold_build2 (PLUS_EXPR, TREE_TYPE (min), min, one);
+ if (TYPE_PRECISION (TREE_TYPE (min)) == 1
+ && !TYPE_UNSIGNED (TREE_TYPE (min)))
+ min = fold_build2 (MINUS_EXPR, TREE_TYPE (min), min,
+ build_int_cst (TREE_TYPE (min), -1));
+ else
+ min = fold_build2 (PLUS_EXPR, TREE_TYPE (min), min,
+ build_int_cst (TREE_TYPE (min), 1));
if (EXPR_P (min))
TREE_NO_WARNING (min) = 1;
}
@@ -1915,9 +1925,19 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
min = positive_overflow_infinity (TREE_TYPE (var_vr->min));
}
else if (!POINTER_TYPE_P (TREE_TYPE (var_vr->min)))
- min = fold_build2 (PLUS_EXPR, TREE_TYPE (var_vr->min),
- anti_max,
- build_int_cst (TREE_TYPE (var_vr->min), 1));
+ {
+ if (TYPE_PRECISION (TREE_TYPE (var_vr->min)) == 1
+ && !TYPE_UNSIGNED (TREE_TYPE (var_vr->min)))
+ min = fold_build2 (MINUS_EXPR, TREE_TYPE (var_vr->min),
+ anti_max,
+ build_int_cst (TREE_TYPE (var_vr->min),
+ -1));
+ else
+ min = fold_build2 (PLUS_EXPR, TREE_TYPE (var_vr->min),
+ anti_max,
+ build_int_cst (TREE_TYPE (var_vr->min),
+ 1));
+ }
else
min = fold_build_pointer_plus_hwi (anti_max, 1);
max = real_max;
@@ -1942,9 +1962,19 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
max = negative_overflow_infinity (TREE_TYPE (var_vr->min));
}
else if (!POINTER_TYPE_P (TREE_TYPE (var_vr->min)))
- max = fold_build2 (MINUS_EXPR, TREE_TYPE (var_vr->min),
- anti_min,
- build_int_cst (TREE_TYPE (var_vr->min), 1));
+ {
+ if (TYPE_PRECISION (TREE_TYPE (var_vr->min)) == 1
+ && !TYPE_UNSIGNED (TREE_TYPE (var_vr->min)))
+ max = fold_build2 (PLUS_EXPR, TREE_TYPE (var_vr->min),
+ anti_min,
+ build_int_cst (TREE_TYPE (var_vr->min),
+ -1));
+ else
+ max = fold_build2 (MINUS_EXPR, TREE_TYPE (var_vr->min),
+ anti_min,
+ build_int_cst (TREE_TYPE (var_vr->min),
+ 1));
+ }
else
max = fold_build_pointer_plus_hwi (anti_min, -1);
min = real_min;
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 4b244f41022..e7f18e25aed 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,48 @@
+2011-11-30 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR other/51272
+ * config/pa/stublib.c (_ITM_registerTMCloneTable): New stub.
+ (_ITM_deregisterTMCloneTable): Likewise.
+ (__register_frame_info): Fix unused warning.
+ (__deregister_frame_info, __cxa_finalize, _Jv_RegisterClasses,
+ pthread_default_stacksize_np): Likewise.
+ * config/pa/t-stublib (LIBGCCSTUB_OBJS): Add new objects and rules.
+
+2011-11-29 DJ Delorie <dj@redhat.com>
+
+ * config.host (rl78-*-elf): New case.
+ * config/rl78: New directory for the Renesas RL78.
+
+2011-11-29 Bernd Schmidt <bernds@codesourcery.com>
+
+ * config.host (tic6x-*-uclinux): Append to extra_parts. Fix
+ formatting.
+
+2011-11-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR other/51022
+ * config/rs6000/t-savresfgpr: New file.
+ * config/rs6000/t-ppccomm (LIB2ADD_ST): Remove all but
+ $(srcdir)/config/rs6000/eabi.S.
+ * config/rs6000/t-ppccomm-ldbl: Remove.
+ * config.host (powerpc-*-freebsd*): Add rs6000/t-savresfgpr to
+ tmake_file.
+ (powerpc-*-eabispe*): Likewise.
+ (powerpc-*-eabi*): Likewise.
+ (powerpc-*-linux*, powerpc64-*-linux*): Likewise.
+ (powerpc-wrs-vxworks, powerpc-wrs-vxworksae): Add rs6000/t-ppccomm
+ to tmake_file, remove rs6000/t-ppccomm-ldbl.
+ (powerpc-*-eabisimaltivec*): Remove rs6000/t-ppccomm-ldbl from
+ tmake_file.
+ (powerpc-*-eabisim*): Likewise.
+ (powerpc-*-elf*): Likewise.
+ (powerpc-*-eabialtivec*): Likewise.
+ (powerpc-xilinx-eabi*): Likewise.
+ (powerpc-*-rtems*): Likewise.
+ (powerpcle-*-elf*): Likewise.
+ (powerpcle-*-eabisim*): Likewise.
+ (powerpcle-*-eabi*): Likewise.
+
2011-11-27 Ian Lance Taylor <iant@google.com>
* generic-morestack.c (__splitstack_find): Check for NULL old
diff --git a/libgcc/config.host b/libgcc/config.host
index bcab56070e3..f15282c4924 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -843,65 +843,65 @@ powerpc64-*-darwin*)
extra_parts="$extra_parts crt2.o"
;;
powerpc-*-freebsd*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff rs6000/t-freebsd t-softfp-sfdf t-softfp-excl t-softfp t-slibgcc-libgcc"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-freebsd t-softfp-sfdf t-softfp-excl t-softfp t-slibgcc-libgcc"
extra_parts="$extra_parts crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-*-netbsd*)
tmake_file="$tmake_file rs6000/t-netbsd rs6000/t-crtstuff"
;;
powerpc-*-eabispe*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic"
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-*-eabisimaltivec*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-*-eabisim*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-*-elf*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-*-eabialtivec*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-xilinx-eabi*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-*-eabi*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-*-rtems*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-*-linux* | powerpc64-*-linux*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff rs6000/t-linux t-softfp-sfdf t-softfp-excl t-dfprules rs6000/t-ppc64-fp t-softfp t-slibgcc-libgcc"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-softfp-sfdf t-softfp-excl t-dfprules rs6000/t-ppc64-fp t-softfp t-slibgcc-libgcc"
extra_parts="$extra_parts ecrti.o ecrtn.o ncrti.o ncrtn.o"
md_unwind_header=rs6000/linux-unwind.h
;;
powerpc-wrs-vxworks|powerpc-wrs-vxworksae)
- tmake_file="$tmake_file rs6000/t-ppccomm-ldbl t-fdpbit"
+ tmake_file="$tmake_file rs6000/t-ppccomm t-fdpbit"
;;
powerpc-*-lynxos*)
tmake_file="$tmake_file rs6000/t-lynx t-fdpbit"
;;
powerpcle-*-elf*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpcle-*-eabisim*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpcle-*-eabi*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
@@ -916,6 +916,9 @@ rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
md_unwind_header=rs6000/aix-unwind.h
tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble rs6000/t-slibgcc-aix"
;;
+rl78-*-elf)
+ tmake_file="$tm_file t-fdpbit rl78/t-rl78"
+ ;;
rx-*-elf)
tmake_file="rx/t-rx t-fdpbit"
tm_file="$tm_file rx/rx-abi.h rx/rx-lib.h"
@@ -1068,9 +1071,11 @@ spu-*-elf*)
libgcc_cache64k.a libgcc_cache128k.a"
;;
tic6x-*-uclinux)
- tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl t-softfp c6x/t-elf c6x/t-uclinux t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-gnu-prefix"
+ tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl t-softfp \
+ c6x/t-elf c6x/t-uclinux t-crtstuff-pic t-libgcc-pic \
+ t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-gnu-prefix"
tm_file="$tm_file c6x/c6x-abi.h"
- extra_parts="crtbeginS.o crtendS.o crti.o crtn.o"
+ extra_parts="$extra_parts crtbeginS.o crtendS.o crti.o crtn.o"
unwind_header=config/c6x/unwind-c6x.h
;;
tic6x-*-elf)
diff --git a/libgcc/config/pa/stublib.c b/libgcc/config/pa/stublib.c
index d3cf559c8ab..4e95ba8b51e 100644
--- a/libgcc/config/pa/stublib.c
+++ b/libgcc/config/pa/stublib.c
@@ -1,5 +1,5 @@
/* Stub functions.
- Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -22,46 +22,66 @@ 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 "tsystem.h"
+
#ifdef L_register_frame_info
struct object;
-void __register_frame_info (const void * __attribute__((unused)),
- struct object * __attribute__((unused)));
+void __register_frame_info (const void *, struct object *);
void
-__register_frame_info (const void *p, struct object *ob)
+__register_frame_info (__attribute__((unused)) const void *p,
+ __attribute__((unused)) struct object *ob)
{
}
#endif
#ifdef L_deregister_frame_info
-void *__deregister_frame_info (const void * __attribute__((unused)));
+void *__deregister_frame_info (const void *);
void *
-__deregister_frame_info (const void *p)
+__deregister_frame_info (__attribute__((unused)) const void *p)
{
return (void *)0;
}
#endif
+#ifdef L_ITM_registerTMCloneTable
+struct object;
+void _ITM_registerTMCloneTable (const void *, size_t);
+void
+_ITM_registerTMCloneTable (__attribute__((unused)) const void *p,
+ __attribute__((unused)) size_t s)
+{
+}
+#endif
+
+#ifdef L_ITM_deregisterTMCloneTable
+void _ITM_deregisterTMCloneTable (const void *);
+void
+_ITM_deregisterTMCloneTable (__attribute__((unused)) const void *p)
+{
+}
+#endif
+
#ifdef L_cxa_finalize
-void __cxa_finalize (void * __attribute__((unused)));
+void __cxa_finalize (void *);
void
-__cxa_finalize (void *p)
+__cxa_finalize (__attribute__((unused)) void *p)
{
}
#endif
#ifdef L_Jv_RegisterClasses
-void _Jv_RegisterClasses (void * __attribute__((unused)));
+void _Jv_RegisterClasses (void *);
void
-_Jv_RegisterClasses (void *p)
+_Jv_RegisterClasses (__attribute__((unused)) void *p)
{
}
#endif
#ifdef L_pthread_default_stacksize_np
-int pthread_default_stacksize_np (unsigned long __attribute__((unused)),
- unsigned long *);
+int pthread_default_stacksize_np (unsigned long, unsigned long *);
int
-pthread_default_stacksize_np (unsigned long new, unsigned long *old)
+pthread_default_stacksize_np (__attribute__((unused)) unsigned long new,
+ unsigned long *old)
{
if (old)
*old = 0;
diff --git a/libgcc/config/pa/t-stublib b/libgcc/config/pa/t-stublib
index 94380923174..8004c1e46a7 100644
--- a/libgcc/config/pa/t-stublib
+++ b/libgcc/config/pa/t-stublib
@@ -1,4 +1,5 @@
-LIBGCCSTUB_OBJS = rfi-stub.o dfi-stub.o jvrc-stub.o cxaf-stub.o \
+LIBGCCSTUB_OBJS = rfi-stub.o dfi-stub.o ritm-stub.o ditm-stub.o \
+ jvrc-stub.o cxaf-stub.o \
pthread_default_stacksize_np-stub.o \
pthread_mutex_lock-stub.o \
pthread_mutex_unlock-stub.o \
@@ -10,6 +11,12 @@ rfi-stub.o: $(srcdir)/config/pa/stublib.c
dfi-stub.o: $(srcdir)/config/pa/stublib.c
$(gcc_compile) -c -O2 -DL_deregister_frame_info $<
+ritm-stub.o: $(srcdir)/config/pa/stublib.c
+ $(gcc_compile) -c -O2 -DL_ITM_registerTMCloneTable $<
+
+ditm-stub.o: $(srcdir)/config/pa/stublib.c
+ $(gcc_compile) -c -O2 -DL_ITM_deregisterTMCloneTable $<
+
cxaf-stub.o: $(srcdir)/config/pa/stublib.c
$(gcc_compile) -c -O2 -DL_cxa_finalize $<
diff --git a/libgcc/config/rl78/cmpsi2.S b/libgcc/config/rl78/cmpsi2.S
new file mode 100644
index 00000000000..14fa3cf0383
--- /dev/null
+++ b/libgcc/config/rl78/cmpsi2.S
@@ -0,0 +1,122 @@
+; Copyright (C) 2011 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/>.
+
+
+; clobberable
+r8 = 0xffef0
+
+ .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.
+
+ .global ___cmpsi2
+ .type ___cmpsi2, @function
+___cmpsi2:
+ ;; A is at [sp+4]
+ ;; B is at [sp+8]
+ ;; Result put in R8
+
+ ;; Initialise default return value.
+ onew bc
+
+ ;; Compare the high words.
+ movw ax, [sp + 10]
+ movw de, ax
+ movw ax, [sp + 6]
+ cmpw ax, de
+ skz
+ br !!.Lconvert_to_signed
+
+.Lcompare_bottom_words:
+ ;; The top words are equal - compare the bottom words.
+ ;; Note - code from __ucmpsi2 branches into here.
+ movw ax, [sp + 8]
+ movw de, ax
+ movw ax, [sp + 4]
+ cmpw ax, de
+ sknz
+ br !!.Lless_than_or_greater_than
+ ;; The words are equal - return 1.
+ ;; Note - we could branch to the return code at the end of the
+ ;; function but a branch instruction takes 4 bytes, and the
+ ;; return sequence itself is only 4 bytes long...
+ movw ax, bc
+ movw r8, ax
+ ret
+
+.Lconvert_to_signed:
+ ;; The top words are different. Unfortunately the comparison
+ ;; is always unsigned, so to get a signed result we XOR the CY
+ ;; flag with the top bits of AX and DE.
+ xor1 cy, a.7
+ mov a, d
+ xor1 cy, a.7
+ ;; Fall through.
+
+.Lless_than_or_greater_than:
+ ;; We now have a signed less than/greater than result in CY.
+ ;; Return 0 for less than, 2 for greater than.
+ ;; Note - code from __ucmpsi2 branches into here.
+ incw bc
+ sknc
+ clrw bc
+
+ ;; Get the result value, currently in BC, into r8
+ movw ax, bc
+ movw r8, ax
+ 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.
+
+ .global ___ucmpsi2
+ .type ___ucmpsi2, @function
+___ucmpsi2:
+ ;; A is at [sp+4]
+ ;; B is at [sp+8]
+ ;; Result put in R8..R9
+
+ ;; Initialise default return value.
+ onew bc
+
+ ;; Compare the high words.
+ movw ax, [sp + 10]
+ movw de, ax
+ movw ax, [sp + 6]
+ cmpw ax, de
+ skz
+ ;; Note: These branches go into the __cmpsi2 code!
+ br !!.Lless_than_or_greater_than
+ br !!.Lcompare_bottom_words
+
+ .size ___ucmpsi2, . - ___ucmpsi2
+ \ No newline at end of file
diff --git a/libgcc/config/rl78/lib2div.c b/libgcc/config/rl78/lib2div.c
new file mode 100644
index 00000000000..679f26dccec
--- /dev/null
+++ b/libgcc/config/rl78/lib2div.c
@@ -0,0 +1,81 @@
+/* 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/>. */
+
+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 "rl78-divmod.h"
+
+#undef UINT_TYPE
+#undef SINT_TYPE
+#undef BITS_MINUS_1
+#undef NAME_MODE
+
+#define UINT_TYPE uint16_type
+#define SINT_TYPE sint16_type
+#define BITS_MINUS_1 15
+#define NAME_MODE hi
+
+#include "rl78-divmod.h"
+
+#undef UINT_TYPE
+#undef SINT_TYPE
+#undef BITS_MINUS_1
+#undef NAME_MODE
+
+#define UINT_TYPE uint08_type
+#define SINT_TYPE sint08_type
+#define BITS_MINUS_1 7
+#define NAME_MODE qi
+
+#include "rl78-divmod.h"
+
+/* 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. */
+
+#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/rl78/lib2mul.c b/libgcc/config/rl78/lib2mul.c
new file mode 100644
index 00000000000..123690bc9ba
--- /dev/null
+++ b/libgcc/config/rl78/lib2mul.c
@@ -0,0 +1,49 @@
+/* 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/>. */
+
+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 "rl78-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 "rl78-mul.h"
diff --git a/libgcc/config/rl78/lib2shift.c b/libgcc/config/rl78/lib2shift.c
new file mode 100644
index 00000000000..c9db85ea0ed
--- /dev/null
+++ b/libgcc/config/rl78/lib2shift.c
@@ -0,0 +1,113 @@
+/* Shift functions for the GCC support library for the Renesas RL78 processors.
+ 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/rl78/lshrsi3.S b/libgcc/config/rl78/lshrsi3.S
new file mode 100644
index 00000000000..84222844259
--- /dev/null
+++ b/libgcc/config/rl78/lshrsi3.S
@@ -0,0 +1,131 @@
+; Copyright (C) 2011 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/>.
+
+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
+
+ .text
+ .global ___lshrsi3
+ .type ___lshrsi3, @function
+___lshrsi3:
+
+ ;; input:
+ ;;
+ ;; [zero]
+ ;; [count] <= $sp+8
+ ;; [in MSB]
+ ;; [in]
+ ;; [in]
+ ;; [in LSB] <- $sp+4
+
+ ;; output:
+ ;;
+ ;; [r8..r11] result
+
+ ;; registers:
+ ;;
+ ;; AX - temp for shift/rotate
+ ;; B - count
+
+ mov a, [sp+8] ; A now contains the count
+
+ cmp a, #0x20
+ bc $.Lcount_is_normal
+
+ ;; count is out of bounds, just return zero.
+ movw r8, #0
+ movw r10, #0
+ ret
+
+.Lcount_is_normal:
+ cmp0 a
+ bnz $.Lcount_is_nonzero
+
+ ;; count is zero, just copy IN to OUT
+ movw ax, [sp+4]
+ movw r8, ax
+ movw ax, [sp+6]
+ movw r10, ax
+ ret
+
+.Lcount_is_nonzero:
+ mov b, a ; B now contains the count also
+ bf a.4, $.Lcount_lt_16
+
+ ;; count >= 16, shift 16 at a time.
+ movw r10, #0
+ movw ax, [sp+6]
+ movw r8, ax
+ mov a, b
+ and a, #0x0f
+ sknz
+ ret
+
+ mov b, a ; B now contains the remaining count
+ inc b
+ br $.Lloop_top
+
+.Lcount_lt_16:
+ ;; count is nonzero. Do one
+ movw ax, [sp+6]
+ shrw ax,1
+ movw r10, ax
+ mov a, [sp+5]
+ rorc a,1
+ mov r9, a
+ mov a, [sp+4]
+ rorc a,1
+ mov r8, a
+
+ ;; we did one shift above; do as many more as we need now.
+.Lloop_top:
+ dec b
+ sknz
+ ret
+
+ movw ax, r10
+ shrw ax,1
+ movw r10, ax
+ mov a, r9
+ rorc a,1
+ mov r9, a
+ mov a, r8
+ rorc a,1
+ mov r8, a
+
+ br $.Lloop_top
+
+ .size ___lshrsi3, .-___lshrsi3
diff --git a/libgcc/config/rl78/mulsi3.S b/libgcc/config/rl78/mulsi3.S
new file mode 100644
index 00000000000..0bca43ad098
--- /dev/null
+++ b/libgcc/config/rl78/mulsi3.S
@@ -0,0 +1,235 @@
+; Copyright (C) 2011 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/>.
+
+;; 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
+
+
+;----------------------------------------------------------------------
+
+; Register use:
+; RB0 RB1 RB2
+; AX op2L res32L res32H
+; BC op2H (resH) op1
+; DE count (resL-tmp)
+; HL [sp+4]
+
+ .text
+ nop
+ .global ___mulsi3 ; (USI a, USI b)
+___mulsi3:
+ ;; A is at [sp+4]
+ ;; 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
+ sel rb0
+
+ clrw ax
+ movw r8, ax
+ movw r16, ax
+
+ movw ax, [hl+6]
+ cmpw ax, #0
+ bz $1f
+ cmpw ax, #0xffff
+ bnz $2f
+ movw ax, [hl]
+ sel rb1
+ subw ax, r_0
+ sel rb0
+ br $1f
+2:
+ movw bc, ax
+ movw ax, [hl]
+ cmpw ax, #0
+ skz
+ call !.Lmul_hi
+1:
+
+ movw ax, [hl+2]
+ cmpw ax, #0
+ bz $1f
+ cmpw ax, #0xffff
+ bnz $2f
+ movw ax, [hl+4]
+ sel rb1
+ subw ax, r_0
+ sel rb0
+ br $1f
+2:
+ movw bc, ax
+ movw ax, [hl+4]
+ cmpw ax, #0
+ skz
+ call !.Lmul_hi
+1:
+
+ movw ax, r8
+ movw r16, ax
+ clrw ax
+ movw r8, ax
+
+ ;; now do R16:R8 += op1L * op2L
+
+ ;; op1 is in AX.0 (needs to shrw)
+ ;; 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 r10, ax ; BC.1
+ movw ax, [hl+4]
+
+ cmpw ax, r10
+ bc $.Lmul_hisi_top
+ movw bc, r10
+ movw r10, ax
+ movw ax, bc
+
+
+.Lmul_hisi_top:
+ movw bc, #0
+
+.Lmul_hisi_loop:
+ shrw ax, 1
+ bnc $.Lmul_hisi_no_add
+ sel rb1
+ addw ax, bc
+ sel rb2
+ sknc
+ incw ax
+ addw ax, r_2
+.Lmul_hisi_no_add:
+ sel rb1
+ shlw bc, 1
+ sel rb0
+ rolwc bc, 1
+ cmpw ax, #0
+ bz $.Lmul_hisi_done
+
+ shrw ax, 1
+ bnc $.Lmul_hisi_no_add2
+ sel rb1
+ addw ax, bc
+ sel rb2
+ sknc
+ incw ax
+ addw ax, r_2
+.Lmul_hisi_no_add2:
+ sel rb1
+ shlw bc, 1
+ sel rb0
+ rolwc bc, 1
+ cmpw ax, #0
+ bnz $.Lmul_hisi_loop
+
+.Lmul_hisi_done:
+
+ movw ax, r16
+ movw r10, ax
+
+ sel rb2
+ pop bc
+ pop ax
+ sel rb0
+
+ ret
+
+;----------------------------------------------------------------------
+
+ ;; R8 += AX * BC
+.Lmul_hi:
+ cmpw ax, bc
+ skc
+ xchw ax, bc
+ br $.Lmul_hi_loop
+
+.Lmul_hi_top:
+ sel rb1
+ addw ax, r_2
+ sel rb0
+.Lmul_hi_no_add:
+ shlw bc, 1
+.Lmul_hi_loop:
+ shrw ax, 1
+ bc $.Lmul_hi_top
+ cmpw ax, #0
+ bz $.Lmul_hi_done
+
+ shlw bc, 1
+ shrw ax, 1
+ bc $.Lmul_hi_top
+ cmpw ax, #0
+ bnz $.Lmul_hi_no_add
+
+.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
diff --git a/libgcc/config/rl78/rl78-divmod.h b/libgcc/config/rl78/rl78-divmod.h
new file mode 100644
index 00000000000..8ea5e1eeb10
--- /dev/null
+++ b/libgcc/config/rl78/rl78-divmod.h
@@ -0,0 +1,118 @@
+/* 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(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/rl78/rl78-mul.h b/libgcc/config/rl78/rl78-mul.h
new file mode 100644
index 00000000000..fc2cd6c6ebb
--- /dev/null
+++ b/libgcc/config/rl78/rl78-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/rl78/t-rl78 b/libgcc/config/rl78/t-rl78
new file mode 100644
index 00000000000..d1a82a29020
--- /dev/null
+++ b/libgcc/config/rl78/t-rl78
@@ -0,0 +1,28 @@
+# Makefile fragment for building LIBGCC for the Renesas RL78 target.
+# 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/>.
+
+LIB2ADD = \
+ $(srcdir)/config/rl78/trampoline.S \
+ $(srcdir)/config/rl78/lib2div.c \
+ $(srcdir)/config/rl78/lib2mul.c \
+ $(srcdir)/config/rl78/lib2shift.c \
+ $(srcdir)/config/rl78/lshrsi3.S \
+ $(srcdir)/config/rl78/mulsi3.S \
+ $(srcdir)/config/rl78/cmpsi2.S
diff --git a/libgcc/config/rl78/trampoline.S b/libgcc/config/rl78/trampoline.S
new file mode 100644
index 00000000000..ef3aa6c97a6
--- /dev/null
+++ b/libgcc/config/rl78/trampoline.S
@@ -0,0 +1,139 @@
+/* libgcc routines for RL78
+ 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/>. */
+
+/* RL78 Trampoline support
+
+ Since the RL78's RAM is not in the first 64k, we cannot "just" use a
+ function pointer to point to a trampoline on the stack. So, we
+ create N fixed trampolines that read from an array, and allocate
+ them as needed.
+
+*/
+
+r8 = 0xffef0
+r10 = 0xffef2
+r14 = 0xffef6
+
+ .data
+ .p2align 1
+trampoline_array:
+
+ .macro stub n
+
+ .text
+trampoline_\n:
+ .type trampoline_\n, @function
+ movw ax, !trampoline_chain_\n
+ movw r14, ax
+ movw ax, !trampoline_addr_\n
+ br ax
+ .size trampoline_\n, .-trampoline_\n
+
+ .data
+trampoline_frame_\n:
+ .short 0
+trampoline_stub_\n:
+ .short trampoline_\n
+trampoline_chain_\n:
+ .short 0
+trampoline_addr_\n:
+ .short 0
+
+#define TO_FRAME 0
+#define TO_STUB 2
+#define TO_CHAIN 4
+#define TO_ADDR 6
+#define TO_SIZE 8
+
+ .endm
+
+ stub 0
+ stub 1
+ stub 2
+ stub 3
+ stub 4
+ stub 5
+
+trampoline_array_end:
+
+/* Given the function pointer in R8 and the static chain
+ pointer in R10, allocate a trampoline and return its address in
+ R8. */
+
+ .text
+ .global ___trampoline_init
+ .type ___trampoline_init, @function
+___trampoline_init:
+
+ movw hl, #trampoline_array
+1:
+ movw ax, [hl + TO_ADDR]
+ cmpw ax, #0
+ bz $2f
+
+ movw ax, hl
+ addw ax, #TO_SIZE
+ movw hl, ax
+ cmpw ax, #trampoline_array_end
+ bnz $1b
+ brk ; no more slots?
+
+2: movw ax, r8
+ movw [hl + TO_ADDR], ax
+ movw ax, r10
+ movw [hl + TO_CHAIN], ax
+ movw ax, sp
+ movw [hl + TO_FRAME], ax
+
+ movw ax, [hl + TO_STUB]
+ movw r8, ax
+
+ ret
+ .size ___trampoline_init, . - ___trampoline_init
+
+ .global ___trampoline_uninit
+ .type ___trampoline_uninit, @function
+___trampoline_uninit:
+ movw hl, #trampoline_array
+ movw ax, sp
+ movw bc, ax
+1:
+ movw ax, [hl + TO_FRAME]
+ cmpw ax, bc
+ bc $2f
+
+ clrw ax
+ movw [hl + TO_ADDR], ax
+
+2:
+ movw ax, hl
+ addw ax, #TO_SIZE
+ movw hl, ax
+ cmpw ax, #trampoline_array_end
+ bnz $1b
+
+ ret
+ .size ___trampoline_uninit, . - ___trampoline_uninit
diff --git a/libgcc/config/rs6000/t-ppccomm b/libgcc/config/rs6000/t-ppccomm
index e9233688268..fb812d3801f 100644
--- a/libgcc/config/rs6000/t-ppccomm
+++ b/libgcc/config/rs6000/t-ppccomm
@@ -1,27 +1,8 @@
LIB2ADD += $(srcdir)/config/rs6000/ibm-ldouble.c \
$(srcdir)/config/rs6000/tramp.S
-# These can't end up in shared libgcc
+# This can't end up in shared libgcc
LIB2ADD_ST += \
- $(srcdir)/config/rs6000/crtsavfpr.S \
- $(srcdir)/config/rs6000/crtresfpr.S \
- $(srcdir)/config/rs6000/crtsavgpr.S \
- $(srcdir)/config/rs6000/crtresgpr.S \
- $(srcdir)/config/rs6000/crtresxfpr.S \
- $(srcdir)/config/rs6000/crtresxgpr.S \
- $(srcdir)/config/rs6000/e500crtres32gpr.S \
- $(srcdir)/config/rs6000/e500crtres64gpr.S \
- $(srcdir)/config/rs6000/e500crtres64gprctr.S \
- $(srcdir)/config/rs6000/e500crtrest32gpr.S \
- $(srcdir)/config/rs6000/e500crtrest64gpr.S \
- $(srcdir)/config/rs6000/e500crtresx32gpr.S \
- $(srcdir)/config/rs6000/e500crtresx64gpr.S \
- $(srcdir)/config/rs6000/e500crtsav32gpr.S \
- $(srcdir)/config/rs6000/e500crtsav64gpr.S \
- $(srcdir)/config/rs6000/e500crtsav64gprctr.S \
- $(srcdir)/config/rs6000/e500crtsavg32gpr.S \
- $(srcdir)/config/rs6000/e500crtsavg64gpr.S \
- $(srcdir)/config/rs6000/e500crtsavg64gprctr.S \
$(srcdir)/config/rs6000/eabi.S
# We build {e,n}crti.o and {e,n}crtn.o, which serve to add begin and
diff --git a/libgcc/config/rs6000/t-ppccomm-ldbl b/libgcc/config/rs6000/t-ppccomm-ldbl
deleted file mode 100644
index f1d53606677..00000000000
--- a/libgcc/config/rs6000/t-ppccomm-ldbl
+++ /dev/null
@@ -1 +0,0 @@
-LIB2ADD += $(srcdir)/config/rs6000/ibm-ldouble.c
diff --git a/libgcc/config/rs6000/t-savresfgpr b/libgcc/config/rs6000/t-savresfgpr
new file mode 100644
index 00000000000..e2a951abd3f
--- /dev/null
+++ b/libgcc/config/rs6000/t-savresfgpr
@@ -0,0 +1,21 @@
+# These can't end up in shared libgcc
+LIB2ADD_ST += \
+ $(srcdir)/config/rs6000/crtsavfpr.S \
+ $(srcdir)/config/rs6000/crtresfpr.S \
+ $(srcdir)/config/rs6000/crtsavgpr.S \
+ $(srcdir)/config/rs6000/crtresgpr.S \
+ $(srcdir)/config/rs6000/crtresxfpr.S \
+ $(srcdir)/config/rs6000/crtresxgpr.S \
+ $(srcdir)/config/rs6000/e500crtres32gpr.S \
+ $(srcdir)/config/rs6000/e500crtres64gpr.S \
+ $(srcdir)/config/rs6000/e500crtres64gprctr.S \
+ $(srcdir)/config/rs6000/e500crtrest32gpr.S \
+ $(srcdir)/config/rs6000/e500crtrest64gpr.S \
+ $(srcdir)/config/rs6000/e500crtresx32gpr.S \
+ $(srcdir)/config/rs6000/e500crtresx64gpr.S \
+ $(srcdir)/config/rs6000/e500crtsav32gpr.S \
+ $(srcdir)/config/rs6000/e500crtsav64gpr.S \
+ $(srcdir)/config/rs6000/e500crtsav64gprctr.S \
+ $(srcdir)/config/rs6000/e500crtsavg32gpr.S \
+ $(srcdir)/config/rs6000/e500crtsavg64gpr.S \
+ $(srcdir)/config/rs6000/e500crtsavg64gprctr.S
diff --git a/libgo/MERGE b/libgo/MERGE
index 8ba17deb09e..2a86f2f86ed 100644
--- a/libgo/MERGE
+++ b/libgo/MERGE
@@ -1,4 +1,4 @@
-6d7136d74b65
+941b8015061a
The first line of this file holds the Mercurial revision number of the
last merge done from the master library sources.
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index c30d9c36c2b..5ab10a61f3d 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -236,11 +236,19 @@ toolexeclibgoencoding_DATA = \
encoding/hex.gox \
encoding/pem.gox
+if LIBGO_IS_LINUX
+# exp_inotify_gox = exp/inotify.gox
+exp_inotify_gox =
+else
+exp_inotify_gox =
+endif
+
toolexeclibgoexpdir = $(toolexeclibgodir)/exp
toolexeclibgoexp_DATA = \
exp/ebnf.gox \
exp/gui.gox \
+ $(exp_inotify_gox) \
exp/norm.gox \
exp/spdy.gox \
exp/sql.gox \
@@ -332,15 +340,7 @@ toolexeclibgoold_DATA = \
toolexeclibgoosdir = $(toolexeclibgodir)/os
-if LIBGO_IS_LINUX
-# os_inotify_gox = os/inotify.gox
-os_inotify_gox =
-else
-os_inotify_gox =
-endif
-
toolexeclibgoos_DATA = \
- $(os_inotify_gox) \
os/user.gox \
os/signal.gox
@@ -1212,6 +1212,8 @@ go_exp_ebnf_files = \
go/exp/ebnf/parser.go
go_exp_gui_files = \
go/exp/gui/gui.go
+go_exp_inotify_files = \
+ go/exp/inotify/inotify_linux.go
go_exp_norm_files = \
go/exp/norm/composition.go \
go/exp/norm/forminfo.go \
@@ -1229,11 +1231,13 @@ go_exp_sql_files = \
go/exp/sql/sql.go
go_exp_ssh_files = \
go/exp/ssh/channel.go \
+ go/exp/ssh/client.go \
go/exp/ssh/common.go \
go/exp/ssh/doc.go \
go/exp/ssh/messages.go \
go/exp/ssh/server.go \
go/exp/ssh/server_shell.go \
+ go/exp/ssh/session.go \
go/exp/ssh/transport.go
go_exp_terminal_files = \
go/exp/terminal/shell.go \
@@ -1387,9 +1391,6 @@ go_old_template_files = \
go/old/template/format.go \
go/old/template/parse.go
-go_os_inotify_files = \
- go/os/inotify/inotify_linux.go
-
go_os_user_files = \
go/os/user/user.go \
go/os/user/lookup_unix.go
@@ -2723,6 +2724,13 @@ exp/gui/x11/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: exp/gui/x11/check
+exp/inotify.lo: $(go_exp_inotify_files) fmt.gox os.gox strings.gox syscall.gox
+ $(BUILDPACKAGE)
+exp/inotify/check: $(CHECK_DEPS)
+ @$(MKDIR_P) exp/inotify
+ @$(CHECK)
+.PHONY: exp/inotify/check
+
exp/sql/driver.lo: $(go_exp_sql_driver_files) fmt.gox os.gox reflect.gox \
strconv.gox
$(BUILDPACKAGE)
@@ -2998,13 +3006,6 @@ old/template/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: old/template/check
-os/inotify.lo: $(go_os_inotify_files) fmt.gox os.gox strings.gox syscall.gox
- $(BUILDPACKAGE)
-os/inotify/check: $(CHECK_DEPS)
- @$(MKDIR_P) os/inotify
- @$(CHECK)
-.PHONY: os/inotify/check
-
os/user.lo: $(go_os_user_files) fmt.gox os.gox runtime.gox strconv.gox \
strings.gox syscall.gox
$(BUILDPACKAGE)
@@ -3331,6 +3332,8 @@ exp/ebnf.gox: exp/ebnf.lo
$(BUILDGOX)
exp/gui.gox: exp/gui.lo
$(BUILDGOX)
+exp/inotify.gox: exp/inotify.lo
+ $(BUILDGOX)
exp/norm.gox: exp/norm.lo
$(BUILDGOX)
exp/spdy.gox: exp/spdy.lo
@@ -3424,8 +3427,6 @@ old/regexp.gox: old/regexp.lo
old/template.gox: old/template.lo
$(BUILDGOX)
-os/inotify.gox: os/inotify.lo
- $(BUILDGOX)
os/user.gox: os/user.lo
$(BUILDGOX)
os/signal.gox: os/signal.lo
@@ -3459,10 +3460,10 @@ testing/script.gox: testing/script.lo
$(BUILDGOX)
if LIBGO_IS_LINUX
-# os_inotify_check = os/inotify/check
-os_inotify_check =
+# exp_inotify_check = exp/inotify/check
+exp_inotify_check =
else
-os_inotify_check =
+exp_inotify_check =
endif
TEST_PACKAGES = \
@@ -3563,6 +3564,7 @@ TEST_PACKAGES = \
encoding/hex/check \
encoding/pem/check \
exp/ebnf/check \
+ $(exp_inotify_check) \
exp/norm/check \
exp/spdy/check \
exp/sql/check \
@@ -3594,7 +3596,6 @@ TEST_PACKAGES = \
old/netchan/check \
old/regexp/check \
old/template/check \
- $(os_inotify_check) \
os/user/check \
os/signal/check \
path/filepath/check \
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 8b6bb728272..f7c293a66cc 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -699,10 +699,15 @@ toolexeclibgoencoding_DATA = \
encoding/hex.gox \
encoding/pem.gox
+@LIBGO_IS_LINUX_FALSE@exp_inotify_gox =
+
+# exp_inotify_gox = exp/inotify.gox
+@LIBGO_IS_LINUX_TRUE@exp_inotify_gox =
toolexeclibgoexpdir = $(toolexeclibgodir)/exp
toolexeclibgoexp_DATA = \
exp/ebnf.gox \
exp/gui.gox \
+ $(exp_inotify_gox) \
exp/norm.gox \
exp/spdy.gox \
exp/sql.gox \
@@ -781,12 +786,7 @@ toolexeclibgoold_DATA = \
old/template.gox
toolexeclibgoosdir = $(toolexeclibgodir)/os
-@LIBGO_IS_LINUX_FALSE@os_inotify_gox =
-
-# os_inotify_gox = os/inotify.gox
-@LIBGO_IS_LINUX_TRUE@os_inotify_gox =
toolexeclibgoos_DATA = \
- $(os_inotify_gox) \
os/user.gox \
os/signal.gox
@@ -1579,6 +1579,9 @@ go_exp_ebnf_files = \
go_exp_gui_files = \
go/exp/gui/gui.go
+go_exp_inotify_files = \
+ go/exp/inotify/inotify_linux.go
+
go_exp_norm_files = \
go/exp/norm/composition.go \
go/exp/norm/forminfo.go \
@@ -1599,11 +1602,13 @@ go_exp_sql_files = \
go_exp_ssh_files = \
go/exp/ssh/channel.go \
+ go/exp/ssh/client.go \
go/exp/ssh/common.go \
go/exp/ssh/doc.go \
go/exp/ssh/messages.go \
go/exp/ssh/server.go \
go/exp/ssh/server_shell.go \
+ go/exp/ssh/session.go \
go/exp/ssh/transport.go
go_exp_terminal_files = \
@@ -1773,9 +1778,6 @@ go_old_template_files = \
go/old/template/format.go \
go/old/template/parse.go
-go_os_inotify_files = \
- go/os/inotify/inotify_linux.go
-
go_os_user_files = \
go/os/user/user.go \
go/os/user/lookup_unix.go
@@ -2171,10 +2173,10 @@ BUILDGOX = \
f=`echo $< | sed -e 's/.lo$$/.o/'`; \
$(OBJCOPY) -j .go_export $$f $@.tmp && mv -f $@.tmp $@
-@LIBGO_IS_LINUX_FALSE@os_inotify_check =
+@LIBGO_IS_LINUX_FALSE@exp_inotify_check =
-# os_inotify_check = os/inotify/check
-@LIBGO_IS_LINUX_TRUE@os_inotify_check =
+# exp_inotify_check = exp/inotify/check
+@LIBGO_IS_LINUX_TRUE@exp_inotify_check =
TEST_PACKAGES = \
asn1/check \
big/check \
@@ -2273,6 +2275,7 @@ TEST_PACKAGES = \
encoding/hex/check \
encoding/pem/check \
exp/ebnf/check \
+ $(exp_inotify_check) \
exp/norm/check \
exp/spdy/check \
exp/sql/check \
@@ -2304,7 +2307,6 @@ TEST_PACKAGES = \
old/netchan/check \
old/regexp/check \
old/template/check \
- $(os_inotify_check) \
os/user/check \
os/signal/check \
path/filepath/check \
@@ -5326,6 +5328,13 @@ exp/gui/x11/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: exp/gui/x11/check
+exp/inotify.lo: $(go_exp_inotify_files) fmt.gox os.gox strings.gox syscall.gox
+ $(BUILDPACKAGE)
+exp/inotify/check: $(CHECK_DEPS)
+ @$(MKDIR_P) exp/inotify
+ @$(CHECK)
+.PHONY: exp/inotify/check
+
exp/sql/driver.lo: $(go_exp_sql_driver_files) fmt.gox os.gox reflect.gox \
strconv.gox
$(BUILDPACKAGE)
@@ -5601,13 +5610,6 @@ old/template/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: old/template/check
-os/inotify.lo: $(go_os_inotify_files) fmt.gox os.gox strings.gox syscall.gox
- $(BUILDPACKAGE)
-os/inotify/check: $(CHECK_DEPS)
- @$(MKDIR_P) os/inotify
- @$(CHECK)
-.PHONY: os/inotify/check
-
os/user.lo: $(go_os_user_files) fmt.gox os.gox runtime.gox strconv.gox \
strings.gox syscall.gox
$(BUILDPACKAGE)
@@ -5929,6 +5931,8 @@ exp/ebnf.gox: exp/ebnf.lo
$(BUILDGOX)
exp/gui.gox: exp/gui.lo
$(BUILDGOX)
+exp/inotify.gox: exp/inotify.lo
+ $(BUILDGOX)
exp/norm.gox: exp/norm.lo
$(BUILDGOX)
exp/spdy.gox: exp/spdy.lo
@@ -6022,8 +6026,6 @@ old/regexp.gox: old/regexp.lo
old/template.gox: old/template.lo
$(BUILDGOX)
-os/inotify.gox: os/inotify.lo
- $(BUILDGOX)
os/user.gox: os/user.lo
$(BUILDGOX)
os/signal.gox: os/signal.lo
diff --git a/libgo/config.h.in b/libgo/config.h.in
index be4a13a8b52..0c1283cc574 100644
--- a/libgo/config.h.in
+++ b/libgo/config.h.in
@@ -36,6 +36,9 @@
/* Define to 1 if you have the `random' function. */
#undef HAVE_RANDOM
+/* Define to 1 if you have the `sem_timedwait' function. */
+#undef HAVE_SEM_TIMEDWAIT
+
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
diff --git a/libgo/configure b/libgo/configure
index 9c619bed47d..e9f536a5883 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -14559,6 +14559,24 @@ else
fi
+CFLAGS_hold="$CFLAGS"
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+LIBS_hold="$LIBS"
+LIBS="$LIBS $PTHREAD_LIBS"
+for ac_func in sem_timedwait
+do :
+ ac_fn_c_check_func "$LINENO" "sem_timedwait" "ac_cv_func_sem_timedwait"
+if test "x$ac_cv_func_sem_timedwait" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SEM_TIMEDWAIT 1
+_ACEOF
+
+fi
+done
+
+CFLAGS="$CFLAGS_hold"
+LIBS="$LIBS_hold"
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sync_bool_compare_and_swap_4" >&5
$as_echo_n "checking for __sync_bool_compare_and_swap_4... " >&6; }
if test "${libgo_cv_func___sync_bool_compare_and_swap_4+set}" = set; then :
diff --git a/libgo/configure.ac b/libgo/configure.ac
index e19b5f37b70..576d1a64329 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -456,6 +456,14 @@ AC_CHECK_FUNCS(srandom random strerror_r strsignal wait4 mincore setenv)
AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes)
AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes)
+CFLAGS_hold="$CFLAGS"
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+LIBS_hold="$LIBS"
+LIBS="$LIBS $PTHREAD_LIBS"
+AC_CHECK_FUNCS(sem_timedwait)
+CFLAGS="$CFLAGS_hold"
+LIBS="$LIBS_hold"
+
AC_CACHE_CHECK([for __sync_bool_compare_and_swap_4],
[libgo_cv_func___sync_bool_compare_and_swap_4],
[AC_LINK_IFELSE([
diff --git a/libgo/go/big/int.go b/libgo/go/big/int.go
index 9e1d1ae1318..b0dde1e6e37 100644
--- a/libgo/go/big/int.go
+++ b/libgo/go/big/int.go
@@ -58,22 +58,24 @@ func NewInt(x int64) *Int {
// Set sets z to x and returns z.
func (z *Int) Set(x *Int) *Int {
- z.abs = z.abs.set(x.abs)
- z.neg = x.neg
+ if z != x {
+ z.abs = z.abs.set(x.abs)
+ z.neg = x.neg
+ }
return z
}
// Abs sets z to |x| (the absolute value of x) and returns z.
func (z *Int) Abs(x *Int) *Int {
- z.abs = z.abs.set(x.abs)
+ z.Set(x)
z.neg = false
return z
}
// Neg sets z to -x and returns z.
func (z *Int) Neg(x *Int) *Int {
- z.abs = z.abs.set(x.abs)
- z.neg = len(z.abs) > 0 && !x.neg // 0 has no sign
+ z.Set(x)
+ z.neg = len(z.abs) > 0 && !z.neg // 0 has no sign
return z
}
@@ -174,7 +176,7 @@ func (z *Int) Quo(x, y *Int) *Int {
// If y == 0, a division-by-zero run-time panic occurs.
// Rem implements truncated modulus (like Go); see QuoRem for more details.
func (z *Int) Rem(x, y *Int) *Int {
- _, z.abs = nat(nil).div(z.abs, x.abs, y.abs)
+ _, z.abs = nat{}.div(z.abs, x.abs, y.abs)
z.neg = len(z.abs) > 0 && x.neg // 0 has no sign
return z
}
@@ -422,8 +424,8 @@ func (x *Int) Format(s fmt.State, ch int) {
// scan sets z to the integer value corresponding to the longest possible prefix
// read from r representing a signed integer number in a given conversion base.
// It returns z, the actual conversion base used, and an error, if any. In the
-// error case, the value of z is undefined. The syntax follows the syntax of
-// integer literals in Go.
+// error case, the value of z is undefined but the returned value is nil. The
+// syntax follows the syntax of integer literals in Go.
//
// The base argument must be 0 or a value from 2 through MaxBase. If the base
// is 0, the string prefix determines the actual conversion base. A prefix of
@@ -434,7 +436,7 @@ func (z *Int) scan(r io.RuneScanner, base int) (*Int, int, os.Error) {
// determine sign
ch, _, err := r.ReadRune()
if err != nil {
- return z, 0, err
+ return nil, 0, err
}
neg := false
switch ch {
@@ -448,7 +450,7 @@ func (z *Int) scan(r io.RuneScanner, base int) (*Int, int, os.Error) {
// determine mantissa
z.abs, base, err = z.abs.scan(r, base)
if err != nil {
- return z, base, err
+ return nil, base, err
}
z.neg = len(z.abs) > 0 && neg // 0 has no sign
@@ -497,7 +499,7 @@ func (x *Int) Int64() int64 {
// SetString sets z to the value of s, interpreted in the given base,
// and returns z and a boolean indicating success. If SetString fails,
-// the value of z is undefined.
+// the value of z is undefined but the returned value is nil.
//
// The base argument must be 0 or a value from 2 through MaxBase. If the base
// is 0, the string prefix determines the actual conversion base. A prefix of
@@ -508,10 +510,13 @@ func (z *Int) SetString(s string, base int) (*Int, bool) {
r := strings.NewReader(s)
_, _, err := z.scan(r, base)
if err != nil {
- return z, false
+ return nil, false
}
_, _, err = r.ReadRune()
- return z, err == os.EOF // err == os.EOF => scan consumed all of s
+ if err != os.EOF {
+ return nil, false
+ }
+ return z, true // err == os.EOF => scan consumed all of s
}
// SetBytes interprets buf as the bytes of a big-endian unsigned
diff --git a/libgo/go/big/int_test.go b/libgo/go/big/int_test.go
index b2e16921799..fde19c23b72 100644
--- a/libgo/go/big/int_test.go
+++ b/libgo/go/big/int_test.go
@@ -311,7 +311,16 @@ func TestSetString(t *testing.T) {
t.Errorf("#%d (input '%s') ok incorrect (should be %t)", i, test.in, test.ok)
continue
}
- if !ok1 || !ok2 {
+ if !ok1 {
+ if n1 != nil {
+ t.Errorf("#%d (input '%s') n1 != nil", i, test.in)
+ }
+ continue
+ }
+ if !ok2 {
+ if n2 != nil {
+ t.Errorf("#%d (input '%s') n2 != nil", i, test.in)
+ }
continue
}
diff --git a/libgo/go/big/nat.go b/libgo/go/big/nat.go
index 33d6bb16ffd..c0769d88a91 100644
--- a/libgo/go/big/nat.go
+++ b/libgo/go/big/nat.go
@@ -35,7 +35,7 @@ import (
// During arithmetic operations, denormalized values may occur but are
// always normalized before returning the final result. The normalized
// representation of 0 is the empty or nil slice (length = 0).
-
+//
type nat []Word
var (
@@ -447,10 +447,10 @@ func (z nat) mulRange(a, b uint64) nat {
case a == b:
return z.setUint64(a)
case a+1 == b:
- return z.mul(nat(nil).setUint64(a), nat(nil).setUint64(b))
+ return z.mul(nat{}.setUint64(a), nat{}.setUint64(b))
}
m := (a + b) / 2
- return z.mul(nat(nil).mulRange(a, m), nat(nil).mulRange(m+1, b))
+ return z.mul(nat{}.mulRange(a, m), nat{}.mulRange(m+1, b))
}
// q = (x-r)/y, with 0 <= r < y
@@ -589,7 +589,6 @@ func (x nat) bitLen() int {
// MaxBase is the largest number base accepted for string conversions.
const MaxBase = 'z' - 'a' + 10 + 1 // = hexValue('z') + 1
-
func hexValue(ch int) Word {
d := MaxBase + 1 // illegal base
switch {
@@ -786,7 +785,7 @@ func (x nat) string(charset string) string {
}
// preserve x, create local copy for use in repeated divisions
- q := nat(nil).set(x)
+ q := nat{}.set(x)
var r Word
// convert
@@ -1192,11 +1191,11 @@ func (n nat) probablyPrime(reps int) bool {
return false
}
- nm1 := nat(nil).sub(n, natOne)
+ nm1 := nat{}.sub(n, natOne)
// 1<<k * q = nm1;
q, k := nm1.powersOfTwoDecompose()
- nm3 := nat(nil).sub(nm1, natTwo)
+ nm3 := nat{}.sub(nm1, natTwo)
rand := rand.New(rand.NewSource(int64(n[0])))
var x, y, quotient nat
diff --git a/libgo/go/big/nat_test.go b/libgo/go/big/nat_test.go
index 71d0860878c..4f5732824c5 100644
--- a/libgo/go/big/nat_test.go
+++ b/libgo/go/big/nat_test.go
@@ -67,7 +67,7 @@ var prodNN = []argNN{
func TestSet(t *testing.T) {
for _, a := range sumNN {
- z := nat(nil).set(a.z)
+ z := nat{}.set(a.z)
if z.cmp(a.z) != 0 {
t.Errorf("got z = %v; want %v", z, a.z)
}
@@ -129,7 +129,7 @@ var mulRangesN = []struct {
func TestMulRangeN(t *testing.T) {
for i, r := range mulRangesN {
- prod := nat(nil).mulRange(r.a, r.b).decimalString()
+ prod := nat{}.mulRange(r.a, r.b).decimalString()
if prod != r.prod {
t.Errorf("#%d: got %s; want %s", i, prod, r.prod)
}
@@ -175,7 +175,7 @@ func toString(x nat, charset string) string {
s := make([]byte, i)
// don't destroy x
- q := nat(nil).set(x)
+ q := nat{}.set(x)
// convert
for len(q) > 0 {
@@ -212,7 +212,7 @@ func TestString(t *testing.T) {
t.Errorf("string%+v\n\tgot s = %s; want %s", a, s, a.s)
}
- x, b, err := nat(nil).scan(strings.NewReader(a.s), len(a.c))
+ x, b, err := nat{}.scan(strings.NewReader(a.s), len(a.c))
if x.cmp(a.x) != 0 {
t.Errorf("scan%+v\n\tgot z = %v; want %v", a, x, a.x)
}
@@ -271,7 +271,7 @@ var natScanTests = []struct {
func TestScanBase(t *testing.T) {
for _, a := range natScanTests {
r := strings.NewReader(a.s)
- x, b, err := nat(nil).scan(r, a.base)
+ x, b, err := nat{}.scan(r, a.base)
if err == nil && !a.ok {
t.Errorf("scan%+v\n\texpected error", a)
}
@@ -651,17 +651,17 @@ var expNNTests = []struct {
func TestExpNN(t *testing.T) {
for i, test := range expNNTests {
- x, _, _ := nat(nil).scan(strings.NewReader(test.x), 0)
- y, _, _ := nat(nil).scan(strings.NewReader(test.y), 0)
- out, _, _ := nat(nil).scan(strings.NewReader(test.out), 0)
+ x, _, _ := nat{}.scan(strings.NewReader(test.x), 0)
+ y, _, _ := nat{}.scan(strings.NewReader(test.y), 0)
+ out, _, _ := nat{}.scan(strings.NewReader(test.out), 0)
var m nat
if len(test.m) > 0 {
- m, _, _ = nat(nil).scan(strings.NewReader(test.m), 0)
+ m, _, _ = nat{}.scan(strings.NewReader(test.m), 0)
}
- z := nat(nil).expNN(x, y, m)
+ z := nat{}.expNN(x, y, m)
if z.cmp(out) != 0 {
t.Errorf("#%d got %v want %v", i, z, out)
}
diff --git a/libgo/go/big/rat.go b/libgo/go/big/rat.go
index f435e637f19..6b860627206 100644
--- a/libgo/go/big/rat.go
+++ b/libgo/go/big/rat.go
@@ -13,11 +13,11 @@ import (
"strings"
)
-// A Rat represents a quotient a/b of arbitrary precision. The zero value for
-// a Rat, 0/0, is not a legal Rat.
+// A Rat represents a quotient a/b of arbitrary precision.
+// The zero value for a Rat represents the value 0.
type Rat struct {
a Int
- b nat
+ b nat // len(b) == 0 acts like b == 1
}
// NewRat creates a new Rat with numerator a and denominator b.
@@ -29,8 +29,11 @@ func NewRat(a, b int64) *Rat {
func (z *Rat) SetFrac(a, b *Int) *Rat {
z.a.neg = a.neg != b.neg
babs := b.abs
+ if len(babs) == 0 {
+ panic("division by zero")
+ }
if &z.a == b || alias(z.a.abs, babs) {
- babs = nat(nil).set(babs) // make a copy
+ babs = nat{}.set(babs) // make a copy
}
z.a.abs = z.a.abs.set(a.abs)
z.b = z.b.set(babs)
@@ -40,6 +43,9 @@ func (z *Rat) SetFrac(a, b *Int) *Rat {
// SetFrac64 sets z to a/b and returns z.
func (z *Rat) SetFrac64(a, b int64) *Rat {
z.a.SetInt64(a)
+ if b == 0 {
+ panic("division by zero")
+ }
if b < 0 {
b = -b
z.a.neg = !z.a.neg
@@ -51,14 +57,55 @@ func (z *Rat) SetFrac64(a, b int64) *Rat {
// SetInt sets z to x (by making a copy of x) and returns z.
func (z *Rat) SetInt(x *Int) *Rat {
z.a.Set(x)
- z.b = z.b.setWord(1)
+ z.b = z.b.make(0)
return z
}
// SetInt64 sets z to x and returns z.
func (z *Rat) SetInt64(x int64) *Rat {
z.a.SetInt64(x)
- z.b = z.b.setWord(1)
+ z.b = z.b.make(0)
+ return z
+}
+
+// Set sets z to x (by making a copy of x) and returns z.
+func (z *Rat) Set(x *Rat) *Rat {
+ if z != x {
+ z.a.Set(&x.a)
+ z.b = z.b.set(x.b)
+ }
+ return z
+}
+
+// Abs sets z to |x| (the absolute value of x) and returns z.
+func (z *Rat) Abs(x *Rat) *Rat {
+ z.Set(x)
+ z.a.neg = false
+ return z
+}
+
+// Neg sets z to -x and returns z.
+func (z *Rat) Neg(x *Rat) *Rat {
+ z.Set(x)
+ z.a.neg = len(z.a.abs) > 0 && !z.a.neg // 0 has no sign
+ return z
+}
+
+// Inv sets z to 1/x and returns z.
+func (z *Rat) Inv(x *Rat) *Rat {
+ if len(x.a.abs) == 0 {
+ panic("division by zero")
+ }
+ z.Set(x)
+ a := z.b
+ if len(a) == 0 {
+ a = a.setWord(1) // materialize numerator
+ }
+ b := z.a.abs
+ if b.cmp(natOne) == 0 {
+ b = b.make(0) // normalize denominator
+ }
+ z.a.abs, z.b = a, b // sign doesn't change
return z
}
@@ -74,21 +121,24 @@ func (x *Rat) Sign() int {
// IsInt returns true if the denominator of x is 1.
func (x *Rat) IsInt() bool {
- return len(x.b) == 1 && x.b[0] == 1
+ return len(x.b) == 0 || x.b.cmp(natOne) == 0
}
-// Num returns the numerator of z; it may be <= 0.
-// The result is a reference to z's numerator; it
-// may change if a new value is assigned to z.
-func (z *Rat) Num() *Int {
- return &z.a
+// Num returns the numerator of x; it may be <= 0.
+// The result is a reference to x's numerator; it
+// may change if a new value is assigned to x.
+func (x *Rat) Num() *Int {
+ return &x.a
}
-// Denom returns the denominator of z; it is always > 0.
-// The result is a reference to z's denominator; it
-// may change if a new value is assigned to z.
-func (z *Rat) Denom() *Int {
- return &Int{false, z.b}
+// Denom returns the denominator of x; it is always > 0.
+// The result is a reference to x's denominator; it
+// may change if a new value is assigned to x.
+func (x *Rat) Denom() *Int {
+ if len(x.b) == 0 {
+ return &Int{abs: nat{1}}
+ }
+ return &Int{abs: x.b}
}
func gcd(x, y nat) nat {
@@ -106,24 +156,47 @@ func gcd(x, y nat) nat {
}
func (z *Rat) norm() *Rat {
- f := gcd(z.a.abs, z.b)
- if len(z.a.abs) == 0 {
- // z == 0
- z.a.neg = false // normalize sign
- z.b = z.b.setWord(1)
- return z
- }
- if f.cmp(natOne) != 0 {
- z.a.abs, _ = z.a.abs.div(nil, z.a.abs, f)
- z.b, _ = z.b.div(nil, z.b, f)
+ switch {
+ case len(z.a.abs) == 0:
+ // z == 0 - normalize sign and denominator
+ z.a.neg = false
+ z.b = z.b.make(0)
+ case len(z.b) == 0:
+ // z is normalized int - nothing to do
+ case z.b.cmp(natOne) == 0:
+ // z is int - normalize denominator
+ z.b = z.b.make(0)
+ default:
+ if f := gcd(z.a.abs, z.b); f.cmp(natOne) != 0 {
+ z.a.abs, _ = z.a.abs.div(nil, z.a.abs, f)
+ z.b, _ = z.b.div(nil, z.b, f)
+ }
}
return z
}
-func mulNat(x *Int, y nat) *Int {
+// mulDenom sets z to the denominator product x*y (by taking into
+// account that 0 values for x or y must be interpreted as 1) and
+// returns z.
+func mulDenom(z, x, y nat) nat {
+ switch {
+ case len(x) == 0:
+ return z.set(y)
+ case len(y) == 0:
+ return z.set(x)
+ }
+ return z.mul(x, y)
+}
+
+// scaleDenom computes x*f.
+// If f == 0 (zero value of denominator), the result is (a copy of) x.
+func scaleDenom(x *Int, f nat) *Int {
var z Int
- z.abs = z.abs.mul(x.abs, y)
- z.neg = len(z.abs) > 0 && x.neg
+ if len(f) == 0 {
+ return z.Set(x)
+ }
+ z.abs = z.abs.mul(x.abs, f)
+ z.neg = x.neg
return &z
}
@@ -133,39 +206,32 @@ func mulNat(x *Int, y nat) *Int {
// 0 if x == y
// +1 if x > y
//
-func (x *Rat) Cmp(y *Rat) (r int) {
- return mulNat(&x.a, y.b).Cmp(mulNat(&y.a, x.b))
-}
-
-// Abs sets z to |x| (the absolute value of x) and returns z.
-func (z *Rat) Abs(x *Rat) *Rat {
- z.a.Abs(&x.a)
- z.b = z.b.set(x.b)
- return z
+func (x *Rat) Cmp(y *Rat) int {
+ return scaleDenom(&x.a, y.b).Cmp(scaleDenom(&y.a, x.b))
}
// Add sets z to the sum x+y and returns z.
func (z *Rat) Add(x, y *Rat) *Rat {
- a1 := mulNat(&x.a, y.b)
- a2 := mulNat(&y.a, x.b)
+ a1 := scaleDenom(&x.a, y.b)
+ a2 := scaleDenom(&y.a, x.b)
z.a.Add(a1, a2)
- z.b = z.b.mul(x.b, y.b)
+ z.b = mulDenom(z.b, x.b, y.b)
return z.norm()
}
// Sub sets z to the difference x-y and returns z.
func (z *Rat) Sub(x, y *Rat) *Rat {
- a1 := mulNat(&x.a, y.b)
- a2 := mulNat(&y.a, x.b)
+ a1 := scaleDenom(&x.a, y.b)
+ a2 := scaleDenom(&y.a, x.b)
z.a.Sub(a1, a2)
- z.b = z.b.mul(x.b, y.b)
+ z.b = mulDenom(z.b, x.b, y.b)
return z.norm()
}
// Mul sets z to the product x*y and returns z.
func (z *Rat) Mul(x, y *Rat) *Rat {
z.a.Mul(&x.a, &y.a)
- z.b = z.b.mul(x.b, y.b)
+ z.b = mulDenom(z.b, x.b, y.b)
return z.norm()
}
@@ -175,28 +241,14 @@ func (z *Rat) Quo(x, y *Rat) *Rat {
if len(y.a.abs) == 0 {
panic("division by zero")
}
- a := mulNat(&x.a, y.b)
- b := mulNat(&y.a, x.b)
+ a := scaleDenom(&x.a, y.b)
+ b := scaleDenom(&y.a, x.b)
z.a.abs = a.abs
z.b = b.abs
z.a.neg = a.neg != b.neg
return z.norm()
}
-// Neg sets z to -x (by making a copy of x if necessary) and returns z.
-func (z *Rat) Neg(x *Rat) *Rat {
- z.a.Neg(&x.a)
- z.b = z.b.set(x.b)
- return z
-}
-
-// Set sets z to x (by making a copy of x if necessary) and returns z.
-func (z *Rat) Set(x *Rat) *Rat {
- z.a.Set(&x.a)
- z.b = z.b.set(x.b)
- return z
-}
-
func ratTok(ch int) bool {
return strings.IndexRune("+-/0123456789.eE", ch) >= 0
}
@@ -219,23 +271,23 @@ func (z *Rat) Scan(s fmt.ScanState, ch int) os.Error {
// SetString sets z to the value of s and returns z and a boolean indicating
// success. s can be given as a fraction "a/b" or as a floating-point number
-// optionally followed by an exponent. If the operation failed, the value of z
-// is undefined.
+// optionally followed by an exponent. If the operation failed, the value of
+// z is undefined but the returned value is nil.
func (z *Rat) SetString(s string) (*Rat, bool) {
if len(s) == 0 {
- return z, false
+ return nil, false
}
// check for a quotient
sep := strings.Index(s, "/")
if sep >= 0 {
if _, ok := z.a.SetString(s[0:sep], 10); !ok {
- return z, false
+ return nil, false
}
s = s[sep+1:]
var err os.Error
if z.b, _, err = z.b.scan(strings.NewReader(s), 10); err != nil {
- return z, false
+ return nil, false
}
return z.norm(), true
}
@@ -248,10 +300,10 @@ func (z *Rat) SetString(s string) (*Rat, bool) {
if e >= 0 {
if e < sep {
// The E must come after the decimal point.
- return z, false
+ return nil, false
}
if _, ok := exp.SetString(s[e+1:], 10); !ok {
- return z, false
+ return nil, false
}
s = s[0:e]
}
@@ -261,7 +313,7 @@ func (z *Rat) SetString(s string) (*Rat, bool) {
}
if _, ok := z.a.SetString(s, 10); !ok {
- return z, false
+ return nil, false
}
powTen := nat{}.expNN(natTen, exp.abs, nil)
if exp.neg {
@@ -269,7 +321,7 @@ func (z *Rat) SetString(s string) (*Rat, bool) {
z.norm()
} else {
z.a.abs = z.a.abs.mul(z.a.abs, powTen)
- z.b = z.b.setWord(1)
+ z.b = z.b.make(0)
}
return z, true
@@ -277,7 +329,11 @@ func (z *Rat) SetString(s string) (*Rat, bool) {
// String returns a string representation of z in the form "a/b" (even if b == 1).
func (z *Rat) String() string {
- return z.a.String() + "/" + z.b.decimalString()
+ s := "/1"
+ if len(z.b) != 0 {
+ s = "/" + z.b.decimalString()
+ }
+ return z.a.String() + s
}
// RatString returns a string representation of z in the form "a/b" if b != 1,
@@ -299,6 +355,7 @@ func (z *Rat) FloatString(prec int) string {
}
return s
}
+ // z.b != 0
q, r := nat{}.div(nat{}, z.a.abs, z.b)
diff --git a/libgo/go/big/rat_test.go b/libgo/go/big/rat_test.go
index a2b905525ee..a95e5fea3a5 100644
--- a/libgo/go/big/rat_test.go
+++ b/libgo/go/big/rat_test.go
@@ -11,6 +11,46 @@ import (
"testing"
)
+func TestZeroRat(t *testing.T) {
+ var x, y, z Rat
+ y.SetFrac64(0, 42)
+
+ if x.Cmp(&y) != 0 {
+ t.Errorf("x and y should be both equal and zero")
+ }
+
+ if s := x.String(); s != "0/1" {
+ t.Errorf("got x = %s, want 0/1", s)
+ }
+
+ if s := x.RatString(); s != "0" {
+ t.Errorf("got x = %s, want 0", s)
+ }
+
+ z.Add(&x, &y)
+ if s := z.RatString(); s != "0" {
+ t.Errorf("got x+y = %s, want 0", s)
+ }
+
+ z.Sub(&x, &y)
+ if s := z.RatString(); s != "0" {
+ t.Errorf("got x-y = %s, want 0", s)
+ }
+
+ z.Mul(&x, &y)
+ if s := z.RatString(); s != "0" {
+ t.Errorf("got x*y = %s, want 0", s)
+ }
+
+ // check for division by zero
+ defer func() {
+ if s := recover(); s == nil || s.(string) != "division by zero" {
+ panic(s)
+ }
+ }()
+ z.Quo(&x, &y)
+}
+
var setStringTests = []struct {
in, out string
ok bool
@@ -50,8 +90,14 @@ func TestRatSetString(t *testing.T) {
for i, test := range setStringTests {
x, ok := new(Rat).SetString(test.in)
- if ok != test.ok || ok && x.RatString() != test.out {
- t.Errorf("#%d got %s want %s", i, x.RatString(), test.out)
+ if ok {
+ if !test.ok {
+ t.Errorf("#%d SetString(%q) expected failure", i, test.in)
+ } else if x.RatString() != test.out {
+ t.Errorf("#%d SetString(%q) got %s want %s", i, test.in, x.RatString(), test.out)
+ }
+ } else if x != nil {
+ t.Errorf("#%d SetString(%q) got %p want nil", i, test.in, x)
}
}
}
@@ -113,8 +159,10 @@ func TestFloatString(t *testing.T) {
func TestRatSign(t *testing.T) {
zero := NewRat(0, 1)
for _, a := range setStringTests {
- var x Rat
- x.SetString(a.in)
+ x, ok := new(Rat).SetString(a.in)
+ if !ok {
+ continue
+ }
s := x.Sign()
e := x.Cmp(zero)
if s != e {
@@ -153,29 +201,65 @@ func TestRatCmp(t *testing.T) {
func TestIsInt(t *testing.T) {
one := NewInt(1)
for _, a := range setStringTests {
- var x Rat
- x.SetString(a.in)
+ x, ok := new(Rat).SetString(a.in)
+ if !ok {
+ continue
+ }
i := x.IsInt()
e := x.Denom().Cmp(one) == 0
if i != e {
- t.Errorf("got %v; want %v for z = %v", i, e, &x)
+ t.Errorf("got IsInt(%v) == %v; want %v", x, i, e)
}
}
}
func TestRatAbs(t *testing.T) {
- zero := NewRat(0, 1)
+ zero := new(Rat)
for _, a := range setStringTests {
- var z Rat
- z.SetString(a.in)
- var e Rat
- e.Set(&z)
+ x, ok := new(Rat).SetString(a.in)
+ if !ok {
+ continue
+ }
+ e := new(Rat).Set(x)
if e.Cmp(zero) < 0 {
- e.Sub(zero, &e)
+ e.Sub(zero, e)
+ }
+ z := new(Rat).Abs(x)
+ if z.Cmp(e) != 0 {
+ t.Errorf("got Abs(%v) = %v; want %v", x, z, e)
+ }
+ }
+}
+
+func TestRatNeg(t *testing.T) {
+ zero := new(Rat)
+ for _, a := range setStringTests {
+ x, ok := new(Rat).SetString(a.in)
+ if !ok {
+ continue
+ }
+ e := new(Rat).Sub(zero, x)
+ z := new(Rat).Neg(x)
+ if z.Cmp(e) != 0 {
+ t.Errorf("got Neg(%v) = %v; want %v", x, z, e)
+ }
+ }
+}
+
+func TestRatInv(t *testing.T) {
+ zero := new(Rat)
+ for _, a := range setStringTests {
+ x, ok := new(Rat).SetString(a.in)
+ if !ok {
+ continue
+ }
+ if x.Cmp(zero) == 0 {
+ continue // avoid division by zero
}
- z.Abs(&z)
- if z.Cmp(&e) != 0 {
- t.Errorf("got z = %v; want %v", &z, &e)
+ e := new(Rat).SetFrac(x.Denom(), x.Num())
+ z := new(Rat).Inv(x)
+ if z.Cmp(e) != 0 {
+ t.Errorf("got Inv(%v) = %v; want %v", x, z, e)
}
}
}
@@ -186,10 +270,10 @@ type ratBinArg struct {
}
func testRatBin(t *testing.T, i int, name string, f ratBinFun, a ratBinArg) {
- x, _ := NewRat(0, 1).SetString(a.x)
- y, _ := NewRat(0, 1).SetString(a.y)
- z, _ := NewRat(0, 1).SetString(a.z)
- out := f(NewRat(0, 1), x, y)
+ x, _ := new(Rat).SetString(a.x)
+ y, _ := new(Rat).SetString(a.y)
+ z, _ := new(Rat).SetString(a.z)
+ out := f(new(Rat), x, y)
if out.Cmp(z) != 0 {
t.Errorf("%s #%d got %s want %s", name, i, out, z)
diff --git a/libgo/go/crypto/x509/x509.go b/libgo/go/crypto/x509/x509.go
index 4b8ecc56c5e..73b32e7d586 100644
--- a/libgo/go/crypto/x509/x509.go
+++ b/libgo/go/crypto/x509/x509.go
@@ -928,11 +928,11 @@ func CreateCertificate(rand io.Reader, template, parent *Certificate, pub *rsa.P
return
}
- asn1Issuer, err := asn1.Marshal(parent.Issuer.ToRDNSequence())
+ asn1Issuer, err := asn1.Marshal(parent.Subject.ToRDNSequence())
if err != nil {
return
}
- asn1Subject, err := asn1.Marshal(parent.Subject.ToRDNSequence())
+ asn1Subject, err := asn1.Marshal(template.Subject.ToRDNSequence())
if err != nil {
return
}
diff --git a/libgo/go/crypto/x509/x509_test.go b/libgo/go/crypto/x509/x509_test.go
index dbc5273ca12..d113f850eb0 100644
--- a/libgo/go/crypto/x509/x509_test.go
+++ b/libgo/go/crypto/x509/x509_test.go
@@ -6,8 +6,8 @@ package x509
import (
"asn1"
- "bytes"
"big"
+ "bytes"
"crypto/dsa"
"crypto/rand"
"crypto/rsa"
@@ -243,10 +243,11 @@ func TestCreateSelfSignedCertificate(t *testing.T) {
return
}
+ commonName := "test.example.com"
template := Certificate{
SerialNumber: big.NewInt(1),
Subject: pkix.Name{
- CommonName: "test.example.com",
+ CommonName: commonName,
Organization: []string{"Acme Co"},
},
NotBefore: time.SecondsToUTC(1000),
@@ -283,6 +284,14 @@ func TestCreateSelfSignedCertificate(t *testing.T) {
t.Errorf("Failed to parse name constraints: %#v", cert.PermittedDNSDomains)
}
+ if cert.Subject.CommonName != commonName {
+ t.Errorf("Subject wasn't correctly copied from the template. Got %s, want %s", cert.Subject.CommonName, commonName)
+ }
+
+ if cert.Issuer.CommonName != commonName {
+ t.Errorf("Issuer wasn't correctly copied from the template. Got %s, want %s", cert.Issuer.CommonName, commonName)
+ }
+
err = cert.CheckSignatureFrom(cert)
if err != nil {
t.Errorf("Signature verification failed: %s", err)
diff --git a/libgo/go/os/inotify/inotify_linux.go b/libgo/go/exp/inotify/inotify_linux.go
index ee3c75f63b1..ee3c75f63b1 100644
--- a/libgo/go/os/inotify/inotify_linux.go
+++ b/libgo/go/exp/inotify/inotify_linux.go
diff --git a/libgo/go/os/inotify/inotify_linux_test.go b/libgo/go/exp/inotify/inotify_linux_test.go
index aa72604eb92..a6bb46fe77d 100644
--- a/libgo/go/os/inotify/inotify_linux_test.go
+++ b/libgo/go/exp/inotify/inotify_linux_test.go
@@ -6,8 +6,8 @@ package inotify
import (
"os"
- "time"
"testing"
+ "time"
)
func TestInotifyEvents(t *testing.T) {
diff --git a/libgo/go/exp/ssh/channel.go b/libgo/go/exp/ssh/channel.go
index 922584f6317..f69b735fd47 100644
--- a/libgo/go/exp/ssh/channel.go
+++ b/libgo/go/exp/ssh/channel.go
@@ -68,7 +68,7 @@ type channel struct {
weClosed bool
dead bool
- serverConn *ServerConnection
+ serverConn *ServerConn
myId, theirId uint32
myWindow, theirWindow uint32
maxPacketSize uint32
diff --git a/libgo/go/exp/ssh/client.go b/libgo/go/exp/ssh/client.go
new file mode 100644
index 00000000000..331138581fe
--- /dev/null
+++ b/libgo/go/exp/ssh/client.go
@@ -0,0 +1,490 @@
+// Copyright 2011 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.
+
+package ssh
+
+import (
+ "big"
+ "crypto"
+ "crypto/rand"
+ "fmt"
+ "io"
+ "net"
+ "os"
+ "sync"
+)
+
+// clientVersion is the fixed identification string that the client will use.
+var clientVersion = []byte("SSH-2.0-Go\r\n")
+
+// ClientConn represents the client side of an SSH connection.
+type ClientConn struct {
+ *transport
+ config *ClientConfig
+ chanlist
+}
+
+// Client returns a new SSH client connection using c as the underlying transport.
+func Client(c net.Conn, config *ClientConfig) (*ClientConn, os.Error) {
+ conn := &ClientConn{
+ transport: newTransport(c, config.rand()),
+ config: config,
+ }
+ if err := conn.handshake(); err != nil {
+ conn.Close()
+ return nil, err
+ }
+ if err := conn.authenticate(); err != nil {
+ conn.Close()
+ return nil, err
+ }
+ go conn.mainLoop()
+ return conn, nil
+}
+
+// handshake performs the client side key exchange. See RFC 4253 Section 7.
+func (c *ClientConn) handshake() os.Error {
+ var magics handshakeMagics
+
+ if _, err := c.Write(clientVersion); err != nil {
+ return err
+ }
+ if err := c.Flush(); err != nil {
+ return err
+ }
+ magics.clientVersion = clientVersion[:len(clientVersion)-2]
+
+ // read remote server version
+ version, err := readVersion(c)
+ if err != nil {
+ return err
+ }
+ magics.serverVersion = version
+ clientKexInit := kexInitMsg{
+ KexAlgos: supportedKexAlgos,
+ ServerHostKeyAlgos: supportedHostKeyAlgos,
+ CiphersClientServer: supportedCiphers,
+ CiphersServerClient: supportedCiphers,
+ MACsClientServer: supportedMACs,
+ MACsServerClient: supportedMACs,
+ CompressionClientServer: supportedCompressions,
+ CompressionServerClient: supportedCompressions,
+ }
+ kexInitPacket := marshal(msgKexInit, clientKexInit)
+ magics.clientKexInit = kexInitPacket
+
+ if err := c.writePacket(kexInitPacket); err != nil {
+ return err
+ }
+ packet, err := c.readPacket()
+ if err != nil {
+ return err
+ }
+
+ magics.serverKexInit = packet
+
+ var serverKexInit kexInitMsg
+ if err = unmarshal(&serverKexInit, packet, msgKexInit); err != nil {
+ return err
+ }
+
+ kexAlgo, hostKeyAlgo, ok := findAgreedAlgorithms(c.transport, &clientKexInit, &serverKexInit)
+ if !ok {
+ return os.NewError("ssh: no common algorithms")
+ }
+
+ if serverKexInit.FirstKexFollows && kexAlgo != serverKexInit.KexAlgos[0] {
+ // The server sent a Kex message for the wrong algorithm,
+ // which we have to ignore.
+ if _, err := c.readPacket(); err != nil {
+ return err
+ }
+ }
+
+ var H, K []byte
+ var hashFunc crypto.Hash
+ switch kexAlgo {
+ case kexAlgoDH14SHA1:
+ hashFunc = crypto.SHA1
+ dhGroup14Once.Do(initDHGroup14)
+ H, K, err = c.kexDH(dhGroup14, hashFunc, &magics, hostKeyAlgo)
+ default:
+ err = fmt.Errorf("ssh: unexpected key exchange algorithm %v", kexAlgo)
+ }
+ if err != nil {
+ return err
+ }
+
+ if err = c.writePacket([]byte{msgNewKeys}); err != nil {
+ return err
+ }
+ if err = c.transport.writer.setupKeys(clientKeys, K, H, H, hashFunc); err != nil {
+ return err
+ }
+ if packet, err = c.readPacket(); err != nil {
+ return err
+ }
+ if packet[0] != msgNewKeys {
+ return UnexpectedMessageError{msgNewKeys, packet[0]}
+ }
+ return c.transport.reader.setupKeys(serverKeys, K, H, H, hashFunc)
+}
+
+// authenticate authenticates with the remote server. See RFC 4252.
+// Only "password" authentication is supported.
+func (c *ClientConn) authenticate() os.Error {
+ if err := c.writePacket(marshal(msgServiceRequest, serviceRequestMsg{serviceUserAuth})); err != nil {
+ return err
+ }
+ packet, err := c.readPacket()
+ if err != nil {
+ return err
+ }
+
+ var serviceAccept serviceAcceptMsg
+ if err = unmarshal(&serviceAccept, packet, msgServiceAccept); err != nil {
+ return err
+ }
+
+ // TODO(dfc) support proper authentication method negotation
+ method := "none"
+ if c.config.Password != "" {
+ method = "password"
+ }
+ if err := c.sendUserAuthReq(method); err != nil {
+ return err
+ }
+
+ if packet, err = c.readPacket(); err != nil {
+ return err
+ }
+
+ if packet[0] != msgUserAuthSuccess {
+ return UnexpectedMessageError{msgUserAuthSuccess, packet[0]}
+ }
+ return nil
+}
+
+func (c *ClientConn) sendUserAuthReq(method string) os.Error {
+ length := stringLength([]byte(c.config.Password)) + 1
+ payload := make([]byte, length)
+ // always false for password auth, see RFC 4252 Section 8.
+ payload[0] = 0
+ marshalString(payload[1:], []byte(c.config.Password))
+
+ return c.writePacket(marshal(msgUserAuthRequest, userAuthRequestMsg{
+ User: c.config.User,
+ Service: serviceSSH,
+ Method: method,
+ Payload: payload,
+ }))
+}
+
+// kexDH performs Diffie-Hellman key agreement on a ClientConn. The
+// returned values are given the same names as in RFC 4253, section 8.
+func (c *ClientConn) kexDH(group *dhGroup, hashFunc crypto.Hash, magics *handshakeMagics, hostKeyAlgo string) ([]byte, []byte, os.Error) {
+ x, err := rand.Int(c.config.rand(), group.p)
+ if err != nil {
+ return nil, nil, err
+ }
+ X := new(big.Int).Exp(group.g, x, group.p)
+ kexDHInit := kexDHInitMsg{
+ X: X,
+ }
+ if err := c.writePacket(marshal(msgKexDHInit, kexDHInit)); err != nil {
+ return nil, nil, err
+ }
+
+ packet, err := c.readPacket()
+ if err != nil {
+ return nil, nil, err
+ }
+
+ var kexDHReply = new(kexDHReplyMsg)
+ if err = unmarshal(kexDHReply, packet, msgKexDHReply); err != nil {
+ return nil, nil, err
+ }
+
+ if kexDHReply.Y.Sign() == 0 || kexDHReply.Y.Cmp(group.p) >= 0 {
+ return nil, nil, os.NewError("server DH parameter out of bounds")
+ }
+
+ kInt := new(big.Int).Exp(kexDHReply.Y, x, group.p)
+ h := hashFunc.New()
+ writeString(h, magics.clientVersion)
+ writeString(h, magics.serverVersion)
+ writeString(h, magics.clientKexInit)
+ writeString(h, magics.serverKexInit)
+ writeString(h, kexDHReply.HostKey)
+ writeInt(h, X)
+ writeInt(h, kexDHReply.Y)
+ K := make([]byte, intLength(kInt))
+ marshalInt(K, kInt)
+ h.Write(K)
+
+ H := h.Sum()
+
+ return H, K, nil
+}
+
+// openChan opens a new client channel. The most common session type is "session".
+// The full set of valid session types are listed in RFC 4250 4.9.1.
+func (c *ClientConn) openChan(typ string) (*clientChan, os.Error) {
+ ch := c.newChan(c.transport)
+ if err := c.writePacket(marshal(msgChannelOpen, channelOpenMsg{
+ ChanType: typ,
+ PeersId: ch.id,
+ PeersWindow: 1 << 14,
+ MaxPacketSize: 1 << 15, // RFC 4253 6.1
+ })); err != nil {
+ c.chanlist.remove(ch.id)
+ return nil, err
+ }
+ // wait for response
+ switch msg := (<-ch.msg).(type) {
+ case *channelOpenConfirmMsg:
+ ch.peersId = msg.MyId
+ case *channelOpenFailureMsg:
+ c.chanlist.remove(ch.id)
+ return nil, os.NewError(msg.Message)
+ default:
+ c.chanlist.remove(ch.id)
+ return nil, os.NewError("Unexpected packet")
+ }
+ return ch, nil
+}
+
+// mainloop reads incoming messages and routes channel messages
+// to their respective ClientChans.
+func (c *ClientConn) mainLoop() {
+ for {
+ packet, err := c.readPacket()
+ if err != nil {
+ // TODO(dfc) signal the underlying close to all channels
+ c.Close()
+ return
+ }
+ // TODO(dfc) A note on blocking channel use.
+ // The msg, win, data and dataExt channels of a clientChan can
+ // cause this loop to block indefinately if the consumer does
+ // not service them.
+ switch msg := decode(packet).(type) {
+ case *channelOpenMsg:
+ c.getChan(msg.PeersId).msg <- msg
+ case *channelOpenConfirmMsg:
+ c.getChan(msg.PeersId).msg <- msg
+ case *channelOpenFailureMsg:
+ c.getChan(msg.PeersId).msg <- msg
+ case *channelCloseMsg:
+ ch := c.getChan(msg.PeersId)
+ close(ch.win)
+ close(ch.data)
+ close(ch.dataExt)
+ c.chanlist.remove(msg.PeersId)
+ case *channelEOFMsg:
+ c.getChan(msg.PeersId).msg <- msg
+ case *channelRequestSuccessMsg:
+ c.getChan(msg.PeersId).msg <- msg
+ case *channelRequestFailureMsg:
+ c.getChan(msg.PeersId).msg <- msg
+ case *channelRequestMsg:
+ c.getChan(msg.PeersId).msg <- msg
+ case *windowAdjustMsg:
+ c.getChan(msg.PeersId).win <- int(msg.AdditionalBytes)
+ case *channelData:
+ c.getChan(msg.PeersId).data <- msg.Payload
+ case *channelExtendedData:
+ // RFC 4254 5.2 defines data_type_code 1 to be data destined
+ // for stderr on interactive sessions. Other data types are
+ // silently discarded.
+ if msg.Datatype == 1 {
+ c.getChan(msg.PeersId).dataExt <- msg.Payload
+ }
+ default:
+ fmt.Printf("mainLoop: unhandled %#v\n", msg)
+ }
+ }
+}
+
+// Dial connects to the given network address using net.Dial and
+// then initiates a SSH handshake, returning the resulting client connection.
+func Dial(network, addr string, config *ClientConfig) (*ClientConn, os.Error) {
+ conn, err := net.Dial(network, addr)
+ if err != nil {
+ return nil, err
+ }
+ return Client(conn, config)
+}
+
+// A ClientConfig structure is used to configure a ClientConn. After one has
+// been passed to an SSH function it must not be modified.
+type ClientConfig struct {
+ // Rand provides the source of entropy for key exchange. If Rand is
+ // nil, the cryptographic random reader in package crypto/rand will
+ // be used.
+ Rand io.Reader
+
+ // The username to authenticate.
+ User string
+
+ // Used for "password" method authentication.
+ Password string
+}
+
+func (c *ClientConfig) rand() io.Reader {
+ if c.Rand == nil {
+ return rand.Reader
+ }
+ return c.Rand
+}
+
+// A clientChan represents a single RFC 4254 channel that is multiplexed
+// over a single SSH connection.
+type clientChan struct {
+ packetWriter
+ id, peersId uint32
+ data chan []byte // receives the payload of channelData messages
+ dataExt chan []byte // receives the payload of channelExtendedData messages
+ win chan int // receives window adjustments
+ msg chan interface{} // incoming messages
+}
+
+func newClientChan(t *transport, id uint32) *clientChan {
+ return &clientChan{
+ packetWriter: t,
+ id: id,
+ data: make(chan []byte, 16),
+ dataExt: make(chan []byte, 16),
+ win: make(chan int, 16),
+ msg: make(chan interface{}, 16),
+ }
+}
+
+// Close closes the channel. This does not close the underlying connection.
+func (c *clientChan) Close() os.Error {
+ return c.writePacket(marshal(msgChannelClose, channelCloseMsg{
+ PeersId: c.id,
+ }))
+}
+
+func (c *clientChan) sendChanReq(req channelRequestMsg) os.Error {
+ if err := c.writePacket(marshal(msgChannelRequest, req)); err != nil {
+ return err
+ }
+ msg := <-c.msg
+ if _, ok := msg.(*channelRequestSuccessMsg); ok {
+ return nil
+ }
+ return fmt.Errorf("failed to complete request: %s, %#v", req.Request, msg)
+}
+
+// Thread safe channel list.
+type chanlist struct {
+ // protects concurrent access to chans
+ sync.Mutex
+ // chans are indexed by the local id of the channel, clientChan.id.
+ // The PeersId value of messages received by ClientConn.mainloop is
+ // used to locate the right local clientChan in this slice.
+ chans []*clientChan
+}
+
+// Allocate a new ClientChan with the next avail local id.
+func (c *chanlist) newChan(t *transport) *clientChan {
+ c.Lock()
+ defer c.Unlock()
+ for i := range c.chans {
+ if c.chans[i] == nil {
+ ch := newClientChan(t, uint32(i))
+ c.chans[i] = ch
+ return ch
+ }
+ }
+ i := len(c.chans)
+ ch := newClientChan(t, uint32(i))
+ c.chans = append(c.chans, ch)
+ return ch
+}
+
+func (c *chanlist) getChan(id uint32) *clientChan {
+ c.Lock()
+ defer c.Unlock()
+ return c.chans[int(id)]
+}
+
+func (c *chanlist) remove(id uint32) {
+ c.Lock()
+ defer c.Unlock()
+ c.chans[int(id)] = nil
+}
+
+// A chanWriter represents the stdin of a remote process.
+type chanWriter struct {
+ win chan int // receives window adjustments
+ id uint32 // this channel's id
+ rwin int // current rwin size
+ packetWriter // for sending channelDataMsg
+}
+
+// Write writes data to the remote process's standard input.
+func (w *chanWriter) Write(data []byte) (n int, err os.Error) {
+ for {
+ if w.rwin == 0 {
+ win, ok := <-w.win
+ if !ok {
+ return 0, os.EOF
+ }
+ w.rwin += win
+ continue
+ }
+ n = len(data)
+ packet := make([]byte, 0, 9+n)
+ packet = append(packet, msgChannelData,
+ byte(w.id)>>24, byte(w.id)>>16, byte(w.id)>>8, byte(w.id),
+ byte(n)>>24, byte(n)>>16, byte(n)>>8, byte(n))
+ err = w.writePacket(append(packet, data...))
+ w.rwin -= n
+ return
+ }
+ panic("unreachable")
+}
+
+func (w *chanWriter) Close() os.Error {
+ return w.writePacket(marshal(msgChannelEOF, channelEOFMsg{w.id}))
+}
+
+// A chanReader represents stdout or stderr of a remote process.
+type chanReader struct {
+ // TODO(dfc) a fixed size channel may not be the right data structure.
+ // If writes to this channel block, they will block mainLoop, making
+ // it unable to receive new messages from the remote side.
+ data chan []byte // receives data from remote
+ id uint32
+ packetWriter // for sending windowAdjustMsg
+ buf []byte
+}
+
+// Read reads data from the remote process's stdout or stderr.
+func (r *chanReader) Read(data []byte) (int, os.Error) {
+ var ok bool
+ for {
+ if len(r.buf) > 0 {
+ n := copy(data, r.buf)
+ r.buf = r.buf[n:]
+ msg := windowAdjustMsg{
+ PeersId: r.id,
+ AdditionalBytes: uint32(n),
+ }
+ return n, r.writePacket(marshal(msgChannelWindowAdjust, msg))
+ }
+ r.buf, ok = <-r.data
+ if !ok {
+ return 0, os.EOF
+ }
+ }
+ panic("unreachable")
+}
+
+func (r *chanReader) Close() os.Error {
+ return r.writePacket(marshal(msgChannelEOF, channelEOFMsg{r.id}))
+}
diff --git a/libgo/go/exp/ssh/doc.go b/libgo/go/exp/ssh/doc.go
index 54a7ba9fdae..fc842b0c1d2 100644
--- a/libgo/go/exp/ssh/doc.go
+++ b/libgo/go/exp/ssh/doc.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
/*
-Package ssh implements an SSH server.
+Package ssh implements an SSH client and server.
SSH is a transport security protocol, an authentication protocol and a
family of application protocols. The most typical application level
@@ -11,26 +11,29 @@ protocol is a remote shell and this is specifically implemented. However,
the multiplexed nature of SSH is exposed to users that wish to support
others.
-An SSH server is represented by a Server, which manages a number of
-ServerConnections and handles authentication.
+An SSH server is represented by a ServerConfig, which holds certificate
+details and handles authentication of ServerConns.
- var s Server
- s.PubKeyCallback = pubKeyAuth
- s.PasswordCallback = passwordAuth
+ config := new(ServerConfig)
+ config.PubKeyCallback = pubKeyAuth
+ config.PasswordCallback = passwordAuth
pemBytes, err := ioutil.ReadFile("id_rsa")
if err != nil {
panic("Failed to load private key")
}
- err = s.SetRSAPrivateKey(pemBytes)
+ err = config.SetRSAPrivateKey(pemBytes)
if err != nil {
panic("Failed to parse private key")
}
-Once a Server has been set up, connections can be attached.
+Once a ServerConfig has been configured, connections can be accepted.
- var sConn ServerConnection
- sConn.Server = &s
+ listener := Listen("tcp", "0.0.0.0:2022", config)
+ sConn, err := listener.Accept()
+ if err != nil {
+ panic("failed to accept incoming connection")
+ }
err = sConn.Handshake(conn)
if err != nil {
panic("failed to handshake")
@@ -38,7 +41,6 @@ Once a Server has been set up, connections can be attached.
An SSH connection multiplexes several channels, which must be accepted themselves:
-
for {
channel, err := sConn.Accept()
if err != nil {
@@ -75,5 +77,29 @@ present a simple terminal interface.
}
return
}()
+
+An SSH client is represented with a ClientConn. Currently only the "password"
+authentication method is supported.
+
+ config := &ClientConfig{
+ User: "username",
+ Password: "123456",
+ }
+ client, err := Dial("yourserver.com:22", config)
+
+Each ClientConn can support multiple interactive sessions, represented by a Session.
+
+ session, err := client.NewSession()
+
+Once a Session is created, you can execute a single command on the remote side
+using the Exec method.
+
+ if err := session.Exec("/usr/bin/whoami"); err != nil {
+ panic("Failed to exec: " + err.String())
+ }
+ reader := bufio.NewReader(session.Stdin)
+ line, _, _ := reader.ReadLine()
+ fmt.Println(line)
+ session.Close()
*/
package ssh
diff --git a/libgo/go/exp/ssh/messages.go b/libgo/go/exp/ssh/messages.go
index 1d0bc577426..7771f2b242e 100644
--- a/libgo/go/exp/ssh/messages.go
+++ b/libgo/go/exp/ssh/messages.go
@@ -154,7 +154,7 @@ type channelData struct {
type channelExtendedData struct {
PeersId uint32
Datatype uint32
- Data string
+ Payload []byte `ssh:"rest"`
}
type channelRequestMsg struct {
diff --git a/libgo/go/exp/ssh/server.go b/libgo/go/exp/ssh/server.go
index 410cafc44c2..3a640fc081e 100644
--- a/libgo/go/exp/ssh/server.go
+++ b/libgo/go/exp/ssh/server.go
@@ -10,19 +10,23 @@ import (
"crypto"
"crypto/rand"
"crypto/rsa"
- _ "crypto/sha1"
"crypto/x509"
"encoding/pem"
+ "io"
"net"
"os"
"sync"
)
-// Server represents an SSH server. A Server may have several ServerConnections.
-type Server struct {
+type ServerConfig struct {
rsa *rsa.PrivateKey
rsaSerialized []byte
+ // Rand provides the source of entropy for key exchange. If Rand is
+ // nil, the cryptographic random reader in package crypto/rand will
+ // be used.
+ Rand io.Reader
+
// NoClientAuth is true if clients are allowed to connect without
// authenticating.
NoClientAuth bool
@@ -38,11 +42,18 @@ type Server struct {
PubKeyCallback func(user, algo string, pubkey []byte) bool
}
+func (c *ServerConfig) rand() io.Reader {
+ if c.Rand == nil {
+ return rand.Reader
+ }
+ return c.Rand
+}
+
// SetRSAPrivateKey sets the private key for a Server. A Server must have a
// private key configured in order to accept connections. The private key must
// be in the form of a PEM encoded, PKCS#1, RSA private key. The file "id_rsa"
// typically contains such a key.
-func (s *Server) SetRSAPrivateKey(pemBytes []byte) os.Error {
+func (s *ServerConfig) SetRSAPrivateKey(pemBytes []byte) os.Error {
block, _ := pem.Decode(pemBytes)
if block == nil {
return os.NewError("ssh: no key found")
@@ -109,7 +120,7 @@ func parseRSASig(in []byte) (sig []byte, ok bool) {
}
// cachedPubKey contains the results of querying whether a public key is
-// acceptable for a user. The cache only applies to a single ServerConnection.
+// acceptable for a user. The cache only applies to a single ServerConn.
type cachedPubKey struct {
user, algo string
pubKey []byte
@@ -118,11 +129,10 @@ type cachedPubKey struct {
const maxCachedPubKeys = 16
-// ServerConnection represents an incomming connection to a Server.
-type ServerConnection struct {
- Server *Server
-
+// A ServerConn represents an incomming connection.
+type ServerConn struct {
*transport
+ config *ServerConfig
channels map[uint32]*channel
nextChanId uint32
@@ -139,9 +149,20 @@ type ServerConnection struct {
cachedPubKeys []cachedPubKey
}
+// Server returns a new SSH server connection
+// using c as the underlying transport.
+func Server(c net.Conn, config *ServerConfig) *ServerConn {
+ conn := &ServerConn{
+ transport: newTransport(c, config.rand()),
+ channels: make(map[uint32]*channel),
+ config: config,
+ }
+ return conn
+}
+
// kexDH performs Diffie-Hellman key agreement on a ServerConnection. The
// returned values are given the same names as in RFC 4253, section 8.
-func (s *ServerConnection) kexDH(group *dhGroup, hashFunc crypto.Hash, magics *handshakeMagics, hostKeyAlgo string) (H, K []byte, err os.Error) {
+func (s *ServerConn) kexDH(group *dhGroup, hashFunc crypto.Hash, magics *handshakeMagics, hostKeyAlgo string) (H, K []byte, err os.Error) {
packet, err := s.readPacket()
if err != nil {
return
@@ -155,7 +176,7 @@ func (s *ServerConnection) kexDH(group *dhGroup, hashFunc crypto.Hash, magics *h
return nil, nil, os.NewError("client DH parameter out of bounds")
}
- y, err := rand.Int(rand.Reader, group.p)
+ y, err := rand.Int(s.config.rand(), group.p)
if err != nil {
return
}
@@ -166,7 +187,7 @@ func (s *ServerConnection) kexDH(group *dhGroup, hashFunc crypto.Hash, magics *h
var serializedHostKey []byte
switch hostKeyAlgo {
case hostAlgoRSA:
- serializedHostKey = s.Server.rsaSerialized
+ serializedHostKey = s.config.rsaSerialized
default:
return nil, nil, os.NewError("internal error")
}
@@ -192,7 +213,7 @@ func (s *ServerConnection) kexDH(group *dhGroup, hashFunc crypto.Hash, magics *h
var sig []byte
switch hostKeyAlgo {
case hostAlgoRSA:
- sig, err = rsa.SignPKCS1v15(rand.Reader, s.Server.rsa, hashFunc, hh)
+ sig, err = rsa.SignPKCS1v15(s.config.rand(), s.config.rsa, hashFunc, hh)
if err != nil {
return
}
@@ -257,19 +278,20 @@ func buildDataSignedForAuth(sessionId []byte, req userAuthRequestMsg, algo, pubK
return ret
}
-// Handshake performs an SSH transport and client authentication on the given ServerConnection.
-func (s *ServerConnection) Handshake(conn net.Conn) os.Error {
+// Handshake performs an SSH transport and client authentication on the given ServerConn.
+func (s *ServerConn) Handshake() os.Error {
var magics handshakeMagics
- s.transport = newTransport(conn, rand.Reader)
-
- if _, err := conn.Write(serverVersion); err != nil {
+ if _, err := s.Write(serverVersion); err != nil {
+ return err
+ }
+ if err := s.Flush(); err != nil {
return err
}
magics.serverVersion = serverVersion[:len(serverVersion)-2]
- version, ok := readVersion(s.transport)
- if !ok {
- return os.NewError("failed to read version string from client")
+ version, err := readVersion(s)
+ if err != nil {
+ return err
}
magics.clientVersion = version
@@ -310,8 +332,7 @@ func (s *ServerConnection) Handshake(conn net.Conn) os.Error {
if clientKexInit.FirstKexFollows && kexAlgo != clientKexInit.KexAlgos[0] {
// The client sent a Kex message for the wrong algorithm,
// which we have to ignore.
- _, err := s.readPacket()
- if err != nil {
+ if _, err := s.readPacket(); err != nil {
return err
}
}
@@ -324,32 +345,27 @@ func (s *ServerConnection) Handshake(conn net.Conn) os.Error {
dhGroup14Once.Do(initDHGroup14)
H, K, err = s.kexDH(dhGroup14, hashFunc, &magics, hostKeyAlgo)
default:
- err = os.NewError("ssh: internal error")
+ err = os.NewError("ssh: unexpected key exchange algorithm " + kexAlgo)
}
-
if err != nil {
return err
}
- packet = []byte{msgNewKeys}
- if err = s.writePacket(packet); err != nil {
+ if err = s.writePacket([]byte{msgNewKeys}); err != nil {
return err
}
if err = s.transport.writer.setupKeys(serverKeys, K, H, H, hashFunc); err != nil {
return err
}
-
if packet, err = s.readPacket(); err != nil {
return err
}
+
if packet[0] != msgNewKeys {
return UnexpectedMessageError{msgNewKeys, packet[0]}
}
-
s.transport.reader.setupKeys(clientKeys, K, H, H, hashFunc)
-
- packet, err = s.readPacket()
- if err != nil {
+ if packet, err = s.readPacket(); err != nil {
return err
}
@@ -360,20 +376,16 @@ func (s *ServerConnection) Handshake(conn net.Conn) os.Error {
if serviceRequest.Service != serviceUserAuth {
return os.NewError("ssh: requested service '" + serviceRequest.Service + "' before authenticating")
}
-
serviceAccept := serviceAcceptMsg{
Service: serviceUserAuth,
}
- packet = marshal(msgServiceAccept, serviceAccept)
- if err = s.writePacket(packet); err != nil {
+ if err = s.writePacket(marshal(msgServiceAccept, serviceAccept)); err != nil {
return err
}
if err = s.authenticate(H); err != nil {
return err
}
-
- s.channels = make(map[uint32]*channel)
return nil
}
@@ -382,8 +394,8 @@ func isAcceptableAlgo(algo string) bool {
}
// testPubKey returns true if the given public key is acceptable for the user.
-func (s *ServerConnection) testPubKey(user, algo string, pubKey []byte) bool {
- if s.Server.PubKeyCallback == nil || !isAcceptableAlgo(algo) {
+func (s *ServerConn) testPubKey(user, algo string, pubKey []byte) bool {
+ if s.config.PubKeyCallback == nil || !isAcceptableAlgo(algo) {
return false
}
@@ -393,7 +405,7 @@ func (s *ServerConnection) testPubKey(user, algo string, pubKey []byte) bool {
}
}
- result := s.Server.PubKeyCallback(user, algo, pubKey)
+ result := s.config.PubKeyCallback(user, algo, pubKey)
if len(s.cachedPubKeys) < maxCachedPubKeys {
c := cachedPubKey{
user: user,
@@ -408,7 +420,7 @@ func (s *ServerConnection) testPubKey(user, algo string, pubKey []byte) bool {
return result
}
-func (s *ServerConnection) authenticate(H []byte) os.Error {
+func (s *ServerConn) authenticate(H []byte) os.Error {
var userAuthReq userAuthRequestMsg
var err os.Error
var packet []byte
@@ -428,11 +440,11 @@ userAuthLoop:
switch userAuthReq.Method {
case "none":
- if s.Server.NoClientAuth {
+ if s.config.NoClientAuth {
break userAuthLoop
}
case "password":
- if s.Server.PasswordCallback == nil {
+ if s.config.PasswordCallback == nil {
break
}
payload := userAuthReq.Payload
@@ -445,11 +457,11 @@ userAuthLoop:
return ParseError{msgUserAuthRequest}
}
- if s.Server.PasswordCallback(userAuthReq.User, string(password)) {
+ if s.config.PasswordCallback(userAuthReq.User, string(password)) {
break userAuthLoop
}
case "publickey":
- if s.Server.PubKeyCallback == nil {
+ if s.config.PubKeyCallback == nil {
break
}
payload := userAuthReq.Payload
@@ -520,10 +532,10 @@ userAuthLoop:
}
var failureMsg userAuthFailureMsg
- if s.Server.PasswordCallback != nil {
+ if s.config.PasswordCallback != nil {
failureMsg.Methods = append(failureMsg.Methods, "password")
}
- if s.Server.PubKeyCallback != nil {
+ if s.config.PubKeyCallback != nil {
failureMsg.Methods = append(failureMsg.Methods, "publickey")
}
@@ -546,9 +558,9 @@ userAuthLoop:
const defaultWindowSize = 32768
-// Accept reads and processes messages on a ServerConnection. It must be called
+// Accept reads and processes messages on a ServerConn. It must be called
// in order to demultiplex messages to any resulting Channels.
-func (s *ServerConnection) Accept() (Channel, os.Error) {
+func (s *ServerConn) Accept() (Channel, os.Error) {
if s.err != nil {
return nil, s.err
}
@@ -643,3 +655,44 @@ func (s *ServerConnection) Accept() (Channel, os.Error) {
panic("unreachable")
}
+
+// A Listener implements a network listener (net.Listener) for SSH connections.
+type Listener struct {
+ listener net.Listener
+ config *ServerConfig
+}
+
+// Accept waits for and returns the next incoming SSH connection.
+// The receiver should call Handshake() in another goroutine
+// to avoid blocking the accepter.
+func (l *Listener) Accept() (*ServerConn, os.Error) {
+ c, err := l.listener.Accept()
+ if err != nil {
+ return nil, err
+ }
+ conn := Server(c, l.config)
+ return conn, nil
+}
+
+// Addr returns the listener's network address.
+func (l *Listener) Addr() net.Addr {
+ return l.listener.Addr()
+}
+
+// Close closes the listener.
+func (l *Listener) Close() os.Error {
+ return l.listener.Close()
+}
+
+// Listen creates an SSH listener accepting connections on
+// the given network address using net.Listen.
+func Listen(network, addr string, config *ServerConfig) (*Listener, os.Error) {
+ l, err := net.Listen(network, addr)
+ if err != nil {
+ return nil, err
+ }
+ return &Listener{
+ l,
+ config,
+ }, nil
+}
diff --git a/libgo/go/exp/ssh/session.go b/libgo/go/exp/ssh/session.go
new file mode 100644
index 00000000000..13df2f0dda4
--- /dev/null
+++ b/libgo/go/exp/ssh/session.go
@@ -0,0 +1,132 @@
+// Copyright 2011 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.
+
+package ssh
+
+// Session implements an interactive session described in
+// "RFC 4254, section 6".
+
+import (
+ "encoding/binary"
+ "io"
+ "os"
+)
+
+// A Session represents a connection to a remote command or shell.
+type Session struct {
+ // Writes to Stdin are made available to the remote command's standard input.
+ // Closing Stdin causes the command to observe an EOF on its standard input.
+ Stdin io.WriteCloser
+
+ // Reads from Stdout and Stderr consume from the remote command's standard
+ // output and error streams, respectively.
+ // There is a fixed amount of buffering that is shared for the two streams.
+ // Failing to read from either may eventually cause the command to block.
+ // Closing Stdout unblocks such writes and causes them to return errors.
+ Stdout io.ReadCloser
+ Stderr io.Reader
+
+ *clientChan // the channel backing this session
+
+ started bool // started is set to true once a Shell or Exec is invoked.
+}
+
+// Setenv sets an environment variable that will be applied to any
+// command executed by Shell or Exec.
+func (s *Session) Setenv(name, value string) os.Error {
+ n, v := []byte(name), []byte(value)
+ nlen, vlen := stringLength(n), stringLength(v)
+ payload := make([]byte, nlen+vlen)
+ marshalString(payload[:nlen], n)
+ marshalString(payload[nlen:], v)
+
+ return s.sendChanReq(channelRequestMsg{
+ PeersId: s.id,
+ Request: "env",
+ WantReply: true,
+ RequestSpecificData: payload,
+ })
+}
+
+// An empty mode list (a string of 1 character, opcode 0), see RFC 4254 Section 8.
+var emptyModeList = []byte{0, 0, 0, 1, 0}
+
+// RequestPty requests the association of a pty with the session on the remote host.
+func (s *Session) RequestPty(term string, h, w int) os.Error {
+ buf := make([]byte, 4+len(term)+16+len(emptyModeList))
+ b := marshalString(buf, []byte(term))
+ binary.BigEndian.PutUint32(b, uint32(h))
+ binary.BigEndian.PutUint32(b[4:], uint32(w))
+ binary.BigEndian.PutUint32(b[8:], uint32(h*8))
+ binary.BigEndian.PutUint32(b[12:], uint32(w*8))
+ copy(b[16:], emptyModeList)
+
+ return s.sendChanReq(channelRequestMsg{
+ PeersId: s.id,
+ Request: "pty-req",
+ WantReply: true,
+ RequestSpecificData: buf,
+ })
+}
+
+// Exec runs cmd on the remote host. Typically, the remote
+// server passes cmd to the shell for interpretation.
+// A Session only accepts one call to Exec or Shell.
+func (s *Session) Exec(cmd string) os.Error {
+ if s.started {
+ return os.NewError("session already started")
+ }
+ cmdLen := stringLength([]byte(cmd))
+ payload := make([]byte, cmdLen)
+ marshalString(payload, []byte(cmd))
+ s.started = true
+
+ return s.sendChanReq(channelRequestMsg{
+ PeersId: s.id,
+ Request: "exec",
+ WantReply: true,
+ RequestSpecificData: payload,
+ })
+}
+
+// Shell starts a login shell on the remote host. A Session only
+// accepts one call to Exec or Shell.
+func (s *Session) Shell() os.Error {
+ if s.started {
+ return os.NewError("session already started")
+ }
+ s.started = true
+
+ return s.sendChanReq(channelRequestMsg{
+ PeersId: s.id,
+ Request: "shell",
+ WantReply: true,
+ })
+}
+
+// NewSession returns a new interactive session on the remote host.
+func (c *ClientConn) NewSession() (*Session, os.Error) {
+ ch, err := c.openChan("session")
+ if err != nil {
+ return nil, err
+ }
+ return &Session{
+ Stdin: &chanWriter{
+ packetWriter: ch,
+ id: ch.id,
+ win: ch.win,
+ },
+ Stdout: &chanReader{
+ packetWriter: ch,
+ id: ch.id,
+ data: ch.data,
+ },
+ Stderr: &chanReader{
+ packetWriter: ch,
+ id: ch.id,
+ data: ch.dataExt,
+ },
+ clientChan: ch,
+ }, nil
+}
diff --git a/libgo/go/exp/ssh/transport.go b/libgo/go/exp/ssh/transport.go
index 5994004d866..97eaf975d10 100644
--- a/libgo/go/exp/ssh/transport.go
+++ b/libgo/go/exp/ssh/transport.go
@@ -332,16 +332,15 @@ func (t truncatingMAC) Size() int {
const maxVersionStringBytes = 1024
// Read version string as specified by RFC 4253, section 4.2.
-func readVersion(r io.Reader) (versionString []byte, ok bool) {
- versionString = make([]byte, 0, 64)
- seenCR := false
-
+func readVersion(r io.Reader) ([]byte, os.Error) {
+ versionString := make([]byte, 0, 64)
+ var ok, seenCR bool
var buf [1]byte
forEachByte:
for len(versionString) < maxVersionStringBytes {
_, err := io.ReadFull(r, buf[:])
if err != nil {
- return
+ return nil, err
}
b := buf[0]
@@ -360,10 +359,10 @@ forEachByte:
versionString = append(versionString, b)
}
- if ok {
- // We need to remove the CR from versionString
- versionString = versionString[:len(versionString)-1]
+ if !ok {
+ return nil, os.NewError("failed to read version string")
}
- return
+ // We need to remove the CR from versionString
+ return versionString[:len(versionString)-1], nil
}
diff --git a/libgo/go/exp/ssh/transport_test.go b/libgo/go/exp/ssh/transport_test.go
index 9a610a7803c..b2e2a7fc92a 100644
--- a/libgo/go/exp/ssh/transport_test.go
+++ b/libgo/go/exp/ssh/transport_test.go
@@ -12,9 +12,9 @@ import (
func TestReadVersion(t *testing.T) {
buf := []byte(serverVersion)
- result, ok := readVersion(bufio.NewReader(bytes.NewBuffer(buf)))
- if !ok {
- t.Error("readVersion didn't read version correctly")
+ result, err := readVersion(bufio.NewReader(bytes.NewBuffer(buf)))
+ if err != nil {
+ t.Errorf("readVersion didn't read version correctly: %s", err)
}
if !bytes.Equal(buf[:len(buf)-2], result) {
t.Error("version read did not match expected")
@@ -23,7 +23,7 @@ func TestReadVersion(t *testing.T) {
func TestReadVersionTooLong(t *testing.T) {
buf := make([]byte, maxVersionStringBytes+1)
- if _, ok := readVersion(bufio.NewReader(bytes.NewBuffer(buf))); ok {
+ if _, err := readVersion(bufio.NewReader(bytes.NewBuffer(buf))); err == nil {
t.Errorf("readVersion consumed %d bytes without error", len(buf))
}
}
@@ -31,7 +31,7 @@ func TestReadVersionTooLong(t *testing.T) {
func TestReadVersionWithoutCRLF(t *testing.T) {
buf := []byte(serverVersion)
buf = buf[:len(buf)-1]
- if _, ok := readVersion(bufio.NewReader(bytes.NewBuffer(buf))); ok {
+ if _, err := readVersion(bufio.NewReader(bytes.NewBuffer(buf))); err == nil {
t.Error("readVersion did not notice \\n was missing")
}
}
diff --git a/libgo/go/exp/types/gcimporter.go b/libgo/go/exp/types/gcimporter.go
index fe90f910807..e744a63a96e 100644
--- a/libgo/go/exp/types/gcimporter.go
+++ b/libgo/go/exp/types/gcimporter.go
@@ -289,9 +289,10 @@ func (p *gcParser) parseExportedName() (*ast.Object, string) {
// BasicType = identifier .
//
func (p *gcParser) parseBasicType() Type {
- obj := Universe.Lookup(p.expect(scanner.Ident))
+ id := p.expect(scanner.Ident)
+ obj := Universe.Lookup(id)
if obj == nil || obj.Kind != ast.Typ {
- p.errorf("not a basic type: %s", obj.Name)
+ p.errorf("not a basic type: %s", id)
}
return obj.Type.(Type)
}
diff --git a/libgo/go/exp/winfsnotify/winfsnotify_test.go b/libgo/go/exp/winfsnotify/winfsnotify_test.go
index edf2165c0ec..6e264d04f90 100644
--- a/libgo/go/exp/winfsnotify/winfsnotify_test.go
+++ b/libgo/go/exp/winfsnotify/winfsnotify_test.go
@@ -6,8 +6,8 @@ package winfsnotify
import (
"os"
- "time"
"testing"
+ "time"
)
func expect(t *testing.T, eventstream <-chan *Event, name string, mask uint32) {
@@ -70,15 +70,11 @@ func TestNotifyEvents(t *testing.T) {
if _, err = file.WriteString("hello, world"); err != nil {
t.Fatalf("failed to write to test file: %s", err)
}
- if err = file.Sync(); err != nil {
- t.Fatalf("failed to sync test file: %s", err)
- }
- expect(t, watcher.Event, testFile, FS_MODIFY)
- expect(t, watcher.Event, testFile, FS_MODIFY)
-
if err = file.Close(); err != nil {
t.Fatalf("failed to close test file: %s", err)
}
+ expect(t, watcher.Event, testFile, FS_MODIFY)
+ expect(t, watcher.Event, testFile, FS_MODIFY)
if err = os.Rename(testFile, testFile2); err != nil {
t.Fatalf("failed to rename test file: %s", err)
diff --git a/libgo/go/fmt/fmt_test.go b/libgo/go/fmt/fmt_test.go
index 030ad6187fa..38280d61f6b 100644
--- a/libgo/go/fmt/fmt_test.go
+++ b/libgo/go/fmt/fmt_test.go
@@ -88,6 +88,10 @@ type S struct {
G G // a struct field that GoStrings
}
+type SI struct {
+ I interface{}
+}
+
// A type with a String method with pointer receiver for testing %p
type P int
@@ -352,6 +356,7 @@ var fmttests = []struct {
{"%#v", map[string]int{"a": 1}, `map[string] int{"a":1}`},
{"%#v", map[string]B{"a": {1, 2}}, `map[string] fmt_test.B{"a":fmt_test.B{I:1, j:2}}`},
{"%#v", []string{"a", "b"}, `[]string{"a", "b"}`},
+ {"%#v", SI{}, `fmt_test.SI{I:interface { }(nil)}`},
// slices with other formats
{"%#x", []int{1, 2, 15}, `[0x1 0x2 0xf]`},
diff --git a/libgo/go/fmt/print.go b/libgo/go/fmt/print.go
index 7721e724115..710baeec1d2 100644
--- a/libgo/go/fmt/print.go
+++ b/libgo/go/fmt/print.go
@@ -74,6 +74,8 @@ type pp struct {
n int
panicking bool
buf bytes.Buffer
+ // field holds the current item, as an interface{}.
+ field interface{}
// value holds the current item, as a reflect.Value, and will be
// the zero Value if the item has not been reflected.
value reflect.Value
@@ -132,6 +134,7 @@ func (p *pp) free() {
return
}
p.buf.Reset()
+ p.field = nil
p.value = reflect.Value{}
ppFree.put(p)
}
@@ -294,16 +297,16 @@ func (p *pp) unknownType(v interface{}) {
p.buf.WriteByte('?')
}
-func (p *pp) badVerb(verb int, val interface{}) {
+func (p *pp) badVerb(verb int) {
p.add('%')
p.add('!')
p.add(verb)
p.add('(')
switch {
- case val != nil:
- p.buf.WriteString(reflect.TypeOf(val).String())
+ case p.field != nil:
+ p.buf.WriteString(reflect.TypeOf(p.field).String())
p.add('=')
- p.printField(val, 'v', false, false, 0)
+ p.printField(p.field, 'v', false, false, 0)
case p.value.IsValid():
p.buf.WriteString(p.value.Type().String())
p.add('=')
@@ -314,12 +317,12 @@ func (p *pp) badVerb(verb int, val interface{}) {
p.add(')')
}
-func (p *pp) fmtBool(v bool, verb int, value interface{}) {
+func (p *pp) fmtBool(v bool, verb int) {
switch verb {
case 't', 'v':
p.fmt.fmt_boolean(v)
default:
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
}
@@ -333,7 +336,7 @@ func (p *pp) fmtC(c int64) {
p.fmt.pad(p.runeBuf[0:w])
}
-func (p *pp) fmtInt64(v int64, verb int, value interface{}) {
+func (p *pp) fmtInt64(v int64, verb int) {
switch verb {
case 'b':
p.fmt.integer(v, 2, signed, ldigits)
@@ -347,7 +350,7 @@ func (p *pp) fmtInt64(v int64, verb int, value interface{}) {
if 0 <= v && v <= unicode.MaxRune {
p.fmt.fmt_qc(v)
} else {
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
case 'x':
p.fmt.integer(v, 16, signed, ldigits)
@@ -356,7 +359,7 @@ func (p *pp) fmtInt64(v int64, verb int, value interface{}) {
case 'X':
p.fmt.integer(v, 16, signed, udigits)
default:
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
}
@@ -391,7 +394,7 @@ func (p *pp) fmtUnicode(v int64) {
p.fmt.sharp = sharp
}
-func (p *pp) fmtUint64(v uint64, verb int, goSyntax bool, value interface{}) {
+func (p *pp) fmtUint64(v uint64, verb int, goSyntax bool) {
switch verb {
case 'b':
p.fmt.integer(int64(v), 2, unsigned, ldigits)
@@ -411,7 +414,7 @@ func (p *pp) fmtUint64(v uint64, verb int, goSyntax bool, value interface{}) {
if 0 <= v && v <= unicode.MaxRune {
p.fmt.fmt_qc(int64(v))
} else {
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
case 'x':
p.fmt.integer(int64(v), 16, unsigned, ldigits)
@@ -420,11 +423,11 @@ func (p *pp) fmtUint64(v uint64, verb int, goSyntax bool, value interface{}) {
case 'U':
p.fmtUnicode(int64(v))
default:
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
}
-func (p *pp) fmtFloat32(v float32, verb int, value interface{}) {
+func (p *pp) fmtFloat32(v float32, verb int) {
switch verb {
case 'b':
p.fmt.fmt_fb32(v)
@@ -439,11 +442,11 @@ func (p *pp) fmtFloat32(v float32, verb int, value interface{}) {
case 'G':
p.fmt.fmt_G32(v)
default:
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
}
-func (p *pp) fmtFloat64(v float64, verb int, value interface{}) {
+func (p *pp) fmtFloat64(v float64, verb int) {
switch verb {
case 'b':
p.fmt.fmt_fb64(v)
@@ -458,33 +461,33 @@ func (p *pp) fmtFloat64(v float64, verb int, value interface{}) {
case 'G':
p.fmt.fmt_G64(v)
default:
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
}
-func (p *pp) fmtComplex64(v complex64, verb int, value interface{}) {
+func (p *pp) fmtComplex64(v complex64, verb int) {
switch verb {
case 'e', 'E', 'f', 'F', 'g', 'G':
p.fmt.fmt_c64(v, verb)
case 'v':
p.fmt.fmt_c64(v, 'g')
default:
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
}
-func (p *pp) fmtComplex128(v complex128, verb int, value interface{}) {
+func (p *pp) fmtComplex128(v complex128, verb int) {
switch verb {
case 'e', 'E', 'f', 'F', 'g', 'G':
p.fmt.fmt_c128(v, verb)
case 'v':
p.fmt.fmt_c128(v, 'g')
default:
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
}
-func (p *pp) fmtString(v string, verb int, goSyntax bool, value interface{}) {
+func (p *pp) fmtString(v string, verb int, goSyntax bool) {
switch verb {
case 'v':
if goSyntax {
@@ -501,11 +504,11 @@ func (p *pp) fmtString(v string, verb int, goSyntax bool, value interface{}) {
case 'q':
p.fmt.fmt_q(v)
default:
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
}
-func (p *pp) fmtBytes(v []byte, verb int, goSyntax bool, depth int, value interface{}) {
+func (p *pp) fmtBytes(v []byte, verb int, goSyntax bool, depth int) {
if verb == 'v' || verb == 'd' {
if goSyntax {
p.buf.Write(bytesBytes)
@@ -540,17 +543,17 @@ func (p *pp) fmtBytes(v []byte, verb int, goSyntax bool, depth int, value interf
case 'q':
p.fmt.fmt_q(s)
default:
- p.badVerb(verb, value)
+ p.badVerb(verb)
}
}
-func (p *pp) fmtPointer(field interface{}, value reflect.Value, verb int, goSyntax bool) {
+func (p *pp) fmtPointer(value reflect.Value, verb int, goSyntax bool) {
var u uintptr
switch value.Kind() {
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer:
u = value.Pointer()
default:
- p.badVerb(verb, field)
+ p.badVerb(verb)
return
}
if goSyntax {
@@ -576,12 +579,12 @@ var (
uintptrBits = reflect.TypeOf(uintptr(0)).Bits()
)
-func (p *pp) catchPanic(val interface{}, verb int) {
+func (p *pp) catchPanic(field interface{}, verb int) {
if err := recover(); err != nil {
// If it's a nil pointer, just say "<nil>". The likeliest causes are a
// Stringer that fails to guard against nil or a nil pointer for a
// value receiver, and in either case, "<nil>" is a nice result.
- if v := reflect.ValueOf(val); v.Kind() == reflect.Ptr && v.IsNil() {
+ if v := reflect.ValueOf(field); v.Kind() == reflect.Ptr && v.IsNil() {
p.buf.Write(nilAngleBytes)
return
}
@@ -601,12 +604,12 @@ func (p *pp) catchPanic(val interface{}, verb int) {
}
}
-func (p *pp) handleMethods(field interface{}, verb int, plus, goSyntax bool, depth int) (wasString, handled bool) {
+func (p *pp) handleMethods(verb int, plus, goSyntax bool, depth int) (wasString, handled bool) {
// Is it a Formatter?
- if formatter, ok := field.(Formatter); ok {
+ if formatter, ok := p.field.(Formatter); ok {
handled = true
wasString = false
- defer p.catchPanic(field, verb)
+ defer p.catchPanic(p.field, verb)
formatter.Format(p, verb)
return
}
@@ -618,20 +621,20 @@ func (p *pp) handleMethods(field interface{}, verb int, plus, goSyntax bool, dep
// If we're doing Go syntax and the field knows how to supply it, take care of it now.
if goSyntax {
p.fmt.sharp = false
- if stringer, ok := field.(GoStringer); ok {
+ if stringer, ok := p.field.(GoStringer); ok {
wasString = false
handled = true
- defer p.catchPanic(field, verb)
+ defer p.catchPanic(p.field, verb)
// Print the result of GoString unadorned.
- p.fmtString(stringer.GoString(), 's', false, field)
+ p.fmtString(stringer.GoString(), 's', false)
return
}
} else {
// Is it a Stringer?
- if stringer, ok := field.(Stringer); ok {
+ if stringer, ok := p.field.(Stringer); ok {
wasString = false
handled = true
- defer p.catchPanic(field, verb)
+ defer p.catchPanic(p.field, verb)
p.printField(stringer.String(), verb, plus, false, depth)
return
}
@@ -645,11 +648,13 @@ func (p *pp) printField(field interface{}, verb int, plus, goSyntax bool, depth
if verb == 'T' || verb == 'v' {
p.buf.Write(nilAngleBytes)
} else {
- p.badVerb(verb, field)
+ p.badVerb(verb)
}
return false
}
+ p.field = field
+ p.value = reflect.Value{}
// Special processing considerations.
// %T (the value's type) and %p (its address) are special; we always do them first.
switch verb {
@@ -657,74 +662,60 @@ func (p *pp) printField(field interface{}, verb int, plus, goSyntax bool, depth
p.printField(reflect.TypeOf(field).String(), 's', false, false, 0)
return false
case 'p':
- p.fmtPointer(field, reflect.ValueOf(field), verb, goSyntax)
+ p.fmtPointer(reflect.ValueOf(field), verb, goSyntax)
return false
}
- if wasString, handled := p.handleMethods(field, verb, plus, goSyntax, depth); handled {
+ if wasString, handled := p.handleMethods(verb, plus, goSyntax, depth); handled {
return wasString
}
// Some types can be done without reflection.
switch f := field.(type) {
case bool:
- p.fmtBool(f, verb, field)
- return false
+ p.fmtBool(f, verb)
case float32:
- p.fmtFloat32(f, verb, field)
- return false
+ p.fmtFloat32(f, verb)
case float64:
- p.fmtFloat64(f, verb, field)
- return false
+ p.fmtFloat64(f, verb)
case complex64:
- p.fmtComplex64(complex64(f), verb, field)
- return false
+ p.fmtComplex64(complex64(f), verb)
case complex128:
- p.fmtComplex128(f, verb, field)
- return false
+ p.fmtComplex128(f, verb)
case int:
- p.fmtInt64(int64(f), verb, field)
- return false
+ p.fmtInt64(int64(f), verb)
case int8:
- p.fmtInt64(int64(f), verb, field)
- return false
+ p.fmtInt64(int64(f), verb)
case int16:
- p.fmtInt64(int64(f), verb, field)
- return false
+ p.fmtInt64(int64(f), verb)
case int32:
- p.fmtInt64(int64(f), verb, field)
- return false
+ p.fmtInt64(int64(f), verb)
case int64:
- p.fmtInt64(f, verb, field)
- return false
+ p.fmtInt64(f, verb)
case uint:
- p.fmtUint64(uint64(f), verb, goSyntax, field)
- return false
+ p.fmtUint64(uint64(f), verb, goSyntax)
case uint8:
- p.fmtUint64(uint64(f), verb, goSyntax, field)
- return false
+ p.fmtUint64(uint64(f), verb, goSyntax)
case uint16:
- p.fmtUint64(uint64(f), verb, goSyntax, field)
- return false
+ p.fmtUint64(uint64(f), verb, goSyntax)
case uint32:
- p.fmtUint64(uint64(f), verb, goSyntax, field)
- return false
+ p.fmtUint64(uint64(f), verb, goSyntax)
case uint64:
- p.fmtUint64(f, verb, goSyntax, field)
- return false
+ p.fmtUint64(f, verb, goSyntax)
case uintptr:
- p.fmtUint64(uint64(f), verb, goSyntax, field)
- return false
+ p.fmtUint64(uint64(f), verb, goSyntax)
case string:
- p.fmtString(f, verb, goSyntax, field)
- return verb == 's' || verb == 'v'
+ p.fmtString(f, verb, goSyntax)
+ wasString = verb == 's' || verb == 'v'
case []byte:
- p.fmtBytes(f, verb, goSyntax, depth, field)
- return verb == 's'
+ p.fmtBytes(f, verb, goSyntax, depth)
+ wasString = verb == 's'
+ default:
+ // Need to use reflection
+ return p.printReflectValue(reflect.ValueOf(field), verb, plus, goSyntax, depth)
}
-
- // Need to use reflection
- return p.printReflectValue(reflect.ValueOf(field), verb, plus, goSyntax, depth)
+ p.field = nil
+ return
}
// printValue is like printField but starts with a reflect value, not an interface{} value.
@@ -733,7 +724,7 @@ func (p *pp) printValue(value reflect.Value, verb int, plus, goSyntax bool, dept
if verb == 'T' || verb == 'v' {
p.buf.Write(nilAngleBytes)
} else {
- p.badVerb(verb, nil)
+ p.badVerb(verb)
}
return false
}
@@ -745,17 +736,17 @@ func (p *pp) printValue(value reflect.Value, verb int, plus, goSyntax bool, dept
p.printField(value.Type().String(), 's', false, false, 0)
return false
case 'p':
- p.fmtPointer(nil, value, verb, goSyntax)
+ p.fmtPointer(value, verb, goSyntax)
return false
}
// Handle values with special methods.
// Call always, even when field == nil, because handleMethods clears p.fmt.plus for us.
- var field interface{}
+ p.field = nil // Make sure it's cleared, for safety.
if value.CanInterface() {
- field = value.Interface()
+ p.field = value.Interface()
}
- if wasString, handled := p.handleMethods(field, verb, plus, goSyntax, depth); handled {
+ if wasString, handled := p.handleMethods(verb, plus, goSyntax, depth); handled {
return wasString
}
@@ -770,25 +761,25 @@ func (p *pp) printReflectValue(value reflect.Value, verb int, plus, goSyntax boo
BigSwitch:
switch f := value; f.Kind() {
case reflect.Bool:
- p.fmtBool(f.Bool(), verb, nil)
+ p.fmtBool(f.Bool(), verb)
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- p.fmtInt64(f.Int(), verb, nil)
+ p.fmtInt64(f.Int(), verb)
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- p.fmtUint64(uint64(f.Uint()), verb, goSyntax, nil)
+ p.fmtUint64(uint64(f.Uint()), verb, goSyntax)
case reflect.Float32, reflect.Float64:
if f.Type().Size() == 4 {
- p.fmtFloat32(float32(f.Float()), verb, nil)
+ p.fmtFloat32(float32(f.Float()), verb)
} else {
- p.fmtFloat64(float64(f.Float()), verb, nil)
+ p.fmtFloat64(float64(f.Float()), verb)
}
case reflect.Complex64, reflect.Complex128:
if f.Type().Size() == 8 {
- p.fmtComplex64(complex64(f.Complex()), verb, nil)
+ p.fmtComplex64(complex64(f.Complex()), verb)
} else {
- p.fmtComplex128(complex128(f.Complex()), verb, nil)
+ p.fmtComplex128(complex128(f.Complex()), verb)
}
case reflect.String:
- p.fmtString(f.String(), verb, goSyntax, nil)
+ p.fmtString(f.String(), verb, goSyntax)
case reflect.Map:
if goSyntax {
p.buf.WriteString(f.Type().String())
@@ -842,7 +833,7 @@ BigSwitch:
value := f.Elem()
if !value.IsValid() {
if goSyntax {
- p.buf.WriteString(value.Type().String())
+ p.buf.WriteString(f.Type().String())
p.buf.Write(nilParenBytes)
} else {
p.buf.Write(nilAngleBytes)
@@ -864,7 +855,7 @@ BigSwitch:
for i := range bytes {
bytes[i] = byte(f.Index(i).Uint())
}
- p.fmtBytes(bytes, verb, goSyntax, depth, nil)
+ p.fmtBytes(bytes, verb, goSyntax, depth)
wasString = verb == 's'
break
}
@@ -924,7 +915,7 @@ BigSwitch:
}
p.fmt0x64(uint64(v), true)
case reflect.Chan, reflect.Func, reflect.UnsafePointer:
- p.fmtPointer(nil, value, verb, goSyntax)
+ p.fmtPointer(value, verb, goSyntax)
default:
p.unknownType(f)
}
diff --git a/libgo/go/go/ast/print_test.go b/libgo/go/go/ast/print_test.go
index a4bc3bb9dcd..c3153ed6f72 100644
--- a/libgo/go/go/ast/print_test.go
+++ b/libgo/go/go/ast/print_test.go
@@ -23,11 +23,10 @@ var tests = []struct {
{"foobar", "0 \"foobar\""},
// maps
- {map[string]int{"a": 1, "b": 2},
- `0 map[string] int (len = 2) {
+ {map[string]int{"a": 1},
+ `0 map[string] int (len = 1) {
1 . "a": 1
- 2 . "b": 2
- 3 }`},
+ 2 }`},
// pointers
{new(int), "0 *0"},
diff --git a/libgo/go/html/doc.go b/libgo/go/html/doc.go
index 5bc0630861a..ba9d188486f 100644
--- a/libgo/go/html/doc.go
+++ b/libgo/go/html/doc.go
@@ -70,9 +70,6 @@ call to Next. For example, to extract an HTML page's anchor text:
}
}
-A Tokenizer typically skips over HTML comments. To return comment tokens, set
-Tokenizer.ReturnComments to true before looping over calls to Next.
-
Parsing is done by calling Parse with an io.Reader, which returns the root of
the parse tree (the document element) as a *Node. It is the caller's
responsibility to ensure that the Reader provides UTF-8 encoded HTML. For
diff --git a/libgo/go/html/parse.go b/libgo/go/html/parse.go
index 582437f7673..530942aa8f0 100644
--- a/libgo/go/html/parse.go
+++ b/libgo/go/html/parse.go
@@ -32,6 +32,9 @@ type parser struct {
// originalIM is the insertion mode to go back to after completing a text
// or inTableText insertion mode.
originalIM insertionMode
+ // fosterParenting is whether new elements should be inserted according to
+ // the foster parenting rules (section 11.2.5.3).
+ fosterParenting bool
}
func (p *parser) top() *Node {
@@ -49,6 +52,11 @@ var (
tableScopeStopTags = []string{"html", "table"}
)
+// stopTags for use in clearStackToContext.
+var (
+ tableRowContextStopTags = []string{"tr", "html"}
+)
+
// popUntil pops the stack of open elements at the highest element whose tag
// is in matchTags, provided there is no higher element in stopTags. It returns
// whether or not there was such an element. If there was not, popUntil leaves
@@ -103,12 +111,61 @@ func (p *parser) elementInScope(stopTags []string, matchTags ...string) bool {
// addChild adds a child node n to the top element, and pushes n onto the stack
// of open elements if it is an element node.
func (p *parser) addChild(n *Node) {
- p.top().Add(n)
+ if p.fosterParenting {
+ p.fosterParent(n)
+ } else {
+ p.top().Add(n)
+ }
+
if n.Type == ElementNode {
p.oe = append(p.oe, n)
}
}
+// fosterParent adds a child node according to the foster parenting rules.
+// Section 11.2.5.3, "foster parenting".
+func (p *parser) fosterParent(n *Node) {
+ var table, parent *Node
+ var i int
+ for i = len(p.oe) - 1; i >= 0; i-- {
+ if p.oe[i].Data == "table" {
+ table = p.oe[i]
+ break
+ }
+ }
+
+ if table == nil {
+ // The foster parent is the html element.
+ parent = p.oe[0]
+ } else {
+ parent = table.Parent
+ }
+ if parent == nil {
+ parent = p.oe[i-1]
+ }
+
+ var child *Node
+ for i, child = range parent.Child {
+ if child == table {
+ break
+ }
+ }
+
+ if i > 0 && parent.Child[i-1].Type == TextNode && n.Type == TextNode {
+ parent.Child[i-1].Data += n.Data
+ return
+ }
+
+ if i == len(parent.Child) {
+ parent.Add(n)
+ } else {
+ // Insert n into parent.Child at index i.
+ parent.Child = append(parent.Child[:i+1], parent.Child[i:]...)
+ parent.Child[i] = n
+ n.Parent = parent
+ }
+}
+
// addText adds text to the preceding node if it is a text node, or else it
// calls addChild with a new text node.
func (p *parser) addText(text string) {
@@ -170,9 +227,9 @@ func (p *parser) reconstructActiveFormattingElements() {
}
for {
i++
- n = p.afe[i]
- p.addChild(n.clone())
- p.afe[i] = n
+ clone := p.afe[i].clone()
+ p.addChild(clone)
+ p.afe[i] = clone
if i == len(p.afe)-1 {
break
}
@@ -234,10 +291,52 @@ func (p *parser) setOriginalIM(im insertionMode) {
p.originalIM = im
}
+// Section 11.2.3.1, "reset the insertion mode".
+func (p *parser) resetInsertionMode() insertionMode {
+ for i := len(p.oe) - 1; i >= 0; i-- {
+ n := p.oe[i]
+ if i == 0 {
+ // TODO: set n to the context element, for HTML fragment parsing.
+ }
+ switch n.Data {
+ case "select":
+ return inSelectIM
+ case "td", "th":
+ return inCellIM
+ case "tr":
+ return inRowIM
+ case "tbody", "thead", "tfoot":
+ return inTableBodyIM
+ case "caption":
+ // TODO: return inCaptionIM
+ case "colgroup":
+ // TODO: return inColumnGroupIM
+ case "table":
+ return inTableIM
+ case "head":
+ return inBodyIM
+ case "body":
+ return inBodyIM
+ case "frameset":
+ // TODO: return inFramesetIM
+ case "html":
+ return beforeHeadIM
+ }
+ }
+ return inBodyIM
+}
+
// Section 11.2.5.4.1.
func initialIM(p *parser) (insertionMode, bool) {
- if p.tok.Type == DoctypeToken {
- p.addChild(&Node{
+ switch p.tok.Type {
+ case CommentToken:
+ p.doc.Add(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return initialIM, true
+ case DoctypeToken:
+ p.doc.Add(&Node{
Type: DoctypeNode,
Data: p.tok.Data,
})
@@ -275,6 +374,12 @@ func beforeHTMLIM(p *parser) (insertionMode, bool) {
default:
// Ignore the token.
}
+ case CommentToken:
+ p.doc.Add(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return beforeHTMLIM, true
}
if add || implied {
p.addElement("html", attr)
@@ -312,6 +417,12 @@ func beforeHeadIM(p *parser) (insertionMode, bool) {
default:
// Ignore the token.
}
+ case CommentToken:
+ p.addChild(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return beforeHeadIM, true
}
if add || implied {
p.addElement("head", attr)
@@ -344,11 +455,17 @@ func inHeadIM(p *parser) (insertionMode, bool) {
pop = true
}
// TODO.
+ case CommentToken:
+ p.addChild(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return inHeadIM, true
}
if pop || implied {
n := p.oe.pop()
if n.Data != "head" {
- panic("html: bad parser state")
+ panic("html: bad parser state: <head> element not found, in the in-head insertion mode")
}
return afterHeadIM, !implied
}
@@ -387,6 +504,12 @@ func afterHeadIM(p *parser) (insertionMode, bool) {
}
case EndTagToken:
// TODO.
+ case CommentToken:
+ p.addChild(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return afterHeadIM, true
}
if add || implied {
p.addElement("body", attr)
@@ -447,6 +570,30 @@ func inBodyIM(p *parser) (insertionMode, bool) {
p.oe.pop()
p.acknowledgeSelfClosingTag()
p.framesetOK = false
+ case "select":
+ p.reconstructActiveFormattingElements()
+ p.addElement(p.tok.Data, p.tok.Attr)
+ p.framesetOK = false
+ // TODO: detect <select> inside a table.
+ return inSelectIM, true
+ case "li":
+ p.framesetOK = false
+ for i := len(p.oe) - 1; i >= 0; i-- {
+ node := p.oe[i]
+ switch node.Data {
+ case "li":
+ p.popUntil(listItemScopeStopTags, "li")
+ case "address", "div", "p":
+ continue
+ default:
+ if !isSpecialElement[node.Data] {
+ continue
+ }
+ }
+ break
+ }
+ p.popUntil(buttonScopeStopTags, "p")
+ p.addElement("li", p.tok.Attr)
default:
// TODO.
p.addElement(p.tok.Data, p.tok.Attr)
@@ -463,12 +610,16 @@ func inBodyIM(p *parser) (insertionMode, bool) {
p.popUntil(buttonScopeStopTags, "p")
case "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u":
p.inBodyEndTagFormatting(p.tok.Data)
+ case "address", "article", "aside", "blockquote", "button", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "menu", "nav", "ol", "pre", "section", "summary", "ul":
+ p.popUntil(defaultScopeStopTags, p.tok.Data)
default:
- // TODO: any other end tag
- if p.tok.Data == p.top().Data {
- p.oe.pop()
- }
+ p.inBodyEndTagOther(p.tok.Data)
}
+ case CommentToken:
+ p.addChild(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
}
return inBodyIM, true
@@ -496,6 +647,7 @@ func (p *parser) inBodyEndTagFormatting(tag string) {
}
}
if formattingElement == nil {
+ p.inBodyEndTagOther(tag)
return
}
feIndex := p.oe.index(formattingElement)
@@ -568,8 +720,7 @@ func (p *parser) inBodyEndTagFormatting(tag string) {
}
switch commonAncestor.Data {
case "table", "tbody", "tfoot", "thead", "tr":
- // TODO: fix up misnested table nodes; find the foster parent.
- fallthrough
+ p.fosterParent(lastNode)
default:
commonAncestor.Add(lastNode)
}
@@ -590,6 +741,19 @@ func (p *parser) inBodyEndTagFormatting(tag string) {
}
}
+// inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM.
+func (p *parser) inBodyEndTagOther(tag string) {
+ for i := len(p.oe) - 1; i >= 0; i-- {
+ if p.oe[i].Data == tag {
+ p.oe = p.oe[:i]
+ break
+ }
+ if isSpecialElement[p.oe[i].Data] {
+ break
+ }
+ }
+}
+
// Section 11.2.5.4.8.
func textIM(p *parser) (insertionMode, bool) {
switch p.tok.Type {
@@ -606,12 +770,6 @@ func textIM(p *parser) (insertionMode, bool) {
// Section 11.2.5.4.9.
func inTableIM(p *parser) (insertionMode, bool) {
- var (
- add bool
- data string
- attr []Attribute
- consumed bool
- )
switch p.tok.Type {
case ErrorToken:
// Stop parsing.
@@ -621,13 +779,19 @@ func inTableIM(p *parser) (insertionMode, bool) {
case StartTagToken:
switch p.tok.Data {
case "tbody", "tfoot", "thead":
- add = true
- data = p.tok.Data
- attr = p.tok.Attr
- consumed = true
+ p.clearStackToContext(tableScopeStopTags)
+ p.addElement(p.tok.Data, p.tok.Attr)
+ return inTableBodyIM, true
case "td", "th", "tr":
- add = true
- data = "tbody"
+ p.clearStackToContext(tableScopeStopTags)
+ p.addElement("tbody", nil)
+ return inTableBodyIM, false
+ case "table":
+ if p.popUntil(tableScopeStopTags, "table") {
+ return p.resetInsertionMode(), false
+ }
+ // Ignore the token.
+ return inTableIM, true
default:
// TODO.
}
@@ -635,8 +799,7 @@ func inTableIM(p *parser) (insertionMode, bool) {
switch p.tok.Data {
case "table":
if p.popUntil(tableScopeStopTags, "table") {
- // TODO: "reset the insertion mode appropriately" as per 11.2.3.1.
- return inBodyIM, false
+ return p.resetInsertionMode(), true
}
// Ignore the token.
return inTableIM, true
@@ -644,14 +807,34 @@ func inTableIM(p *parser) (insertionMode, bool) {
// Ignore the token.
return inTableIM, true
}
+ case CommentToken:
+ p.addChild(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return inTableIM, true
}
- if add {
- // TODO: clear the stack back to a table context.
- p.addElement(data, attr)
- return inTableBodyIM, consumed
+
+ switch p.top().Data {
+ case "table", "tbody", "tfoot", "thead", "tr":
+ p.fosterParenting = true
+ defer func() { p.fosterParenting = false }()
+ }
+
+ return useTheRulesFor(p, inTableIM, inBodyIM)
+}
+
+// clearStackToContext pops elements off the stack of open elements
+// until an element listed in stopTags is found.
+func (p *parser) clearStackToContext(stopTags []string) {
+ for i := len(p.oe) - 1; i >= 0; i-- {
+ for _, tag := range stopTags {
+ if p.oe[i].Data == tag {
+ p.oe = p.oe[:i+1]
+ return
+ }
+ }
}
- // TODO: return useTheRulesFor(inTableIM, inBodyIM, p) unless etc. etc. foster parenting.
- return inTableIM, true
}
// Section 11.2.5.4.13.
@@ -693,6 +876,12 @@ func inTableBodyIM(p *parser) (insertionMode, bool) {
// Ignore the token.
return inTableBodyIM, true
}
+ case CommentToken:
+ p.addChild(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return inTableBodyIM, true
}
if add {
// TODO: clear the stack back to a table body context.
@@ -722,7 +911,12 @@ func inRowIM(p *parser) (insertionMode, bool) {
case EndTagToken:
switch p.tok.Data {
case "tr":
- // TODO.
+ if !p.elementInScope(tableScopeStopTags, "tr") {
+ return inRowIM, true
+ }
+ p.clearStackToContext(tableRowContextStopTags)
+ p.oe.pop()
+ return inTableBodyIM, true
case "table":
if p.popUntil(tableScopeStopTags, "tr") {
return inTableBodyIM, false
@@ -737,6 +931,12 @@ func inRowIM(p *parser) (insertionMode, bool) {
default:
// TODO.
}
+ case CommentToken:
+ p.addChild(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return inRowIM, true
}
return useTheRulesFor(p, inRowIM, inTableIM)
}
@@ -763,6 +963,12 @@ func inCellIM(p *parser) (insertionMode, bool) {
// TODO: check for matching element in table scope.
closeTheCellAndReprocess = true
}
+ case CommentToken:
+ p.addChild(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return inCellIM, true
}
if closeTheCellAndReprocess {
if p.popUntil(tableScopeStopTags, "td") || p.popUntil(tableScopeStopTags, "th") {
@@ -773,6 +979,68 @@ func inCellIM(p *parser) (insertionMode, bool) {
return useTheRulesFor(p, inCellIM, inBodyIM)
}
+// Section 11.2.5.4.16.
+func inSelectIM(p *parser) (insertionMode, bool) {
+ endSelect := false
+ switch p.tok.Type {
+ case ErrorToken:
+ // TODO.
+ case TextToken:
+ p.addText(p.tok.Data)
+ case StartTagToken:
+ switch p.tok.Data {
+ case "html":
+ // TODO.
+ case "option":
+ if p.top().Data == "option" {
+ p.oe.pop()
+ }
+ p.addElement(p.tok.Data, p.tok.Attr)
+ case "optgroup":
+ // TODO.
+ case "select":
+ endSelect = true
+ case "input", "keygen", "textarea":
+ // TODO.
+ case "script":
+ // TODO.
+ default:
+ // Ignore the token.
+ }
+ case EndTagToken:
+ switch p.tok.Data {
+ case "option":
+ // TODO.
+ case "optgroup":
+ // TODO.
+ case "select":
+ endSelect = true
+ default:
+ // Ignore the token.
+ }
+ case CommentToken:
+ p.doc.Add(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ }
+ if endSelect {
+ for i := len(p.oe) - 1; i >= 0; i-- {
+ switch p.oe[i].Data {
+ case "select":
+ p.oe = p.oe[:i]
+ return p.resetInsertionMode(), true
+ case "option", "optgroup":
+ continue
+ default:
+ // Ignore the token.
+ return inSelectIM, true
+ }
+ }
+ }
+ return inSelectIM, true
+}
+
// Section 11.2.5.4.18.
func afterBodyIM(p *parser) (insertionMode, bool) {
switch p.tok.Type {
@@ -790,7 +1058,18 @@ func afterBodyIM(p *parser) (insertionMode, bool) {
default:
// TODO.
}
+ case CommentToken:
+ // The comment is attached to the <html> element.
+ if len(p.oe) < 1 || p.oe[0].Data != "html" {
+ panic("html: bad parser state: <html> element not found, in the after-body insertion mode")
+ }
+ p.oe[0].Add(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return afterBodyIM, true
}
+ // TODO: should this be "return inBodyIM, true"?
return afterBodyIM, true
}
@@ -806,6 +1085,12 @@ func afterAfterBodyIM(p *parser) (insertionMode, bool) {
if p.tok.Data == "html" {
return useTheRulesFor(p, afterAfterBodyIM, inBodyIM)
}
+ case CommentToken:
+ p.doc.Add(&Node{
+ Type: CommentNode,
+ Data: p.tok.Data,
+ })
+ return afterAfterBodyIM, true
}
return inBodyIM, false
}
diff --git a/libgo/go/html/parse_test.go b/libgo/go/html/parse_test.go
index 564580c78b2..b0ddd924762 100644
--- a/libgo/go/html/parse_test.go
+++ b/libgo/go/html/parse_test.go
@@ -69,11 +69,15 @@ func readDat(filename string, c chan io.Reader) {
}
}
-func dumpLevel(w io.Writer, n *Node, level int) os.Error {
+func dumpIndent(w io.Writer, level int) {
io.WriteString(w, "| ")
for i := 0; i < level; i++ {
io.WriteString(w, " ")
}
+}
+
+func dumpLevel(w io.Writer, n *Node, level int) os.Error {
+ dumpIndent(w, level)
switch n.Type {
case ErrorNode:
return os.NewError("unexpected ErrorNode")
@@ -81,10 +85,15 @@ func dumpLevel(w io.Writer, n *Node, level int) os.Error {
return os.NewError("unexpected DocumentNode")
case ElementNode:
fmt.Fprintf(w, "<%s>", n.Data)
+ for _, a := range n.Attr {
+ io.WriteString(w, "\n")
+ dumpIndent(w, level+1)
+ fmt.Fprintf(w, `%s="%s"`, a.Key, a.Val)
+ }
case TextNode:
fmt.Fprintf(w, "%q", n.Data)
case CommentNode:
- return os.NewError("COMMENT")
+ fmt.Fprintf(w, "<!-- %s -->", n.Data)
case DoctypeNode:
fmt.Fprintf(w, "<!DOCTYPE %s>", n.Data)
case scopeMarkerNode:
@@ -123,7 +132,7 @@ func TestParser(t *testing.T) {
rc := make(chan io.Reader)
go readDat(filename, rc)
// TODO(nigeltao): Process all test cases, not just a subset.
- for i := 0; i < 27; i++ {
+ for i := 0; i < 34; i++ {
// Parse the #data section.
b, err := ioutil.ReadAll(<-rc)
if err != nil {
@@ -152,6 +161,13 @@ func TestParser(t *testing.T) {
continue
}
// Check that rendering and re-parsing results in an identical tree.
+ if filename == "tests1.dat" && i == 30 {
+ // Test 30 in tests1.dat is such messed-up markup that a correct parse
+ // results in a non-conforming tree (one <a> element nested inside another).
+ // Therefore when it is rendered and re-parsed, it isn't the same.
+ // So we skip rendering on that test.
+ continue
+ }
pr, pw := io.Pipe()
go func() {
pw.CloseWithError(Render(pw, doc))
diff --git a/libgo/go/html/render.go b/libgo/go/html/render.go
index e1ec66ff1ac..d5dc4484333 100644
--- a/libgo/go/html/render.go
+++ b/libgo/go/html/render.go
@@ -30,9 +30,6 @@ type writer interface {
// would become a tree containing <html>, <head> and <body> elements. Another
// example is that the programmatic equivalent of "a<head>b</head>c" becomes
// "<html><head><head/><body>abc</body></html>".
-//
-// Comment nodes are elided from the output, analogous to Parse skipping over
-// any <!--comment--> input.
func Render(w io.Writer, n *Node) os.Error {
if x, ok := w.(writer); ok {
return render(x, n)
@@ -61,6 +58,15 @@ func render(w writer, n *Node) os.Error {
case ElementNode:
// No-op.
case CommentNode:
+ if _, err := w.WriteString("<!--"); err != nil {
+ return err
+ }
+ if _, err := w.WriteString(n.Data); err != nil {
+ return err
+ }
+ if _, err := w.WriteString("-->"); err != nil {
+ return err
+ }
return nil
case DoctypeNode:
if _, err := w.WriteString("<!DOCTYPE "); err != nil {
diff --git a/libgo/go/html/token.go b/libgo/go/html/token.go
index 2826f95f17f..952d17468bd 100644
--- a/libgo/go/html/token.go
+++ b/libgo/go/html/token.go
@@ -116,10 +116,6 @@ type span struct {
// A Tokenizer returns a stream of HTML Tokens.
type Tokenizer struct {
- // If ReturnComments is set, Next returns comment tokens;
- // otherwise it skips over comments (default).
- ReturnComments bool
-
// r is the source of the HTML text.
r io.Reader
// tt is the TokenType of the current token.
@@ -546,17 +542,19 @@ func (z *Tokenizer) readTagAttrVal() {
}
}
-// next scans the next token and returns its type.
-func (z *Tokenizer) next() TokenType {
+// Next scans the next token and returns its type.
+func (z *Tokenizer) Next() TokenType {
if z.err != nil {
- return ErrorToken
+ z.tt = ErrorToken
+ return z.tt
}
z.raw.start = z.raw.end
z.data.start = z.raw.end
z.data.end = z.raw.end
if z.rawTag != "" {
z.readRawOrRCDATA()
- return TextToken
+ z.tt = TextToken
+ return z.tt
}
z.textIsRaw = false
@@ -596,11 +594,13 @@ loop:
if x := z.raw.end - len("<a"); z.raw.start < x {
z.raw.end = x
z.data.end = x
- return TextToken
+ z.tt = TextToken
+ return z.tt
}
switch tokenType {
case StartTagToken:
- return z.readStartTag()
+ z.tt = z.readStartTag()
+ return z.tt
case EndTagToken:
c = z.readByte()
if z.err != nil {
@@ -616,39 +616,31 @@ loop:
}
if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' {
z.readEndTag()
- return EndTagToken
+ z.tt = EndTagToken
+ return z.tt
}
z.raw.end--
z.readUntilCloseAngle()
- return CommentToken
+ z.tt = CommentToken
+ return z.tt
case CommentToken:
if c == '!' {
- return z.readMarkupDeclaration()
+ z.tt = z.readMarkupDeclaration()
+ return z.tt
}
z.raw.end--
z.readUntilCloseAngle()
- return CommentToken
+ z.tt = CommentToken
+ return z.tt
}
}
if z.raw.start < z.raw.end {
z.data.end = z.raw.end
- return TextToken
- }
- return ErrorToken
-}
-
-// Next scans the next token and returns its type.
-func (z *Tokenizer) Next() TokenType {
- for {
- z.tt = z.next()
- // TODO: remove the ReturnComments option. A tokenizer should
- // always return comment tags.
- if z.tt == CommentToken && !z.ReturnComments {
- continue
- }
+ z.tt = TextToken
return z.tt
}
- panic("unreachable")
+ z.tt = ErrorToken
+ return z.tt
}
// Raw returns the unmodified text of the current token. Calling Next, Token,
diff --git a/libgo/go/html/token_test.go b/libgo/go/html/token_test.go
index 310cd97d670..45ce85e9115 100644
--- a/libgo/go/html/token_test.go
+++ b/libgo/go/html/token_test.go
@@ -424,7 +424,6 @@ func TestTokenizer(t *testing.T) {
loop:
for _, tt := range tokenTests {
z := NewTokenizer(strings.NewReader(tt.html))
- z.ReturnComments = true
if tt.golden != "" {
for i, s := range strings.Split(tt.golden, "$") {
if z.Next() == ErrorToken {
diff --git a/libgo/go/http/client.go b/libgo/go/http/client.go
index 3fa4a056ad8..e939b96a311 100644
--- a/libgo/go/http/client.go
+++ b/libgo/go/http/client.go
@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Primitive HTTP client. See RFC 2616.
+// HTTP client. See RFC 2616.
+//
+// This is the high-level Client interface.
+// The low-level implementation is in transport.go.
package http
diff --git a/libgo/go/http/client_test.go b/libgo/go/http/client_test.go
index 0ad6cd7c2f3..8f61286c46a 100644
--- a/libgo/go/http/client_test.go
+++ b/libgo/go/http/client_test.go
@@ -7,6 +7,7 @@
package http_test
import (
+ "crypto/tls"
"fmt"
. "http"
"http/httptest"
@@ -292,3 +293,26 @@ func TestClientWrites(t *testing.T) {
t.Errorf("Post request did %d Write calls, want 1", writes)
}
}
+
+func TestClientInsecureTransport(t *testing.T) {
+ ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) {
+ w.Write([]byte("Hello"))
+ }))
+ defer ts.Close()
+
+ // TODO(bradfitz): add tests for skipping hostname checks too?
+ // would require a new cert for testing, and probably
+ // redundant with these tests.
+ for _, insecure := range []bool{true, false} {
+ tr := &Transport{
+ TLSClientConfig: &tls.Config{
+ InsecureSkipVerify: insecure,
+ },
+ }
+ c := &Client{Transport: tr}
+ _, err := c.Get(ts.URL)
+ if (err == nil) != insecure {
+ t.Errorf("insecure=%v: got unexpected err=%v", insecure, err)
+ }
+ }
+}
diff --git a/libgo/go/http/doc.go b/libgo/go/http/doc.go
new file mode 100644
index 00000000000..9c47ac7823f
--- /dev/null
+++ b/libgo/go/http/doc.go
@@ -0,0 +1,79 @@
+// Copyright 2011 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.
+
+/*
+Package http provides HTTP client and server implementations.
+
+Get, Head, Post, and PostForm make HTTP requests:
+
+ resp, err := http.Get("http://example.com/")
+ ...
+ resp, err := http.Post("http://example.com/upload", "image/jpeg", &buf)
+ ...
+ resp, err := http.PostForm("http://example.com/form",
+ url.Values{"key": {"Value"}, "id": {"123"}})
+
+The client must close the response body when finished with it:
+
+ resp, err := http.Get("http://example.com/")
+ if err != nil {
+ // handle error
+ }
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ // ...
+
+For control over HTTP client headers, redirect policy, and other
+settings, create a Client:
+
+ client := &http.Client{
+ CheckRedirect: redirectPolicyFunc,
+ }
+
+ resp, err := client.Get("http://example.com")
+ // ...
+
+ req := http.NewRequest("GET", "http://example.com", nil)
+ req.Header.Add("If-None-Match", `W/"wyzzy"`)
+ resp, err := client.Do(req)
+ // ...
+
+For control over proxies, TLS configuration, keep-alives,
+compression, and other settings, create a Transport:
+
+ tr := &http.Transport{
+ TLSClientConfig: &tls.Config{RootCAs: pool},
+ DisableCompression: true,
+ }
+ client := &http.Client{Transport: tr}
+ resp, err := client.Get("https://example.com")
+
+Clients and Transports are safe for concurrent use by multiple
+goroutines and for efficiency should only be created once and re-used.
+
+ListenAndServe starts an HTTP server with a given address and handler.
+The handler is usually nil, which means to use DefaultServeMux.
+Handle and HandleFunc add handlers to DefaultServeMux:
+
+ http.Handle("/foo", fooHandler)
+
+ http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.RawPath))
+ })
+
+ log.Fatal(http.ListenAndServe(":8080", nil))
+
+More control over the server's behavior is available by creating a
+custom Server:
+
+ s := &http.Server{
+ Addr: ":8080",
+ Handler: myHandler,
+ ReadTimeout: 10e9,
+ WriteTimeout: 10e9,
+ MaxHeaderBytes: 1 << 20,
+ }
+ log.Fatal(s.ListenAndServe())
+*/
+package http
diff --git a/libgo/go/http/request.go b/libgo/go/http/request.go
index 02317e0c419..78e07ecbc97 100644
--- a/libgo/go/http/request.go
+++ b/libgo/go/http/request.go
@@ -4,8 +4,6 @@
// HTTP Request reading and parsing.
-// Package http implements parsing of HTTP requests, replies, and URLs and
-// provides an extensible HTTP server and a basic HTTP client.
package http
import (
diff --git a/libgo/go/http/transport.go b/libgo/go/http/transport.go
index 0914af7e5cf..1d4433d14f6 100644
--- a/libgo/go/http/transport.go
+++ b/libgo/go/http/transport.go
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// HTTP client implementation. See RFC 2616.
+//
+// This is the low-level Transport implementation of RoundTripper.
+// The high-level interface is in client.go.
+
package http
import (
@@ -357,8 +362,10 @@ func (t *Transport) getConn(cm *connectMethod) (*persistConn, os.Error) {
if err = conn.(*tls.Conn).Handshake(); err != nil {
return nil, err
}
- if err = conn.(*tls.Conn).VerifyHostname(cm.tlsHost()); err != nil {
- return nil, err
+ if t.TLSClientConfig == nil || !t.TLSClientConfig.InsecureSkipVerify {
+ if err = conn.(*tls.Conn).VerifyHostname(cm.tlsHost()); err != nil {
+ return nil, err
+ }
}
pconn.conn = conn
}
diff --git a/libgo/go/net/sock_windows.go b/libgo/go/net/sock_windows.go
index c6dbd046567..5169d1e6a29 100644
--- a/libgo/go/net/sock_windows.go
+++ b/libgo/go/net/sock_windows.go
@@ -11,9 +11,6 @@ import (
)
func setKernelSpecificSockopt(s syscall.Handle, f int) {
- // Allow reuse of recently-used addresses and ports.
- syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
-
// Allow broadcast.
syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1)
diff --git a/libgo/go/unicode/tables.go b/libgo/go/unicode/tables.go
index 88b5c0fbaaa..a3b882625ef 100644
--- a/libgo/go/unicode/tables.go
+++ b/libgo/go/unicode/tables.go
@@ -9,233 +9,79 @@ const Version = "6.0.0"
// Categories is the set of Unicode data tables.
var Categories = map[string]*RangeTable{
- "Lm": Lm,
- "Ll": Ll,
"C": C,
- "M": M,
+ "Cc": Cc,
+ "Cf": Cf,
+ "Co": Co,
+ "Cs": Cs,
"L": L,
+ "Ll": Ll,
+ "Lm": Lm,
+ "Lo": Lo,
+ "Lt": Lt,
+ "Lu": Lu,
+ "M": M,
+ "Mc": Mc,
+ "Me": Me,
+ "Mn": Mn,
"N": N,
+ "Nd": Nd,
+ "Nl": Nl,
+ "No": No,
"P": P,
+ "Pc": Pc,
+ "Pd": Pd,
+ "Pe": Pe,
+ "Pf": Pf,
+ "Pi": Pi,
+ "Po": Po,
+ "Ps": Ps,
"S": S,
+ "Sc": Sc,
+ "Sk": Sk,
+ "Sm": Sm,
+ "So": So,
"Z": Z,
- "Me": Me,
- "Mc": Mc,
- "Mn": Mn,
"Zl": Zl,
"Zp": Zp,
"Zs": Zs,
- "Cs": Cs,
- "Co": Co,
- "Cf": Cf,
- "Cc": Cc,
- "Po": Po,
- "Pi": Pi,
- "Pf": Pf,
- "Pe": Pe,
- "Pd": Pd,
- "Pc": Pc,
- "Ps": Ps,
- "Nd": Nd,
- "Nl": Nl,
- "No": No,
- "So": So,
- "Sm": Sm,
- "Sk": Sk,
- "Sc": Sc,
- "Lu": Lu,
- "Lt": Lt,
- "Lo": Lo,
-}
-
-var _Lm = &RangeTable{
- R16: []Range16{
- {0x02b0, 0x02c1, 1},
- {0x02c6, 0x02d1, 1},
- {0x02e0, 0x02e4, 1},
- {0x02ec, 0x02ee, 2},
- {0x0374, 0x037a, 6},
- {0x0559, 0x0640, 231},
- {0x06e5, 0x06e6, 1},
- {0x07f4, 0x07f5, 1},
- {0x07fa, 0x081a, 32},
- {0x0824, 0x0828, 4},
- {0x0971, 0x0e46, 1237},
- {0x0ec6, 0x10fc, 566},
- {0x17d7, 0x1843, 108},
- {0x1aa7, 0x1c78, 465},
- {0x1c79, 0x1c7d, 1},
- {0x1d2c, 0x1d61, 1},
- {0x1d78, 0x1d9b, 35},
- {0x1d9c, 0x1dbf, 1},
- {0x2071, 0x207f, 14},
- {0x2090, 0x209c, 1},
- {0x2c7d, 0x2d6f, 242},
- {0x2e2f, 0x3005, 470},
- {0x3031, 0x3035, 1},
- {0x303b, 0x309d, 98},
- {0x309e, 0x30fc, 94},
- {0x30fd, 0x30fe, 1},
- {0xa015, 0xa4f8, 1251},
- {0xa4f9, 0xa4fd, 1},
- {0xa60c, 0xa67f, 115},
- {0xa717, 0xa71f, 1},
- {0xa770, 0xa788, 24},
- {0xa9cf, 0xaa70, 161},
- {0xaadd, 0xff70, 21651},
- {0xff9e, 0xff9f, 1},
- },
}
-var _Ll = &RangeTable{
+var _C = &RangeTable{
R16: []Range16{
- {0x0061, 0x007a, 1},
- {0x00aa, 0x00b5, 11},
- {0x00ba, 0x00df, 37},
- {0x00e0, 0x00f6, 1},
- {0x00f8, 0x00ff, 1},
- {0x0101, 0x0137, 2},
- {0x0138, 0x0148, 2},
- {0x0149, 0x0177, 2},
- {0x017a, 0x017e, 2},
- {0x017f, 0x0180, 1},
- {0x0183, 0x0185, 2},
- {0x0188, 0x018c, 4},
- {0x018d, 0x0192, 5},
- {0x0195, 0x0199, 4},
- {0x019a, 0x019b, 1},
- {0x019e, 0x01a1, 3},
- {0x01a3, 0x01a5, 2},
- {0x01a8, 0x01aa, 2},
- {0x01ab, 0x01ad, 2},
- {0x01b0, 0x01b4, 4},
- {0x01b6, 0x01b9, 3},
- {0x01ba, 0x01bd, 3},
- {0x01be, 0x01bf, 1},
- {0x01c6, 0x01cc, 3},
- {0x01ce, 0x01dc, 2},
- {0x01dd, 0x01ef, 2},
- {0x01f0, 0x01f3, 3},
- {0x01f5, 0x01f9, 4},
- {0x01fb, 0x0233, 2},
- {0x0234, 0x0239, 1},
- {0x023c, 0x023f, 3},
- {0x0240, 0x0242, 2},
- {0x0247, 0x024f, 2},
- {0x0250, 0x0293, 1},
- {0x0295, 0x02af, 1},
- {0x0371, 0x0373, 2},
- {0x0377, 0x037b, 4},
- {0x037c, 0x037d, 1},
- {0x0390, 0x03ac, 28},
- {0x03ad, 0x03ce, 1},
- {0x03d0, 0x03d1, 1},
- {0x03d5, 0x03d7, 1},
- {0x03d9, 0x03ef, 2},
- {0x03f0, 0x03f3, 1},
- {0x03f5, 0x03fb, 3},
- {0x03fc, 0x0430, 52},
- {0x0431, 0x045f, 1},
- {0x0461, 0x0481, 2},
- {0x048b, 0x04bf, 2},
- {0x04c2, 0x04ce, 2},
- {0x04cf, 0x0527, 2},
- {0x0561, 0x0587, 1},
- {0x1d00, 0x1d2b, 1},
- {0x1d62, 0x1d77, 1},
- {0x1d79, 0x1d9a, 1},
- {0x1e01, 0x1e95, 2},
- {0x1e96, 0x1e9d, 1},
- {0x1e9f, 0x1eff, 2},
- {0x1f00, 0x1f07, 1},
- {0x1f10, 0x1f15, 1},
- {0x1f20, 0x1f27, 1},
- {0x1f30, 0x1f37, 1},
- {0x1f40, 0x1f45, 1},
- {0x1f50, 0x1f57, 1},
- {0x1f60, 0x1f67, 1},
- {0x1f70, 0x1f7d, 1},
- {0x1f80, 0x1f87, 1},
- {0x1f90, 0x1f97, 1},
- {0x1fa0, 0x1fa7, 1},
- {0x1fb0, 0x1fb4, 1},
- {0x1fb6, 0x1fb7, 1},
- {0x1fbe, 0x1fc2, 4},
- {0x1fc3, 0x1fc4, 1},
- {0x1fc6, 0x1fc7, 1},
- {0x1fd0, 0x1fd3, 1},
- {0x1fd6, 0x1fd7, 1},
- {0x1fe0, 0x1fe7, 1},
- {0x1ff2, 0x1ff4, 1},
- {0x1ff6, 0x1ff7, 1},
- {0x210a, 0x210e, 4},
- {0x210f, 0x2113, 4},
- {0x212f, 0x2139, 5},
- {0x213c, 0x213d, 1},
- {0x2146, 0x2149, 1},
- {0x214e, 0x2184, 54},
- {0x2c30, 0x2c5e, 1},
- {0x2c61, 0x2c65, 4},
- {0x2c66, 0x2c6c, 2},
- {0x2c71, 0x2c73, 2},
- {0x2c74, 0x2c76, 2},
- {0x2c77, 0x2c7c, 1},
- {0x2c81, 0x2ce3, 2},
- {0x2ce4, 0x2cec, 8},
- {0x2cee, 0x2d00, 18},
- {0x2d01, 0x2d25, 1},
- {0xa641, 0xa66d, 2},
- {0xa681, 0xa697, 2},
- {0xa723, 0xa72f, 2},
- {0xa730, 0xa731, 1},
- {0xa733, 0xa771, 2},
- {0xa772, 0xa778, 1},
- {0xa77a, 0xa77c, 2},
- {0xa77f, 0xa787, 2},
- {0xa78c, 0xa78e, 2},
- {0xa791, 0xa7a1, 16},
- {0xa7a3, 0xa7a9, 2},
- {0xa7fa, 0xfb00, 21254},
- {0xfb01, 0xfb06, 1},
- {0xfb13, 0xfb17, 1},
- {0xff41, 0xff5a, 1},
+ {0x0001, 0x001f, 1},
+ {0x007f, 0x009f, 1},
+ {0x00ad, 0x0600, 1363},
+ {0x0601, 0x0603, 1},
+ {0x06dd, 0x070f, 50},
+ {0x17b4, 0x17b5, 1},
+ {0x200b, 0x200f, 1},
+ {0x202a, 0x202e, 1},
+ {0x2060, 0x2064, 1},
+ {0x206a, 0x206f, 1},
+ {0xd800, 0xf8ff, 1},
+ {0xfeff, 0xfff9, 250},
+ {0xfffa, 0xfffb, 1},
},
R32: []Range32{
- {0x10428, 0x1044f, 1},
- {0x1d41a, 0x1d433, 1},
- {0x1d44e, 0x1d454, 1},
- {0x1d456, 0x1d467, 1},
- {0x1d482, 0x1d49b, 1},
- {0x1d4b6, 0x1d4b9, 1},
- {0x1d4bb, 0x1d4bd, 2},
- {0x1d4be, 0x1d4c3, 1},
- {0x1d4c5, 0x1d4cf, 1},
- {0x1d4ea, 0x1d503, 1},
- {0x1d51e, 0x1d537, 1},
- {0x1d552, 0x1d56b, 1},
- {0x1d586, 0x1d59f, 1},
- {0x1d5ba, 0x1d5d3, 1},
- {0x1d5ee, 0x1d607, 1},
- {0x1d622, 0x1d63b, 1},
- {0x1d656, 0x1d66f, 1},
- {0x1d68a, 0x1d6a5, 1},
- {0x1d6c2, 0x1d6da, 1},
- {0x1d6dc, 0x1d6e1, 1},
- {0x1d6fc, 0x1d714, 1},
- {0x1d716, 0x1d71b, 1},
- {0x1d736, 0x1d74e, 1},
- {0x1d750, 0x1d755, 1},
- {0x1d770, 0x1d788, 1},
- {0x1d78a, 0x1d78f, 1},
- {0x1d7aa, 0x1d7c2, 1},
- {0x1d7c4, 0x1d7c9, 1},
- {0x1d7cb, 0x1d7cb, 1},
+ {0x110bd, 0x1d173, 49334},
+ {0x1d174, 0x1d17a, 1},
+ {0xe0001, 0xe0020, 31},
+ {0xe0021, 0xe007f, 1},
+ {0xf0000, 0xffffd, 1},
+ {0x100000, 0x10fffd, 1},
},
}
-var _C = &RangeTable{
+var _Cc = &RangeTable{
R16: []Range16{
{0x0001, 0x001f, 1},
{0x007f, 0x009f, 1},
+ },
+}
+
+var _Cf = &RangeTable{
+ R16: []Range16{
{0x00ad, 0x0600, 1363},
{0x0601, 0x0603, 1},
{0x06dd, 0x070f, 50},
@@ -244,7 +90,6 @@ var _C = &RangeTable{
{0x202a, 0x202e, 1},
{0x2060, 0x2064, 1},
{0x206a, 0x206f, 1},
- {0xd800, 0xf8ff, 1},
{0xfeff, 0xfff9, 250},
{0xfffa, 0xfffb, 1},
},
@@ -253,200 +98,22 @@ var _C = &RangeTable{
{0x1d174, 0x1d17a, 1},
{0xe0001, 0xe0020, 31},
{0xe0021, 0xe007f, 1},
- {0xf0000, 0xffffd, 1},
- {0x100000, 0x10fffd, 1},
},
}
-var _M = &RangeTable{
+var _Co = &RangeTable{
R16: []Range16{
- {0x0300, 0x036f, 1},
- {0x0483, 0x0489, 1},
- {0x0591, 0x05bd, 1},
- {0x05bf, 0x05c1, 2},
- {0x05c2, 0x05c4, 2},
- {0x05c5, 0x05c7, 2},
- {0x0610, 0x061a, 1},
- {0x064b, 0x065f, 1},
- {0x0670, 0x06d6, 102},
- {0x06d7, 0x06dc, 1},
- {0x06df, 0x06e4, 1},
- {0x06e7, 0x06e8, 1},
- {0x06ea, 0x06ed, 1},
- {0x0711, 0x0730, 31},
- {0x0731, 0x074a, 1},
- {0x07a6, 0x07b0, 1},
- {0x07eb, 0x07f3, 1},
- {0x0816, 0x0819, 1},
- {0x081b, 0x0823, 1},
- {0x0825, 0x0827, 1},
- {0x0829, 0x082d, 1},
- {0x0859, 0x085b, 1},
- {0x0900, 0x0903, 1},
- {0x093a, 0x093c, 1},
- {0x093e, 0x094f, 1},
- {0x0951, 0x0957, 1},
- {0x0962, 0x0963, 1},
- {0x0981, 0x0983, 1},
- {0x09bc, 0x09be, 2},
- {0x09bf, 0x09c4, 1},
- {0x09c7, 0x09c8, 1},
- {0x09cb, 0x09cd, 1},
- {0x09d7, 0x09e2, 11},
- {0x09e3, 0x0a01, 30},
- {0x0a02, 0x0a03, 1},
- {0x0a3c, 0x0a3e, 2},
- {0x0a3f, 0x0a42, 1},
- {0x0a47, 0x0a48, 1},
- {0x0a4b, 0x0a4d, 1},
- {0x0a51, 0x0a70, 31},
- {0x0a71, 0x0a75, 4},
- {0x0a81, 0x0a83, 1},
- {0x0abc, 0x0abe, 2},
- {0x0abf, 0x0ac5, 1},
- {0x0ac7, 0x0ac9, 1},
- {0x0acb, 0x0acd, 1},
- {0x0ae2, 0x0ae3, 1},
- {0x0b01, 0x0b03, 1},
- {0x0b3c, 0x0b3e, 2},
- {0x0b3f, 0x0b44, 1},
- {0x0b47, 0x0b48, 1},
- {0x0b4b, 0x0b4d, 1},
- {0x0b56, 0x0b57, 1},
- {0x0b62, 0x0b63, 1},
- {0x0b82, 0x0bbe, 60},
- {0x0bbf, 0x0bc2, 1},
- {0x0bc6, 0x0bc8, 1},
- {0x0bca, 0x0bcd, 1},
- {0x0bd7, 0x0c01, 42},
- {0x0c02, 0x0c03, 1},
- {0x0c3e, 0x0c44, 1},
- {0x0c46, 0x0c48, 1},
- {0x0c4a, 0x0c4d, 1},
- {0x0c55, 0x0c56, 1},
- {0x0c62, 0x0c63, 1},
- {0x0c82, 0x0c83, 1},
- {0x0cbc, 0x0cbe, 2},
- {0x0cbf, 0x0cc4, 1},
- {0x0cc6, 0x0cc8, 1},
- {0x0cca, 0x0ccd, 1},
- {0x0cd5, 0x0cd6, 1},
- {0x0ce2, 0x0ce3, 1},
- {0x0d02, 0x0d03, 1},
- {0x0d3e, 0x0d44, 1},
- {0x0d46, 0x0d48, 1},
- {0x0d4a, 0x0d4d, 1},
- {0x0d57, 0x0d62, 11},
- {0x0d63, 0x0d82, 31},
- {0x0d83, 0x0dca, 71},
- {0x0dcf, 0x0dd4, 1},
- {0x0dd6, 0x0dd8, 2},
- {0x0dd9, 0x0ddf, 1},
- {0x0df2, 0x0df3, 1},
- {0x0e31, 0x0e34, 3},
- {0x0e35, 0x0e3a, 1},
- {0x0e47, 0x0e4e, 1},
- {0x0eb1, 0x0eb4, 3},
- {0x0eb5, 0x0eb9, 1},
- {0x0ebb, 0x0ebc, 1},
- {0x0ec8, 0x0ecd, 1},
- {0x0f18, 0x0f19, 1},
- {0x0f35, 0x0f39, 2},
- {0x0f3e, 0x0f3f, 1},
- {0x0f71, 0x0f84, 1},
- {0x0f86, 0x0f87, 1},
- {0x0f8d, 0x0f97, 1},
- {0x0f99, 0x0fbc, 1},
- {0x0fc6, 0x102b, 101},
- {0x102c, 0x103e, 1},
- {0x1056, 0x1059, 1},
- {0x105e, 0x1060, 1},
- {0x1062, 0x1064, 1},
- {0x1067, 0x106d, 1},
- {0x1071, 0x1074, 1},
- {0x1082, 0x108d, 1},
- {0x108f, 0x109a, 11},
- {0x109b, 0x109d, 1},
- {0x135d, 0x135f, 1},
- {0x1712, 0x1714, 1},
- {0x1732, 0x1734, 1},
- {0x1752, 0x1753, 1},
- {0x1772, 0x1773, 1},
- {0x17b6, 0x17d3, 1},
- {0x17dd, 0x180b, 46},
- {0x180c, 0x180d, 1},
- {0x18a9, 0x1920, 119},
- {0x1921, 0x192b, 1},
- {0x1930, 0x193b, 1},
- {0x19b0, 0x19c0, 1},
- {0x19c8, 0x19c9, 1},
- {0x1a17, 0x1a1b, 1},
- {0x1a55, 0x1a5e, 1},
- {0x1a60, 0x1a7c, 1},
- {0x1a7f, 0x1b00, 129},
- {0x1b01, 0x1b04, 1},
- {0x1b34, 0x1b44, 1},
- {0x1b6b, 0x1b73, 1},
- {0x1b80, 0x1b82, 1},
- {0x1ba1, 0x1baa, 1},
- {0x1be6, 0x1bf3, 1},
- {0x1c24, 0x1c37, 1},
- {0x1cd0, 0x1cd2, 1},
- {0x1cd4, 0x1ce8, 1},
- {0x1ced, 0x1cf2, 5},
- {0x1dc0, 0x1de6, 1},
- {0x1dfc, 0x1dff, 1},
- {0x20d0, 0x20f0, 1},
- {0x2cef, 0x2cf1, 1},
- {0x2d7f, 0x2de0, 97},
- {0x2de1, 0x2dff, 1},
- {0x302a, 0x302f, 1},
- {0x3099, 0x309a, 1},
- {0xa66f, 0xa672, 1},
- {0xa67c, 0xa67d, 1},
- {0xa6f0, 0xa6f1, 1},
- {0xa802, 0xa806, 4},
- {0xa80b, 0xa823, 24},
- {0xa824, 0xa827, 1},
- {0xa880, 0xa881, 1},
- {0xa8b4, 0xa8c4, 1},
- {0xa8e0, 0xa8f1, 1},
- {0xa926, 0xa92d, 1},
- {0xa947, 0xa953, 1},
- {0xa980, 0xa983, 1},
- {0xa9b3, 0xa9c0, 1},
- {0xaa29, 0xaa36, 1},
- {0xaa43, 0xaa4c, 9},
- {0xaa4d, 0xaa7b, 46},
- {0xaab0, 0xaab2, 2},
- {0xaab3, 0xaab4, 1},
- {0xaab7, 0xaab8, 1},
- {0xaabe, 0xaabf, 1},
- {0xaac1, 0xabe3, 290},
- {0xabe4, 0xabea, 1},
- {0xabec, 0xabed, 1},
- {0xfb1e, 0xfe00, 738},
- {0xfe01, 0xfe0f, 1},
- {0xfe20, 0xfe26, 1},
+ {0xe000, 0xf8ff, 1},
},
R32: []Range32{
- {0x101fd, 0x10a01, 2052},
- {0x10a02, 0x10a03, 1},
- {0x10a05, 0x10a06, 1},
- {0x10a0c, 0x10a0f, 1},
- {0x10a38, 0x10a3a, 1},
- {0x10a3f, 0x11000, 1473},
- {0x11001, 0x11002, 1},
- {0x11038, 0x11046, 1},
- {0x11080, 0x11082, 1},
- {0x110b0, 0x110ba, 1},
- {0x1d165, 0x1d169, 1},
- {0x1d16d, 0x1d172, 1},
- {0x1d17b, 0x1d182, 1},
- {0x1d185, 0x1d18b, 1},
- {0x1d1aa, 0x1d1ad, 1},
- {0x1d242, 0x1d244, 1},
- {0xe0100, 0xe01ef, 1},
+ {0xf0000, 0xffffd, 1},
+ {0x100000, 0x10fffd, 1},
+ },
+}
+
+var _Cs = &RangeTable{
+ R16: []Range16{
+ {0xd800, 0xdfff, 1},
},
}
@@ -871,422 +538,845 @@ var _L = &RangeTable{
},
}
-var _N = &RangeTable{
+var _Ll = &RangeTable{
R16: []Range16{
- {0x0030, 0x0039, 1},
- {0x00b2, 0x00b3, 1},
- {0x00b9, 0x00bc, 3},
- {0x00bd, 0x00be, 1},
- {0x0660, 0x0669, 1},
- {0x06f0, 0x06f9, 1},
- {0x07c0, 0x07c9, 1},
- {0x0966, 0x096f, 1},
- {0x09e6, 0x09ef, 1},
- {0x09f4, 0x09f9, 1},
- {0x0a66, 0x0a6f, 1},
- {0x0ae6, 0x0aef, 1},
- {0x0b66, 0x0b6f, 1},
- {0x0b72, 0x0b77, 1},
- {0x0be6, 0x0bf2, 1},
- {0x0c66, 0x0c6f, 1},
- {0x0c78, 0x0c7e, 1},
- {0x0ce6, 0x0cef, 1},
- {0x0d66, 0x0d75, 1},
- {0x0e50, 0x0e59, 1},
- {0x0ed0, 0x0ed9, 1},
- {0x0f20, 0x0f33, 1},
- {0x1040, 0x1049, 1},
- {0x1090, 0x1099, 1},
- {0x1369, 0x137c, 1},
- {0x16ee, 0x16f0, 1},
- {0x17e0, 0x17e9, 1},
- {0x17f0, 0x17f9, 1},
- {0x1810, 0x1819, 1},
- {0x1946, 0x194f, 1},
- {0x19d0, 0x19da, 1},
- {0x1a80, 0x1a89, 1},
- {0x1a90, 0x1a99, 1},
- {0x1b50, 0x1b59, 1},
- {0x1bb0, 0x1bb9, 1},
- {0x1c40, 0x1c49, 1},
- {0x1c50, 0x1c59, 1},
- {0x2070, 0x2074, 4},
- {0x2075, 0x2079, 1},
- {0x2080, 0x2089, 1},
- {0x2150, 0x2182, 1},
- {0x2185, 0x2189, 1},
- {0x2460, 0x249b, 1},
- {0x24ea, 0x24ff, 1},
- {0x2776, 0x2793, 1},
- {0x2cfd, 0x3007, 778},
- {0x3021, 0x3029, 1},
- {0x3038, 0x303a, 1},
- {0x3192, 0x3195, 1},
- {0x3220, 0x3229, 1},
- {0x3251, 0x325f, 1},
- {0x3280, 0x3289, 1},
- {0x32b1, 0x32bf, 1},
- {0xa620, 0xa629, 1},
- {0xa6e6, 0xa6ef, 1},
- {0xa830, 0xa835, 1},
- {0xa8d0, 0xa8d9, 1},
- {0xa900, 0xa909, 1},
- {0xa9d0, 0xa9d9, 1},
- {0xaa50, 0xaa59, 1},
- {0xabf0, 0xabf9, 1},
- {0xff10, 0xff19, 1},
+ {0x0061, 0x007a, 1},
+ {0x00aa, 0x00b5, 11},
+ {0x00ba, 0x00df, 37},
+ {0x00e0, 0x00f6, 1},
+ {0x00f8, 0x00ff, 1},
+ {0x0101, 0x0137, 2},
+ {0x0138, 0x0148, 2},
+ {0x0149, 0x0177, 2},
+ {0x017a, 0x017e, 2},
+ {0x017f, 0x0180, 1},
+ {0x0183, 0x0185, 2},
+ {0x0188, 0x018c, 4},
+ {0x018d, 0x0192, 5},
+ {0x0195, 0x0199, 4},
+ {0x019a, 0x019b, 1},
+ {0x019e, 0x01a1, 3},
+ {0x01a3, 0x01a5, 2},
+ {0x01a8, 0x01aa, 2},
+ {0x01ab, 0x01ad, 2},
+ {0x01b0, 0x01b4, 4},
+ {0x01b6, 0x01b9, 3},
+ {0x01ba, 0x01bd, 3},
+ {0x01be, 0x01bf, 1},
+ {0x01c6, 0x01cc, 3},
+ {0x01ce, 0x01dc, 2},
+ {0x01dd, 0x01ef, 2},
+ {0x01f0, 0x01f3, 3},
+ {0x01f5, 0x01f9, 4},
+ {0x01fb, 0x0233, 2},
+ {0x0234, 0x0239, 1},
+ {0x023c, 0x023f, 3},
+ {0x0240, 0x0242, 2},
+ {0x0247, 0x024f, 2},
+ {0x0250, 0x0293, 1},
+ {0x0295, 0x02af, 1},
+ {0x0371, 0x0373, 2},
+ {0x0377, 0x037b, 4},
+ {0x037c, 0x037d, 1},
+ {0x0390, 0x03ac, 28},
+ {0x03ad, 0x03ce, 1},
+ {0x03d0, 0x03d1, 1},
+ {0x03d5, 0x03d7, 1},
+ {0x03d9, 0x03ef, 2},
+ {0x03f0, 0x03f3, 1},
+ {0x03f5, 0x03fb, 3},
+ {0x03fc, 0x0430, 52},
+ {0x0431, 0x045f, 1},
+ {0x0461, 0x0481, 2},
+ {0x048b, 0x04bf, 2},
+ {0x04c2, 0x04ce, 2},
+ {0x04cf, 0x0527, 2},
+ {0x0561, 0x0587, 1},
+ {0x1d00, 0x1d2b, 1},
+ {0x1d62, 0x1d77, 1},
+ {0x1d79, 0x1d9a, 1},
+ {0x1e01, 0x1e95, 2},
+ {0x1e96, 0x1e9d, 1},
+ {0x1e9f, 0x1eff, 2},
+ {0x1f00, 0x1f07, 1},
+ {0x1f10, 0x1f15, 1},
+ {0x1f20, 0x1f27, 1},
+ {0x1f30, 0x1f37, 1},
+ {0x1f40, 0x1f45, 1},
+ {0x1f50, 0x1f57, 1},
+ {0x1f60, 0x1f67, 1},
+ {0x1f70, 0x1f7d, 1},
+ {0x1f80, 0x1f87, 1},
+ {0x1f90, 0x1f97, 1},
+ {0x1fa0, 0x1fa7, 1},
+ {0x1fb0, 0x1fb4, 1},
+ {0x1fb6, 0x1fb7, 1},
+ {0x1fbe, 0x1fc2, 4},
+ {0x1fc3, 0x1fc4, 1},
+ {0x1fc6, 0x1fc7, 1},
+ {0x1fd0, 0x1fd3, 1},
+ {0x1fd6, 0x1fd7, 1},
+ {0x1fe0, 0x1fe7, 1},
+ {0x1ff2, 0x1ff4, 1},
+ {0x1ff6, 0x1ff7, 1},
+ {0x210a, 0x210e, 4},
+ {0x210f, 0x2113, 4},
+ {0x212f, 0x2139, 5},
+ {0x213c, 0x213d, 1},
+ {0x2146, 0x2149, 1},
+ {0x214e, 0x2184, 54},
+ {0x2c30, 0x2c5e, 1},
+ {0x2c61, 0x2c65, 4},
+ {0x2c66, 0x2c6c, 2},
+ {0x2c71, 0x2c73, 2},
+ {0x2c74, 0x2c76, 2},
+ {0x2c77, 0x2c7c, 1},
+ {0x2c81, 0x2ce3, 2},
+ {0x2ce4, 0x2cec, 8},
+ {0x2cee, 0x2d00, 18},
+ {0x2d01, 0x2d25, 1},
+ {0xa641, 0xa66d, 2},
+ {0xa681, 0xa697, 2},
+ {0xa723, 0xa72f, 2},
+ {0xa730, 0xa731, 1},
+ {0xa733, 0xa771, 2},
+ {0xa772, 0xa778, 1},
+ {0xa77a, 0xa77c, 2},
+ {0xa77f, 0xa787, 2},
+ {0xa78c, 0xa78e, 2},
+ {0xa791, 0xa7a1, 16},
+ {0xa7a3, 0xa7a9, 2},
+ {0xa7fa, 0xfb00, 21254},
+ {0xfb01, 0xfb06, 1},
+ {0xfb13, 0xfb17, 1},
+ {0xff41, 0xff5a, 1},
},
R32: []Range32{
- {0x10107, 0x10133, 1},
- {0x10140, 0x10178, 1},
- {0x1018a, 0x10320, 406},
- {0x10321, 0x10323, 1},
- {0x10341, 0x1034a, 9},
- {0x103d1, 0x103d5, 1},
- {0x104a0, 0x104a9, 1},
- {0x10858, 0x1085f, 1},
- {0x10916, 0x1091b, 1},
- {0x10a40, 0x10a47, 1},
- {0x10a7d, 0x10a7e, 1},
- {0x10b58, 0x10b5f, 1},
- {0x10b78, 0x10b7f, 1},
- {0x10e60, 0x10e7e, 1},
- {0x11052, 0x1106f, 1},
- {0x12400, 0x12462, 1},
- {0x1d360, 0x1d371, 1},
- {0x1d7ce, 0x1d7ff, 1},
- {0x1f100, 0x1f10a, 1},
+ {0x10428, 0x1044f, 1},
+ {0x1d41a, 0x1d433, 1},
+ {0x1d44e, 0x1d454, 1},
+ {0x1d456, 0x1d467, 1},
+ {0x1d482, 0x1d49b, 1},
+ {0x1d4b6, 0x1d4b9, 1},
+ {0x1d4bb, 0x1d4bd, 2},
+ {0x1d4be, 0x1d4c3, 1},
+ {0x1d4c5, 0x1d4cf, 1},
+ {0x1d4ea, 0x1d503, 1},
+ {0x1d51e, 0x1d537, 1},
+ {0x1d552, 0x1d56b, 1},
+ {0x1d586, 0x1d59f, 1},
+ {0x1d5ba, 0x1d5d3, 1},
+ {0x1d5ee, 0x1d607, 1},
+ {0x1d622, 0x1d63b, 1},
+ {0x1d656, 0x1d66f, 1},
+ {0x1d68a, 0x1d6a5, 1},
+ {0x1d6c2, 0x1d6da, 1},
+ {0x1d6dc, 0x1d6e1, 1},
+ {0x1d6fc, 0x1d714, 1},
+ {0x1d716, 0x1d71b, 1},
+ {0x1d736, 0x1d74e, 1},
+ {0x1d750, 0x1d755, 1},
+ {0x1d770, 0x1d788, 1},
+ {0x1d78a, 0x1d78f, 1},
+ {0x1d7aa, 0x1d7c2, 1},
+ {0x1d7c4, 0x1d7c9, 1},
+ {0x1d7cb, 0x1d7cb, 1},
},
}
-var _P = &RangeTable{
+var _Lm = &RangeTable{
R16: []Range16{
- {0x0021, 0x0023, 1},
- {0x0025, 0x002a, 1},
- {0x002c, 0x002f, 1},
- {0x003a, 0x003b, 1},
- {0x003f, 0x0040, 1},
- {0x005b, 0x005d, 1},
- {0x005f, 0x007b, 28},
- {0x007d, 0x00a1, 36},
- {0x00ab, 0x00b7, 12},
- {0x00bb, 0x00bf, 4},
- {0x037e, 0x0387, 9},
- {0x055a, 0x055f, 1},
- {0x0589, 0x058a, 1},
- {0x05be, 0x05c0, 2},
- {0x05c3, 0x05c6, 3},
- {0x05f3, 0x05f4, 1},
- {0x0609, 0x060a, 1},
- {0x060c, 0x060d, 1},
- {0x061b, 0x061e, 3},
- {0x061f, 0x066a, 75},
- {0x066b, 0x066d, 1},
- {0x06d4, 0x0700, 44},
- {0x0701, 0x070d, 1},
- {0x07f7, 0x07f9, 1},
- {0x0830, 0x083e, 1},
- {0x085e, 0x0964, 262},
- {0x0965, 0x0970, 11},
- {0x0df4, 0x0e4f, 91},
- {0x0e5a, 0x0e5b, 1},
- {0x0f04, 0x0f12, 1},
- {0x0f3a, 0x0f3d, 1},
- {0x0f85, 0x0fd0, 75},
- {0x0fd1, 0x0fd4, 1},
- {0x0fd9, 0x0fda, 1},
- {0x104a, 0x104f, 1},
- {0x10fb, 0x1361, 614},
- {0x1362, 0x1368, 1},
- {0x1400, 0x166d, 621},
- {0x166e, 0x169b, 45},
- {0x169c, 0x16eb, 79},
- {0x16ec, 0x16ed, 1},
- {0x1735, 0x1736, 1},
- {0x17d4, 0x17d6, 1},
- {0x17d8, 0x17da, 1},
- {0x1800, 0x180a, 1},
- {0x1944, 0x1945, 1},
- {0x1a1e, 0x1a1f, 1},
- {0x1aa0, 0x1aa6, 1},
- {0x1aa8, 0x1aad, 1},
- {0x1b5a, 0x1b60, 1},
- {0x1bfc, 0x1bff, 1},
- {0x1c3b, 0x1c3f, 1},
- {0x1c7e, 0x1c7f, 1},
- {0x1cd3, 0x2010, 829},
- {0x2011, 0x2027, 1},
- {0x2030, 0x2043, 1},
- {0x2045, 0x2051, 1},
- {0x2053, 0x205e, 1},
- {0x207d, 0x207e, 1},
- {0x208d, 0x208e, 1},
- {0x2329, 0x232a, 1},
- {0x2768, 0x2775, 1},
- {0x27c5, 0x27c6, 1},
- {0x27e6, 0x27ef, 1},
- {0x2983, 0x2998, 1},
- {0x29d8, 0x29db, 1},
- {0x29fc, 0x29fd, 1},
- {0x2cf9, 0x2cfc, 1},
- {0x2cfe, 0x2cff, 1},
- {0x2d70, 0x2e00, 144},
- {0x2e01, 0x2e2e, 1},
- {0x2e30, 0x2e31, 1},
- {0x3001, 0x3003, 1},
- {0x3008, 0x3011, 1},
- {0x3014, 0x301f, 1},
- {0x3030, 0x303d, 13},
- {0x30a0, 0x30fb, 91},
- {0xa4fe, 0xa4ff, 1},
- {0xa60d, 0xa60f, 1},
- {0xa673, 0xa67e, 11},
- {0xa6f2, 0xa6f7, 1},
- {0xa874, 0xa877, 1},
- {0xa8ce, 0xa8cf, 1},
- {0xa8f8, 0xa8fa, 1},
- {0xa92e, 0xa92f, 1},
- {0xa95f, 0xa9c1, 98},
- {0xa9c2, 0xa9cd, 1},
- {0xa9de, 0xa9df, 1},
- {0xaa5c, 0xaa5f, 1},
- {0xaade, 0xaadf, 1},
- {0xabeb, 0xfd3e, 20819},
- {0xfd3f, 0xfe10, 209},
- {0xfe11, 0xfe19, 1},
- {0xfe30, 0xfe52, 1},
- {0xfe54, 0xfe61, 1},
- {0xfe63, 0xfe68, 5},
- {0xfe6a, 0xfe6b, 1},
- {0xff01, 0xff03, 1},
- {0xff05, 0xff0a, 1},
- {0xff0c, 0xff0f, 1},
- {0xff1a, 0xff1b, 1},
- {0xff1f, 0xff20, 1},
- {0xff3b, 0xff3d, 1},
- {0xff3f, 0xff5b, 28},
- {0xff5d, 0xff5f, 2},
- {0xff60, 0xff65, 1},
- },
- R32: []Range32{
- {0x10100, 0x10101, 1},
- {0x1039f, 0x103d0, 49},
- {0x10857, 0x1091f, 200},
- {0x1093f, 0x10a50, 273},
- {0x10a51, 0x10a58, 1},
- {0x10a7f, 0x10b39, 186},
- {0x10b3a, 0x10b3f, 1},
- {0x11047, 0x1104d, 1},
- {0x110bb, 0x110bc, 1},
- {0x110be, 0x110c1, 1},
- {0x12470, 0x12473, 1},
+ {0x02b0, 0x02c1, 1},
+ {0x02c6, 0x02d1, 1},
+ {0x02e0, 0x02e4, 1},
+ {0x02ec, 0x02ee, 2},
+ {0x0374, 0x037a, 6},
+ {0x0559, 0x0640, 231},
+ {0x06e5, 0x06e6, 1},
+ {0x07f4, 0x07f5, 1},
+ {0x07fa, 0x081a, 32},
+ {0x0824, 0x0828, 4},
+ {0x0971, 0x0e46, 1237},
+ {0x0ec6, 0x10fc, 566},
+ {0x17d7, 0x1843, 108},
+ {0x1aa7, 0x1c78, 465},
+ {0x1c79, 0x1c7d, 1},
+ {0x1d2c, 0x1d61, 1},
+ {0x1d78, 0x1d9b, 35},
+ {0x1d9c, 0x1dbf, 1},
+ {0x2071, 0x207f, 14},
+ {0x2090, 0x209c, 1},
+ {0x2c7d, 0x2d6f, 242},
+ {0x2e2f, 0x3005, 470},
+ {0x3031, 0x3035, 1},
+ {0x303b, 0x309d, 98},
+ {0x309e, 0x30fc, 94},
+ {0x30fd, 0x30fe, 1},
+ {0xa015, 0xa4f8, 1251},
+ {0xa4f9, 0xa4fd, 1},
+ {0xa60c, 0xa67f, 115},
+ {0xa717, 0xa71f, 1},
+ {0xa770, 0xa788, 24},
+ {0xa9cf, 0xaa70, 161},
+ {0xaadd, 0xff70, 21651},
+ {0xff9e, 0xff9f, 1},
},
}
-var _S = &RangeTable{
+var _Lo = &RangeTable{
R16: []Range16{
- {0x0024, 0x002b, 7},
- {0x003c, 0x003e, 1},
- {0x005e, 0x0060, 2},
- {0x007c, 0x007e, 2},
- {0x00a2, 0x00a9, 1},
- {0x00ac, 0x00ae, 2},
- {0x00af, 0x00b1, 1},
- {0x00b4, 0x00b8, 2},
- {0x00d7, 0x00f7, 32},
- {0x02c2, 0x02c5, 1},
- {0x02d2, 0x02df, 1},
- {0x02e5, 0x02eb, 1},
- {0x02ed, 0x02ef, 2},
- {0x02f0, 0x02ff, 1},
- {0x0375, 0x0384, 15},
- {0x0385, 0x03f6, 113},
- {0x0482, 0x0606, 388},
- {0x0607, 0x0608, 1},
- {0x060b, 0x060e, 3},
- {0x060f, 0x06de, 207},
- {0x06e9, 0x06fd, 20},
- {0x06fe, 0x07f6, 248},
- {0x09f2, 0x09f3, 1},
- {0x09fa, 0x09fb, 1},
- {0x0af1, 0x0b70, 127},
- {0x0bf3, 0x0bfa, 1},
- {0x0c7f, 0x0d79, 250},
- {0x0e3f, 0x0f01, 194},
- {0x0f02, 0x0f03, 1},
- {0x0f13, 0x0f17, 1},
- {0x0f1a, 0x0f1f, 1},
- {0x0f34, 0x0f38, 2},
- {0x0fbe, 0x0fc5, 1},
- {0x0fc7, 0x0fcc, 1},
- {0x0fce, 0x0fcf, 1},
- {0x0fd5, 0x0fd8, 1},
- {0x109e, 0x109f, 1},
- {0x1360, 0x1390, 48},
- {0x1391, 0x1399, 1},
- {0x17db, 0x1940, 357},
- {0x19de, 0x19ff, 1},
- {0x1b61, 0x1b6a, 1},
- {0x1b74, 0x1b7c, 1},
- {0x1fbd, 0x1fbf, 2},
- {0x1fc0, 0x1fc1, 1},
- {0x1fcd, 0x1fcf, 1},
- {0x1fdd, 0x1fdf, 1},
- {0x1fed, 0x1fef, 1},
- {0x1ffd, 0x1ffe, 1},
- {0x2044, 0x2052, 14},
- {0x207a, 0x207c, 1},
- {0x208a, 0x208c, 1},
- {0x20a0, 0x20b9, 1},
- {0x2100, 0x2101, 1},
- {0x2103, 0x2106, 1},
- {0x2108, 0x2109, 1},
- {0x2114, 0x2116, 2},
- {0x2117, 0x2118, 1},
- {0x211e, 0x2123, 1},
- {0x2125, 0x2129, 2},
- {0x212e, 0x213a, 12},
- {0x213b, 0x2140, 5},
- {0x2141, 0x2144, 1},
- {0x214a, 0x214d, 1},
- {0x214f, 0x2190, 65},
- {0x2191, 0x2328, 1},
- {0x232b, 0x23f3, 1},
- {0x2400, 0x2426, 1},
- {0x2440, 0x244a, 1},
- {0x249c, 0x24e9, 1},
- {0x2500, 0x26ff, 1},
- {0x2701, 0x2767, 1},
- {0x2794, 0x27c4, 1},
- {0x27c7, 0x27ca, 1},
- {0x27cc, 0x27ce, 2},
- {0x27cf, 0x27e5, 1},
- {0x27f0, 0x2982, 1},
- {0x2999, 0x29d7, 1},
- {0x29dc, 0x29fb, 1},
- {0x29fe, 0x2b4c, 1},
- {0x2b50, 0x2b59, 1},
- {0x2ce5, 0x2cea, 1},
- {0x2e80, 0x2e99, 1},
- {0x2e9b, 0x2ef3, 1},
- {0x2f00, 0x2fd5, 1},
- {0x2ff0, 0x2ffb, 1},
- {0x3004, 0x3012, 14},
- {0x3013, 0x3020, 13},
- {0x3036, 0x3037, 1},
- {0x303e, 0x303f, 1},
- {0x309b, 0x309c, 1},
- {0x3190, 0x3191, 1},
- {0x3196, 0x319f, 1},
- {0x31c0, 0x31e3, 1},
- {0x3200, 0x321e, 1},
- {0x322a, 0x3250, 1},
- {0x3260, 0x327f, 1},
- {0x328a, 0x32b0, 1},
- {0x32c0, 0x32fe, 1},
- {0x3300, 0x33ff, 1},
- {0x4dc0, 0x4dff, 1},
- {0xa490, 0xa4c6, 1},
- {0xa700, 0xa716, 1},
- {0xa720, 0xa721, 1},
- {0xa789, 0xa78a, 1},
- {0xa828, 0xa82b, 1},
- {0xa836, 0xa839, 1},
- {0xaa77, 0xaa79, 1},
- {0xfb29, 0xfbb2, 137},
- {0xfbb3, 0xfbc1, 1},
- {0xfdfc, 0xfdfd, 1},
- {0xfe62, 0xfe64, 2},
- {0xfe65, 0xfe66, 1},
- {0xfe69, 0xff04, 155},
- {0xff0b, 0xff1c, 17},
- {0xff1d, 0xff1e, 1},
- {0xff3e, 0xff40, 2},
- {0xff5c, 0xff5e, 2},
- {0xffe0, 0xffe6, 1},
- {0xffe8, 0xffee, 1},
- {0xfffc, 0xfffd, 1},
+ {0x01bb, 0x01c0, 5},
+ {0x01c1, 0x01c3, 1},
+ {0x0294, 0x05d0, 828},
+ {0x05d1, 0x05ea, 1},
+ {0x05f0, 0x05f2, 1},
+ {0x0620, 0x063f, 1},
+ {0x0641, 0x064a, 1},
+ {0x066e, 0x066f, 1},
+ {0x0671, 0x06d3, 1},
+ {0x06d5, 0x06ee, 25},
+ {0x06ef, 0x06fa, 11},
+ {0x06fb, 0x06fc, 1},
+ {0x06ff, 0x0710, 17},
+ {0x0712, 0x072f, 1},
+ {0x074d, 0x07a5, 1},
+ {0x07b1, 0x07ca, 25},
+ {0x07cb, 0x07ea, 1},
+ {0x0800, 0x0815, 1},
+ {0x0840, 0x0858, 1},
+ {0x0904, 0x0939, 1},
+ {0x093d, 0x0950, 19},
+ {0x0958, 0x0961, 1},
+ {0x0972, 0x0977, 1},
+ {0x0979, 0x097f, 1},
+ {0x0985, 0x098c, 1},
+ {0x098f, 0x0990, 1},
+ {0x0993, 0x09a8, 1},
+ {0x09aa, 0x09b0, 1},
+ {0x09b2, 0x09b6, 4},
+ {0x09b7, 0x09b9, 1},
+ {0x09bd, 0x09ce, 17},
+ {0x09dc, 0x09dd, 1},
+ {0x09df, 0x09e1, 1},
+ {0x09f0, 0x09f1, 1},
+ {0x0a05, 0x0a0a, 1},
+ {0x0a0f, 0x0a10, 1},
+ {0x0a13, 0x0a28, 1},
+ {0x0a2a, 0x0a30, 1},
+ {0x0a32, 0x0a33, 1},
+ {0x0a35, 0x0a36, 1},
+ {0x0a38, 0x0a39, 1},
+ {0x0a59, 0x0a5c, 1},
+ {0x0a5e, 0x0a72, 20},
+ {0x0a73, 0x0a74, 1},
+ {0x0a85, 0x0a8d, 1},
+ {0x0a8f, 0x0a91, 1},
+ {0x0a93, 0x0aa8, 1},
+ {0x0aaa, 0x0ab0, 1},
+ {0x0ab2, 0x0ab3, 1},
+ {0x0ab5, 0x0ab9, 1},
+ {0x0abd, 0x0ad0, 19},
+ {0x0ae0, 0x0ae1, 1},
+ {0x0b05, 0x0b0c, 1},
+ {0x0b0f, 0x0b10, 1},
+ {0x0b13, 0x0b28, 1},
+ {0x0b2a, 0x0b30, 1},
+ {0x0b32, 0x0b33, 1},
+ {0x0b35, 0x0b39, 1},
+ {0x0b3d, 0x0b5c, 31},
+ {0x0b5d, 0x0b5f, 2},
+ {0x0b60, 0x0b61, 1},
+ {0x0b71, 0x0b83, 18},
+ {0x0b85, 0x0b8a, 1},
+ {0x0b8e, 0x0b90, 1},
+ {0x0b92, 0x0b95, 1},
+ {0x0b99, 0x0b9a, 1},
+ {0x0b9c, 0x0b9e, 2},
+ {0x0b9f, 0x0ba3, 4},
+ {0x0ba4, 0x0ba8, 4},
+ {0x0ba9, 0x0baa, 1},
+ {0x0bae, 0x0bb9, 1},
+ {0x0bd0, 0x0c05, 53},
+ {0x0c06, 0x0c0c, 1},
+ {0x0c0e, 0x0c10, 1},
+ {0x0c12, 0x0c28, 1},
+ {0x0c2a, 0x0c33, 1},
+ {0x0c35, 0x0c39, 1},
+ {0x0c3d, 0x0c58, 27},
+ {0x0c59, 0x0c60, 7},
+ {0x0c61, 0x0c85, 36},
+ {0x0c86, 0x0c8c, 1},
+ {0x0c8e, 0x0c90, 1},
+ {0x0c92, 0x0ca8, 1},
+ {0x0caa, 0x0cb3, 1},
+ {0x0cb5, 0x0cb9, 1},
+ {0x0cbd, 0x0cde, 33},
+ {0x0ce0, 0x0ce1, 1},
+ {0x0cf1, 0x0cf2, 1},
+ {0x0d05, 0x0d0c, 1},
+ {0x0d0e, 0x0d10, 1},
+ {0x0d12, 0x0d3a, 1},
+ {0x0d3d, 0x0d4e, 17},
+ {0x0d60, 0x0d61, 1},
+ {0x0d7a, 0x0d7f, 1},
+ {0x0d85, 0x0d96, 1},
+ {0x0d9a, 0x0db1, 1},
+ {0x0db3, 0x0dbb, 1},
+ {0x0dbd, 0x0dc0, 3},
+ {0x0dc1, 0x0dc6, 1},
+ {0x0e01, 0x0e30, 1},
+ {0x0e32, 0x0e33, 1},
+ {0x0e40, 0x0e45, 1},
+ {0x0e81, 0x0e82, 1},
+ {0x0e84, 0x0e87, 3},
+ {0x0e88, 0x0e8a, 2},
+ {0x0e8d, 0x0e94, 7},
+ {0x0e95, 0x0e97, 1},
+ {0x0e99, 0x0e9f, 1},
+ {0x0ea1, 0x0ea3, 1},
+ {0x0ea5, 0x0ea7, 2},
+ {0x0eaa, 0x0eab, 1},
+ {0x0ead, 0x0eb0, 1},
+ {0x0eb2, 0x0eb3, 1},
+ {0x0ebd, 0x0ec0, 3},
+ {0x0ec1, 0x0ec4, 1},
+ {0x0edc, 0x0edd, 1},
+ {0x0f00, 0x0f40, 64},
+ {0x0f41, 0x0f47, 1},
+ {0x0f49, 0x0f6c, 1},
+ {0x0f88, 0x0f8c, 1},
+ {0x1000, 0x102a, 1},
+ {0x103f, 0x1050, 17},
+ {0x1051, 0x1055, 1},
+ {0x105a, 0x105d, 1},
+ {0x1061, 0x1065, 4},
+ {0x1066, 0x106e, 8},
+ {0x106f, 0x1070, 1},
+ {0x1075, 0x1081, 1},
+ {0x108e, 0x10d0, 66},
+ {0x10d1, 0x10fa, 1},
+ {0x1100, 0x1248, 1},
+ {0x124a, 0x124d, 1},
+ {0x1250, 0x1256, 1},
+ {0x1258, 0x125a, 2},
+ {0x125b, 0x125d, 1},
+ {0x1260, 0x1288, 1},
+ {0x128a, 0x128d, 1},
+ {0x1290, 0x12b0, 1},
+ {0x12b2, 0x12b5, 1},
+ {0x12b8, 0x12be, 1},
+ {0x12c0, 0x12c2, 2},
+ {0x12c3, 0x12c5, 1},
+ {0x12c8, 0x12d6, 1},
+ {0x12d8, 0x1310, 1},
+ {0x1312, 0x1315, 1},
+ {0x1318, 0x135a, 1},
+ {0x1380, 0x138f, 1},
+ {0x13a0, 0x13f4, 1},
+ {0x1401, 0x166c, 1},
+ {0x166f, 0x167f, 1},
+ {0x1681, 0x169a, 1},
+ {0x16a0, 0x16ea, 1},
+ {0x1700, 0x170c, 1},
+ {0x170e, 0x1711, 1},
+ {0x1720, 0x1731, 1},
+ {0x1740, 0x1751, 1},
+ {0x1760, 0x176c, 1},
+ {0x176e, 0x1770, 1},
+ {0x1780, 0x17b3, 1},
+ {0x17dc, 0x1820, 68},
+ {0x1821, 0x1842, 1},
+ {0x1844, 0x1877, 1},
+ {0x1880, 0x18a8, 1},
+ {0x18aa, 0x18b0, 6},
+ {0x18b1, 0x18f5, 1},
+ {0x1900, 0x191c, 1},
+ {0x1950, 0x196d, 1},
+ {0x1970, 0x1974, 1},
+ {0x1980, 0x19ab, 1},
+ {0x19c1, 0x19c7, 1},
+ {0x1a00, 0x1a16, 1},
+ {0x1a20, 0x1a54, 1},
+ {0x1b05, 0x1b33, 1},
+ {0x1b45, 0x1b4b, 1},
+ {0x1b83, 0x1ba0, 1},
+ {0x1bae, 0x1baf, 1},
+ {0x1bc0, 0x1be5, 1},
+ {0x1c00, 0x1c23, 1},
+ {0x1c4d, 0x1c4f, 1},
+ {0x1c5a, 0x1c77, 1},
+ {0x1ce9, 0x1cec, 1},
+ {0x1cee, 0x1cf1, 1},
+ {0x2135, 0x2138, 1},
+ {0x2d30, 0x2d65, 1},
+ {0x2d80, 0x2d96, 1},
+ {0x2da0, 0x2da6, 1},
+ {0x2da8, 0x2dae, 1},
+ {0x2db0, 0x2db6, 1},
+ {0x2db8, 0x2dbe, 1},
+ {0x2dc0, 0x2dc6, 1},
+ {0x2dc8, 0x2dce, 1},
+ {0x2dd0, 0x2dd6, 1},
+ {0x2dd8, 0x2dde, 1},
+ {0x3006, 0x303c, 54},
+ {0x3041, 0x3096, 1},
+ {0x309f, 0x30a1, 2},
+ {0x30a2, 0x30fa, 1},
+ {0x30ff, 0x3105, 6},
+ {0x3106, 0x312d, 1},
+ {0x3131, 0x318e, 1},
+ {0x31a0, 0x31ba, 1},
+ {0x31f0, 0x31ff, 1},
+ {0x3400, 0x4db5, 1},
+ {0x4e00, 0x9fcb, 1},
+ {0xa000, 0xa014, 1},
+ {0xa016, 0xa48c, 1},
+ {0xa4d0, 0xa4f7, 1},
+ {0xa500, 0xa60b, 1},
+ {0xa610, 0xa61f, 1},
+ {0xa62a, 0xa62b, 1},
+ {0xa66e, 0xa6a0, 50},
+ {0xa6a1, 0xa6e5, 1},
+ {0xa7fb, 0xa801, 1},
+ {0xa803, 0xa805, 1},
+ {0xa807, 0xa80a, 1},
+ {0xa80c, 0xa822, 1},
+ {0xa840, 0xa873, 1},
+ {0xa882, 0xa8b3, 1},
+ {0xa8f2, 0xa8f7, 1},
+ {0xa8fb, 0xa90a, 15},
+ {0xa90b, 0xa925, 1},
+ {0xa930, 0xa946, 1},
+ {0xa960, 0xa97c, 1},
+ {0xa984, 0xa9b2, 1},
+ {0xaa00, 0xaa28, 1},
+ {0xaa40, 0xaa42, 1},
+ {0xaa44, 0xaa4b, 1},
+ {0xaa60, 0xaa6f, 1},
+ {0xaa71, 0xaa76, 1},
+ {0xaa7a, 0xaa80, 6},
+ {0xaa81, 0xaaaf, 1},
+ {0xaab1, 0xaab5, 4},
+ {0xaab6, 0xaab9, 3},
+ {0xaaba, 0xaabd, 1},
+ {0xaac0, 0xaac2, 2},
+ {0xaadb, 0xaadc, 1},
+ {0xab01, 0xab06, 1},
+ {0xab09, 0xab0e, 1},
+ {0xab11, 0xab16, 1},
+ {0xab20, 0xab26, 1},
+ {0xab28, 0xab2e, 1},
+ {0xabc0, 0xabe2, 1},
+ {0xac00, 0xd7a3, 1},
+ {0xd7b0, 0xd7c6, 1},
+ {0xd7cb, 0xd7fb, 1},
+ {0xf900, 0xfa2d, 1},
+ {0xfa30, 0xfa6d, 1},
+ {0xfa70, 0xfad9, 1},
+ {0xfb1d, 0xfb1f, 2},
+ {0xfb20, 0xfb28, 1},
+ {0xfb2a, 0xfb36, 1},
+ {0xfb38, 0xfb3c, 1},
+ {0xfb3e, 0xfb40, 2},
+ {0xfb41, 0xfb43, 2},
+ {0xfb44, 0xfb46, 2},
+ {0xfb47, 0xfbb1, 1},
+ {0xfbd3, 0xfd3d, 1},
+ {0xfd50, 0xfd8f, 1},
+ {0xfd92, 0xfdc7, 1},
+ {0xfdf0, 0xfdfb, 1},
+ {0xfe70, 0xfe74, 1},
+ {0xfe76, 0xfefc, 1},
+ {0xff66, 0xff6f, 1},
+ {0xff71, 0xff9d, 1},
+ {0xffa0, 0xffbe, 1},
+ {0xffc2, 0xffc7, 1},
+ {0xffca, 0xffcf, 1},
+ {0xffd2, 0xffd7, 1},
+ {0xffda, 0xffdc, 1},
},
R32: []Range32{
- {0x10102, 0x10137, 53},
- {0x10138, 0x1013f, 1},
- {0x10179, 0x10189, 1},
- {0x10190, 0x1019b, 1},
- {0x101d0, 0x101fc, 1},
- {0x1d000, 0x1d0f5, 1},
- {0x1d100, 0x1d126, 1},
- {0x1d129, 0x1d164, 1},
- {0x1d16a, 0x1d16c, 1},
- {0x1d183, 0x1d184, 1},
- {0x1d18c, 0x1d1a9, 1},
- {0x1d1ae, 0x1d1dd, 1},
- {0x1d200, 0x1d241, 1},
- {0x1d245, 0x1d300, 187},
- {0x1d301, 0x1d356, 1},
- {0x1d6c1, 0x1d6db, 26},
- {0x1d6fb, 0x1d715, 26},
- {0x1d735, 0x1d74f, 26},
- {0x1d76f, 0x1d789, 26},
- {0x1d7a9, 0x1d7c3, 26},
- {0x1f000, 0x1f02b, 1},
- {0x1f030, 0x1f093, 1},
- {0x1f0a0, 0x1f0ae, 1},
- {0x1f0b1, 0x1f0be, 1},
- {0x1f0c1, 0x1f0cf, 1},
- {0x1f0d1, 0x1f0df, 1},
- {0x1f110, 0x1f12e, 1},
- {0x1f130, 0x1f169, 1},
- {0x1f170, 0x1f19a, 1},
- {0x1f1e6, 0x1f202, 1},
- {0x1f210, 0x1f23a, 1},
- {0x1f240, 0x1f248, 1},
- {0x1f250, 0x1f251, 1},
- {0x1f300, 0x1f320, 1},
- {0x1f330, 0x1f335, 1},
- {0x1f337, 0x1f37c, 1},
- {0x1f380, 0x1f393, 1},
- {0x1f3a0, 0x1f3c4, 1},
- {0x1f3c6, 0x1f3ca, 1},
- {0x1f3e0, 0x1f3f0, 1},
- {0x1f400, 0x1f43e, 1},
- {0x1f440, 0x1f442, 2},
- {0x1f443, 0x1f4f7, 1},
- {0x1f4f9, 0x1f4fc, 1},
- {0x1f500, 0x1f53d, 1},
- {0x1f550, 0x1f567, 1},
- {0x1f5fb, 0x1f5ff, 1},
- {0x1f601, 0x1f610, 1},
- {0x1f612, 0x1f614, 1},
- {0x1f616, 0x1f61c, 2},
- {0x1f61d, 0x1f61e, 1},
- {0x1f620, 0x1f625, 1},
- {0x1f628, 0x1f62b, 1},
- {0x1f62d, 0x1f630, 3},
- {0x1f631, 0x1f633, 1},
- {0x1f635, 0x1f640, 1},
- {0x1f645, 0x1f64f, 1},
- {0x1f680, 0x1f6c5, 1},
- {0x1f700, 0x1f773, 1},
+ {0x10000, 0x1000b, 1},
+ {0x1000d, 0x10026, 1},
+ {0x10028, 0x1003a, 1},
+ {0x1003c, 0x1003d, 1},
+ {0x1003f, 0x1004d, 1},
+ {0x10050, 0x1005d, 1},
+ {0x10080, 0x100fa, 1},
+ {0x10280, 0x1029c, 1},
+ {0x102a0, 0x102d0, 1},
+ {0x10300, 0x1031e, 1},
+ {0x10330, 0x10340, 1},
+ {0x10342, 0x10349, 1},
+ {0x10380, 0x1039d, 1},
+ {0x103a0, 0x103c3, 1},
+ {0x103c8, 0x103cf, 1},
+ {0x10450, 0x1049d, 1},
+ {0x10800, 0x10805, 1},
+ {0x10808, 0x1080a, 2},
+ {0x1080b, 0x10835, 1},
+ {0x10837, 0x10838, 1},
+ {0x1083c, 0x1083f, 3},
+ {0x10840, 0x10855, 1},
+ {0x10900, 0x10915, 1},
+ {0x10920, 0x10939, 1},
+ {0x10a00, 0x10a10, 16},
+ {0x10a11, 0x10a13, 1},
+ {0x10a15, 0x10a17, 1},
+ {0x10a19, 0x10a33, 1},
+ {0x10a60, 0x10a7c, 1},
+ {0x10b00, 0x10b35, 1},
+ {0x10b40, 0x10b55, 1},
+ {0x10b60, 0x10b72, 1},
+ {0x10c00, 0x10c48, 1},
+ {0x11003, 0x11037, 1},
+ {0x11083, 0x110af, 1},
+ {0x12000, 0x1236e, 1},
+ {0x13000, 0x1342e, 1},
+ {0x16800, 0x16a38, 1},
+ {0x1b000, 0x1b001, 1},
+ {0x20000, 0x2a6d6, 1},
+ {0x2a700, 0x2b734, 1},
+ {0x2b740, 0x2b81d, 1},
+ {0x2f800, 0x2fa1d, 1},
},
}
-var _Z = &RangeTable{
+var _Lt = &RangeTable{
R16: []Range16{
- {0x0020, 0x00a0, 128},
- {0x1680, 0x180e, 398},
- {0x2000, 0x200a, 1},
- {0x2028, 0x2029, 1},
- {0x202f, 0x205f, 48},
- {0x3000, 0x3000, 1},
+ {0x01c5, 0x01cb, 3},
+ {0x01f2, 0x1f88, 7574},
+ {0x1f89, 0x1f8f, 1},
+ {0x1f98, 0x1f9f, 1},
+ {0x1fa8, 0x1faf, 1},
+ {0x1fbc, 0x1fcc, 16},
+ {0x1ffc, 0x1ffc, 1},
},
}
-var _Me = &RangeTable{
+var _Lu = &RangeTable{
R16: []Range16{
- {0x0488, 0x0489, 1},
- {0x20dd, 0x20e0, 1},
- {0x20e2, 0x20e4, 1},
- {0xa670, 0xa672, 1},
+ {0x0041, 0x005a, 1},
+ {0x00c0, 0x00d6, 1},
+ {0x00d8, 0x00de, 1},
+ {0x0100, 0x0136, 2},
+ {0x0139, 0x0147, 2},
+ {0x014a, 0x0178, 2},
+ {0x0179, 0x017d, 2},
+ {0x0181, 0x0182, 1},
+ {0x0184, 0x0186, 2},
+ {0x0187, 0x0189, 2},
+ {0x018a, 0x018b, 1},
+ {0x018e, 0x0191, 1},
+ {0x0193, 0x0194, 1},
+ {0x0196, 0x0198, 1},
+ {0x019c, 0x019d, 1},
+ {0x019f, 0x01a0, 1},
+ {0x01a2, 0x01a6, 2},
+ {0x01a7, 0x01a9, 2},
+ {0x01ac, 0x01ae, 2},
+ {0x01af, 0x01b1, 2},
+ {0x01b2, 0x01b3, 1},
+ {0x01b5, 0x01b7, 2},
+ {0x01b8, 0x01bc, 4},
+ {0x01c4, 0x01cd, 3},
+ {0x01cf, 0x01db, 2},
+ {0x01de, 0x01ee, 2},
+ {0x01f1, 0x01f4, 3},
+ {0x01f6, 0x01f8, 1},
+ {0x01fa, 0x0232, 2},
+ {0x023a, 0x023b, 1},
+ {0x023d, 0x023e, 1},
+ {0x0241, 0x0243, 2},
+ {0x0244, 0x0246, 1},
+ {0x0248, 0x024e, 2},
+ {0x0370, 0x0372, 2},
+ {0x0376, 0x0386, 16},
+ {0x0388, 0x038a, 1},
+ {0x038c, 0x038e, 2},
+ {0x038f, 0x0391, 2},
+ {0x0392, 0x03a1, 1},
+ {0x03a3, 0x03ab, 1},
+ {0x03cf, 0x03d2, 3},
+ {0x03d3, 0x03d4, 1},
+ {0x03d8, 0x03ee, 2},
+ {0x03f4, 0x03f7, 3},
+ {0x03f9, 0x03fa, 1},
+ {0x03fd, 0x042f, 1},
+ {0x0460, 0x0480, 2},
+ {0x048a, 0x04c0, 2},
+ {0x04c1, 0x04cd, 2},
+ {0x04d0, 0x0526, 2},
+ {0x0531, 0x0556, 1},
+ {0x10a0, 0x10c5, 1},
+ {0x1e00, 0x1e94, 2},
+ {0x1e9e, 0x1efe, 2},
+ {0x1f08, 0x1f0f, 1},
+ {0x1f18, 0x1f1d, 1},
+ {0x1f28, 0x1f2f, 1},
+ {0x1f38, 0x1f3f, 1},
+ {0x1f48, 0x1f4d, 1},
+ {0x1f59, 0x1f5f, 2},
+ {0x1f68, 0x1f6f, 1},
+ {0x1fb8, 0x1fbb, 1},
+ {0x1fc8, 0x1fcb, 1},
+ {0x1fd8, 0x1fdb, 1},
+ {0x1fe8, 0x1fec, 1},
+ {0x1ff8, 0x1ffb, 1},
+ {0x2102, 0x2107, 5},
+ {0x210b, 0x210d, 1},
+ {0x2110, 0x2112, 1},
+ {0x2115, 0x2119, 4},
+ {0x211a, 0x211d, 1},
+ {0x2124, 0x212a, 2},
+ {0x212b, 0x212d, 1},
+ {0x2130, 0x2133, 1},
+ {0x213e, 0x213f, 1},
+ {0x2145, 0x2183, 62},
+ {0x2c00, 0x2c2e, 1},
+ {0x2c60, 0x2c62, 2},
+ {0x2c63, 0x2c64, 1},
+ {0x2c67, 0x2c6d, 2},
+ {0x2c6e, 0x2c70, 1},
+ {0x2c72, 0x2c75, 3},
+ {0x2c7e, 0x2c80, 1},
+ {0x2c82, 0x2ce2, 2},
+ {0x2ceb, 0x2ced, 2},
+ {0xa640, 0xa66c, 2},
+ {0xa680, 0xa696, 2},
+ {0xa722, 0xa72e, 2},
+ {0xa732, 0xa76e, 2},
+ {0xa779, 0xa77d, 2},
+ {0xa77e, 0xa786, 2},
+ {0xa78b, 0xa78d, 2},
+ {0xa790, 0xa7a0, 16},
+ {0xa7a2, 0xa7a8, 2},
+ {0xff21, 0xff3a, 1},
+ },
+ R32: []Range32{
+ {0x10400, 0x10427, 1},
+ {0x1d400, 0x1d419, 1},
+ {0x1d434, 0x1d44d, 1},
+ {0x1d468, 0x1d481, 1},
+ {0x1d49c, 0x1d49e, 2},
+ {0x1d49f, 0x1d4a5, 3},
+ {0x1d4a6, 0x1d4a9, 3},
+ {0x1d4aa, 0x1d4ac, 1},
+ {0x1d4ae, 0x1d4b5, 1},
+ {0x1d4d0, 0x1d4e9, 1},
+ {0x1d504, 0x1d505, 1},
+ {0x1d507, 0x1d50a, 1},
+ {0x1d50d, 0x1d514, 1},
+ {0x1d516, 0x1d51c, 1},
+ {0x1d538, 0x1d539, 1},
+ {0x1d53b, 0x1d53e, 1},
+ {0x1d540, 0x1d544, 1},
+ {0x1d546, 0x1d54a, 4},
+ {0x1d54b, 0x1d550, 1},
+ {0x1d56c, 0x1d585, 1},
+ {0x1d5a0, 0x1d5b9, 1},
+ {0x1d5d4, 0x1d5ed, 1},
+ {0x1d608, 0x1d621, 1},
+ {0x1d63c, 0x1d655, 1},
+ {0x1d670, 0x1d689, 1},
+ {0x1d6a8, 0x1d6c0, 1},
+ {0x1d6e2, 0x1d6fa, 1},
+ {0x1d71c, 0x1d734, 1},
+ {0x1d756, 0x1d76e, 1},
+ {0x1d790, 0x1d7a8, 1},
+ {0x1d7ca, 0x1d7ca, 1},
+ },
+}
+
+var _M = &RangeTable{
+ R16: []Range16{
+ {0x0300, 0x036f, 1},
+ {0x0483, 0x0489, 1},
+ {0x0591, 0x05bd, 1},
+ {0x05bf, 0x05c1, 2},
+ {0x05c2, 0x05c4, 2},
+ {0x05c5, 0x05c7, 2},
+ {0x0610, 0x061a, 1},
+ {0x064b, 0x065f, 1},
+ {0x0670, 0x06d6, 102},
+ {0x06d7, 0x06dc, 1},
+ {0x06df, 0x06e4, 1},
+ {0x06e7, 0x06e8, 1},
+ {0x06ea, 0x06ed, 1},
+ {0x0711, 0x0730, 31},
+ {0x0731, 0x074a, 1},
+ {0x07a6, 0x07b0, 1},
+ {0x07eb, 0x07f3, 1},
+ {0x0816, 0x0819, 1},
+ {0x081b, 0x0823, 1},
+ {0x0825, 0x0827, 1},
+ {0x0829, 0x082d, 1},
+ {0x0859, 0x085b, 1},
+ {0x0900, 0x0903, 1},
+ {0x093a, 0x093c, 1},
+ {0x093e, 0x094f, 1},
+ {0x0951, 0x0957, 1},
+ {0x0962, 0x0963, 1},
+ {0x0981, 0x0983, 1},
+ {0x09bc, 0x09be, 2},
+ {0x09bf, 0x09c4, 1},
+ {0x09c7, 0x09c8, 1},
+ {0x09cb, 0x09cd, 1},
+ {0x09d7, 0x09e2, 11},
+ {0x09e3, 0x0a01, 30},
+ {0x0a02, 0x0a03, 1},
+ {0x0a3c, 0x0a3e, 2},
+ {0x0a3f, 0x0a42, 1},
+ {0x0a47, 0x0a48, 1},
+ {0x0a4b, 0x0a4d, 1},
+ {0x0a51, 0x0a70, 31},
+ {0x0a71, 0x0a75, 4},
+ {0x0a81, 0x0a83, 1},
+ {0x0abc, 0x0abe, 2},
+ {0x0abf, 0x0ac5, 1},
+ {0x0ac7, 0x0ac9, 1},
+ {0x0acb, 0x0acd, 1},
+ {0x0ae2, 0x0ae3, 1},
+ {0x0b01, 0x0b03, 1},
+ {0x0b3c, 0x0b3e, 2},
+ {0x0b3f, 0x0b44, 1},
+ {0x0b47, 0x0b48, 1},
+ {0x0b4b, 0x0b4d, 1},
+ {0x0b56, 0x0b57, 1},
+ {0x0b62, 0x0b63, 1},
+ {0x0b82, 0x0bbe, 60},
+ {0x0bbf, 0x0bc2, 1},
+ {0x0bc6, 0x0bc8, 1},
+ {0x0bca, 0x0bcd, 1},
+ {0x0bd7, 0x0c01, 42},
+ {0x0c02, 0x0c03, 1},
+ {0x0c3e, 0x0c44, 1},
+ {0x0c46, 0x0c48, 1},
+ {0x0c4a, 0x0c4d, 1},
+ {0x0c55, 0x0c56, 1},
+ {0x0c62, 0x0c63, 1},
+ {0x0c82, 0x0c83, 1},
+ {0x0cbc, 0x0cbe, 2},
+ {0x0cbf, 0x0cc4, 1},
+ {0x0cc6, 0x0cc8, 1},
+ {0x0cca, 0x0ccd, 1},
+ {0x0cd5, 0x0cd6, 1},
+ {0x0ce2, 0x0ce3, 1},
+ {0x0d02, 0x0d03, 1},
+ {0x0d3e, 0x0d44, 1},
+ {0x0d46, 0x0d48, 1},
+ {0x0d4a, 0x0d4d, 1},
+ {0x0d57, 0x0d62, 11},
+ {0x0d63, 0x0d82, 31},
+ {0x0d83, 0x0dca, 71},
+ {0x0dcf, 0x0dd4, 1},
+ {0x0dd6, 0x0dd8, 2},
+ {0x0dd9, 0x0ddf, 1},
+ {0x0df2, 0x0df3, 1},
+ {0x0e31, 0x0e34, 3},
+ {0x0e35, 0x0e3a, 1},
+ {0x0e47, 0x0e4e, 1},
+ {0x0eb1, 0x0eb4, 3},
+ {0x0eb5, 0x0eb9, 1},
+ {0x0ebb, 0x0ebc, 1},
+ {0x0ec8, 0x0ecd, 1},
+ {0x0f18, 0x0f19, 1},
+ {0x0f35, 0x0f39, 2},
+ {0x0f3e, 0x0f3f, 1},
+ {0x0f71, 0x0f84, 1},
+ {0x0f86, 0x0f87, 1},
+ {0x0f8d, 0x0f97, 1},
+ {0x0f99, 0x0fbc, 1},
+ {0x0fc6, 0x102b, 101},
+ {0x102c, 0x103e, 1},
+ {0x1056, 0x1059, 1},
+ {0x105e, 0x1060, 1},
+ {0x1062, 0x1064, 1},
+ {0x1067, 0x106d, 1},
+ {0x1071, 0x1074, 1},
+ {0x1082, 0x108d, 1},
+ {0x108f, 0x109a, 11},
+ {0x109b, 0x109d, 1},
+ {0x135d, 0x135f, 1},
+ {0x1712, 0x1714, 1},
+ {0x1732, 0x1734, 1},
+ {0x1752, 0x1753, 1},
+ {0x1772, 0x1773, 1},
+ {0x17b6, 0x17d3, 1},
+ {0x17dd, 0x180b, 46},
+ {0x180c, 0x180d, 1},
+ {0x18a9, 0x1920, 119},
+ {0x1921, 0x192b, 1},
+ {0x1930, 0x193b, 1},
+ {0x19b0, 0x19c0, 1},
+ {0x19c8, 0x19c9, 1},
+ {0x1a17, 0x1a1b, 1},
+ {0x1a55, 0x1a5e, 1},
+ {0x1a60, 0x1a7c, 1},
+ {0x1a7f, 0x1b00, 129},
+ {0x1b01, 0x1b04, 1},
+ {0x1b34, 0x1b44, 1},
+ {0x1b6b, 0x1b73, 1},
+ {0x1b80, 0x1b82, 1},
+ {0x1ba1, 0x1baa, 1},
+ {0x1be6, 0x1bf3, 1},
+ {0x1c24, 0x1c37, 1},
+ {0x1cd0, 0x1cd2, 1},
+ {0x1cd4, 0x1ce8, 1},
+ {0x1ced, 0x1cf2, 5},
+ {0x1dc0, 0x1de6, 1},
+ {0x1dfc, 0x1dff, 1},
+ {0x20d0, 0x20f0, 1},
+ {0x2cef, 0x2cf1, 1},
+ {0x2d7f, 0x2de0, 97},
+ {0x2de1, 0x2dff, 1},
+ {0x302a, 0x302f, 1},
+ {0x3099, 0x309a, 1},
+ {0xa66f, 0xa672, 1},
+ {0xa67c, 0xa67d, 1},
+ {0xa6f0, 0xa6f1, 1},
+ {0xa802, 0xa806, 4},
+ {0xa80b, 0xa823, 24},
+ {0xa824, 0xa827, 1},
+ {0xa880, 0xa881, 1},
+ {0xa8b4, 0xa8c4, 1},
+ {0xa8e0, 0xa8f1, 1},
+ {0xa926, 0xa92d, 1},
+ {0xa947, 0xa953, 1},
+ {0xa980, 0xa983, 1},
+ {0xa9b3, 0xa9c0, 1},
+ {0xaa29, 0xaa36, 1},
+ {0xaa43, 0xaa4c, 9},
+ {0xaa4d, 0xaa7b, 46},
+ {0xaab0, 0xaab2, 2},
+ {0xaab3, 0xaab4, 1},
+ {0xaab7, 0xaab8, 1},
+ {0xaabe, 0xaabf, 1},
+ {0xaac1, 0xabe3, 290},
+ {0xabe4, 0xabea, 1},
+ {0xabec, 0xabed, 1},
+ {0xfb1e, 0xfe00, 738},
+ {0xfe01, 0xfe0f, 1},
+ {0xfe20, 0xfe26, 1},
+ },
+ R32: []Range32{
+ {0x101fd, 0x10a01, 2052},
+ {0x10a02, 0x10a03, 1},
+ {0x10a05, 0x10a06, 1},
+ {0x10a0c, 0x10a0f, 1},
+ {0x10a38, 0x10a3a, 1},
+ {0x10a3f, 0x11000, 1473},
+ {0x11001, 0x11002, 1},
+ {0x11038, 0x11046, 1},
+ {0x11080, 0x11082, 1},
+ {0x110b0, 0x110ba, 1},
+ {0x1d165, 0x1d169, 1},
+ {0x1d16d, 0x1d172, 1},
+ {0x1d17b, 0x1d182, 1},
+ {0x1d185, 0x1d18b, 1},
+ {0x1d1aa, 0x1d1ad, 1},
+ {0x1d242, 0x1d244, 1},
+ {0xe0100, 0xe01ef, 1},
},
}
@@ -1398,6 +1488,15 @@ var _Mc = &RangeTable{
},
}
+var _Me = &RangeTable{
+ R16: []Range16{
+ {0x0488, 0x0489, 1},
+ {0x20dd, 0x20e0, 1},
+ {0x20e2, 0x20e4, 1},
+ {0xa670, 0xa672, 1},
+ },
+}
+
var _Mn = &RangeTable{
R16: []Range16{
{0x0300, 0x036f, 1},
@@ -1584,69 +1683,396 @@ var _Mn = &RangeTable{
},
}
-var _Zl = &RangeTable{
+var _N = &RangeTable{
R16: []Range16{
- {0x2028, 0x2028, 1},
+ {0x0030, 0x0039, 1},
+ {0x00b2, 0x00b3, 1},
+ {0x00b9, 0x00bc, 3},
+ {0x00bd, 0x00be, 1},
+ {0x0660, 0x0669, 1},
+ {0x06f0, 0x06f9, 1},
+ {0x07c0, 0x07c9, 1},
+ {0x0966, 0x096f, 1},
+ {0x09e6, 0x09ef, 1},
+ {0x09f4, 0x09f9, 1},
+ {0x0a66, 0x0a6f, 1},
+ {0x0ae6, 0x0aef, 1},
+ {0x0b66, 0x0b6f, 1},
+ {0x0b72, 0x0b77, 1},
+ {0x0be6, 0x0bf2, 1},
+ {0x0c66, 0x0c6f, 1},
+ {0x0c78, 0x0c7e, 1},
+ {0x0ce6, 0x0cef, 1},
+ {0x0d66, 0x0d75, 1},
+ {0x0e50, 0x0e59, 1},
+ {0x0ed0, 0x0ed9, 1},
+ {0x0f20, 0x0f33, 1},
+ {0x1040, 0x1049, 1},
+ {0x1090, 0x1099, 1},
+ {0x1369, 0x137c, 1},
+ {0x16ee, 0x16f0, 1},
+ {0x17e0, 0x17e9, 1},
+ {0x17f0, 0x17f9, 1},
+ {0x1810, 0x1819, 1},
+ {0x1946, 0x194f, 1},
+ {0x19d0, 0x19da, 1},
+ {0x1a80, 0x1a89, 1},
+ {0x1a90, 0x1a99, 1},
+ {0x1b50, 0x1b59, 1},
+ {0x1bb0, 0x1bb9, 1},
+ {0x1c40, 0x1c49, 1},
+ {0x1c50, 0x1c59, 1},
+ {0x2070, 0x2074, 4},
+ {0x2075, 0x2079, 1},
+ {0x2080, 0x2089, 1},
+ {0x2150, 0x2182, 1},
+ {0x2185, 0x2189, 1},
+ {0x2460, 0x249b, 1},
+ {0x24ea, 0x24ff, 1},
+ {0x2776, 0x2793, 1},
+ {0x2cfd, 0x3007, 778},
+ {0x3021, 0x3029, 1},
+ {0x3038, 0x303a, 1},
+ {0x3192, 0x3195, 1},
+ {0x3220, 0x3229, 1},
+ {0x3251, 0x325f, 1},
+ {0x3280, 0x3289, 1},
+ {0x32b1, 0x32bf, 1},
+ {0xa620, 0xa629, 1},
+ {0xa6e6, 0xa6ef, 1},
+ {0xa830, 0xa835, 1},
+ {0xa8d0, 0xa8d9, 1},
+ {0xa900, 0xa909, 1},
+ {0xa9d0, 0xa9d9, 1},
+ {0xaa50, 0xaa59, 1},
+ {0xabf0, 0xabf9, 1},
+ {0xff10, 0xff19, 1},
+ },
+ R32: []Range32{
+ {0x10107, 0x10133, 1},
+ {0x10140, 0x10178, 1},
+ {0x1018a, 0x10320, 406},
+ {0x10321, 0x10323, 1},
+ {0x10341, 0x1034a, 9},
+ {0x103d1, 0x103d5, 1},
+ {0x104a0, 0x104a9, 1},
+ {0x10858, 0x1085f, 1},
+ {0x10916, 0x1091b, 1},
+ {0x10a40, 0x10a47, 1},
+ {0x10a7d, 0x10a7e, 1},
+ {0x10b58, 0x10b5f, 1},
+ {0x10b78, 0x10b7f, 1},
+ {0x10e60, 0x10e7e, 1},
+ {0x11052, 0x1106f, 1},
+ {0x12400, 0x12462, 1},
+ {0x1d360, 0x1d371, 1},
+ {0x1d7ce, 0x1d7ff, 1},
+ {0x1f100, 0x1f10a, 1},
},
}
-var _Zp = &RangeTable{
+var _Nd = &RangeTable{
R16: []Range16{
- {0x2029, 0x2029, 1},
+ {0x0030, 0x0039, 1},
+ {0x0660, 0x0669, 1},
+ {0x06f0, 0x06f9, 1},
+ {0x07c0, 0x07c9, 1},
+ {0x0966, 0x096f, 1},
+ {0x09e6, 0x09ef, 1},
+ {0x0a66, 0x0a6f, 1},
+ {0x0ae6, 0x0aef, 1},
+ {0x0b66, 0x0b6f, 1},
+ {0x0be6, 0x0bef, 1},
+ {0x0c66, 0x0c6f, 1},
+ {0x0ce6, 0x0cef, 1},
+ {0x0d66, 0x0d6f, 1},
+ {0x0e50, 0x0e59, 1},
+ {0x0ed0, 0x0ed9, 1},
+ {0x0f20, 0x0f29, 1},
+ {0x1040, 0x1049, 1},
+ {0x1090, 0x1099, 1},
+ {0x17e0, 0x17e9, 1},
+ {0x1810, 0x1819, 1},
+ {0x1946, 0x194f, 1},
+ {0x19d0, 0x19d9, 1},
+ {0x1a80, 0x1a89, 1},
+ {0x1a90, 0x1a99, 1},
+ {0x1b50, 0x1b59, 1},
+ {0x1bb0, 0x1bb9, 1},
+ {0x1c40, 0x1c49, 1},
+ {0x1c50, 0x1c59, 1},
+ {0xa620, 0xa629, 1},
+ {0xa8d0, 0xa8d9, 1},
+ {0xa900, 0xa909, 1},
+ {0xa9d0, 0xa9d9, 1},
+ {0xaa50, 0xaa59, 1},
+ {0xabf0, 0xabf9, 1},
+ {0xff10, 0xff19, 1},
+ },
+ R32: []Range32{
+ {0x104a0, 0x104a9, 1},
+ {0x11066, 0x1106f, 1},
+ {0x1d7ce, 0x1d7ff, 1},
},
}
-var _Zs = &RangeTable{
+var _Nl = &RangeTable{
R16: []Range16{
- {0x0020, 0x00a0, 128},
- {0x1680, 0x180e, 398},
- {0x2000, 0x200a, 1},
- {0x202f, 0x205f, 48},
- {0x3000, 0x3000, 1},
+ {0x16ee, 0x16f0, 1},
+ {0x2160, 0x2182, 1},
+ {0x2185, 0x2188, 1},
+ {0x3007, 0x3021, 26},
+ {0x3022, 0x3029, 1},
+ {0x3038, 0x303a, 1},
+ {0xa6e6, 0xa6ef, 1},
+ },
+ R32: []Range32{
+ {0x10140, 0x10174, 1},
+ {0x10341, 0x1034a, 9},
+ {0x103d1, 0x103d5, 1},
+ {0x12400, 0x12462, 1},
},
}
-var _Cs = &RangeTable{
+var _No = &RangeTable{
R16: []Range16{
- {0xd800, 0xdfff, 1},
+ {0x00b2, 0x00b3, 1},
+ {0x00b9, 0x00bc, 3},
+ {0x00bd, 0x00be, 1},
+ {0x09f4, 0x09f9, 1},
+ {0x0b72, 0x0b77, 1},
+ {0x0bf0, 0x0bf2, 1},
+ {0x0c78, 0x0c7e, 1},
+ {0x0d70, 0x0d75, 1},
+ {0x0f2a, 0x0f33, 1},
+ {0x1369, 0x137c, 1},
+ {0x17f0, 0x17f9, 1},
+ {0x19da, 0x2070, 1686},
+ {0x2074, 0x2079, 1},
+ {0x2080, 0x2089, 1},
+ {0x2150, 0x215f, 1},
+ {0x2189, 0x2460, 727},
+ {0x2461, 0x249b, 1},
+ {0x24ea, 0x24ff, 1},
+ {0x2776, 0x2793, 1},
+ {0x2cfd, 0x3192, 1173},
+ {0x3193, 0x3195, 1},
+ {0x3220, 0x3229, 1},
+ {0x3251, 0x325f, 1},
+ {0x3280, 0x3289, 1},
+ {0x32b1, 0x32bf, 1},
+ {0xa830, 0xa835, 1},
+ },
+ R32: []Range32{
+ {0x10107, 0x10133, 1},
+ {0x10175, 0x10178, 1},
+ {0x1018a, 0x10320, 406},
+ {0x10321, 0x10323, 1},
+ {0x10858, 0x1085f, 1},
+ {0x10916, 0x1091b, 1},
+ {0x10a40, 0x10a47, 1},
+ {0x10a7d, 0x10a7e, 1},
+ {0x10b58, 0x10b5f, 1},
+ {0x10b78, 0x10b7f, 1},
+ {0x10e60, 0x10e7e, 1},
+ {0x11052, 0x11065, 1},
+ {0x1d360, 0x1d371, 1},
+ {0x1f100, 0x1f10a, 1},
},
}
-var _Co = &RangeTable{
+var _P = &RangeTable{
R16: []Range16{
- {0xe000, 0xf8ff, 1},
+ {0x0021, 0x0023, 1},
+ {0x0025, 0x002a, 1},
+ {0x002c, 0x002f, 1},
+ {0x003a, 0x003b, 1},
+ {0x003f, 0x0040, 1},
+ {0x005b, 0x005d, 1},
+ {0x005f, 0x007b, 28},
+ {0x007d, 0x00a1, 36},
+ {0x00ab, 0x00b7, 12},
+ {0x00bb, 0x00bf, 4},
+ {0x037e, 0x0387, 9},
+ {0x055a, 0x055f, 1},
+ {0x0589, 0x058a, 1},
+ {0x05be, 0x05c0, 2},
+ {0x05c3, 0x05c6, 3},
+ {0x05f3, 0x05f4, 1},
+ {0x0609, 0x060a, 1},
+ {0x060c, 0x060d, 1},
+ {0x061b, 0x061e, 3},
+ {0x061f, 0x066a, 75},
+ {0x066b, 0x066d, 1},
+ {0x06d4, 0x0700, 44},
+ {0x0701, 0x070d, 1},
+ {0x07f7, 0x07f9, 1},
+ {0x0830, 0x083e, 1},
+ {0x085e, 0x0964, 262},
+ {0x0965, 0x0970, 11},
+ {0x0df4, 0x0e4f, 91},
+ {0x0e5a, 0x0e5b, 1},
+ {0x0f04, 0x0f12, 1},
+ {0x0f3a, 0x0f3d, 1},
+ {0x0f85, 0x0fd0, 75},
+ {0x0fd1, 0x0fd4, 1},
+ {0x0fd9, 0x0fda, 1},
+ {0x104a, 0x104f, 1},
+ {0x10fb, 0x1361, 614},
+ {0x1362, 0x1368, 1},
+ {0x1400, 0x166d, 621},
+ {0x166e, 0x169b, 45},
+ {0x169c, 0x16eb, 79},
+ {0x16ec, 0x16ed, 1},
+ {0x1735, 0x1736, 1},
+ {0x17d4, 0x17d6, 1},
+ {0x17d8, 0x17da, 1},
+ {0x1800, 0x180a, 1},
+ {0x1944, 0x1945, 1},
+ {0x1a1e, 0x1a1f, 1},
+ {0x1aa0, 0x1aa6, 1},
+ {0x1aa8, 0x1aad, 1},
+ {0x1b5a, 0x1b60, 1},
+ {0x1bfc, 0x1bff, 1},
+ {0x1c3b, 0x1c3f, 1},
+ {0x1c7e, 0x1c7f, 1},
+ {0x1cd3, 0x2010, 829},
+ {0x2011, 0x2027, 1},
+ {0x2030, 0x2043, 1},
+ {0x2045, 0x2051, 1},
+ {0x2053, 0x205e, 1},
+ {0x207d, 0x207e, 1},
+ {0x208d, 0x208e, 1},
+ {0x2329, 0x232a, 1},
+ {0x2768, 0x2775, 1},
+ {0x27c5, 0x27c6, 1},
+ {0x27e6, 0x27ef, 1},
+ {0x2983, 0x2998, 1},
+ {0x29d8, 0x29db, 1},
+ {0x29fc, 0x29fd, 1},
+ {0x2cf9, 0x2cfc, 1},
+ {0x2cfe, 0x2cff, 1},
+ {0x2d70, 0x2e00, 144},
+ {0x2e01, 0x2e2e, 1},
+ {0x2e30, 0x2e31, 1},
+ {0x3001, 0x3003, 1},
+ {0x3008, 0x3011, 1},
+ {0x3014, 0x301f, 1},
+ {0x3030, 0x303d, 13},
+ {0x30a0, 0x30fb, 91},
+ {0xa4fe, 0xa4ff, 1},
+ {0xa60d, 0xa60f, 1},
+ {0xa673, 0xa67e, 11},
+ {0xa6f2, 0xa6f7, 1},
+ {0xa874, 0xa877, 1},
+ {0xa8ce, 0xa8cf, 1},
+ {0xa8f8, 0xa8fa, 1},
+ {0xa92e, 0xa92f, 1},
+ {0xa95f, 0xa9c1, 98},
+ {0xa9c2, 0xa9cd, 1},
+ {0xa9de, 0xa9df, 1},
+ {0xaa5c, 0xaa5f, 1},
+ {0xaade, 0xaadf, 1},
+ {0xabeb, 0xfd3e, 20819},
+ {0xfd3f, 0xfe10, 209},
+ {0xfe11, 0xfe19, 1},
+ {0xfe30, 0xfe52, 1},
+ {0xfe54, 0xfe61, 1},
+ {0xfe63, 0xfe68, 5},
+ {0xfe6a, 0xfe6b, 1},
+ {0xff01, 0xff03, 1},
+ {0xff05, 0xff0a, 1},
+ {0xff0c, 0xff0f, 1},
+ {0xff1a, 0xff1b, 1},
+ {0xff1f, 0xff20, 1},
+ {0xff3b, 0xff3d, 1},
+ {0xff3f, 0xff5b, 28},
+ {0xff5d, 0xff5f, 2},
+ {0xff60, 0xff65, 1},
},
R32: []Range32{
- {0xf0000, 0xffffd, 1},
- {0x100000, 0x10fffd, 1},
+ {0x10100, 0x10101, 1},
+ {0x1039f, 0x103d0, 49},
+ {0x10857, 0x1091f, 200},
+ {0x1093f, 0x10a50, 273},
+ {0x10a51, 0x10a58, 1},
+ {0x10a7f, 0x10b39, 186},
+ {0x10b3a, 0x10b3f, 1},
+ {0x11047, 0x1104d, 1},
+ {0x110bb, 0x110bc, 1},
+ {0x110be, 0x110c1, 1},
+ {0x12470, 0x12473, 1},
},
}
-var _Cf = &RangeTable{
+var _Pc = &RangeTable{
R16: []Range16{
- {0x00ad, 0x0600, 1363},
- {0x0601, 0x0603, 1},
- {0x06dd, 0x070f, 50},
- {0x17b4, 0x17b5, 1},
- {0x200b, 0x200f, 1},
- {0x202a, 0x202e, 1},
- {0x2060, 0x2064, 1},
- {0x206a, 0x206f, 1},
- {0xfeff, 0xfff9, 250},
- {0xfffa, 0xfffb, 1},
+ {0x005f, 0x203f, 8160},
+ {0x2040, 0x2054, 20},
+ {0xfe33, 0xfe34, 1},
+ {0xfe4d, 0xfe4f, 1},
+ {0xff3f, 0xff3f, 1},
},
- R32: []Range32{
- {0x110bd, 0x1d173, 49334},
- {0x1d174, 0x1d17a, 1},
- {0xe0001, 0xe0020, 31},
- {0xe0021, 0xe007f, 1},
+}
+
+var _Pd = &RangeTable{
+ R16: []Range16{
+ {0x002d, 0x058a, 1373},
+ {0x05be, 0x1400, 3650},
+ {0x1806, 0x2010, 2058},
+ {0x2011, 0x2015, 1},
+ {0x2e17, 0x2e1a, 3},
+ {0x301c, 0x3030, 20},
+ {0x30a0, 0xfe31, 52625},
+ {0xfe32, 0xfe58, 38},
+ {0xfe63, 0xff0d, 170},
},
}
-var _Cc = &RangeTable{
+var _Pe = &RangeTable{
R16: []Range16{
- {0x0001, 0x001f, 1},
- {0x007f, 0x009f, 1},
+ {0x0029, 0x005d, 52},
+ {0x007d, 0x0f3b, 3774},
+ {0x0f3d, 0x169c, 1887},
+ {0x2046, 0x207e, 56},
+ {0x208e, 0x232a, 668},
+ {0x2769, 0x2775, 2},
+ {0x27c6, 0x27e7, 33},
+ {0x27e9, 0x27ef, 2},
+ {0x2984, 0x2998, 2},
+ {0x29d9, 0x29db, 2},
+ {0x29fd, 0x2e23, 1062},
+ {0x2e25, 0x2e29, 2},
+ {0x3009, 0x3011, 2},
+ {0x3015, 0x301b, 2},
+ {0x301e, 0x301f, 1},
+ {0xfd3f, 0xfe18, 217},
+ {0xfe36, 0xfe44, 2},
+ {0xfe48, 0xfe5a, 18},
+ {0xfe5c, 0xfe5e, 2},
+ {0xff09, 0xff3d, 52},
+ {0xff5d, 0xff63, 3},
+ },
+}
+
+var _Pf = &RangeTable{
+ R16: []Range16{
+ {0x00bb, 0x2019, 8030},
+ {0x201d, 0x203a, 29},
+ {0x2e03, 0x2e05, 2},
+ {0x2e0a, 0x2e0d, 3},
+ {0x2e1d, 0x2e21, 4},
+ },
+}
+
+var _Pi = &RangeTable{
+ R16: []Range16{
+ {0x00ab, 0x2018, 8045},
+ {0x201b, 0x201c, 1},
+ {0x201f, 0x2039, 26},
+ {0x2e02, 0x2e04, 2},
+ {0x2e09, 0x2e0c, 3},
+ {0x2e1c, 0x2e20, 4},
},
}
@@ -1770,77 +2196,6 @@ var _Po = &RangeTable{
},
}
-var _Pi = &RangeTable{
- R16: []Range16{
- {0x00ab, 0x2018, 8045},
- {0x201b, 0x201c, 1},
- {0x201f, 0x2039, 26},
- {0x2e02, 0x2e04, 2},
- {0x2e09, 0x2e0c, 3},
- {0x2e1c, 0x2e20, 4},
- },
-}
-
-var _Pf = &RangeTable{
- R16: []Range16{
- {0x00bb, 0x2019, 8030},
- {0x201d, 0x203a, 29},
- {0x2e03, 0x2e05, 2},
- {0x2e0a, 0x2e0d, 3},
- {0x2e1d, 0x2e21, 4},
- },
-}
-
-var _Pe = &RangeTable{
- R16: []Range16{
- {0x0029, 0x005d, 52},
- {0x007d, 0x0f3b, 3774},
- {0x0f3d, 0x169c, 1887},
- {0x2046, 0x207e, 56},
- {0x208e, 0x232a, 668},
- {0x2769, 0x2775, 2},
- {0x27c6, 0x27e7, 33},
- {0x27e9, 0x27ef, 2},
- {0x2984, 0x2998, 2},
- {0x29d9, 0x29db, 2},
- {0x29fd, 0x2e23, 1062},
- {0x2e25, 0x2e29, 2},
- {0x3009, 0x3011, 2},
- {0x3015, 0x301b, 2},
- {0x301e, 0x301f, 1},
- {0xfd3f, 0xfe18, 217},
- {0xfe36, 0xfe44, 2},
- {0xfe48, 0xfe5a, 18},
- {0xfe5c, 0xfe5e, 2},
- {0xff09, 0xff3d, 52},
- {0xff5d, 0xff63, 3},
- },
-}
-
-var _Pd = &RangeTable{
- R16: []Range16{
- {0x002d, 0x058a, 1373},
- {0x05be, 0x1400, 3650},
- {0x1806, 0x2010, 2058},
- {0x2011, 0x2015, 1},
- {0x2e17, 0x2e1a, 3},
- {0x301c, 0x3030, 20},
- {0x30a0, 0xfe31, 52625},
- {0xfe32, 0xfe58, 38},
- {0xfe63, 0xff0d, 170},
- },
-}
-
-var _Pc = &RangeTable{
- R16: []Range16{
- {0x005f, 0x203f, 8160},
- {0x2040, 0x2054, 20},
- {0xfe33, 0xfe34, 1},
- {0xfe4d, 0xfe4f, 1},
- {0xff3f, 0xff3f, 1},
- },
-}
-
var _Ps = &RangeTable{
R16: []Range16{
{0x0028, 0x005b, 51},
@@ -1869,113 +2224,291 @@ var _Ps = &RangeTable{
},
}
-var _Nd = &RangeTable{
+var _S = &RangeTable{
R16: []Range16{
- {0x0030, 0x0039, 1},
- {0x0660, 0x0669, 1},
- {0x06f0, 0x06f9, 1},
- {0x07c0, 0x07c9, 1},
- {0x0966, 0x096f, 1},
- {0x09e6, 0x09ef, 1},
- {0x0a66, 0x0a6f, 1},
- {0x0ae6, 0x0aef, 1},
- {0x0b66, 0x0b6f, 1},
- {0x0be6, 0x0bef, 1},
- {0x0c66, 0x0c6f, 1},
- {0x0ce6, 0x0cef, 1},
- {0x0d66, 0x0d6f, 1},
- {0x0e50, 0x0e59, 1},
- {0x0ed0, 0x0ed9, 1},
- {0x0f20, 0x0f29, 1},
- {0x1040, 0x1049, 1},
- {0x1090, 0x1099, 1},
- {0x17e0, 0x17e9, 1},
- {0x1810, 0x1819, 1},
- {0x1946, 0x194f, 1},
- {0x19d0, 0x19d9, 1},
- {0x1a80, 0x1a89, 1},
- {0x1a90, 0x1a99, 1},
- {0x1b50, 0x1b59, 1},
- {0x1bb0, 0x1bb9, 1},
- {0x1c40, 0x1c49, 1},
- {0x1c50, 0x1c59, 1},
- {0xa620, 0xa629, 1},
- {0xa8d0, 0xa8d9, 1},
- {0xa900, 0xa909, 1},
- {0xa9d0, 0xa9d9, 1},
- {0xaa50, 0xaa59, 1},
- {0xabf0, 0xabf9, 1},
- {0xff10, 0xff19, 1},
+ {0x0024, 0x002b, 7},
+ {0x003c, 0x003e, 1},
+ {0x005e, 0x0060, 2},
+ {0x007c, 0x007e, 2},
+ {0x00a2, 0x00a9, 1},
+ {0x00ac, 0x00ae, 2},
+ {0x00af, 0x00b1, 1},
+ {0x00b4, 0x00b8, 2},
+ {0x00d7, 0x00f7, 32},
+ {0x02c2, 0x02c5, 1},
+ {0x02d2, 0x02df, 1},
+ {0x02e5, 0x02eb, 1},
+ {0x02ed, 0x02ef, 2},
+ {0x02f0, 0x02ff, 1},
+ {0x0375, 0x0384, 15},
+ {0x0385, 0x03f6, 113},
+ {0x0482, 0x0606, 388},
+ {0x0607, 0x0608, 1},
+ {0x060b, 0x060e, 3},
+ {0x060f, 0x06de, 207},
+ {0x06e9, 0x06fd, 20},
+ {0x06fe, 0x07f6, 248},
+ {0x09f2, 0x09f3, 1},
+ {0x09fa, 0x09fb, 1},
+ {0x0af1, 0x0b70, 127},
+ {0x0bf3, 0x0bfa, 1},
+ {0x0c7f, 0x0d79, 250},
+ {0x0e3f, 0x0f01, 194},
+ {0x0f02, 0x0f03, 1},
+ {0x0f13, 0x0f17, 1},
+ {0x0f1a, 0x0f1f, 1},
+ {0x0f34, 0x0f38, 2},
+ {0x0fbe, 0x0fc5, 1},
+ {0x0fc7, 0x0fcc, 1},
+ {0x0fce, 0x0fcf, 1},
+ {0x0fd5, 0x0fd8, 1},
+ {0x109e, 0x109f, 1},
+ {0x1360, 0x1390, 48},
+ {0x1391, 0x1399, 1},
+ {0x17db, 0x1940, 357},
+ {0x19de, 0x19ff, 1},
+ {0x1b61, 0x1b6a, 1},
+ {0x1b74, 0x1b7c, 1},
+ {0x1fbd, 0x1fbf, 2},
+ {0x1fc0, 0x1fc1, 1},
+ {0x1fcd, 0x1fcf, 1},
+ {0x1fdd, 0x1fdf, 1},
+ {0x1fed, 0x1fef, 1},
+ {0x1ffd, 0x1ffe, 1},
+ {0x2044, 0x2052, 14},
+ {0x207a, 0x207c, 1},
+ {0x208a, 0x208c, 1},
+ {0x20a0, 0x20b9, 1},
+ {0x2100, 0x2101, 1},
+ {0x2103, 0x2106, 1},
+ {0x2108, 0x2109, 1},
+ {0x2114, 0x2116, 2},
+ {0x2117, 0x2118, 1},
+ {0x211e, 0x2123, 1},
+ {0x2125, 0x2129, 2},
+ {0x212e, 0x213a, 12},
+ {0x213b, 0x2140, 5},
+ {0x2141, 0x2144, 1},
+ {0x214a, 0x214d, 1},
+ {0x214f, 0x2190, 65},
+ {0x2191, 0x2328, 1},
+ {0x232b, 0x23f3, 1},
+ {0x2400, 0x2426, 1},
+ {0x2440, 0x244a, 1},
+ {0x249c, 0x24e9, 1},
+ {0x2500, 0x26ff, 1},
+ {0x2701, 0x2767, 1},
+ {0x2794, 0x27c4, 1},
+ {0x27c7, 0x27ca, 1},
+ {0x27cc, 0x27ce, 2},
+ {0x27cf, 0x27e5, 1},
+ {0x27f0, 0x2982, 1},
+ {0x2999, 0x29d7, 1},
+ {0x29dc, 0x29fb, 1},
+ {0x29fe, 0x2b4c, 1},
+ {0x2b50, 0x2b59, 1},
+ {0x2ce5, 0x2cea, 1},
+ {0x2e80, 0x2e99, 1},
+ {0x2e9b, 0x2ef3, 1},
+ {0x2f00, 0x2fd5, 1},
+ {0x2ff0, 0x2ffb, 1},
+ {0x3004, 0x3012, 14},
+ {0x3013, 0x3020, 13},
+ {0x3036, 0x3037, 1},
+ {0x303e, 0x303f, 1},
+ {0x309b, 0x309c, 1},
+ {0x3190, 0x3191, 1},
+ {0x3196, 0x319f, 1},
+ {0x31c0, 0x31e3, 1},
+ {0x3200, 0x321e, 1},
+ {0x322a, 0x3250, 1},
+ {0x3260, 0x327f, 1},
+ {0x328a, 0x32b0, 1},
+ {0x32c0, 0x32fe, 1},
+ {0x3300, 0x33ff, 1},
+ {0x4dc0, 0x4dff, 1},
+ {0xa490, 0xa4c6, 1},
+ {0xa700, 0xa716, 1},
+ {0xa720, 0xa721, 1},
+ {0xa789, 0xa78a, 1},
+ {0xa828, 0xa82b, 1},
+ {0xa836, 0xa839, 1},
+ {0xaa77, 0xaa79, 1},
+ {0xfb29, 0xfbb2, 137},
+ {0xfbb3, 0xfbc1, 1},
+ {0xfdfc, 0xfdfd, 1},
+ {0xfe62, 0xfe64, 2},
+ {0xfe65, 0xfe66, 1},
+ {0xfe69, 0xff04, 155},
+ {0xff0b, 0xff1c, 17},
+ {0xff1d, 0xff1e, 1},
+ {0xff3e, 0xff40, 2},
+ {0xff5c, 0xff5e, 2},
+ {0xffe0, 0xffe6, 1},
+ {0xffe8, 0xffee, 1},
+ {0xfffc, 0xfffd, 1},
},
R32: []Range32{
- {0x104a0, 0x104a9, 1},
- {0x11066, 0x1106f, 1},
- {0x1d7ce, 0x1d7ff, 1},
+ {0x10102, 0x10137, 53},
+ {0x10138, 0x1013f, 1},
+ {0x10179, 0x10189, 1},
+ {0x10190, 0x1019b, 1},
+ {0x101d0, 0x101fc, 1},
+ {0x1d000, 0x1d0f5, 1},
+ {0x1d100, 0x1d126, 1},
+ {0x1d129, 0x1d164, 1},
+ {0x1d16a, 0x1d16c, 1},
+ {0x1d183, 0x1d184, 1},
+ {0x1d18c, 0x1d1a9, 1},
+ {0x1d1ae, 0x1d1dd, 1},
+ {0x1d200, 0x1d241, 1},
+ {0x1d245, 0x1d300, 187},
+ {0x1d301, 0x1d356, 1},
+ {0x1d6c1, 0x1d6db, 26},
+ {0x1d6fb, 0x1d715, 26},
+ {0x1d735, 0x1d74f, 26},
+ {0x1d76f, 0x1d789, 26},
+ {0x1d7a9, 0x1d7c3, 26},
+ {0x1f000, 0x1f02b, 1},
+ {0x1f030, 0x1f093, 1},
+ {0x1f0a0, 0x1f0ae, 1},
+ {0x1f0b1, 0x1f0be, 1},
+ {0x1f0c1, 0x1f0cf, 1},
+ {0x1f0d1, 0x1f0df, 1},
+ {0x1f110, 0x1f12e, 1},
+ {0x1f130, 0x1f169, 1},
+ {0x1f170, 0x1f19a, 1},
+ {0x1f1e6, 0x1f202, 1},
+ {0x1f210, 0x1f23a, 1},
+ {0x1f240, 0x1f248, 1},
+ {0x1f250, 0x1f251, 1},
+ {0x1f300, 0x1f320, 1},
+ {0x1f330, 0x1f335, 1},
+ {0x1f337, 0x1f37c, 1},
+ {0x1f380, 0x1f393, 1},
+ {0x1f3a0, 0x1f3c4, 1},
+ {0x1f3c6, 0x1f3ca, 1},
+ {0x1f3e0, 0x1f3f0, 1},
+ {0x1f400, 0x1f43e, 1},
+ {0x1f440, 0x1f442, 2},
+ {0x1f443, 0x1f4f7, 1},
+ {0x1f4f9, 0x1f4fc, 1},
+ {0x1f500, 0x1f53d, 1},
+ {0x1f550, 0x1f567, 1},
+ {0x1f5fb, 0x1f5ff, 1},
+ {0x1f601, 0x1f610, 1},
+ {0x1f612, 0x1f614, 1},
+ {0x1f616, 0x1f61c, 2},
+ {0x1f61d, 0x1f61e, 1},
+ {0x1f620, 0x1f625, 1},
+ {0x1f628, 0x1f62b, 1},
+ {0x1f62d, 0x1f630, 3},
+ {0x1f631, 0x1f633, 1},
+ {0x1f635, 0x1f640, 1},
+ {0x1f645, 0x1f64f, 1},
+ {0x1f680, 0x1f6c5, 1},
+ {0x1f700, 0x1f773, 1},
},
}
-var _Nl = &RangeTable{
+var _Sc = &RangeTable{
R16: []Range16{
- {0x16ee, 0x16f0, 1},
- {0x2160, 0x2182, 1},
- {0x2185, 0x2188, 1},
- {0x3007, 0x3021, 26},
- {0x3022, 0x3029, 1},
- {0x3038, 0x303a, 1},
- {0xa6e6, 0xa6ef, 1},
+ {0x0024, 0x00a2, 126},
+ {0x00a3, 0x00a5, 1},
+ {0x060b, 0x09f2, 999},
+ {0x09f3, 0x09fb, 8},
+ {0x0af1, 0x0bf9, 264},
+ {0x0e3f, 0x17db, 2460},
+ {0x20a0, 0x20b9, 1},
+ {0xa838, 0xfdfc, 21956},
+ {0xfe69, 0xff04, 155},
+ {0xffe0, 0xffe1, 1},
+ {0xffe5, 0xffe6, 1},
},
- R32: []Range32{
- {0x10140, 0x10174, 1},
- {0x10341, 0x1034a, 9},
- {0x103d1, 0x103d5, 1},
- {0x12400, 0x12462, 1},
+}
+
+var _Sk = &RangeTable{
+ R16: []Range16{
+ {0x005e, 0x0060, 2},
+ {0x00a8, 0x00af, 7},
+ {0x00b4, 0x00b8, 4},
+ {0x02c2, 0x02c5, 1},
+ {0x02d2, 0x02df, 1},
+ {0x02e5, 0x02eb, 1},
+ {0x02ed, 0x02ef, 2},
+ {0x02f0, 0x02ff, 1},
+ {0x0375, 0x0384, 15},
+ {0x0385, 0x1fbd, 7224},
+ {0x1fbf, 0x1fc1, 1},
+ {0x1fcd, 0x1fcf, 1},
+ {0x1fdd, 0x1fdf, 1},
+ {0x1fed, 0x1fef, 1},
+ {0x1ffd, 0x1ffe, 1},
+ {0x309b, 0x309c, 1},
+ {0xa700, 0xa716, 1},
+ {0xa720, 0xa721, 1},
+ {0xa789, 0xa78a, 1},
+ {0xfbb2, 0xfbc1, 1},
+ {0xff3e, 0xff40, 2},
+ {0xffe3, 0xffe3, 1},
},
}
-var _No = &RangeTable{
+var _Sm = &RangeTable{
R16: []Range16{
- {0x00b2, 0x00b3, 1},
- {0x00b9, 0x00bc, 3},
- {0x00bd, 0x00be, 1},
- {0x09f4, 0x09f9, 1},
- {0x0b72, 0x0b77, 1},
- {0x0bf0, 0x0bf2, 1},
- {0x0c78, 0x0c7e, 1},
- {0x0d70, 0x0d75, 1},
- {0x0f2a, 0x0f33, 1},
- {0x1369, 0x137c, 1},
- {0x17f0, 0x17f9, 1},
- {0x19da, 0x2070, 1686},
- {0x2074, 0x2079, 1},
- {0x2080, 0x2089, 1},
- {0x2150, 0x215f, 1},
- {0x2189, 0x2460, 727},
- {0x2461, 0x249b, 1},
- {0x24ea, 0x24ff, 1},
- {0x2776, 0x2793, 1},
- {0x2cfd, 0x3192, 1173},
- {0x3193, 0x3195, 1},
- {0x3220, 0x3229, 1},
- {0x3251, 0x325f, 1},
- {0x3280, 0x3289, 1},
- {0x32b1, 0x32bf, 1},
- {0xa830, 0xa835, 1},
+ {0x002b, 0x003c, 17},
+ {0x003d, 0x003e, 1},
+ {0x007c, 0x007e, 2},
+ {0x00ac, 0x00b1, 5},
+ {0x00d7, 0x00f7, 32},
+ {0x03f6, 0x0606, 528},
+ {0x0607, 0x0608, 1},
+ {0x2044, 0x2052, 14},
+ {0x207a, 0x207c, 1},
+ {0x208a, 0x208c, 1},
+ {0x2118, 0x2140, 40},
+ {0x2141, 0x2144, 1},
+ {0x214b, 0x2190, 69},
+ {0x2191, 0x2194, 1},
+ {0x219a, 0x219b, 1},
+ {0x21a0, 0x21a6, 3},
+ {0x21ae, 0x21ce, 32},
+ {0x21cf, 0x21d2, 3},
+ {0x21d4, 0x21f4, 32},
+ {0x21f5, 0x22ff, 1},
+ {0x2308, 0x230b, 1},
+ {0x2320, 0x2321, 1},
+ {0x237c, 0x239b, 31},
+ {0x239c, 0x23b3, 1},
+ {0x23dc, 0x23e1, 1},
+ {0x25b7, 0x25c1, 10},
+ {0x25f8, 0x25ff, 1},
+ {0x266f, 0x27c0, 337},
+ {0x27c1, 0x27c4, 1},
+ {0x27c7, 0x27ca, 1},
+ {0x27cc, 0x27ce, 2},
+ {0x27cf, 0x27e5, 1},
+ {0x27f0, 0x27ff, 1},
+ {0x2900, 0x2982, 1},
+ {0x2999, 0x29d7, 1},
+ {0x29dc, 0x29fb, 1},
+ {0x29fe, 0x2aff, 1},
+ {0x2b30, 0x2b44, 1},
+ {0x2b47, 0x2b4c, 1},
+ {0xfb29, 0xfe62, 825},
+ {0xfe64, 0xfe66, 1},
+ {0xff0b, 0xff1c, 17},
+ {0xff1d, 0xff1e, 1},
+ {0xff5c, 0xff5e, 2},
+ {0xffe2, 0xffe9, 7},
+ {0xffea, 0xffec, 1},
},
R32: []Range32{
- {0x10107, 0x10133, 1},
- {0x10175, 0x10178, 1},
- {0x1018a, 0x10320, 406},
- {0x10321, 0x10323, 1},
- {0x10858, 0x1085f, 1},
- {0x10916, 0x1091b, 1},
- {0x10a40, 0x10a47, 1},
- {0x10a7d, 0x10a7e, 1},
- {0x10b58, 0x10b5f, 1},
- {0x10b78, 0x10b7f, 1},
- {0x10e60, 0x10e7e, 1},
- {0x11052, 0x11065, 1},
- {0x1d360, 0x1d371, 1},
- {0x1f100, 0x1f10a, 1},
+ {0x1d6c1, 0x1d6db, 26},
+ {0x1d6fb, 0x1d715, 26},
+ {0x1d735, 0x1d74f, 26},
+ {0x1d76f, 0x1d789, 26},
+ {0x1d7a9, 0x1d7c3, 26},
},
}
@@ -2135,569 +2668,36 @@ var _So = &RangeTable{
},
}
-var _Sm = &RangeTable{
- R16: []Range16{
- {0x002b, 0x003c, 17},
- {0x003d, 0x003e, 1},
- {0x007c, 0x007e, 2},
- {0x00ac, 0x00b1, 5},
- {0x00d7, 0x00f7, 32},
- {0x03f6, 0x0606, 528},
- {0x0607, 0x0608, 1},
- {0x2044, 0x2052, 14},
- {0x207a, 0x207c, 1},
- {0x208a, 0x208c, 1},
- {0x2118, 0x2140, 40},
- {0x2141, 0x2144, 1},
- {0x214b, 0x2190, 69},
- {0x2191, 0x2194, 1},
- {0x219a, 0x219b, 1},
- {0x21a0, 0x21a6, 3},
- {0x21ae, 0x21ce, 32},
- {0x21cf, 0x21d2, 3},
- {0x21d4, 0x21f4, 32},
- {0x21f5, 0x22ff, 1},
- {0x2308, 0x230b, 1},
- {0x2320, 0x2321, 1},
- {0x237c, 0x239b, 31},
- {0x239c, 0x23b3, 1},
- {0x23dc, 0x23e1, 1},
- {0x25b7, 0x25c1, 10},
- {0x25f8, 0x25ff, 1},
- {0x266f, 0x27c0, 337},
- {0x27c1, 0x27c4, 1},
- {0x27c7, 0x27ca, 1},
- {0x27cc, 0x27ce, 2},
- {0x27cf, 0x27e5, 1},
- {0x27f0, 0x27ff, 1},
- {0x2900, 0x2982, 1},
- {0x2999, 0x29d7, 1},
- {0x29dc, 0x29fb, 1},
- {0x29fe, 0x2aff, 1},
- {0x2b30, 0x2b44, 1},
- {0x2b47, 0x2b4c, 1},
- {0xfb29, 0xfe62, 825},
- {0xfe64, 0xfe66, 1},
- {0xff0b, 0xff1c, 17},
- {0xff1d, 0xff1e, 1},
- {0xff5c, 0xff5e, 2},
- {0xffe2, 0xffe9, 7},
- {0xffea, 0xffec, 1},
- },
- R32: []Range32{
- {0x1d6c1, 0x1d6db, 26},
- {0x1d6fb, 0x1d715, 26},
- {0x1d735, 0x1d74f, 26},
- {0x1d76f, 0x1d789, 26},
- {0x1d7a9, 0x1d7c3, 26},
- },
-}
-
-var _Sk = &RangeTable{
- R16: []Range16{
- {0x005e, 0x0060, 2},
- {0x00a8, 0x00af, 7},
- {0x00b4, 0x00b8, 4},
- {0x02c2, 0x02c5, 1},
- {0x02d2, 0x02df, 1},
- {0x02e5, 0x02eb, 1},
- {0x02ed, 0x02ef, 2},
- {0x02f0, 0x02ff, 1},
- {0x0375, 0x0384, 15},
- {0x0385, 0x1fbd, 7224},
- {0x1fbf, 0x1fc1, 1},
- {0x1fcd, 0x1fcf, 1},
- {0x1fdd, 0x1fdf, 1},
- {0x1fed, 0x1fef, 1},
- {0x1ffd, 0x1ffe, 1},
- {0x309b, 0x309c, 1},
- {0xa700, 0xa716, 1},
- {0xa720, 0xa721, 1},
- {0xa789, 0xa78a, 1},
- {0xfbb2, 0xfbc1, 1},
- {0xff3e, 0xff40, 2},
- {0xffe3, 0xffe3, 1},
- },
-}
-
-var _Sc = &RangeTable{
+var _Z = &RangeTable{
R16: []Range16{
- {0x0024, 0x00a2, 126},
- {0x00a3, 0x00a5, 1},
- {0x060b, 0x09f2, 999},
- {0x09f3, 0x09fb, 8},
- {0x0af1, 0x0bf9, 264},
- {0x0e3f, 0x17db, 2460},
- {0x20a0, 0x20b9, 1},
- {0xa838, 0xfdfc, 21956},
- {0xfe69, 0xff04, 155},
- {0xffe0, 0xffe1, 1},
- {0xffe5, 0xffe6, 1},
+ {0x0020, 0x00a0, 128},
+ {0x1680, 0x180e, 398},
+ {0x2000, 0x200a, 1},
+ {0x2028, 0x2029, 1},
+ {0x202f, 0x205f, 48},
+ {0x3000, 0x3000, 1},
},
}
-var _Lu = &RangeTable{
+var _Zl = &RangeTable{
R16: []Range16{
- {0x0041, 0x005a, 1},
- {0x00c0, 0x00d6, 1},
- {0x00d8, 0x00de, 1},
- {0x0100, 0x0136, 2},
- {0x0139, 0x0147, 2},
- {0x014a, 0x0178, 2},
- {0x0179, 0x017d, 2},
- {0x0181, 0x0182, 1},
- {0x0184, 0x0186, 2},
- {0x0187, 0x0189, 2},
- {0x018a, 0x018b, 1},
- {0x018e, 0x0191, 1},
- {0x0193, 0x0194, 1},
- {0x0196, 0x0198, 1},
- {0x019c, 0x019d, 1},
- {0x019f, 0x01a0, 1},
- {0x01a2, 0x01a6, 2},
- {0x01a7, 0x01a9, 2},
- {0x01ac, 0x01ae, 2},
- {0x01af, 0x01b1, 2},
- {0x01b2, 0x01b3, 1},
- {0x01b5, 0x01b7, 2},
- {0x01b8, 0x01bc, 4},
- {0x01c4, 0x01cd, 3},
- {0x01cf, 0x01db, 2},
- {0x01de, 0x01ee, 2},
- {0x01f1, 0x01f4, 3},
- {0x01f6, 0x01f8, 1},
- {0x01fa, 0x0232, 2},
- {0x023a, 0x023b, 1},
- {0x023d, 0x023e, 1},
- {0x0241, 0x0243, 2},
- {0x0244, 0x0246, 1},
- {0x0248, 0x024e, 2},
- {0x0370, 0x0372, 2},
- {0x0376, 0x0386, 16},
- {0x0388, 0x038a, 1},
- {0x038c, 0x038e, 2},
- {0x038f, 0x0391, 2},
- {0x0392, 0x03a1, 1},
- {0x03a3, 0x03ab, 1},
- {0x03cf, 0x03d2, 3},
- {0x03d3, 0x03d4, 1},
- {0x03d8, 0x03ee, 2},
- {0x03f4, 0x03f7, 3},
- {0x03f9, 0x03fa, 1},
- {0x03fd, 0x042f, 1},
- {0x0460, 0x0480, 2},
- {0x048a, 0x04c0, 2},
- {0x04c1, 0x04cd, 2},
- {0x04d0, 0x0526, 2},
- {0x0531, 0x0556, 1},
- {0x10a0, 0x10c5, 1},
- {0x1e00, 0x1e94, 2},
- {0x1e9e, 0x1efe, 2},
- {0x1f08, 0x1f0f, 1},
- {0x1f18, 0x1f1d, 1},
- {0x1f28, 0x1f2f, 1},
- {0x1f38, 0x1f3f, 1},
- {0x1f48, 0x1f4d, 1},
- {0x1f59, 0x1f5f, 2},
- {0x1f68, 0x1f6f, 1},
- {0x1fb8, 0x1fbb, 1},
- {0x1fc8, 0x1fcb, 1},
- {0x1fd8, 0x1fdb, 1},
- {0x1fe8, 0x1fec, 1},
- {0x1ff8, 0x1ffb, 1},
- {0x2102, 0x2107, 5},
- {0x210b, 0x210d, 1},
- {0x2110, 0x2112, 1},
- {0x2115, 0x2119, 4},
- {0x211a, 0x211d, 1},
- {0x2124, 0x212a, 2},
- {0x212b, 0x212d, 1},
- {0x2130, 0x2133, 1},
- {0x213e, 0x213f, 1},
- {0x2145, 0x2183, 62},
- {0x2c00, 0x2c2e, 1},
- {0x2c60, 0x2c62, 2},
- {0x2c63, 0x2c64, 1},
- {0x2c67, 0x2c6d, 2},
- {0x2c6e, 0x2c70, 1},
- {0x2c72, 0x2c75, 3},
- {0x2c7e, 0x2c80, 1},
- {0x2c82, 0x2ce2, 2},
- {0x2ceb, 0x2ced, 2},
- {0xa640, 0xa66c, 2},
- {0xa680, 0xa696, 2},
- {0xa722, 0xa72e, 2},
- {0xa732, 0xa76e, 2},
- {0xa779, 0xa77d, 2},
- {0xa77e, 0xa786, 2},
- {0xa78b, 0xa78d, 2},
- {0xa790, 0xa7a0, 16},
- {0xa7a2, 0xa7a8, 2},
- {0xff21, 0xff3a, 1},
- },
- R32: []Range32{
- {0x10400, 0x10427, 1},
- {0x1d400, 0x1d419, 1},
- {0x1d434, 0x1d44d, 1},
- {0x1d468, 0x1d481, 1},
- {0x1d49c, 0x1d49e, 2},
- {0x1d49f, 0x1d4a5, 3},
- {0x1d4a6, 0x1d4a9, 3},
- {0x1d4aa, 0x1d4ac, 1},
- {0x1d4ae, 0x1d4b5, 1},
- {0x1d4d0, 0x1d4e9, 1},
- {0x1d504, 0x1d505, 1},
- {0x1d507, 0x1d50a, 1},
- {0x1d50d, 0x1d514, 1},
- {0x1d516, 0x1d51c, 1},
- {0x1d538, 0x1d539, 1},
- {0x1d53b, 0x1d53e, 1},
- {0x1d540, 0x1d544, 1},
- {0x1d546, 0x1d54a, 4},
- {0x1d54b, 0x1d550, 1},
- {0x1d56c, 0x1d585, 1},
- {0x1d5a0, 0x1d5b9, 1},
- {0x1d5d4, 0x1d5ed, 1},
- {0x1d608, 0x1d621, 1},
- {0x1d63c, 0x1d655, 1},
- {0x1d670, 0x1d689, 1},
- {0x1d6a8, 0x1d6c0, 1},
- {0x1d6e2, 0x1d6fa, 1},
- {0x1d71c, 0x1d734, 1},
- {0x1d756, 0x1d76e, 1},
- {0x1d790, 0x1d7a8, 1},
- {0x1d7ca, 0x1d7ca, 1},
+ {0x2028, 0x2028, 1},
},
}
-var _Lt = &RangeTable{
+var _Zp = &RangeTable{
R16: []Range16{
- {0x01c5, 0x01cb, 3},
- {0x01f2, 0x1f88, 7574},
- {0x1f89, 0x1f8f, 1},
- {0x1f98, 0x1f9f, 1},
- {0x1fa8, 0x1faf, 1},
- {0x1fbc, 0x1fcc, 16},
- {0x1ffc, 0x1ffc, 1},
+ {0x2029, 0x2029, 1},
},
}
-var _Lo = &RangeTable{
+var _Zs = &RangeTable{
R16: []Range16{
- {0x01bb, 0x01c0, 5},
- {0x01c1, 0x01c3, 1},
- {0x0294, 0x05d0, 828},
- {0x05d1, 0x05ea, 1},
- {0x05f0, 0x05f2, 1},
- {0x0620, 0x063f, 1},
- {0x0641, 0x064a, 1},
- {0x066e, 0x066f, 1},
- {0x0671, 0x06d3, 1},
- {0x06d5, 0x06ee, 25},
- {0x06ef, 0x06fa, 11},
- {0x06fb, 0x06fc, 1},
- {0x06ff, 0x0710, 17},
- {0x0712, 0x072f, 1},
- {0x074d, 0x07a5, 1},
- {0x07b1, 0x07ca, 25},
- {0x07cb, 0x07ea, 1},
- {0x0800, 0x0815, 1},
- {0x0840, 0x0858, 1},
- {0x0904, 0x0939, 1},
- {0x093d, 0x0950, 19},
- {0x0958, 0x0961, 1},
- {0x0972, 0x0977, 1},
- {0x0979, 0x097f, 1},
- {0x0985, 0x098c, 1},
- {0x098f, 0x0990, 1},
- {0x0993, 0x09a8, 1},
- {0x09aa, 0x09b0, 1},
- {0x09b2, 0x09b6, 4},
- {0x09b7, 0x09b9, 1},
- {0x09bd, 0x09ce, 17},
- {0x09dc, 0x09dd, 1},
- {0x09df, 0x09e1, 1},
- {0x09f0, 0x09f1, 1},
- {0x0a05, 0x0a0a, 1},
- {0x0a0f, 0x0a10, 1},
- {0x0a13, 0x0a28, 1},
- {0x0a2a, 0x0a30, 1},
- {0x0a32, 0x0a33, 1},
- {0x0a35, 0x0a36, 1},
- {0x0a38, 0x0a39, 1},
- {0x0a59, 0x0a5c, 1},
- {0x0a5e, 0x0a72, 20},
- {0x0a73, 0x0a74, 1},
- {0x0a85, 0x0a8d, 1},
- {0x0a8f, 0x0a91, 1},
- {0x0a93, 0x0aa8, 1},
- {0x0aaa, 0x0ab0, 1},
- {0x0ab2, 0x0ab3, 1},
- {0x0ab5, 0x0ab9, 1},
- {0x0abd, 0x0ad0, 19},
- {0x0ae0, 0x0ae1, 1},
- {0x0b05, 0x0b0c, 1},
- {0x0b0f, 0x0b10, 1},
- {0x0b13, 0x0b28, 1},
- {0x0b2a, 0x0b30, 1},
- {0x0b32, 0x0b33, 1},
- {0x0b35, 0x0b39, 1},
- {0x0b3d, 0x0b5c, 31},
- {0x0b5d, 0x0b5f, 2},
- {0x0b60, 0x0b61, 1},
- {0x0b71, 0x0b83, 18},
- {0x0b85, 0x0b8a, 1},
- {0x0b8e, 0x0b90, 1},
- {0x0b92, 0x0b95, 1},
- {0x0b99, 0x0b9a, 1},
- {0x0b9c, 0x0b9e, 2},
- {0x0b9f, 0x0ba3, 4},
- {0x0ba4, 0x0ba8, 4},
- {0x0ba9, 0x0baa, 1},
- {0x0bae, 0x0bb9, 1},
- {0x0bd0, 0x0c05, 53},
- {0x0c06, 0x0c0c, 1},
- {0x0c0e, 0x0c10, 1},
- {0x0c12, 0x0c28, 1},
- {0x0c2a, 0x0c33, 1},
- {0x0c35, 0x0c39, 1},
- {0x0c3d, 0x0c58, 27},
- {0x0c59, 0x0c60, 7},
- {0x0c61, 0x0c85, 36},
- {0x0c86, 0x0c8c, 1},
- {0x0c8e, 0x0c90, 1},
- {0x0c92, 0x0ca8, 1},
- {0x0caa, 0x0cb3, 1},
- {0x0cb5, 0x0cb9, 1},
- {0x0cbd, 0x0cde, 33},
- {0x0ce0, 0x0ce1, 1},
- {0x0cf1, 0x0cf2, 1},
- {0x0d05, 0x0d0c, 1},
- {0x0d0e, 0x0d10, 1},
- {0x0d12, 0x0d3a, 1},
- {0x0d3d, 0x0d4e, 17},
- {0x0d60, 0x0d61, 1},
- {0x0d7a, 0x0d7f, 1},
- {0x0d85, 0x0d96, 1},
- {0x0d9a, 0x0db1, 1},
- {0x0db3, 0x0dbb, 1},
- {0x0dbd, 0x0dc0, 3},
- {0x0dc1, 0x0dc6, 1},
- {0x0e01, 0x0e30, 1},
- {0x0e32, 0x0e33, 1},
- {0x0e40, 0x0e45, 1},
- {0x0e81, 0x0e82, 1},
- {0x0e84, 0x0e87, 3},
- {0x0e88, 0x0e8a, 2},
- {0x0e8d, 0x0e94, 7},
- {0x0e95, 0x0e97, 1},
- {0x0e99, 0x0e9f, 1},
- {0x0ea1, 0x0ea3, 1},
- {0x0ea5, 0x0ea7, 2},
- {0x0eaa, 0x0eab, 1},
- {0x0ead, 0x0eb0, 1},
- {0x0eb2, 0x0eb3, 1},
- {0x0ebd, 0x0ec0, 3},
- {0x0ec1, 0x0ec4, 1},
- {0x0edc, 0x0edd, 1},
- {0x0f00, 0x0f40, 64},
- {0x0f41, 0x0f47, 1},
- {0x0f49, 0x0f6c, 1},
- {0x0f88, 0x0f8c, 1},
- {0x1000, 0x102a, 1},
- {0x103f, 0x1050, 17},
- {0x1051, 0x1055, 1},
- {0x105a, 0x105d, 1},
- {0x1061, 0x1065, 4},
- {0x1066, 0x106e, 8},
- {0x106f, 0x1070, 1},
- {0x1075, 0x1081, 1},
- {0x108e, 0x10d0, 66},
- {0x10d1, 0x10fa, 1},
- {0x1100, 0x1248, 1},
- {0x124a, 0x124d, 1},
- {0x1250, 0x1256, 1},
- {0x1258, 0x125a, 2},
- {0x125b, 0x125d, 1},
- {0x1260, 0x1288, 1},
- {0x128a, 0x128d, 1},
- {0x1290, 0x12b0, 1},
- {0x12b2, 0x12b5, 1},
- {0x12b8, 0x12be, 1},
- {0x12c0, 0x12c2, 2},
- {0x12c3, 0x12c5, 1},
- {0x12c8, 0x12d6, 1},
- {0x12d8, 0x1310, 1},
- {0x1312, 0x1315, 1},
- {0x1318, 0x135a, 1},
- {0x1380, 0x138f, 1},
- {0x13a0, 0x13f4, 1},
- {0x1401, 0x166c, 1},
- {0x166f, 0x167f, 1},
- {0x1681, 0x169a, 1},
- {0x16a0, 0x16ea, 1},
- {0x1700, 0x170c, 1},
- {0x170e, 0x1711, 1},
- {0x1720, 0x1731, 1},
- {0x1740, 0x1751, 1},
- {0x1760, 0x176c, 1},
- {0x176e, 0x1770, 1},
- {0x1780, 0x17b3, 1},
- {0x17dc, 0x1820, 68},
- {0x1821, 0x1842, 1},
- {0x1844, 0x1877, 1},
- {0x1880, 0x18a8, 1},
- {0x18aa, 0x18b0, 6},
- {0x18b1, 0x18f5, 1},
- {0x1900, 0x191c, 1},
- {0x1950, 0x196d, 1},
- {0x1970, 0x1974, 1},
- {0x1980, 0x19ab, 1},
- {0x19c1, 0x19c7, 1},
- {0x1a00, 0x1a16, 1},
- {0x1a20, 0x1a54, 1},
- {0x1b05, 0x1b33, 1},
- {0x1b45, 0x1b4b, 1},
- {0x1b83, 0x1ba0, 1},
- {0x1bae, 0x1baf, 1},
- {0x1bc0, 0x1be5, 1},
- {0x1c00, 0x1c23, 1},
- {0x1c4d, 0x1c4f, 1},
- {0x1c5a, 0x1c77, 1},
- {0x1ce9, 0x1cec, 1},
- {0x1cee, 0x1cf1, 1},
- {0x2135, 0x2138, 1},
- {0x2d30, 0x2d65, 1},
- {0x2d80, 0x2d96, 1},
- {0x2da0, 0x2da6, 1},
- {0x2da8, 0x2dae, 1},
- {0x2db0, 0x2db6, 1},
- {0x2db8, 0x2dbe, 1},
- {0x2dc0, 0x2dc6, 1},
- {0x2dc8, 0x2dce, 1},
- {0x2dd0, 0x2dd6, 1},
- {0x2dd8, 0x2dde, 1},
- {0x3006, 0x303c, 54},
- {0x3041, 0x3096, 1},
- {0x309f, 0x30a1, 2},
- {0x30a2, 0x30fa, 1},
- {0x30ff, 0x3105, 6},
- {0x3106, 0x312d, 1},
- {0x3131, 0x318e, 1},
- {0x31a0, 0x31ba, 1},
- {0x31f0, 0x31ff, 1},
- {0x3400, 0x4db5, 1},
- {0x4e00, 0x9fcb, 1},
- {0xa000, 0xa014, 1},
- {0xa016, 0xa48c, 1},
- {0xa4d0, 0xa4f7, 1},
- {0xa500, 0xa60b, 1},
- {0xa610, 0xa61f, 1},
- {0xa62a, 0xa62b, 1},
- {0xa66e, 0xa6a0, 50},
- {0xa6a1, 0xa6e5, 1},
- {0xa7fb, 0xa801, 1},
- {0xa803, 0xa805, 1},
- {0xa807, 0xa80a, 1},
- {0xa80c, 0xa822, 1},
- {0xa840, 0xa873, 1},
- {0xa882, 0xa8b3, 1},
- {0xa8f2, 0xa8f7, 1},
- {0xa8fb, 0xa90a, 15},
- {0xa90b, 0xa925, 1},
- {0xa930, 0xa946, 1},
- {0xa960, 0xa97c, 1},
- {0xa984, 0xa9b2, 1},
- {0xaa00, 0xaa28, 1},
- {0xaa40, 0xaa42, 1},
- {0xaa44, 0xaa4b, 1},
- {0xaa60, 0xaa6f, 1},
- {0xaa71, 0xaa76, 1},
- {0xaa7a, 0xaa80, 6},
- {0xaa81, 0xaaaf, 1},
- {0xaab1, 0xaab5, 4},
- {0xaab6, 0xaab9, 3},
- {0xaaba, 0xaabd, 1},
- {0xaac0, 0xaac2, 2},
- {0xaadb, 0xaadc, 1},
- {0xab01, 0xab06, 1},
- {0xab09, 0xab0e, 1},
- {0xab11, 0xab16, 1},
- {0xab20, 0xab26, 1},
- {0xab28, 0xab2e, 1},
- {0xabc0, 0xabe2, 1},
- {0xac00, 0xd7a3, 1},
- {0xd7b0, 0xd7c6, 1},
- {0xd7cb, 0xd7fb, 1},
- {0xf900, 0xfa2d, 1},
- {0xfa30, 0xfa6d, 1},
- {0xfa70, 0xfad9, 1},
- {0xfb1d, 0xfb1f, 2},
- {0xfb20, 0xfb28, 1},
- {0xfb2a, 0xfb36, 1},
- {0xfb38, 0xfb3c, 1},
- {0xfb3e, 0xfb40, 2},
- {0xfb41, 0xfb43, 2},
- {0xfb44, 0xfb46, 2},
- {0xfb47, 0xfbb1, 1},
- {0xfbd3, 0xfd3d, 1},
- {0xfd50, 0xfd8f, 1},
- {0xfd92, 0xfdc7, 1},
- {0xfdf0, 0xfdfb, 1},
- {0xfe70, 0xfe74, 1},
- {0xfe76, 0xfefc, 1},
- {0xff66, 0xff6f, 1},
- {0xff71, 0xff9d, 1},
- {0xffa0, 0xffbe, 1},
- {0xffc2, 0xffc7, 1},
- {0xffca, 0xffcf, 1},
- {0xffd2, 0xffd7, 1},
- {0xffda, 0xffdc, 1},
- },
- R32: []Range32{
- {0x10000, 0x1000b, 1},
- {0x1000d, 0x10026, 1},
- {0x10028, 0x1003a, 1},
- {0x1003c, 0x1003d, 1},
- {0x1003f, 0x1004d, 1},
- {0x10050, 0x1005d, 1},
- {0x10080, 0x100fa, 1},
- {0x10280, 0x1029c, 1},
- {0x102a0, 0x102d0, 1},
- {0x10300, 0x1031e, 1},
- {0x10330, 0x10340, 1},
- {0x10342, 0x10349, 1},
- {0x10380, 0x1039d, 1},
- {0x103a0, 0x103c3, 1},
- {0x103c8, 0x103cf, 1},
- {0x10450, 0x1049d, 1},
- {0x10800, 0x10805, 1},
- {0x10808, 0x1080a, 2},
- {0x1080b, 0x10835, 1},
- {0x10837, 0x10838, 1},
- {0x1083c, 0x1083f, 3},
- {0x10840, 0x10855, 1},
- {0x10900, 0x10915, 1},
- {0x10920, 0x10939, 1},
- {0x10a00, 0x10a10, 16},
- {0x10a11, 0x10a13, 1},
- {0x10a15, 0x10a17, 1},
- {0x10a19, 0x10a33, 1},
- {0x10a60, 0x10a7c, 1},
- {0x10b00, 0x10b35, 1},
- {0x10b40, 0x10b55, 1},
- {0x10b60, 0x10b72, 1},
- {0x10c00, 0x10c48, 1},
- {0x11003, 0x11037, 1},
- {0x11083, 0x110af, 1},
- {0x12000, 0x1236e, 1},
- {0x13000, 0x1342e, 1},
- {0x16800, 0x16a38, 1},
- {0x1b000, 0x1b001, 1},
- {0x20000, 0x2a6d6, 1},
- {0x2a700, 0x2b734, 1},
- {0x2b740, 0x2b81d, 1},
- {0x2f800, 0x2fa1d, 1},
+ {0x0020, 0x00a0, 128},
+ {0x1680, 0x180e, 398},
+ {0x2000, 0x200a, 1},
+ {0x202f, 0x205f, 48},
+ {0x3000, 0x3000, 1},
},
}
@@ -2757,262 +2757,186 @@ var (
// Scripts is the set of Unicode script tables.
var Scripts = map[string]*RangeTable{
- "Katakana": Katakana,
- "Malayalam": Malayalam,
- "Phags_Pa": Phags_Pa,
- "Inscriptional_Parthian": Inscriptional_Parthian,
- "Latin": Latin,
- "Inscriptional_Pahlavi": Inscriptional_Pahlavi,
- "Osmanya": Osmanya,
- "Khmer": Khmer,
- "Inherited": Inherited,
- "Telugu": Telugu,
- "Samaritan": Samaritan,
+ "Arabic": Arabic,
+ "Armenian": Armenian,
+ "Avestan": Avestan,
+ "Balinese": Balinese,
+ "Bamum": Bamum,
+ "Batak": Batak,
+ "Bengali": Bengali,
"Bopomofo": Bopomofo,
- "Imperial_Aramaic": Imperial_Aramaic,
- "Kaithi": Kaithi,
- "Mandaic": Mandaic,
- "Old_South_Arabian": Old_South_Arabian,
- "Kayah_Li": Kayah_Li,
- "New_Tai_Lue": New_Tai_Lue,
- "Tai_Le": Tai_Le,
- "Kharoshthi": Kharoshthi,
- "Common": Common,
- "Kannada": Kannada,
- "Old_Turkic": Old_Turkic,
- "Tamil": Tamil,
- "Tagalog": Tagalog,
"Brahmi": Brahmi,
- "Arabic": Arabic,
- "Tagbanwa": Tagbanwa,
+ "Braille": Braille,
+ "Buginese": Buginese,
+ "Buhid": Buhid,
"Canadian_Aboriginal": Canadian_Aboriginal,
- "Tibetan": Tibetan,
+ "Carian": Carian,
+ "Cham": Cham,
+ "Cherokee": Cherokee,
+ "Common": Common,
"Coptic": Coptic,
- "Hiragana": Hiragana,
- "Limbu": Limbu,
+ "Cuneiform": Cuneiform,
+ "Cypriot": Cypriot,
+ "Cyrillic": Cyrillic,
+ "Deseret": Deseret,
+ "Devanagari": Devanagari,
"Egyptian_Hieroglyphs": Egyptian_Hieroglyphs,
- "Avestan": Avestan,
- "Myanmar": Myanmar,
- "Armenian": Armenian,
- "Sinhala": Sinhala,
- "Bengali": Bengali,
+ "Ethiopic": Ethiopic,
+ "Georgian": Georgian,
+ "Glagolitic": Glagolitic,
+ "Gothic": Gothic,
"Greek": Greek,
- "Cham": Cham,
- "Hebrew": Hebrew,
- "Meetei_Mayek": Meetei_Mayek,
- "Saurashtra": Saurashtra,
+ "Gujarati": Gujarati,
+ "Gurmukhi": Gurmukhi,
+ "Han": Han,
"Hangul": Hangul,
- "Runic": Runic,
- "Deseret": Deseret,
- "Lisu": Lisu,
- "Sundanese": Sundanese,
- "Glagolitic": Glagolitic,
- "Oriya": Oriya,
- "Buhid": Buhid,
- "Ethiopic": Ethiopic,
+ "Hanunoo": Hanunoo,
+ "Hebrew": Hebrew,
+ "Hiragana": Hiragana,
+ "Imperial_Aramaic": Imperial_Aramaic,
+ "Inherited": Inherited,
+ "Inscriptional_Pahlavi": Inscriptional_Pahlavi,
+ "Inscriptional_Parthian": Inscriptional_Parthian,
"Javanese": Javanese,
- "Syloti_Nagri": Syloti_Nagri,
- "Vai": Vai,
- "Cherokee": Cherokee,
+ "Kaithi": Kaithi,
+ "Kannada": Kannada,
+ "Katakana": Katakana,
+ "Kayah_Li": Kayah_Li,
+ "Kharoshthi": Kharoshthi,
+ "Khmer": Khmer,
+ "Lao": Lao,
+ "Latin": Latin,
+ "Lepcha": Lepcha,
+ "Limbu": Limbu,
+ "Linear_B": Linear_B,
+ "Lisu": Lisu,
+ "Lycian": Lycian,
+ "Lydian": Lydian,
+ "Malayalam": Malayalam,
+ "Mandaic": Mandaic,
+ "Meetei_Mayek": Meetei_Mayek,
+ "Mongolian": Mongolian,
+ "Myanmar": Myanmar,
+ "New_Tai_Lue": New_Tai_Lue,
+ "Nko": Nko,
"Ogham": Ogham,
- "Batak": Batak,
- "Syriac": Syriac,
- "Gurmukhi": Gurmukhi,
- "Tai_Tham": Tai_Tham,
"Ol_Chiki": Ol_Chiki,
- "Mongolian": Mongolian,
- "Hanunoo": Hanunoo,
- "Cypriot": Cypriot,
- "Buginese": Buginese,
- "Bamum": Bamum,
- "Lepcha": Lepcha,
- "Thaana": Thaana,
+ "Old_Italic": Old_Italic,
"Old_Persian": Old_Persian,
- "Cuneiform": Cuneiform,
+ "Old_South_Arabian": Old_South_Arabian,
+ "Old_Turkic": Old_Turkic,
+ "Oriya": Oriya,
+ "Osmanya": Osmanya,
+ "Phags_Pa": Phags_Pa,
+ "Phoenician": Phoenician,
"Rejang": Rejang,
- "Georgian": Georgian,
+ "Runic": Runic,
+ "Samaritan": Samaritan,
+ "Saurashtra": Saurashtra,
"Shavian": Shavian,
- "Lycian": Lycian,
- "Nko": Nko,
- "Yi": Yi,
- "Lao": Lao,
- "Linear_B": Linear_B,
- "Old_Italic": Old_Italic,
+ "Sinhala": Sinhala,
+ "Sundanese": Sundanese,
+ "Syloti_Nagri": Syloti_Nagri,
+ "Syriac": Syriac,
+ "Tagalog": Tagalog,
+ "Tagbanwa": Tagbanwa,
+ "Tai_Le": Tai_Le,
+ "Tai_Tham": Tai_Tham,
"Tai_Viet": Tai_Viet,
- "Devanagari": Devanagari,
- "Lydian": Lydian,
+ "Tamil": Tamil,
+ "Telugu": Telugu,
+ "Thaana": Thaana,
+ "Thai": Thai,
+ "Tibetan": Tibetan,
"Tifinagh": Tifinagh,
"Ugaritic": Ugaritic,
- "Thai": Thai,
- "Cyrillic": Cyrillic,
- "Gujarati": Gujarati,
- "Carian": Carian,
- "Phoenician": Phoenician,
- "Balinese": Balinese,
- "Braille": Braille,
- "Han": Han,
- "Gothic": Gothic,
-}
-
-var _Katakana = &RangeTable{
- R16: []Range16{
- {0x30a1, 0x30fa, 1},
- {0x30fd, 0x30ff, 1},
- {0x31f0, 0x31ff, 1},
- {0x32d0, 0x32fe, 1},
- {0x3300, 0x3357, 1},
- {0xff66, 0xff6f, 1},
- {0xff71, 0xff9d, 1},
- },
- R32: []Range32{
- {0x1b000, 0x1b000, 1},
- },
-}
-
-var _Malayalam = &RangeTable{
- R16: []Range16{
- {0x0d02, 0x0d03, 1},
- {0x0d05, 0x0d0c, 1},
- {0x0d0e, 0x0d10, 1},
- {0x0d12, 0x0d3a, 1},
- {0x0d3d, 0x0d44, 1},
- {0x0d46, 0x0d48, 1},
- {0x0d4a, 0x0d4e, 1},
- {0x0d57, 0x0d57, 1},
- {0x0d60, 0x0d63, 1},
- {0x0d66, 0x0d75, 1},
- {0x0d79, 0x0d7f, 1},
- },
+ "Vai": Vai,
+ "Yi": Yi,
}
-var _Phags_Pa = &RangeTable{
+var _Arabic = &RangeTable{
R16: []Range16{
- {0xa840, 0xa877, 1},
+ {0x0600, 0x0603, 1},
+ {0x0606, 0x060b, 1},
+ {0x060d, 0x061a, 1},
+ {0x061e, 0x061e, 1},
+ {0x0620, 0x063f, 1},
+ {0x0641, 0x064a, 1},
+ {0x0656, 0x065e, 1},
+ {0x066a, 0x066f, 1},
+ {0x0671, 0x06dc, 1},
+ {0x06de, 0x06ff, 1},
+ {0x0750, 0x077f, 1},
+ {0xfb50, 0xfbc1, 1},
+ {0xfbd3, 0xfd3d, 1},
+ {0xfd50, 0xfd8f, 1},
+ {0xfd92, 0xfdc7, 1},
+ {0xfdf0, 0xfdfc, 1},
+ {0xfe70, 0xfe74, 1},
+ {0xfe76, 0xfefc, 1},
},
-}
-
-var _Inscriptional_Parthian = &RangeTable{
- R16: []Range16{},
R32: []Range32{
- {0x10b40, 0x10b55, 1},
- {0x10b58, 0x10b5f, 1},
+ {0x10e60, 0x10e7e, 1},
},
}
-var _Latin = &RangeTable{
+var _Armenian = &RangeTable{
R16: []Range16{
- {0x0041, 0x005a, 1},
- {0x0061, 0x007a, 1},
- {0x00aa, 0x00aa, 1},
- {0x00ba, 0x00ba, 1},
- {0x00c0, 0x00d6, 1},
- {0x00d8, 0x00f6, 1},
- {0x00f8, 0x02b8, 1},
- {0x02e0, 0x02e4, 1},
- {0x1d00, 0x1d25, 1},
- {0x1d2c, 0x1d5c, 1},
- {0x1d62, 0x1d65, 1},
- {0x1d6b, 0x1d77, 1},
- {0x1d79, 0x1dbe, 1},
- {0x1e00, 0x1eff, 1},
- {0x2071, 0x2071, 1},
- {0x207f, 0x207f, 1},
- {0x2090, 0x209c, 1},
- {0x212a, 0x212b, 1},
- {0x2132, 0x2132, 1},
- {0x214e, 0x214e, 1},
- {0x2160, 0x2188, 1},
- {0x2c60, 0x2c7f, 1},
- {0xa722, 0xa787, 1},
- {0xa78b, 0xa78e, 1},
- {0xa790, 0xa791, 1},
- {0xa7a0, 0xa7a9, 1},
- {0xa7fa, 0xa7ff, 1},
- {0xfb00, 0xfb06, 1},
- {0xff21, 0xff3a, 1},
- {0xff41, 0xff5a, 1},
- },
-}
-
-var _Inscriptional_Pahlavi = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x10b60, 0x10b72, 1},
- {0x10b78, 0x10b7f, 1},
+ {0x0531, 0x0556, 1},
+ {0x0559, 0x055f, 1},
+ {0x0561, 0x0587, 1},
+ {0x058a, 0x058a, 1},
+ {0xfb13, 0xfb17, 1},
},
}
-var _Osmanya = &RangeTable{
+var _Avestan = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x10480, 0x1049d, 1},
- {0x104a0, 0x104a9, 1},
+ {0x10b00, 0x10b35, 1},
+ {0x10b39, 0x10b3f, 1},
},
}
-var _Khmer = &RangeTable{
+var _Balinese = &RangeTable{
R16: []Range16{
- {0x1780, 0x17dd, 1},
- {0x17e0, 0x17e9, 1},
- {0x17f0, 0x17f9, 1},
- {0x19e0, 0x19ff, 1},
+ {0x1b00, 0x1b4b, 1},
+ {0x1b50, 0x1b7c, 1},
},
}
-var _Inherited = &RangeTable{
+var _Bamum = &RangeTable{
R16: []Range16{
- {0x0300, 0x036f, 1},
- {0x0485, 0x0486, 1},
- {0x064b, 0x0655, 1},
- {0x065f, 0x065f, 1},
- {0x0670, 0x0670, 1},
- {0x0951, 0x0952, 1},
- {0x1cd0, 0x1cd2, 1},
- {0x1cd4, 0x1ce0, 1},
- {0x1ce2, 0x1ce8, 1},
- {0x1ced, 0x1ced, 1},
- {0x1dc0, 0x1de6, 1},
- {0x1dfc, 0x1dff, 1},
- {0x200c, 0x200d, 1},
- {0x20d0, 0x20f0, 1},
- {0x302a, 0x302d, 1},
- {0x3099, 0x309a, 1},
- {0xfe00, 0xfe0f, 1},
- {0xfe20, 0xfe26, 1},
+ {0xa6a0, 0xa6f7, 1},
},
R32: []Range32{
- {0x101fd, 0x101fd, 1},
- {0x1d167, 0x1d169, 1},
- {0x1d17b, 0x1d182, 1},
- {0x1d185, 0x1d18b, 1},
- {0x1d1aa, 0x1d1ad, 1},
- {0xe0100, 0xe01ef, 1},
+ {0x16800, 0x16a38, 1},
},
}
-var _Telugu = &RangeTable{
+var _Batak = &RangeTable{
R16: []Range16{
- {0x0c01, 0x0c03, 1},
- {0x0c05, 0x0c0c, 1},
- {0x0c0e, 0x0c10, 1},
- {0x0c12, 0x0c28, 1},
- {0x0c2a, 0x0c33, 1},
- {0x0c35, 0x0c39, 1},
- {0x0c3d, 0x0c44, 1},
- {0x0c46, 0x0c48, 1},
- {0x0c4a, 0x0c4d, 1},
- {0x0c55, 0x0c56, 1},
- {0x0c58, 0x0c59, 1},
- {0x0c60, 0x0c63, 1},
- {0x0c66, 0x0c6f, 1},
- {0x0c78, 0x0c7f, 1},
+ {0x1bc0, 0x1bf3, 1},
+ {0x1bfc, 0x1bff, 1},
},
}
-var _Samaritan = &RangeTable{
+var _Bengali = &RangeTable{
R16: []Range16{
- {0x0800, 0x082d, 1},
- {0x0830, 0x083e, 1},
+ {0x0981, 0x0983, 1},
+ {0x0985, 0x098c, 1},
+ {0x098f, 0x0990, 1},
+ {0x0993, 0x09a8, 1},
+ {0x09aa, 0x09b0, 1},
+ {0x09b2, 0x09b2, 1},
+ {0x09b6, 0x09b9, 1},
+ {0x09bc, 0x09c4, 1},
+ {0x09c7, 0x09c8, 1},
+ {0x09cb, 0x09ce, 1},
+ {0x09d7, 0x09d7, 1},
+ {0x09dc, 0x09dd, 1},
+ {0x09df, 0x09e3, 1},
+ {0x09e6, 0x09fb, 1},
},
}
@@ -3024,68 +2948,59 @@ var _Bopomofo = &RangeTable{
},
}
-var _Imperial_Aramaic = &RangeTable{
+var _Brahmi = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x10840, 0x10855, 1},
- {0x10857, 0x1085f, 1},
+ {0x11000, 0x1104d, 1},
+ {0x11052, 0x1106f, 1},
},
}
-var _Kaithi = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x11080, 0x110c1, 1},
+var _Braille = &RangeTable{
+ R16: []Range16{
+ {0x2800, 0x28ff, 1},
},
}
-var _Mandaic = &RangeTable{
+var _Buginese = &RangeTable{
R16: []Range16{
- {0x0840, 0x085b, 1},
- {0x085e, 0x085e, 1},
+ {0x1a00, 0x1a1b, 1},
+ {0x1a1e, 0x1a1f, 1},
},
}
-var _Old_South_Arabian = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x10a60, 0x10a7f, 1},
+var _Buhid = &RangeTable{
+ R16: []Range16{
+ {0x1740, 0x1753, 1},
},
}
-var _Kayah_Li = &RangeTable{
+var _Canadian_Aboriginal = &RangeTable{
R16: []Range16{
- {0xa900, 0xa92f, 1},
+ {0x1400, 0x167f, 1},
+ {0x18b0, 0x18f5, 1},
},
}
-var _New_Tai_Lue = &RangeTable{
- R16: []Range16{
- {0x1980, 0x19ab, 1},
- {0x19b0, 0x19c9, 1},
- {0x19d0, 0x19da, 1},
- {0x19de, 0x19df, 1},
+var _Carian = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x102a0, 0x102d0, 1},
},
}
-var _Tai_Le = &RangeTable{
+var _Cham = &RangeTable{
R16: []Range16{
- {0x1950, 0x196d, 1},
- {0x1970, 0x1974, 1},
+ {0xaa00, 0xaa36, 1},
+ {0xaa40, 0xaa4d, 1},
+ {0xaa50, 0xaa59, 1},
+ {0xaa5c, 0xaa5f, 1},
},
}
-var _Kharoshthi = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x10a00, 0x10a03, 1},
- {0x10a05, 0x10a06, 1},
- {0x10a0c, 0x10a13, 1},
- {0x10a15, 0x10a17, 1},
- {0x10a19, 0x10a33, 1},
- {0x10a38, 0x10a3a, 1},
- {0x10a3f, 0x10a47, 1},
- {0x10a50, 0x10a58, 1},
+var _Cherokee = &RangeTable{
+ R16: []Range16{
+ {0x13a0, 0x13f4, 1},
},
}
@@ -3265,147 +3180,62 @@ var _Common = &RangeTable{
},
}
-var _Kannada = &RangeTable{
+var _Coptic = &RangeTable{
R16: []Range16{
- {0x0c82, 0x0c83, 1},
- {0x0c85, 0x0c8c, 1},
- {0x0c8e, 0x0c90, 1},
- {0x0c92, 0x0ca8, 1},
- {0x0caa, 0x0cb3, 1},
- {0x0cb5, 0x0cb9, 1},
- {0x0cbc, 0x0cc4, 1},
- {0x0cc6, 0x0cc8, 1},
- {0x0cca, 0x0ccd, 1},
- {0x0cd5, 0x0cd6, 1},
- {0x0cde, 0x0cde, 1},
- {0x0ce0, 0x0ce3, 1},
- {0x0ce6, 0x0cef, 1},
- {0x0cf1, 0x0cf2, 1},
+ {0x03e2, 0x03ef, 1},
+ {0x2c80, 0x2cf1, 1},
+ {0x2cf9, 0x2cff, 1},
},
}
-var _Old_Turkic = &RangeTable{
+var _Cuneiform = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x10c00, 0x10c48, 1},
- },
-}
-
-var _Tamil = &RangeTable{
- R16: []Range16{
- {0x0b82, 0x0b83, 1},
- {0x0b85, 0x0b8a, 1},
- {0x0b8e, 0x0b90, 1},
- {0x0b92, 0x0b95, 1},
- {0x0b99, 0x0b9a, 1},
- {0x0b9c, 0x0b9c, 1},
- {0x0b9e, 0x0b9f, 1},
- {0x0ba3, 0x0ba4, 1},
- {0x0ba8, 0x0baa, 1},
- {0x0bae, 0x0bb9, 1},
- {0x0bbe, 0x0bc2, 1},
- {0x0bc6, 0x0bc8, 1},
- {0x0bca, 0x0bcd, 1},
- {0x0bd0, 0x0bd0, 1},
- {0x0bd7, 0x0bd7, 1},
- {0x0be6, 0x0bfa, 1},
- },
-}
-
-var _Tagalog = &RangeTable{
- R16: []Range16{
- {0x1700, 0x170c, 1},
- {0x170e, 0x1714, 1},
+ {0x12000, 0x1236e, 1},
+ {0x12400, 0x12462, 1},
+ {0x12470, 0x12473, 1},
},
}
-var _Brahmi = &RangeTable{
+var _Cypriot = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x11000, 0x1104d, 1},
- {0x11052, 0x1106f, 1},
- },
-}
-
-var _Arabic = &RangeTable{
- R16: []Range16{
- {0x0600, 0x0603, 1},
- {0x0606, 0x060b, 1},
- {0x060d, 0x061a, 1},
- {0x061e, 0x061e, 1},
- {0x0620, 0x063f, 1},
- {0x0641, 0x064a, 1},
- {0x0656, 0x065e, 1},
- {0x066a, 0x066f, 1},
- {0x0671, 0x06dc, 1},
- {0x06de, 0x06ff, 1},
- {0x0750, 0x077f, 1},
- {0xfb50, 0xfbc1, 1},
- {0xfbd3, 0xfd3d, 1},
- {0xfd50, 0xfd8f, 1},
- {0xfd92, 0xfdc7, 1},
- {0xfdf0, 0xfdfc, 1},
- {0xfe70, 0xfe74, 1},
- {0xfe76, 0xfefc, 1},
- },
- R32: []Range32{
- {0x10e60, 0x10e7e, 1},
- },
-}
-
-var _Tagbanwa = &RangeTable{
- R16: []Range16{
- {0x1760, 0x176c, 1},
- {0x176e, 0x1770, 1},
- {0x1772, 0x1773, 1},
- },
-}
-
-var _Canadian_Aboriginal = &RangeTable{
- R16: []Range16{
- {0x1400, 0x167f, 1},
- {0x18b0, 0x18f5, 1},
- },
-}
-
-var _Tibetan = &RangeTable{
- R16: []Range16{
- {0x0f00, 0x0f47, 1},
- {0x0f49, 0x0f6c, 1},
- {0x0f71, 0x0f97, 1},
- {0x0f99, 0x0fbc, 1},
- {0x0fbe, 0x0fcc, 1},
- {0x0fce, 0x0fd4, 1},
- {0x0fd9, 0x0fda, 1},
+ {0x10800, 0x10805, 1},
+ {0x10808, 0x10808, 1},
+ {0x1080a, 0x10835, 1},
+ {0x10837, 0x10838, 1},
+ {0x1083c, 0x1083c, 1},
+ {0x1083f, 0x1083f, 1},
},
}
-var _Coptic = &RangeTable{
+var _Cyrillic = &RangeTable{
R16: []Range16{
- {0x03e2, 0x03ef, 1},
- {0x2c80, 0x2cf1, 1},
- {0x2cf9, 0x2cff, 1},
+ {0x0400, 0x0484, 1},
+ {0x0487, 0x0527, 1},
+ {0x1d2b, 0x1d2b, 1},
+ {0x1d78, 0x1d78, 1},
+ {0x2de0, 0x2dff, 1},
+ {0xa640, 0xa673, 1},
+ {0xa67c, 0xa697, 1},
},
}
-var _Hiragana = &RangeTable{
- R16: []Range16{
- {0x3041, 0x3096, 1},
- {0x309d, 0x309f, 1},
- },
+var _Deseret = &RangeTable{
+ R16: []Range16{},
R32: []Range32{
- {0x1b001, 0x1b001, 1},
- {0x1f200, 0x1f200, 1},
+ {0x10400, 0x1044f, 1},
},
}
-var _Limbu = &RangeTable{
+var _Devanagari = &RangeTable{
R16: []Range16{
- {0x1900, 0x191c, 1},
- {0x1920, 0x192b, 1},
- {0x1930, 0x193b, 1},
- {0x1940, 0x1940, 1},
- {0x1944, 0x194f, 1},
+ {0x0900, 0x0950, 1},
+ {0x0953, 0x0963, 1},
+ {0x0966, 0x096f, 1},
+ {0x0971, 0x0977, 1},
+ {0x0979, 0x097f, 1},
+ {0xa8e0, 0xa8fb, 1},
},
}
@@ -3416,63 +3246,63 @@ var _Egyptian_Hieroglyphs = &RangeTable{
},
}
-var _Avestan = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x10b00, 0x10b35, 1},
- {0x10b39, 0x10b3f, 1},
- },
-}
-
-var _Myanmar = &RangeTable{
+var _Ethiopic = &RangeTable{
R16: []Range16{
- {0x1000, 0x109f, 1},
- {0xaa60, 0xaa7b, 1},
+ {0x1200, 0x1248, 1},
+ {0x124a, 0x124d, 1},
+ {0x1250, 0x1256, 1},
+ {0x1258, 0x1258, 1},
+ {0x125a, 0x125d, 1},
+ {0x1260, 0x1288, 1},
+ {0x128a, 0x128d, 1},
+ {0x1290, 0x12b0, 1},
+ {0x12b2, 0x12b5, 1},
+ {0x12b8, 0x12be, 1},
+ {0x12c0, 0x12c0, 1},
+ {0x12c2, 0x12c5, 1},
+ {0x12c8, 0x12d6, 1},
+ {0x12d8, 0x1310, 1},
+ {0x1312, 0x1315, 1},
+ {0x1318, 0x135a, 1},
+ {0x135d, 0x137c, 1},
+ {0x1380, 0x1399, 1},
+ {0x2d80, 0x2d96, 1},
+ {0x2da0, 0x2da6, 1},
+ {0x2da8, 0x2dae, 1},
+ {0x2db0, 0x2db6, 1},
+ {0x2db8, 0x2dbe, 1},
+ {0x2dc0, 0x2dc6, 1},
+ {0x2dc8, 0x2dce, 1},
+ {0x2dd0, 0x2dd6, 1},
+ {0x2dd8, 0x2dde, 1},
+ {0xab01, 0xab06, 1},
+ {0xab09, 0xab0e, 1},
+ {0xab11, 0xab16, 1},
+ {0xab20, 0xab26, 1},
+ {0xab28, 0xab2e, 1},
},
}
-var _Armenian = &RangeTable{
+var _Georgian = &RangeTable{
R16: []Range16{
- {0x0531, 0x0556, 1},
- {0x0559, 0x055f, 1},
- {0x0561, 0x0587, 1},
- {0x058a, 0x058a, 1},
- {0xfb13, 0xfb17, 1},
+ {0x10a0, 0x10c5, 1},
+ {0x10d0, 0x10fa, 1},
+ {0x10fc, 0x10fc, 1},
+ {0x2d00, 0x2d25, 1},
},
}
-var _Sinhala = &RangeTable{
+var _Glagolitic = &RangeTable{
R16: []Range16{
- {0x0d82, 0x0d83, 1},
- {0x0d85, 0x0d96, 1},
- {0x0d9a, 0x0db1, 1},
- {0x0db3, 0x0dbb, 1},
- {0x0dbd, 0x0dbd, 1},
- {0x0dc0, 0x0dc6, 1},
- {0x0dca, 0x0dca, 1},
- {0x0dcf, 0x0dd4, 1},
- {0x0dd6, 0x0dd6, 1},
- {0x0dd8, 0x0ddf, 1},
- {0x0df2, 0x0df4, 1},
+ {0x2c00, 0x2c2e, 1},
+ {0x2c30, 0x2c5e, 1},
},
}
-var _Bengali = &RangeTable{
- R16: []Range16{
- {0x0981, 0x0983, 1},
- {0x0985, 0x098c, 1},
- {0x098f, 0x0990, 1},
- {0x0993, 0x09a8, 1},
- {0x09aa, 0x09b0, 1},
- {0x09b2, 0x09b2, 1},
- {0x09b6, 0x09b9, 1},
- {0x09bc, 0x09c4, 1},
- {0x09c7, 0x09c8, 1},
- {0x09cb, 0x09ce, 1},
- {0x09d7, 0x09d7, 1},
- {0x09dc, 0x09dd, 1},
- {0x09df, 0x09e3, 1},
- {0x09e6, 0x09fb, 1},
+var _Gothic = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x10330, 0x1034a, 1},
},
}
@@ -3516,40 +3346,66 @@ var _Greek = &RangeTable{
},
}
-var _Cham = &RangeTable{
+var _Gujarati = &RangeTable{
R16: []Range16{
- {0xaa00, 0xaa36, 1},
- {0xaa40, 0xaa4d, 1},
- {0xaa50, 0xaa59, 1},
- {0xaa5c, 0xaa5f, 1},
+ {0x0a81, 0x0a83, 1},
+ {0x0a85, 0x0a8d, 1},
+ {0x0a8f, 0x0a91, 1},
+ {0x0a93, 0x0aa8, 1},
+ {0x0aaa, 0x0ab0, 1},
+ {0x0ab2, 0x0ab3, 1},
+ {0x0ab5, 0x0ab9, 1},
+ {0x0abc, 0x0ac5, 1},
+ {0x0ac7, 0x0ac9, 1},
+ {0x0acb, 0x0acd, 1},
+ {0x0ad0, 0x0ad0, 1},
+ {0x0ae0, 0x0ae3, 1},
+ {0x0ae6, 0x0aef, 1},
+ {0x0af1, 0x0af1, 1},
},
}
-var _Hebrew = &RangeTable{
+var _Gurmukhi = &RangeTable{
R16: []Range16{
- {0x0591, 0x05c7, 1},
- {0x05d0, 0x05ea, 1},
- {0x05f0, 0x05f4, 1},
- {0xfb1d, 0xfb36, 1},
- {0xfb38, 0xfb3c, 1},
- {0xfb3e, 0xfb3e, 1},
- {0xfb40, 0xfb41, 1},
- {0xfb43, 0xfb44, 1},
- {0xfb46, 0xfb4f, 1},
+ {0x0a01, 0x0a03, 1},
+ {0x0a05, 0x0a0a, 1},
+ {0x0a0f, 0x0a10, 1},
+ {0x0a13, 0x0a28, 1},
+ {0x0a2a, 0x0a30, 1},
+ {0x0a32, 0x0a33, 1},
+ {0x0a35, 0x0a36, 1},
+ {0x0a38, 0x0a39, 1},
+ {0x0a3c, 0x0a3c, 1},
+ {0x0a3e, 0x0a42, 1},
+ {0x0a47, 0x0a48, 1},
+ {0x0a4b, 0x0a4d, 1},
+ {0x0a51, 0x0a51, 1},
+ {0x0a59, 0x0a5c, 1},
+ {0x0a5e, 0x0a5e, 1},
+ {0x0a66, 0x0a75, 1},
},
}
-var _Meetei_Mayek = &RangeTable{
+var _Han = &RangeTable{
R16: []Range16{
- {0xabc0, 0xabed, 1},
- {0xabf0, 0xabf9, 1},
+ {0x2e80, 0x2e99, 1},
+ {0x2e9b, 0x2ef3, 1},
+ {0x2f00, 0x2fd5, 1},
+ {0x3005, 0x3005, 1},
+ {0x3007, 0x3007, 1},
+ {0x3021, 0x3029, 1},
+ {0x3038, 0x303b, 1},
+ {0x3400, 0x4db5, 1},
+ {0x4e00, 0x9fcb, 1},
+ {0xf900, 0xfa2d, 1},
+ {0xfa30, 0xfa6d, 1},
+ {0xfa70, 0xfad9, 1},
},
-}
-
-var _Saurashtra = &RangeTable{
- R16: []Range16{
- {0xa880, 0xa8c4, 1},
- {0xa8ce, 0xa8d9, 1},
+ R32: []Range32{
+ {0x20000, 0x2a6d6, 1},
+ {0x2a700, 0x2b734, 1},
+ {0x2b740, 0x2b81d, 1},
+ {0x2f800, 0x2fa1d, 1},
},
}
@@ -3572,183 +3428,307 @@ var _Hangul = &RangeTable{
},
}
-var _Runic = &RangeTable{
+var _Hanunoo = &RangeTable{
R16: []Range16{
- {0x16a0, 0x16ea, 1},
- {0x16ee, 0x16f0, 1},
+ {0x1720, 0x1734, 1},
},
}
-var _Deseret = &RangeTable{
+var _Hebrew = &RangeTable{
+ R16: []Range16{
+ {0x0591, 0x05c7, 1},
+ {0x05d0, 0x05ea, 1},
+ {0x05f0, 0x05f4, 1},
+ {0xfb1d, 0xfb36, 1},
+ {0xfb38, 0xfb3c, 1},
+ {0xfb3e, 0xfb3e, 1},
+ {0xfb40, 0xfb41, 1},
+ {0xfb43, 0xfb44, 1},
+ {0xfb46, 0xfb4f, 1},
+ },
+}
+
+var _Hiragana = &RangeTable{
+ R16: []Range16{
+ {0x3041, 0x3096, 1},
+ {0x309d, 0x309f, 1},
+ },
+ R32: []Range32{
+ {0x1b001, 0x1b001, 1},
+ {0x1f200, 0x1f200, 1},
+ },
+}
+
+var _Imperial_Aramaic = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x10400, 0x1044f, 1},
+ {0x10840, 0x10855, 1},
+ {0x10857, 0x1085f, 1},
},
}
-var _Lisu = &RangeTable{
+var _Inherited = &RangeTable{
R16: []Range16{
- {0xa4d0, 0xa4ff, 1},
+ {0x0300, 0x036f, 1},
+ {0x0485, 0x0486, 1},
+ {0x064b, 0x0655, 1},
+ {0x065f, 0x065f, 1},
+ {0x0670, 0x0670, 1},
+ {0x0951, 0x0952, 1},
+ {0x1cd0, 0x1cd2, 1},
+ {0x1cd4, 0x1ce0, 1},
+ {0x1ce2, 0x1ce8, 1},
+ {0x1ced, 0x1ced, 1},
+ {0x1dc0, 0x1de6, 1},
+ {0x1dfc, 0x1dff, 1},
+ {0x200c, 0x200d, 1},
+ {0x20d0, 0x20f0, 1},
+ {0x302a, 0x302d, 1},
+ {0x3099, 0x309a, 1},
+ {0xfe00, 0xfe0f, 1},
+ {0xfe20, 0xfe26, 1},
+ },
+ R32: []Range32{
+ {0x101fd, 0x101fd, 1},
+ {0x1d167, 0x1d169, 1},
+ {0x1d17b, 0x1d182, 1},
+ {0x1d185, 0x1d18b, 1},
+ {0x1d1aa, 0x1d1ad, 1},
+ {0xe0100, 0xe01ef, 1},
},
}
-var _Sundanese = &RangeTable{
- R16: []Range16{
- {0x1b80, 0x1baa, 1},
- {0x1bae, 0x1bb9, 1},
+var _Inscriptional_Pahlavi = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x10b60, 0x10b72, 1},
+ {0x10b78, 0x10b7f, 1},
},
}
-var _Glagolitic = &RangeTable{
- R16: []Range16{
- {0x2c00, 0x2c2e, 1},
- {0x2c30, 0x2c5e, 1},
+var _Inscriptional_Parthian = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x10b40, 0x10b55, 1},
+ {0x10b58, 0x10b5f, 1},
},
}
-var _Oriya = &RangeTable{
+var _Javanese = &RangeTable{
R16: []Range16{
- {0x0b01, 0x0b03, 1},
- {0x0b05, 0x0b0c, 1},
- {0x0b0f, 0x0b10, 1},
- {0x0b13, 0x0b28, 1},
- {0x0b2a, 0x0b30, 1},
- {0x0b32, 0x0b33, 1},
- {0x0b35, 0x0b39, 1},
- {0x0b3c, 0x0b44, 1},
- {0x0b47, 0x0b48, 1},
- {0x0b4b, 0x0b4d, 1},
- {0x0b56, 0x0b57, 1},
- {0x0b5c, 0x0b5d, 1},
- {0x0b5f, 0x0b63, 1},
- {0x0b66, 0x0b77, 1},
+ {0xa980, 0xa9cd, 1},
+ {0xa9cf, 0xa9d9, 1},
+ {0xa9de, 0xa9df, 1},
},
}
-var _Buhid = &RangeTable{
+var _Kaithi = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x11080, 0x110c1, 1},
+ },
+}
+
+var _Kannada = &RangeTable{
R16: []Range16{
- {0x1740, 0x1753, 1},
+ {0x0c82, 0x0c83, 1},
+ {0x0c85, 0x0c8c, 1},
+ {0x0c8e, 0x0c90, 1},
+ {0x0c92, 0x0ca8, 1},
+ {0x0caa, 0x0cb3, 1},
+ {0x0cb5, 0x0cb9, 1},
+ {0x0cbc, 0x0cc4, 1},
+ {0x0cc6, 0x0cc8, 1},
+ {0x0cca, 0x0ccd, 1},
+ {0x0cd5, 0x0cd6, 1},
+ {0x0cde, 0x0cde, 1},
+ {0x0ce0, 0x0ce3, 1},
+ {0x0ce6, 0x0cef, 1},
+ {0x0cf1, 0x0cf2, 1},
},
}
-var _Ethiopic = &RangeTable{
+var _Katakana = &RangeTable{
R16: []Range16{
- {0x1200, 0x1248, 1},
- {0x124a, 0x124d, 1},
- {0x1250, 0x1256, 1},
- {0x1258, 0x1258, 1},
- {0x125a, 0x125d, 1},
- {0x1260, 0x1288, 1},
- {0x128a, 0x128d, 1},
- {0x1290, 0x12b0, 1},
- {0x12b2, 0x12b5, 1},
- {0x12b8, 0x12be, 1},
- {0x12c0, 0x12c0, 1},
- {0x12c2, 0x12c5, 1},
- {0x12c8, 0x12d6, 1},
- {0x12d8, 0x1310, 1},
- {0x1312, 0x1315, 1},
- {0x1318, 0x135a, 1},
- {0x135d, 0x137c, 1},
- {0x1380, 0x1399, 1},
- {0x2d80, 0x2d96, 1},
- {0x2da0, 0x2da6, 1},
- {0x2da8, 0x2dae, 1},
- {0x2db0, 0x2db6, 1},
- {0x2db8, 0x2dbe, 1},
- {0x2dc0, 0x2dc6, 1},
- {0x2dc8, 0x2dce, 1},
- {0x2dd0, 0x2dd6, 1},
- {0x2dd8, 0x2dde, 1},
- {0xab01, 0xab06, 1},
- {0xab09, 0xab0e, 1},
- {0xab11, 0xab16, 1},
- {0xab20, 0xab26, 1},
- {0xab28, 0xab2e, 1},
+ {0x30a1, 0x30fa, 1},
+ {0x30fd, 0x30ff, 1},
+ {0x31f0, 0x31ff, 1},
+ {0x32d0, 0x32fe, 1},
+ {0x3300, 0x3357, 1},
+ {0xff66, 0xff6f, 1},
+ {0xff71, 0xff9d, 1},
+ },
+ R32: []Range32{
+ {0x1b000, 0x1b000, 1},
},
}
-var _Javanese = &RangeTable{
+var _Kayah_Li = &RangeTable{
R16: []Range16{
- {0xa980, 0xa9cd, 1},
- {0xa9cf, 0xa9d9, 1},
- {0xa9de, 0xa9df, 1},
+ {0xa900, 0xa92f, 1},
},
}
-var _Syloti_Nagri = &RangeTable{
+var _Kharoshthi = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x10a00, 0x10a03, 1},
+ {0x10a05, 0x10a06, 1},
+ {0x10a0c, 0x10a13, 1},
+ {0x10a15, 0x10a17, 1},
+ {0x10a19, 0x10a33, 1},
+ {0x10a38, 0x10a3a, 1},
+ {0x10a3f, 0x10a47, 1},
+ {0x10a50, 0x10a58, 1},
+ },
+}
+
+var _Khmer = &RangeTable{
R16: []Range16{
- {0xa800, 0xa82b, 1},
+ {0x1780, 0x17dd, 1},
+ {0x17e0, 0x17e9, 1},
+ {0x17f0, 0x17f9, 1},
+ {0x19e0, 0x19ff, 1},
},
}
-var _Vai = &RangeTable{
+var _Lao = &RangeTable{
R16: []Range16{
- {0xa500, 0xa62b, 1},
+ {0x0e81, 0x0e82, 1},
+ {0x0e84, 0x0e84, 1},
+ {0x0e87, 0x0e88, 1},
+ {0x0e8a, 0x0e8a, 1},
+ {0x0e8d, 0x0e8d, 1},
+ {0x0e94, 0x0e97, 1},
+ {0x0e99, 0x0e9f, 1},
+ {0x0ea1, 0x0ea3, 1},
+ {0x0ea5, 0x0ea5, 1},
+ {0x0ea7, 0x0ea7, 1},
+ {0x0eaa, 0x0eab, 1},
+ {0x0ead, 0x0eb9, 1},
+ {0x0ebb, 0x0ebd, 1},
+ {0x0ec0, 0x0ec4, 1},
+ {0x0ec6, 0x0ec6, 1},
+ {0x0ec8, 0x0ecd, 1},
+ {0x0ed0, 0x0ed9, 1},
+ {0x0edc, 0x0edd, 1},
},
}
-var _Cherokee = &RangeTable{
+var _Latin = &RangeTable{
R16: []Range16{
- {0x13a0, 0x13f4, 1},
+ {0x0041, 0x005a, 1},
+ {0x0061, 0x007a, 1},
+ {0x00aa, 0x00aa, 1},
+ {0x00ba, 0x00ba, 1},
+ {0x00c0, 0x00d6, 1},
+ {0x00d8, 0x00f6, 1},
+ {0x00f8, 0x02b8, 1},
+ {0x02e0, 0x02e4, 1},
+ {0x1d00, 0x1d25, 1},
+ {0x1d2c, 0x1d5c, 1},
+ {0x1d62, 0x1d65, 1},
+ {0x1d6b, 0x1d77, 1},
+ {0x1d79, 0x1dbe, 1},
+ {0x1e00, 0x1eff, 1},
+ {0x2071, 0x2071, 1},
+ {0x207f, 0x207f, 1},
+ {0x2090, 0x209c, 1},
+ {0x212a, 0x212b, 1},
+ {0x2132, 0x2132, 1},
+ {0x214e, 0x214e, 1},
+ {0x2160, 0x2188, 1},
+ {0x2c60, 0x2c7f, 1},
+ {0xa722, 0xa787, 1},
+ {0xa78b, 0xa78e, 1},
+ {0xa790, 0xa791, 1},
+ {0xa7a0, 0xa7a9, 1},
+ {0xa7fa, 0xa7ff, 1},
+ {0xfb00, 0xfb06, 1},
+ {0xff21, 0xff3a, 1},
+ {0xff41, 0xff5a, 1},
},
}
-var _Ogham = &RangeTable{
+var _Lepcha = &RangeTable{
R16: []Range16{
- {0x1680, 0x169c, 1},
+ {0x1c00, 0x1c37, 1},
+ {0x1c3b, 0x1c49, 1},
+ {0x1c4d, 0x1c4f, 1},
},
}
-var _Batak = &RangeTable{
+var _Limbu = &RangeTable{
R16: []Range16{
- {0x1bc0, 0x1bf3, 1},
- {0x1bfc, 0x1bff, 1},
+ {0x1900, 0x191c, 1},
+ {0x1920, 0x192b, 1},
+ {0x1930, 0x193b, 1},
+ {0x1940, 0x1940, 1},
+ {0x1944, 0x194f, 1},
},
}
-var _Syriac = &RangeTable{
+var _Linear_B = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x10000, 0x1000b, 1},
+ {0x1000d, 0x10026, 1},
+ {0x10028, 0x1003a, 1},
+ {0x1003c, 0x1003d, 1},
+ {0x1003f, 0x1004d, 1},
+ {0x10050, 0x1005d, 1},
+ {0x10080, 0x100fa, 1},
+ },
+}
+
+var _Lisu = &RangeTable{
R16: []Range16{
- {0x0700, 0x070d, 1},
- {0x070f, 0x074a, 1},
- {0x074d, 0x074f, 1},
+ {0xa4d0, 0xa4ff, 1},
},
}
-var _Gurmukhi = &RangeTable{
+var _Lycian = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x10280, 0x1029c, 1},
+ },
+}
+
+var _Lydian = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x10920, 0x10939, 1},
+ {0x1093f, 0x1093f, 1},
+ },
+}
+
+var _Malayalam = &RangeTable{
R16: []Range16{
- {0x0a01, 0x0a03, 1},
- {0x0a05, 0x0a0a, 1},
- {0x0a0f, 0x0a10, 1},
- {0x0a13, 0x0a28, 1},
- {0x0a2a, 0x0a30, 1},
- {0x0a32, 0x0a33, 1},
- {0x0a35, 0x0a36, 1},
- {0x0a38, 0x0a39, 1},
- {0x0a3c, 0x0a3c, 1},
- {0x0a3e, 0x0a42, 1},
- {0x0a47, 0x0a48, 1},
- {0x0a4b, 0x0a4d, 1},
- {0x0a51, 0x0a51, 1},
- {0x0a59, 0x0a5c, 1},
- {0x0a5e, 0x0a5e, 1},
- {0x0a66, 0x0a75, 1},
+ {0x0d02, 0x0d03, 1},
+ {0x0d05, 0x0d0c, 1},
+ {0x0d0e, 0x0d10, 1},
+ {0x0d12, 0x0d3a, 1},
+ {0x0d3d, 0x0d44, 1},
+ {0x0d46, 0x0d48, 1},
+ {0x0d4a, 0x0d4e, 1},
+ {0x0d57, 0x0d57, 1},
+ {0x0d60, 0x0d63, 1},
+ {0x0d66, 0x0d75, 1},
+ {0x0d79, 0x0d7f, 1},
},
}
-var _Tai_Tham = &RangeTable{
+var _Mandaic = &RangeTable{
R16: []Range16{
- {0x1a20, 0x1a5e, 1},
- {0x1a60, 0x1a7c, 1},
- {0x1a7f, 0x1a89, 1},
- {0x1a90, 0x1a99, 1},
- {0x1aa0, 0x1aad, 1},
+ {0x0840, 0x085b, 1},
+ {0x085e, 0x085e, 1},
},
}
-var _Ol_Chiki = &RangeTable{
+var _Meetei_Mayek = &RangeTable{
R16: []Range16{
- {0x1c50, 0x1c7f, 1},
+ {0xabc0, 0xabed, 1},
+ {0xabf0, 0xabf9, 1},
},
}
@@ -3763,51 +3743,45 @@ var _Mongolian = &RangeTable{
},
}
-var _Hanunoo = &RangeTable{
+var _Myanmar = &RangeTable{
R16: []Range16{
- {0x1720, 0x1734, 1},
+ {0x1000, 0x109f, 1},
+ {0xaa60, 0xaa7b, 1},
},
}
-var _Cypriot = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x10800, 0x10805, 1},
- {0x10808, 0x10808, 1},
- {0x1080a, 0x10835, 1},
- {0x10837, 0x10838, 1},
- {0x1083c, 0x1083c, 1},
- {0x1083f, 0x1083f, 1},
+var _New_Tai_Lue = &RangeTable{
+ R16: []Range16{
+ {0x1980, 0x19ab, 1},
+ {0x19b0, 0x19c9, 1},
+ {0x19d0, 0x19da, 1},
+ {0x19de, 0x19df, 1},
},
}
-var _Buginese = &RangeTable{
+var _Nko = &RangeTable{
R16: []Range16{
- {0x1a00, 0x1a1b, 1},
- {0x1a1e, 0x1a1f, 1},
+ {0x07c0, 0x07fa, 1},
},
}
-var _Bamum = &RangeTable{
+var _Ogham = &RangeTable{
R16: []Range16{
- {0xa6a0, 0xa6f7, 1},
- },
- R32: []Range32{
- {0x16800, 0x16a38, 1},
+ {0x1680, 0x169c, 1},
},
}
-var _Lepcha = &RangeTable{
+var _Ol_Chiki = &RangeTable{
R16: []Range16{
- {0x1c00, 0x1c37, 1},
- {0x1c3b, 0x1c49, 1},
- {0x1c4d, 0x1c4f, 1},
+ {0x1c50, 0x1c7f, 1},
},
}
-var _Thaana = &RangeTable{
- R16: []Range16{
- {0x0780, 0x07b1, 1},
+var _Old_Italic = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x10300, 0x1031e, 1},
+ {0x10320, 0x10323, 1},
},
}
@@ -3819,237 +3793,263 @@ var _Old_Persian = &RangeTable{
},
}
-var _Cuneiform = &RangeTable{
+var _Old_South_Arabian = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x12000, 0x1236e, 1},
- {0x12400, 0x12462, 1},
- {0x12470, 0x12473, 1},
+ {0x10a60, 0x10a7f, 1},
},
}
-var _Rejang = &RangeTable{
- R16: []Range16{
- {0xa930, 0xa953, 1},
- {0xa95f, 0xa95f, 1},
+var _Old_Turkic = &RangeTable{
+ R16: []Range16{},
+ R32: []Range32{
+ {0x10c00, 0x10c48, 1},
},
}
-var _Georgian = &RangeTable{
+var _Oriya = &RangeTable{
R16: []Range16{
- {0x10a0, 0x10c5, 1},
- {0x10d0, 0x10fa, 1},
- {0x10fc, 0x10fc, 1},
- {0x2d00, 0x2d25, 1},
+ {0x0b01, 0x0b03, 1},
+ {0x0b05, 0x0b0c, 1},
+ {0x0b0f, 0x0b10, 1},
+ {0x0b13, 0x0b28, 1},
+ {0x0b2a, 0x0b30, 1},
+ {0x0b32, 0x0b33, 1},
+ {0x0b35, 0x0b39, 1},
+ {0x0b3c, 0x0b44, 1},
+ {0x0b47, 0x0b48, 1},
+ {0x0b4b, 0x0b4d, 1},
+ {0x0b56, 0x0b57, 1},
+ {0x0b5c, 0x0b5d, 1},
+ {0x0b5f, 0x0b63, 1},
+ {0x0b66, 0x0b77, 1},
},
}
-var _Shavian = &RangeTable{
+var _Osmanya = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x10450, 0x1047f, 1},
+ {0x10480, 0x1049d, 1},
+ {0x104a0, 0x104a9, 1},
},
}
-var _Lycian = &RangeTable{
+var _Phags_Pa = &RangeTable{
+ R16: []Range16{
+ {0xa840, 0xa877, 1},
+ },
+}
+
+var _Phoenician = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x10280, 0x1029c, 1},
+ {0x10900, 0x1091b, 1},
+ {0x1091f, 0x1091f, 1},
},
}
-var _Nko = &RangeTable{
+var _Rejang = &RangeTable{
R16: []Range16{
- {0x07c0, 0x07fa, 1},
+ {0xa930, 0xa953, 1},
+ {0xa95f, 0xa95f, 1},
},
}
-var _Yi = &RangeTable{
+var _Runic = &RangeTable{
R16: []Range16{
- {0xa000, 0xa48c, 1},
- {0xa490, 0xa4c6, 1},
+ {0x16a0, 0x16ea, 1},
+ {0x16ee, 0x16f0, 1},
},
}
-var _Lao = &RangeTable{
+var _Samaritan = &RangeTable{
R16: []Range16{
- {0x0e81, 0x0e82, 1},
- {0x0e84, 0x0e84, 1},
- {0x0e87, 0x0e88, 1},
- {0x0e8a, 0x0e8a, 1},
- {0x0e8d, 0x0e8d, 1},
- {0x0e94, 0x0e97, 1},
- {0x0e99, 0x0e9f, 1},
- {0x0ea1, 0x0ea3, 1},
- {0x0ea5, 0x0ea5, 1},
- {0x0ea7, 0x0ea7, 1},
- {0x0eaa, 0x0eab, 1},
- {0x0ead, 0x0eb9, 1},
- {0x0ebb, 0x0ebd, 1},
- {0x0ec0, 0x0ec4, 1},
- {0x0ec6, 0x0ec6, 1},
- {0x0ec8, 0x0ecd, 1},
- {0x0ed0, 0x0ed9, 1},
- {0x0edc, 0x0edd, 1},
+ {0x0800, 0x082d, 1},
+ {0x0830, 0x083e, 1},
},
}
-var _Linear_B = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x10000, 0x1000b, 1},
- {0x1000d, 0x10026, 1},
- {0x10028, 0x1003a, 1},
- {0x1003c, 0x1003d, 1},
- {0x1003f, 0x1004d, 1},
- {0x10050, 0x1005d, 1},
- {0x10080, 0x100fa, 1},
+var _Saurashtra = &RangeTable{
+ R16: []Range16{
+ {0xa880, 0xa8c4, 1},
+ {0xa8ce, 0xa8d9, 1},
},
}
-var _Old_Italic = &RangeTable{
+var _Shavian = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x10300, 0x1031e, 1},
- {0x10320, 0x10323, 1},
+ {0x10450, 0x1047f, 1},
},
}
-var _Tai_Viet = &RangeTable{
+var _Sinhala = &RangeTable{
R16: []Range16{
- {0xaa80, 0xaac2, 1},
- {0xaadb, 0xaadf, 1},
+ {0x0d82, 0x0d83, 1},
+ {0x0d85, 0x0d96, 1},
+ {0x0d9a, 0x0db1, 1},
+ {0x0db3, 0x0dbb, 1},
+ {0x0dbd, 0x0dbd, 1},
+ {0x0dc0, 0x0dc6, 1},
+ {0x0dca, 0x0dca, 1},
+ {0x0dcf, 0x0dd4, 1},
+ {0x0dd6, 0x0dd6, 1},
+ {0x0dd8, 0x0ddf, 1},
+ {0x0df2, 0x0df4, 1},
},
}
-var _Devanagari = &RangeTable{
+var _Sundanese = &RangeTable{
R16: []Range16{
- {0x0900, 0x0950, 1},
- {0x0953, 0x0963, 1},
- {0x0966, 0x096f, 1},
- {0x0971, 0x0977, 1},
- {0x0979, 0x097f, 1},
- {0xa8e0, 0xa8fb, 1},
+ {0x1b80, 0x1baa, 1},
+ {0x1bae, 0x1bb9, 1},
},
}
-var _Lydian = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x10920, 0x10939, 1},
- {0x1093f, 0x1093f, 1},
+var _Syloti_Nagri = &RangeTable{
+ R16: []Range16{
+ {0xa800, 0xa82b, 1},
},
}
-var _Tifinagh = &RangeTable{
+var _Syriac = &RangeTable{
R16: []Range16{
- {0x2d30, 0x2d65, 1},
- {0x2d6f, 0x2d70, 1},
- {0x2d7f, 0x2d7f, 1},
+ {0x0700, 0x070d, 1},
+ {0x070f, 0x074a, 1},
+ {0x074d, 0x074f, 1},
},
}
-var _Ugaritic = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x10380, 0x1039d, 1},
- {0x1039f, 0x1039f, 1},
+var _Tagalog = &RangeTable{
+ R16: []Range16{
+ {0x1700, 0x170c, 1},
+ {0x170e, 0x1714, 1},
},
}
-var _Thai = &RangeTable{
+var _Tagbanwa = &RangeTable{
R16: []Range16{
- {0x0e01, 0x0e3a, 1},
- {0x0e40, 0x0e5b, 1},
+ {0x1760, 0x176c, 1},
+ {0x176e, 0x1770, 1},
+ {0x1772, 0x1773, 1},
},
}
-var _Cyrillic = &RangeTable{
+var _Tai_Le = &RangeTable{
R16: []Range16{
- {0x0400, 0x0484, 1},
- {0x0487, 0x0527, 1},
- {0x1d2b, 0x1d2b, 1},
- {0x1d78, 0x1d78, 1},
- {0x2de0, 0x2dff, 1},
- {0xa640, 0xa673, 1},
- {0xa67c, 0xa697, 1},
+ {0x1950, 0x196d, 1},
+ {0x1970, 0x1974, 1},
},
}
-var _Gujarati = &RangeTable{
+var _Tai_Tham = &RangeTable{
R16: []Range16{
- {0x0a81, 0x0a83, 1},
- {0x0a85, 0x0a8d, 1},
- {0x0a8f, 0x0a91, 1},
- {0x0a93, 0x0aa8, 1},
- {0x0aaa, 0x0ab0, 1},
- {0x0ab2, 0x0ab3, 1},
- {0x0ab5, 0x0ab9, 1},
- {0x0abc, 0x0ac5, 1},
- {0x0ac7, 0x0ac9, 1},
- {0x0acb, 0x0acd, 1},
- {0x0ad0, 0x0ad0, 1},
- {0x0ae0, 0x0ae3, 1},
- {0x0ae6, 0x0aef, 1},
- {0x0af1, 0x0af1, 1},
+ {0x1a20, 0x1a5e, 1},
+ {0x1a60, 0x1a7c, 1},
+ {0x1a7f, 0x1a89, 1},
+ {0x1a90, 0x1a99, 1},
+ {0x1aa0, 0x1aad, 1},
},
}
-var _Carian = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x102a0, 0x102d0, 1},
+var _Tai_Viet = &RangeTable{
+ R16: []Range16{
+ {0xaa80, 0xaac2, 1},
+ {0xaadb, 0xaadf, 1},
},
}
-var _Phoenician = &RangeTable{
- R16: []Range16{},
- R32: []Range32{
- {0x10900, 0x1091b, 1},
- {0x1091f, 0x1091f, 1},
+var _Tamil = &RangeTable{
+ R16: []Range16{
+ {0x0b82, 0x0b83, 1},
+ {0x0b85, 0x0b8a, 1},
+ {0x0b8e, 0x0b90, 1},
+ {0x0b92, 0x0b95, 1},
+ {0x0b99, 0x0b9a, 1},
+ {0x0b9c, 0x0b9c, 1},
+ {0x0b9e, 0x0b9f, 1},
+ {0x0ba3, 0x0ba4, 1},
+ {0x0ba8, 0x0baa, 1},
+ {0x0bae, 0x0bb9, 1},
+ {0x0bbe, 0x0bc2, 1},
+ {0x0bc6, 0x0bc8, 1},
+ {0x0bca, 0x0bcd, 1},
+ {0x0bd0, 0x0bd0, 1},
+ {0x0bd7, 0x0bd7, 1},
+ {0x0be6, 0x0bfa, 1},
},
}
-var _Balinese = &RangeTable{
+var _Telugu = &RangeTable{
R16: []Range16{
- {0x1b00, 0x1b4b, 1},
- {0x1b50, 0x1b7c, 1},
+ {0x0c01, 0x0c03, 1},
+ {0x0c05, 0x0c0c, 1},
+ {0x0c0e, 0x0c10, 1},
+ {0x0c12, 0x0c28, 1},
+ {0x0c2a, 0x0c33, 1},
+ {0x0c35, 0x0c39, 1},
+ {0x0c3d, 0x0c44, 1},
+ {0x0c46, 0x0c48, 1},
+ {0x0c4a, 0x0c4d, 1},
+ {0x0c55, 0x0c56, 1},
+ {0x0c58, 0x0c59, 1},
+ {0x0c60, 0x0c63, 1},
+ {0x0c66, 0x0c6f, 1},
+ {0x0c78, 0x0c7f, 1},
},
}
-var _Braille = &RangeTable{
+var _Thaana = &RangeTable{
R16: []Range16{
- {0x2800, 0x28ff, 1},
+ {0x0780, 0x07b1, 1},
},
}
-var _Han = &RangeTable{
+var _Thai = &RangeTable{
R16: []Range16{
- {0x2e80, 0x2e99, 1},
- {0x2e9b, 0x2ef3, 1},
- {0x2f00, 0x2fd5, 1},
- {0x3005, 0x3005, 1},
- {0x3007, 0x3007, 1},
- {0x3021, 0x3029, 1},
- {0x3038, 0x303b, 1},
- {0x3400, 0x4db5, 1},
- {0x4e00, 0x9fcb, 1},
- {0xf900, 0xfa2d, 1},
- {0xfa30, 0xfa6d, 1},
- {0xfa70, 0xfad9, 1},
+ {0x0e01, 0x0e3a, 1},
+ {0x0e40, 0x0e5b, 1},
},
- R32: []Range32{
- {0x20000, 0x2a6d6, 1},
- {0x2a700, 0x2b734, 1},
- {0x2b740, 0x2b81d, 1},
- {0x2f800, 0x2fa1d, 1},
+}
+
+var _Tibetan = &RangeTable{
+ R16: []Range16{
+ {0x0f00, 0x0f47, 1},
+ {0x0f49, 0x0f6c, 1},
+ {0x0f71, 0x0f97, 1},
+ {0x0f99, 0x0fbc, 1},
+ {0x0fbe, 0x0fcc, 1},
+ {0x0fce, 0x0fd4, 1},
+ {0x0fd9, 0x0fda, 1},
},
}
-var _Gothic = &RangeTable{
+var _Tifinagh = &RangeTable{
+ R16: []Range16{
+ {0x2d30, 0x2d65, 1},
+ {0x2d6f, 0x2d70, 1},
+ {0x2d7f, 0x2d7f, 1},
+ },
+}
+
+var _Ugaritic = &RangeTable{
R16: []Range16{},
R32: []Range32{
- {0x10330, 0x1034a, 1},
+ {0x10380, 0x1039d, 1},
+ {0x1039f, 0x1039f, 1},
+ },
+}
+
+var _Vai = &RangeTable{
+ R16: []Range16{
+ {0xa500, 0xa62b, 1},
+ },
+}
+
+var _Yi = &RangeTable{
+ R16: []Range16{
+ {0xa000, 0xa48c, 1},
+ {0xa490, 0xa4c6, 1},
},
}
@@ -4157,144 +4157,241 @@ var (
// Properties is the set of Unicode property tables.
var Properties = map[string]*RangeTable{
- "Pattern_Syntax": Pattern_Syntax,
- "Other_ID_Start": Other_ID_Start,
- "Pattern_White_Space": Pattern_White_Space,
- "Other_Lowercase": Other_Lowercase,
- "Soft_Dotted": Soft_Dotted,
- "Hex_Digit": Hex_Digit,
"ASCII_Hex_Digit": ASCII_Hex_Digit,
- "Deprecated": Deprecated,
- "Terminal_Punctuation": Terminal_Punctuation,
- "Quotation_Mark": Quotation_Mark,
- "Other_ID_Continue": Other_ID_Continue,
"Bidi_Control": Bidi_Control,
- "Variation_Selector": Variation_Selector,
- "Noncharacter_Code_Point": Noncharacter_Code_Point,
- "Other_Math": Other_Math,
- "Unified_Ideograph": Unified_Ideograph,
+ "Dash": Dash,
+ "Deprecated": Deprecated,
+ "Diacritic": Diacritic,
+ "Extender": Extender,
+ "Hex_Digit": Hex_Digit,
"Hyphen": Hyphen,
"IDS_Binary_Operator": IDS_Binary_Operator,
+ "IDS_Trinary_Operator": IDS_Trinary_Operator,
+ "Ideographic": Ideographic,
+ "Join_Control": Join_Control,
"Logical_Order_Exception": Logical_Order_Exception,
- "Radical": Radical,
- "Other_Uppercase": Other_Uppercase,
- "STerm": STerm,
+ "Noncharacter_Code_Point": Noncharacter_Code_Point,
"Other_Alphabetic": Other_Alphabetic,
- "Diacritic": Diacritic,
- "Extender": Extender,
- "Join_Control": Join_Control,
- "Ideographic": Ideographic,
- "Dash": Dash,
- "IDS_Trinary_Operator": IDS_Trinary_Operator,
- "Other_Grapheme_Extend": Other_Grapheme_Extend,
"Other_Default_Ignorable_Code_Point": Other_Default_Ignorable_Code_Point,
+ "Other_Grapheme_Extend": Other_Grapheme_Extend,
+ "Other_ID_Continue": Other_ID_Continue,
+ "Other_ID_Start": Other_ID_Start,
+ "Other_Lowercase": Other_Lowercase,
+ "Other_Math": Other_Math,
+ "Other_Uppercase": Other_Uppercase,
+ "Pattern_Syntax": Pattern_Syntax,
+ "Pattern_White_Space": Pattern_White_Space,
+ "Quotation_Mark": Quotation_Mark,
+ "Radical": Radical,
+ "STerm": STerm,
+ "Soft_Dotted": Soft_Dotted,
+ "Terminal_Punctuation": Terminal_Punctuation,
+ "Unified_Ideograph": Unified_Ideograph,
+ "Variation_Selector": Variation_Selector,
"White_Space": White_Space,
}
-var _Pattern_Syntax = &RangeTable{
+var _ASCII_Hex_Digit = &RangeTable{
R16: []Range16{
- {0x0021, 0x002f, 1},
- {0x003a, 0x0040, 1},
- {0x005b, 0x005e, 1},
- {0x0060, 0x0060, 1},
- {0x007b, 0x007e, 1},
- {0x00a1, 0x00a7, 1},
- {0x00a9, 0x00a9, 1},
- {0x00ab, 0x00ac, 1},
- {0x00ae, 0x00ae, 1},
- {0x00b0, 0x00b1, 1},
- {0x00b6, 0x00b6, 1},
- {0x00bb, 0x00bb, 1},
- {0x00bf, 0x00bf, 1},
- {0x00d7, 0x00d7, 1},
- {0x00f7, 0x00f7, 1},
- {0x2010, 0x2027, 1},
- {0x2030, 0x203e, 1},
- {0x2041, 0x2053, 1},
- {0x2055, 0x205e, 1},
- {0x2190, 0x245f, 1},
- {0x2500, 0x2775, 1},
- {0x2794, 0x2bff, 1},
- {0x2e00, 0x2e7f, 1},
- {0x3001, 0x3003, 1},
- {0x3008, 0x3020, 1},
- {0x3030, 0x3030, 1},
- {0xfd3e, 0xfd3f, 1},
- {0xfe45, 0xfe46, 1},
+ {0x0030, 0x0039, 1},
+ {0x0041, 0x0046, 1},
+ {0x0061, 0x0066, 1},
},
}
-var _Other_ID_Start = &RangeTable{
+var _Bidi_Control = &RangeTable{
R16: []Range16{
- {0x2118, 0x2118, 1},
- {0x212e, 0x212e, 1},
- {0x309b, 0x309c, 1},
+ {0x200e, 0x200f, 1},
+ {0x202a, 0x202e, 1},
},
}
-var _Pattern_White_Space = &RangeTable{
+var _Dash = &RangeTable{
R16: []Range16{
- {0x0009, 0x000d, 1},
- {0x0020, 0x0020, 1},
- {0x0085, 0x0085, 1},
- {0x200e, 0x200f, 1},
- {0x2028, 0x2029, 1},
+ {0x002d, 0x002d, 1},
+ {0x058a, 0x058a, 1},
+ {0x05be, 0x05be, 1},
+ {0x1400, 0x1400, 1},
+ {0x1806, 0x1806, 1},
+ {0x2010, 0x2015, 1},
+ {0x2053, 0x2053, 1},
+ {0x207b, 0x207b, 1},
+ {0x208b, 0x208b, 1},
+ {0x2212, 0x2212, 1},
+ {0x2e17, 0x2e17, 1},
+ {0x2e1a, 0x2e1a, 1},
+ {0x301c, 0x301c, 1},
+ {0x3030, 0x3030, 1},
+ {0x30a0, 0x30a0, 1},
+ {0xfe31, 0xfe32, 1},
+ {0xfe58, 0xfe58, 1},
+ {0xfe63, 0xfe63, 1},
+ {0xff0d, 0xff0d, 1},
},
}
-var _Other_Lowercase = &RangeTable{
+var _Deprecated = &RangeTable{
R16: []Range16{
- {0x02b0, 0x02b8, 1},
- {0x02c0, 0x02c1, 1},
- {0x02e0, 0x02e4, 1},
- {0x0345, 0x0345, 1},
- {0x037a, 0x037a, 1},
- {0x1d2c, 0x1d61, 1},
- {0x1d78, 0x1d78, 1},
- {0x1d9b, 0x1dbf, 1},
- {0x2090, 0x2094, 1},
- {0x2170, 0x217f, 1},
- {0x24d0, 0x24e9, 1},
- {0x2c7d, 0x2c7d, 1},
- {0xa770, 0xa770, 1},
+ {0x0149, 0x0149, 1},
+ {0x0673, 0x0673, 1},
+ {0x0f77, 0x0f77, 1},
+ {0x0f79, 0x0f79, 1},
+ {0x17a3, 0x17a4, 1},
+ {0x206a, 0x206f, 1},
+ {0x2329, 0x232a, 1},
+ },
+ R32: []Range32{
+ {0xe0001, 0xe0001, 1},
+ {0xe0020, 0xe007f, 1},
},
}
-var _Soft_Dotted = &RangeTable{
+var _Diacritic = &RangeTable{
R16: []Range16{
- {0x0069, 0x006a, 1},
- {0x012f, 0x012f, 1},
- {0x0249, 0x0249, 1},
- {0x0268, 0x0268, 1},
- {0x029d, 0x029d, 1},
- {0x02b2, 0x02b2, 1},
- {0x03f3, 0x03f3, 1},
- {0x0456, 0x0456, 1},
- {0x0458, 0x0458, 1},
- {0x1d62, 0x1d62, 1},
- {0x1d96, 0x1d96, 1},
- {0x1da4, 0x1da4, 1},
- {0x1da8, 0x1da8, 1},
- {0x1e2d, 0x1e2d, 1},
- {0x1ecb, 0x1ecb, 1},
- {0x2071, 0x2071, 1},
- {0x2148, 0x2149, 1},
- {0x2c7c, 0x2c7c, 1},
+ {0x005e, 0x005e, 1},
+ {0x0060, 0x0060, 1},
+ {0x00a8, 0x00a8, 1},
+ {0x00af, 0x00af, 1},
+ {0x00b4, 0x00b4, 1},
+ {0x00b7, 0x00b8, 1},
+ {0x02b0, 0x034e, 1},
+ {0x0350, 0x0357, 1},
+ {0x035d, 0x0362, 1},
+ {0x0374, 0x0375, 1},
+ {0x037a, 0x037a, 1},
+ {0x0384, 0x0385, 1},
+ {0x0483, 0x0487, 1},
+ {0x0559, 0x0559, 1},
+ {0x0591, 0x05a1, 1},
+ {0x05a3, 0x05bd, 1},
+ {0x05bf, 0x05bf, 1},
+ {0x05c1, 0x05c2, 1},
+ {0x05c4, 0x05c4, 1},
+ {0x064b, 0x0652, 1},
+ {0x0657, 0x0658, 1},
+ {0x06df, 0x06e0, 1},
+ {0x06e5, 0x06e6, 1},
+ {0x06ea, 0x06ec, 1},
+ {0x0730, 0x074a, 1},
+ {0x07a6, 0x07b0, 1},
+ {0x07eb, 0x07f5, 1},
+ {0x0818, 0x0819, 1},
+ {0x093c, 0x093c, 1},
+ {0x094d, 0x094d, 1},
+ {0x0951, 0x0954, 1},
+ {0x0971, 0x0971, 1},
+ {0x09bc, 0x09bc, 1},
+ {0x09cd, 0x09cd, 1},
+ {0x0a3c, 0x0a3c, 1},
+ {0x0a4d, 0x0a4d, 1},
+ {0x0abc, 0x0abc, 1},
+ {0x0acd, 0x0acd, 1},
+ {0x0b3c, 0x0b3c, 1},
+ {0x0b4d, 0x0b4d, 1},
+ {0x0bcd, 0x0bcd, 1},
+ {0x0c4d, 0x0c4d, 1},
+ {0x0cbc, 0x0cbc, 1},
+ {0x0ccd, 0x0ccd, 1},
+ {0x0d4d, 0x0d4d, 1},
+ {0x0dca, 0x0dca, 1},
+ {0x0e47, 0x0e4c, 1},
+ {0x0e4e, 0x0e4e, 1},
+ {0x0ec8, 0x0ecc, 1},
+ {0x0f18, 0x0f19, 1},
+ {0x0f35, 0x0f35, 1},
+ {0x0f37, 0x0f37, 1},
+ {0x0f39, 0x0f39, 1},
+ {0x0f3e, 0x0f3f, 1},
+ {0x0f82, 0x0f84, 1},
+ {0x0f86, 0x0f87, 1},
+ {0x0fc6, 0x0fc6, 1},
+ {0x1037, 0x1037, 1},
+ {0x1039, 0x103a, 1},
+ {0x1087, 0x108d, 1},
+ {0x108f, 0x108f, 1},
+ {0x109a, 0x109b, 1},
+ {0x17c9, 0x17d3, 1},
+ {0x17dd, 0x17dd, 1},
+ {0x1939, 0x193b, 1},
+ {0x1a75, 0x1a7c, 1},
+ {0x1a7f, 0x1a7f, 1},
+ {0x1b34, 0x1b34, 1},
+ {0x1b44, 0x1b44, 1},
+ {0x1b6b, 0x1b73, 1},
+ {0x1baa, 0x1baa, 1},
+ {0x1c36, 0x1c37, 1},
+ {0x1c78, 0x1c7d, 1},
+ {0x1cd0, 0x1ce8, 1},
+ {0x1ced, 0x1ced, 1},
+ {0x1d2c, 0x1d6a, 1},
+ {0x1dc4, 0x1dcf, 1},
+ {0x1dfd, 0x1dff, 1},
+ {0x1fbd, 0x1fbd, 1},
+ {0x1fbf, 0x1fc1, 1},
+ {0x1fcd, 0x1fcf, 1},
+ {0x1fdd, 0x1fdf, 1},
+ {0x1fed, 0x1fef, 1},
+ {0x1ffd, 0x1ffe, 1},
+ {0x2cef, 0x2cf1, 1},
+ {0x2e2f, 0x2e2f, 1},
+ {0x302a, 0x302f, 1},
+ {0x3099, 0x309c, 1},
+ {0x30fc, 0x30fc, 1},
+ {0xa66f, 0xa66f, 1},
+ {0xa67c, 0xa67d, 1},
+ {0xa67f, 0xa67f, 1},
+ {0xa6f0, 0xa6f1, 1},
+ {0xa717, 0xa721, 1},
+ {0xa788, 0xa788, 1},
+ {0xa8c4, 0xa8c4, 1},
+ {0xa8e0, 0xa8f1, 1},
+ {0xa92b, 0xa92e, 1},
+ {0xa953, 0xa953, 1},
+ {0xa9b3, 0xa9b3, 1},
+ {0xa9c0, 0xa9c0, 1},
+ {0xaa7b, 0xaa7b, 1},
+ {0xaabf, 0xaac2, 1},
+ {0xabec, 0xabed, 1},
+ {0xfb1e, 0xfb1e, 1},
+ {0xfe20, 0xfe26, 1},
+ {0xff3e, 0xff3e, 1},
+ {0xff40, 0xff40, 1},
+ {0xff70, 0xff70, 1},
+ {0xff9e, 0xff9f, 1},
+ {0xffe3, 0xffe3, 1},
},
R32: []Range32{
- {0x1d422, 0x1d423, 1},
- {0x1d456, 0x1d457, 1},
- {0x1d48a, 0x1d48b, 1},
- {0x1d4be, 0x1d4bf, 1},
- {0x1d4f2, 0x1d4f3, 1},
- {0x1d526, 0x1d527, 1},
- {0x1d55a, 0x1d55b, 1},
- {0x1d58e, 0x1d58f, 1},
- {0x1d5c2, 0x1d5c3, 1},
- {0x1d5f6, 0x1d5f7, 1},
- {0x1d62a, 0x1d62b, 1},
- {0x1d65e, 0x1d65f, 1},
- {0x1d692, 0x1d693, 1},
+ {0x110b9, 0x110ba, 1},
+ {0x1d167, 0x1d169, 1},
+ {0x1d16d, 0x1d172, 1},
+ {0x1d17b, 0x1d182, 1},
+ {0x1d185, 0x1d18b, 1},
+ {0x1d1aa, 0x1d1ad, 1},
+ },
+}
+
+var _Extender = &RangeTable{
+ R16: []Range16{
+ {0x00b7, 0x00b7, 1},
+ {0x02d0, 0x02d1, 1},
+ {0x0640, 0x0640, 1},
+ {0x07fa, 0x07fa, 1},
+ {0x0e46, 0x0e46, 1},
+ {0x0ec6, 0x0ec6, 1},
+ {0x1843, 0x1843, 1},
+ {0x1aa7, 0x1aa7, 1},
+ {0x1c36, 0x1c36, 1},
+ {0x1c7b, 0x1c7b, 1},
+ {0x3005, 0x3005, 1},
+ {0x3031, 0x3035, 1},
+ {0x309d, 0x309e, 1},
+ {0x30fc, 0x30fe, 1},
+ {0xa015, 0xa015, 1},
+ {0xa60c, 0xa60c, 1},
+ {0xa9cf, 0xa9cf, 1},
+ {0xaa70, 0xaa70, 1},
+ {0xaadd, 0xaadd, 1},
+ {0xff70, 0xff70, 1},
},
}
@@ -4309,144 +4406,66 @@ var _Hex_Digit = &RangeTable{
},
}
-var _ASCII_Hex_Digit = &RangeTable{
+var _Hyphen = &RangeTable{
R16: []Range16{
- {0x0030, 0x0039, 1},
- {0x0041, 0x0046, 1},
- {0x0061, 0x0066, 1},
+ {0x002d, 0x002d, 1},
+ {0x00ad, 0x00ad, 1},
+ {0x058a, 0x058a, 1},
+ {0x1806, 0x1806, 1},
+ {0x2010, 0x2011, 1},
+ {0x2e17, 0x2e17, 1},
+ {0x30fb, 0x30fb, 1},
+ {0xfe63, 0xfe63, 1},
+ {0xff0d, 0xff0d, 1},
+ {0xff65, 0xff65, 1},
},
}
-var _Deprecated = &RangeTable{
+var _IDS_Binary_Operator = &RangeTable{
R16: []Range16{
- {0x0149, 0x0149, 1},
- {0x0673, 0x0673, 1},
- {0x0f77, 0x0f77, 1},
- {0x0f79, 0x0f79, 1},
- {0x17a3, 0x17a4, 1},
- {0x206a, 0x206f, 1},
- {0x2329, 0x232a, 1},
- },
- R32: []Range32{
- {0xe0001, 0xe0001, 1},
- {0xe0020, 0xe007f, 1},
+ {0x2ff0, 0x2ff1, 1},
+ {0x2ff4, 0x2ffb, 1},
},
}
-var _Terminal_Punctuation = &RangeTable{
+var _IDS_Trinary_Operator = &RangeTable{
R16: []Range16{
- {0x0021, 0x0021, 1},
- {0x002c, 0x002c, 1},
- {0x002e, 0x002e, 1},
- {0x003a, 0x003b, 1},
- {0x003f, 0x003f, 1},
- {0x037e, 0x037e, 1},
- {0x0387, 0x0387, 1},
- {0x0589, 0x0589, 1},
- {0x05c3, 0x05c3, 1},
- {0x060c, 0x060c, 1},
- {0x061b, 0x061b, 1},
- {0x061f, 0x061f, 1},
- {0x06d4, 0x06d4, 1},
- {0x0700, 0x070a, 1},
- {0x070c, 0x070c, 1},
- {0x07f8, 0x07f9, 1},
- {0x0830, 0x083e, 1},
- {0x085e, 0x085e, 1},
- {0x0964, 0x0965, 1},
- {0x0e5a, 0x0e5b, 1},
- {0x0f08, 0x0f08, 1},
- {0x0f0d, 0x0f12, 1},
- {0x104a, 0x104b, 1},
- {0x1361, 0x1368, 1},
- {0x166d, 0x166e, 1},
- {0x16eb, 0x16ed, 1},
- {0x17d4, 0x17d6, 1},
- {0x17da, 0x17da, 1},
- {0x1802, 0x1805, 1},
- {0x1808, 0x1809, 1},
- {0x1944, 0x1945, 1},
- {0x1aa8, 0x1aab, 1},
- {0x1b5a, 0x1b5b, 1},
- {0x1b5d, 0x1b5f, 1},
- {0x1c3b, 0x1c3f, 1},
- {0x1c7e, 0x1c7f, 1},
- {0x203c, 0x203d, 1},
- {0x2047, 0x2049, 1},
- {0x2e2e, 0x2e2e, 1},
- {0x3001, 0x3002, 1},
- {0xa4fe, 0xa4ff, 1},
- {0xa60d, 0xa60f, 1},
- {0xa6f3, 0xa6f7, 1},
- {0xa876, 0xa877, 1},
- {0xa8ce, 0xa8cf, 1},
- {0xa92f, 0xa92f, 1},
- {0xa9c7, 0xa9c9, 1},
- {0xaa5d, 0xaa5f, 1},
- {0xaadf, 0xaadf, 1},
- {0xabeb, 0xabeb, 1},
- {0xfe50, 0xfe52, 1},
- {0xfe54, 0xfe57, 1},
- {0xff01, 0xff01, 1},
- {0xff0c, 0xff0c, 1},
- {0xff0e, 0xff0e, 1},
- {0xff1a, 0xff1b, 1},
- {0xff1f, 0xff1f, 1},
- {0xff61, 0xff61, 1},
- {0xff64, 0xff64, 1},
- },
- R32: []Range32{
- {0x1039f, 0x1039f, 1},
- {0x103d0, 0x103d0, 1},
- {0x10857, 0x10857, 1},
- {0x1091f, 0x1091f, 1},
- {0x10b3a, 0x10b3f, 1},
- {0x11047, 0x1104d, 1},
- {0x110be, 0x110c1, 1},
- {0x12470, 0x12473, 1},
+ {0x2ff2, 0x2ff3, 1},
},
}
-var _Quotation_Mark = &RangeTable{
+var _Ideographic = &RangeTable{
R16: []Range16{
- {0x0022, 0x0022, 1},
- {0x0027, 0x0027, 1},
- {0x00ab, 0x00ab, 1},
- {0x00bb, 0x00bb, 1},
- {0x2018, 0x201f, 1},
- {0x2039, 0x203a, 1},
- {0x300c, 0x300f, 1},
- {0x301d, 0x301f, 1},
- {0xfe41, 0xfe44, 1},
- {0xff02, 0xff02, 1},
- {0xff07, 0xff07, 1},
- {0xff62, 0xff63, 1},
+ {0x3006, 0x3007, 1},
+ {0x3021, 0x3029, 1},
+ {0x3038, 0x303a, 1},
+ {0x3400, 0x4db5, 1},
+ {0x4e00, 0x9fcb, 1},
+ {0xf900, 0xfa2d, 1},
+ {0xfa30, 0xfa6d, 1},
+ {0xfa70, 0xfad9, 1},
},
-}
-
-var _Other_ID_Continue = &RangeTable{
- R16: []Range16{
- {0x00b7, 0x00b7, 1},
- {0x0387, 0x0387, 1},
- {0x1369, 0x1371, 1},
- {0x19da, 0x19da, 1},
+ R32: []Range32{
+ {0x20000, 0x2a6d6, 1},
+ {0x2a700, 0x2b734, 1},
+ {0x2b740, 0x2b81d, 1},
+ {0x2f800, 0x2fa1d, 1},
},
}
-var _Bidi_Control = &RangeTable{
+var _Join_Control = &RangeTable{
R16: []Range16{
- {0x200e, 0x200f, 1},
- {0x202a, 0x202e, 1},
+ {0x200c, 0x200d, 1},
},
}
-var _Variation_Selector = &RangeTable{
+var _Logical_Order_Exception = &RangeTable{
R16: []Range16{
- {0x180b, 0x180d, 1},
- {0xfe00, 0xfe0f, 1},
- },
- R32: []Range32{
- {0xe0100, 0xe01ef, 1},
+ {0x0e40, 0x0e44, 1},
+ {0x0ec0, 0x0ec4, 1},
+ {0xaab5, 0xaab6, 1},
+ {0xaab9, 0xaab9, 1},
+ {0xaabb, 0xaabc, 1},
},
}
@@ -4475,6 +4494,233 @@ var _Noncharacter_Code_Point = &RangeTable{
},
}
+var _Other_Alphabetic = &RangeTable{
+ R16: []Range16{
+ {0x0345, 0x0345, 1},
+ {0x05b0, 0x05bd, 1},
+ {0x05bf, 0x05bf, 1},
+ {0x05c1, 0x05c2, 1},
+ {0x05c4, 0x05c5, 1},
+ {0x05c7, 0x05c7, 1},
+ {0x0610, 0x061a, 1},
+ {0x064b, 0x0657, 1},
+ {0x0659, 0x065f, 1},
+ {0x0670, 0x0670, 1},
+ {0x06d6, 0x06dc, 1},
+ {0x06e1, 0x06e4, 1},
+ {0x06e7, 0x06e8, 1},
+ {0x06ed, 0x06ed, 1},
+ {0x0711, 0x0711, 1},
+ {0x0730, 0x073f, 1},
+ {0x07a6, 0x07b0, 1},
+ {0x0816, 0x0817, 1},
+ {0x081b, 0x0823, 1},
+ {0x0825, 0x0827, 1},
+ {0x0829, 0x082c, 1},
+ {0x0900, 0x0903, 1},
+ {0x093a, 0x093b, 1},
+ {0x093e, 0x094c, 1},
+ {0x094e, 0x094f, 1},
+ {0x0955, 0x0957, 1},
+ {0x0962, 0x0963, 1},
+ {0x0981, 0x0983, 1},
+ {0x09be, 0x09c4, 1},
+ {0x09c7, 0x09c8, 1},
+ {0x09cb, 0x09cc, 1},
+ {0x09d7, 0x09d7, 1},
+ {0x09e2, 0x09e3, 1},
+ {0x0a01, 0x0a03, 1},
+ {0x0a3e, 0x0a42, 1},
+ {0x0a47, 0x0a48, 1},
+ {0x0a4b, 0x0a4c, 1},
+ {0x0a51, 0x0a51, 1},
+ {0x0a70, 0x0a71, 1},
+ {0x0a75, 0x0a75, 1},
+ {0x0a81, 0x0a83, 1},
+ {0x0abe, 0x0ac5, 1},
+ {0x0ac7, 0x0ac9, 1},
+ {0x0acb, 0x0acc, 1},
+ {0x0ae2, 0x0ae3, 1},
+ {0x0b01, 0x0b03, 1},
+ {0x0b3e, 0x0b44, 1},
+ {0x0b47, 0x0b48, 1},
+ {0x0b4b, 0x0b4c, 1},
+ {0x0b56, 0x0b57, 1},
+ {0x0b62, 0x0b63, 1},
+ {0x0b82, 0x0b82, 1},
+ {0x0bbe, 0x0bc2, 1},
+ {0x0bc6, 0x0bc8, 1},
+ {0x0bca, 0x0bcc, 1},
+ {0x0bd7, 0x0bd7, 1},
+ {0x0c01, 0x0c03, 1},
+ {0x0c3e, 0x0c44, 1},
+ {0x0c46, 0x0c48, 1},
+ {0x0c4a, 0x0c4c, 1},
+ {0x0c55, 0x0c56, 1},
+ {0x0c62, 0x0c63, 1},
+ {0x0c82, 0x0c83, 1},
+ {0x0cbe, 0x0cc4, 1},
+ {0x0cc6, 0x0cc8, 1},
+ {0x0cca, 0x0ccc, 1},
+ {0x0cd5, 0x0cd6, 1},
+ {0x0ce2, 0x0ce3, 1},
+ {0x0d02, 0x0d03, 1},
+ {0x0d3e, 0x0d44, 1},
+ {0x0d46, 0x0d48, 1},
+ {0x0d4a, 0x0d4c, 1},
+ {0x0d57, 0x0d57, 1},
+ {0x0d62, 0x0d63, 1},
+ {0x0d82, 0x0d83, 1},
+ {0x0dcf, 0x0dd4, 1},
+ {0x0dd6, 0x0dd6, 1},
+ {0x0dd8, 0x0ddf, 1},
+ {0x0df2, 0x0df3, 1},
+ {0x0e31, 0x0e31, 1},
+ {0x0e34, 0x0e3a, 1},
+ {0x0e4d, 0x0e4d, 1},
+ {0x0eb1, 0x0eb1, 1},
+ {0x0eb4, 0x0eb9, 1},
+ {0x0ebb, 0x0ebc, 1},
+ {0x0ecd, 0x0ecd, 1},
+ {0x0f71, 0x0f81, 1},
+ {0x0f8d, 0x0f97, 1},
+ {0x0f99, 0x0fbc, 1},
+ {0x102b, 0x1036, 1},
+ {0x1038, 0x1038, 1},
+ {0x103b, 0x103e, 1},
+ {0x1056, 0x1059, 1},
+ {0x105e, 0x1060, 1},
+ {0x1062, 0x1062, 1},
+ {0x1067, 0x1068, 1},
+ {0x1071, 0x1074, 1},
+ {0x1082, 0x1086, 1},
+ {0x109c, 0x109d, 1},
+ {0x135f, 0x135f, 1},
+ {0x1712, 0x1713, 1},
+ {0x1732, 0x1733, 1},
+ {0x1752, 0x1753, 1},
+ {0x1772, 0x1773, 1},
+ {0x17b6, 0x17c8, 1},
+ {0x18a9, 0x18a9, 1},
+ {0x1920, 0x192b, 1},
+ {0x1930, 0x1938, 1},
+ {0x19b0, 0x19c0, 1},
+ {0x19c8, 0x19c9, 1},
+ {0x1a17, 0x1a1b, 1},
+ {0x1a55, 0x1a5e, 1},
+ {0x1a61, 0x1a74, 1},
+ {0x1b00, 0x1b04, 1},
+ {0x1b35, 0x1b43, 1},
+ {0x1b80, 0x1b82, 1},
+ {0x1ba1, 0x1ba9, 1},
+ {0x1be7, 0x1bf1, 1},
+ {0x1c24, 0x1c35, 1},
+ {0x1cf2, 0x1cf2, 1},
+ {0x24b6, 0x24e9, 1},
+ {0x2de0, 0x2dff, 1},
+ {0xa823, 0xa827, 1},
+ {0xa880, 0xa881, 1},
+ {0xa8b4, 0xa8c3, 1},
+ {0xa926, 0xa92a, 1},
+ {0xa947, 0xa952, 1},
+ {0xa980, 0xa983, 1},
+ {0xa9b4, 0xa9bf, 1},
+ {0xaa29, 0xaa36, 1},
+ {0xaa43, 0xaa43, 1},
+ {0xaa4c, 0xaa4d, 1},
+ {0xaab0, 0xaab0, 1},
+ {0xaab2, 0xaab4, 1},
+ {0xaab7, 0xaab8, 1},
+ {0xaabe, 0xaabe, 1},
+ {0xabe3, 0xabea, 1},
+ {0xfb1e, 0xfb1e, 1},
+ },
+ R32: []Range32{
+ {0x10a01, 0x10a03, 1},
+ {0x10a05, 0x10a06, 1},
+ {0x10a0c, 0x10a0f, 1},
+ {0x11000, 0x11002, 1},
+ {0x11038, 0x11045, 1},
+ {0x11082, 0x11082, 1},
+ {0x110b0, 0x110b8, 1},
+ },
+}
+
+var _Other_Default_Ignorable_Code_Point = &RangeTable{
+ R16: []Range16{
+ {0x034f, 0x034f, 1},
+ {0x115f, 0x1160, 1},
+ {0x2065, 0x2069, 1},
+ {0x3164, 0x3164, 1},
+ {0xffa0, 0xffa0, 1},
+ {0xfff0, 0xfff8, 1},
+ },
+ R32: []Range32{
+ {0xe0000, 0xe0000, 1},
+ {0xe0002, 0xe001f, 1},
+ {0xe0080, 0xe00ff, 1},
+ {0xe01f0, 0xe0fff, 1},
+ },
+}
+
+var _Other_Grapheme_Extend = &RangeTable{
+ R16: []Range16{
+ {0x09be, 0x09be, 1},
+ {0x09d7, 0x09d7, 1},
+ {0x0b3e, 0x0b3e, 1},
+ {0x0b57, 0x0b57, 1},
+ {0x0bbe, 0x0bbe, 1},
+ {0x0bd7, 0x0bd7, 1},
+ {0x0cc2, 0x0cc2, 1},
+ {0x0cd5, 0x0cd6, 1},
+ {0x0d3e, 0x0d3e, 1},
+ {0x0d57, 0x0d57, 1},
+ {0x0dcf, 0x0dcf, 1},
+ {0x0ddf, 0x0ddf, 1},
+ {0x200c, 0x200d, 1},
+ {0xff9e, 0xff9f, 1},
+ },
+ R32: []Range32{
+ {0x1d165, 0x1d165, 1},
+ {0x1d16e, 0x1d172, 1},
+ },
+}
+
+var _Other_ID_Continue = &RangeTable{
+ R16: []Range16{
+ {0x00b7, 0x00b7, 1},
+ {0x0387, 0x0387, 1},
+ {0x1369, 0x1371, 1},
+ {0x19da, 0x19da, 1},
+ },
+}
+
+var _Other_ID_Start = &RangeTable{
+ R16: []Range16{
+ {0x2118, 0x2118, 1},
+ {0x212e, 0x212e, 1},
+ {0x309b, 0x309c, 1},
+ },
+}
+
+var _Other_Lowercase = &RangeTable{
+ R16: []Range16{
+ {0x02b0, 0x02b8, 1},
+ {0x02c0, 0x02c1, 1},
+ {0x02e0, 0x02e4, 1},
+ {0x0345, 0x0345, 1},
+ {0x037a, 0x037a, 1},
+ {0x1d2c, 0x1d61, 1},
+ {0x1d78, 0x1d78, 1},
+ {0x1d9b, 0x1dbf, 1},
+ {0x2090, 0x2094, 1},
+ {0x2170, 0x217f, 1},
+ {0x24d0, 0x24e9, 1},
+ {0x2c7d, 0x2c7d, 1},
+ {0xa770, 0xa770, 1},
+ },
+}
+
var _Other_Math = &RangeTable{
R16: []Range16{
{0x005e, 0x005e, 1},
@@ -4582,54 +4828,70 @@ var _Other_Math = &RangeTable{
},
}
-var _Unified_Ideograph = &RangeTable{
+var _Other_Uppercase = &RangeTable{
R16: []Range16{
- {0x3400, 0x4db5, 1},
- {0x4e00, 0x9fcb, 1},
- {0xfa0e, 0xfa0f, 1},
- {0xfa11, 0xfa11, 1},
- {0xfa13, 0xfa14, 1},
- {0xfa1f, 0xfa1f, 1},
- {0xfa21, 0xfa21, 1},
- {0xfa23, 0xfa24, 1},
- {0xfa27, 0xfa29, 1},
- },
- R32: []Range32{
- {0x20000, 0x2a6d6, 1},
- {0x2a700, 0x2b734, 1},
- {0x2b740, 0x2b81d, 1},
+ {0x2160, 0x216f, 1},
+ {0x24b6, 0x24cf, 1},
},
}
-var _Hyphen = &RangeTable{
+var _Pattern_Syntax = &RangeTable{
R16: []Range16{
- {0x002d, 0x002d, 1},
- {0x00ad, 0x00ad, 1},
- {0x058a, 0x058a, 1},
- {0x1806, 0x1806, 1},
- {0x2010, 0x2011, 1},
- {0x2e17, 0x2e17, 1},
- {0x30fb, 0x30fb, 1},
- {0xfe63, 0xfe63, 1},
- {0xff0d, 0xff0d, 1},
- {0xff65, 0xff65, 1},
+ {0x0021, 0x002f, 1},
+ {0x003a, 0x0040, 1},
+ {0x005b, 0x005e, 1},
+ {0x0060, 0x0060, 1},
+ {0x007b, 0x007e, 1},
+ {0x00a1, 0x00a7, 1},
+ {0x00a9, 0x00a9, 1},
+ {0x00ab, 0x00ac, 1},
+ {0x00ae, 0x00ae, 1},
+ {0x00b0, 0x00b1, 1},
+ {0x00b6, 0x00b6, 1},
+ {0x00bb, 0x00bb, 1},
+ {0x00bf, 0x00bf, 1},
+ {0x00d7, 0x00d7, 1},
+ {0x00f7, 0x00f7, 1},
+ {0x2010, 0x2027, 1},
+ {0x2030, 0x203e, 1},
+ {0x2041, 0x2053, 1},
+ {0x2055, 0x205e, 1},
+ {0x2190, 0x245f, 1},
+ {0x2500, 0x2775, 1},
+ {0x2794, 0x2bff, 1},
+ {0x2e00, 0x2e7f, 1},
+ {0x3001, 0x3003, 1},
+ {0x3008, 0x3020, 1},
+ {0x3030, 0x3030, 1},
+ {0xfd3e, 0xfd3f, 1},
+ {0xfe45, 0xfe46, 1},
},
}
-var _IDS_Binary_Operator = &RangeTable{
+var _Pattern_White_Space = &RangeTable{
R16: []Range16{
- {0x2ff0, 0x2ff1, 1},
- {0x2ff4, 0x2ffb, 1},
+ {0x0009, 0x000d, 1},
+ {0x0020, 0x0020, 1},
+ {0x0085, 0x0085, 1},
+ {0x200e, 0x200f, 1},
+ {0x2028, 0x2029, 1},
},
}
-var _Logical_Order_Exception = &RangeTable{
+var _Quotation_Mark = &RangeTable{
R16: []Range16{
- {0x0e40, 0x0e44, 1},
- {0x0ec0, 0x0ec4, 1},
- {0xaab5, 0xaab6, 1},
- {0xaab9, 0xaab9, 1},
- {0xaabb, 0xaabc, 1},
+ {0x0022, 0x0022, 1},
+ {0x0027, 0x0027, 1},
+ {0x00ab, 0x00ab, 1},
+ {0x00bb, 0x00bb, 1},
+ {0x2018, 0x201f, 1},
+ {0x2039, 0x203a, 1},
+ {0x300c, 0x300f, 1},
+ {0x301d, 0x301f, 1},
+ {0xfe41, 0xfe44, 1},
+ {0xff02, 0xff02, 1},
+ {0xff07, 0xff07, 1},
+ {0xff62, 0xff63, 1},
},
}
@@ -4641,13 +4903,6 @@ var _Radical = &RangeTable{
},
}
-var _Other_Uppercase = &RangeTable{
- R16: []Range16{
- {0x2160, 0x216f, 1},
- {0x24b6, 0x24cf, 1},
- },
-}
-
var _STerm = &RangeTable{
R16: []Range16{
{0x0021, 0x0021, 1},
@@ -4702,399 +4957,144 @@ var _STerm = &RangeTable{
},
}
-var _Other_Alphabetic = &RangeTable{
+var _Soft_Dotted = &RangeTable{
R16: []Range16{
- {0x0345, 0x0345, 1},
- {0x05b0, 0x05bd, 1},
- {0x05bf, 0x05bf, 1},
- {0x05c1, 0x05c2, 1},
- {0x05c4, 0x05c5, 1},
- {0x05c7, 0x05c7, 1},
- {0x0610, 0x061a, 1},
- {0x064b, 0x0657, 1},
- {0x0659, 0x065f, 1},
- {0x0670, 0x0670, 1},
- {0x06d6, 0x06dc, 1},
- {0x06e1, 0x06e4, 1},
- {0x06e7, 0x06e8, 1},
- {0x06ed, 0x06ed, 1},
- {0x0711, 0x0711, 1},
- {0x0730, 0x073f, 1},
- {0x07a6, 0x07b0, 1},
- {0x0816, 0x0817, 1},
- {0x081b, 0x0823, 1},
- {0x0825, 0x0827, 1},
- {0x0829, 0x082c, 1},
- {0x0900, 0x0903, 1},
- {0x093a, 0x093b, 1},
- {0x093e, 0x094c, 1},
- {0x094e, 0x094f, 1},
- {0x0955, 0x0957, 1},
- {0x0962, 0x0963, 1},
- {0x0981, 0x0983, 1},
- {0x09be, 0x09c4, 1},
- {0x09c7, 0x09c8, 1},
- {0x09cb, 0x09cc, 1},
- {0x09d7, 0x09d7, 1},
- {0x09e2, 0x09e3, 1},
- {0x0a01, 0x0a03, 1},
- {0x0a3e, 0x0a42, 1},
- {0x0a47, 0x0a48, 1},
- {0x0a4b, 0x0a4c, 1},
- {0x0a51, 0x0a51, 1},
- {0x0a70, 0x0a71, 1},
- {0x0a75, 0x0a75, 1},
- {0x0a81, 0x0a83, 1},
- {0x0abe, 0x0ac5, 1},
- {0x0ac7, 0x0ac9, 1},
- {0x0acb, 0x0acc, 1},
- {0x0ae2, 0x0ae3, 1},
- {0x0b01, 0x0b03, 1},
- {0x0b3e, 0x0b44, 1},
- {0x0b47, 0x0b48, 1},
- {0x0b4b, 0x0b4c, 1},
- {0x0b56, 0x0b57, 1},
- {0x0b62, 0x0b63, 1},
- {0x0b82, 0x0b82, 1},
- {0x0bbe, 0x0bc2, 1},
- {0x0bc6, 0x0bc8, 1},
- {0x0bca, 0x0bcc, 1},
- {0x0bd7, 0x0bd7, 1},
- {0x0c01, 0x0c03, 1},
- {0x0c3e, 0x0c44, 1},
- {0x0c46, 0x0c48, 1},
- {0x0c4a, 0x0c4c, 1},
- {0x0c55, 0x0c56, 1},
- {0x0c62, 0x0c63, 1},
- {0x0c82, 0x0c83, 1},
- {0x0cbe, 0x0cc4, 1},
- {0x0cc6, 0x0cc8, 1},
- {0x0cca, 0x0ccc, 1},
- {0x0cd5, 0x0cd6, 1},
- {0x0ce2, 0x0ce3, 1},
- {0x0d02, 0x0d03, 1},
- {0x0d3e, 0x0d44, 1},
- {0x0d46, 0x0d48, 1},
- {0x0d4a, 0x0d4c, 1},
- {0x0d57, 0x0d57, 1},
- {0x0d62, 0x0d63, 1},
- {0x0d82, 0x0d83, 1},
- {0x0dcf, 0x0dd4, 1},
- {0x0dd6, 0x0dd6, 1},
- {0x0dd8, 0x0ddf, 1},
- {0x0df2, 0x0df3, 1},
- {0x0e31, 0x0e31, 1},
- {0x0e34, 0x0e3a, 1},
- {0x0e4d, 0x0e4d, 1},
- {0x0eb1, 0x0eb1, 1},
- {0x0eb4, 0x0eb9, 1},
- {0x0ebb, 0x0ebc, 1},
- {0x0ecd, 0x0ecd, 1},
- {0x0f71, 0x0f81, 1},
- {0x0f8d, 0x0f97, 1},
- {0x0f99, 0x0fbc, 1},
- {0x102b, 0x1036, 1},
- {0x1038, 0x1038, 1},
- {0x103b, 0x103e, 1},
- {0x1056, 0x1059, 1},
- {0x105e, 0x1060, 1},
- {0x1062, 0x1062, 1},
- {0x1067, 0x1068, 1},
- {0x1071, 0x1074, 1},
- {0x1082, 0x1086, 1},
- {0x109c, 0x109d, 1},
- {0x135f, 0x135f, 1},
- {0x1712, 0x1713, 1},
- {0x1732, 0x1733, 1},
- {0x1752, 0x1753, 1},
- {0x1772, 0x1773, 1},
- {0x17b6, 0x17c8, 1},
- {0x18a9, 0x18a9, 1},
- {0x1920, 0x192b, 1},
- {0x1930, 0x1938, 1},
- {0x19b0, 0x19c0, 1},
- {0x19c8, 0x19c9, 1},
- {0x1a17, 0x1a1b, 1},
- {0x1a55, 0x1a5e, 1},
- {0x1a61, 0x1a74, 1},
- {0x1b00, 0x1b04, 1},
- {0x1b35, 0x1b43, 1},
- {0x1b80, 0x1b82, 1},
- {0x1ba1, 0x1ba9, 1},
- {0x1be7, 0x1bf1, 1},
- {0x1c24, 0x1c35, 1},
- {0x1cf2, 0x1cf2, 1},
- {0x24b6, 0x24e9, 1},
- {0x2de0, 0x2dff, 1},
- {0xa823, 0xa827, 1},
- {0xa880, 0xa881, 1},
- {0xa8b4, 0xa8c3, 1},
- {0xa926, 0xa92a, 1},
- {0xa947, 0xa952, 1},
- {0xa980, 0xa983, 1},
- {0xa9b4, 0xa9bf, 1},
- {0xaa29, 0xaa36, 1},
- {0xaa43, 0xaa43, 1},
- {0xaa4c, 0xaa4d, 1},
- {0xaab0, 0xaab0, 1},
- {0xaab2, 0xaab4, 1},
- {0xaab7, 0xaab8, 1},
- {0xaabe, 0xaabe, 1},
- {0xabe3, 0xabea, 1},
- {0xfb1e, 0xfb1e, 1},
+ {0x0069, 0x006a, 1},
+ {0x012f, 0x012f, 1},
+ {0x0249, 0x0249, 1},
+ {0x0268, 0x0268, 1},
+ {0x029d, 0x029d, 1},
+ {0x02b2, 0x02b2, 1},
+ {0x03f3, 0x03f3, 1},
+ {0x0456, 0x0456, 1},
+ {0x0458, 0x0458, 1},
+ {0x1d62, 0x1d62, 1},
+ {0x1d96, 0x1d96, 1},
+ {0x1da4, 0x1da4, 1},
+ {0x1da8, 0x1da8, 1},
+ {0x1e2d, 0x1e2d, 1},
+ {0x1ecb, 0x1ecb, 1},
+ {0x2071, 0x2071, 1},
+ {0x2148, 0x2149, 1},
+ {0x2c7c, 0x2c7c, 1},
},
R32: []Range32{
- {0x10a01, 0x10a03, 1},
- {0x10a05, 0x10a06, 1},
- {0x10a0c, 0x10a0f, 1},
- {0x11000, 0x11002, 1},
- {0x11038, 0x11045, 1},
- {0x11082, 0x11082, 1},
- {0x110b0, 0x110b8, 1},
+ {0x1d422, 0x1d423, 1},
+ {0x1d456, 0x1d457, 1},
+ {0x1d48a, 0x1d48b, 1},
+ {0x1d4be, 0x1d4bf, 1},
+ {0x1d4f2, 0x1d4f3, 1},
+ {0x1d526, 0x1d527, 1},
+ {0x1d55a, 0x1d55b, 1},
+ {0x1d58e, 0x1d58f, 1},
+ {0x1d5c2, 0x1d5c3, 1},
+ {0x1d5f6, 0x1d5f7, 1},
+ {0x1d62a, 0x1d62b, 1},
+ {0x1d65e, 0x1d65f, 1},
+ {0x1d692, 0x1d693, 1},
},
}
-var _Diacritic = &RangeTable{
+var _Terminal_Punctuation = &RangeTable{
R16: []Range16{
- {0x005e, 0x005e, 1},
- {0x0060, 0x0060, 1},
- {0x00a8, 0x00a8, 1},
- {0x00af, 0x00af, 1},
- {0x00b4, 0x00b4, 1},
- {0x00b7, 0x00b8, 1},
- {0x02b0, 0x034e, 1},
- {0x0350, 0x0357, 1},
- {0x035d, 0x0362, 1},
- {0x0374, 0x0375, 1},
- {0x037a, 0x037a, 1},
- {0x0384, 0x0385, 1},
- {0x0483, 0x0487, 1},
- {0x0559, 0x0559, 1},
- {0x0591, 0x05a1, 1},
- {0x05a3, 0x05bd, 1},
- {0x05bf, 0x05bf, 1},
- {0x05c1, 0x05c2, 1},
- {0x05c4, 0x05c4, 1},
- {0x064b, 0x0652, 1},
- {0x0657, 0x0658, 1},
- {0x06df, 0x06e0, 1},
- {0x06e5, 0x06e6, 1},
- {0x06ea, 0x06ec, 1},
- {0x0730, 0x074a, 1},
- {0x07a6, 0x07b0, 1},
- {0x07eb, 0x07f5, 1},
- {0x0818, 0x0819, 1},
- {0x093c, 0x093c, 1},
- {0x094d, 0x094d, 1},
- {0x0951, 0x0954, 1},
- {0x0971, 0x0971, 1},
- {0x09bc, 0x09bc, 1},
- {0x09cd, 0x09cd, 1},
- {0x0a3c, 0x0a3c, 1},
- {0x0a4d, 0x0a4d, 1},
- {0x0abc, 0x0abc, 1},
- {0x0acd, 0x0acd, 1},
- {0x0b3c, 0x0b3c, 1},
- {0x0b4d, 0x0b4d, 1},
- {0x0bcd, 0x0bcd, 1},
- {0x0c4d, 0x0c4d, 1},
- {0x0cbc, 0x0cbc, 1},
- {0x0ccd, 0x0ccd, 1},
- {0x0d4d, 0x0d4d, 1},
- {0x0dca, 0x0dca, 1},
- {0x0e47, 0x0e4c, 1},
- {0x0e4e, 0x0e4e, 1},
- {0x0ec8, 0x0ecc, 1},
- {0x0f18, 0x0f19, 1},
- {0x0f35, 0x0f35, 1},
- {0x0f37, 0x0f37, 1},
- {0x0f39, 0x0f39, 1},
- {0x0f3e, 0x0f3f, 1},
- {0x0f82, 0x0f84, 1},
- {0x0f86, 0x0f87, 1},
- {0x0fc6, 0x0fc6, 1},
- {0x1037, 0x1037, 1},
- {0x1039, 0x103a, 1},
- {0x1087, 0x108d, 1},
- {0x108f, 0x108f, 1},
- {0x109a, 0x109b, 1},
- {0x17c9, 0x17d3, 1},
- {0x17dd, 0x17dd, 1},
- {0x1939, 0x193b, 1},
- {0x1a75, 0x1a7c, 1},
- {0x1a7f, 0x1a7f, 1},
- {0x1b34, 0x1b34, 1},
- {0x1b44, 0x1b44, 1},
- {0x1b6b, 0x1b73, 1},
- {0x1baa, 0x1baa, 1},
- {0x1c36, 0x1c37, 1},
- {0x1c78, 0x1c7d, 1},
- {0x1cd0, 0x1ce8, 1},
- {0x1ced, 0x1ced, 1},
- {0x1d2c, 0x1d6a, 1},
- {0x1dc4, 0x1dcf, 1},
- {0x1dfd, 0x1dff, 1},
- {0x1fbd, 0x1fbd, 1},
- {0x1fbf, 0x1fc1, 1},
- {0x1fcd, 0x1fcf, 1},
- {0x1fdd, 0x1fdf, 1},
- {0x1fed, 0x1fef, 1},
- {0x1ffd, 0x1ffe, 1},
- {0x2cef, 0x2cf1, 1},
- {0x2e2f, 0x2e2f, 1},
- {0x302a, 0x302f, 1},
- {0x3099, 0x309c, 1},
- {0x30fc, 0x30fc, 1},
- {0xa66f, 0xa66f, 1},
- {0xa67c, 0xa67d, 1},
- {0xa67f, 0xa67f, 1},
- {0xa6f0, 0xa6f1, 1},
- {0xa717, 0xa721, 1},
- {0xa788, 0xa788, 1},
- {0xa8c4, 0xa8c4, 1},
- {0xa8e0, 0xa8f1, 1},
- {0xa92b, 0xa92e, 1},
- {0xa953, 0xa953, 1},
- {0xa9b3, 0xa9b3, 1},
- {0xa9c0, 0xa9c0, 1},
- {0xaa7b, 0xaa7b, 1},
- {0xaabf, 0xaac2, 1},
- {0xabec, 0xabed, 1},
- {0xfb1e, 0xfb1e, 1},
- {0xfe20, 0xfe26, 1},
- {0xff3e, 0xff3e, 1},
- {0xff40, 0xff40, 1},
- {0xff70, 0xff70, 1},
- {0xff9e, 0xff9f, 1},
- {0xffe3, 0xffe3, 1},
+ {0x0021, 0x0021, 1},
+ {0x002c, 0x002c, 1},
+ {0x002e, 0x002e, 1},
+ {0x003a, 0x003b, 1},
+ {0x003f, 0x003f, 1},
+ {0x037e, 0x037e, 1},
+ {0x0387, 0x0387, 1},
+ {0x0589, 0x0589, 1},
+ {0x05c3, 0x05c3, 1},
+ {0x060c, 0x060c, 1},
+ {0x061b, 0x061b, 1},
+ {0x061f, 0x061f, 1},
+ {0x06d4, 0x06d4, 1},
+ {0x0700, 0x070a, 1},
+ {0x070c, 0x070c, 1},
+ {0x07f8, 0x07f9, 1},
+ {0x0830, 0x083e, 1},
+ {0x085e, 0x085e, 1},
+ {0x0964, 0x0965, 1},
+ {0x0e5a, 0x0e5b, 1},
+ {0x0f08, 0x0f08, 1},
+ {0x0f0d, 0x0f12, 1},
+ {0x104a, 0x104b, 1},
+ {0x1361, 0x1368, 1},
+ {0x166d, 0x166e, 1},
+ {0x16eb, 0x16ed, 1},
+ {0x17d4, 0x17d6, 1},
+ {0x17da, 0x17da, 1},
+ {0x1802, 0x1805, 1},
+ {0x1808, 0x1809, 1},
+ {0x1944, 0x1945, 1},
+ {0x1aa8, 0x1aab, 1},
+ {0x1b5a, 0x1b5b, 1},
+ {0x1b5d, 0x1b5f, 1},
+ {0x1c3b, 0x1c3f, 1},
+ {0x1c7e, 0x1c7f, 1},
+ {0x203c, 0x203d, 1},
+ {0x2047, 0x2049, 1},
+ {0x2e2e, 0x2e2e, 1},
+ {0x3001, 0x3002, 1},
+ {0xa4fe, 0xa4ff, 1},
+ {0xa60d, 0xa60f, 1},
+ {0xa6f3, 0xa6f7, 1},
+ {0xa876, 0xa877, 1},
+ {0xa8ce, 0xa8cf, 1},
+ {0xa92f, 0xa92f, 1},
+ {0xa9c7, 0xa9c9, 1},
+ {0xaa5d, 0xaa5f, 1},
+ {0xaadf, 0xaadf, 1},
+ {0xabeb, 0xabeb, 1},
+ {0xfe50, 0xfe52, 1},
+ {0xfe54, 0xfe57, 1},
+ {0xff01, 0xff01, 1},
+ {0xff0c, 0xff0c, 1},
+ {0xff0e, 0xff0e, 1},
+ {0xff1a, 0xff1b, 1},
+ {0xff1f, 0xff1f, 1},
+ {0xff61, 0xff61, 1},
+ {0xff64, 0xff64, 1},
},
R32: []Range32{
- {0x110b9, 0x110ba, 1},
- {0x1d167, 0x1d169, 1},
- {0x1d16d, 0x1d172, 1},
- {0x1d17b, 0x1d182, 1},
- {0x1d185, 0x1d18b, 1},
- {0x1d1aa, 0x1d1ad, 1},
- },
-}
-
-var _Extender = &RangeTable{
- R16: []Range16{
- {0x00b7, 0x00b7, 1},
- {0x02d0, 0x02d1, 1},
- {0x0640, 0x0640, 1},
- {0x07fa, 0x07fa, 1},
- {0x0e46, 0x0e46, 1},
- {0x0ec6, 0x0ec6, 1},
- {0x1843, 0x1843, 1},
- {0x1aa7, 0x1aa7, 1},
- {0x1c36, 0x1c36, 1},
- {0x1c7b, 0x1c7b, 1},
- {0x3005, 0x3005, 1},
- {0x3031, 0x3035, 1},
- {0x309d, 0x309e, 1},
- {0x30fc, 0x30fe, 1},
- {0xa015, 0xa015, 1},
- {0xa60c, 0xa60c, 1},
- {0xa9cf, 0xa9cf, 1},
- {0xaa70, 0xaa70, 1},
- {0xaadd, 0xaadd, 1},
- {0xff70, 0xff70, 1},
- },
-}
-
-var _Join_Control = &RangeTable{
- R16: []Range16{
- {0x200c, 0x200d, 1},
+ {0x1039f, 0x1039f, 1},
+ {0x103d0, 0x103d0, 1},
+ {0x10857, 0x10857, 1},
+ {0x1091f, 0x1091f, 1},
+ {0x10b3a, 0x10b3f, 1},
+ {0x11047, 0x1104d, 1},
+ {0x110be, 0x110c1, 1},
+ {0x12470, 0x12473, 1},
},
}
-var _Ideographic = &RangeTable{
+var _Unified_Ideograph = &RangeTable{
R16: []Range16{
- {0x3006, 0x3007, 1},
- {0x3021, 0x3029, 1},
- {0x3038, 0x303a, 1},
{0x3400, 0x4db5, 1},
{0x4e00, 0x9fcb, 1},
- {0xf900, 0xfa2d, 1},
- {0xfa30, 0xfa6d, 1},
- {0xfa70, 0xfad9, 1},
+ {0xfa0e, 0xfa0f, 1},
+ {0xfa11, 0xfa11, 1},
+ {0xfa13, 0xfa14, 1},
+ {0xfa1f, 0xfa1f, 1},
+ {0xfa21, 0xfa21, 1},
+ {0xfa23, 0xfa24, 1},
+ {0xfa27, 0xfa29, 1},
},
R32: []Range32{
{0x20000, 0x2a6d6, 1},
{0x2a700, 0x2b734, 1},
{0x2b740, 0x2b81d, 1},
- {0x2f800, 0x2fa1d, 1},
- },
-}
-
-var _Dash = &RangeTable{
- R16: []Range16{
- {0x002d, 0x002d, 1},
- {0x058a, 0x058a, 1},
- {0x05be, 0x05be, 1},
- {0x1400, 0x1400, 1},
- {0x1806, 0x1806, 1},
- {0x2010, 0x2015, 1},
- {0x2053, 0x2053, 1},
- {0x207b, 0x207b, 1},
- {0x208b, 0x208b, 1},
- {0x2212, 0x2212, 1},
- {0x2e17, 0x2e17, 1},
- {0x2e1a, 0x2e1a, 1},
- {0x301c, 0x301c, 1},
- {0x3030, 0x3030, 1},
- {0x30a0, 0x30a0, 1},
- {0xfe31, 0xfe32, 1},
- {0xfe58, 0xfe58, 1},
- {0xfe63, 0xfe63, 1},
- {0xff0d, 0xff0d, 1},
- },
-}
-
-var _IDS_Trinary_Operator = &RangeTable{
- R16: []Range16{
- {0x2ff2, 0x2ff3, 1},
- },
-}
-
-var _Other_Grapheme_Extend = &RangeTable{
- R16: []Range16{
- {0x09be, 0x09be, 1},
- {0x09d7, 0x09d7, 1},
- {0x0b3e, 0x0b3e, 1},
- {0x0b57, 0x0b57, 1},
- {0x0bbe, 0x0bbe, 1},
- {0x0bd7, 0x0bd7, 1},
- {0x0cc2, 0x0cc2, 1},
- {0x0cd5, 0x0cd6, 1},
- {0x0d3e, 0x0d3e, 1},
- {0x0d57, 0x0d57, 1},
- {0x0dcf, 0x0dcf, 1},
- {0x0ddf, 0x0ddf, 1},
- {0x200c, 0x200d, 1},
- {0xff9e, 0xff9f, 1},
- },
- R32: []Range32{
- {0x1d165, 0x1d165, 1},
- {0x1d16e, 0x1d172, 1},
},
}
-var _Other_Default_Ignorable_Code_Point = &RangeTable{
+var _Variation_Selector = &RangeTable{
R16: []Range16{
- {0x034f, 0x034f, 1},
- {0x115f, 0x1160, 1},
- {0x2065, 0x2069, 1},
- {0x3164, 0x3164, 1},
- {0xffa0, 0xffa0, 1},
- {0xfff0, 0xfff8, 1},
+ {0x180b, 0x180d, 1},
+ {0xfe00, 0xfe0f, 1},
},
R32: []Range32{
- {0xe0000, 0xe0000, 1},
- {0xe0002, 0xe001f, 1},
- {0xe0080, 0xe00ff, 1},
- {0xe01f0, 0xe0fff, 1},
+ {0xe0100, 0xe01ef, 1},
},
}
@@ -5746,15 +5746,40 @@ var caseOrbit = []foldPair{
// simple case folding to code points inside the category.
// If there is no entry for a category name, there are no such points.
var FoldCategory = map[string]*RangeTable{
- "Ll": foldLl,
- "Inherited": foldInherited,
- "M": foldM,
- "L": foldL,
- "Mn": foldMn,
"Common": foldCommon,
"Greek": foldGreek,
- "Lu": foldLu,
+ "Inherited": foldInherited,
+ "L": foldL,
+ "Ll": foldLl,
"Lt": foldLt,
+ "Lu": foldLu,
+ "M": foldM,
+ "Mn": foldMn,
+}
+
+var foldCommon = &RangeTable{
+ R16: []Range16{
+ {0x039c, 0x03bc, 32},
+ },
+}
+
+var foldGreek = &RangeTable{
+ R16: []Range16{
+ {0x00b5, 0x0345, 656},
+ },
+}
+
+var foldInherited = &RangeTable{
+ R16: []Range16{
+ {0x0399, 0x03b9, 32},
+ {0x1fbe, 0x1fbe, 1},
+ },
+}
+
+var foldL = &RangeTable{
+ R16: []Range16{
+ {0x0345, 0x0345, 1},
+ },
}
var foldLl = &RangeTable{
@@ -5861,42 +5886,17 @@ var foldLl = &RangeTable{
},
}
-var foldInherited = &RangeTable{
- R16: []Range16{
- {0x0399, 0x03b9, 32},
- {0x1fbe, 0x1fbe, 1},
- },
-}
-
-var foldM = &RangeTable{
- R16: []Range16{
- {0x0399, 0x03b9, 32},
- {0x1fbe, 0x1fbe, 1},
- },
-}
-
-var foldL = &RangeTable{
- R16: []Range16{
- {0x0345, 0x0345, 1},
- },
-}
-
-var foldMn = &RangeTable{
- R16: []Range16{
- {0x0399, 0x03b9, 32},
- {0x1fbe, 0x1fbe, 1},
- },
-}
-
-var foldCommon = &RangeTable{
- R16: []Range16{
- {0x039c, 0x03bc, 32},
- },
-}
-
-var foldGreek = &RangeTable{
+var foldLt = &RangeTable{
R16: []Range16{
- {0x00b5, 0x0345, 656},
+ {0x01c4, 0x01c6, 2},
+ {0x01c7, 0x01c9, 2},
+ {0x01ca, 0x01cc, 2},
+ {0x01f1, 0x01f3, 2},
+ {0x1f80, 0x1f87, 1},
+ {0x1f90, 0x1f97, 1},
+ {0x1fa0, 0x1fa7, 1},
+ {0x1fb3, 0x1fc3, 16},
+ {0x1ff3, 0x1ff3, 1},
},
}
@@ -6000,17 +6000,17 @@ var foldLu = &RangeTable{
},
}
-var foldLt = &RangeTable{
+var foldM = &RangeTable{
R16: []Range16{
- {0x01c4, 0x01c6, 2},
- {0x01c7, 0x01c9, 2},
- {0x01ca, 0x01cc, 2},
- {0x01f1, 0x01f3, 2},
- {0x1f80, 0x1f87, 1},
- {0x1f90, 0x1f97, 1},
- {0x1fa0, 0x1fa7, 1},
- {0x1fb3, 0x1fc3, 16},
- {0x1ff3, 0x1ff3, 1},
+ {0x0399, 0x03b9, 32},
+ {0x1fbe, 0x1fbe, 1},
+ },
+}
+
+var foldMn = &RangeTable{
+ R16: []Range16{
+ {0x0399, 0x03b9, 32},
+ {0x1fbe, 0x1fbe, 1},
},
}
diff --git a/libgo/runtime/go-append.c b/libgo/runtime/go-append.c
index b1e882cc575..3a0c7781126 100644
--- a/libgo/runtime/go-append.c
+++ b/libgo/runtime/go-append.c
@@ -32,7 +32,7 @@ __go_append (struct __go_open_array a, void *bvalues, uintptr_t bcount,
ucount = (uintptr_t) a.__count + bcount;
count = (int) ucount;
if ((uintptr_t) count != ucount || count <= a.__count)
- __go_panic_msg ("append: slice overflow");
+ runtime_panicstring ("append: slice overflow");
if (count > a.__capacity)
{
diff --git a/libgo/runtime/go-close.c b/libgo/runtime/go-close.c
index a6df3833c26..7e32286dae0 100644
--- a/libgo/runtime/go-close.c
+++ b/libgo/runtime/go-close.c
@@ -18,7 +18,7 @@ __go_builtin_close (struct __go_channel *channel)
int i;
if (channel == NULL)
- __go_panic_msg ("close of nil channel");
+ runtime_panicstring ("close of nil channel");
i = pthread_mutex_lock (&channel->lock);
__go_assert (i == 0);
@@ -30,7 +30,7 @@ __go_builtin_close (struct __go_channel *channel)
{
i = pthread_mutex_unlock (&channel->lock);
__go_assert (i == 0);
- __go_panic_msg ("close of closed channel");
+ runtime_panicstring ("close of closed channel");
}
channel->is_closed = 1;
diff --git a/libgo/runtime/go-eface-compare.c b/libgo/runtime/go-eface-compare.c
index 673440542f3..d88d50569c2 100644
--- a/libgo/runtime/go-eface-compare.c
+++ b/libgo/runtime/go-eface-compare.c
@@ -4,7 +4,7 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
-#include "go-panic.h"
+#include "runtime.h"
#include "interface.h"
/* Compare two interface values. Return 0 for equal, not zero for not
@@ -20,7 +20,7 @@ __go_empty_interface_compare (struct __go_empty_interface left,
if (((uintptr_t) left_descriptor & reflectFlags) != 0
|| ((uintptr_t) right.__type_descriptor & reflectFlags) != 0)
- __go_panic_msg ("invalid interface value");
+ runtime_panicstring ("invalid interface value");
if (left_descriptor == NULL && right.__type_descriptor == NULL)
return 0;
diff --git a/libgo/runtime/go-eface-val-compare.c b/libgo/runtime/go-eface-val-compare.c
index d754cc5f36e..fed3fdb4432 100644
--- a/libgo/runtime/go-eface-val-compare.c
+++ b/libgo/runtime/go-eface-val-compare.c
@@ -4,7 +4,7 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
-#include "go-panic.h"
+#include "runtime.h"
#include "go-type.h"
#include "interface.h"
@@ -21,7 +21,7 @@ __go_empty_interface_value_compare (
left_descriptor = left.__type_descriptor;
if (((uintptr_t) left_descriptor & reflectFlags) != 0)
- __go_panic_msg ("invalid interface value");
+ runtime_panicstring ("invalid interface value");
if (left_descriptor == NULL)
return 1;
if (!__go_type_descriptors_equal (left_descriptor, right_descriptor))
diff --git a/libgo/runtime/go-interface-eface-compare.c b/libgo/runtime/go-interface-eface-compare.c
index ff69a2749d4..db03b914c84 100644
--- a/libgo/runtime/go-interface-eface-compare.c
+++ b/libgo/runtime/go-interface-eface-compare.c
@@ -4,7 +4,7 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
-#include "go-panic.h"
+#include "runtime.h"
#include "interface.h"
/* Compare a non-empty interface value with an empty interface value.
@@ -18,7 +18,7 @@ __go_interface_empty_compare (struct __go_interface left,
const struct __go_type_descriptor *left_descriptor;
if (((uintptr_t) right.__type_descriptor & reflectFlags) != 0)
- __go_panic_msg ("invalid interface value");
+ runtime_panicstring ("invalid interface value");
if (left.__methods == NULL && right.__type_descriptor == NULL)
return 0;
if (left.__methods == NULL || right.__type_descriptor == NULL)
diff --git a/libgo/runtime/go-make-slice.c b/libgo/runtime/go-make-slice.c
index a818a7f76d9..765e7c021b7 100644
--- a/libgo/runtime/go-make-slice.c
+++ b/libgo/runtime/go-make-slice.c
@@ -31,14 +31,14 @@ __go_make_slice2 (const struct __go_type_descriptor *td, uintptr_t len,
ilen = (int) len;
if (ilen < 0 || (uintptr_t) ilen != len)
- __go_panic_msg ("makeslice: len out of range");
+ runtime_panicstring ("makeslice: len out of range");
icap = (int) cap;
if (cap < len
|| (uintptr_t) icap != cap
|| (std->__element_type->__size > 0
&& cap > (uintptr_t) -1U / std->__element_type->__size))
- __go_panic_msg ("makeslice: cap out of range");
+ runtime_panicstring ("makeslice: cap out of range");
ret.__count = ilen;
ret.__capacity = icap;
diff --git a/libgo/runtime/go-map-delete.c b/libgo/runtime/go-map-delete.c
index a8f928f0c9a..cb10d8dcdc0 100644
--- a/libgo/runtime/go-map-delete.c
+++ b/libgo/runtime/go-map-delete.c
@@ -7,9 +7,9 @@
#include <stddef.h>
#include <stdlib.h>
+#include "runtime.h"
#include "go-alloc.h"
#include "go-assert.h"
-#include "go-panic.h"
#include "map.h"
/* Delete the entry matching KEY from MAP. */
@@ -27,7 +27,7 @@ __go_map_delete (struct __go_map *map, const void *key)
void **pentry;
if (map == NULL)
- __go_panic_msg ("deletion of entry in nil map");
+ runtime_panicstring ("deletion of entry in nil map");
descriptor = map->__descriptor;
diff --git a/libgo/runtime/go-map-index.c b/libgo/runtime/go-map-index.c
index 92a806868bc..ffb532bee88 100644
--- a/libgo/runtime/go-map-index.c
+++ b/libgo/runtime/go-map-index.c
@@ -7,9 +7,9 @@
#include <stddef.h>
#include <stdlib.h>
+#include "runtime.h"
#include "go-alloc.h"
#include "go-assert.h"
-#include "go-panic.h"
#include "map.h"
/* Rehash MAP to a larger size. */
@@ -89,7 +89,7 @@ __go_map_index (struct __go_map *map, const void *key, _Bool insert)
if (map == NULL)
{
if (insert)
- __go_panic_msg ("assignment to entry in nil map");
+ runtime_panicstring ("assignment to entry in nil map");
return NULL;
}
diff --git a/libgo/runtime/go-new-channel.c b/libgo/runtime/go-new-channel.c
index 2f5bf2ea20a..fe13c5efab6 100644
--- a/libgo/runtime/go-new-channel.c
+++ b/libgo/runtime/go-new-channel.c
@@ -7,9 +7,9 @@
#include <stddef.h>
#include <stdint.h>
+#include "runtime.h"
#include "go-alloc.h"
#include "go-assert.h"
-#include "go-panic.h"
#include "channel.h"
struct __go_channel*
@@ -34,7 +34,7 @@ __go_new_channel (const struct __go_type_descriptor *channel_type,
if (ientries < 0
|| (uintptr_t) ientries != entries
|| (element_size > 0 && entries > (uintptr_t) -1 / element_size))
- __go_panic_msg ("chan size out of range");
+ runtime_panicstring ("chan size out of range");
alloc_size = (element_size + sizeof (uint64_t) - 1) / sizeof (uint64_t);
diff --git a/libgo/runtime/go-new-map.c b/libgo/runtime/go-new-map.c
index 05ac8a1a40c..288e1883f9d 100644
--- a/libgo/runtime/go-new-map.c
+++ b/libgo/runtime/go-new-map.c
@@ -4,8 +4,8 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
+#include "runtime.h"
#include "go-alloc.h"
-#include "go-panic.h"
#include "map.h"
/* List of prime numbers, copied from libstdc++/src/hashtable.c. */
@@ -111,7 +111,7 @@ __go_new_map (const struct __go_map_descriptor *descriptor, uintptr_t entries)
ientries = (int) entries;
if (ientries < 0 || (uintptr_t) ientries != entries)
- __go_panic_msg ("map size out of range");
+ runtime_panicstring ("map size out of range");
if (entries == 0)
entries = 5;
diff --git a/libgo/runtime/go-panic.c b/libgo/runtime/go-panic.c
index 23df57930b7..2e4a7883c18 100644
--- a/libgo/runtime/go-panic.c
+++ b/libgo/runtime/go-panic.c
@@ -105,22 +105,3 @@ __go_panic (struct __go_empty_interface arg)
__printpanics (g->panic);
runtime_dopanic (0);
}
-
-/* This is used by the runtime library. */
-
-void
-__go_panic_msg (const char* msg)
-{
- size_t len;
- unsigned char *sdata;
- struct __go_string s;
- struct __go_empty_interface arg;
-
- len = __builtin_strlen (msg);
- sdata = runtime_mallocgc (len, FlagNoPointers, 0, 0);
- __builtin_memcpy (sdata, msg, len);
- s.__data = sdata;
- s.__length = len;
- newErrorString(s, &arg);
- __go_panic (arg);
-}
diff --git a/libgo/runtime/go-panic.h b/libgo/runtime/go-panic.h
index bd3e238aef4..41996e43b5f 100644
--- a/libgo/runtime/go-panic.h
+++ b/libgo/runtime/go-panic.h
@@ -34,9 +34,6 @@ struct __go_panic_stack
extern void __go_panic (struct __go_empty_interface)
__attribute__ ((noreturn));
-extern void __go_panic_msg (const char* msg)
- __attribute__ ((noreturn));
-
extern void __go_print_string (struct __go_string);
extern struct __go_empty_interface __go_recover (void);
@@ -55,7 +52,8 @@ extern void newTypeAssertionError(const struct __go_type_descriptor *pt1,
struct __go_empty_interface *ret)
__asm__ ("libgo_runtime.runtime.NewTypeAssertionError");
-extern void newErrorString(struct __go_string, struct __go_empty_interface *)
+extern void runtime_newErrorString(struct __go_string,
+ struct __go_empty_interface *)
__asm__ ("libgo_runtime.runtime.NewErrorString");
extern void printany(struct __go_empty_interface)
diff --git a/libgo/runtime/go-reflect-map.c b/libgo/runtime/go-reflect-map.c
index eb0590602e0..c06aef17eed 100644
--- a/libgo/runtime/go-reflect-map.c
+++ b/libgo/runtime/go-reflect-map.c
@@ -7,9 +7,9 @@
#include <stdlib.h>
#include <stdint.h>
+#include "runtime.h"
#include "go-alloc.h"
#include "go-assert.h"
-#include "go-panic.h"
#include "go-type.h"
#include "map.h"
@@ -90,7 +90,7 @@ mapassign (struct __go_map_type *mt, uintptr_t m, uintptr_t key_i,
__go_assert (mt->__common.__code == GO_MAP);
if (map == NULL)
- __go_panic_msg ("assignment to entry in nil map");
+ runtime_panicstring ("assignment to entry in nil map");
key_descriptor = mt->__key_type;
if (__go_is_pointer_type (key_descriptor))
diff --git a/libgo/runtime/go-reflect.c b/libgo/runtime/go-reflect.c
index af7d5e8968f..d14a5805549 100644
--- a/libgo/runtime/go-reflect.c
+++ b/libgo/runtime/go-reflect.c
@@ -7,9 +7,9 @@
#include <stdlib.h>
#include <stdint.h>
+#include "runtime.h"
#include "interface.h"
#include "go-alloc.h"
-#include "go-panic.h"
#include "go-string.h"
#include "go-type.h"
@@ -122,7 +122,7 @@ Reflect (struct __go_empty_interface e)
struct reflect_ret ret;
if (((uintptr_t) e.__type_descriptor & reflectFlags) != 0)
- __go_panic_msg ("invalid interface value");
+ runtime_panicstring ("invalid interface value");
if (e.__type_descriptor == NULL)
{
@@ -170,7 +170,7 @@ Typeof (const struct __go_empty_interface e)
struct __go_empty_interface ret;
if (((uintptr_t) e.__type_descriptor & reflectFlags) != 0)
- __go_panic_msg ("invalid interface value");
+ runtime_panicstring ("invalid interface value");
if (e.__type_descriptor == NULL)
{
diff --git a/libgo/runtime/go-runtime-error.c b/libgo/runtime/go-runtime-error.c
index ceba2d673a9..f732e7f017f 100644
--- a/libgo/runtime/go-runtime-error.c
+++ b/libgo/runtime/go-runtime-error.c
@@ -4,7 +4,7 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
-#include "go-panic.h"
+#include "runtime.h"
/* The compiler generates calls to this function. This enum values
are known to the compiler and used by compiled code. Any change
@@ -59,26 +59,26 @@ __go_runtime_error (int i)
case SLICE_INDEX_OUT_OF_BOUNDS:
case ARRAY_INDEX_OUT_OF_BOUNDS:
case STRING_INDEX_OUT_OF_BOUNDS:
- __go_panic_msg ("index out of range");
+ runtime_panicstring ("index out of range");
case SLICE_SLICE_OUT_OF_BOUNDS:
case ARRAY_SLICE_OUT_OF_BOUNDS:
case STRING_SLICE_OUT_OF_BOUNDS:
- __go_panic_msg ("slice bounds out of range");
+ runtime_panicstring ("slice bounds out of range");
case NIL_DEREFERENCE:
- __go_panic_msg ("nil pointer dereference");
+ runtime_panicstring ("nil pointer dereference");
case MAKE_SLICE_OUT_OF_BOUNDS:
- __go_panic_msg ("make slice len or cap out of range");
+ runtime_panicstring ("make slice len or cap out of range");
case MAKE_MAP_OUT_OF_BOUNDS:
- __go_panic_msg ("make map len out of range");
+ runtime_panicstring ("make map len out of range");
case MAKE_CHAN_OUT_OF_BOUNDS:
- __go_panic_msg ("make chan len out of range");
+ runtime_panicstring ("make chan len out of range");
default:
- __go_panic_msg ("unknown runtime error");
+ runtime_panicstring ("unknown runtime error");
}
}
diff --git a/libgo/runtime/go-send-nb-small.c b/libgo/runtime/go-send-nb-small.c
index f3336099bf7..c77ee9183e2 100644
--- a/libgo/runtime/go-send-nb-small.c
+++ b/libgo/runtime/go-send-nb-small.c
@@ -31,7 +31,7 @@ __go_send_nonblocking_acquire (struct __go_channel *channel)
{
i = pthread_mutex_unlock (&channel->lock);
__go_assert (i == 0);
- __go_panic_msg ("send on closed channel");
+ runtime_panicstring ("send on closed channel");
}
if (channel->num_entries > 0)
diff --git a/libgo/runtime/go-send-small.c b/libgo/runtime/go-send-small.c
index 89a7032756d..06bcb41b9ad 100644
--- a/libgo/runtime/go-send-small.c
+++ b/libgo/runtime/go-send-small.c
@@ -31,7 +31,7 @@ __go_send_acquire (struct __go_channel *channel, _Bool for_select)
channel->selected_for_send = 0;
i = pthread_mutex_unlock (&channel->lock);
__go_assert (i == 0);
- __go_panic_msg ("send on closed channel");
+ runtime_panicstring ("send on closed channel");
}
/* If somebody else has the channel locked for sending, we have
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c
index 468235ddf4e..958b421c871 100644
--- a/libgo/runtime/go-signal.c
+++ b/libgo/runtime/go-signal.c
@@ -178,7 +178,7 @@ sighandler (int sig)
i = sigprocmask (SIG_UNBLOCK, &clear, NULL);
__go_assert (i == 0);
- __go_panic_msg (msg);
+ runtime_panicstring (msg);
}
for (i = 0; signals[i].sig != -1; ++i)
diff --git a/libgo/runtime/go-strslice.c b/libgo/runtime/go-strslice.c
index 40ccac617a1..8d916c46084 100644
--- a/libgo/runtime/go-strslice.c
+++ b/libgo/runtime/go-strslice.c
@@ -20,7 +20,7 @@ __go_string_slice (struct __go_string s, int start, int end)
if (end == -1)
end = len;
if (start > len || end < start || end > len)
- __go_panic_msg ("string index out of bounds");
+ runtime_panicstring ("string index out of bounds");
ret.__data = s.__data + start;
ret.__length = end - start;
return ret;
diff --git a/libgo/runtime/go-type-eface.c b/libgo/runtime/go-type-eface.c
index cea9c240a66..5bf932fc8ba 100644
--- a/libgo/runtime/go-type-eface.c
+++ b/libgo/runtime/go-type-eface.c
@@ -4,8 +4,8 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
+#include "runtime.h"
#include "interface.h"
-#include "go-panic.h"
#include "go-type.h"
/* A hash function for an empty interface. */
@@ -46,7 +46,7 @@ __go_type_equal_empty_interface (const void *vv1, const void *vv2,
v2_descriptor = v2->__type_descriptor;
if (((uintptr_t) v1_descriptor & reflectFlags) != 0
|| ((uintptr_t) v2_descriptor & reflectFlags) != 0)
- __go_panic_msg ("invalid interface value");
+ runtime_panicstring ("invalid interface value");
if (v1_descriptor == NULL || v2_descriptor == NULL)
return v1_descriptor == v2_descriptor;
if (!__go_type_descriptors_equal (v1_descriptor, v2_descriptor))
diff --git a/libgo/runtime/go-type-error.c b/libgo/runtime/go-type-error.c
index 865850c9ca0..ba3146e3dda 100644
--- a/libgo/runtime/go-type-error.c
+++ b/libgo/runtime/go-type-error.c
@@ -4,8 +4,8 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
+#include "runtime.h"
#include "go-type.h"
-#include "go-panic.h"
/* A hash function used for a type which does not support hash
functions. */
@@ -14,7 +14,7 @@ size_t
__go_type_hash_error (const void *val __attribute__ ((unused)),
size_t key_size __attribute__ ((unused)))
{
- __go_panic_msg ("hash of unhashable type");
+ runtime_panicstring ("hash of unhashable type");
}
/* An equality function for an interface. */
@@ -24,5 +24,5 @@ __go_type_equal_error (const void *v1 __attribute__ ((unused)),
const void *v2 __attribute__ ((unused)),
size_t key_size __attribute__ ((unused)))
{
- __go_panic_msg ("comparing uncomparable types");
+ runtime_panicstring ("comparing uncomparable types");
}
diff --git a/libgo/runtime/go-unreflect.c b/libgo/runtime/go-unreflect.c
index c4da5fdcf05..6f1ea732fa3 100644
--- a/libgo/runtime/go-unreflect.c
+++ b/libgo/runtime/go-unreflect.c
@@ -4,8 +4,8 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
+#include "runtime.h"
#include "go-alloc.h"
-#include "go-panic.h"
#include "go-type.h"
#include "interface.h"
@@ -21,7 +21,7 @@ Unreflect (struct __go_empty_interface type, void *object)
struct __go_empty_interface ret;
if (((uintptr_t) type.__type_descriptor & reflectFlags) != 0)
- __go_panic_msg ("invalid interface value");
+ runtime_panicstring ("invalid interface value");
/* FIXME: We should check __type_descriptor to verify that this is
really a type descriptor. */
diff --git a/libgo/runtime/go-unsafe-new.c b/libgo/runtime/go-unsafe-new.c
index b0a65c42263..c60e05b3bda 100644
--- a/libgo/runtime/go-unsafe-new.c
+++ b/libgo/runtime/go-unsafe-new.c
@@ -4,8 +4,8 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
+#include "runtime.h"
#include "go-alloc.h"
-#include "go-panic.h"
#include "go-type.h"
#include "interface.h"
@@ -22,7 +22,7 @@ New (struct __go_empty_interface type)
const struct __go_type_descriptor *descriptor;
if (((uintptr_t) type.__type_descriptor & reflectFlags) != 0)
- __go_panic_msg ("invalid interface value");
+ runtime_panicstring ("invalid interface value");
/* FIXME: We should check __type_descriptor to verify that this is
really a type descriptor. */
diff --git a/libgo/runtime/go-unsafe-newarray.c b/libgo/runtime/go-unsafe-newarray.c
index 5fd81ce2733..470ed2d0c72 100644
--- a/libgo/runtime/go-unsafe-newarray.c
+++ b/libgo/runtime/go-unsafe-newarray.c
@@ -4,8 +4,8 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
+#include "runtime.h"
#include "go-alloc.h"
-#include "go-panic.h"
#include "go-type.h"
#include "interface.h"
@@ -23,7 +23,7 @@ NewArray (struct __go_empty_interface type, int n)
const struct __go_type_descriptor *descriptor;
if (((uintptr_t) type.__type_descriptor & reflectFlags) != 0)
- __go_panic_msg ("invalid interface value");
+ runtime_panicstring ("invalid interface value");
/* FIXME: We should check __type_descriptor to verify that this is
really a type descriptor. */
diff --git a/libgo/runtime/iface.goc b/libgo/runtime/iface.goc
index 05e37736b88..7c74e80ac3a 100644
--- a/libgo/runtime/iface.goc
+++ b/libgo/runtime/iface.goc
@@ -3,12 +3,10 @@
// license that can be found in the LICENSE file.
package runtime
-#include "go-panic.h"
+#include "runtime.h"
#include "go-type.h"
#include "interface.h"
-#define nil NULL
-typedef _Bool bool;
typedef struct __go_type_descriptor descriptor;
typedef const struct __go_type_descriptor const_descriptor;
typedef struct __go_interface interface;
@@ -35,7 +33,7 @@ func ifacetype(i interface) (d *const_descriptor) {
// Convert an empty interface to an empty interface.
func ifaceE2E2(e empty_interface) (ret empty_interface, ok bool) {
if(((uintptr_t)e.__type_descriptor&reflectFlags) != 0)
- __go_panic_msg("invalid interface value");
+ runtime_panicstring("invalid interface value");
ret = e;
ok = ret.__type_descriptor != nil;
}
@@ -56,7 +54,7 @@ func ifaceI2E2(i interface) (ret empty_interface, ok bool) {
// Convert an empty interface to a non-empty interface.
func ifaceE2I2(inter *descriptor, e empty_interface) (ret interface, ok bool) {
if(((uintptr_t)e.__type_descriptor&reflectFlags) != 0)
- __go_panic_msg("invalid interface value");
+ runtime_panicstring("invalid interface value");
if (e.__type_descriptor == nil) {
ret.__methods = nil;
ret.__object = nil;
@@ -87,7 +85,7 @@ func ifaceI2I2(inter *descriptor, i interface) (ret interface, ok bool) {
// Convert an empty interface to a pointer type.
func ifaceE2T2P(inter *descriptor, e empty_interface) (ret *void, ok bool) {
if(((uintptr_t)e.__type_descriptor&reflectFlags) != 0)
- __go_panic_msg("invalid interface value");
+ runtime_panicstring("invalid interface value");
if (!__go_type_descriptors_equal(inter, e.__type_descriptor)) {
ret = nil;
ok = 0;
@@ -112,7 +110,7 @@ func ifaceI2T2P(inter *descriptor, i interface) (ret *void, ok bool) {
// Convert an empty interface to a non-pointer type.
func ifaceE2T2(inter *descriptor, e empty_interface, ret *void) (ok bool) {
if(((uintptr_t)e.__type_descriptor&reflectFlags) != 0)
- __go_panic_msg("invalid interface value");
+ runtime_panicstring("invalid interface value");
if (!__go_type_descriptors_equal(inter, e.__type_descriptor)) {
__builtin_memset(ret, 0, inter->__size);
ok = 0;
diff --git a/libgo/runtime/lock_sema.c b/libgo/runtime/lock_sema.c
index 2fa837d8b0e..6b4fffbdcf8 100644
--- a/libgo/runtime/lock_sema.c
+++ b/libgo/runtime/lock_sema.c
@@ -32,9 +32,11 @@ enum
void
runtime_lock(Lock *l)
{
+ M *m;
uintptr v;
uint32 i, spin;
+ m = runtime_m();
if(m->locks++ < 0)
runtime_throw("runtime_lock: lock count");
@@ -91,7 +93,7 @@ runtime_unlock(Lock *l)
uintptr v;
M *mp;
- if(--m->locks < 0)
+ if(--runtime_m()->locks < 0)
runtime_throw("runtime_unlock: lock count");
for(;;) {
@@ -144,6 +146,9 @@ runtime_notewakeup(Note *n)
void
runtime_notesleep(Note *n)
{
+ M *m;
+
+ m = runtime_m();
if(m->waitsema == 0)
m->waitsema = runtime_semacreate();
if(!runtime_casp(&n->waitm, nil, m)) { // must be LOCKED (got wakeup)
@@ -158,6 +163,7 @@ runtime_notesleep(Note *n)
void
runtime_notetsleep(Note *n, int64 ns)
{
+ M *m;
M *mp;
int64 deadline, now;
@@ -166,6 +172,7 @@ runtime_notetsleep(Note *n, int64 ns)
return;
}
+ m = runtime_m();
if(m->waitsema == 0)
m->waitsema = runtime_semacreate();
diff --git a/libgo/runtime/malloc.goc b/libgo/runtime/malloc.goc
index 73446bf8347..f5321856eac 100644
--- a/libgo/runtime/malloc.goc
+++ b/libgo/runtime/malloc.goc
@@ -17,9 +17,6 @@ package runtime
#include "go-string.h"
#include "interface.h"
#include "go-type.h"
-typedef struct __go_empty_interface Eface;
-typedef struct __go_type_descriptor Type;
-typedef struct __go_func_type FuncType;
MHeap runtime_mheap;
extern MStats mstats; // defined in extern.go
diff --git a/libgo/runtime/map.goc b/libgo/runtime/map.goc
index da67d49287d..e4b8456dc36 100644
--- a/libgo/runtime/map.goc
+++ b/libgo/runtime/map.goc
@@ -3,13 +3,9 @@
// license that can be found in the LICENSE file.
package runtime
+#include "runtime.h"
#include "map.h"
-#define nil NULL
-typedef unsigned char byte;
-typedef _Bool bool;
-
-typedef struct __go_map_type MapType;
typedef struct __go_map Hmap;
typedef struct __go_hash_iter hiter;
diff --git a/libgo/runtime/reflect.goc b/libgo/runtime/reflect.goc
index 4666dd5389c..d3cde7c0e5b 100644
--- a/libgo/runtime/reflect.goc
+++ b/libgo/runtime/reflect.goc
@@ -8,10 +8,6 @@ package reflect
#include "runtime.h"
#include "go-panic.h"
-typedef struct __go_type_descriptor Type;
-typedef struct __go_interface Iface;
-typedef struct __go_empty_interface Eface;
-
func ifaceE2I(inter *Type, e Eface, ret *Iface) {
const Type *t;
Eface err;
diff --git a/libgo/runtime/runtime.c b/libgo/runtime/runtime.c
index de4c982620f..8e4433b0d6c 100644
--- a/libgo/runtime/runtime.c
+++ b/libgo/runtime/runtime.c
@@ -70,6 +70,19 @@ runtime_throw(const char *s)
runtime_exit(1); // even more not reached
}
+void
+runtime_panicstring(const char *s)
+{
+ Eface err;
+
+ if(runtime_m()->gcing) {
+ runtime_printf("panic: %s\n", s);
+ runtime_throw("panic during gc");
+ }
+ runtime_newErrorString(runtime_gostringnocopy((const byte*)s), &err);
+ runtime_panic(err);
+}
+
static int32 argc;
static byte** argv;
@@ -95,7 +108,7 @@ runtime_goargs(void)
s = runtime_malloc(argc*sizeof s[0]);
for(i=0; i<argc; i++)
- s[i] = runtime_gostringnocopy((byte*)argv[i]);
+ s[i] = runtime_gostringnocopy((const byte*)argv[i]);
os_Args.__values = (void*)s;
os_Args.__count = argc;
os_Args.__capacity = argc;
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 818465cb897..9455ae88c5a 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -57,10 +57,16 @@ typedef struct MCache MCache;
typedef struct FixAlloc FixAlloc;
typedef struct __go_defer_stack Defer;
+typedef struct __go_interface Iface;
+typedef struct __go_empty_interface Eface;
+typedef struct __go_type_descriptor Type;
typedef struct __go_panic_stack Panic;
typedef struct __go_open_array Slice;
typedef struct __go_string String;
+typedef struct __go_func_type FuncType;
+typedef struct __go_map_type MapType;
+
/*
* per-cpu declaration.
*/
@@ -211,10 +217,11 @@ void runtime_osinit();
void runtime_goargs(void);
void runtime_goenvs(void);
void runtime_throw(const char*);
+void runtime_panicstring(const char*) __attribute__ ((noreturn));
void* runtime_mal(uintptr);
void runtime_schedinit(void);
void runtime_initsig(int32);
-String runtime_gostringnocopy(byte*);
+String runtime_gostringnocopy(const byte*);
void* runtime_mstart(void*);
G* runtime_malg(int32, byte**, size_t*);
void runtime_minit(void);
@@ -274,8 +281,13 @@ void runtime_semawakeup(M*);
void runtime_futexsleep(uint32*, uint32, int64);
void runtime_futexwakeup(uint32*, uint32);
+/*
+ * runtime go-called
+ */
+void runtime_panic(Eface);
/* Functions. */
+#define runtime_panic __go_panic
#define runtime_printf printf
#define runtime_malloc(s) __go_alloc(s)
#define runtime_free(p) __go_free(p)
diff --git a/libgo/runtime/string.goc b/libgo/runtime/string.goc
index aa75628730e..fbbe393bbef 100644
--- a/libgo/runtime/string.goc
+++ b/libgo/runtime/string.goc
@@ -15,7 +15,7 @@ runtime_findnull(const byte *s)
}
String
-runtime_gostringnocopy(byte *str)
+runtime_gostringnocopy(const byte *str)
{
String s;
diff --git a/libgo/runtime/thread-linux.c b/libgo/runtime/thread-linux.c
index b51f4970d25..c08cc0dba29 100644
--- a/libgo/runtime/thread-linux.c
+++ b/libgo/runtime/thread-linux.c
@@ -62,6 +62,10 @@ runtime_futexwakeup(uint32 *addr, uint32 cnt)
*(int32*)0x1006 = 0x1006;
}
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
static int32
getproccount(void)
{
diff --git a/libgo/runtime/thread-sema.c b/libgo/runtime/thread-sema.c
index b0a6dc337fd..71555d09725 100644
--- a/libgo/runtime/thread-sema.c
+++ b/libgo/runtime/thread-sema.c
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include "config.h"
#include "runtime.h"
#include <errno.h>
@@ -9,19 +10,43 @@
#include <time.h>
#include <semaphore.h>
+/* If we don't have sem_timedwait, use pthread_cond_timedwait instead.
+ We don't always use condition variables because on some systems
+ pthread_mutex_lock and pthread_mutex_unlock must be called by the
+ same thread. That is never true of semaphores. */
+
+struct go_sem
+{
+ sem_t sem;
+
+#ifndef HAVE_SEM_TIMEDWAIT
+ int timedwait;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+#endif
+};
+
/* Create a semaphore. */
uintptr
runtime_semacreate(void)
{
- sem_t *p;
+ struct go_sem *p;
/* Call malloc rather than runtime_malloc. This will allocate space
on the C heap. We can't call runtime_malloc here because it
could cause a deadlock. */
- p = malloc (sizeof (sem_t));
- if (sem_init (p, 0, 0) != 0)
+ p = malloc (sizeof (struct go_sem));
+ if (sem_init (&p->sem, 0, 0) != 0)
runtime_throw ("sem_init");
+
+#ifndef HAVE_SEM_TIMEDWAIT
+ if (pthread_mutex_init (&p->mutex, NULL) != 0)
+ runtime_throw ("pthread_mutex_init");
+ if (pthread_cond_init (&p->cond, NULL) != 0)
+ runtime_throw ("pthread_cond_init");
+#endif
+
return (uintptr) p;
}
@@ -30,26 +55,56 @@ runtime_semacreate(void)
int32
runtime_semasleep (int64 ns)
{
+ M *m;
+ struct go_sem *sem;
int r;
+ m = runtime_m ();
+ sem = (struct go_sem *) m->waitsema;
if (ns >= 0)
{
+ int64 abs;
struct timespec ts;
+ int err;
+
+ abs = ns + runtime_nanotime ();
+ ts.tv_sec = abs / 1000000000LL;
+ ts.tv_nsec = abs % 1000000000LL;
+
+ err = 0;
- ns += runtime_nanotime ();
- ts.tv_sec = ns / 1000000000LL;
- ts.tv_nsec = ns % 1000000000LL;
- r = sem_timedwait ((sem_t *) m->waitsema, &ts);
+#ifdef HAVE_SEM_TIMEDWAIT
+ r = sem_timedwait (&sem->sem, &ts);
if (r != 0)
+ err = errno;
+#else
+ if (pthread_mutex_lock (&sem->mutex) != 0)
+ runtime_throw ("pthread_mutex_lock");
+
+ while ((r = sem_trywait (&sem->sem)) != 0)
{
- if (errno == ETIMEDOUT || errno == EINTR)
+ r = pthread_cond_timedwait (&sem->cond, &sem->mutex, &ts);
+ if (r != 0)
+ {
+ err = r;
+ break;
+ }
+ }
+
+ if (pthread_mutex_unlock (&sem->mutex) != 0)
+ runtime_throw ("pthread_mutex_unlock");
+#endif
+
+ if (err != 0)
+ {
+ if (err == ETIMEDOUT || err == EAGAIN || err == EINTR)
return -1;
runtime_throw ("sema_timedwait");
}
return 0;
}
- while (sem_wait ((sem_t *) m->waitsema) != 0)
+ while (sem_wait (&sem->sem) != 0)
{
if (errno == EINTR)
continue;
@@ -64,8 +119,20 @@ runtime_semasleep (int64 ns)
void
runtime_semawakeup (M *mp)
{
- if (sem_post ((sem_t *) mp->waitsema) != 0)
+ struct go_sem *sem;
+
+ sem = (struct go_sem *) mp->waitsema;
+ if (sem_post (&sem->sem) != 0)
runtime_throw ("sem_post");
+
+#ifndef HAVE_SEM_TIMEDWAIT
+ if (pthread_mutex_lock (&sem->mutex) != 0)
+ runtime_throw ("pthread_mutex_lock");
+ if (pthread_cond_broadcast (&sem->cond) != 0)
+ runtime_throw ("pthread_cond_broadcast");
+ if (pthread_mutex_unlock (&sem->mutex) != 0)
+ runtime_throw ("pthread_mutex_unlock");
+#endif
}
void
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index b52de1a1aea..f6278b77159 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,34 @@
+2011-11-30 Alan Modra <amodra@gmail.com>
+
+ PR libgomp/51298
+ * config/linux/bar.h: Use atomic rather than sync builtins.
+ * config/linux/bar.c: Likewise. Add missing acquire
+ synchronisation on generation field.
+ * task.c (gomp_barrier_handle_tasks): Regain lock so as to not
+ double unlock.
+
+2011-11-30 Alan Modra <amodra@gmail.com>
+
+ * ordered.c (gomp_ordered_sync): Add MEMMODEL_ACQ_REL fence.
+ * critical.c (GOMP_critical_start): Add MEMMODEL_RELEASE fence.
+ * config/linux/mutex.h: Use atomic rather than sync builtins.
+ * config/linux/mutex.c: Likewise. Comment. Use -1 for waiting state.
+ * config/linux/omp-lock.h: Comment fix.
+ * config/linux/arm/mutex.h: Delete.
+ * config/linux/powerpc/mutex.h: Delete.
+ * config/linux/ia64/mutex.h: Delete.
+ * config/linux/mips/mutex.h: Delete.
+
+2011-11-30 Alan Modra <amodra@gmail.com>
+
+ PR libgomp/51249
+ * config/linux/sem.h: Rewrite.
+ * config/linux/sem.c: Rewrite.
+
+2011-11-28 Richard Henderson <rth@redhat.com>
+
+ * libgomp.h (enum memmodel): New.
+
2011-11-21 Andreas Tobler <andreast@fgznet.ch>
* configure: Regenerate.
@@ -312,7 +343,7 @@
Tobias Burnus <burnus@net-b.de>
PR fortran/32049
- * configure.ac:
+ * configure.ac:
* configure: Regenerate.
2010-10-06 Marcus Shawcroft <marcus.shawcroft@arm.com>
@@ -1076,7 +1107,7 @@
(gomp_new_thread_pool, gomp_free_pool_helper, gomp_free_thread): New
functions.
(gomp_team_start): Create new pool if current thread doesn't have
- one. Use pool fields instead of global gomp_* variables.
+ one. Use pool fields instead of global gomp_* variables.
Initialize thread_pool field for new threads. Clear single_count.
Change last argument from ws to team, don't create
new team, set ts.work_share to &team->work_shares[0] and clear
@@ -1308,7 +1339,7 @@
inlines.
* config/posix/bar.c (gomp_barrier_init): Clear generation field.
(gomp_barrier_wait_end): Change second argument to
- gomp_barrier_state_t.
+ gomp_barrier_state_t.
(gomp_team_barrier_wait, gomp_team_barrier_wait_end,
gomp_team_barrier_wake): New functions.
* config/linux/mutex.c: Include wait.h instead of libgomp.h and
diff --git a/libgomp/config/linux/arm/mutex.h b/libgomp/config/linux/arm/mutex.h
deleted file mode 100644
index 30021d54746..00000000000
--- a/libgomp/config/linux/arm/mutex.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2010 Free Software Foundation, Inc.
- Contributed by ARM Ltd.
-
- This file is part of the GNU OpenMP Library (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* ARM needs the same correct usage of __sync_synchronize and
- __sync_lock_test_and_set as ia64. So we just use its mutex.h. */
-
-#include "config/linux/ia64/mutex.h"
diff --git a/libgomp/config/linux/bar.c b/libgomp/config/linux/bar.c
index 3e0379eb695..223a2aec432 100644
--- a/libgomp/config/linux/bar.c
+++ b/libgomp/config/linux/bar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2008, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
@@ -37,17 +37,15 @@ gomp_barrier_wait_end (gomp_barrier_t *bar, gomp_barrier_state_t state)
{
/* Next time we'll be awaiting TOTAL threads again. */
bar->awaited = bar->total;
- atomic_write_barrier ();
- bar->generation += 4;
+ __atomic_store_n (&bar->generation, bar->generation + 4,
+ MEMMODEL_RELEASE);
futex_wake ((int *) &bar->generation, INT_MAX);
}
else
{
- unsigned int generation = state;
-
do
- do_wait ((int *) &bar->generation, generation);
- while (bar->generation == generation);
+ do_wait ((int *) &bar->generation, state);
+ while (__atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE) == state);
}
}
@@ -81,15 +79,15 @@ gomp_team_barrier_wake (gomp_barrier_t *bar, int count)
void
gomp_team_barrier_wait_end (gomp_barrier_t *bar, gomp_barrier_state_t state)
{
- unsigned int generation;
+ unsigned int generation, gen;
if (__builtin_expect ((state & 1) != 0, 0))
{
/* Next time we'll be awaiting TOTAL threads again. */
struct gomp_thread *thr = gomp_thread ();
struct gomp_team *team = thr->ts.team;
+
bar->awaited = bar->total;
- atomic_write_barrier ();
if (__builtin_expect (team->task_count, 0))
{
gomp_barrier_handle_tasks (state);
@@ -97,7 +95,7 @@ gomp_team_barrier_wait_end (gomp_barrier_t *bar, gomp_barrier_state_t state)
}
else
{
- bar->generation = state + 3;
+ __atomic_store_n (&bar->generation, state + 3, MEMMODEL_RELEASE);
futex_wake ((int *) &bar->generation, INT_MAX);
return;
}
@@ -107,12 +105,16 @@ gomp_team_barrier_wait_end (gomp_barrier_t *bar, gomp_barrier_state_t state)
do
{
do_wait ((int *) &bar->generation, generation);
- if (__builtin_expect (bar->generation & 1, 0))
- gomp_barrier_handle_tasks (state);
- if ((bar->generation & 2))
+ gen = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE);
+ if (__builtin_expect (gen & 1, 0))
+ {
+ gomp_barrier_handle_tasks (state);
+ gen = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE);
+ }
+ if ((gen & 2) != 0)
generation |= 2;
}
- while (bar->generation != state + 4);
+ while (gen != state + 4);
}
void
diff --git a/libgomp/config/linux/bar.h b/libgomp/config/linux/bar.h
index 9c1a8a07687..58bd40d6989 100644
--- a/libgomp/config/linux/bar.h
+++ b/libgomp/config/linux/bar.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2008, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
@@ -50,7 +50,7 @@ static inline void gomp_barrier_init (gomp_barrier_t *bar, unsigned count)
static inline void gomp_barrier_reinit (gomp_barrier_t *bar, unsigned count)
{
- __sync_fetch_and_add (&bar->awaited, count - bar->total);
+ __atomic_add_fetch (&bar->awaited, count - bar->total, MEMMODEL_ACQ_REL);
bar->total = count;
}
@@ -69,10 +69,13 @@ extern void gomp_team_barrier_wake (gomp_barrier_t *, int);
static inline gomp_barrier_state_t
gomp_barrier_wait_start (gomp_barrier_t *bar)
{
- unsigned int ret = bar->generation & ~3;
- /* Do we need any barrier here or is __sync_add_and_fetch acting
- as the needed LoadLoad barrier already? */
- ret += __sync_add_and_fetch (&bar->awaited, -1) == 0;
+ unsigned int ret = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE) & ~3;
+ /* A memory barrier is needed before exiting from the various forms
+ of gomp_barrier_wait, to satisfy OpenMP API version 3.1 section
+ 2.8.6 flush Construct, which says there is an implicit flush during
+ a barrier region. This is a convenient place to add the barrier,
+ so we use MEMMODEL_ACQ_REL here rather than MEMMODEL_ACQUIRE. */
+ ret += __atomic_add_fetch (&bar->awaited, -1, MEMMODEL_ACQ_REL) == 0;
return ret;
}
diff --git a/libgomp/config/linux/ia64/mutex.h b/libgomp/config/linux/ia64/mutex.h
deleted file mode 100644
index 8a67673df40..00000000000
--- a/libgomp/config/linux/ia64/mutex.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2005, 2008, 2009, 2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson <rth@redhat.com>.
-
- This file is part of the GNU OpenMP Library (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This is a Linux specific implementation of a mutex synchronization
- mechanism for libgomp. This type is private to the library. This
- implementation uses atomic instructions and the futex syscall. */
-
-#ifndef GOMP_MUTEX_H
-#define GOMP_MUTEX_H 1
-
-typedef int gomp_mutex_t;
-
-#define GOMP_MUTEX_INIT_0 1
-
-static inline void gomp_mutex_init (gomp_mutex_t *mutex)
-{
- *mutex = 0;
-}
-
-extern void gomp_mutex_lock_slow (gomp_mutex_t *mutex, int);
-static inline void gomp_mutex_lock (gomp_mutex_t *mutex)
-{
- int oldval = __sync_val_compare_and_swap (mutex, 0, 1);
- if (__builtin_expect (oldval, 0))
- gomp_mutex_lock_slow (mutex, oldval);
-}
-
-extern void gomp_mutex_unlock_slow (gomp_mutex_t *mutex);
-
-/* IA64 needs a __sync_synchronize call before __sync_lock_test_and_set
- because __sync_lock_test_and_set is not a full memory fence. */
-static inline void gomp_mutex_unlock (gomp_mutex_t *mutex)
-{
- int val;
- __sync_synchronize ();
- val = __sync_lock_test_and_set (mutex, 0);
- if (__builtin_expect (val > 1, 0))
- gomp_mutex_unlock_slow (mutex);
-}
-
-static inline void gomp_mutex_destroy (gomp_mutex_t *mutex)
-{
-}
-
-#endif /* GOMP_MUTEX_H */
diff --git a/libgomp/config/linux/mips/mutex.h b/libgomp/config/linux/mips/mutex.h
deleted file mode 100644
index 668cc11b29a..00000000000
--- a/libgomp/config/linux/mips/mutex.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
-
- This file is part of the GNU OpenMP Library (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* MIPS needs the same correct usage of __sync_synchronize and
- __sync_lock_test_and_set as ia64. So we just use its mutex.h. */
-
-#include "config/linux/ia64/mutex.h"
diff --git a/libgomp/config/linux/mutex.c b/libgomp/config/linux/mutex.c
index 2574f7be42a..1b84ffb0990 100644
--- a/libgomp/config/linux/mutex.c
+++ b/libgomp/config/linux/mutex.c
@@ -34,25 +34,32 @@ long int gomp_futex_wait = FUTEX_WAIT | FUTEX_PRIVATE_FLAG;
void
gomp_mutex_lock_slow (gomp_mutex_t *mutex, int oldval)
{
+ /* First loop spins a while. */
while (oldval == 1)
{
if (do_spin (mutex, 1))
{
- oldval = __sync_lock_test_and_set (mutex, 2);
+ /* Spin timeout, nothing changed. Set waiting flag. */
+ oldval = __atomic_exchange_n (mutex, -1, MEMMODEL_ACQUIRE);
if (oldval == 0)
return;
- futex_wait (mutex, 2);
+ futex_wait (mutex, -1);
break;
}
else
{
- oldval = __sync_val_compare_and_swap (mutex, 0, 1);
- if (oldval == 0)
+ /* Something changed. If now unlocked, we're good to go. */
+ oldval = 0;
+ if (__atomic_compare_exchange_n (mutex, &oldval, 1, false,
+ MEMMODEL_ACQUIRE, MEMMODEL_RELAXED))
return;
}
}
- while ((oldval = __sync_lock_test_and_set (mutex, 2)))
- do_wait (mutex, 2);
+
+ /* Second loop waits until mutex is unlocked. We always exit this
+ loop with wait flag set, so next unlock will awaken a thread. */
+ while ((oldval = __atomic_exchange_n (mutex, -1, MEMMODEL_ACQUIRE)))
+ do_wait (mutex, -1);
}
void
diff --git a/libgomp/config/linux/mutex.h b/libgomp/config/linux/mutex.h
index eafb0e76734..912152ec3a1 100644
--- a/libgomp/config/linux/mutex.h
+++ b/libgomp/config/linux/mutex.h
@@ -33,39 +33,34 @@ typedef int gomp_mutex_t;
#define GOMP_MUTEX_INIT_0 1
-static inline void gomp_mutex_init (gomp_mutex_t *mutex)
+extern void gomp_mutex_lock_slow (gomp_mutex_t *mutex, int);
+extern void gomp_mutex_unlock_slow (gomp_mutex_t *mutex);
+
+static inline void
+gomp_mutex_init (gomp_mutex_t *mutex)
{
*mutex = 0;
}
-extern void gomp_mutex_lock_slow (gomp_mutex_t *mutex, int);
-static inline void gomp_mutex_lock (gomp_mutex_t *mutex)
+static inline void
+gomp_mutex_destroy (gomp_mutex_t *mutex)
{
- int oldval = __sync_val_compare_and_swap (mutex, 0, 1);
- if (__builtin_expect (oldval, 0))
- gomp_mutex_lock_slow (mutex, oldval);
}
-extern void gomp_mutex_unlock_slow (gomp_mutex_t *mutex);
-static inline void gomp_mutex_unlock (gomp_mutex_t *mutex)
+static inline void
+gomp_mutex_lock (gomp_mutex_t *mutex)
{
- /* Warning: By definition __sync_lock_test_and_set() does not have
- proper memory barrier semantics for a mutex unlock operation.
- However, this default implementation is written assuming that it
- does, which is true for some targets.
-
- Targets that require additional memory barriers before
- __sync_lock_test_and_set to achieve the release semantics of
- mutex unlock, are encouraged to include
- "config/linux/ia64/mutex.h" in a target specific mutex.h instead
- of using this file. */
- int val = __sync_lock_test_and_set (mutex, 0);
- if (__builtin_expect (val > 1, 0))
- gomp_mutex_unlock_slow (mutex);
+ int oldval = 0;
+ if (!__atomic_compare_exchange_n (mutex, &oldval, 1, false,
+ MEMMODEL_ACQUIRE, MEMMODEL_RELAXED))
+ gomp_mutex_lock_slow (mutex, oldval);
}
-static inline void gomp_mutex_destroy (gomp_mutex_t *mutex)
+static inline void
+gomp_mutex_unlock (gomp_mutex_t *mutex)
{
+ int wait = __atomic_exchange_n (mutex, 0, MEMMODEL_RELEASE);
+ if (__builtin_expect (wait < 0, 0))
+ gomp_mutex_unlock_slow (mutex);
}
-
#endif /* GOMP_MUTEX_H */
diff --git a/libgomp/config/linux/omp-lock.h b/libgomp/config/linux/omp-lock.h
index e65aff7fce7..2ca7c5e1d60 100644
--- a/libgomp/config/linux/omp-lock.h
+++ b/libgomp/config/linux/omp-lock.h
@@ -3,8 +3,8 @@
structures without polluting the namespace.
When using the Linux futex primitive, non-recursive locks require
- only one int. Recursive locks require we identify the owning task
- and so require one int and a pointer. */
+ one int. Recursive locks require we identify the owning task
+ and so require in addition one int and a pointer. */
typedef int omp_lock_t;
typedef struct { int lock, count; void *owner; } omp_nest_lock_t;
diff --git a/libgomp/config/linux/powerpc/mutex.h b/libgomp/config/linux/powerpc/mutex.h
deleted file mode 100644
index e64ff077c83..00000000000
--- a/libgomp/config/linux/powerpc/mutex.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* On PowerPC __sync_lock_test_and_set isn't a full barrier. */
-#include "config/linux/ia64/mutex.h"
diff --git a/libgomp/config/linux/sem.c b/libgomp/config/linux/sem.c
index ea981024c5d..3f2fc998819 100644
--- a/libgomp/config/linux/sem.c
+++ b/libgomp/config/linux/sem.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2008, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
@@ -28,34 +28,56 @@
#include "wait.h"
-
void
-gomp_sem_wait_slow (gomp_sem_t *sem)
+gomp_sem_wait_slow (gomp_sem_t *sem, int count)
{
+ /* First loop spins a while. */
+ while (count == 0)
+ if (do_spin (sem, 0)
+ /* Spin timeout, nothing changed. Set waiting flag. */
+ && __atomic_compare_exchange_n (sem, &count, SEM_WAIT, false,
+ MEMMODEL_ACQUIRE, MEMMODEL_RELAXED))
+ {
+ futex_wait (sem, SEM_WAIT);
+ count = *sem;
+ break;
+ }
+ /* Something changed. If it wasn't the wait flag, we're good to go. */
+ else if (__builtin_expect (((count = *sem) & SEM_WAIT) == 0 && count != 0,
+ 1))
+ {
+ if (__atomic_compare_exchange_n (sem, &count, count - SEM_INC, false,
+ MEMMODEL_ACQUIRE, MEMMODEL_RELAXED))
+ return;
+ }
+
+ /* Second loop waits until semaphore is posted. We always exit this
+ loop with wait flag set, so next post will awaken a thread. */
while (1)
{
- int val = __sync_val_compare_and_swap (sem, 0, -1);
- if (val > 0)
+ unsigned int wake = count & ~SEM_WAIT;
+ int newval = SEM_WAIT;
+
+ if (wake != 0)
+ newval |= wake - SEM_INC;
+ if (__atomic_compare_exchange_n (sem, &count, newval, false,
+ MEMMODEL_ACQUIRE, MEMMODEL_RELAXED))
{
- if (__sync_bool_compare_and_swap (sem, val, val - 1))
- return;
+ if (wake != 0)
+ {
+ /* If we can wake more threads, do so now. */
+ if (wake > SEM_INC)
+ gomp_sem_post_slow (sem);
+ break;
+ }
+ do_wait (sem, SEM_WAIT);
+ count = *sem;
}
- do_wait (sem, -1);
}
}
void
gomp_sem_post_slow (gomp_sem_t *sem)
{
- int old, tmp = *sem, wake;
-
- do
- {
- old = tmp;
- wake = old > 0 ? old + 1 : 1;
- tmp = __sync_val_compare_and_swap (sem, old, wake);
- }
- while (old != tmp);
-
- futex_wake (sem, wake);
+ futex_wake (sem, 1);
}
diff --git a/libgomp/config/linux/sem.h b/libgomp/config/linux/sem.h
index 9b0f0f82bac..9bf480ded36 100644
--- a/libgomp/config/linux/sem.h
+++ b/libgomp/config/linux/sem.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
@@ -24,34 +24,64 @@
/* This is a Linux specific implementation of a semaphore synchronization
mechanism for libgomp. This type is private to the library. This
- implementation uses atomic instructions and the futex syscall. */
+ counting semaphore implementation uses atomic instructions and the
+ futex syscall, and a single 32-bit int to store semaphore state.
+ The low 31 bits are the count, the top bit is a flag set when some
+ threads may be waiting. */
#ifndef GOMP_SEM_H
#define GOMP_SEM_H 1
+#include <limits.h> /* For INT_MIN */
+
typedef int gomp_sem_t;
+#define SEM_WAIT INT_MIN
+#define SEM_INC 1
+
+extern void gomp_sem_wait_slow (gomp_sem_t *, int);
+extern void gomp_sem_post_slow (gomp_sem_t *);
-static inline void gomp_sem_init (gomp_sem_t *sem, int value)
+static inline void
+gomp_sem_init (gomp_sem_t *sem, int value)
{
- *sem = value;
+ *sem = value * SEM_INC;
}
-extern void gomp_sem_wait_slow (gomp_sem_t *);
-static inline void gomp_sem_wait (gomp_sem_t *sem)
+static inline void
+gomp_sem_destroy (gomp_sem_t *sem)
{
- if (!__sync_bool_compare_and_swap (sem, 1, 0))
- gomp_sem_wait_slow (sem);
}
-extern void gomp_sem_post_slow (gomp_sem_t *);
-static inline void gomp_sem_post (gomp_sem_t *sem)
+static inline void
+gomp_sem_wait (gomp_sem_t *sem)
{
- if (!__sync_bool_compare_and_swap (sem, 0, 1))
- gomp_sem_post_slow (sem);
+ int count = *sem;
+
+ while ((count & ~SEM_WAIT) != 0)
+ if (__atomic_compare_exchange_n (sem, &count, count - SEM_INC, true,
+ MEMMODEL_ACQUIRE, MEMMODEL_RELAXED))
+ return;
+ gomp_sem_wait_slow (sem, count);
}
-static inline void gomp_sem_destroy (gomp_sem_t *sem)
+static inline void
+gomp_sem_post (gomp_sem_t *sem)
{
-}
+ int count = *sem;
+
+ /* Clear SEM_WAIT here so that if there are no more waiting threads
+ we transition back to the uncontended state that does not make
+ futex syscalls. If there are waiting threads then when one is
+ awoken it will set SEM_WAIT again, so other waiting threads are
+ woken on a future gomp_sem_post. Furthermore, the awoken thread
+ will wake other threads in case gomp_sem_post was called again
+ before it had time to set SEM_WAIT. */
+ while (!__atomic_compare_exchange_n (sem, &count,
+ (count + SEM_INC) & ~SEM_WAIT, true,
+ MEMMODEL_RELEASE, MEMMODEL_RELAXED))
+ continue;
+ if (__builtin_expect (count & SEM_WAIT, 0))
+ gomp_sem_post_slow (sem);
+}
#endif /* GOMP_SEM_H */
diff --git a/libgomp/critical.c b/libgomp/critical.c
index daf1ffc2137..414c4221626 100644
--- a/libgomp/critical.c
+++ b/libgomp/critical.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
@@ -33,6 +33,8 @@ static gomp_mutex_t default_lock;
void
GOMP_critical_start (void)
{
+ /* There is an implicit flush on entry to a critical region. */
+ __atomic_thread_fence (MEMMODEL_RELEASE);
gomp_mutex_lock (&default_lock);
}
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index 9cf9d3221c5..2c9c0716cd5 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -45,6 +45,17 @@
# pragma GCC visibility push(hidden)
#endif
+/* If we were a C++ library, we'd get this from <std/atomic>. */
+enum memmodel
+{
+ MEMMODEL_RELAXED = 0,
+ MEMMODEL_CONSUME = 1,
+ MEMMODEL_ACQUIRE = 2,
+ MEMMODEL_RELEASE = 3,
+ MEMMODEL_ACQ_REL = 4,
+ MEMMODEL_SEQ_CST = 5
+};
+
#include "sem.h"
#include "mutex.h"
#include "bar.h"
diff --git a/libgomp/ordered.c b/libgomp/ordered.c
index e5673fe1c08..f84d52eb9ff 100644
--- a/libgomp/ordered.c
+++ b/libgomp/ordered.c
@@ -207,8 +207,13 @@ gomp_ordered_sync (void)
post to our release semaphore. So the two cases are that we will
either win the race an momentarily block on the semaphore, or lose
the race and find the semaphore already unlocked and so not block.
- Either way we get correct results. */
+ Either way we get correct results.
+ However, there is an implicit flush on entry to an ordered region,
+ so we do need to have a barrier here. If we were taking a lock
+ this could be MEMMODEL_RELEASE since the acquire would be coverd
+ by the lock. */
+ __atomic_thread_fence (MEMMODEL_ACQ_REL);
if (ws->ordered_owner != thr->ts.team_id)
{
gomp_sem_wait (team->ordered_release[thr->ts.team_id]);
diff --git a/libgomp/task.c b/libgomp/task.c
index b93f77a3816..d3d72663f35 100644
--- a/libgomp/task.c
+++ b/libgomp/task.c
@@ -273,6 +273,7 @@ gomp_barrier_handle_tasks (gomp_barrier_state_t state)
gomp_team_barrier_done (&team->barrier, state);
gomp_mutex_unlock (&team->task_lock);
gomp_team_barrier_wake (&team->barrier, 0);
+ gomp_mutex_lock (&team->task_lock);
}
}
}
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index be994a5c36e..33584647bc8 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,11 @@
+2011-11-30 Richard Henderson <rth@redhat.com>
+
+ * libitm_i.h (GTM_longjmp): Swap first and second arguments.
+ * beginend.c (_ITM_abortTransaction): Update to match.
+ (GTM::gtm_thread::restart): Likewise.
+ * config/alpha/sjlj.S (GTM_longjmp): Likewise.
+ * config/x86/sjlj.S (GTM_longjmp): Likewise.
+
2011-11-23 Iain Sandoe <iains@gcc.gnu.org>
* Makefile.am (libitm_la_LDFLAGS): Remove "-no-undefined".
diff --git a/libitm/beginend.cc b/libitm/beginend.cc
index a26697567a3..d8ef651236d 100644
--- a/libitm/beginend.cc
+++ b/libitm/beginend.cc
@@ -404,8 +404,8 @@ _ITM_abortTransaction (_ITM_abortReason reason)
tx->rollback (cp, true);
// Jump to nested transaction (use the saved jump buffer).
- GTM_longjmp (&longjmp_jb, a_abortTransaction | a_restoreLiveVariables,
- longjmp_prop);
+ GTM_longjmp (a_abortTransaction | a_restoreLiveVariables,
+ &longjmp_jb, longjmp_prop);
}
else
{
@@ -421,8 +421,8 @@ _ITM_abortTransaction (_ITM_abortReason reason)
gtm_thread::serial_lock.read_unlock (tx);
tx->state = 0;
- GTM_longjmp (&tx->jb, a_abortTransaction | a_restoreLiveVariables,
- tx->prop);
+ GTM_longjmp (a_abortTransaction | a_restoreLiveVariables,
+ &tx->jb, tx->prop);
}
}
@@ -512,8 +512,8 @@ GTM::gtm_thread::restart (gtm_restart_reason r)
disp = abi_disp();
}
- GTM_longjmp (&jb,
- choose_code_path(prop, disp) | a_restoreLiveVariables, prop);
+ GTM_longjmp (choose_code_path(prop, disp) | a_restoreLiveVariables,
+ &jb, prop);
}
void ITM_REGPARM
diff --git a/libitm/config/alpha/sjlj.S b/libitm/config/alpha/sjlj.S
index 3aa5f06e332..615eacb8688 100644
--- a/libitm/config/alpha/sjlj.S
+++ b/libitm/config/alpha/sjlj.S
@@ -81,28 +81,28 @@ _ITM_beginTransaction:
GTM_longjmp:
.prologue 0
- ldq $26, 0($16)
- ldq $9, 8($16)
- ldq $10, 16($16)
- ldq $11, 24($16)
-
- ldq $12, 32($16)
- ldq $13, 40($16)
- ldq $14, 48($16)
- ldq $15, 56($16)
-
- ldq $1, 64($16)
- ldt $f2, 72($16)
- ldt $f3, 80($16)
- ldt $f4, 88($16)
-
- ldt $f5, 96($16)
- ldt $f6, 104($16)
- ldt $f7, 112($16)
- ldt $f8, 120($16)
-
- ldt $f9, 128($16)
- mov $17, $0
+ ldq $26, 0($17)
+ ldq $9, 8($17)
+ ldq $10, 16($17)
+ ldq $11, 24($17)
+
+ ldq $12, 32($17)
+ ldq $13, 40($17)
+ ldq $14, 48($17)
+ ldq $15, 56($17)
+
+ ldq $1, 64($17)
+ ldt $f2, 72($17)
+ ldt $f3, 80($17)
+ ldt $f4, 88($17)
+
+ ldt $f5, 96($17)
+ ldt $f6, 104($17)
+ ldt $f7, 112($17)
+ ldt $f8, 120($17)
+
+ ldt $f9, 128($17)
+ mov $16, $0
mov $1, $30
ret
.end GTM_longjmp
diff --git a/libitm/config/x86/sjlj.S b/libitm/config/x86/sjlj.S
index 39e0c758d6d..8faa0c61d5c 100644
--- a/libitm/config/x86/sjlj.S
+++ b/libitm/config/x86/sjlj.S
@@ -113,21 +113,20 @@ SYM(_ITM_beginTransaction):
SYM(GTM_longjmp):
cfi_startproc
#ifdef __x86_64__
- movq (%rdi), %rcx
- movq 8(%rdi), %rdx
- movq 16(%rdi), %rbx
- movq 24(%rdi), %rbp
- movq 32(%rdi), %r12
- movq 40(%rdi), %r13
- movq 48(%rdi), %r14
- movq 56(%rdi), %r15
- movl %esi, %eax
+ movq (%rsi), %rcx
+ movq 8(%rsi), %rdx
+ movq 16(%rsi), %rbx
+ movq 24(%rsi), %rbp
+ movq 32(%rsi), %r12
+ movq 40(%rsi), %r13
+ movq 48(%rsi), %r14
+ movq 56(%rsi), %r15
+ movl %edi, %eax
cfi_def_cfa(%rcx, 0)
cfi_register(%rip, %rdx)
movq %rcx, %rsp
jmp *%rdx
#else
- xchgl %eax, %edx
movl (%edx), %ecx
movl 4(%edx), %ebx
movl 8(%edx), %esi
diff --git a/libitm/libitm_i.h b/libitm/libitm_i.h
index ba1afb4710c..ff6884e8805 100644
--- a/libitm/libitm_i.h
+++ b/libitm/libitm_i.h
@@ -285,7 +285,7 @@ namespace GTM HIDDEN {
// are used.
extern uint64_t gtm_spin_count_var;
-extern "C" uint32_t GTM_longjmp (const gtm_jmpbuf *, uint32_t, uint32_t)
+extern "C" uint32_t GTM_longjmp (uint32_t, const gtm_jmpbuf *, uint32_t)
ITM_NORETURN ITM_REGPARM;
extern "C" void GTM_LB (const void *, size_t) ITM_REGPARM;
diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj
index 9eb70ac14e5..0f537912e8c 100644
--- a/libjava/classpath/ChangeLog.gcj
+++ b/libjava/classpath/ChangeLog.gcj
@@ -1,3 +1,9 @@
+2011-11-29 Andreas Tobler <andreast@fgznet.ch>
+
+ * config.rpath (ld_shlibs): Fix detection of FreeBSD-10 and up.
+ (libname_spec): Likewise.
+ * configure: Regenerate with autoconf -I ../../.
+
2011-02-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* config.rpath, ltcf-c.sh, ltcf-gcj.sh, ltconfig: Remove
diff --git a/libjava/classpath/config.rpath b/libjava/classpath/config.rpath
index def43dcc5e7..b7f75cde451 100755
--- a/libjava/classpath/config.rpath
+++ b/libjava/classpath/config.rpath
@@ -361,7 +361,7 @@ else
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
- freebsd2*)
+ freebsd2.*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
@@ -533,7 +533,7 @@ case "$host_os" in
;;
freebsd* | dragonfly*)
case "$host_os" in
- freebsd[123]*)
+ freebsd[23].*)
library_names_spec='$libname$shrext$versuffix' ;;
*)
library_names_spec='$libname$shrext' ;;
diff --git a/libjava/classpath/configure b/libjava/classpath/configure
index 2274f648cf9..a25f5f75a47 100755
--- a/libjava/classpath/configure
+++ b/libjava/classpath/configure
@@ -10025,7 +10025,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -10941,7 +10941,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -10959,7 +10959,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -14225,7 +14225,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
;;
- freebsd[12]*)
+ freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
ld_shlibs_CXX=no
@@ -16000,7 +16000,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -16018,7 +16018,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 1d4dff8747c..7ce62eae77b 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,58 @@
+2011-11-30 Benjamin Kosnik <bkoz@redhat.com>
+
+ * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Remove
+ size-specific macros. _GLIBCXX_ATOMIC_BUILTINS_1,
+ _GLIBCXX_ATOMIC_BUILTINS_2, _GLIBCXX_ATOMIC_BUILTINS_4,
+ _GLIBCXX_ATOMIC_BUILTINS_8. Use _GLIBCXX_ATOMIC_BUILTINS to
+ indicate use of C++11 atomic builtins.
+ * config.h.in: Regenerate.
+ * configure: Regenerate.
+ * include/Makefile.am (bits_sup_headers): Add atomic_lockfree_defines.h.
+ * include/Makefile.in: Regenerate.
+ * libsupc++/Makefile.am: Compile C++11 support with -std=gnu++0x.
+ * libsupc++/Makefile.in: Regenerate.
+
+ * include/bits/atomic_base.h: Move lock-free property macros...
+ * libsupc++/atomic_lockfree_defines.h: ...here.
+ * include/std/future: Use C++11 macros.
+ * libsupc++/eh_ptr.cc: Same.
+ * libsupc++/eh_throw.cc: Same.
+ * libsupc++/exception: Same.
+ * libsupc++/exception_ptr.h: Same.
+ * libsupc++/guard.cc: Same.
+ * libsupc++/nested_exception.cc: Same.
+ * libsupc++/nested_exception.h: Same.
+ * src/future.cc: Same.
+
+ * include/ext/atomicity.h: Use _GLIBCXX_ATOMIC_BUILTINS.
+
+ * doc/doxygen/user.cfg.in
+ * doc/xml/manual/concurrency_extensions.xml
+
+ * testsuite/18_support/exception_ptr/lifespan.cc
+ * testsuite/lib/libstdc++.exp
+
+2011-11-29 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/hashtable.h (_Hashtable<>::_M_rehash): Remove code
+ useless now that the hashtable implementation put the hash code in
+ cache if the hash functor throws.
+ * testsuite/23_containers/unordered_set/erase/1.cc: Enhance test by
+ checking also distance between begin and end iterators to validate
+ underlying data model.
+ * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise.
+ * testsuire/23_containers/unordered_map/erase/1.cc: Likewise.
+ * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise.
+ * testsuite/23_containers/unordered_multiset/erase/2.cc: New.
+ * testsuite/23_containers/unordered_multimap/erase/2.cc: New.
+
+2011-11-28 Andrew MacLeod <amacleod@redhat.com>
+
+ * include/bits/atomic_base.h (ATOMIC_*_LOCK_FREE): Use new cpp
+ predefined macros.
+ * testsuite/29_atomics/headers/atomic/macros.cc: Add BOOL and POINTER
+ macro checks. Check for expected compile time values.
+
2011-11-28 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/51288
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index fee5c6f2776..9d08178c35e 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2683,12 +2683,6 @@ dnl
dnl Note:
dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
dnl
-dnl Defines:
-dnl _GLIBCXX_ATOMIC_BUILTINS_1
-dnl _GLIBCXX_ATOMIC_BUILTINS_2
-dnl _GLIBCXX_ATOMIC_BUILTINS_4
-dnl _GLIBCXX_ATOMIC_BUILTINS_8
-dnl
AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
@@ -2729,10 +2723,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
[glibcxx_cv_atomic_bool=yes],
[glibcxx_cv_atomic_bool=no])
])
- if test $glibcxx_cv_atomic_bool = yes; then
- AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
- [Define if builtin atomic operations for bool are supported on this host.])
- fi
AC_MSG_RESULT($glibcxx_cv_atomic_bool)
AC_MSG_CHECKING([for atomic builtins for short])
@@ -2751,10 +2741,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
[glibcxx_cv_atomic_short=yes],
[glibcxx_cv_atomic_short=no])
])
- if test $glibcxx_cv_atomic_short = yes; then
- AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
- [Define if builtin atomic operations for short are supported on this host.])
- fi
AC_MSG_RESULT($glibcxx_cv_atomic_short)
AC_MSG_CHECKING([for atomic builtins for int])
@@ -2773,10 +2759,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
[glibcxx_cv_atomic_int=yes],
[glibcxx_cv_atomic_int=no])
])
- if test $glibcxx_cv_atomic_int = yes; then
- AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
- [Define if builtin atomic operations for int are supported on this host.])
- fi
AC_MSG_RESULT($glibcxx_cv_atomic_int)
AC_MSG_CHECKING([for atomic builtins for long long])
@@ -2795,10 +2777,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
[glibcxx_cv_atomic_long_long=yes],
[glibcxx_cv_atomic_long_long=no])
])
- if test $glibcxx_cv_atomic_long_long = yes; then
- AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
- [Define if builtin atomic operations for long long are supported on this host.])
- fi
AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
else
@@ -2832,8 +2810,6 @@ EOF
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
glibcxx_cv_atomic_bool=no
else
- AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
- [Define if builtin atomic operations for bool are supported on this host.])
glibcxx_cv_atomic_bool=yes
fi
fi
@@ -2862,8 +2838,6 @@ EOF
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
glibcxx_cv_atomic_short=no
else
- AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
- [Define if builtin atomic operations for short are supported on this host.])
glibcxx_cv_atomic_short=yes
fi
fi
@@ -2893,8 +2867,6 @@ EOF
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
glibcxx_cv_atomic_int=no
else
- AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
- [Define if builtin atomic operations for int are supported on this host.])
glibcxx_cv_atomic_int=yes
fi
fi
@@ -2923,8 +2895,6 @@ EOF
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
glibcxx_cv_atomic_long_long=no
else
- AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
- [Define if builtin atomic operations for long long are supported on this host.])
glibcxx_cv_atomic_long_long=yes
fi
fi
@@ -2938,6 +2908,8 @@ EOF
# Set atomicity_dir to builtins if either of above tests pass.
if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1,
+ [Define if the compiler supports C++11 atomics.])
atomicity_dir=cpu/generic/atomicity_builtins
fi
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 7215a7fec62..378ddabb3f2 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -689,19 +689,8 @@
/* Version number of package */
#undef VERSION
-/* Define if builtin atomic operations for bool are supported on this host. */
-#undef _GLIBCXX_ATOMIC_BUILTINS_1
-
-/* Define if builtin atomic operations for short are supported on this host.
- */
-#undef _GLIBCXX_ATOMIC_BUILTINS_2
-
-/* Define if builtin atomic operations for int are supported on this host. */
-#undef _GLIBCXX_ATOMIC_BUILTINS_4
-
-/* Define if builtin atomic operations for long long are supported on this
- host. */
-#undef _GLIBCXX_ATOMIC_BUILTINS_8
+/* Define if the compiler supports C++11 atomics. */
+#undef _GLIBCXX_ATOMIC_BUILTINS
/* Define to use concept checking code from the boost libraries. */
#undef _GLIBCXX_CONCEPT_CHECKS
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 52218367919..3c64a28e3c8 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15147,11 +15147,6 @@ rm -f core conftest.err conftest.$ac_objext \
fi
- if test $glibcxx_cv_atomic_bool = yes; then
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_1 1" >>confdefs.h
-
- fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_bool" >&5
$as_echo "$glibcxx_cv_atomic_bool" >&6; }
@@ -15193,11 +15188,6 @@ rm -f core conftest.err conftest.$ac_objext \
fi
- if test $glibcxx_cv_atomic_short = yes; then
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_2 1" >>confdefs.h
-
- fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_short" >&5
$as_echo "$glibcxx_cv_atomic_short" >&6; }
@@ -15239,11 +15229,6 @@ rm -f core conftest.err conftest.$ac_objext \
fi
- if test $glibcxx_cv_atomic_int = yes; then
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_4 1" >>confdefs.h
-
- fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_int" >&5
$as_echo "$glibcxx_cv_atomic_int" >&6; }
@@ -15285,11 +15270,6 @@ rm -f core conftest.err conftest.$ac_objext \
fi
- if test $glibcxx_cv_atomic_long_long = yes; then
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_8 1" >>confdefs.h
-
- fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_long_long" >&5
$as_echo "$glibcxx_cv_atomic_long_long" >&6; }
@@ -15303,7 +15283,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 15306 "configure"
+#line 15286 "configure"
int main()
{
typedef bool atomic_type;
@@ -15329,9 +15309,6 @@ $as_echo_n "checking for atomic builtins for bool... " >&6; }
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
glibcxx_cv_atomic_bool=no
else
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_1 1" >>confdefs.h
-
glibcxx_cv_atomic_bool=yes
fi
fi
@@ -15340,7 +15317,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15343 "configure"
+#line 15320 "configure"
int main()
{
typedef short atomic_type;
@@ -15366,9 +15343,6 @@ $as_echo_n "checking for atomic builtins for short... " >&6; }
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
glibcxx_cv_atomic_short=no
else
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_2 1" >>confdefs.h
-
glibcxx_cv_atomic_short=yes
fi
fi
@@ -15377,7 +15351,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15380 "configure"
+#line 15354 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -15404,9 +15378,6 @@ $as_echo_n "checking for atomic builtins for int... " >&6; }
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
glibcxx_cv_atomic_int=no
else
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_4 1" >>confdefs.h
-
glibcxx_cv_atomic_int=yes
fi
fi
@@ -15415,7 +15386,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15418 "configure"
+#line 15389 "configure"
int main()
{
typedef long long atomic_type;
@@ -15441,9 +15412,6 @@ $as_echo_n "checking for atomic builtins for long long... " >&6; }
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
glibcxx_cv_atomic_long_long=no
else
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_8 1" >>confdefs.h
-
glibcxx_cv_atomic_long_long=yes
fi
fi
@@ -15463,6 +15431,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Set atomicity_dir to builtins if either of above tests pass.
if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
+
+$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS 1" >>confdefs.h
+
atomicity_dir=cpu/generic/atomicity_builtins
fi
@@ -15491,7 +15462,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 15494 "configure"
+#line 15465 "configure"
int main()
{
_Decimal32 d1;
@@ -15533,7 +15504,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15536 "configure"
+#line 15507 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -15567,7 +15538,7 @@ $as_echo "$enable_int128" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15570 "configure"
+#line 15541 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in
index 0b01ceb61e6..9178b0c7671 100644
--- a/libstdc++-v3/doc/doxygen/user.cfg.in
+++ b/libstdc++-v3/doc/doxygen/user.cfg.in
@@ -1645,10 +1645,6 @@ PREDEFINED = __cplusplus \
_GLIBCXX_USE_WCHAR_T \
_GLIBCXX_USE_LONG_LONG \
_GLIBCXX_USE_C99_STDINT_TR1 \
- _GLIBCXX_ATOMIC_BUILTINS_1 \
- _GLIBCXX_ATOMIC_BUILTINS_2 \
- _GLIBCXX_ATOMIC_BUILTINS_4 \
- _GLIBCXX_ATOMIC_BUILTINS_8 \
_GLIBCXX_USE_SCHED_YIELD \
_GLIBCXX_USE_NANOSLEEP \
PB_DS_DATA_TRUE_INDICATOR \
diff --git a/libstdc++-v3/doc/xml/manual/concurrency_extensions.xml b/libstdc++-v3/doc/xml/manual/concurrency_extensions.xml
index 9092c8def61..c87f41ba1c1 100644
--- a/libstdc++-v3/doc/xml/manual/concurrency_extensions.xml
+++ b/libstdc++-v3/doc/xml/manual/concurrency_extensions.xml
@@ -210,11 +210,19 @@ usage vary depending on the target hardware and the flags used during
compile.
</para>
+
+
+<para>
+<remark>
+Incomplete/inconsistent. This is only C++11.
+</remark>
+</para>
+
<para>
If builtins are possible for bool-sized integral types,
-<code>_GLIBCXX_ATOMIC_BUILTINS_1</code> will be defined.
+<code>ATOMIC_BOOL_LOCK_FREE</code> will be defined.
If builtins are possible for int-sized integral types,
-<code>_GLIBCXX_ATOMIC_BUILTINS_4</code> will be defined.
+<code>ATOMIC_INT_LOCK_FREE</code> will be defined.
</para>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 121a6427ec2..1e9b144a07d 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -177,6 +177,7 @@ bits_headers = \
bits_sup_srcdir = ${glibcxx_srcdir}/libsupc++
bits_sup_headers = \
+ ${bits_sup_srcdir}/atomic_lockfree_defines.h \
${bits_sup_srcdir}/cxxabi_forced.h \
${bits_sup_srcdir}/exception_defines.h \
${bits_sup_srcdir}/exception_ptr.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 70c0781d513..fec2d94bf7b 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -429,6 +429,7 @@ bits_headers = \
bits_sup_srcdir = ${glibcxx_srcdir}/libsupc++
bits_sup_headers = \
+ ${bits_sup_srcdir}/atomic_lockfree_defines.h \
${bits_sup_srcdir}/cxxabi_forced.h \
${bits_sup_srcdir}/exception_defines.h \
${bits_sup_srcdir}/exception_ptr.h \
diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index cf292a85385..3f00cda6775 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -35,6 +35,7 @@
#include <bits/c++config.h>
#include <stdbool.h>
#include <stdint.h>
+#include <bits/atomic_lockfree_defines.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -70,15 +71,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline void
atomic_thread_fence(memory_order __m) noexcept
- {
- __atomic_thread_fence (__m);
- }
+ { __atomic_thread_fence(__m); }
inline void
atomic_signal_fence(memory_order __m) noexcept
- {
- __atomic_thread_fence (__m);
- }
+ { __atomic_thread_fence(__m); }
/// kill_dependency
template<typename _Tp>
@@ -89,20 +86,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __ret;
}
- /// Lock-free Property
-
-#define LOCKFREE_PROP(T) (__atomic_always_lock_free (sizeof (T), 0) ? 2 : 1)
-
-#define ATOMIC_BOOL_LOCK_FREE LOCKFREE_PROP (bool)
-#define ATOMIC_CHAR_LOCK_FREE LOCKFREE_PROP (char)
-#define ATOMIC_CHAR16_T_LOCK_FREE LOCKFREE_PROP (char16_t)
-#define ATOMIC_CHAR32_T_LOCK_FREE LOCKFREE_PROP (char32_t)
-#define ATOMIC_WCHAR_T_LOCK_FREE LOCKFREE_PROP (wchar_t)
-#define ATOMIC_SHORT_LOCK_FREE LOCKFREE_PROP (short)
-#define ATOMIC_INT_LOCK_FREE LOCKFREE_PROP (int)
-#define ATOMIC_LONG_LOCK_FREE LOCKFREE_PROP (long)
-#define ATOMIC_LLONG_LOCK_FREE LOCKFREE_PROP (long long)
-#define ATOMIC_POINTER_LOCK_FREE LOCKFREE_PROP (void *)
// Base types for atomics.
template<typename _IntTp>
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index dfa91f7cc8c..712b1df91c2 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -233,11 +233,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
_M_deallocate_node(_Node* __n);
- // Deallocate all nodes contained in the bucket array, buckets' nodes
- // are not linked to each other
- void
- _M_deallocate_nodes(_Bucket*, size_type);
-
// Deallocate the linked list of nodes pointed to by __n
void
_M_deallocate_nodes(_Node* __n);
@@ -591,19 +586,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
- _M_deallocate_nodes(_Bucket* __buckets, size_type __n)
- {
- for (size_type __i = 0; __i != __n; ++__i)
- _M_deallocate_nodes(__buckets[__i]);
- }
-
- template<typename _Key, typename _Value,
- typename _Allocator, typename _ExtractKey, typename _Equal,
- typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
- bool __chc, bool __cit, bool __uk>
- void
- _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_deallocate_nodes(_Node* __n)
{
while (__n)
@@ -1542,11 +1524,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_rehash(size_type __n, const _RehashPolicyState& __state)
{
- _Bucket* __new_buckets = nullptr;
- _Node* __p = _M_buckets[_M_begin_bucket_index];
__try
{
- __new_buckets = _M_allocate_buckets(__n);
+ _Bucket* __new_buckets = _M_allocate_buckets(__n);
+ _Node* __p = _M_buckets[_M_begin_bucket_index];
// First loop to store each node in its new bucket
while (__p)
{
@@ -1591,24 +1572,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
__catch(...)
{
- if (__new_buckets)
- {
- // A failure here means that a hash function threw an exception.
- // We can't restore the previous state without calling the hash
- // function again, so the only sensible recovery is to delete
- // everything.
- _M_deallocate_nodes(__new_buckets, __n);
- _M_deallocate_buckets(__new_buckets, __n);
- _M_deallocate_nodes(__p);
- __builtin_memset(_M_buckets, 0, sizeof(_Bucket) * _M_bucket_count);
- _M_element_count = 0;
- _M_begin_bucket_index = _M_bucket_count;
- _M_rehash_policy._M_reset(_RehashPolicyState());
- }
- else
- // A failure here means that buckets allocation failed. We only
- // have to restore hash policy previous state.
- _M_rehash_policy._M_reset(__state);
+ // A failure here means that buckets allocation failed. We only
+ // have to restore hash policy previous state.
+ _M_rehash_policy._M_reset(__state);
__throw_exception_again;
}
}
diff --git a/libstdc++-v3/include/ext/atomicity.h b/libstdc++-v3/include/ext/atomicity.h
index f0c775216c5..c63b1d46361 100644
--- a/libstdc++-v3/include/ext/atomicity.h
+++ b/libstdc++-v3/include/ext/atomicity.h
@@ -1,6 +1,6 @@
// Support for atomic operations -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010
+// Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -42,7 +42,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// To abstract locking primitives across all thread policies, use:
// __exchange_and_add_dispatch
// __atomic_add_dispatch
-#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
+#ifdef _GLIBCXX_ATOMIC_BUILTINS
static inline _Atomic_word
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ return __sync_fetch_and_add(__mem, __val); }
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index bfd1ff9e9bb..040f573ea72 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -187,7 +187,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
async(_Fn&& __fn, _Args&&... __args);
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
- && defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+ && (ATOMIC_INT_LOCK_FREE > 1)
/// Base class and enclosing scope.
struct __future_base
@@ -1493,7 +1493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
- // && _GLIBCXX_ATOMIC_BUILTINS_4
+ // && ATOMIC_INT_LOCK_FREE
// @} group futures
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am
index c8e661d5788..fb5c26f374e 100644
--- a/libstdc++-v3/libsupc++/Makefile.am
+++ b/libstdc++-v3/libsupc++/Makefile.am
@@ -35,8 +35,8 @@ std_HEADERS = \
cxxabi.h exception initializer_list new typeinfo
bits_HEADERS = \
- cxxabi_forced.h hash_bytes.h \
- exception_defines.h exception_ptr.h nested_exception.h
+ atomic_lockfree_defines.h cxxabi_forced.h \
+ exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h
headers = $(std_HEADERS) $(bits_HEADERS)
@@ -136,6 +136,22 @@ cp-demangle.o: cp-demangle.c
$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
+# Use special rules for the C++0x sources so that the proper flags are passed.
+eh_ptr.lo: eh_ptr.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+eh_ptr.o: eh_ptr.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+eh_throw.lo: eh_throw.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+eh_throw.o: eh_throw.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+guard.lo: guard.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+guard.o: guard.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
nested_exception.lo: nested_exception.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
nested_exception.o: nested_exception.cc
diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in
index 191bd281e3d..2cc92ec1889 100644
--- a/libstdc++-v3/libsupc++/Makefile.in
+++ b/libstdc++-v3/libsupc++/Makefile.in
@@ -346,8 +346,8 @@ std_HEADERS = \
cxxabi.h exception initializer_list new typeinfo
bits_HEADERS = \
- cxxabi_forced.h hash_bytes.h \
- exception_defines.h exception_ptr.h nested_exception.h
+ atomic_lockfree_defines.h cxxabi_forced.h \
+ exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h
headers = $(std_HEADERS) $(bits_HEADERS)
@GLIBCXX_HOSTED_TRUE@c_sources = \
@@ -770,6 +770,22 @@ cp-demangle.lo: cp-demangle.c
cp-demangle.o: cp-demangle.c
$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
+# Use special rules for the C++0x sources so that the proper flags are passed.
+eh_ptr.lo: eh_ptr.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+eh_ptr.o: eh_ptr.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+eh_throw.lo: eh_throw.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+eh_throw.o: eh_throw.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+guard.lo: guard.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+guard.o: guard.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
nested_exception.lo: nested_exception.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
nested_exception.o: nested_exception.cc
diff --git a/libstdc++-v3/libsupc++/atomic_lockfree_defines.h b/libstdc++-v3/libsupc++/atomic_lockfree_defines.h
new file mode 100644
index 00000000000..22331b61537
--- /dev/null
+++ b/libstdc++-v3/libsupc++/atomic_lockfree_defines.h
@@ -0,0 +1,63 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009, 2010, 2011 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/atomic_lockfree_defines.h
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly. @headername{atomic}
+ */
+
+#ifndef _GLIBCXX_ATOMIC_LOCK_FREE_H
+#define _GLIBCXX_ATOMIC_LOCK_FREE_H 1
+
+#pragma GCC system_header
+
+/**
+ * @addtogroup atomics
+ * @{
+ */
+
+/**
+ * Lock-free property.
+ *
+ * 0 indicates that the types are never lock-free.
+ * 1 indicates that the types are sometimes lock-free.
+ * 2 indicates that the types are always lock-free.
+ */
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
+#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
+#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
+#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
+#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
+#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
+#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
+#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
+#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
+#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
+#endif
+
+// @} group atomics
+
+#endif
diff --git a/libstdc++-v3/libsupc++/eh_ptr.cc b/libstdc++-v3/libsupc++/eh_ptr.cc
index 94c28427d6d..0e710f2de62 100644
--- a/libstdc++-v3/libsupc++/eh_ptr.cc
+++ b/libstdc++-v3/libsupc++/eh_ptr.cc
@@ -1,5 +1,5 @@
// -*- C++ -*- Implement the members of exception_ptr.
-// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -23,8 +23,9 @@
// <http://www.gnu.org/licenses/>.
#include <bits/c++config.h>
+#include <bits/atomic_lockfree_defines.h>
-#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
+#if ATOMIC_INT_LOCK_FREE > 1
#define _GLIBCXX_EH_PTR_COMPAT
diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc
index 78cfc13956a..728c5ccf284 100644
--- a/libstdc++-v3/libsupc++/eh_throw.cc
+++ b/libstdc++-v3/libsupc++/eh_throw.cc
@@ -43,7 +43,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
if (code != _URC_FOREIGN_EXCEPTION_CAUGHT && code != _URC_NO_REASON)
__terminate (header->exc.terminateHandler);
-#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
+#if ATOMIC_INT_LOCK_FREE > 1
if (__sync_sub_and_fetch (&header->referenceCount, 1) == 0)
{
#endif
@@ -51,7 +51,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
header->exc.exceptionDestructor (header + 1);
__cxa_free_exception (header + 1);
-#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
+#if ATOMIC_INT_LOCK_FREE > 1
}
#endif
}
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index db75ad115f3..3deb45ef38f 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -37,6 +37,7 @@
#pragma GCC visibility push(default)
#include <bits/c++config.h>
+#include <bits/atomic_lockfree_defines.h>
extern "C++" {
@@ -149,8 +150,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
#pragma GCC visibility pop
-#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
- && defined(_GLIBCXX_ATOMIC_BUILTINS_4))
+#if defined(__GXX_EXPERIMENTAL_CXX0X__) && (ATOMIC_INT_LOCK_FREE > 1)
#include <bits/exception_ptr.h>
#include <bits/nested_exception.h>
#endif
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index 00b30fd398a..bd18dc1b3a0 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -36,7 +36,7 @@
#include <bits/c++config.h>
#include <bits/exception_defines.h>
-#if !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+#if ATOMIC_INT_LOCK_FREE < 2
# error This platform does not support exception propagation.
#endif
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 21bca584c1d..643ecd703a1 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -32,7 +32,7 @@
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \
- && defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_HAVE_LINUX_FUTEX)
+ && (ATOMIC_INT_LOCK_FREE > 1) && defined(_GLIBCXX_HAVE_LINUX_FUTEX)
# include <climits>
# include <syscall.h>
# include <unistd.h>
diff --git a/libstdc++-v3/libsupc++/nested_exception.cc b/libstdc++-v3/libsupc++/nested_exception.cc
index ecbc4c81158..ad83ecdfb53 100644
--- a/libstdc++-v3/libsupc++/nested_exception.cc
+++ b/libstdc++-v3/libsupc++/nested_exception.cc
@@ -25,7 +25,7 @@
namespace std
{
-#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
+#if ATOMIC_INT_LOCK_FREE > 1
nested_exception::~nested_exception() = default;
#endif
} // namespace std
diff --git a/libstdc++-v3/libsupc++/nested_exception.h b/libstdc++-v3/libsupc++/nested_exception.h
index d4804bbedc5..9b99c32dd7e 100644
--- a/libstdc++-v3/libsupc++/nested_exception.h
+++ b/libstdc++-v3/libsupc++/nested_exception.h
@@ -38,7 +38,7 @@
#include <bits/c++config.h>
-#if !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+#if ATOMIC_INT_LOCK_FREE < 2
# error This platform does not support exception propagation.
#endif
diff --git a/libstdc++-v3/src/future.cc b/libstdc++-v3/src/future.cc
index 8569bf0af3b..e68642c3427 100644
--- a/libstdc++-v3/src/future.cc
+++ b/libstdc++-v3/src/future.cc
@@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
future_error::what() const noexcept { return _M_code.message().c_str(); }
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
- && defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+ && (ATOMIC_INT_LOCK_FREE > 1)
__future_base::_Result_base::_Result_base() = default;
__future_base::_Result_base::~_Result_base() = default;
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc
index 704f77e695b..b417ea68e17 100644
--- a/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc
@@ -150,11 +150,14 @@ void test06()
may_destruct = false;
- try {
- test06_helper();
- } catch(...) {
- may_destruct = true;
- }
+ try
+ {
+ test06_helper();
+ }
+ catch(...)
+ {
+ may_destruct = true;
+ }
may_destruct = false;
}
@@ -167,11 +170,14 @@ void test99()
may_destruct = false;
- try {
- throw destructing();
- } catch(...) {
- gep = current_exception();
- }
+ try
+ {
+ throw destructing();
+ }
+ catch(...)
+ {
+ gep = current_exception();
+ }
}
int main()
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/erase/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/erase/1.cc
index f9b74e08c8d..9863ef792ba 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/erase/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/erase/1.cc
@@ -23,6 +23,18 @@
#include <string>
#include <testsuite_hooks.h>
+namespace
+{
+ std::size_t
+ get_nb_bucket_elems(const std::unordered_map<std::string, int>& us)
+ {
+ std::size_t nb = 0;
+ for (std::size_t b = 0; b != us.bucket_count(); ++b)
+ nb += us.bucket_size(b);
+ return nb;
+ }
+}
+
void test01()
{
bool test __attribute__((unused)) = true;
@@ -33,7 +45,7 @@ void test01()
typedef Map::value_type value_type;
Map m1;
-
+
m1.insert(value_type("because to why", 1));
m1.insert(value_type("the stockholm syndrome", 2));
m1.insert(value_type("a cereous night", 3));
@@ -45,14 +57,20 @@ void test01()
m1.insert(value_type("belonging (no longer mix)", 9));
m1.insert(value_type("one line behind", 10));
VERIFY( m1.size() == 10 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
VERIFY( m1.erase("eeilo") == 1 );
VERIFY( m1.size() == 9 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
iterator it1 = m1.find("eeilo");
VERIFY( it1 == m1.end() );
VERIFY( m1.erase("tillsammans") == 1 );
VERIFY( m1.size() == 8 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
iterator it2 = m1.find("tillsammans");
VERIFY( it2 == m1.end() );
@@ -61,17 +79,23 @@ void test01()
VERIFY( it3 != m1.end() );
VERIFY( m1.erase(it3->first) == 1 );
VERIFY( m1.size() == 7 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
it3 = m1.find("belonging (no longer mix)");
VERIFY( it3 == m1.end() );
VERIFY( !m1.erase("abra") );
VERIFY( m1.size() == 7 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
VERIFY( !m1.erase("eeilo") );
VERIFY( m1.size() == 7 );
VERIFY( m1.erase("because to why") == 1 );
VERIFY( m1.size() == 6 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
iterator it4 = m1.find("because to why");
VERIFY( it4 == m1.end() );
@@ -87,11 +111,15 @@ void test01()
VERIFY( m1.erase(it5->first) == 1 );
VERIFY( m1.size() == 5 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
it5 = m1.find("umbra/penumbra");
VERIFY( it5 == m1.end() );
VERIFY( m1.erase(it6->first) == 1 );
VERIFY( m1.size() == 4 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
it6 = m1.find("one line behind");
VERIFY( it6 == m1.end() );
@@ -103,6 +131,8 @@ void test01()
VERIFY( m1.erase(it8->first) == 1 );
VERIFY( m1.size() == 3 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
VERIFY( ++it7 == it9 );
iterator it10 = it9;
@@ -110,15 +140,21 @@ void test01()
iterator it11 = it10;
VERIFY( m1.erase(it9->first) == 1 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
VERIFY( m1.size() == 2 );
VERIFY( ++it10 == m1.end() );
VERIFY( m1.erase(m1.begin()) != m1.end() );
VERIFY( m1.size() == 1 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
VERIFY( m1.begin() == it11 );
VERIFY( m1.erase(m1.begin()->first) == 1 );
VERIFY( m1.size() == 0 );
+ VERIFY( get_nb_bucket_elems(m1) == m1.size() );
+ VERIFY( distance(m1.begin(), m1.end()) == m1.size() );
VERIFY( m1.begin() == m1.end() );
}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/1.cc
index 09515726598..c599cc01a73 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/1.cc
@@ -23,6 +23,18 @@
#include <string>
#include <testsuite_hooks.h>
+namespace
+{
+ std::size_t
+ get_nb_bucket_elems(const std::unordered_multimap<std::string, int>& us)
+ {
+ std::size_t nb = 0;
+ for (std::size_t b = 0; b != us.bucket_count(); ++b)
+ nb += us.bucket_size(b);
+ return nb;
+ }
+}
+
void test01()
{
bool test __attribute__((unused)) = true;
@@ -46,14 +58,20 @@ void test01()
mm1.insert(value_type("one line behind", 10));
mm1.insert(value_type("because to why", 11));
VERIFY( mm1.size() == 11 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
VERIFY( mm1.erase("eeilo") == 1 );
VERIFY( mm1.size() == 10 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
iterator it1 = mm1.find("eeilo");
VERIFY( it1 == mm1.end() );
VERIFY( mm1.erase("tillsammans") == 1 );
VERIFY( mm1.size() == 9 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
iterator it2 = mm1.find("tillsammans");
VERIFY( it2 == mm1.end() );
@@ -62,17 +80,23 @@ void test01()
VERIFY( it3 != mm1.end() );
VERIFY( mm1.erase(it3->first) == 1 );
VERIFY( mm1.size() == 8 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
it3 = mm1.find("belonging (no longer mix)");
VERIFY( it3 == mm1.end() );
VERIFY( !mm1.erase("abra") );
VERIFY( mm1.size() == 8 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
VERIFY( !mm1.erase("eeilo") );
VERIFY( mm1.size() == 8 );
VERIFY( mm1.erase("because to why") == 2 );
VERIFY( mm1.size() == 6 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
iterator it4 = mm1.find("because to why");
VERIFY( it4 == mm1.end() );
@@ -88,11 +112,15 @@ void test01()
VERIFY( mm1.erase(it5->first) == 1 );
VERIFY( mm1.size() == 5 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
it5 = mm1.find("umbra/penumbra");
VERIFY( it5 == mm1.end() );
VERIFY( mm1.erase(it6->first) == 1 );
VERIFY( mm1.size() == 4 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
it6 = mm1.find("one line behind");
VERIFY( it6 == mm1.end() );
@@ -104,6 +132,8 @@ void test01()
VERIFY( mm1.erase(it8->first) == 1 );
VERIFY( mm1.size() == 3 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
VERIFY( ++it7 == it9 );
iterator it10 = it9;
@@ -111,15 +141,21 @@ void test01()
iterator it11 = it10;
VERIFY( mm1.erase(it9->first) == 1 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
VERIFY( mm1.size() == 2 );
VERIFY( ++it10 == mm1.end() );
VERIFY( mm1.erase(mm1.begin()) != mm1.end() );
VERIFY( mm1.size() == 1 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
VERIFY( mm1.begin() == it11 );
VERIFY( mm1.erase(mm1.begin()->first) == 1 );
VERIFY( mm1.size() == 0 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
VERIFY( mm1.begin() == mm1.end() );
}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/2.cc
new file mode 100644
index 00000000000..df73a85dcc1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/2.cc
@@ -0,0 +1,90 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 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 <unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+namespace
+{
+ std::size_t
+ get_nb_bucket_elems(const std::unordered_multimap<std::string, int>& um)
+ {
+ std::size_t nb = 0;
+ for (std::size_t b = 0; b != um.bucket_count(); ++b)
+ nb += um.bucket_size(b);
+ return nb;
+ }
+}
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_multimap<std::string, int> Mmap;
+ typedef Mmap::iterator iterator;
+ typedef Mmap::const_iterator const_iterator;
+ typedef Mmap::value_type value_type;
+
+ Mmap mm1;
+
+ mm1.insert(value_type("foo", 10));
+ mm1.insert(value_type("foo", 11));
+ mm1.insert(value_type("foo", 12));
+ mm1.insert(value_type("foo", 13));
+ mm1.insert(value_type("foo", 14));
+ mm1.insert(value_type("foo", 15));
+ mm1.insert(value_type("bar", 20));
+ mm1.insert(value_type("bar", 21));
+ mm1.insert(value_type("bar", 22));
+ mm1.insert(value_type("bar", 23));
+ mm1.insert(value_type("bar", 24));
+ mm1.insert(value_type("bar", 25));
+ VERIFY( mm1.size() == 12 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
+
+ VERIFY( mm1.erase(mm1.begin()) != mm1.end() );
+ VERIFY( mm1.size() == 11 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
+
+ auto it = mm1.begin();
+ advance(it, 2);
+ VERIFY( mm1.erase(mm1.begin(), it) != mm1.end() );
+ VERIFY( mm1.size() == 9 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
+
+ VERIFY( mm1.erase(mm1.begin()->first) == 3 );
+ VERIFY( mm1.size() == 6 );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
+
+ VERIFY( mm1.erase(mm1.begin(), mm1.end()) == mm1.end() );
+ VERIFY( mm1.empty() );
+ VERIFY( get_nb_bucket_elems(mm1) == mm1.size() );
+ VERIFY( distance(mm1.begin(), mm1.end()) == mm1.size() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/1.cc
index e48e31149e3..b95c8a38706 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/1.cc
@@ -58,16 +58,19 @@ void test01()
ms1.insert("because to why");
VERIFY( ms1.size() == 11 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
VERIFY( ms1.erase("eeilo") == 1 );
VERIFY( ms1.size() == 10 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
iterator it1 = ms1.find("eeilo");
VERIFY( it1 == ms1.end() );
VERIFY( ms1.erase("tillsammans") == 1 );
VERIFY( ms1.size() == 9 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
iterator it2 = ms1.find("tillsammans");
VERIFY( it2 == ms1.end() );
@@ -77,12 +80,14 @@ void test01()
VERIFY( ms1.erase(*it3) == 1 );
VERIFY( ms1.size() == 8 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
it3 = ms1.find("belonging (no longer mix)");
VERIFY( it3 == ms1.end() );
VERIFY( !ms1.erase("abra") );
VERIFY( ms1.size() == 8 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
VERIFY( !ms1.erase("eeilo") );
VERIFY( ms1.size() == 8 );
@@ -90,6 +95,7 @@ void test01()
VERIFY( ms1.erase("because to why") == 2 );
VERIFY( ms1.size() == 6 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
iterator it4 = ms1.find("because to why");
VERIFY( it4 == ms1.end() );
@@ -106,12 +112,14 @@ void test01()
VERIFY( ms1.erase(*it5) == 1 );
VERIFY( ms1.size() == 5 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
it5 = ms1.find("umbra/penumbra");
VERIFY( it5 == ms1.end() );
VERIFY( ms1.erase(*it6) == 1 );
VERIFY( ms1.size() == 4 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
it6 = ms1.find("one line behind");
VERIFY( it6 == ms1.end() );
@@ -124,6 +132,7 @@ void test01()
VERIFY( ms1.erase(*it8) == 1 );
VERIFY( ms1.size() == 3 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
VERIFY( ++it7 == it9 );
iterator it10 = it9;
@@ -132,17 +141,20 @@ void test01()
VERIFY( ms1.erase(*it9) == 1 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
VERIFY( ms1.size() == 2 );
VERIFY( ++it10 == ms1.end() );
VERIFY( ms1.erase(ms1.begin()) != ms1.end() );
VERIFY( ms1.size() == 1 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
VERIFY( ms1.begin() == it11 );
VERIFY( ms1.erase(*ms1.begin()) == 1 );
VERIFY( ms1.size() == 0 );
VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
VERIFY( ms1.begin() == ms1.end() );
}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/2.cc
new file mode 100644
index 00000000000..ad6cad4a00d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/2.cc
@@ -0,0 +1,89 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 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 <unordered_set>
+#include <string>
+#include <testsuite_hooks.h>
+
+namespace
+{
+ std::size_t
+ get_nb_bucket_elems(const std::unordered_multiset<std::string>& us)
+ {
+ std::size_t nb = 0;
+ for (std::size_t b = 0; b != us.bucket_count(); ++b)
+ nb += us.bucket_size(b);
+ return nb;
+ }
+}
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_multiset<std::string> Mset;
+ typedef Mset::iterator iterator;
+ typedef Mset::const_iterator const_iterator;
+
+ Mset ms1;
+
+ ms1.insert("foo");
+ ms1.insert("foo");
+ ms1.insert("foo");
+ ms1.insert("foo");
+ ms1.insert("foo");
+ ms1.insert("foo");
+ ms1.insert("bar");
+ ms1.insert("bar");
+ ms1.insert("bar");
+ ms1.insert("bar");
+ ms1.insert("bar");
+ ms1.insert("bar");
+ VERIFY( ms1.size() == 12 );
+ VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
+
+ VERIFY( ms1.erase(ms1.begin()) != ms1.end() );
+ VERIFY( ms1.size() == 11 );
+ VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
+
+ auto it = ms1.begin();
+ advance(it, 2);
+ VERIFY( ms1.erase(ms1.begin(), it) != ms1.end() );
+ VERIFY( ms1.size() == 9 );
+ VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
+
+ VERIFY( ms1.erase(*(ms1.begin())) == 3 );
+ VERIFY( ms1.size() == 6 );
+ VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
+
+ VERIFY( ms1.erase(ms1.begin(), ms1.end()) == ms1.end() );
+ VERIFY( ms1.empty() );
+ VERIFY( get_nb_bucket_elems(ms1) == ms1.size() );
+ VERIFY( distance(ms1.begin(), ms1.end()) == ms1.size() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/erase/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/erase/1.cc
index 8f59773d802..cdefef2afc1 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/erase/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/erase/1.cc
@@ -23,6 +23,18 @@
#include <string>
#include <testsuite_hooks.h>
+namespace
+{
+ std::size_t
+ get_nb_bucket_elems(const std::unordered_set<std::string>& us)
+ {
+ std::size_t nb = 0;
+ for (std::size_t b = 0; b != us.bucket_count(); ++b)
+ nb += us.bucket_size(b);
+ return nb;
+ }
+}
+
void test01()
{
bool test __attribute__((unused)) = true;
@@ -44,14 +56,20 @@ void test01()
s1.insert("belonging (no longer mix)");
s1.insert("one line behind");
VERIFY( s1.size() == 10 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
VERIFY( s1.erase("eeilo") == 1 );
VERIFY( s1.size() == 9 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
iterator it1 = s1.find("eeilo");
VERIFY( it1 == s1.end() );
VERIFY( s1.erase("tillsammans") == 1 );
VERIFY( s1.size() == 8 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
iterator it2 = s1.find("tillsammans");
VERIFY( it2 == s1.end() );
@@ -60,17 +78,23 @@ void test01()
VERIFY( it3 != s1.end() );
VERIFY( s1.erase(*it3) == 1 );
VERIFY( s1.size() == 7 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
it3 = s1.find("belonging (no longer mix)");
VERIFY( it3 == s1.end() );
VERIFY( !s1.erase("abra") );
VERIFY( s1.size() == 7 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
VERIFY( !s1.erase("eeilo") );
VERIFY( s1.size() == 7 );
VERIFY( s1.erase("because to why") == 1 );
VERIFY( s1.size() == 6 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
iterator it4 = s1.find("because to why");
VERIFY( it4 == s1.end() );
@@ -86,11 +110,15 @@ void test01()
VERIFY( s1.erase(*it5) == 1 );
VERIFY( s1.size() == 5 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
it5 = s1.find("umbra/penumbra");
VERIFY( it5 == s1.end() );
VERIFY( s1.erase(*it6) == 1 );
VERIFY( s1.size() == 4 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
it6 = s1.find("one line behind");
VERIFY( it6 == s1.end() );
@@ -102,6 +130,8 @@ void test01()
VERIFY( s1.erase(*it8) == 1 );
VERIFY( s1.size() == 3 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
VERIFY( ++it7 == it9 );
iterator it10 = it9;
@@ -109,15 +139,21 @@ void test01()
iterator it11 = it10;
VERIFY( s1.erase(*it9) == 1 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
VERIFY( s1.size() == 2 );
VERIFY( ++it10 == s1.end() );
VERIFY( s1.erase(s1.begin()) != s1.end() );
VERIFY( s1.size() == 1 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
VERIFY( s1.begin() == it11 );
VERIFY( s1.erase(*s1.begin()) == 1 );
VERIFY( s1.size() == 0 );
+ VERIFY( get_nb_bucket_elems(s1) == s1.size() );
+ VERIFY( distance(s1.begin(), s1.end()) == s1.size() );
VERIFY( s1.begin() == s1.end() );
}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
index 1bbab865f24..fe78cff28aa 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
@@ -20,6 +20,10 @@
#include <atomic>
+#ifndef ATOMIC_BOOL_LOCK_FREE
+# error "ATOMIC_BOOL_LOCK_FREE must be a macro"
+#endif
+
#ifndef ATOMIC_CHAR_LOCK_FREE
# error "ATOMIC_CHAR_LOCK_FREE must be a macro"
#endif
@@ -52,6 +56,10 @@
# error "ATOMIC_LLONG_LOCK_FREE must be a macro"
#endif
+#ifndef ATOMIC_POINTER_LOCK_FREE
+# error "ATOMIC_POINTER_LOCK_FREE must be a macro"
+#endif
+
#ifndef ATOMIC_FLAG_INIT
#error "ATOMIC_FLAG_INIT_must_be_a_macro"
#endif
@@ -65,35 +73,43 @@ extern void abort(void);
int main ()
{
- if (ATOMIC_CHAR_LOCK_FREE != 0 && ATOMIC_CHAR_LOCK_FREE != 1
- && ATOMIC_CHAR_LOCK_FREE != 2)
+#if (ATOMIC_BOOL_LOCK_FREE != 1 && ATOMIC_BOOL_LOCK_FREE != 2)
+ abort ();
+#endif
+
+#if (ATOMIC_CHAR_LOCK_FREE != 1 && ATOMIC_CHAR_LOCK_FREE != 2)
+ abort ();
+#endif
+
+#if (ATOMIC_CHAR16_T_LOCK_FREE != 1 && ATOMIC_CHAR16_T_LOCK_FREE != 2)
abort ();
+#endif
- if (ATOMIC_CHAR16_T_LOCK_FREE != 0 && ATOMIC_CHAR16_T_LOCK_FREE != 1
- && ATOMIC_CHAR16_T_LOCK_FREE != 2)
+#if (ATOMIC_CHAR32_T_LOCK_FREE != 1 && ATOMIC_CHAR32_T_LOCK_FREE != 2)
abort ();
+#endif
- if (ATOMIC_CHAR32_T_LOCK_FREE != 0 && ATOMIC_CHAR32_T_LOCK_FREE != 1
- && ATOMIC_CHAR32_T_LOCK_FREE != 2)
+#if (ATOMIC_WCHAR_T_LOCK_FREE != 1 && ATOMIC_WCHAR_T_LOCK_FREE != 2)
abort ();
+#endif
- if (ATOMIC_WCHAR_T_LOCK_FREE != 0 && ATOMIC_WCHAR_T_LOCK_FREE != 1
- && ATOMIC_WCHAR_T_LOCK_FREE != 2)
+#if (ATOMIC_SHORT_LOCK_FREE != 1 && ATOMIC_SHORT_LOCK_FREE != 2)
abort ();
+#endif
- if (ATOMIC_SHORT_LOCK_FREE != 0 && ATOMIC_SHORT_LOCK_FREE != 1
- && ATOMIC_SHORT_LOCK_FREE != 2)
+#if (ATOMIC_INT_LOCK_FREE != 1 && ATOMIC_INT_LOCK_FREE != 2)
abort ();
+#endif
- if (ATOMIC_INT_LOCK_FREE != 0 && ATOMIC_INT_LOCK_FREE != 1
- && ATOMIC_INT_LOCK_FREE != 2)
+#if (ATOMIC_LONG_LOCK_FREE != 1 && ATOMIC_LONG_LOCK_FREE != 2)
abort ();
+#endif
- if (ATOMIC_LONG_LOCK_FREE != 0 && ATOMIC_LONG_LOCK_FREE != 1
- && ATOMIC_LONG_LOCK_FREE != 2)
+#if (ATOMIC_LLONG_LOCK_FREE != 1 && ATOMIC_LLONG_LOCK_FREE != 2)
abort ();
+#endif
- if (ATOMIC_LLONG_LOCK_FREE != 0 && ATOMIC_LLONG_LOCK_FREE != 1
- && ATOMIC_LLONG_LOCK_FREE != 2)
+#if (ATOMIC_POINTER_LOCK_FREE != 1 && ATOMIC_POINTER_LOCK_FREE != 2)
abort ();
+#endif
}
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index e4191925546..abb92bf358d 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1219,14 +1219,16 @@ proc check_v3_target_atomic_builtins { } {
set src atomic_builtins[pid].cc
set f [open $src "w"]
- puts $f "#include <bits/c++config.h>"
- puts $f "#ifndef _GLIBCXX_ATOMIC_BUILTINS_4"
- puts $f "# error No atomic builtins"
+ puts $f "#if __GCC_ATOMIC_BOOL_LOCK_FREE < 2"
+ puts $f "# error No atomic bool"
+ puts $f "#endif"
+ puts $f "#if __GCC_ATOMIC_INT_LOCK_FREE < 2"
+ puts $f "# error No atomic int"
puts $f "#endif"
close $f
set cxxflags_saved $cxxflags
- set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+ set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror -std=gnu++0x"
set lines [v3_target_compile $src /dev/null preprocess ""]
set cxxflags $cxxflags_saved