aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.def9
-rw-r--r--Makefile.in498
-rw-r--r--Makefile.tpl11
-rwxr-xr-xconfigure234
-rw-r--r--configure.ac23
-rwxr-xr-xcontrib/gcc_update5
-rwxr-xr-xcontrib/update-copyright.py6
-rw-r--r--gcc/ChangeLog.upc5132
-rw-r--r--gcc/DEV-PHASE1
-rw-r--r--gcc/Makefile.in7
-rw-r--r--gcc/c-family/c-common.c127
-rw-r--r--gcc/c-family/c-common.def18
-rw-r--r--gcc/c-family/c-common.h69
-rw-r--r--gcc/c-family/c-cppbuiltin.c91
-rw-r--r--gcc/c-family/c-lex.c10
-rw-r--r--gcc/c-family/c-opts.c145
-rw-r--r--gcc/c-family/c-pragma.c243
-rw-r--r--gcc/c-family/c-pragma.h9
-rw-r--r--gcc/c-family/c-pretty-print.c7
-rw-r--r--gcc/c-family/c-upc-pts.h40
-rw-r--r--gcc/c-family/c.opt44
-rw-r--r--gcc/c/Make-lang.in36
-rw-r--r--gcc/c/c-convert.c6
-rw-r--r--gcc/c/c-decl.c242
-rw-r--r--gcc/c/c-fold.c5
-rw-r--r--gcc/c/c-lang.c10
-rw-r--r--gcc/c/c-objc-common.c91
-rw-r--r--gcc/c/c-parser.c564
-rw-r--r--gcc/c/c-tree.h15
-rw-r--r--gcc/c/c-typeck.c401
-rw-r--r--gcc/c/c-upc-gasp.c130
-rw-r--r--gcc/c/c-upc-gasp.h32
-rw-r--r--gcc/c/c-upc-lang.c203
-rw-r--r--gcc/c/c-upc-lang.h28
-rw-r--r--gcc/c/c-upc-low.c1514
-rw-r--r--gcc/c/c-upc-low.h33
-rw-r--r--gcc/c/c-upc-pts-ops.c655
-rw-r--r--gcc/c/c-upc-pts-ops.h35
-rw-r--r--gcc/c/c-upc-rts-names.h64
-rw-r--r--gcc/c/c-upc.c798
-rw-r--r--gcc/c/c-upc.h50
-rw-r--r--gcc/c/config-lang.in2
-rw-r--r--gcc/c/gupcspec.c307
-rw-r--r--gcc/config.in6
-rw-r--r--gcc/config/darwin.h8
-rw-r--r--gcc/config/i386/i386.c17
-rw-r--r--gcc/config/rs6000/rs6000.c39
-rwxr-xr-xgcc/configure121
-rw-r--r--gcc/configure.ac72
-rw-r--r--gcc/convert.c24
-rw-r--r--gcc/cp/lex.c3
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/defaults.h19
-rw-r--r--gcc/doc/gupc.texi394
-rw-r--r--gcc/doc/install.texi21
-rw-r--r--gcc/doc/invoke.texi68
-rw-r--r--gcc/doc/passes.texi95
-rw-r--r--gcc/doc/sourcebuild.texi6
-rw-r--r--gcc/doc/tm.texi21
-rw-r--r--gcc/doc/tm.texi.in13
-rw-r--r--gcc/dojump.c4
-rw-r--r--gcc/dwarf2out.c57
-rw-r--r--gcc/explow.c2
-rw-r--r--gcc/expr.c13
-rw-r--r--gcc/fold-const.c28
-rw-r--r--gcc/function.c18
-rw-r--r--gcc/gcc.c31
-rw-r--r--gcc/gimple-expr.c14
-rw-r--r--gcc/gimplify.c2
-rw-r--r--gcc/gimplify.h1
-rw-r--r--gcc/langhooks-def.h16
-rw-r--r--gcc/langhooks.c15
-rw-r--r--gcc/langhooks.h21
-rw-r--r--gcc/match.pd53
-rw-r--r--gcc/print-tree.c10
-rw-r--r--gcc/stor-layout.c6
-rw-r--r--gcc/target.def35
-rw-r--r--gcc/targhooks.c45
-rw-r--r--gcc/targhooks.h6
-rw-r--r--gcc/testsuite/gcc.dg/gupc/addr-of-shared-bit-field.upc22
-rw-r--r--gcc/testsuite/gcc.dg/gupc/assign-local-ptr-to-pts.upc20
-rw-r--r--gcc/testsuite/gcc.dg/gupc/assign-pts-to-local-ptr.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/assign-pts-with-diff-block-factors-no-cast.upc22
-rw-r--r--gcc/testsuite/gcc.dg/gupc/barrier-notify-wait.upc17
-rw-r--r--gcc/testsuite/gcc.dg/gupc/block-factor-applied-to-void-type.upc10
-rw-r--r--gcc/testsuite/gcc.dg/gupc/block-factor-incompatible-with-ref-type.upc12
-rw-r--r--gcc/testsuite/gcc.dg/gupc/block-factor-not-int-constant.upc10
-rw-r--r--gcc/testsuite/gcc.dg/gupc/cast-int-to-pts.upc16
-rw-r--r--gcc/testsuite/gcc.dg/gupc/cast-local-ptr-to-pts.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/cmp-pts-and-local-ptr.upc22
-rw-r--r--gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-1.upc16
-rw-r--r--gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-2.upc16
-rw-r--r--gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-3.upc16
-rw-r--r--gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-1.upc16
-rw-r--r--gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-2.upc16
-rw-r--r--gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-3.upc16
-rw-r--r--gcc/testsuite/gcc.dg/gupc/decl-multiple-layout-quals.upc10
-rw-r--r--gcc/testsuite/gcc.dg/gupc/deprecated-barrier-notify-stmt.upc15
-rw-r--r--gcc/testsuite/gcc.dg/gupc/deprecated-barrier-stmt.upc15
-rw-r--r--gcc/testsuite/gcc.dg/gupc/deprecated-barrier-wait-stmt.upc15
-rw-r--r--gcc/testsuite/gcc.dg/gupc/diff-pts-and-local-ptr.upc24
-rw-r--r--gcc/testsuite/gcc.dg/gupc/dyn-array-decl-threads-more-than-once.upc12
-rw-r--r--gcc/testsuite/gcc.dg/gupc/dyn-array-dim-not-simple-multiple-of-threads.upc12
-rw-r--r--gcc/testsuite/gcc.dg/gupc/dyn-star-layout-dim-not-multiple-of-threads.upc14
-rw-r--r--gcc/testsuite/gcc.dg/gupc/dyn-threads-more-than-once.upc14
-rw-r--r--gcc/testsuite/gcc.dg/gupc/dyn-threads-with-indef-block-size.upc13
-rw-r--r--gcc/testsuite/gcc.dg/gupc/field-decl-with-shared-qual.upc15
-rw-r--r--gcc/testsuite/gcc.dg/gupc/func-decl-has-shared_qual.upc13
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-blk-relaxed.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-blk-strict.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-df-relaxed.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-df-strict.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-di-relaxed.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-di-strict.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-hi-relaxed.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-hi-strict.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-qi-relaxed.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-qi-strict.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-sf-relaxed.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-sf-strict.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-si-relaxed.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-si-strict.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-tf-relaxed.upc20
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-tf-strict.upc20
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-ti-relaxed.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/get-ti-strict.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/getaddr.upc14
-rw-r--r--gcc/testsuite/gcc.dg/gupc/gupc.exp40
-rw-r--r--gcc/testsuite/gcc.dg/gupc/init-makes-pts-from-int.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/invalid-local-ptr-to-void-arith.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/invalid-sizeof-shared-void.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/invalid-sizeof-void.upc16
-rw-r--r--gcc/testsuite/gcc.dg/gupc/lt-pts-and-local-ptr.upc22
-rw-r--r--gcc/testsuite/gcc.dg/gupc/max-block-size-exceeded.upc10
-rw-r--r--gcc/testsuite/gcc.dg/gupc/no-closing-layout-qual-bracket.upc11
-rw-r--r--gcc/testsuite/gcc.dg/gupc/parm-decl-with-shared-qual.upc13
-rw-r--r--gcc/testsuite/gcc.dg/gupc/passing-arg-makes-pts-from-int.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/pts-to-void-in-arith.upc23
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-blk-relaxed.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-blk-strict.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-df-relaxed.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-df-strict.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-di-relaxed.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-di-strict.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-hi-relaxed.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-hi-strict.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-qi-relaxed.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-qi-strict.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-sf-relaxed.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-sf-strict.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-si-relaxed.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-si-strict.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-tf-relaxed.upc20
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-tf-strict.upc20
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-ti-relaxed.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/put-ti-strict.upc21
-rw-r--r--gcc/testsuite/gcc.dg/gupc/relaxed-qual-but-not-shared.upc11
-rw-r--r--gcc/testsuite/gcc.dg/gupc/return-makes-pts-from-int.upc13
-rw-r--r--gcc/testsuite/gcc.dg/gupc/shared-array-init-unsupported.upc10
-rw-r--r--gcc/testsuite/gcc.dg/gupc/shared-auto-var-decl.upc14
-rw-r--r--gcc/testsuite/gcc.dg/gupc/shared-init-addr.upc20
-rw-r--r--gcc/testsuite/gcc.dg/gupc/shared-var-both-strict-and-relaxed.upc11
-rw-r--r--gcc/testsuite/gcc.dg/gupc/shared-vla-not-allowed.upc15
-rw-r--r--gcc/testsuite/gcc.dg/gupc/star-block-factor-applied-to-incomplete-type.upc11
-rw-r--r--gcc/testsuite/gcc.dg/gupc/star-block-factor-in-pts-decl.upc10
-rw-r--r--gcc/testsuite/gcc.dg/gupc/static-threads-val-too-big.upc12
-rw-r--r--gcc/testsuite/gcc.dg/gupc/strict-qual-but-not-shared.upc11
-rw-r--r--gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-func-type.upc20
-rw-r--r--gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-non-shared-type.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-void-type.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-func-type.upc20
-rw-r--r--gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-non-shared-type.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-void-type.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/upc-localsizeof-func-type.upc20
-rw-r--r--gcc/testsuite/gcc.dg/gupc/upc-localsizeof-non-shared-type.upc18
-rw-r--r--gcc/testsuite/gcc.dg/gupc/upc-localsizeof-void-type.upc19
-rw-r--r--gcc/testsuite/gcc.dg/gupc/warn-junk-at-end-pragma-upc.upc12
-rw-r--r--gcc/testsuite/gcc.dg/gupc/warn-missing-param-after-pragma-upc.upc12
-rw-r--r--gcc/testsuite/gcc.dg/gupc/warn-pragma-upc-bad-context.upc22
-rw-r--r--gcc/testsuite/lib/target-supports.exp36
-rw-r--r--gcc/timevar.def1
-rw-r--r--gcc/tree-core.h25
-rw-r--r--gcc/tree-dump.c7
-rw-r--r--gcc/tree-pretty-print.c40
-rw-r--r--gcc/tree-sra.c1
-rw-r--r--gcc/tree.c229
-rw-r--r--gcc/tree.h155
-rw-r--r--gcc/varasm.c15
-rw-r--r--libatomic/Makefile.am12
-rw-r--r--libatomic/Makefile.in33
-rw-r--r--libgupc/ChangeLog1644
-rw-r--r--libgupc/Makefile.am404
-rw-r--r--libgupc/Makefile.in3086
-rw-r--r--libgupc/acinclude.m4409
-rw-r--r--libgupc/aclocal.m41028
-rw-r--r--libgupc/ax_prog_doxygen.m4583
-rw-r--r--libgupc/collectives/gen-upc-coll-reduce.pl68
-rw-r--r--libgupc/collectives/upc_coll.h67
-rw-r--r--libgupc/collectives/upc_coll_broadcast.upc128
-rw-r--r--libgupc/collectives/upc_coll_err.upc493
-rw-r--r--libgupc/collectives/upc_coll_exchange.upc129
-rw-r--r--libgupc/collectives/upc_coll_gather.upc127
-rw-r--r--libgupc/collectives/upc_coll_gather_all.upc127
-rw-r--r--libgupc/collectives/upc_coll_init.upc94
-rw-r--r--libgupc/collectives/upc_coll_permute.upc128
-rw-r--r--libgupc/collectives/upc_coll_prefix_reduce.in623
-rw-r--r--libgupc/collectives/upc_coll_prefix_reduce.upc5818
-rw-r--r--libgupc/collectives/upc_coll_readme.txt162
-rw-r--r--libgupc/collectives/upc_coll_reduce.in476
-rw-r--r--libgupc/collectives/upc_coll_reduce.upc4296
-rw-r--r--libgupc/collectives/upc_coll_scatter.upc128
-rw-r--r--libgupc/collectives/upc_coll_sort.upc147
-rw-r--r--libgupc/config.h.in457
-rw-r--r--libgupc/config/darwin/upc-crt-config.h30
-rw-r--r--libgupc/config/default/upc-crt-begin-end.h29
-rw-r--r--libgupc/config/default/upc-crt-config.h36
-rwxr-xr-xlibgupc/configure23425
-rw-r--r--libgupc/configure.ac1382
-rw-r--r--libgupc/configure.tgt125
-rw-r--r--libgupc/dox-filter-config-h29
-rw-r--r--libgupc/doxygen-include.am123
-rw-r--r--libgupc/doxygen.sty.in441
-rw-r--r--libgupc/gen-inline-libgupc.pl99
-rw-r--r--libgupc/gen-upc-ld-script.pl65
-rw-r--r--libgupc/header.tex.in66
-rw-r--r--libgupc/include/gasp.h72
-rw-r--r--libgupc/include/gasp_upc.h224
-rw-r--r--libgupc/include/gcc-upc.h54
-rw-r--r--libgupc/include/pupc.h70
-rw-r--r--libgupc/include/upc.h131
-rw-r--r--libgupc/include/upc_atomic.h84
-rw-r--r--libgupc/include/upc_castable.h60
-rw-r--r--libgupc/include/upc_collective.h222
-rw-r--r--libgupc/include/upc_nb.h65
-rw-r--r--libgupc/include/upc_ops.def164
-rw-r--r--libgupc/include/upc_relaxed.h31
-rw-r--r--libgupc/include/upc_strict.h31
-rw-r--r--libgupc/include/upc_tick.h41
-rw-r--r--libgupc/include/upc_types.def196
-rw-r--r--libgupc/include/upc_types.h97
-rw-r--r--libgupc/libgupc.spec.in3
-rw-r--r--libgupc/libgupc.texi215
-rw-r--r--libgupc/portals4/doxygen.cfg.in1722
-rw-r--r--libgupc/portals4/gcc-upc-lib.in171
-rw-r--r--libgupc/portals4/gupcr_access.c1851
-rw-r--r--libgupc/portals4/gupcr_access.h179
-rw-r--r--libgupc/portals4/gupcr_addr.c195
-rw-r--r--libgupc/portals4/gupcr_alloc.h47
-rw-r--r--libgupc/portals4/gupcr_alloc.upc641
-rw-r--r--libgupc/portals4/gupcr_atomic.upc600
-rw-r--r--libgupc/portals4/gupcr_atomic_sup.c292
-rw-r--r--libgupc/portals4/gupcr_atomic_sup.h84
-rw-r--r--libgupc/portals4/gupcr_backtrace.c400
-rw-r--r--libgupc/portals4/gupcr_backtrace.h45
-rw-r--r--libgupc/portals4/gupcr_barrier.c1003
-rw-r--r--libgupc/portals4/gupcr_barrier.h49
-rw-r--r--libgupc/portals4/gupcr_broadcast.c122
-rw-r--r--libgupc/portals4/gupcr_broadcast.h50
-rw-r--r--libgupc/portals4/gupcr_castable.upc69
-rw-r--r--libgupc/portals4/gupcr_clock.c138
-rw-r--r--libgupc/portals4/gupcr_coll_broadcast.upc129
-rw-r--r--libgupc/portals4/gupcr_coll_init.upc67
-rw-r--r--libgupc/portals4/gupcr_coll_reduce.in606
-rw-r--r--libgupc/portals4/gupcr_coll_reduce.upc4978
-rw-r--r--libgupc/portals4/gupcr_coll_sup.c393
-rw-r--r--libgupc/portals4/gupcr_coll_sup.h106
-rw-r--r--libgupc/portals4/gupcr_config.h180
-rw-r--r--libgupc/portals4/gupcr_defs.h98
-rw-r--r--libgupc/portals4/gupcr_env.c515
-rw-r--r--libgupc/portals4/gupcr_gmem.c521
-rw-r--r--libgupc/portals4/gupcr_gmem.h132
-rw-r--r--libgupc/portals4/gupcr_lib.h72
-rw-r--r--libgupc/portals4/gupcr_lock.h40
-rw-r--r--libgupc/portals4/gupcr_lock.upc539
-rw-r--r--libgupc/portals4/gupcr_lock_sup.c315
-rw-r--r--libgupc/portals4/gupcr_lock_sup.h48
-rw-r--r--libgupc/portals4/gupcr_main.c298
-rw-r--r--libgupc/portals4/gupcr_mem.c211
-rw-r--r--libgupc/portals4/gupcr_nb.upc320
-rw-r--r--libgupc/portals4/gupcr_nb_sup.c597
-rw-r--r--libgupc/portals4/gupcr_nb_sup.h54
-rw-r--r--libgupc/portals4/gupcr_node.c268
-rw-r--r--libgupc/portals4/gupcr_node.h61
-rw-r--r--libgupc/portals4/gupcr_node_mem_mmap.c102
-rw-r--r--libgupc/portals4/gupcr_node_mem_posix.c106
-rw-r--r--libgupc/portals4/gupcr_pgm_info.c243
-rw-r--r--libgupc/portals4/gupcr_portals.c521
-rw-r--r--libgupc/portals4/gupcr_portals.h167
-rw-r--r--libgupc/portals4/gupcr_pts.h193
-rw-r--r--libgupc/portals4/gupcr_runtime.c368
-rw-r--r--libgupc/portals4/gupcr_runtime.h41
-rw-r--r--libgupc/portals4/gupcr_shutdown.c328
-rw-r--r--libgupc/portals4/gupcr_shutdown.h39
-rw-r--r--libgupc/portals4/gupcr_sup.h48
-rw-r--r--libgupc/portals4/gupcr_sync.h87
-rw-r--r--libgupc/portals4/gupcr_tick.c77
-rw-r--r--libgupc/portals4/gupcr_utils.c820
-rw-r--r--libgupc/portals4/gupcr_utils.h327
-rw-r--r--libgupc/portals4/upc_coll.h90
-rw-r--r--libgupc/smp/gcc-upc-lib.in206
-rw-r--r--libgupc/smp/upc_access.c455
-rw-r--r--libgupc/smp/upc_access.h180
-rw-r--r--libgupc/smp/upc_accessg.c557
-rw-r--r--libgupc/smp/upc_addr.c121
-rw-r--r--libgupc/smp/upc_affinity.c221
-rw-r--r--libgupc/smp/upc_affinity.h39
-rw-r--r--libgupc/smp/upc_affinity_stub.c68
-rw-r--r--libgupc/smp/upc_alloc.upc435
-rw-r--r--libgupc/smp/upc_allocg.upc115
-rw-r--r--libgupc/smp/upc_atomic.def5
-rw-r--r--libgupc/smp/upc_atomic.tpl555
-rw-r--r--libgupc/smp/upc_atomic.upc1872
-rw-r--r--libgupc/smp/upc_backtrace.c443
-rw-r--r--libgupc/smp/upc_backtrace.h45
-rw-r--r--libgupc/smp/upc_barrier.upc395
-rw-r--r--libgupc/smp/upc_castable.upc52
-rw-r--r--libgupc/smp/upc_config.h270
-rw-r--r--libgupc/smp/upc_debug.c74
-rw-r--r--libgupc/smp/upc_debug.h96
-rw-r--r--libgupc/smp/upc_defs.h171
-rw-r--r--libgupc/smp/upc_gasp.c83
-rw-r--r--libgupc/smp/upc_gum.c197
-rw-r--r--libgupc/smp/upc_lib.h68
-rw-r--r--libgupc/smp/upc_libat_lock.c61
-rw-r--r--libgupc/smp/upc_libat_lock.h39
-rw-r--r--libgupc/smp/upc_libg.c251
-rw-r--r--libgupc/smp/upc_lock.h31
-rw-r--r--libgupc/smp/upc_lock.upc419
-rw-r--r--libgupc/smp/upc_lock_sup.c49
-rw-r--r--libgupc/smp/upc_lock_sup.h226
-rw-r--r--libgupc/smp/upc_main.c1176
-rw-r--r--libgupc/smp/upc_mem.c56
-rw-r--r--libgupc/smp/upc_mem.h136
-rw-r--r--libgupc/smp/upc_nb.upc189
-rw-r--r--libgupc/smp/upc_numa.c125
-rw-r--r--libgupc/smp/upc_numa.h44
-rw-r--r--libgupc/smp/upc_numa_stub.c75
-rw-r--r--libgupc/smp/upc_pgm_info.c303
-rw-r--r--libgupc/smp/upc_pts.h175
-rw-r--r--libgupc/smp/upc_pupc.c111
-rw-r--r--libgupc/smp/upc_pupc.h57
-rw-r--r--libgupc/smp/upc_sup.h116
-rw-r--r--libgupc/smp/upc_sync.h157
-rw-r--r--libgupc/smp/upc_sysdep.c319
-rw-r--r--libgupc/smp/upc_sysdep.h80
-rw-r--r--libgupc/smp/upc_tick.c78
-rw-r--r--libgupc/smp/upc_vm.c363
-rw-r--r--libgupc/testsuite/Makefile.am13
-rw-r--r--libgupc/testsuite/Makefile.in509
-rw-r--r--libgupc/testsuite/config/default.exp17
-rw-r--r--libgupc/testsuite/lib/libgupc-dg.exp77
-rw-r--r--libgupc/testsuite/lib/libgupc.exp257
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/ChangeLog146
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test00.upc107
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test01.upc65
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test02.upc70
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test03.upc85
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test04.upc106
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test05.upc102
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test06.upc68
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test07.upc44
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test07_sep.upc60
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test08.upc44
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test08_sep.upc63
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test09.upc74
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test10.upc80
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test11.upc72
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test12.upc95
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test13.upc79
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test14.upc78
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test15.upc81
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test16.upc80
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test17.upc99
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test18.upc1090
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test19.upc286
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test20.upc97
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test21.upc83
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test22.upc70
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test23.upc84
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test24.upc296
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test25.upc91
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test26.upc239
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test27.upc360
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test28.upc117
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test29.upc163
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test30.upc142
-rw-r--r--libgupc/testsuite/libgupc.upc/intrepid/test31.upc103
-rw-r--r--libgupc/testsuite/libgupc.upc/upc.exp37
-rw-r--r--libgupc/upc-crtbegin.spec.in3
-rw-r--r--libgupc/upc-crtend.spec.in3
-rw-r--r--libgupc/upc-crtstuff.c66
391 files changed, 102647 insertions, 154 deletions
diff --git a/Makefile.def b/Makefile.def
index ea8453e851f..0d3612672f4 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -155,6 +155,7 @@ target_modules = { module= libbacktrace; };
target_modules = { module= libquadmath; };
target_modules = { module= libgfortran; };
target_modules = { module= libobjc; };
+target_modules = { module= libgupc; };
target_modules = { module= libgo; };
target_modules = { module= libtermcap; no_check=true;
missing=mostlyclean;
@@ -285,6 +286,8 @@ flags_to_pass = { flag= GCJ_FOR_TARGET ; };
flags_to_pass = { flag= GFORTRAN_FOR_TARGET ; };
flags_to_pass = { flag= GOC_FOR_TARGET ; };
flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; };
+flags_to_pass = { flag= GUPC_FOR_TARGET ; };
+flags_to_pass = { flag= GUPCFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= LD_FOR_TARGET ; };
flags_to_pass = { flag= LIPO_FOR_TARGET ; };
flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; };
@@ -563,6 +566,8 @@ dependencies = { module=all-target-libjava; on=all-target-boehm-gc; };
dependencies = { module=all-target-libjava; on=all-target-libffi; };
dependencies = { module=configure-target-libobjc; on=configure-target-boehm-gc; };
dependencies = { module=all-target-libobjc; on=all-target-boehm-gc; };
+dependencies = { module=all-target-libgupc; on=all-target-libbacktrace; };
+dependencies = { module=all-target-libgupc; on=all-target-libatomic; };
dependencies = { module=configure-target-libstdc++-v3; on=configure-target-libgomp; };
dependencies = { module=configure-target-liboffloadmic; on=configure-target-libgomp; };
dependencies = { module=configure-target-libsanitizer; on=all-target-libstdc++-v3; };
@@ -571,6 +576,9 @@ dependencies = { module=configure-target-libvtv; on=all-target-libstdc++-v3; };
// generated by the libgomp configure. Unfortunately, due to the use of
// recursive make, we can't be that specific.
dependencies = { module=all-target-libstdc++-v3; on=configure-target-libgomp; };
+// Installing UPC headers must follow gcc install because
+// gcc removes and then recreates the include directory.
+dependencies = { module=install-target-libgupc; on=install-gcc; };
dependencies = { module=all-target-liboffloadmic; on=all-target-libgomp; };
dependencies = { module=install-target-libgo; on=install-target-libatomic; };
@@ -587,6 +595,7 @@ dependencies = { module=install-target-liboffloadmic; on=install-target-libgcc;
dependencies = { module=install-target-libjava; on=install-target-libgcc; };
dependencies = { module=install-target-libitm; on=install-target-libgcc; };
dependencies = { module=install-target-libobjc; on=install-target-libgcc; };
+dependencies = { module=install-target-libgupc; on=install-target-libgcc; };
dependencies = { module=install-target-libstdc++-v3; on=install-target-libgcc; };
// Target modules in the 'src' repository.
diff --git a/Makefile.in b/Makefile.in
index 1522e39ec5b..691371e988c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -157,6 +157,8 @@ BUILD_EXPORTS = \
GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
GOC="$(GOC_FOR_BUILD)"; export GOC; \
GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
+ GUPC="$(GUPC_FOR_BUILD)"; export GUPC; \
+ GUPCFLAGS="$(GUPCFLAGS_FOR_BUILD)"; export GUPCFLAGS; \
DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
LD="$(LD_FOR_BUILD)"; export LD; \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
@@ -194,6 +196,7 @@ HOST_EXPORTS = \
GCJ="$(GCJ)"; export GCJ; \
GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
GOC="$(GOC)"; export GOC; \
+ GUPC="$(GUPC)"; export GUPC; \
AR="$(AR)"; export AR; \
AS="$(AS)"; export AS; \
CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
@@ -282,6 +285,7 @@ BASE_TARGET_EXPORTS = \
GCJ="$(GCJ_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GCJ; \
GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
+ GUPC="$(GUPC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GUPC; \
DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
@@ -350,6 +354,7 @@ DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
GCJ_FOR_BUILD = @GCJ_FOR_BUILD@
GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
GOC_FOR_BUILD = @GOC_FOR_BUILD@
+GUPC_FOR_BUILD = @GUPC_FOR_BUILD@
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
LD_FOR_BUILD = @LD_FOR_BUILD@
NM_FOR_BUILD = @NM_FOR_BUILD@
@@ -414,6 +419,7 @@ LIBCFLAGS = $(CFLAGS)
CXXFLAGS = @CXXFLAGS@
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
GOCFLAGS = $(CFLAGS)
+GUPCFLAGS = $(CFLAGS)
TFLAGS =
@@ -530,6 +536,7 @@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@
GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
+GUPC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GUPC_FOR_TARGET@
DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
LD_FOR_TARGET=@LD_FOR_TARGET@
@@ -554,6 +561,7 @@ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
GOCFLAGS_FOR_TARGET = -O2 -g
+GUPCFLAGS_FOR_TARGET = -O2 -g
FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
@@ -754,6 +762,8 @@ BASE_FLAGS_TO_PASS = \
"GFORTRAN_FOR_TARGET=$(GFORTRAN_FOR_TARGET)" \
"GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
"GOCFLAGS_FOR_TARGET=$(GOCFLAGS_FOR_TARGET)" \
+ "GUPC_FOR_TARGET=$(GUPC_FOR_TARGET)" \
+ "GUPCFLAGS_FOR_TARGET=$(GUPCFLAGS_FOR_TARGET)" \
"LD_FOR_TARGET=$(LD_FOR_TARGET)" \
"LIPO_FOR_TARGET=$(LIPO_FOR_TARGET)" \
"LDFLAGS_FOR_TARGET=$(LDFLAGS_FOR_TARGET)" \
@@ -808,6 +818,7 @@ EXTRA_HOST_FLAGS = \
'GCJ=$(GCJ)' \
'GFORTRAN=$(GFORTRAN)' \
'GOC=$(GOC)' \
+ 'GUPC=$(GUPC)' \
'LD=$(LD)' \
'LIPO=$(LIPO)' \
'NM=$(NM)' \
@@ -864,6 +875,8 @@ EXTRA_TARGET_FLAGS = \
'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
+ 'GUPC=$$(GUPC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+ 'GUPCFLAGS=$$(GUPCFLAGS_FOR_TARGET)' \
'LD=$(COMPILER_LD_FOR_TARGET)' \
'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
@@ -965,6 +978,7 @@ configure-target: \
maybe-configure-target-libquadmath \
maybe-configure-target-libgfortran \
maybe-configure-target-libobjc \
+ maybe-configure-target-libgupc \
maybe-configure-target-libgo \
maybe-configure-target-libtermcap \
maybe-configure-target-winsup \
@@ -1132,6 +1146,7 @@ all-target: maybe-all-target-libbacktrace
all-target: maybe-all-target-libquadmath
all-target: maybe-all-target-libgfortran
all-target: maybe-all-target-libobjc
+all-target: maybe-all-target-libgupc
all-target: maybe-all-target-libgo
all-target: maybe-all-target-libtermcap
all-target: maybe-all-target-winsup
@@ -1226,6 +1241,7 @@ info-target: maybe-info-target-libbacktrace
info-target: maybe-info-target-libquadmath
info-target: maybe-info-target-libgfortran
info-target: maybe-info-target-libobjc
+info-target: maybe-info-target-libgupc
info-target: maybe-info-target-libgo
info-target: maybe-info-target-libtermcap
info-target: maybe-info-target-winsup
@@ -1313,6 +1329,7 @@ dvi-target: maybe-dvi-target-libbacktrace
dvi-target: maybe-dvi-target-libquadmath
dvi-target: maybe-dvi-target-libgfortran
dvi-target: maybe-dvi-target-libobjc
+dvi-target: maybe-dvi-target-libgupc
dvi-target: maybe-dvi-target-libgo
dvi-target: maybe-dvi-target-libtermcap
dvi-target: maybe-dvi-target-winsup
@@ -1400,6 +1417,7 @@ pdf-target: maybe-pdf-target-libbacktrace
pdf-target: maybe-pdf-target-libquadmath
pdf-target: maybe-pdf-target-libgfortran
pdf-target: maybe-pdf-target-libobjc
+pdf-target: maybe-pdf-target-libgupc
pdf-target: maybe-pdf-target-libgo
pdf-target: maybe-pdf-target-libtermcap
pdf-target: maybe-pdf-target-winsup
@@ -1487,6 +1505,7 @@ html-target: maybe-html-target-libbacktrace
html-target: maybe-html-target-libquadmath
html-target: maybe-html-target-libgfortran
html-target: maybe-html-target-libobjc
+html-target: maybe-html-target-libgupc
html-target: maybe-html-target-libgo
html-target: maybe-html-target-libtermcap
html-target: maybe-html-target-winsup
@@ -1574,6 +1593,7 @@ TAGS-target: maybe-TAGS-target-libbacktrace
TAGS-target: maybe-TAGS-target-libquadmath
TAGS-target: maybe-TAGS-target-libgfortran
TAGS-target: maybe-TAGS-target-libobjc
+TAGS-target: maybe-TAGS-target-libgupc
TAGS-target: maybe-TAGS-target-libgo
TAGS-target: maybe-TAGS-target-libtermcap
TAGS-target: maybe-TAGS-target-winsup
@@ -1661,6 +1681,7 @@ install-info-target: maybe-install-info-target-libbacktrace
install-info-target: maybe-install-info-target-libquadmath
install-info-target: maybe-install-info-target-libgfortran
install-info-target: maybe-install-info-target-libobjc
+install-info-target: maybe-install-info-target-libgupc
install-info-target: maybe-install-info-target-libgo
install-info-target: maybe-install-info-target-libtermcap
install-info-target: maybe-install-info-target-winsup
@@ -1748,6 +1769,7 @@ install-pdf-target: maybe-install-pdf-target-libbacktrace
install-pdf-target: maybe-install-pdf-target-libquadmath
install-pdf-target: maybe-install-pdf-target-libgfortran
install-pdf-target: maybe-install-pdf-target-libobjc
+install-pdf-target: maybe-install-pdf-target-libgupc
install-pdf-target: maybe-install-pdf-target-libgo
install-pdf-target: maybe-install-pdf-target-libtermcap
install-pdf-target: maybe-install-pdf-target-winsup
@@ -1835,6 +1857,7 @@ install-html-target: maybe-install-html-target-libbacktrace
install-html-target: maybe-install-html-target-libquadmath
install-html-target: maybe-install-html-target-libgfortran
install-html-target: maybe-install-html-target-libobjc
+install-html-target: maybe-install-html-target-libgupc
install-html-target: maybe-install-html-target-libgo
install-html-target: maybe-install-html-target-libtermcap
install-html-target: maybe-install-html-target-winsup
@@ -1922,6 +1945,7 @@ installcheck-target: maybe-installcheck-target-libbacktrace
installcheck-target: maybe-installcheck-target-libquadmath
installcheck-target: maybe-installcheck-target-libgfortran
installcheck-target: maybe-installcheck-target-libobjc
+installcheck-target: maybe-installcheck-target-libgupc
installcheck-target: maybe-installcheck-target-libgo
installcheck-target: maybe-installcheck-target-libtermcap
installcheck-target: maybe-installcheck-target-winsup
@@ -2009,6 +2033,7 @@ mostlyclean-target: maybe-mostlyclean-target-libbacktrace
mostlyclean-target: maybe-mostlyclean-target-libquadmath
mostlyclean-target: maybe-mostlyclean-target-libgfortran
mostlyclean-target: maybe-mostlyclean-target-libobjc
+mostlyclean-target: maybe-mostlyclean-target-libgupc
mostlyclean-target: maybe-mostlyclean-target-libgo
mostlyclean-target: maybe-mostlyclean-target-libtermcap
mostlyclean-target: maybe-mostlyclean-target-winsup
@@ -2096,6 +2121,7 @@ clean-target: maybe-clean-target-libbacktrace
clean-target: maybe-clean-target-libquadmath
clean-target: maybe-clean-target-libgfortran
clean-target: maybe-clean-target-libobjc
+clean-target: maybe-clean-target-libgupc
clean-target: maybe-clean-target-libgo
clean-target: maybe-clean-target-libtermcap
clean-target: maybe-clean-target-winsup
@@ -2183,6 +2209,7 @@ distclean-target: maybe-distclean-target-libbacktrace
distclean-target: maybe-distclean-target-libquadmath
distclean-target: maybe-distclean-target-libgfortran
distclean-target: maybe-distclean-target-libobjc
+distclean-target: maybe-distclean-target-libgupc
distclean-target: maybe-distclean-target-libgo
distclean-target: maybe-distclean-target-libtermcap
distclean-target: maybe-distclean-target-winsup
@@ -2270,6 +2297,7 @@ maintainer-clean-target: maybe-maintainer-clean-target-libbacktrace
maintainer-clean-target: maybe-maintainer-clean-target-libquadmath
maintainer-clean-target: maybe-maintainer-clean-target-libgfortran
maintainer-clean-target: maybe-maintainer-clean-target-libobjc
+maintainer-clean-target: maybe-maintainer-clean-target-libgupc
maintainer-clean-target: maybe-maintainer-clean-target-libgo
maintainer-clean-target: maybe-maintainer-clean-target-libtermcap
maintainer-clean-target: maybe-maintainer-clean-target-winsup
@@ -2413,6 +2441,7 @@ check-target: \
maybe-check-target-libquadmath \
maybe-check-target-libgfortran \
maybe-check-target-libobjc \
+ maybe-check-target-libgupc \
maybe-check-target-libgo \
maybe-check-target-libtermcap \
maybe-check-target-winsup \
@@ -2596,6 +2625,7 @@ install-target: \
maybe-install-target-libquadmath \
maybe-install-target-libgfortran \
maybe-install-target-libobjc \
+ maybe-install-target-libgupc \
maybe-install-target-libgo \
maybe-install-target-libtermcap \
maybe-install-target-winsup \
@@ -2703,6 +2733,7 @@ install-strip-target: \
maybe-install-strip-target-libquadmath \
maybe-install-strip-target-libgfortran \
maybe-install-strip-target-libobjc \
+ maybe-install-strip-target-libgupc \
maybe-install-strip-target-libgo \
maybe-install-strip-target-libtermcap \
maybe-install-strip-target-winsup \
@@ -41295,6 +41326,464 @@ maintainer-clean-target-libobjc:
+.PHONY: configure-target-libgupc maybe-configure-target-libgupc
+maybe-configure-target-libgupc:
+@if gcc-bootstrap
+configure-target-libgupc: stage_current
+@endif gcc-bootstrap
+@if target-libgupc
+maybe-configure-target-libgupc: configure-target-libgupc
+configure-target-libgupc:
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ echo "Checking multilib configuration for libgupc..."; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgupc; \
+ $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgupc/multilib.tmp 2> /dev/null; \
+ if test -r $(TARGET_SUBDIR)/libgupc/multilib.out; then \
+ if cmp -s $(TARGET_SUBDIR)/libgupc/multilib.tmp $(TARGET_SUBDIR)/libgupc/multilib.out; then \
+ rm -f $(TARGET_SUBDIR)/libgupc/multilib.tmp; \
+ else \
+ rm -f $(TARGET_SUBDIR)/libgupc/Makefile; \
+ mv $(TARGET_SUBDIR)/libgupc/multilib.tmp $(TARGET_SUBDIR)/libgupc/multilib.out; \
+ fi; \
+ else \
+ mv $(TARGET_SUBDIR)/libgupc/multilib.tmp $(TARGET_SUBDIR)/libgupc/multilib.out; \
+ fi; \
+ test ! -f $(TARGET_SUBDIR)/libgupc/Makefile || exit 0; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgupc; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo Configuring in $(TARGET_SUBDIR)/libgupc; \
+ cd "$(TARGET_SUBDIR)/libgupc" || exit 1; \
+ case $(srcdir) in \
+ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+ *) topdir=`echo $(TARGET_SUBDIR)/libgupc/ | \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ esac; \
+ module_srcdir=libgupc; \
+ rm -f no-such-file || : ; \
+ CONFIG_SITE=no-such-file $(SHELL) \
+ $$s/$$module_srcdir/configure \
+ --srcdir=$${topdir}/$$module_srcdir \
+ $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+ --target=${target_alias} \
+ || exit 1
+@endif target-libgupc
+
+
+
+
+
+.PHONY: all-target-libgupc maybe-all-target-libgupc
+maybe-all-target-libgupc:
+@if gcc-bootstrap
+all-target-libgupc: stage_current
+@endif gcc-bootstrap
+@if target-libgupc
+TARGET-target-libgupc=all
+maybe-all-target-libgupc: all-target-libgupc
+all-target-libgupc: configure-target-libgupc
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) \
+ $(TARGET-target-libgupc))
+@endif target-libgupc
+
+
+
+
+
+.PHONY: check-target-libgupc maybe-check-target-libgupc
+maybe-check-target-libgupc:
+@if target-libgupc
+maybe-check-target-libgupc: check-target-libgupc
+
+check-target-libgupc:
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) check)
+
+@endif target-libgupc
+
+.PHONY: install-target-libgupc maybe-install-target-libgupc
+maybe-install-target-libgupc:
+@if target-libgupc
+maybe-install-target-libgupc: install-target-libgupc
+
+install-target-libgupc: installdirs
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) install)
+
+@endif target-libgupc
+
+.PHONY: install-strip-target-libgupc maybe-install-strip-target-libgupc
+maybe-install-strip-target-libgupc:
+@if target-libgupc
+maybe-install-strip-target-libgupc: install-strip-target-libgupc
+
+install-strip-target-libgupc: installdirs
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) install-strip)
+
+@endif target-libgupc
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-libgupc info-target-libgupc
+maybe-info-target-libgupc:
+@if target-libgupc
+maybe-info-target-libgupc: info-target-libgupc
+
+info-target-libgupc: \
+ configure-target-libgupc
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing info in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ info) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-dvi-target-libgupc dvi-target-libgupc
+maybe-dvi-target-libgupc:
+@if target-libgupc
+maybe-dvi-target-libgupc: dvi-target-libgupc
+
+dvi-target-libgupc: \
+ configure-target-libgupc
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing dvi in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ dvi) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-pdf-target-libgupc pdf-target-libgupc
+maybe-pdf-target-libgupc:
+@if target-libgupc
+maybe-pdf-target-libgupc: pdf-target-libgupc
+
+pdf-target-libgupc: \
+ configure-target-libgupc
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing pdf in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ pdf) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-html-target-libgupc html-target-libgupc
+maybe-html-target-libgupc:
+@if target-libgupc
+maybe-html-target-libgupc: html-target-libgupc
+
+html-target-libgupc: \
+ configure-target-libgupc
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing html in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ html) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-TAGS-target-libgupc TAGS-target-libgupc
+maybe-TAGS-target-libgupc:
+@if target-libgupc
+maybe-TAGS-target-libgupc: TAGS-target-libgupc
+
+TAGS-target-libgupc: \
+ configure-target-libgupc
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing TAGS in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ TAGS) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-install-info-target-libgupc install-info-target-libgupc
+maybe-install-info-target-libgupc:
+@if target-libgupc
+maybe-install-info-target-libgupc: install-info-target-libgupc
+
+install-info-target-libgupc: \
+ configure-target-libgupc \
+ info-target-libgupc
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing install-info in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ install-info) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-install-pdf-target-libgupc install-pdf-target-libgupc
+maybe-install-pdf-target-libgupc:
+@if target-libgupc
+maybe-install-pdf-target-libgupc: install-pdf-target-libgupc
+
+install-pdf-target-libgupc: \
+ configure-target-libgupc \
+ pdf-target-libgupc
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing install-pdf in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ install-pdf) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-install-html-target-libgupc install-html-target-libgupc
+maybe-install-html-target-libgupc:
+@if target-libgupc
+maybe-install-html-target-libgupc: install-html-target-libgupc
+
+install-html-target-libgupc: \
+ configure-target-libgupc \
+ html-target-libgupc
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing install-html in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ install-html) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-installcheck-target-libgupc installcheck-target-libgupc
+maybe-installcheck-target-libgupc:
+@if target-libgupc
+maybe-installcheck-target-libgupc: installcheck-target-libgupc
+
+installcheck-target-libgupc: \
+ configure-target-libgupc
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing installcheck in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ installcheck) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-mostlyclean-target-libgupc mostlyclean-target-libgupc
+maybe-mostlyclean-target-libgupc:
+@if target-libgupc
+maybe-mostlyclean-target-libgupc: mostlyclean-target-libgupc
+
+mostlyclean-target-libgupc:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ mostlyclean) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-clean-target-libgupc clean-target-libgupc
+maybe-clean-target-libgupc:
+@if target-libgupc
+maybe-clean-target-libgupc: clean-target-libgupc
+
+clean-target-libgupc:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing clean in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ clean) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-distclean-target-libgupc distclean-target-libgupc
+maybe-distclean-target-libgupc:
+@if target-libgupc
+maybe-distclean-target-libgupc: distclean-target-libgupc
+
+distclean-target-libgupc:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing distclean in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ distclean) \
+ || exit 1
+
+@endif target-libgupc
+
+.PHONY: maybe-maintainer-clean-target-libgupc maintainer-clean-target-libgupc
+maybe-maintainer-clean-target-libgupc:
+@if target-libgupc
+maybe-maintainer-clean-target-libgupc: maintainer-clean-target-libgupc
+
+maintainer-clean-target-libgupc:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgupc/Makefile ] || exit 0; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgupc"; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgupc && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+ maintainer-clean) \
+ || exit 1
+
+@endif target-libgupc
+
+
+
+
+
.PHONY: configure-target-libgo maybe-configure-target-libgo
maybe-configure-target-libgo:
@if gcc-bootstrap
@@ -49988,6 +50477,7 @@ configure-target-libbacktrace: stage_last
configure-target-libquadmath: stage_last
configure-target-libgfortran: stage_last
configure-target-libobjc: stage_last
+configure-target-libgupc: stage_last
configure-target-libgo: stage_last
configure-target-libtermcap: stage_last
configure-target-winsup: stage_last
@@ -50022,6 +50512,7 @@ configure-target-libbacktrace: maybe-all-gcc
configure-target-libquadmath: maybe-all-gcc
configure-target-libgfortran: maybe-all-gcc
configure-target-libobjc: maybe-all-gcc
+configure-target-libgupc: maybe-all-gcc
configure-target-libgo: maybe-all-gcc
configure-target-libtermcap: maybe-all-gcc
configure-target-winsup: maybe-all-gcc
@@ -50881,6 +51372,8 @@ all-target-libjava: maybe-all-target-boehm-gc
all-target-libjava: maybe-all-target-libffi
configure-target-libobjc: maybe-configure-target-boehm-gc
all-target-libobjc: maybe-all-target-boehm-gc
+all-target-libgupc: maybe-all-target-libbacktrace
+all-target-libgupc: maybe-all-target-libatomic
configure-target-libstdc++-v3: maybe-configure-target-libgomp
configure-stage1-target-libstdc++-v3: maybe-configure-stage1-target-libgomp
@@ -50914,6 +51407,7 @@ all-stage3-target-libstdc++-v3: maybe-configure-stage3-target-libgomp
all-stage4-target-libstdc++-v3: maybe-configure-stage4-target-libgomp
all-stageprofile-target-libstdc++-v3: maybe-configure-stageprofile-target-libgomp
all-stagefeedback-target-libstdc++-v3: maybe-configure-stagefeedback-target-libgomp
+install-target-libgupc: maybe-install-gcc
all-target-liboffloadmic: maybe-all-target-libgomp
install-target-libgo: maybe-install-target-libatomic
install-target-libgfortran: maybe-install-target-libquadmath
@@ -50929,6 +51423,7 @@ install-target-liboffloadmic: maybe-install-target-libgcc
install-target-libjava: maybe-install-target-libgcc
install-target-libitm: maybe-install-target-libgcc
install-target-libobjc: maybe-install-target-libgcc
+install-target-libgupc: maybe-install-target-libgcc
install-target-libstdc++-v3: maybe-install-target-libgcc
all-target-libgloss: maybe-all-target-newlib
all-target-winsup: maybe-all-target-libtermcap
@@ -50989,6 +51484,7 @@ configure-target-libbacktrace: maybe-all-target-libgcc
configure-target-libquadmath: maybe-all-target-libgcc
configure-target-libgfortran: maybe-all-target-libgcc
configure-target-libobjc: maybe-all-target-libgcc
+configure-target-libgupc: maybe-all-target-libgcc
configure-target-libgo: maybe-all-target-libgcc
configure-target-libtermcap: maybe-all-target-libgcc
configure-target-winsup: maybe-all-target-libgcc
@@ -51031,6 +51527,8 @@ configure-target-libgfortran: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libobjc: maybe-all-target-newlib maybe-all-target-libgloss
+configure-target-libgupc: maybe-all-target-newlib maybe-all-target-libgloss
+
configure-target-libgo: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libtermcap: maybe-all-target-newlib maybe-all-target-libgloss
diff --git a/Makefile.tpl b/Makefile.tpl
index 6b2eb6aca50..1abca0b9418 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -160,6 +160,8 @@ BUILD_EXPORTS = \
GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
GOC="$(GOC_FOR_BUILD)"; export GOC; \
GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
+ GUPC="$(GUPC_FOR_BUILD)"; export GUPC; \
+ GUPCFLAGS="$(GUPCFLAGS_FOR_BUILD)"; export GUPCFLAGS; \
DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
LD="$(LD_FOR_BUILD)"; export LD; \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
@@ -197,6 +199,7 @@ HOST_EXPORTS = \
GCJ="$(GCJ)"; export GCJ; \
GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
GOC="$(GOC)"; export GOC; \
+ GUPC="$(GUPC)"; export GUPC; \
AR="$(AR)"; export AR; \
AS="$(AS)"; export AS; \
CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
@@ -285,6 +288,7 @@ BASE_TARGET_EXPORTS = \
GCJ="$(GCJ_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GCJ; \
GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
+ GUPC="$(GUPC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GUPC; \
DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
@@ -353,6 +357,7 @@ DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
GCJ_FOR_BUILD = @GCJ_FOR_BUILD@
GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
GOC_FOR_BUILD = @GOC_FOR_BUILD@
+GUPC_FOR_BUILD = @GUPC_FOR_BUILD@
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
LD_FOR_BUILD = @LD_FOR_BUILD@
NM_FOR_BUILD = @NM_FOR_BUILD@
@@ -417,6 +422,7 @@ LIBCFLAGS = $(CFLAGS)
CXXFLAGS = @CXXFLAGS@
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
GOCFLAGS = $(CFLAGS)
+GUPCFLAGS = $(CFLAGS)
TFLAGS =
@@ -483,6 +489,7 @@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@
GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
+GUPC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GUPC_FOR_TARGET@
DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
LD_FOR_TARGET=@LD_FOR_TARGET@
@@ -507,6 +514,7 @@ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
GOCFLAGS_FOR_TARGET = -O2 -g
+GUPCFLAGS_FOR_TARGET = -O2 -g
FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
@@ -609,6 +617,7 @@ EXTRA_HOST_FLAGS = \
'GCJ=$(GCJ)' \
'GFORTRAN=$(GFORTRAN)' \
'GOC=$(GOC)' \
+ 'GUPC=$(GUPC)' \
'LD=$(LD)' \
'LIPO=$(LIPO)' \
'NM=$(NM)' \
@@ -665,6 +674,8 @@ EXTRA_TARGET_FLAGS = \
'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
+ 'GUPC=$$(GUPC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+ 'GUPCFLAGS=$$(GUPCFLAGS_FOR_TARGET)' \
'LD=$(COMPILER_LD_FOR_TARGET)' \
'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
diff --git a/configure b/configure
index 35f231ea92b..99f3c9c3af0 100755
--- a/configure
+++ b/configure
@@ -581,6 +581,7 @@ LD_FOR_TARGET
DLLTOOL_FOR_TARGET
AS_FOR_TARGET
AR_FOR_TARGET
+GUPC_FOR_TARGET
GOC_FOR_TARGET
GFORTRAN_FOR_TARGET
GCJ_FOR_TARGET
@@ -614,6 +615,7 @@ RANLIB_FOR_BUILD
NM_FOR_BUILD
LD_FOR_BUILD
LDFLAGS_FOR_BUILD
+GUPC_FOR_BUILD
GOC_FOR_BUILD
GFORTRAN_FOR_BUILD
GCJ_FOR_BUILD
@@ -831,6 +833,7 @@ GCC_FOR_TARGET
GCJ_FOR_TARGET
GFORTRAN_FOR_TARGET
GOC_FOR_TARGET
+GUPC_FOR_TARGET
AR_FOR_TARGET
AS_FOR_TARGET
DLLTOOL_FOR_TARGET
@@ -1606,6 +1609,8 @@ Some influential environment variables:
GFORTRAN for the target
GOC_FOR_TARGET
GOC for the target
+ GUPC_FOR_TARGET
+ GUPC for the target
AR_FOR_TARGET
AR for the target
AS_FOR_TARGET
@@ -2763,6 +2768,7 @@ target_libraries="target-libgcc \
target-boehm-gc \
${libgcj} \
target-libobjc \
+ target-libgupc \
target-libada \
target-libgo"
@@ -3204,6 +3210,25 @@ if test x$enable_libgomp = x ; then
esac
fi
+# Disable libgupc on unsupported systems.
+if test -d ${srcdir}/libgupc; then
+ if test x$enable_libgupc = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgupc support" >&5
+$as_echo_n "checking for libgupc support... " >&6; }
+ if (srcdir=${srcdir}/libgupc; \
+ . ${srcdir}/configure.tgt; \
+ test -n "$UNSUPPORTED")
+ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ noconfigdirs="$noconfigdirs target-libgupc"
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ fi
+ fi
+fi
+
# Disable libatomic on unsupported systems.
if test -d ${srcdir}/libatomic; then
if test x$enable_libatomic = x; then
@@ -4045,6 +4070,7 @@ if test "${build}" != "${host}" ; then
GCJ_FOR_BUILD=${GCJ_FOR_BUILD-gcj}
GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
+ GUPC_FOR_BUILD=${GUPC_FOR_BUILD-gupc}
DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
LD_FOR_BUILD=${LD_FOR_BUILD-ld}
NM_FOR_BUILD=${NM_FOR_BUILD-nm}
@@ -4059,6 +4085,7 @@ else
GCJ_FOR_BUILD="\$(GCJ)"
GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
GOC_FOR_BUILD="\$(GOC)"
+ GUPC_FOR_BUILD="\$(GUPC)"
DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
LD_FOR_BUILD="\$(LD)"
NM_FOR_BUILD="\$(NM)"
@@ -7710,6 +7737,7 @@ done
+
# Generate default definitions for YACC, M4, LEX and other programs that run
# on the build machine. These are used if the Makefile can't locate these
# programs in objdir.
@@ -10925,6 +10953,167 @@ fi
+if test -n "$GUPC_FOR_TARGET"; then
+ ac_cv_prog_GUPC_FOR_TARGET=$GUPC_FOR_TARGET
+elif test -n "$ac_cv_prog_GUPC_FOR_TARGET"; then
+ GUPC_FOR_TARGET=$ac_cv_prog_GUPC_FOR_TARGET
+fi
+
+if test -n "$ac_cv_prog_GUPC_FOR_TARGET"; then
+ for ncn_progname in gupc; do
+ # Extract the first word of "${ncn_progname}", so it can be a program name with args.
+set dummy ${ncn_progname}; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_GUPC_FOR_TARGET+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$GUPC_FOR_TARGET"; then
+ ac_cv_prog_GUPC_FOR_TARGET="$GUPC_FOR_TARGET" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_GUPC_FOR_TARGET="${ncn_progname}"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+GUPC_FOR_TARGET=$ac_cv_prog_GUPC_FOR_TARGET
+if test -n "$GUPC_FOR_TARGET"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUPC_FOR_TARGET" >&5
+$as_echo "$GUPC_FOR_TARGET" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ done
+fi
+
+if test -z "$ac_cv_prog_GUPC_FOR_TARGET" && test -n "$with_build_time_tools"; then
+ for ncn_progname in gupc; do
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ncn_progname} in $with_build_time_tools" >&5
+$as_echo_n "checking for ${ncn_progname} in $with_build_time_tools... " >&6; }
+ if test -x $with_build_time_tools/${ncn_progname}; then
+ ac_cv_prog_GUPC_FOR_TARGET=$with_build_time_tools/${ncn_progname}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ break
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ done
+fi
+
+if test -z "$ac_cv_prog_GUPC_FOR_TARGET"; then
+ for ncn_progname in gupc; do
+ if test -n "$ncn_target_tool_prefix"; then
+ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
+set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_GUPC_FOR_TARGET+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$GUPC_FOR_TARGET"; then
+ ac_cv_prog_GUPC_FOR_TARGET="$GUPC_FOR_TARGET" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_GUPC_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+GUPC_FOR_TARGET=$ac_cv_prog_GUPC_FOR_TARGET
+if test -n "$GUPC_FOR_TARGET"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUPC_FOR_TARGET" >&5
+$as_echo "$GUPC_FOR_TARGET" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+ if test -z "$ac_cv_prog_GUPC_FOR_TARGET" && test $build = $target ; then
+ # Extract the first word of "${ncn_progname}", so it can be a program name with args.
+set dummy ${ncn_progname}; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_GUPC_FOR_TARGET+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$GUPC_FOR_TARGET"; then
+ ac_cv_prog_GUPC_FOR_TARGET="$GUPC_FOR_TARGET" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_GUPC_FOR_TARGET="${ncn_progname}"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+GUPC_FOR_TARGET=$ac_cv_prog_GUPC_FOR_TARGET
+if test -n "$GUPC_FOR_TARGET"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUPC_FOR_TARGET" >&5
+$as_echo "$GUPC_FOR_TARGET" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+ test -n "$ac_cv_prog_GUPC_FOR_TARGET" && break
+ done
+fi
+
+if test -z "$ac_cv_prog_GUPC_FOR_TARGET" ; then
+ set dummy gupc
+ if test $build = $target ; then
+ GUPC_FOR_TARGET="$2"
+ else
+ GUPC_FOR_TARGET="${ncn_target_tool_prefix}$2"
+ fi
+else
+ GUPC_FOR_TARGET="$ac_cv_prog_GUPC_FOR_TARGET"
+fi
+
+
+
cat > conftest.c << \EOF
#ifdef __GNUC__
gcc_yay;
@@ -14366,6 +14555,51 @@ $as_echo "pre-installed" >&6; }
fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target gupc" >&5
+$as_echo_n "checking where to find the target gupc... " >&6; }
+if test "x${build}" != "x${host}" ; then
+ if expr "x$GUPC_FOR_TARGET" : "x/" > /dev/null; then
+ # We already found the complete path
+ ac_dir=`dirname $GUPC_FOR_TARGET`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5
+$as_echo "pre-installed in $ac_dir" >&6; }
+ else
+ # Canadian cross, just use what we found
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5
+$as_echo "pre-installed" >&6; }
+ fi
+else
+ ok=yes
+ case " ${configdirs} " in
+ *" gcc "*) ;;
+ *) ok=no ;;
+ esac
+ case ,${enable_languages}, in
+ *,upc,*) ;;
+ *) ok=no ;;
+ esac
+ if test $ok = yes; then
+ # An in-tree tool is available and we can use it
+ GUPC_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gupc -B$$r/$(HOST_SUBDIR)/gcc/'
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: just compiled" >&5
+$as_echo "just compiled" >&6; }
+ elif expr "x$GUPC_FOR_TARGET" : "x/" > /dev/null; then
+ # We already found the complete path
+ ac_dir=`dirname $GUPC_FOR_TARGET`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5
+$as_echo "pre-installed in $ac_dir" >&6; }
+ elif test "x$target" = "x$host"; then
+ # We can use an host tool
+ GUPC_FOR_TARGET='$(GUPC)'
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: host tool" >&5
+$as_echo "host tool" >&6; }
+ else
+ # We need a cross tool
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5
+$as_echo "pre-installed" >&6; }
+ fi
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target ld" >&5
$as_echo_n "checking where to find the target ld... " >&6; }
if test "x${build}" != "x${host}" ; then
diff --git a/configure.ac b/configure.ac
index 74bf58aad93..86325c4283b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -169,6 +169,7 @@ target_libraries="target-libgcc \
target-boehm-gc \
${libgcj} \
target-libobjc \
+ target-libgupc \
target-libada \
target-libgo"
@@ -561,6 +562,22 @@ if test x$enable_libgomp = x ; then
esac
fi
+# Disable libgupc on unsupported systems.
+if test -d ${srcdir}/libgupc; then
+ if test x$enable_libgupc = x; then
+ AC_MSG_CHECKING([for libgupc support])
+ if (srcdir=${srcdir}/libgupc; \
+ . ${srcdir}/configure.tgt; \
+ test -n "$UNSUPPORTED")
+ then
+ AC_MSG_RESULT([no])
+ noconfigdirs="$noconfigdirs target-libgupc"
+ else
+ AC_MSG_RESULT([yes])
+ fi
+ fi
+fi
+
# Disable libatomic on unsupported systems.
if test -d ${srcdir}/libatomic; then
if test x$enable_libatomic = x; then
@@ -1362,6 +1379,7 @@ if test "${build}" != "${host}" ; then
GCJ_FOR_BUILD=${GCJ_FOR_BUILD-gcj}
GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
+ GUPC_FOR_BUILD=${GUPC_FOR_BUILD-gupc}
DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
LD_FOR_BUILD=${LD_FOR_BUILD-ld}
NM_FOR_BUILD=${NM_FOR_BUILD-nm}
@@ -1376,6 +1394,7 @@ else
GCJ_FOR_BUILD="\$(GCJ)"
GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
GOC_FOR_BUILD="\$(GOC)"
+ GUPC_FOR_BUILD="\$(GUPC)"
DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
LD_FOR_BUILD="\$(LD)"
NM_FOR_BUILD="\$(NM)"
@@ -3302,6 +3321,7 @@ AC_SUBST(DLLTOOL_FOR_BUILD)
AC_SUBST(GCJ_FOR_BUILD)
AC_SUBST(GFORTRAN_FOR_BUILD)
AC_SUBST(GOC_FOR_BUILD)
+AC_SUBST(GUPC_FOR_BUILD)
AC_SUBST(LDFLAGS_FOR_BUILD)
AC_SUBST(LD_FOR_BUILD)
AC_SUBST(NM_FOR_BUILD)
@@ -3412,6 +3432,7 @@ NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
NCN_STRICT_CHECK_TARGET_TOOLS(GCJ_FOR_TARGET, gcj)
NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
+NCN_STRICT_CHECK_TARGET_TOOLS(GUPC_FOR_TARGET, gupc)
ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
@@ -3447,6 +3468,8 @@ GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
[gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC,
[gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
+GCC_TARGET_TOOL(gupc, GUPC_FOR_TARGET, GUPC,
+ [gcc/gupc -B$$r/$(HOST_SUBDIR)/gcc/], upc)
GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
diff --git a/contrib/gcc_update b/contrib/gcc_update
index 2df9da407ef..2fe42b75aff 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -145,6 +145,11 @@ libgomp/testsuite/Makefile.in: libgomp/testsuite/Makefile.am libgomp/aclocal.m4
libgomp/configure.ac: libgomp/plugin/configfrag.ac
libgomp/configure: libgomp/configure.ac libgomp/aclocal.m4
libgomp/config.h.in: libgomp/configure.ac libgomp/aclocal.m4
+libgupc/aclocal.m4: libgupc/configure.ac libgupc/acinclude.m4
+libgupc/config.h.in: libgupc/configure.ac
+libgupc/configure: libgupc/configure.ac libgupc/aclocal.m4 libgupc/acinclude.m4
+libgupc/Makefile.in: libgupc/Makefile.am libgupc/aclocal.m4
+libgupc/testsuite/Makefile.in: libgupc/Makefile.am libgupc/aclocal.m4
libitm/aclocal.m4: libitm/configure.ac libitm/acinclude.m4
libitm/Makefile.in: libitm/Makefile.am libitm/aclocal.m4
libitm/testsuite/Makefile.in: libitm/testsuite/Makefile.am libitm/aclocal.m4
diff --git a/contrib/update-copyright.py b/contrib/update-copyright.py
index 5f93d01ac8c..bad9922c2ac 100755
--- a/contrib/update-copyright.py
+++ b/contrib/update-copyright.py
@@ -578,6 +578,7 @@ class TestsuiteFilter (GenericFilter):
'.go',
'.inc',
'.java',
+ '.upc',
])
def skip_file (self, dir, filename):
@@ -711,6 +712,10 @@ class GCCCopyright (Copyright):
self.add_external_author ('The Regents of the University of California.')
self.add_external_author ('Unicode, Inc.')
self.add_external_author ('University of Toronto.')
+ self.add_external_author ('Michigan Technological University')
+ self.add_external_author ('Jeff Muizelaar')
+ self.add_external_author ('Sandia Corporation.')
+ self.add_external_author ('Oren Ben-Kiki')
class GCCCmdLine (CmdLine):
def __init__ (self):
@@ -734,6 +739,7 @@ class GCCCmdLine (CmdLine):
self.add_dir ('libgcc', LibGCCFilter())
self.add_dir ('libgfortran')
self.add_dir ('libgomp')
+ self.add_dir ('libgupc')
self.add_dir ('libiberty')
self.add_dir ('libitm')
self.add_dir ('libjava', LibJavaFilter())
diff --git a/gcc/ChangeLog.upc b/gcc/ChangeLog.upc
new file mode 100644
index 00000000000..fb54640de12
--- /dev/null
+++ b/gcc/ChangeLog.upc
@@ -0,0 +1,5132 @@
+2016-07-15 Gary Funck <gary@intrepid.com>
+
+ Merge GCC 6.0 version 238402 into gupc-6-branch.
+
+2016-06-06 Gary Funck <gary@intrepid.com>
+
+ Merge GCC 6.0 version 237141 into gupc-6-branch.
+
+2016-05-30 Gary Funck <gary@intrepid.com>
+
+ Merge GCC 6.0 version 236881 into gupc-6-branch.
+
+2016-05-03 Gary Funck <gary@intrepid.com>
+
+ Merge GCC 6.0 version 235850 into gupc-6-branch.
+
+2016-04-18 Gary Funck <gary@intrepid.com>
+
+ Merge GCC 6.0 version 235186 into gupc-6-branch.
+ * DEV-PHASE: Change to GNU UPC 6.0.1-1.
+
+2016-04-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 235033 into gupc branch.
+ This trunk version is the origin of the GCC 6 branch.
+
+ * c/c-parser.c: Adjust calls to c_parser_pragm() and
+ c_parser_c99_block_statement(), passing null 'if_p' pointer.
+
+2016-04-11 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 234874 into gupc branch.
+
+2016-04-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 234707 into gupc branch.
+
+2016-03-28 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 234500 into gupc branch.
+
+2016-03-21 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 234360 into gupc branch.
+
+2016-03-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 234176 into gupc branch.
+
+2016-03-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 234022 into gupc branch.
+
+2016-02-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 233807 into gupc branch.
+
+2016-02-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 233598 into gupc branch.
+
+2016-02-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 233420 into gupc branch.
+
+2016-02-08 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 233210 into gupc branch.
+
+2016-02-06 Gary Funck <gary@intrepid.com>
+
+ * langhooks.h (lang_hooks_for_upc): Fix incomplete comment.
+ * langhooks.h (upc.write_global_init_func):
+ Rename - was: upc.write_global_declarations
+ * langhooks-def.h (LANG_HOOKS_UPC_WRITE_GLOBAL_INIT_FUNC):
+ Rename - was: LANG_HOOKS_UPC_WRITE_GLOBAL_DECLS
+ * langhooks-def.h (LANG_HOOKS_UPC): Adjust for rename.
+ * c/c-lang.c: Adjust for rename.
+ * c/c-upc-low.c: Ditto.
+ * c/c-upc-low.h: Ditto.
+ * c-family/c-opts.c: Ditto.
+
+2016-02-01 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 233033 into gupc branch.
+
+2016-01-25 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 232787 into gupc branch.
+
+2016-01-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 232750 into gupc branch.
+
+2016-01-21 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 232666 into gupc branch.
+
+2016-01-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 232497 into gupc branch.
+
+2016-01-11 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 232232 into gupc branch.
+
+2016-01-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 232051 into gupc branch.
+
+2015-12-28 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 231970 into gupc branch.
+
+2015-12-16 Gary Funck <gary@intrepid.com>
+
+ * c/c-lang.c (c_language): Delete references to
+ LANG_HOOKS_UPC_PTS_INIT_TYPE and LANG_HOOKS_UPC_BUILD_INIT_FUNC.
+ * c/c-upc-lang.c: Delete #include "c-family/c-upc-pts.h".
+ (upc_init_array_section): Delete, un-used.
+ (upc_create_static_var): Move to c/upc-low.c.
+ (upc_pts_init_type): Move to c/c-upc-pts-ops.c.
+ (upc_build_init_func): Move to c/upc-low.c.
+ * c/c-upc-lang.h (upc_pts_init_type): Delete prototype.
+ (upc_build_init_func): Ditto.
+ * c/c-upc-low.c (upc_create_static_var): Move here.
+ (upc_build_init_func): Ditto.
+ (upc_write_init_func): Adjust call to upc_build_init_func().
+ * c/c-upc-pts-ops.c (upc_pts_init_type): Move to here.
+ (upc_pts_init): Adjust call to upc_pts_init_type ().
+ * langhooks-def.h (LANG_HOOKS_UPC_PTS_INIT_TYPE): Delete.
+ (LANG_HOOKS_UPC_BUILD_INIT_FUNC): Delete.
+ * langhooks.h (lang_hooks_for_upc): Delete pts_init_type() hook.
+ Delete build_init_func() hook.
+
+2015-12-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 231609 into gupc branch.
+ * c-family/c-opts.c (upc_init_options):
+ Adjust call to control_warning_option().
+
+2015-12-11 Gary Funck <gary@intrepid.com>
+
+ * tree.h (check_qualified_type): Add block_factor argument,
+ pass NULL_TREE by default.
+ * tree.c (build_opaque_vector_type): Adjust call to
+ check_qualified_type(). Use default block_factor. Revert to trunk.
+ * cp/tree.c (cp_check_qualified_type): Likewise.
+
+2015-12-11 Gary Funck <gary@intrepid.com>
+
+ * c/c-decl.c, c/c-typeck.c, c/c-upc-low.c, c/c-upc-pts-ops.c:
+ Use error_at and warning_at where 'loc' is available.
+
+2015-12-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 231354 into gupc branch.
+
+2015-12-06 Gary Funck <gary@intrepid.com>
+
+ * c/c-upc-low.c, c/gupcspec.c, c-family/c-pragma.c,
+ targhooks.c, tree-pretty-print.c, tree.c:
+ Add missing function comments.
+
+2015-12-05 Gary Funck <gary@intrepid.com>
+
+ * tree.c, tree-core.h: Remove custom GC logic for tree nodes.
+ Revert to trunk.
+
+2015-11-30 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 231059 into gupc branch.
+
+2015-11-29 Gary Funck <gary@intrepid.com>
+
+ * c/c-parser.c (upc_affinity_test): Remove call to
+ assemble_external().
+
+2015-11-28 Gary Funck <gary@intrepid.com>
+
+ * doc/gupc.texi: Document -fupc-threads=N and -fupc-heap=N.
+ Remove outdated URL's.
+
+2015-11-27 Gary Funck <gary@intrepid.com>
+
+ * c/c-upc-low.c (create_unshared_var): Set DECL_EXTERNAL()
+ to avoid allocating the unshared "shadow" variable.
+ * c-family/c-opts.c (upc_init_options): Remove work-around
+ that disabled "section anchors" on the PowerPC.
+
+2015-11-25 Gary Funck <gary@intrepid.com>
+
+ * print-tree.c (print_node): Revert to trunk. Remove code that
+ prints constructor/destructor if function_decl flag is set.
+
+2015-11-23 Gary Funck <gary@intrepid.com>
+
+ * c.opt: Add periods to the end of help text.
+ Remove LTO and C++ from UPC-only switches.
+
+2015-11-23 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 230742 into gupc branch.
+
+2015-11-22 Gary Funck <gary@intrepid.com>
+
+ Add two spaces after a period in comments and messages.
+
+2015-11-22 Gary Funck <gary@intrepid.com>
+
+ * c/c-parser.c: Fix spelling.
+ * c/c-typeck.c: Fix spelling.
+
+2015-11-21 Gary Funck <gary@intrepid.com>
+
+ * c-family/c-common.h (c_header_level): extern declaration.
+ * c/c-upc.c (upc_set_decl_section): Delete local extern declaration.
+ Fix comment - do not localize variables declared in system headers.
+
+2015-11-21 Gary Funck <gary@intrepid.com>
+
+ * hooks.c: Revert to trunk.
+ * hooks.h: Revert to trunk.
+
+2015-11-21 Gary Funck <gary@intrepid.com>
+
+ top-level/
+ * contrib/ChangeLog: Revert to trunk.
+ gcc/
+ * c-family/c-common.def: Remove reference to UPC in comment.
+ * print-tree.c (print_node): Remove check for TYPE_SHARED()
+ when printing language flags.
+ * testsuite/gcc.dg/gupc/gupc.exp: Update copyright.
+ * tree.h: Remove extra spaces.
+ * c-family/c-common.c: Fix comment.
+ * c-family/c-common.h: Fix comment.
+ * c-family/c-lex.c: Fix comment.
+ * c-family/c-pragma.c: Fix comment.
+ * c/c-decl.c (merge_decls): set TREE_VOLATILE in 'olddecl'.
+ * c/c-decl.c: Fix spacing and comments.
+ * c/c-parser.c (c_parser_condition): Remove ATTRIBUTE_UNUSED.
+ * c/c-typeck.c: Revert line formatting to trunk.
+
+2015-11-20 Gary Funck <gary@intrepid.com>
+
+ * Makefile.in (doc/gupc.info): Add make dependents.
+
+2015-11-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 230603 into gupc branch.
+
+2015-11-14 Gary Funck <gary@intrepid.com>
+
+ * Makefile.in: Add rules to build gupc.info and gupc.1.
+ * doc/gupc.texi: Minor fixes.
+
+2015-11-14 Gary Funck <gary@intrepid.com>
+
+ * c-family/c.opt: Fix comment.
+
+2015-11-11 Gary Funck <gary@intrepid.com>
+
+ * config/rs6000/rs6000.c: Improve comments.
+
+2015-11-10 Gary Funck <gary@intrepid.com>
+
+ * target.def: Fix typos in the UPC target hook descriptions.
+ * doc/tm.texi: Re-generate.
+
+2015-11-09 Gary Funck <gary@intrepid.com>
+
+ * top-level/Makefile.def (GUPC_FOR_TARGET, GUPCFLAGS_FOR_TARGET):
+ Revert previous commit, these variables are set by configure.
+ * top-level/Makefile.in: Re-generate.
+
+2015-11-09 Gary Funck <gary@intrepid.com>
+
+ * top-level/Makefile.def (GUPC_FOR_TARGET, GUPCFLAGS_FOR_TARGET):
+ Delete un-used make flags.
+ * top-level/Makefile.in: Re-generate.
+
+2015-11-09 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 230003 into gupc branch.
+
+2015-11-09 Gary Funck <gary@intrepid.com>
+
+ * libatomic/Makefile.am: Revert.
+ Can't use $(filter-out) in an automake variable assignment.
+ * libatomic/Makefile.in: Re-generate.
+
+2015-11-08 Gary Funck <gary@intrepid.com>
+
+ * tree-core.h (TI_UPC_PHASE_MASK, TI_UPC_THREAD_MASK,
+ TI_UPC_VADDR_MASK, TI_UPC_PHASE_SHIFT, TI_UPC_THREAD_SHIFT,
+ TI_UPC_VADDR_SHIFT):
+ Delete definitions of UPC "packed PTS" related values.
+ * tree.h, (upc_phase_mask_node, upc_thread_mask_node,
+ upc_vaddr_mask_node, upc_phase_shift_node, upc_thread_shift_node,
+ upc_vaddr_shift_node):
+ Delete definitions of UPC "packed PTS" related values.
+ * doc/install.texi: Remove description of --with-upc-pts-* options,
+ now that only a single UPC pointer-to-shared format is supported.
+ * libatomic/Makefile.am: Simplify logic for building the
+ "no lock" convenience library.
+ * libatomic/Makefile.in: Re-generate.
+
+2015-11-06 Gary Funck <gary@intrepid.com>
+
+ * cp/tree.c (c_build_qualified_type_1): fix typo.
+ layout_qualifier was mis-spelled.
+
+2015-11-06 Gary Funck <gary@intrepid.com>
+
+ * cp/lex.c (init_reswords): Fix logic to disable UPC keywords for C++.
+
+2015-11-05 Gary Funck <gary@intrepid.com>
+
+ * cp/lex.c (init_reswords): Revert to trunk.
+ Do not enable UPC keywords for C++. The -fupc option
+ is currently supported only for "C".
+
+2015-11-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 229652 into gupc branch.
+ * c/c-objc-common.c: Add back #include "options.h".
+ Needed to test for flag_upc.
+ * c/c-parser.c: Add back #include "output.h".
+ Need assemble_external() in upc_affinity_test().
+ * c/c-typeck.c (c_build_qualified_type_1):
+ Use newly introduced 'var_type' variable.
+ * c-family/c-pragma.c: Add #include "langhooks.h"
+ to resolve merge conflict.
+ * fold-const.c (fold_unary_loc): Adjust logic to exclude
+ UPC shared types when simplifying POINTER_PLUS_EXPR.
+ * gimple-expr.c: Add include "langhooks.h"
+ to resolve merge conflict. Used by useless_type_conversion_p().
+
+2015-10-26 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 229307 into gupc branch.
+
+2015-10-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 228959 into gupc branch.
+
+2015-10-18 Gary Funck <gary@intrepid.com>
+
+ Remove support for packed PTS, vaddr order and the
+ ability to choose differing PTS formats.
+ Use only 'struct PTS'.
+ * c/c-upc-pts-packed.c: Delete.
+ * c/c-upc-pts-ops.c: moved from c/c-upc-pts-struct.c.
+ * c/Make-lang.in (c/c-upc-pts-packed.o, c/c-upc-pts-struct.o):
+ Delete references.
+ * configure.ac: Remove support for --with-upc-pts,
+ --with-upc-pts-vaddr-order, --with-upc-pts-packed-bits
+ * langhooks.h, langhooks-def.h, c/c-upc-lang.c, c/c-upc-lang.h,
+ c/c-lang.c, c/c-upc-lang.c, c/c-upc-lang.h, c/c-upc-pts-ops.c:
+ Rename UPC_PTS_INIT_TYPE from UPC_PTS_STRUCT_INIT_TYPE
+ and upc_pts_init_type from upc_pts_struct_init_type.
+ * c/c-upc-lang.c, c-family/c-cppbuiltin.c, c-family/c-upc-pts.h,
+ config.in, configure.ac, configure, c/c-upc-lang.c:
+ Delete references to HAVE_UPC_PTS_VADDR_FIRST.
+ * c/c-parser.c, c/c-upc-low.c, c/c-upc-pts-ops.c, c/c-upc-pts-ops.h,
+ c/c-upc.c: Change (*upc_pts.<pts_op>) to upc_pts_<pts_op>.
+ * c/c-upc-low.c, c/c-upc-pts-ops.c, c-family/c-cppbuiltin.c,
+ c-family/c-upc-pts.h, config.in, doc/tm.texi.in:
+ Delete references to HAVE_UPC_PTS_PACKED_REP
+ and HAVE_UPC_PTS_STRUCT_REP.
+ * configure: Re-generate.
+ * config.in: Re-generate.
+ * doc/tm.texi: Re-generate.
+
+2015-10-18 Gary Funck <gary@intrepid.com>
+
+ * c/c-upc-low.c: Fix typo in comment.
+
+2015-10-17 Gary Funck <gary@intrepid.com>
+
+ * testsuite/gcc.dg/gupc/max-block-size-exceeded.upc:
+ Adjust expected error pattern so that it accepts an
+ arbitrary number range for UPC_MAX_BLOCK_SIZE, and
+ run only one thread to avoid possible overflow in
+ array dimension.
+
+2015-10-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 228829 into gupc branch.
+
+2015-10-14 Gary Funck <gary@intrepid.com>
+
+ * top-level/configure.ac: Remove handling of --with-upc-pts.
+ This is done in the gcc configure script.
+ * top-level/configure: Re-generate.
+ * c/c-upc-gasp.c, c/c-upc-lang.c, c/c-upc-low.c,
+ c/c-upc-pts-ops.c, c/c-upc-pts-packed.c, c/c-upc-pts-struct.c:
+ Fix/add comments.
+
+2015-10-13 Gary Funck <gary@intrepid.com>
+
+ Move most UPC-specific files from 'c-family' to 'c'.
+ This accommodates a dependency upon c/c-tree.h.
+ * Makefile.in: Revert to trunk.
+ * langhooks.h (write_global_declarations): New UPC hook.
+ * langhooks-def.h (LANG_HOOKS_UPC_WRITE_GLOBAL_DECLS): New.
+ * c-family/c-opts.c (c_common_parse_file):
+ Call UPC write_global_declarations hook.
+ * c/c-lang.c: define LANG_HOOKS_UPC_WRITE_GLOBAL_DECLS
+ as upc_write_global_declarations.
+ * c/c-convert.c, c/c-decl.c, c/c-lang.c, c/c-objc-common.c,
+ c/c-parser.c, c/c-typeck.c:
+ Adjust UPC #include's moved from 'c-family' to 'c'.
+ * c-family/c-pragma.c: Delete un-needed #include of c-upc.h.
+ * c/Make-lang.in: Adjust for UPC files moved from c-family.
+ * c/config-lang.in: Ditto.
+ * c/c-upc.c moved from c-family/c-upc.c.
+ * c/c-upc.h moved from c-family/c-upc.h.
+ * c/c-upc-gasp.c moved from c-family/c-upc-gasp.c.
+ * c/c-upc-gasp.h moved from c-family/c-upc-gasp.h.
+ * c/c-upc-low.c moved from c-family/c-upc-low.c.
+ * c/c-upc-low.h moved from c-family/c-upc-low.h.
+ * c/c-upc-pts-ops.c moved from c-family/c-upc-pts-ops.c.
+ * c/c-upc-pts-ops.h moved from c-family/c-upc-pts-ops.h.
+ * c/c-upc-pts-packed.c moved from c-family/c-upc-pts-packed.c.
+ * c/c-upc-pts-struct.c moved from c-family/c-upc-pts-struct.c.
+ * c/c-upc-rts-names.h moved from c-family/c-upc-rts-names.h.
+
+2015-10-13 Gary Funck <gary@intrepid.com>
+
+ * tree-upc.h: Delete. Move UPC support into tree.h.
+ * tree-upc.c: Delete. Move UPC support into tree.c.
+ * Makefile.in: Remove references to tree-upc.c and tree-upc.h.
+ * c/c-convert.c, c/c-decl.c, c/c-objc-common.c, c/c-typeck.c,
+ c/c-upc-lang.c, c-family/c-common.c, c-family/c-upc.c,
+ c-family/c-upc-low.c, c-family/c-upc-pts-packed.c,
+ c-family/c-upc-pts-struct.c, convert.c, dwarf2out.c, print-tree.c,
+ tree.c, tree-pretty-print.c: Delete #include of tree-upc.h.
+
+ * c/c-convert.c, c/c-decl.c, c/c-objc-common.c, c/c-parser.c,
+ c/c-typeck.c, c/c-upc-lang.c, c-family/c-common.c,
+ c-family/c-pretty-print.c, c-family/c-upc.c, c-family/c-upc-low.c,
+ c-family/c-upc-pts-packed.c, c-family/c-upc-pts-struct.c,
+ config/i386/i386.c, config/rs6000/rs6000.c, convert.c, dojump.c,
+ dwarf2out.c, explow.c, fold-const.c, function.c, gimple-expr.c,
+ Makefile.in, match.pd, print-tree.c, tree.c, tree-core.h,
+ tree-dump.c, tree.h, tree-pretty-print.c, tree-sra.c:
+ Rename identifiers defined in tree-core.h and tree.h
+ that have 'UPC' or 'upc' in their name into names that do not
+ refer to UPC (or upc). Identifiers in those files should be generic.
+
+2015-10-13 Gary Funck <gary@intrepid.com>
+
+ * doc/passes.texi: fix typo.
+
+2015-10-12 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 228706 into gupc branch.
+
+2015-10-07 Gary Funck <gary@intrepid.com>
+
+ top-level/configure.ac: Remove --enable-upc-link-script option.
+ This option is now handled in gcc's configure script
+ and the value is communicated to libgupc via a
+ builtin preprocessor definition.
+ top-level/configure: Re-generate.
+ * c-family/c-cppbuiltin.c: define __UPC_LINK_SCRIPT__
+ as builtin preprocessor definition if UPC linker script
+ support is enabled.
+ * configure.ac: Improve handling of --enable-upc-link-script option.
+ When checking default behavior, ensure that this is a native build
+ with GNU ld of a proper version and that the system linker script
+ has the expected format.
+ * configure: Re-generate.
+
+2015-10-06 Gary Funck <gary@intrepid.com>
+
+ * configure: Re-generate.
+
+2015-10-05 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 228465 into gupc branch.
+
+2015-10-04 Gary Funck <gary@intrepid.com>
+
+ * defaults.h (UPC_SHARED_BEGIN_NAME, UPC_SHARED_END_NAME,
+ UPC_PGM_INFO_BEGIN_NAME, UPC_PGM_INFO_END_NAME,
+ UPC_INIT_ARRAY_BEGIN_NAME, UPC_INIT_ARRAY_END_NAME):
+ Delete un-used definitions.
+ * target.def: Define UPC target hooks which replace
+ target macros.
+ * targhooks.c: Define default UPC target hooks.
+ * targhooks.h: Define prototypes for default UPC target hooks.
+ * c/c-upc-lang.c (upc_build_init_func):
+ Use UPC target hook, instead of macro.
+ * c-family/c-cppbuiltin.c (strip_section_prefix):
+ New static helper function.
+ * c-family/c-cppbuiltin.c (upc_cpp_builtins):
+ Emit builtin pre-processor definitions which communicate
+ linker section names used by UPC.
+ * c-family/c-upc.c (upc_set_decl_section): Use UPC target hooks
+ instead of target macros.
+ * varasm.c (default_section_type_flags):
+ Replace UPC target macros with target hooks.
+ * doc/tm.texi.in: Delete UPC target macro descriptions
+ and refer to newly defined UPC target hooks.
+ * doc/tm.texi: Re-generate.
+
+2015-10-02 Gary Funck <gary@intrepid.com>
+
+ * config/darwin.h (UPC_MAIN_NAME): Delete (un-used).
+ * config/darwin.h (UPC_INIT_SECTION_NAME): Delete (un-used).
+
+2015-09-28 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 228196 into gupc branch.
+
+2015-09-21 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 227960 into gupc branch.
+
+2015-09-17 Gary Funck <gary@intrepid.com>
+
+ top-level/
+ * contrib/update-copyright.py: Add .upc to list of test file
+ extensions that should be ignored.
+
+2015-09-17 Gary Funck <gary@intrepid.com>
+
+ * c/c-upc-lang.c: Remove spurious statement in comment.
+ * c/c-upc-lang.c, c/c-upc-lang.h, c/gupcspec.c, c-family/c-upc-gasp.c,
+ c-family/c-upc-gasp.h, c-family/c-upc-low.c, c-family/c-upc-low.h,
+ c-family/c-upc-pts-ops.c, c-family/c-upc-pts-ops.h,
+ c-family/c-upc-pts-packed.c, c-family/c-upc-pts-struct.c,
+ c-family/c-upc-pts.h, c-family/c-upc-rts-names.h,
+ c-family/c-upc.c, c-family/c-upc.h, tree-upc.c, tree-upc.h:
+ Update copyright notices.
+
+2015-09-17 Gary Funck <gary@intrepid.com>
+
+ * tree-upc.c, tree-upc.h: Update copyright notices.
+
+2015-09-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 227737 into gupc branch.
+
+2015-09-13 Gary Funck <gary@intrepid.com>
+
+ * c/c-decl.c: Fold long lines.
+ * c-family/c-upc-low.c: Ditto.
+ * c-family/c-upc-pts-ops.c: Ditto.
+ * c-family/c-upc-pts.h: Ditto.
+ * convert.c: Ditto.
+
+2015-09-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 227337 into gupc branch.
+
+2015-08-31 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 227333 into gupc branch.
+
+2015-08-26 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 227163 into gupc branch.
+
+2015-08-25 Gary Funck <gary@intrepid.com>
+
+ top-level/configure.ac: Use libgupc/configure.tgt to determine
+ if a target is unsupported.
+ top-level/configure: Re-generate.
+
+2015-08-25 Gary Funck <gary@intrepid.com>
+
+ * dwarf2out.c (type_main_variant): Add back static prototype
+ to match trunk.
+ * fold-const.c (fold_unary_loc): Re-arrange terms in
+ if-statement to match trunk.
+
+2015-08-17 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 226950 into gupc branch.
+ * c-family/c-pretty-print.c (pp_c_cv_qualifiers):
+ Adjust logic for relaxed/strict/shared qualifiers.
+
+2015-08-16 Gary Funck <gary@intrepid.com>
+
+ * c/c-decl.c (grokdeclarator): Remove extra space on empty line.
+ * c/c-typeck.c (build_array_ref): Add an empty line to match trunk.
+ * c-family/c-common.c: Remove extra blank line to match trunk.
+ * c-family/c-opts.c (c_common_option_lang_mask):
+ Add an empty line to match trunk.
+ * c-family/c-pretty-print.c (pp_c_cv_qualifiers):
+ Remove assignment to 'previous' to match trunk.
+ * config/darwin.c (darwin_override_options):
+ Remove check for optimize to match trunk.
+ * configure.ac (ACX_BUGRURL): Revert to trunk.
+ * configure: Re-generate.
+ * cp/tree.c (c_build_qualified_type_1): wrap long line.
+ * doc/invoke.texi: Remove extra line with -trigraphs.
+ * match.pd: Remove extra space on empty line.
+ * tree.c (stabilize_reference): Remove extra line to match trunk.
+
+2015-08-15 Gary Funck <gary@intrepid.com>
+
+ * top-level/Makefile.def (language=upc):
+ Remove UPC language target.
+ * top-level/Makefile.in: Re-generate.
+
+2015-08-15 Gary Funck <gary@intrepid.com>
+
+ testsuite/gcc.dg/gupc/
+ * barrier-notify-wait.upc, getaddr.upc, get-blk-relaxed.upc,
+ get-blk-strict.upc, get-df-relaxed.upc, get-df-strict.upc,
+ get-di-relaxed.upc, get-di-strict.upc, get-hi-relaxed.upc,
+ get-hi-strict.upc, get-qi-relaxed.upc, get-qi-strict.upc,
+ get-sf-relaxed.upc, get-sf-strict.upc, get-si-relaxed.upc,
+ get-si-strict.upc, get-tf-relaxed.upc, get-tf-strict.upc,
+ get-ti-relaxed.upc, get-ti-strict.upc, put-blk-relaxed.upc,
+ put-blk-strict.upc, put-df-relaxed.upc, put-df-strict.upc,
+ put-di-relaxed.upc, put-di-strict.upc, put-hi-relaxed.upc,
+ put-hi-strict.upc, put-qi-relaxed.upc, put-qi-strict.upc,
+ put-sf-relaxed.upc, put-sf-strict.upc, put-si-relaxed.upc,
+ put-si-strict.upc, put-tf-relaxed.upc, put-tf-strict.upc,
+ put-ti-relaxed.upc, put-ti-strict.upc, shared-init-addr.upc:
+ Remove calls to cleanup-tree-dump.
+
+2015-08-10 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 226755 into gupc branch.
+
+2015-08-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 226548 into gupc branch.
+
+2015-07-30 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 226386 into gupc branch.
+
+2015-07-27 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 226240 into gupc branch.
+
+2015-07-24 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 226170 into gupc branch.
+
+2015-07-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 225993 into gupc branch.
+
+2015-07-13 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 225729 into gupc branch.
+
+ * c/c-upc-lang.c, c-family/c-upc-low.c, c-family/c-upc-pts-ops.c,
+ c-family/c-upc-pts-packed.c, c-family/c-upc-pts-struct.c:
+ Remove symtab.h from include list. Adjust includes.
+
+2015-07-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 225446 into gupc branch.
+
+2015-06-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 225113 into gupc branch.
+
+ * c-family/c-upc-low.c:
+ Remove ipa-ref.h and plugin-api.h from include list.
+ * tree-upc.c (tm_block_factor_hasher): Rename from tree_map_hasher.
+ * tree-upc.c (tm_block_factor_hasher): Inherit from ggc_cache_ptr_hash
+ rather than ggc_cache_hasher.
+
+2015-06-23 Gary Funck <gary@intrepid.com>
+
+ * function.c (assign_parm_setup_reg): Improve check for
+ struct PTS.
+
+2015-06-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 224722 into gupc branch.
+
+ * tree-upc.c, c/c-upc-lang.c, c-family/c-upc.c, c-family/c-upc-low.c,
+ c-family/c-upc-pts-ops.c, c-family/c-upc-pts-packed.c,
+ c-family/c-upc-pts-struct.c:
+ Remove #include's made redundant by changes to coretypes.h
+
+2015-06-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 224475 into gupc branch.
+
+ * tree-upc.c, c/c-upc-lang.c, c-family/c-upc.c, c-family/c-upc-low.c,
+ c-family/c-upc-pts-ops.c, c-family/c-upc-pts-packed.c,
+ c-family/c-upc-pts-struct.c:
+ Remove #include's made redundant by changes to coretypes.h.
+
+2015-06-08 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 224210 into gupc branch.
+
+ * tree-upc.c, c/c-upc-lang.c, c-family/c-upc.c,
+ c-family/c-upc-low.c, c-family/c-upc-pts-ops.c,
+ c-family/c-upc-pts-packed.c, c-family/c-upc-pts-struct.c:
+ Remove #include's made redundant by changes to coretypes.h.
+
+2015-06-06 Gary Funck <gary@intrepid.com>
+
+ * config/rs6000/rs6000.c (rs6000_pass_by_reference):
+ Check for UPC struct pointer-to-shared type,
+ if using V4 ABI (typical of 32 bit target).
+
+2015-06-01 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 223920 into gupc branch.
+
+2015-05-27 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 223766 into gupc branch.
+
+2015-05-27 Gary Funck <gary@intrepid.com>
+
+ * config/rs6000/rs6000.c (rs6000_return_in_memory):
+ Generalize check for struct PTS to handle various ABI's.
+ (rs6000_function_arg_boundary): Simplify the check for struct PTS.
+ (rs6000_function_value): Improve formatting.
+
+2015-05-25 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 223642 into gupc branch.
+
+2015-05-24 Gary Funck <gary@intrepid.com>
+
+ * tree-core.h, tree.h: Fix typo introduced in revision 209120.
+
+2015-05-23 Gary Funck <gary@intrepid.com>
+
+ * config/rs6000/rs6000.c (rs6000_function_arg_boundary):
+ Disable ABI warning for UPC pointer-to-shared types
+ or the PTS representation type.
+
+2015-05-22 Gary Funck <gary@intrepid.com>
+
+ * config/rs6000/rs6000.c (s6000_function_arg_boundary):
+ Check for UPC pointer-to-shared type in logic that
+ handles new ABI for types that are aligned at >= 16 bytes.
+
+2015-05-22 Gary Funck <gary@intrepid.com>
+
+ Fix RTL check for "struct-PTS".
+ * function.c (assign_parm_setup_reg): Don't call mark_reg_pointer()
+ with a UPC pointer-to-shared.
+
+2015-05-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 223286 into gupc branch.
+
+2015-05-13 Gary Funck <gary@intrepid.com>
+
+ Fix ICE when initializing a global shared variable of type __int128.
+ * c/c-convert.c (convert):
+ Drop 'shared' qualifier for all conversions.
+ Previously, this was done only for types that
+ shared the same main variant.
+
+2015-05-12 Gary Funck <gary@intrepid.com>
+
+ Fix ICE when compiling nested functions.
+ * c-family/c-gimplify.c: Revert to trunk.
+ * c/c-decl.c (finish_function):
+ Move call to upc_genericize here.
+ * c-family/c-upc-low.c (upc_genericize_function): Renamed.
+ Was: upc_genericize_fndecl.
+ Remove logic that attempted to explicitly save/restore
+ current_function_decl.
+ (upc_genericize_function_tree): Delete.
+
+2015-05-11 Gary Funck <gary@intrepid.com>
+
+ Remove asserts which check for attempt to qualify an ARRAY_TYPE.
+ Caused an ICE when compiling gcc.dg/pointer-array-quals-*.c.
+ * c/c-typeck.c (qualify_type): Revert to trunk.
+
+2015-05-11 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 222997 into gupc branch.
+
+2015-05-08 Gary Funck <gary@intrepid.com>
+
+ Revert cosmetic changes to trunk to avoid spurious differences.
+ * tree.c: Remove extra blank line.
+ * c/c-typeck.c: Add back extra blank line.
+
+2015-05-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 222758 into gupc branch.
+
+2015-04-30 Gary Funck <gary@intrepid.com>
+
+ * doc/passes.texi: Add @section command for "UPC Transformation".
+
+2015-04-29 Gary Funck <gary@intrepid.com>
+
+ * doc/gupc.texi, doc/install.texi, doc/invoke.texi,
+ doc/passes.texi, doc/sourcebuild.texi:
+ Update GUPC documentation.
+
+2015-04-27 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 222452 into gupc branch.
+ DEV-PHASE: Bump to 6.0.0-1.
+
+2015-04-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 222227 into gupc branch.
+
+2015-04-13 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 222043 into gupc branch.
+
+2015-04-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 221876 into gupc branch.
+
+2015-03-30 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 221770 into gupc branch.
+
+2015-03-23 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 221587 into gupc branch.
+
+2015-03-16 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 221445 into gupc branch.
+
+2015-03-09 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 221277 into gupc branch.
+
+2015-03-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 221103 into gupc branch.
+
+2015-02-23 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 220913 into gupc branch.
+
+2015-02-16 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 220722 into gupc branch.
+
+2015-02-09 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 220526 into gupc branch.
+
+2015-02-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 220345 into gupc branch.
+
+2015-01-26 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 220104 into gupc branch.
+
+2015-01-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 219833 into gupc branch.
+
+2015-01-12 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 219456 into gupc branch.
+
+2015-01-05 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 219182 into gupc branch.
+
+2014-12-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 219097 into gupc branch.
+
+2014-12-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 219006 into gupc branch.
+
+2014-12-08 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 218477 into gupc branch.
+
+2014-12-01 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 218203 into gupc branch.
+
+2014-11-05 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 217032 into gupc branch.
+ * c/c-upc-lang.c c/gupcspec.c c-family/c-upc.c
+ c-family/c-upc-gasp.c c-family/c-upc-low.c
+ c-family/c-upc-pts-ops.c c-family/c-upc-pts-packed.c
+ c-family/c-upc-pts-struct.c: Remove unnecessary #include's.
+
+2014-10-27 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 216723 into gupc branch.
+
+2014-10-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 216449 into gupc branch.
+
+2014-10-13 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 216139 into gupc branch.
+
+2014-10-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 215919 into gupc branch.
+
+2014-09-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 215678 into gupc branch.
+
+2014-09-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 215458 into gupc branch.
+
+2014-09-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 215259 into gupc branch.
+
+2014-09-08 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 215014 into gupc branch.
+
+2014-09-01 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 214779 into gupc branch.
+
+2014-08-25 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 214415 into gupc branch.
+
+2014-08-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 214178 into gupc branch.
+
+2014-08-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 213968 into gupc branch.
+ DEV-PHASE: Bump to 5.0.0-1.
+
+2014-08-11 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 213809 into gupc branch.
+
+2014-08-05 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 213646 into gupc branch.
+
+2014-08-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 213543 into gupc branch.
+
+2014-08-01 Gary Funck <gary@intrepid.com>
+
+ * testsuite/gcc.dg/gupc: New.
+ Add compile-only tests which check for semantic errors/warnings
+ and verify that UPC constructs generate expected UPC runtime calls.
+ * testsuite/upc.dg: Removed.
+ * testsuite/lib/upc-dg.exp: Removed.
+ * testsuite/lib/upc.exp: Removed.
+ * testsuite/lib/target-supports.exp
+ (check_effective_target_fupc): New.
+ (check_effective_target_upc_struct_pts,
+ check_effective_target_upc_packed_pts):
+ Pass "-fupc -fno-upc-pre-include".
+ * testsuite/gcc.dg/gupc/gupc.exp: Moved from
+ testsuite/upc.dg/compile/compile.exp and modified to
+ work under gcc.dg.
+
+2014-07-28 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 213118 into gupc branch.
+
+2014-07-21 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 212892 into gupc branch.
+
+2014-07-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 212522 into gupc branch.
+
+2014-07-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 212325 into gupc branch.
+
+2014-07-02 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Fix checking for 32-bits target while
+ setting the default PTS packed bits.
+ * configure: Regenerate.
+
+2014-06-30 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 212138 into gupc branch.
+
+2014-06-23 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 211886 into gupc branch.
+
+2014-06-16 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 211699 into gupc branch.
+
+2014-06-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 211672 into gupc branch.
+
+2014-06-12 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 211604 into gupc branch.
+
+2014-06-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 211129 into gupc branch.
+
+2014-05-26 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 210928 into gupc branch.
+
+2014-05-21 Nenad Vukicevic <nenad@intrepid.com>
+
+ * config/darwin.h (LINK_COMMAND_SPEC_A): Fix linker spec
+ on Darwin, replace -fupc-link with -fupc option.
+
+2014-05-12 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 210323 into gupc branch.
+
+2014-05-05 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 210065 into gupc branch.
+
+2014-04-28 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 209848 into gupc branch.
+
+2014-04-21 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 209542 into gupc branch.
+
+2014-04-20 Gary Funck <gary@intrepid.com>
+
+ * c/c-typeck.c (build_binary_op): Check for invalid comparison
+ between pointers-to-shared with target types that have
+ differing UPC blocking factors.
+
+2014-04-16 Gary Funck <gary@intrepid.com>
+
+ Fix PTS comparison involving a generic PTS using packed representation.
+ * c-family/c-upc-pts-packed.c (upc_pts_packed_build_cond_expr):
+ When comparing (shared void *) pointers, mask out the phase component.
+
+2014-04-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 209359 into gupc branch.
+ DEV-PHASE: Bump to 4.10.0-1.
+
+2014-04-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 209179 into gupc branch.
+
+2014-04-04 Gary Funck <gary@intrepid.com>
+
+ * tree-upc.c tree-upc.h: New.
+ Factor UPC-specific tree node handling
+ into tree-upc.c and tree-upc.h.
+ * Makefile.in: Refer to tree-upc.c and tree-upc.h.
+ * c/c-convert.c c/c-decl.c c/c-objc-common.c
+ c/c-typeck.c c/c-upc-lang.c c-family/c-common.c
+ c-family/c-pretty-print.c c-family/c-upc-low.c
+ c-family/c-upc-pts-packed.c c-family/c-upc-pts-struct.c
+ c-family/c-upc.c c-family/c-upc.h convert.c
+ dwarf2out.c print-tree.c tree-core.h tree-dump.c
+ tree-pretty-print.c tree.c tree.h: Rename variables and
+ functions to include 'upc' in their names.
+
+2014-03-31 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 208955 into gupc branch.
+
+2014-03-24 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 208783 into gupc branch.
+
+2014-03-17 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 208609 into gupc branch.
+
+2014-03-10 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 208447 into gupc branch.
+
+2014-03-03 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 208270 into gupc branch.
+
+2014-02-24 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 208066 into gupc branch.
+
+2014-02-17 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 207818 into gupc branch.
+
+2014-02-10 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 207649 into gupc branch.
+
+2014-02-03 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 207415 into gupc branch.
+
+2014-01-30 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 207297 into gupc branch.
+
+2014-01-28 Gary Funck <gary@intrepid.com>
+
+ * c/gupcspec.c (match_suffix): Remove use of PARAMS.
+
+2014-01-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 206847 into gupc branch.
+
+2014-01-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 206792 into gupc branch.
+
+2014-01-17 Nenad Vukicevic <nenad@intrepid.com>
+
+ * c-family/c-cppbuiltin.c (upc_cpp_builtins): Remove pre-defines
+ for __UPC_CASTABLE__, __UPC_COLLECTIVE__, __UPC_TICK__ and
+ __UPC_PUPC__ as they are library and not compiler features.
+
+2014-01-13 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 206575 into gupc branch.
+
+2014-01-10 Gary Funck <gary@intrepid.com>
+
+ Update copyright notices.
+
+2014-01-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 206354 into gupc branch.
+
+2014-01-04 Gary Funck <gary@intrepid.com>
+
+ Integrate GUPC into cc1.
+ * upc/: Remove directory. Re-distribute files.
+ * c/c-upc-lang.c: Move upc/upc-lang.c here.
+ * c/c-upc-lang.h: New.
+ * c-family/c-upc.c: Move upc/upc-act.c here.
+ * c-family/c-upc-gasp.c: Move upc/upc-gasp.c here.
+ * c-family/c-upc-gasp.h: Move upc/upc-gasp.h here.
+ * c-family/c-upc.h: Move upc/upc-act.h here.
+ * c-family/c-upc-low.c: Move upc/upc-genericize.c here.
+ * c-family/c-upc-low.h: Move upc/upc-genericize.h here.
+ * c-family/c-upc-pts.h: Split upc/upc-pts.h here.
+ * c-family/c-upc-pts-ops.c: Split upc/upc-pts.c here.
+ * c-family/c-upc-pts-ops.h: Split upc/upc-pts.h here.
+ * c-family/c-upc-pts-packed.c: Move upc/upc-pts-packed.c here.
+ * c-family/c-upc-pts-struct.c: Move upc/upc-pts-struct.c here.
+ * c-family/c-upc-rts-names.h: Move upc/upc-rts-names.h here.
+ * c-family/stub-upc.c: Remove.
+ * c/gupcspec.c: Move upc/gupcspec.c here.
+ * doc/gupc.texi: Move upc/gupc.texi here.
+ * c/c-objc-common.h: Revert to trunk.
+ * cp/lex.c: Revert to trunk.
+ * cp/Make-lang.in: Revert to trunk.
+ * expr.h: Revert to trunk.
+ * flags.h: Revert to trunk.
+ * fortran/Make-lang.in: Revert to trunk.
+ * java/Make-lang.in: Revert to trunk.
+ * lto/Make-lang.in: Revert to trunk.
+ * objc/Make-lang.in: Revert to trunk.
+ * stor-layout.c: Delete custom hook routines, use
+ newly defined declaration layout language hooks.
+ * stor-layout.h: Revert to trunk.
+ * ../configure.ac: Remove check for UPC language dialect.
+ * ../configure: Re-generate.
+ * Makefile.in (C_COMMON_OBJS): Add UPC-related object files.
+ * c/Make-lang.in: Compile UPC-related files. Build gupc driver.
+ * c/c-decl.c: Call c_genericize() directly rather than
+ lang_hooks.genericize(). Adjust for flag_upc and name changes.
+ * c/c-lang.c (LANG_HOOKS_UPC_TOGGLE_KEYWORDS,
+ LANG_HOOKS_UPC_PTS_STRUCT_INIT_TYPE, LANG_HOOKS_UPC_BUILD_INIT_FUNC,
+ LANG_HOOKS_LAYOUT_DECL_P, LANG_HOOKS_LAYOUT_DECL):
+ Define UPC-specific hooks.
+ * c/c-objc-common.c (upc_types_compatible_p): Move to here.
+ (c_types_compatible_p): Call upc_types_compatible_p().
+ * c/c-parser.c (upc_affinity_test): Move to here.
+ (upc_build_sync_stmt): Move to here.
+ * c/c-typeck.c: #include c-family/c-upc-low.h.
+ * c/config-lang.in (gtfiles): Add UPC gt files.
+ * c-family/c-common.c: Add #include c-upc.h.
+ (c_common_get_alias_set): Move UPC-related alias check to here.
+ (upc_num_threads): Move to here.
+ (c_common_init_ts): Mark UPC-specific statement tree definitions.
+ * c-family/c-common.def (UPC_FORALL_STMT, UPC_SYNC_STMT):
+ Define UPC-specific statements.
+ * c-family/c-common.h (RID_FIRST_UPC_QUAL, RID_LAST_UPC_QUAL,
+ RID_FIRST_UPC_KW, RID_LAST_UPC_KW, UPC_IS_KEYWORD): New.
+ (clk_upc, clk_upcxx, c_dialect_upc, compiling_upc): Delete.
+ (use_upc_dwarf2_extensions, flag_upc): Move to c-family/c.opts.
+ (upc_num_threads): Declare prototype.
+ (UPC_SYNC_OP, UPC_SYNC_ID, UPC_SYNC_NOTIFY_OP, UPC_SYNC_WAIT_OP,
+ UPC_SYNC_BARRIER_OP): Move definitions here.
+ * c-family/c-cppbuiltin.c: Remove #include c-upc.h and
+ add #include c-upc-pts.h.
+ (upc_cpp_builtins): Move to here. Define as static.
+ (c_cpp_builtin): Change call to c_dialect_upc () into
+ test of flag_upc.
+ * c-family/c-gimplify.c: #include c-upc-low.h.
+ (c_common_genericize): Rename c_genericize() to this and make static.
+ (c_genericize): Call upc_genericize() if flag_upc is set and
+ then call c_common_genericize().
+ * c-family/c-opts.c: #include c-upc-low.h and c-upc-pts.h.
+ (c_family_lang_mask): Remove CL_UPC.
+ (c_common_option_lang_mask): Remove CL_UPC from lang_flags.
+ (upc_init_options): Move to here, make it static.
+ (c_common_init_options): Add early check for flag_upc, if found
+ call upc_init_options().
+ (upc_handle_option): Move to here and make static.
+ (c_common_handle_option): Check for UPC-related options
+ and call upc_handle_option(). Remove references to
+ OPT_lang_upc and clk_upc. Check flag_upc instead of
+ calling c_dialect_upc().
+ * c-family/c-pragma.c: #include langhooks.h.
+ (handle_pragma_upc): Remove warning if flag_upc not set;
+ flag_upc now serves the function of compiling_upc().
+ Add call to lang_hooks.upc.toggle_keywords() to
+ implement enable/disable of UPC keywords.
+ (init_pragma): Check flag_upc instead of compiling_upc.
+ * c-family/c-pragma.h (deny_pragma_upc, get_upc_consistency_mode,
+ permit_pragma_upc, pop_upc_consistency_mode,
+ pragma_upc_permitted_p, push_upc_consistency_mode,
+ set_upc_consistency_mode): Move prototypes to here.
+ * c-family/c.opt: Remove all references to "UPC" language dialect.
+ Add -fupc option. Delete -fupc-link option.
+ Add -fupc-threads= option and deprecate -fupc-threads-.
+ * configure.ac: Remove check for UPC language dialect.
+ * configure: Re-generate.
+ * explow.c (tree_expr_size): Move to tree.c.
+ * gcc.c: Change specs to refer to -fupc instead of -lang-upc
+ and -fupc-link.
+ * hooks.c (hook_bool_tree_tree_false): Declare prototype.
+ * langhooks.c (lhd_do_nothing_b, lhd_do_nothing_t_t): New.
+ * langhooks.h (lang_hooks_for_upc): Define hooks for UPC.
+ (layout_decl_p, layout_decl): Define language-specific
+ declaration layout hooks.
+ (genericize): Remove this language hook.
+ * langhooks-def.h: Define UPC default language hooks.
+ Define language-specific declaration layout default hooks.
+ * langhooks.c (lhd_do_nothing_b): New.
+ * tree-core.h (shared_flag): Rename from upc_shared_flag.
+ (strict_flag): Rename from upc_strict_flag.
+ (relaxed_flag): Rename from upc_relaxed_flag.
+ (threads_factor_flag): New. Was a lang. flag.
+ (block_factor_0): New. Was a lang. flag.
+ (block_factor_x): New. Was a lang. flag.
+ (spare1): Decrement spare bits from 8 down to 5.
+ * tree.c (block_factor_for_type): Move to here.
+ (tree_expr_size): Move to here from explow.c.
+ (block_factor_lookup): Move to here.
+ (block_factor_insert): Move to here.
+ (upc_get_block_factor): Move to here.
+ * tree.h: refer to block_factor_* instead of upc_block_factor_*.
+ (TYPE_HAS_BLOCK_FACTOR_0, TYPE_HAS_BLOCK_FACTOR_X,
+ TYPE_HAS_THREADS_FACTOR): Refer to tree base flag bits instead
+ of lang. flag bits.
+ (tree_expr_size): Move prototype from explow.h.
+
+2013-12-30 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 206243 into gupc branch.
+
+2013-12-23 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 206179 into gupc branch.
+
+2013-12-22 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_cpp_builtins): Bump UPC_VERSION
+ to reflect UPC specification version 1.3 compliance.
+
+2013-12-16 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 206010 into gupc branch.
+
+2013-12-09 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 205801 into gupc branch.
+
+2013-12-03 Meador Inge <meadori@codesourcery.com>
+
+ * tree-core.h (tree_type_common): Change tree_type_common to use
+ user-provided GC marking.
+ (gt_ggc_mx, gt_pch_nx): New prototypes.
+ * tree.c (gt_ggc_mx, gt_pch_nx): New functions.
+
+2013-12-03 Gary Funck <gary@intrepid.com>
+
+ Revert:
+
+ 2011-10-10 Gary Funck <gary@intrepid.com>
+
+ * tree.c (check_qualified_type, check_aligned_type):
+ Call tree_int_cst_equal() to compare UPC blocking factors
+ if the corresponding tree pointers are not equal.
+ * c-typeck.c (comptypes_internal, c_build_qualified_type_1): Ditto.
+
+2013-12-03 Gary Funck <gary@intrepid.com>
+
+ * c-family/c.opt: Fix typo introduced in 2013-06-03
+ merge with trunk.
+
+2013-12-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 205582 into gupc branch.
+
+2013-11-26 Meador Inge <meadori@codesourcery.com>
+
+ * upc/upc-genericize.c (upc_expand_get): Ensure that temporaries
+ are declared via a DECL_EXPR.
+
+2013-11-25 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 205346 into gupc branch.
+
+2013-11-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 204942 into gupc branch.
+
+2013-11-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 204894 into gupc branch.
+
+2013-11-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 204659 into gupc branch.
+
+2013-11-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 204345 into gupc branch.
+
+2013-10-31 Gary Funck <gary@intrepid.com>
+
+ Released GUPC 4.9.0.1 based on version 203902.
+ This release version was committed on 2013-10-21.
+ * DEV-PHASE: Bump to 4.9.0.2.
+ * DATESTAMP: Bump date stamp.
+
+2013-10-28 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 204119 into gupc branch.
+
+2013-10-21 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 203886 into gupc branch.
+
+2013-10-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 203514 into gupc branch.
+
+2013-10-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 203240 into gupc branch.
+
+2013-10-01 Gary Funck <gary@intrepid.com>
+
+ Implement pointer-to-shared -> integer conversions.
+ Required per UPC 1.3 Specification.
+ * c/c-typeck.c (build_c_cast): Remove logic that diagnosed
+ PTS->int conversions as an error. Rewrite into a CONVERT_EXPR
+ for later processing by upc_genericize().
+
+2013-10-01 Gary Funck <gary@intrepid.com>
+
+ Implement pointer-to-shared -> integer conversions.
+ Required per UPC 1.3 Specification.
+ * upc/upc-genericize.c (upc_genericize_pts_to_int_cvt): New.
+ (upc_genericize_expr): Call upc_genericize_pts_to_int_cvt().
+
+2013-09-30 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 203026 into gupc branch.
+
+2013-09-23 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 202825 into gupc branch.
+
+2013-09-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 202725 into gupc branch.
+
+2013-09-16 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 202619 into gupc branch.
+
+2013-09-09 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 202382 into gupc branch.
+
+2013-09-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 202159 into gupc branch.
+
+2013-08-26 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 202008 into gupc branch.
+
+2013-08-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 201832 into gupc branch.
+
+2013-08-05 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 201483 into gupc branch.
+
+2013-07-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 201301 into gupc branch.
+
+2013-07-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 201119 into gupc branch.
+
+2013-07-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 200955 into gupc branch.
+
+2013-07-08 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 200775 into gupc branch.
+
+2013-07-01 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 200575 into gupc branch.
+
+2013-06-24 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 200361 into gupc branch.
+
+2013-06-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 200149 into gupc branch.
+
+2013-06-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 200149 into gupc branch.
+ * upc/upc-act.c (upc_create_static_var): New.
+ (upc_build_init_func): Call upc_create_static_var() to
+ create a static variable, __upc_init_func_addr, which
+ is initialized to the address of the UPC
+ shared data initialization function. This change is
+ needed to avoid writing to the output assembly language
+ file too early.
+ (upc_build_sync_stmt): Delete unused variable, sync_expr_type.
+
+2013-06-03 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 199596 into gupc branch.
+
+2013-05-27 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 199350 into gupc branch.
+
+2013-05-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 199093 into gupc branch.
+
+2013-05-14 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-pts-packed.c (upc_pts_packed_build_cvt):
+ When checking whether the phase of a PTS should be reset,
+ if the source type is an array type, then bypass
+ the check for equal type sizes.
+ * upc/upc-pts-struct.c (upc_pts_struct_build_cvt): Ditto.
+
+2013-05-13 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 198815 into gupc branch.
+
+2013-05-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 198622 into gupc branch.
+
+2013-04-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 198433 into gupc branch.
+
+2013-04-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 197958 into gupc branch.
+
+2013-04-08 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 197571 into gupc branch.
+
+2013-04-04 Gary Funck <gary@intrepid.com>
+
+ Per the UPC 1.3 specification, the type of the
+ optional barrier/notify/wait expression is not constrained to
+ 'int'. Instead, any type that is assignment compatible
+ with an 'int' type is permitted.
+ * c/c-parser.c (c_parser_upc_sync_statement): Do not check
+ the optional expression type here. Let upc_build_sync_stmt()
+ handle it.
+ * c/c-tree.h (c_cvt_expr_for_assign): Declare prototype.
+ * c/c-typeck.c (c_cvt_expr_for_assign): New. Also, call
+ error_at() in lieu of error() when the source location is known.
+ * upc/upc-act.c (upc_build_sync_stmt): Call c_cvt_expr_for_assign()
+ to check/convert the optional synchronization statement
+ expression.
+
+2013-04-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 197340 into gupc branch.
+
+2013-04-02 Gary Funck <gary@intrepid.com>
+
+ Revert revision 178346 (2011-08-30)
+ which changed the prototype of check_qualified_type and related
+ functions so that their parameters were just 'tree' and not
+ 'const_tree'. This seemed necessary at the time because of a
+ change to TYPE_BLOCK_FACTOR(), which in turn called function
+ that hashed the type node pointer. The hash functions did
+ not accept "const void *" pointers. Implement a work around
+ that removes this restriction.
+ * c/c-typeck.c: Revert.
+ * tree.c: Revert.
+ * tree.h: Revert. Change prototype of upc_block_factor_lookup()
+ to accept a 'const_tree' pointer to a type node.
+ * c-family/stub-upc.c (upc_block_factor_lookup): Update prototype.
+ * upc/upc-act.c (upc_block_factor_lookup): Accept const_tree
+ input argument and convert this to 'tree' for use with hash function.
+
+2013-04-02 Gary Funck <gary@intrepid.com>
+
+ Revert revision 178346 (2011-08-30)
+ which changed the prototype of check_qualified_type and related
+ functions so that their parameters were just 'tree' and not
+ 'const_tree'. This seemed necessary at the time because of a
+ change to TYPE_BLOCK_FACTOR(), which in turn called a function
+ that hashed the type node pointer. The hash functions did
+ not accept "const void *" pointers. Implement a work around
+ that removes this restriction.
+ * upc/upc-act.c (upc_block_factor_lookup): Accept const_tree
+ input argument and convert this to 'tree' for use with hash function.
+
+2013-03-25 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 197029 into gupc branch.
+
+2013-03-21 Gary Funck <gary@intrepid.com>
+
+ Released GUPC 4.8.0.3 based on version 196601.
+ This release version was committed on 2013-03-11.
+ * DATESTAMP: Bump date stamp.
+
+2013-03-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 196771 into gupc branch.
+ * DEV-PHASE: Bump release identifier to 4.9.0-1.
+
+2013-03-11 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 196592 into gupc branch.
+
+2013-03-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 196422 into gupc branch.
+
+2013-02-25 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 196253 into gupc branch.
+
+2013-02-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 196115 into gupc branch.
+
+2013-02-11 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 195937 into gupc branch.
+
+2013-02-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 195707 into gupc branch.
+
+2013-01-28 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 195502 into gupc branch.
+
+2013-01-21 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 195330 into gupc branch.
+
+2013-01-14 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 195164 into gupc branch.
+
+2013-01-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 194962 into gupc branch.
+
+2012-12-24 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 194709 into gupc branch.
+
+2012-12-17 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 194552 into gupc branch.
+
+2012-12-10 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 194351 into gupc branch.
+
+2012-12-03 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 194076 into gupc branch.
+
+2012-11-30 Gary Funck <gary@intrepid.com>
+
+ Released GUPC 4.8.0.2 based on version 193446.
+ Date of release: 2012-11-12.
+ * DEV-PHASE: Bump release identifier to 4.8.0-3.
+ * DATESTAMP: Bump date stamp.
+
+2012-11-26 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 193807 into gupc branch.
+
+2012-11-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 193672 into gupc branch.
+
+2012-11-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 193617 into gupc branch.
+
+2012-11-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 193426 into gupc branch.
+
+2012-11-12 Gary Funck <gary@intrepid.com>
+
+ Released GUPC 4.8.0.1 based on version 192948.
+ Date of release: 2012-10-29.
+ * DEV-PHASE: Bump release identifier to 4.8.0-2.
+ * DATESTAMP: Bump date stamp.
+
+2012-11-05 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 193152 into gupc branch.
+
+2012-10-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 192909 into gupc branch.
+
+2012-10-28 Nenad Vukicevic <nenad@intrepid.com>
+
+ Remove unused --upc-pthreads-per-process compile switch.
+ * c-family/c.opt: Remove --upc-pthreads-per-process switch
+ that compiler/runtime do not use.
+ * c-family/c-opts.c (c_common_handle_option): Remove support for
+ --upc-pthreads-per-process switch.
+ * c-family/c-common.c: Ditto.
+ * c-family/c-common.h: Ditto.
+
+2012-10-28 Nenad Vukicevic <nenad@intrepid.com>
+
+ Remove unused --upc-pthreads-per-process compile switch.
+ * upc/upc-act.c (upc_handle_option): Ditto.
+ (upc_cpp_builtins): Ditto.
+ * upc/upc-lang.c (upc_init_options): Ditto.
+
+2012-10-27 Gary Funck <gary@intrepid.com>
+
+ * defaults.h: fix typos and formatting in UPC-related entries.
+
+2012-10-26 Nenad Vukicevic <nenad@intrepid.com>
+
+ Place shared initialization code into the .text
+ section instead of a separate .upc_init section.
+ * defaults.h (UPC_INIT_SECTION_NAME): Delete.
+ (UPC_INIT_BEGIN_NAME): Delete.
+ (UPC_INIT_END_NAME): Delete.
+ * doc/tm.texi.in: Ditto.
+ * doc/tm.texi: Ditto.
+
+2012-10-26 Nenad Vukicevic <nenad@intrepid.com>
+
+ Place shared initialization code into the .text
+ section instead of a separate .upc_init section.
+ * upc/upc-act.c (upc_build_init_func): Remove settings
+ of the section for shared initialization code.
+
+2012-10-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 192673 into gupc branch.
+
+2012-10-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 192449 into gupc branch.
+
+2012-10-08 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 192198 into gupc branch.
+
+2012-10-01 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 191931 into gupc branch.
+
+2012-09-26 Gary Funck <gary@intrepid.com>
+
+ Implement support for various UPC version 1.3 specification
+ additions and changes. Deprecate support for upc_local_alloc.
+ Add support for upc_tick (wall-clock timer) library.
+ Add support for collective de-allocation functions:
+ upc_all_free and upc_all_lock_free.
+ Consult libgupc/ChangeLog,
+ libgupc/testsuite/libgupc.upc/intrepid/ChangeLog for details.
+
+2012-09-26 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_cpp_builtins): Pre-define __UPC_TICK__.
+
+2012-09-24 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 191658 into gupc branch.
+
+2012-09-17 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 191376 into gupc branch.
+
+2012-09-10 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 191141 into gupc branch.
+
+2012-08-29 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/gupc.texi: Add description for -fupc-pre-include.
+
+2012-08-27 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 190707 into gupc branch.
+ * tree.h (struct tree_base): Adjust various
+ UPC tree and type flags to refer to the
+ newly introduced u.bits field.
+
+2012-08-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 190524 into gupc branch.
+ Incorporates a fix in genoutput.c (to properly use
+ CONST_CAST) that led to build failures with
+ older versions of g++.
+
+2012-08-16 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 190437 into gupc branch.
+ Incorporates a fix for a build failure on the PPC
+ due to passing incorrect switches to the assembler.
+ Also, first merged trunk revision that compiles GCC
+ with the C++ compiler in the first stage.
+
+2012-08-16 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-pts-struct.c (upc_pts_struct_is_null_p):
+ Adjust VEC_index() calls to use C++ syntax.
+ This is required as part of the move to compile
+ GCC with the C++ compiler.
+
+2012-08-13 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 190336 into gupc branch.
+
+2012-08-09 Gary Funck <gary@intrepid.com>
+
+ * c-family/c-common.c (c_fully_fold_internal): Do not fold
+ offsetof-like expressions when they are applied to UPC
+ shared types.
+
+2012-08-07 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-genericize.c: Delete un-used include of optabs.h.
+ Fixes a parallel make failure due to un-noticed dependency.
+
+2012-08-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 190173 into gupc branch.
+
+2012-08-01 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 190063 into gupc branch.
+ Incorporates fix for build failure on IA64.
+
+2012-07-30 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 189954 into gupc branch.
+
+2012-07-27 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 189856 into gupc branch.
+ Incorporates fix for bootstrap with a sub-set of language
+ specific source directories present.
+ * optabs.c: Revert to trunk. Rather than defining opcodes
+ as a way of defining get/put runtime library function names,
+ generate them directly in gcc/upc/upc-genericize.c.
+ * optabs.h: Ditto.
+ * genopinit.c: Ditto.
+
+2012-07-27 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-genericize.c (upc_expand_get, upc_expand_put):
+ Rather than referring to UPC-specific opcodes to find
+ the name of the get/put library function name, generate
+ the name directly.
+ (get_lc_mode_name): New.
+
+2012-07-25 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-pts-struct.c (upc_pts_struct_build_cond_expr):
+ Fix regression: field-by-field comparison of UPC
+ pointer-to-shared (vaddr, thread) only works
+ (with the current logic) for the == and != operators.
+
+2012-07-24 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-pts-packed.c (upc_pts_packed_build_cond_expr):
+ Fix warning about use of const_tree.
+
+2012-07-24 Gary Funck <gary@intrepid.com>
+
+ Per UPC spec. 6.4.2p6, ignore the value of the
+ phase of a pointer-to-shared, when comparing for
+ equal or not equal.
+ * upc/upc-pts-packed.c (upc_pts_packed_build_cond_expr):
+ Use bit-wise comparison only if the UPC pointer-to-shared
+ target type has a block size <= 1 and the representation
+ has vaddr first or the comparison is for equality/inequality.
+ * upc/upc-pts-struct.c (upc_pts_struct_build_cond_expr):
+ Use (vaddr, thread) comparison only if the UPC pointer-to-shared
+ has a block size <= 1 or the comparison is for equality/inequality.
+
+2012-07-23 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 189777 into gupc branch.
+
+2012-07-16 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 189545 into gupc branch.
+
+2012-07-12 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 189366 into gupc branch.
+
+2012-07-05 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 189274 into gupc branch.
+ Incorporates graphite build infrastructure changes.
+
+2012-07-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 189080 into gupc branch.
+ * Makefile.in: Adjust for move of C front-end files.
+ * c/Make-lang.in: Ditto.
+
+2012-07-04 Gary Funck <gary@intrepid.com>
+
+ * upc/config-lang.in: Adjust for move of C front-end files.
+ * upc/upc-act.c: Look for c-tree.h and c-objc-common.h in c/.
+ * upc/upc-gasp.c: Ditto.
+ * upc/upc-genericize.c: Ditto.
+ * upc/upc-lang.c: Ditto.
+ * upc/upc-pts-struct.c: Ditto.
+
+2012-07-03 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 189078 into gupc branch.
+
+2012-06-25 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 188931 into gupc branch.
+
+2012-06-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 188721 into gupc branch.
+
+2012-06-11 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 188380 into gupc branch.
+
+2012-06-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 188168 into gupc branch.
+
+2012-05-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 187927 into gupc branch.
+
+2012-05-19 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_lang_layout_decl): Ignore declarations of
+ an array of shared type declarations if the size of the
+ array is zero. This avoids a segfault when processing
+ the UPC blocking factor.
+
+2012-05-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 187666 into gupc branch.
+ Incorporates fix for ICE in tree vectorization pass
+ when processing strided loads.
+
+2012-05-17 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 187578 into gupc branch.
+
+2012-05-09 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 187347 into gupc branch.
+ Incorporates fix for segfault in tree vectorization pass.
+
+2012-05-08 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/gupcspec.c (lang_specific_driver): Improve handling of
+ "-x" switches: (a) add "-x upc" switch for C source files if
+ no -x switch was seen before OR "-x none" was seen, (b) add
+ "-x none" for files other then C files if "-x upc" was
+ previously added. Cleanup warnings on unused variables
+ and integer conversion. Print verbose info regardless of the
+ command line being the same.
+
+2012-05-04 Nenad Vukicevic <nenad@intrepid.com>
+
+ * testsuite/lib/upc.exp: Use gupc instead of xgupc driver.
+ Appropriate libraries and include files are added on the
+ command line to make it possible to compile with the driver
+ from the build tree.
+
+2012-05-04 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/gupc.texi: Simplify the description of the optimization
+ options.
+
+2012-05-04 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/Make-lang.in: Remove build of xgupc.
+ * upc/gupcspec.c (get_libgupc_path): Delete.
+ (lang_specific_driver): Remove support for building xgupc.
+ Removed code tried to add -B, -L, -isystem to the command
+ line if xgupc driver is invoked from the development tree.
+
+2012-05-04 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_num_threads): When THREADS is specified
+ statically, convert the value to a signed size type,
+ so that (for example) the thread affinity test in a
+ upc_forall() statement will work as expected for negative
+ integer index values.
+
+2012-04-30 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/Make-lang.in: Add year 2012 to the copyright.
+
+2012-04-30 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/gupc.c: Delete. The old GUPC driver.
+ * upc/gupcspec.c: Add. The new GUPC driver tailored
+ after fortran/gfortranspec.c driver. Options "-n", "-inst",
+ and "-inst-functions' are not supported by the new driver.
+ Support for building gupc and xgupc remains the same.
+ * upc/Make-lang.in (xgupc): Changes to compile gupcspec.c
+ instead of gupc.c
+ (gupc): Ditto.
+ * upc/gupc.texi: Remove '-n', '-inst', and '-inst-functions'
+ options.
+
+2012-04-29 Nenad Vukicevic <nenad@intrepid.com>
+
+ * config/rs6000/rs6000.c (rs6000_return_in_memory): Conform to
+ PPC ABI. In the UPC 'struct' pointer-to-shared representation,
+ a function returns a pointer-to-shared in memory instead
+ of in registers.
+ (rs6000_pass_by_reference): Ditto.
+
+2012-04-28 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (grokdeclarator): Set 'type' to error node
+ after detecting "shared auto variable" error to avoid
+ downstream complications.
+ * upc/upc-act.c: Fix a couple of spelling errors in comments.
+
+2012-04-26 Gary Funck <gary@intrepid.com>
+
+ * c-family/c-pragma.c (handle_pragma_upc):
+ Fix typo in warning message.
+
+2012-04-17 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/gupc.texi: Fix the warning for usage of 'insertcopying'
+ before 'copying'. Minor changes to to copyright years and
+ manual info.
+
+2012-04-17 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 186486 into gupc branch.
+
+2012-04-17 Gary Funck <gary@intrepid.com>
+
+ * c-family/c-pragma.c (disable_pupc_mode): Return the previous
+ value of the pupc mode. Fixes a compile-time warning.
+ * c-family/c-pragma.c (init_pragma_pupc, get_upc_pupc_mode,
+ disable_pupc_mode, set_pupc_mode, handle_pragma_pupc):
+ Improve source formatting.
+
+2012-04-16 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-genericize.c: Adjust copyright.
+ (upc_genericize_fndecl): Adjust call graph
+ union member reference to use the newly introduced
+ 'symbol' field in order to refer to 'decl'.
+
+2012-04-09 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 186243 into gupc branch.
+ Incorporates a powerpc 'ffi' fix.
+
+2012-03-16 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 185454 into gupc branch.
+ Incorporates a libgcc fix for builds on Darwin.
+
+2012-03-13 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 185278 into gupc branch.
+ * c-decl.c (c_build_pointer_type): For UPC pointer-to-shared types
+ call build_pointer_type() to apply UPC-specific qualifiers.
+ * top-level/configure.ac: factor the checking for posix hosts
+ out of the libgomp section so that it can also be used by libgupc.
+ * top-level/configure: Re-generate.
+ * DEV-PHASE: bump to 4.8.0-1.
+
+2012-03-12 Gary Funck <gary@intrepid.com>
+
+ * config/rs6000/rs6000.c (rs6000_function_value): Do not over-ride
+ the mode for a pointer for upc-pointer-to-shared types.
+
+2012-03-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 184900 into gupc branch.
+
+2012-02-17 Gary Funck <gary@intrepid.com>
+
+ Released GUPC 4.7.0.2 based on version 183992.
+ * DEV-PHASE: Bump release identifier to 4.7.0-3.
+ * DATESTAMP: Bump date stamp.
+
+2012-02-07 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/gupc.texi: Added entries for the directory.
+
+2012-02-05 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/gupc-manpage.html: Removed. HTML files are generated from
+ the texi source.
+
+2012-02-05 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/gupc.texi (-x upc): Add files ending with '.c' to the list
+ of files compiled as UPC source.
+
+2012-02-04 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/Make-lang.in (doc/gupc.info): Fix dependencies for creating
+ gupc.info document.
+
+2012-02-03 Nenad Vukicevic <nenad@intrepid.com>
+
+ * c-family/c-pragma.c (disable_pupc_mode): New. Disable profiling
+ code generation (same as #pragma pupc off).
+ (set_pupc_mode): New. Set/restore profiling mode.
+ * c-family/c-upc.h (disable_pupc_mode): New. Prototype.
+ (set_pupc_mode): New. Prototype.
+ * upc/upc-act.c (upc_write_init_func): Disable emitting of the
+ profiling code for shared variables initialization routines.
+
+2012-02-03 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/upc-act.c (upc_write_init_func): Disable emitting of the
+ profiling code for shared variables initialization routines.
+
+2012-02-03 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/Make-lang.in: Various changes related to generating
+ man/info pages from texi source file.
+ (upc.install-common): Fix for removing the upc command
+ link before install if suffix was applied.
+ (upc.install-pdf): New.
+ (upc.install-html): Change for the build from texi.
+ (upc.install-man): Change for the build from texi.
+ * upc/gupc.1: Removed.
+ * upc/gupc.texi: New. Created texi source for man/info
+ generation.
+
+2012-01-31 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 183751 into gupc branch.
+ Incorporates fix for bootstrap failure on openSUSE 12.1.
+
+2012-01-30 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/Make-lang.in: Fix the --program-suffix configuration
+ option. GUPC executables are now installed with appropriate
+ suffixes and GUPC driver execs 'gcc' with the right suffix.
+
+2012-01-24 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/upc-lang.c (upc_init_options): Disable section anchors
+ for UPC language.
+
+2012-01-14 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-genericize.c (upc_genericize_expr): Update input_location
+ while traversing the program tree.
+ (upc_expand_get, upc_expand_put): For profiling, derive
+ the source code location from the incoming 'loc' parameter.
+
+2012-01-10 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 183072 into gupc branch.
+ Incorporates libcpp __BASE_FILE__ fix.
+
+2012-01-09 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-genericize.c (upc_expand_put): Use is_gimple_reg instead of
+ is_gimple_non_addressable.
+
+2012-01-06 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/Make-lang.in: Add appropriate linker flags when linking
+ gupc drivers.
+
+2012-01-06 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc/Make-lang.in: Add appropriate linker flags when linking
+ gupc drivers.
+
+2011-12-31 Gary Funck <gary@intrepid.com>
+
+ Fix gupc driver to avoid segfault when processing
+ invalid use of a switch that expects an argument.
+ * upc/gupc.c (get_libgupc_path): Add check for non-NULL value of
+ libgupc_archive before attempting to access libgupc_archive[0].
+ (main): Do not issue error if lib_dir is NULL. Instead, only
+ process lib_dir if it is non-NULL.
+
+2011-12-31 Gary Funck <gary@intrepid.com>
+
+ Improve -fupc-debug support.
+ * upc/upc-genericize.c (upc_expand_get, upc_expand_put,
+ upc_genericize_sync_stmt): Add check for flag_upc_debug.
+ * upc/upc-pts-struct.c (upc_pts_struct_build_cvt): Ditto.
+ * upc/upc-pts-packed.c (upc_pts_packed_build_cvt): Ditto.
+ * upc/upc-act.c (upc_cpp_builtins): Disable inlining of the
+ runtime if flag_upc_debug is asserted.
+
+2011-12-20 Nenad Vukicevic <nenad@intrepid.com>
+
+ * top-level/Makefile.def (flags_to_pass): Added GUPC
+ defines. Fixes the make error when upc is not specified as one
+ of the languages to build.
+ * top-level/Makefile.in: Re-generate.
+
+2011-11-22 Gary Funck <gary@intrepid.com>
+
+ * DEV-PHASE: "GCC UPC" -> "GNU UPC", and bump minor rev.
+ * dwarf2out.c (gen_compile_unit_die): Check for
+ the "GNU UPC" language string in lieu of "GCC UPC".
+ * config/rs6000/rs6000.c (rs6000_output_function_epilogue): Ditto.
+
+2011-11-22 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_cpp_builtins): Generate new pre-defined
+ macro: __GUPC__.
+
+2011-11-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 181552 into gupc branch.
+ Incorporates libgcc/libunwind fix for IA64.
+
+2011-11-19 Gary Funck <gary@intrepid.com>
+
+ * config/rs6000/rs6000.c (rs6000_output_function_epilogue):
+ Add check for UPC when defining the language type value
+ in a traceback entry.
+
+2011-11-19 Gary Funck <gary@intrepid.com>
+
+ * upc/config-lang.in: Remove checks for supported targets.
+ This is now done at a higher level.
+
+2011-11-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 181493 into gupc branch.
+ Incorporates final fix for PR target/49992.
+
+2011-11-09 Nenad Vukicevic <nenad@intrepid.com>
+
+ * Makefile.in (CRTSTUFF_CFLAGS): Revert the previous
+ change that converted relative include paths into absolute
+ ones, as it does not work with older version of make (3.80).
+
+2011-10-27 Nenad Vukicevic <nenad@intrepid.com>
+
+ Apply patch for Darwin build - PR49992.
+ * top-level/configure.ac: Don't run ranlib with '-c' option for Darwin.
+ * gcc/configure.ac: Ditto.
+ * gcc/ada/mlib-tgt-specific-darwin.adb: Ditto.
+ * gcc/ada/gcc-interface/Makefile.in: Ditto.
+ * top-level/configure: Re-generate.
+ * gcc/configure: Re-generate.
+
+2011-10-26 Gary Funck <gary@intrepid.com>
+
+ Rename "GCC/UPC" to "GNU UPC", "UPC" to "GUPC", and
+ "libupc" to "libgupc".
+ * top-level/configure.ac: Implement support for cross-builds, and
+ adjust for rename of libupc to libgupc.
+ * top-level/Makefile.tpl: Ditto.
+ * top-level/Makefile.def: Ditto.
+ * top-level/configure: Re-generate.
+ * top-level/Makefile.in: Re-generate.
+ * top-level/contrib/gcc_update: Adjust for rename of libupc to libgupc.
+ * doc/tm.texi.in: Adjust for rename of libupc to libgupc.
+ * doc/tm.texi: Re-generate.
+ * tree-pretty-print.c (dump_block_node): Delete unused variable.
+ * gcc.c: Adjust for rename of libupc to libgupc.
+ * testsuite/lib/upc.exp: Adjust for rename of libupc to libgupc.
+ Change "GCC_UNDER_TEST" to "GUPC_UNDER_TEST".
+ Change "xupc" to "xgupc".
+ * configure.ac: Change "GCC UPC" to "GNU UPC".
+ * Makefile.in (CRTSTUFF_CFLAGS): Adjust $(INCLUDES_FOR_TARGET)
+ so that they are absolute paths. This is needed because
+ the upc-crtstuff builds are in the libgupc library build
+ directories which are not at the same level as libgcc.
+ * config/darwin.h: Adjust for rename of libupc to libgupc.
+
+2011-10-26 Gary Funck <gary@intrepid.com>
+
+ Rename "GCC/UPC" to "GNU UPC", "UPC" to "GUPC", and
+ "libupc" to "libgupc".
+ * upc/gupc.c: Rename from upc-cmd.c and adjust for rename
+ of libupc to libgupc.
+ * upc/upc-lang.c (LANG_HOOKS_NAME): Change "GCC UPC" to "GNU UPC".
+ * upc/config-lang.in: Adjust for rename of libupc to libgupc.
+ * upc/gupc.1: Rename from upc.1. Change "GCC UPC" references
+ to "GNU UPC". Adjust for rename of libupc to libgupc.
+ Improve formatting.
+ * upc/gupc-manpage.html: Rename from upc-manpage.html. Re-generate.
+ * upc/Make-lang.in: Change "upc" to "gupc". Change "xupc" to "xgupc".
+ Adjust for rename of libupc to libgupc. Install target symlink from
+ "upc" to "gupc". Install target/version-specific hard links to "gupc".
+
+2011-10-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 180276 into gupc branch.
+ Incorporates fix for PR bootstrap/50709.
+
+2011-10-20 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 180246 into gupc branch.
+
+2011-10-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 180233 into gupc branch.
+ Incorporates fix for PR debug/49310 (var tracking).
+
+2011-10-17 Gary Funck <gary@intrepid.com>
+
+ Fix a regression caused by the previous commit.
+ * upc/upc-genericize.c (upc_genericize_walk):
+ Renamed from: upc_genericize_stmt.
+ (upc_shared_addr): for COMPONENT_REF and INDIRECT_REF
+ re-walk the tree after simplification, by calling
+ upc_genericize_walk().
+ (upc_genericize_array_ref): expand the newly constructed
+ indirect reference by calling upc_genericize_indirect_ref().
+
+2011-10-11 Nenad Vukicevic <nenad@intrepid.com>
+
+ * testsuite/lib/upc-dg.exp: Limit number of torture runs to
+ only four (O0 static/dynamic, O3 static/dynamic).
+ Detect -fupc-threads-0 as an option for dynamic threads
+ compile environment.
+
+2011-10-10 Gary Funck <gary@intrepid.com>
+
+ * tree.c (check_qualified_type, check_aligned_type):
+ Call tree_int_cst_equal() to compare UPC blocking factors
+ if the corresponding tree pointers are not equal.
+ * c-typeck.c (comptypes_internal, c_build_qualified_type_1): Ditto.
+
+2011-10-10 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-genericize.c (upc_simplify_shared_ref): When simplifying
+ the base address always convert to (shared [] char *).
+ This ensures that &a[i].field1 ends up with the required
+ zero block size, for example.
+
+2011-10-07 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add configuration checks for struct/packed builds so we can
+ use upc_struct_pts/upc_packed_pts selectors in the testsuite.
+ * testsuite/lib/target-supports.exp
+ (check_effective_target_upc_struct_pts): New.
+ (check_effective_target_upc_packed_pts): New.
+
+2011-09-15 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add to FLAGS the flags needed to disable inlining of
+ UPC run-time access routines.
+ * testsuite/lib/target-supports.exp
+ (add_options_for_upc_library_calls): New.
+
+2011-09-15 Gary Funck <gary@intrepid.com>
+
+ Fix ICE involving shared bit field accesses.
+ * tree.c (build3_stat): Propagate TEEE_SHARED()
+ and TREE_STRICT() and TREE_RELAXED() flags, if applicable.
+
+2011-09-13 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 178795 into gupc branch.
+ Incorporates fix to PR bootstrap/50010 for x86-32.
+
+2011-09-08 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 178557 into gupc branch.
+
+2011-09-07 Gary Funck <gary@intrepid.com>
+
+ Ensure that UPC pointer-to-shared type alignment is
+ propagated to the final type. Revert to long-standing
+ alignment policy: twice the size of a "C" pointer.
+ * tree.c (build_pointer_type): Propagate the alignment
+ of the UPC pointer-to-shared representation type
+ into the newly built pointer type.
+
+2011-08-30 Gary Funck <gary@intrepid.com>
+
+ * tree.h (check_qualified_type): Change 'const_tree'
+ argument types back to 'tree' to avoid complaints
+ of assignment drops qualifiers for invocations of the
+ newly implemented TYPE_BLOCK_FACTOR() macro, which
+ invokes hash functions with 'tree' pointer values that
+ are not const qualified.
+ * tree.c (check_qualified_type, check_aligned_type): Ditto.
+ * c-typeck.c (comptypes_internal): Ditto.
+
+2011-08-29 Gary Funck <gary@intrepid.com>
+
+ Fixes for regressions noted running "make check"
+ versus GCC trunk.
+ * fold-const.c (fold_unary_loc): Execute UPC-specific
+ checks for a cast-of-a-cast, only if one of the
+ operands is a UPC pointer-to-shared value.
+ * opts.c (print_specific_help): Fix a comparison
+ in an assert that checks that there are enough
+ bits reserved for the number of languages defined
+ in the .opt files.
+
+2011-08-29 Gary Funck <gary@intrepid.com>
+
+ Implement a hash table to record UPC block factors.
+ * c-family/stub-upc.c (upc_block_factor_insert,
+ upc_block_factor_lookup): New dummy stub procedures.
+ * c-family/c-common.c (c_sizeof_or_alignof_type):
+ Rename UPC_TYPE_HAS_THREADS_FACTOR() to TYPE_HAS_THREADS_FACTOR().
+ * tree.c (copy_node_stat): call SET_TYPE_BLOCK_FACTOR()
+ to copy (hashed) UPC blocking factor.
+ (set_type_quals): Likewise.
+ * tree.h: Rename UPC_TYPE_HAS_THREADS_FACTOR() to
+ TYPE_HAS_THREADS_FACTOR().
+ (type_common.block_factor): Delete.
+ (TYPE_HAS_BLOCK_FACTOR_0, TYPE_HAS_BLOCK_FACTOR_X,
+ TYPE_HAS_BLOCK_FACTOR, SET_TYPE_BLOCK_FACTOR): New.
+ (TYPE_BLOCK_FACTOR): Re-implement, using hash table for
+ UPC blocking factors greater than one.
+ * dwarf2out.c (modified_type_die): Re-implement
+ logic that records UPC blocking factor in the generated
+ DWARF2 debugging information.
+ (add_subscript_info): Rename UPC_TYPE_HAS_THREADS_FACTOR() to
+ TYPE_HAS_THREADS_FACTOR().
+ * c-decl.c (finish_decl, grokdeclarator):
+ Rename UPC_TYPE_HAS_THREADS_FACTOR() to TYPE_HAS_THREADS_FACTOR().
+ * print-tree.c (print_node): Check for TYPE_LANG_FLAG_* flags
+ used by UPC, and print UPC-specific information.
+
+2011-08-28 Gary Funck <gary@intrepid.com>
+
+ Re-work the type machinery to fully support and to unify support
+ for the UPC layout qualifier (blocking factor).
+ * c-family/stub-upc.c (upc_set_block_factor): Delete.
+ (upc_grok_layout_qualifier): rename from upc_apply_layout_qualifier()
+ and update prototype.
+ * c-family/c-common.c (complete_array_type): call newly
+ defined c_build_qualified_type_1() instead of
+ upc_set_block_factor().
+ * c-family/c-upc.h (pc_grok_layout_qualifier): rename from
+ upc_apply_layout_qualifier() and update prototype.
+ (upc_set_block_factor): Delete prototype.
+ * c-family/c-common.h (c_build_qualified_type): redefine
+ as a pre-processor macro that invokes c_build_qualified_type_1()
+ with a null UPC layout qualifier.
+ (c_build_qualified_type_1): New. Add layout qualifier argument
+ to old c_build_qualified_type() prototype.
+ * tree.c (set_type_quals, check_qualified_type):
+ Add layout qualifier as argument.
+ (check_aligned_type): Add check for UPC block factor equality.
+ (get_qualified_type_1): Rename from get_qualified_type() and
+ add layout qualifier as argument.
+ (build_qualified_type_1): Rename from build_qualified_type() and
+ add layout qualifier as argument.
+ * tree.h (check_qualified_type): Add layout qualifier as argument
+ to the prototype.
+ (get_qualified_type): Re-define as a as a pre-processor macro
+ that invokes get_qualified_type_1() with a null
+ UPC layout qualifier.
+ (get_qualified_type_1): Rename from get_qualified_type() and
+ add layout qualifier as argument.
+ * cp/tree.c (c_build_qualified_type_1): Rename from
+ c_build_qualified_type() and add (unused) layout qualifier
+ argument.
+ * c-decl.c (finish_decl): re-format long error messages.
+ (grokdeclarator): Re-work the logic so that it calls
+ upc_grok_layout_qualifier() to handle the UPC layout
+ qualifier, if present.
+ * c-typeck.c (qualify_type, common_pointer_type,
+ build_component_ref): Re-work the logic so that it calls
+ upc_grok_layout_qualifier() to handle the UPC layout qualifier,
+ if present.
+ (c_build_qualified_type_1): Rename from c_build_qualified_type()
+ and add layout qualifier argument.
+ * print_tree.c (print_node): Re-format a long line.
+
+2011-08-26 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 177949 into gupc branch.
+ * c-family/c-common.h (enum rid): Bump the number of type modifiers
+ in the comment.
+ * ../libcpp/init.c (struct lang_flags): Adjust the entry for UPC
+ to add new rliterals column value.
+
+2011-08-26 Gary Funck <gary@intrepid.com>
+
+ * convert.c (convert_to_integer): Fix the check for the
+ difference between two UPC pointers-to-shared values.
+
+2011-08-23 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Fix the name for --with-upc-pts-packed-bits
+ option. Support --with-upc-packed-bits as deprecated. Fix the code to
+ correctly check packed bits.
+ * configure: Re-generate.
+
+2011-08-16 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c (c_parser_upc_sync_statement): issue error diagnostic if
+ the barrier id expression is not an integer expression.
+
+2011-08-12 Gary Funck <gary@intrepid.com>
+
+ * config/i386/i386.h (MAX_FIXED_MODE_SIZE): Delete
+ (revert to trunk).
+ * upc/upc-pts-struct.c (upc_pts_struct_init_type):
+ Set mode of UPC pointer-to-shared rep. to an
+ integral mode of size at least as large as the
+ size of the representation's struct type.
+
+2011-08-12 Gary Funck <gary@intrepid.com>
+
+ Rework/simplify the UPC genericize pass.
+ * c-family/stub-upc.c (upc_apply_layout_qualifier,
+ upc_build_pointer_type): New.
+ (upc_set_block_factor): Adjust to new calling sequence.
+ (upc_build_shared_var_addr): Delete.
+ * c-family/c-common.c (complete_array_type): Adjust call
+ to upc_set_block_factor().
+ * c-family/c-upc.h (upc_apply_layout_qualifier,
+ upc_build_pointer_type): New.
+ (upc_build_shared_var_addr): Delete.
+ (upc_set_block_factor): Adjust to new calling sequence.
+ * tree.h (TI_UPC_CHAR_PTS_TYPE, upc_char_pts_type_node): New.
+ * c-decl.c (grokdeclarator): Call newly defined
+ upc_apply_layout_qualifier() instead of upc_set_block_factor().
+ * c-decl.c (grokdeclarator): Split long UPC-related error
+ messages into two lines.
+ * c-typeck.c (build_unary_op): Do not call upc_build_shared_var_addr()
+ directly. Revert that change to trunk. (upc_genericize() will
+ handle lowering the expressions that take the address of a
+ UPC variable).
+ * config/i386/i386.c (ix86_promote_function_mode): For UPC
+ pointers-to-shared, return the type mode of the UPC pointer-to-shared
+ representation type.
+
+2011-08-10 Gary Funck <gary@intrepid.com>
+
+ Implement additional fixes for recent merge with trunk.
+ * explow.c (promote_mode): Do not attempt to promote
+ the mode for UPC pointer-to-shared types.
+ * config/i386/i386.c (function_value_64): Ditto.
+
+2011-08-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 177548 into gupc branch.
+ * config/i386/i386.c (ix86_promote_function_mode):
+ Do not promote UPC pointers-to-shared to Pmode.
+ * c-family/c-common.c (pointer_int_sum):
+ Also check the pointer operand, rather than just
+ its type, when making the decision to derive
+ the equivalent unshared type.
+ * tree.c (build2_stat): If the type of the result
+ passed in as an argument is a UPC shared type,
+ derive the unshared equivalent when calculating
+ the result type of the node.
+
+2011-07-15 Nenad Vukicevic <nenad@intrepid.com>
+
+ * config/darwin.c: Disable var_tracking option
+ on -O0 as it is supposed to run only when optimization
+ is applied. See GCC bug 49743.
+
+2011-07-06 Gary Funck <gary@intrepid.com>
+
+ Re-implement the pass that lowers trees generated by
+ the UPC front-end into GENERIC. Previously this was
+ done within the gimplification framework, but this
+ required that gimplification be run before inlining
+ and various other passes, which did not fit in well
+ with the current design of the middle-end passes.
+ Now, the lowering is done by a newly defined language
+ specific genericize hook. With this change, we are
+ are able to undo some extensions made to the gimplify
+ logic, and thus can revert several files to trunk.
+ * c-decl.c: Add a check for UPC deprecated names which
+ may appear as undefined function names.
+ * libfuncs.h (LTI_upc_barrier, LTI_upc_notify, LTI_upc_wait,
+ LTI_upc_getaddr): Remove definitions of unused UPC
+ library function names. These were defined back when
+ the libfunc interface was used to call these routines.
+ * timevar.def (TV_TREE_UPC_GENERICIZE): New. Track time spent
+ in UPC lowering (genericize) pass.
+ * langhooks.h (gimplify_expr): Revert to trunk's definition.
+ (instrument_func): Delete this hook. Now handled in
+ upc_genericize().
+ * tree-pass.h: Revert to trunk.
+ * c-typeck.c (build_unary_op): Adjust reference to
+ upc_genericize() in a comment.
+ * gimplify.c (create_tmp_var_raw): Delete logic that
+ was converting UPC shared types into unshared types
+ to be used for temporaries. Now handled in upc_genericize().
+ Replace with an assertion check.
+ (prepare_gimple_addressable): Revert to trunk's definition.
+ No longer needed as an externally called function.
+ (flag_instrument_functions_exclude_p): Re-define as
+ an externally called function.
+ (gimplify_function_tree): Delete code that implemented
+ call to UPC's language specific function instrumentation hook.
+ * gimple.h (flag_instrument_functions_exclude_p): Define as extern.
+ (prepare_gimple_addressable): Delete extern definition;
+ revert to trunk's definition.
+ * lnaghooks-def.h (lhd_gimplify_expr): Revert to trunk's definition.
+ (LANG_HOOKS_INSTRUMENT_FUNC): Remove, no longer needed for UPC.
+ * c-family/c-gimplify.c: Revert to trunk.
+ * cp/cp-gimplify.c: Revert to trunk.
+ * cp/cp-tree.h: Revert to trunk.
+ * explow.c: Revert to trunk.
+ * langhooks.c: Revert to trunk.
+ * libfuncs.h: Revert to trunk.
+ * objc/objc-act.c: Revert to trunk.
+
+2011-06-30 Gary Funck <gary@intrepid.com>
+
+ * c-family/c.opt: Bring options definitions up-to-date
+ with respect to changes made in the trunk.
+
+2011-06-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 175584 into gupc branch.
+
+2011-06-13 Gary Funck <gary@intrepid.com>
+
+ libcpp/
+ * include/cpplib.h (enum c_lang):
+ Move the entry for CLK_UPC so that it follows CLK_STDC1X.
+ This keeps all the "C" variants together.
+ * init.c (lang_defaults): Add an entry for UPC.
+
+2011-06-09 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c (upc_localsizeof_type): Fix an ICE when compiling for
+ a 32-bit target, the size expression overflowed, the result was
+ error_mark_node, and an ICE was triggered on an attempt to evaluate
+ C_TYPE_VARIABLE_SIZE() on the error node.
+ (upc_blocksizeof_expr, upc_blocksizeof_type,
+ upc_elemsizeof_expr, upc_elemsizeof_type, upc_localsizeof_expr):
+ Make similar changes to avoid further processing of error_mark_node.
+
+2011-06-07 Gary Funck <gary@intrepid.com>
+
+ * sel-sched.c (move_op): Incorporate the following
+ patch to eliminate ICE at -O3 on IA64/Altix.
+
+2011-06-07 Alexander Monakov <amonakov@ispras.ru>
+
+ * sel-sched.c (move_op): Use correct type for 'res'. Verify that
+ code_motion_path_driver returned 0 or 1.
+ (sel_region_finish): Clear h_d_i_d.
+
+2011-06-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 174558 into gupc branch.
+
+2011-05-30 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Make the default order of the virtual
+ address field in a UPC pointer-to-shared to be "first".
+ This reverts to the previous setting, and is a short term
+ measure to work around a bug found on the IA64,
+ where vaddr=last led to incorrect code generation.
+ Rename UPC_PTS_VADDR_FIRST to HAVE_UPC_PTS_VADDR_FIRST
+ in AC_DEFINE(), to agree with recent changes in files
+ that reference this define.
+ configure, config.in: Regenerate.
+
+2011-05-26 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Fix typo when referring to $upc_vaddr_order.
+ configure: Regenerate.
+ * ../fixincludes/fixincl.x: Revert to trunk.
+ This file is auto-generated, and should not be merged.
+
+2011-05-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 173845 into gupc branch.
+
+2011-05-17 Gary Funck <gary@intrepid.com>
+
+ * c-family/stub-upc.c (upc_rts_forall_depth_var): New.
+ c-family/c-upc.h (upc_rts_forall_depth_var): Define.
+ * c-family/c-pragma.c: Remove conditional compilation
+ with HANDLE_PRAGMA_UPC and HANDLE_PRAGMA_PUPC.
+ Test 'compiling_upc' when compiling to determine if
+ the "upc" and "pupc" pragmas should be registered.
+ * defaults.h (UPC_SHARED_SECTION_NAME, UPC_SHARED_BEGIN_NAME,
+ UPC_SHARED_END_NAME, UPC_PGM_INFO_SECTION_NAME,
+ UPC_PGM_INFO_BEGIN_NAME, UPC_PGM_INFO_END_NAME,
+ UPC_INIT_SECTION_NAME, UPC_INIT_BEGIN_NAME,
+ UPC_INIT_END_NAME, UPC_INIT_ARRAY_SECTION_NAME,
+ UPC_INIT_ARRAY_BEGIN_NAME, UPC_INIT_ARRAY_END_NAME): New.
+ Move these target-dependent definitions from config/upc-conf.h
+ to here.
+ * configure.ac: Improve the logic for UPC-related options.
+ Delete references to pre-processor definitions that have
+ been moved to "upc/upc-pts.h".
+ * configure, config.in: Regenerate.
+ * Makefile.in (UPC_PTS_REP): Remove definition and revert
+ to trunk. This substitution variable was used to
+ configure the representation-specific versions of
+ the tree rewrites that operate on UPC pointer-to-shared
+ types and objects.
+ * c-parser.c (c_parser_upc_forall_statement): Remove
+ reference to UPC_FORALL_DEPTH_NAME, and call
+ newly defined upc_rts_forall_depth_var() instead.
+ * config/upc-config.h: Delete. Various definitions
+ moved to "upc/upc-rts-names.h", "defaults.h", and
+ "upc/upc-pts.h".
+ * doc/tm.texi.in (HAVE_UPC_PTS_VADDR_FIRST,
+ HAVE_UPC_PTS_PACKED_REP, HAVE_UPC_PTS_STRUCT_REP,
+ UPC_SHARED_SECTION_NAME, UPC_SHARED_BEGIN_NAME,
+ UPC_SHARED_END_NAME, UPC_PGM_INFO_SECTION_NAME,
+ UPC_PGM_INFO_BEGIN_NAME, UPC_PGM_INFO_END_NAME,
+ UPC_INIT_SECTION_NAME, UPC_INIT_BEGIN_NAME,
+ UPC_INIT_END_NAME, UPC_INIT_ARRAY_SECTION_NAME,
+ UPC_INIT_ARRAY_BEGIN_NAME, UPC_INIT_ARRAY_END_NAME):
+ New. Document UPC target macros.
+ doc/tm.texi: Regenerate.
+
+2011-05-07 Gary Funck <gary@intrepid.com>
+
+ * ../configure.ac: Disable build of libupc
+ on non POSIX hosted systems. Use AS_HELP_STRING
+ to define messages. Remove 'word-pair' as a
+ possible --with-upc-pts UPC pointer-to-shared
+ representation.
+ * ../configure: Regenerate.
+ * configure.ac: Use AS_HELP_STRING to define messages.
+ Remove 'word-pair' as a possible --with-upc-pts
+ UPC pointer-to-shared representation.
+ (UPC_MAX_THREADS): Limit the maximum value to 2^31-1.
+ (UPC_MAX_BLOCK_SIZE): Correct the default value.
+ * configure: Regenerate.
+ * config.in: Regenerate. Delete UPC_PTS_WORD_PAIR_REP
+ definition.
+ * ChangeLog.upc: Fix some typos.
+
+2011-05-07 Gary Funck <gary@intrepid.com>
+
+ * ../maintainer-scripts/gcc_release: Add "upc"
+ as one of the released languages.
+
+2011-05-06 Gary Funck <gary@intrepid.com>
+
+ Eliminate compilation warnings, by fixing
+ #include's and updating function prototypes.
+ * c-family/c-cppbuiltin.c: Include c-upc.h.
+ * optabs.c (gen_libfunc): Change type of 'suffix'
+ parameter to conform with prototype.
+ * cp/cp-gimplify.c (cp_gimplify_expr): Add extra parameters
+ ('gimple_test_f' and 'fallback') used by extended gimplify_expr
+ hook used by UPC.
+ * cp/cp-tree.h (cp_gimplify_expr): Add extra parameters to
+ the prototype.
+ * objc/objc-act.c (objc_gimplify_expr): Pass extra dummy
+ argument values to cp_gimplify_expr.
+ * config.in (HAVE_UPC_AFFINITY_SUPPORT,
+ HAVE_UPC_NUMA_SUPPORT): Regenerate. Remove
+ pre-processor definitions that are no longer
+ needed to build the 'upc' command (upc-cmd.c)
+ because the linker specs. defined in libupc
+ take care of linking in the needed libraries.
+ * c-parser.c (c_parser_upc_forall_statement):
+ initialize affinity_loc to avoid "maybe unused" warning.
+ (c_parser_upc_sync_statement): Remove un-needed
+ 'ret' variable. Cast return value from
+ 'upc_build_sync_stmt' to 'void' to avoid
+ compile-time warning.
+ * config/upc-conf.h (UPC_MAX_THREADS): Define as an
+ integer constant, not a string. Range is restricted
+ to maximum positive 32-bit integer (2+ billion) to
+ fit in with the use of 'int' in the front-end's
+ switch handling logic.
+
+2011-05-06 Gary Funck <gary@intrepid.com>
+
+ Upgrade c-family source files to conform with modularity
+ improvements. Mainly, remove #include of c-tree.h in files
+ under c-family, and define a new UPC-specific #include file,
+ c-upc.h, and use it.
+ * c-family/stub-upc.c: Remove #include of c-tree.h and
+ upc/upc-act.h. Replace with #include of c-common.h
+ and c-upc.h.
+ (upc_get_unshared_type, upc_pts_cvt_op_p, upc_blocksizeof_expr,
+ upc_blocksizeof_type, upc_elemsizeof_expr, upc_elemsizeof_type,
+ upc_localsizeof_expr, upc_localsizeof_type,
+ upc_shared_type_p): Delete.
+ * c-family/c-opts.c: Add #include of c-upc.h
+ * c-family/c-common.c: Remove #include of c-tree.h and
+ add #include of c-upc.h.
+ * c-family/c-upc.h: New. Define API for UPC-specific functions
+ (mostly implemented in upc/upc-act.c).
+ * c-family/c-common.h (upc_cpp_builtins,
+ upc_write_global_declarations): Remove extern definitions.
+ * c-family/c-pragma.c: Remove #include of c-tree.h.
+ Add #include of c-upc.h.
+ * tree.h (UPC_TYPE_HAS_THREADS_FACTOR): New. Move from
+ c-tree.h.
+ (upc_shared_type_p, upc_pts_cvt_op_p): New. Move from
+ upc/upc-act.c, and define as a macro.
+ (expand_affinity_test): Remove unused external definition.
+ (build_upc_unshared_type): Add external definition.
+ (upc_shared_type_p): Remove external definition.
+ * c-config-lang.in: Update gtfiles to refer to c-family/c-upc.h.
+ * dojump.c: Remove #include of c-tree.h.
+ * c-tree.h: Remove definition of UPC_TYPE_HAS_THREADS_FACTOR
+ and move to tree.h.
+ (count_upc_threads_refs, is_multiple_of_upc_threads,
+ set_upc_threads_refs_to_one, c_expr, upc_affinity_test,
+ upc_build_shared_var_addr, upc_build_sync_stmt,
+ upc_check_decl_init, upc_check_decl, upc_decl_init, c_expr,
+ upc_get_block_factor, upc_instrument_forall, upc_is_null_pts_p,
+ c_expr, upc_num_threads, upc_diagnose_deprecated_stmt,
+ upc_pts_cvt_op_p, upc_pts_diff, upc_pts_increment,
+ upc_pts_int_sum, upc_set_block_factor, upc_set_decl_section,
+ permit_pragma_upc, deny_pragma_upc, pragma_upc_permitted_p,
+ set_upc_consistency_mode, get_upc_consistency_mode,
+ push_upc_consistency_mode, pop_upc_consistency_mode,
+ get_upc_pupc_mode):
+ Move external definitions to c-family/c-upc.h.
+ (upc_blocksizeof_type, upc_localsizeof_type,
+ upc_elemsizeof_type): Remove external definitions;
+ these functions were moved to c-parser.c.
+ * c-decl.c: Add #include of c-upc.h.
+ * c-typeck.c: Add #include of c-upc.h.
+ * c-convert.c: Add #include of c-upc.h.
+ * ChangeLog.upc: Fix typo.
+ * Makefile.in: Add references to c-family/c-upc.h, everywhere
+ there is a reference to c-family/c-objc.h.
+ Remove extraneous reference to upc-act.h.
+ * c-parser.c: Add #include of c-upc.h.
+ (upc_blocksizeof_expr, upc_blocksizeof_type,
+ upc_elemsizeof_expr, upc_elemsizeof_type,
+ upc_localsizeof_expr, upc_localsizeof_type):
+ Move from upc/upc-act.c.
+ * tree.c (build_upc_unshared_type): New.
+ Move upc_get_unshared_type from upc/upc-act.c and rename
+ to build_upc_unshared_type.
+ c-family/c-common.c (pointer_int_sum): refer to renamed
+ build_upc_unshared_type function.
+ c-convert.c (convert): Ditto.
+ convert.c (convert_to_pointer): Ditto.
+ c-typeck.c (build_unary_op, build_modify_expr,
+ really_start_incremental_init): Ditto.
+ gimplify.c (create_tmp_var_raw): Ditto.
+ tree.c (build1_stat): Ditto.
+ tree.h (upc_get_unshared_type): Rename to
+ build_upc_unshared_type.
+
+2011-05-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 173471 into gupc branch.
+
+2011-05-05 Gary Funck <gary@intrepid.com>
+
+ Make changes that bring the GUPC branch more closely in sync.
+ with the GCC trunk. Revert any fixes that are not UPC-specific.
+ Remove gratuitous re-formatting.
+ * ../libstdc++-v3/config/os/bionic/ctype_noninline.h: Delete.
+ This file should have been removed in a previous merge
+ with the trunk.
+ * ../configure.ac: Remove Cray Catamount/CNL support.
+ * ../configure: Regenerate.
+ * ../config.sub: Remove Cray Catamount/CNL support.
+ * config.gcc: Remove Cray Catamount/CNL support.
+ * ../maintainer-scripts/gcc_release: Revert to trunk.
+ * c-family/c-common.h: Define parse_optimize_options. Its definition
+ was missed in a previous merge with the trunk.
+ * dwarf2out.c: Revert a fix which removed the 'type_main_variant'
+ procedure.
+ * dwarf2out.c: Revert a fix that added a check for VECTOR_TYPE
+ in addition to ARRAY_TYPE.
+ * c-typeck.c: Remove an extra newline character.
+ * varasm.c: Revert a fix that improved an error message
+ when TLS common data is unimplemented.
+ * varasm.c: Revert a gcc_assert that had been added which
+ checked for a null DECL_SIZE_UNIT field.
+ * emultls.c: Revert to trunk. Remove possible fix.
+ * Makefile.in: Revert extra blank line that is present
+ in the trunk version.
+ * Makefile.in: Revert a fix that handled long shell
+ argument lists for plugin headers.
+ * config/ia64/ia64.opt: Revert an option setting
+ that increased the default TLS address range.
+ * config/ia64/crtbegin.asm: Revert to trunk.
+ Removes an extra newline character.
+ * ChangeLog.upc: Spell check.
+
+2011-05-03 Gary Funck <gary@intrepid.com>
+
+ * c-family/c-common.c: Remove extraneous FIXME/TODO comments.
+ (c_apply_type_quals_to_decl): Ditto.
+ * c-family/c-common.h: Ditto.
+ * dojump.c: Ditto.
+ * c-decl.c (merge_decls): Ditto.
+ * c-typeck.c (qualify_type, default_conversion,
+ build_component_ref, build_unary_op,
+ c_build_qualified_type): Ditto.
+ * gimplify.c (create_tmp_var_raw): Remove UPC-specific dead code.
+
+2011-04-29 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (finish_decl): Improve error diagnostics.
+ (grokdeclarator): Ditto.
+ * c-typeck.c (build_c_cast): Improve error diagnostics.
+ (convert_for_assignment): Ditto.
+ (build_binary_op): Ditto.
+ * c-parser.c (c_parser_upc_forall_statement):
+ Improve error diagnostics.
+ * convert.c (convert_to_integer): Improve error diagnostics.
+
+2011-04-24 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c (c_parser_upc_sync_statement): Fix ICE that
+ occurred if there is an error in the barrier id
+ expression. Map error_mark_node into NULL.
+
+2011-04-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 172873 into gupc branch.
+
+2011-04-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 172359 into gupc branch.
+
+2011-04-14 Gary Funck <gary@intrepid.com>
+
+ * c-family/c.opt: Add UPC as a valid language for various
+ switches where it is valid for "C", that were not updated
+ in previous merges with trunk.
+
+2011-04-13 Gary Funck <gary@intrepid.com>
+
+ * c-family/c.opt (fupc-pre-include): New option definition.
+ * gcc.c (upc_options): Do not add "-include gcc-upc.h" if
+ -fno-upc-pre-include is asserted.
+
+2011-04-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 172158 into gupc branch.
+ to bring in the following fix.
+
+2011-04-05 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR bootstrap/48403
+ * haifa-sched.c (schedule_block): Increment cycle_issued_insns only
+ if old and new states differ.
+
+2011-04-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 171966 into gupc branch.
+
+2011-04-01 Gary Funck <gary@intrepid.com>
+
+ * tree.h (tree_base): Move UPC flag bits into bit fields
+ located just before spare bits. Decrement spare bits.
+ Rename 'shared_flag' -> 'upc_shared_flag',
+ 'relaxed_flag' -> 'upc_relaxed_flag',
+ 'strict_flag' -> 'upc_strict_flag, and adjust macros
+ that reference them accordingly.
+
+2011-04-01 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (grokdeclarator): Fix formatting of
+ code that sets UPC block size on scalars.
+
+2011-04-01 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (grokdeclarator): Revert use of white space
+ to match the trunk (to rationalize diffs).
+ * c-typeck.c (convert_for_assignment): Ditto.
+ * tree-ssa.c (useless_type_conversion_p): Ditto.
+
+2011-03-23 Gary Funck <gary@intrepid.com>
+
+ * DEV-PHASE: bump to 4.7.0-1 to reflect recent creation of
+ the GCC 4.6 release branch.
+
+2011-03-21 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 171202 into gupc branch.
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ * varasm.c: Call error() directly with a format specifier,
+ rather than using sprintf() to format the message.
+ This should make it easier to internationalize UPC's error messages.
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Fix the check for gnu ld when enabling
+ UPC link script support.
+ configure: Regenerate (also picks up changes from previous
+ merge with trunk).
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ Move UPC start files, end files, and linker specs.
+ into libupc. This reduces the impact on common GCC
+ configuration files, and ensures that these UPC-specific
+ components are only built when the UPC language dialect is selected.
+ * c-family/c.opt: Add -fupc-link switch, used to select UPC-specific
+ linker specs. Fix typo in -fupc-debug message.
+ * config/upc-conf.h, config/darwin.h: Move defines for
+ UPC-related section begins/ends into libupc/config/default/
+ upc-crt-config.h.
+ * config/darwin.h(LINK_COMMAND_SPEC_A): Add call outs to
+ UPC-related linker compiler specifications,
+ accessed via %:include().
+ * configure.ac, configure: Remove logic related to building
+ upc-crtbegin/end. Remove config. tests for numa and cpu
+ affinity (previously used by the 'upc' driver); these
+ settings are now propagated by target-specific compiler
+ specs. built by libupc. Regenerate autoconf.
+ * gcc.c (LINK_COMMAND_SPEC): Add call outs to UPC-related
+ linker compiler specifications, accessed via %:include().
+ Define 'upc_crtbegin_spec', 'upc_crtend_spec', and
+ 'link_upc_spec'.
+ * Makefile.in: Remove definition of UPC_CRTSTUFF_CFLAGS.
+ * config/linux.h, config/i386/darwin.h, config/i386/linux64.h,
+ config/i386/linux.h, config/i386/t-darwin, config/i386/t-darwin64,
+ config/ia64/linux.h, config/mips/t-iris,
+ config/mips/iris6.h: Revert to trunk version 167307.
+ libgcc/
+ * configure, configure.ac, config.host, Makefile.in:
+ Revert to trunk version 167307.
+
+2011-02-23 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (undeclared_variable): fix typo. Inadvertently
+ removed negation on following 'if'.
+
+2011-02-22 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (undeclared_variable): call upc_diagnose_deprecated_stmt
+ to check for the usage of certain deprecated UPC keywords.
+ * c-family/stub-upc.c (upc_diagnose_deprecated_stmt): New.
+ * c-tree.h (undeclared_variable): Define prototype.
+
+2011-02-12 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: (build_c_cast, convert_for_assignment)
+ Diagnose an attempt to convert from an integer to
+ a pointer-to-shared as an error. Also, fix various
+ error messages so that they use the preferred term
+ pointer-to-shared instead of "shared pointer".
+
+2011-02-07 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: (convert_for_assignment)
+ Fix typo. in error message.
+
+2011-01-23 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: (c_build_qualified_type)
+ derive UPC block size by calling upc_get_block_size(),
+ to ensure that the element type of an array of an array
+ is derived correctly.
+
+2010-12-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 168314 into gupc branch.
+
+2010-12-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 167307 into gupc branch.
+
+2010-10-19 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: Fix typo in previous fix
+ which led to a mis-compare for equal block sizes.
+
+2010-10-18 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: Fix bug: Cast of (shared <type> * shared) not
+ diagnosed as an error
+ The conversion from any type (shared or not) to
+ a shared type is likely either meaningless or an error. This update
+ makes any conversion to a shared type, an error.
+
+2010-10-18 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: Fix bug: passing int to shared pointer arg.
+ generates spurious warning
+ Add a #define procedure that does the same thing as
+ WARN_FOR_ASSIGNMENT but issues an error diagnostic instead. Use
+ this procedure to diagnose passing an integer value to a
+ pointer-to-shared as an error.
+
+2010-10-18 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: Fix bug: shared [] in prototype silently ignored when
+ matching routine declaration.
+ When checking for type compatibility, shared qualified types must
+ have the same block factor. This check was missing from
+ comptypes_internal(). This update adds the check for blocking
+ factor equality.
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * dwarf2out.c: Fix GCC Bug 45870 - note: non-delegitimized UNSPEC 5
+ found (-O1 -g)
+ See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45870#c6
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * tree-cfg.c: Implement the fix for GCC Bugzilla Bug
+ 45869 - [4.5/4.6 Regression] type mismatch in shift expression
+ produces ice with -O3 and -m32.
+ See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45869
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * c-common.c: Diagnose the application of the various "*sizeof"
+ operations on generic pointer-to-shared as a compilation error.
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix a segfault/ICE that occurred when printing an error
+ message regarding a function parameter being declared with a shared
+ qualifier.
+ The parameter's 'name' value is not defined at this point, and
+ cannot be used in the error message. This update removes the
+ reference to 'name', and eliminates the segfault.
+
+2010-10-16 Gary Funck <gary@intrepid.com>
+
+ * Makefile.in: Implement fixes for SGI/IRIX/MIPS port.
+ The gcc/Makefile.in rules for install-plugin had to be re-written to
+ break up a long list of header files that exceeded the command line
+ limitation imposed by Irix.
+ Access functions for TFmode types had to be implemented.
+ Apparently, this is the mode used for the SGI/MIPS port to represent
+ "long float".
+
+2010-10-14 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix bug: Multiple equal blocking factors specified
+ via typedef chain should not be diagnosed as an error.
+ If the block size that is given by the typedef is equal to the block
+ size given explicitly in the variable declaration, then do not
+ complain. The easiest way to make this check was to create a
+ temporary type that is a clone of the element type and then set its
+ block size using the given layout qualifier. Then compare the block
+ size of the temporary (the declaration) to the block size specified
+ in the typedef. This complexity is needed, because the '[*]' block
+ size needs to be calculated, and the '[]' needs to be mapped into a
+ zero block size.
+
+2010-10-10 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix bug: ICE: two or more layout qualifiers
+ specified
+ The compiler properly detected the presence of two or more layout
+ qualifiers as an error, but then hit an assertion check, because the
+ code that followed the error expected to see a qualifier and not a
+ layout specifier. The fix is simple: just return immediately after
+ detecting the error.
+
+2010-10-10 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Improve error diagnostics for various cases of UPC
+ shared array type declarations.
+ Add the check for this error: "In the dynamic translation
+ environment, THREADS may not appear in declarations of shared arrays
+ with indefinite block size". Also, fix up a few of the other
+ related error diagnostics.
+
+2010-10-09 Gary Funck <gary@intrepid.com>
+
+ * c-common.c: Fix bug: segfault on incomplete array definition.
+ This turned out to be a bit complicated. The logic in
+ upc_lang_layout_decl had to be re-arranged to avoid trying to lookup
+ the THREADS identifier in the case where the blocking factor has
+ been set to indefinite ([]). This can happen when indefinite array
+ declarations are processed for shared arrays. At that time, the
+ file scope has been closed and THREADS is no longer in scope. Some
+ more work is needed on upc_lang_layout_decl(). It has some
+ duplication, and notably duplicates the two branches of the if
+ having to do with TYPE_SIZE and TYPE_SIZE_UNIT, that appear in the
+ caller of this routine (layout_decl()).
+ The method of forcing a layout qualifier of [] in the indefinite
+ declaration handler is odd a well. The code that just does the
+ setting of the block factor, needs to moved into its own routine
+ that doesn't depend upon a declspec for '[]' to be passed in, just
+ in order to set the blocking factor to some value (in this case, 0).
+ Also, the logic for how that shared type is constructed is strange.
+ First the type with 0 blocking factor is set. Then the shared
+ qualifier is removed from the type, and then added back later. The
+ intermediate type has a blocking factor set, but it has no shared
+ qualifier. Fixing this will require some thought. It is tempting
+ just to make indefinite shared arrays an error, rather than forcing
+ the dimension to be '1'.
+ This likely fixes a serious error in the previous update to
+ upc_lang_layout_decl(), where it didn't have the logic to set
+ TYPE_SIZE_UNIT() in the main part of the 'if' statement. This means
+ the previous update would fail on many tests.
+
+2010-10-09 Gary Funck <gary@intrepid.com>
+
+ * varasm.c: Add an assertion check for the case that DECL_SIZE_UNIT
+ (decl) is null, which can happen if some layout error occurred
+ upstream.
+
+2010-10-09 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix bug: file scope shared arrays mis-diagnosed as
+ "variable-sized" when compiled in dynamic threads.
+ This long-standing bug is easily fixed. Just check
+ for the situation that the non-constant sized type is shared and
+ that it does not have a dimension that references a multiple of
+ threads. If this criteria is met, then issue a meaningful
+ diagnostic.
+
+2010-10-01 Gary Funck <gary@intrepid.com>
+
+ * configure, configure.ac: Update manual page, and bug reporting
+ URL. Update "man" page to reflect debugging switches.
+ Also, some general clean up. Change the bug reporting
+ URL to point to gccupc.org.
+
+2010-09-27 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c, config/upc-conf.h: Issue a descriptive message when
+ the UPC forall depth count variable is not found.
+ The __upc_forall_depth variable should be defined in gcc-upc-lib.h.
+ The compiler will generate code that references this variable in
+ order to implement nested upc_forall semantics. If there is a
+ compiler build or install problem, this variable may not be found.
+ In this case, terminate with an internal_error().
+
+2010-09-26 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c: Fix Bug 240: upc_forall with empty clauses
+ mis-diagnosed as syntax error.
+ Fix a failure exhibited by the Berkeley test case,
+ bug873a.upc, which has the code:
+ double d;
+ upc_forall (;;;d) {...} The compiler did not properly handle
+ the empty "condition" clause, and did not recover well when it was
+ determined that the use of a double value, "d" above, was neither a
+ pointer-to-shared nor an integer expression. The update implements a
+ fix for both issues.
+ See also: gcc/c-parser.c gcc/upc/upc-act.c
+
+2010-09-23 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix Bug 29: Layout qualifier within a typedef is not
+ incorporated into the referencing type.
+ This was semi-fixed a few times before. This update fixes a few
+ more places where the layout qualifier wasn't being propagated
+ through typedef's properly. What made this a bit tricky is shown in
+ the example cited in the bug report:
+ typedef shared [5] int A_t; A_t A[5*THREADS];
+ In the typedef, the blocksize is being applied to a shared *scalar*,
+ and the code was applying the blocksize only to arrays. This update
+ handles shared scalars correctly.
+
+2010-09-22 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c, c-tree.h, stub-upc.c: Fix Bug 403: Nested
+ upc_forall() semantics are not implemented
+ The checkforall test in the Berkeley harness test suite indicated
+ that GCC/UPC was not properly implementing nested upc_forall
+ semantics. Nested upc_forall statements (both statically or
+ dynamically nested) must implement their affinity clause as if it
+ were "continue"; thus all steps in the loop must execute without
+ regard for affinity. To implement these semantics a global depth
+ counter, __upc_forall_depth, is maintained by the generated code
+ that implements upc_forall.
+ See also: gcc/c-parser.c gcc/c-tree.h gcc/stub-upc.c
+ gcc/upc/upc-act.c gcc/upc/upc-act.h libupc/include/gcc-upc-lib.in
+ libupc/include/upc.h libupc/smp/upc_main.c
+
+2010-09-19 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: c-decl.c: zero out the layout specifier, after
+ processing an array type.
+ Fix the previous fix, that moved the setting of the type's layout
+ qualifier to the outside of the array type processing loop. What is
+ missing from the fix is that the layout_qualifier variable needs to
+ be cleared after setting the type's blocksize.
+
+2010-09-19 Gary Funck <gary@intrepid.com>
+
+ * config/upc-conf.h: Fix Bug 375: error message is off-by-one when
+ given blocksize is greater than UPC_MAX_BLOCKSIZE.
+ The value we were using for UPC_MAX_BLOCK_SIZE was one bigger than
+ the actual maximum block size. Therefore, the message was correct,
+ but the underlying value that was being checked was wrong. Change
+ the values so that they agree with the actual implementation-defined
+ limit.
+
+2010-09-11 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix Bug 402: ICE: '[*]' layout factor on
+ multi-dimensional shared array with dynamic threads.
+ This declaration caused an internal compiler error when compiled
+ with dynamic threads:
+ shared [*] int A[THREADS][16]; The bug was discovered when
+ compiling the RTED_UPC test suite.
+ The fix is to process layout qualifiers after the entire array type
+ has been built. Otherwise, we try to calculate the blocksize on a
+ shared array type that has not had its "size depends upon the value
+ of THREADS" flag set.
+ Also, added a test case.
+ See also: libupc/testsuite/libupc.upc/intrepid/test18.upc
+
+2010-07-11 Gary Funck <gary@intrepid.com>
+
+ Fix a bug where a statement in c_build_qualified_type()
+ in the trunk had been inadvertently deleted.
+ This bug showed up in the IA64 port, because jmpbuf's
+ on that architecture must be 16 byte aligned, and they were not.
+ c-typeck.c (c_build_qualified_type): Revive the deleted line.
+
+2010-07-08 Gary Funck <gary@intrepid.com>
+
+ Make changes so that other language compilers
+ will build and bootstrap.
+ * c-family/c-common.c (compiling_upc, flag_upc,
+ flag_upc_instrument, flag_upc_instrument_functions,
+ use_upc_dwarf2_extensions): Move to stub-upc.c and
+ upc-lang.c.
+ * c-family/c-common.h (use_upc_dwarf2_extensions,
+ compiling_upc): Add extern definitions - needed
+ to compile/build other language front ends.
+ * c-family/c.opt: Fix the spelling of ObjC.
+ It had been incorrectly spelled as Objc.
+ * c-family/c.opt: Add UPC for the various switches
+ that are valid for both C and ObjC.
+ * c-family/c-opts.c: Add CL_UPC to the list of
+ supported options switches when compiling assembly
+ language.
+ * lto/lto-lang.c (use_upc_dwarf2_extensions,
+ flag_upc_instrument, flag_upc_instrument_functions):
+ Remove these definitions. They have been moved
+ to c-family/stub-upc.c.
+ * upc/ChangeLog: Move relevant entries
+ to ChangeLog.upc.
+ * c-family/stub-upc.c (compiling_upc, flag_upc,
+ flag_upc_instrument, flag_upc_instrument_functions,
+ use_upc_dwarf2_extensions): Moved from c-common.c
+ * upc/upc-lang.c (compiling_upc, flag_upc,
+ flag_upc_instrument, flag_upc_instrument_functions,
+ use_upc_dwarf2_extensions): Moved from c-common.c
+ * objc/objc-act.c (objc_gimplify_expr): Add additional
+ parameters to c_gimplify_expr() call, that are used
+ by upc's tree rewrites.
+ * cp/cp-gimplify.c (cp_gimplify_expr): Likewise.
+ * gcc/cp/lex.c (init_reswords): If not compiling
+ UPC, then mask off the UPC keywords.
+ * cp/Make-lang.in (C_STUB_OBJS): Use this
+ make macro to link with c-family/stub-objc.o
+ and c-family/stub-upc.o.
+ * fortran/Make-lang.in (C_STUB_OBJS): Likewise.
+ * java/Make-lang.in (C_STUB_OBJS): Likewise.
+ * objc/Make-lang.in: Link with c-family/stub-upc.o
+ to avoid undefined references.
+ c-parser.c: Fix line indentation.
+ * libcpp/include/cpplib.h: Remove CL_UPC from
+ the list of language kinds accepted by the
+ C preprocessor. This is not necessary because
+ UPC is a derivative of C99, and does not need
+ a different language kind.
+ * c-family/c-opts.c (c_common_handle_option):
+ Call set_std_c99() when processing the
+ "--lang upc" switch, instead of setting the
+ language kind to CL_UPC.
+ * libupc/testsuite/libupc.upc/intrepid/ChangeLog: New.
+
+2010-07-03 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 161517 into gupc branch.
+ * gcc/stub-upc.c: Move to gcc/c-family/.
+ * libupc/testsuite/libupc.upc/intrepid/test19.upc:
+ Add 'unused' attributes to avoid "set, but
+ not referenced" warnings.
+ * libupc/testsuite/libupc.upc/intrepid/test18.upc:
+ Likewise.
+
+2010-03-01 Gary Funck <gary@intrepid.com>
+
+ Create gupc branch from trunk version 157149.
+
+2011-10-04 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 179421 into gupc branch.
+ * tree.c (build_opaque_vector_type): Add null UPC layout qualifier
+ argument to the call to check_qualified_type().
+
+2011-09-22 Gary Funck <gary@intrepid.com>
+
+ * tree-pretty-print.c (dump_generic_node): Print UPC type qualifier
+ information.
+ (dump_upc_type_quals): New.
+
+2011-09-22 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_get_block_factor): test TYPE_HAS_BLOCK_FACTOR()
+ before calling TYPE_BLOCK_FACTOR(). This fits better with
+ recent encoding of block factor values with a hash table.
+
+2011-09-15 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add to FLAGS the flags needed to disable inlining of
+ UPC run-time access routines.
+ * testsuite/lib/target-supports.exp
+ (add_options_for_upc_library_calls): New.
+
+2011-09-15 Gary Funck <gary@intrepid.com>
+
+ Fix ICE involving shared bit field accesses.
+ * tree.c (build3_stat): Propagate TEEE_SHARED()
+ TREE_STRICT() and TREE_RELAXED() flags, if applicable.
+
+2011-09-15 Gary Funck <gary@intrepid.com>
+
+ Fix ICE involving shared bit field accesses.
+ * upc/upc-genericize.c (upc_simplify_shared_ref): Improve
+ "shared bit fields not yet implemented" error message
+ by adding file/line number location.
+
+2011-09-13 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 178795 into gupc branch.
+ Incorporates fix to PR bootstrap/50010 for x86-32.
+
+2011-09-13 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-tree.def (UPC_FORALL_STMT): Fix spelling error in comments.
+ * upc/upc-lang.c (upc_init_options): Ditto.
+ * upc/upc-genericize.c (lookup_unshared_var, upc_shared_addr_rep,
+ upc_genericize_expr, upc_genericize_compound_expr): Ditto.
+ * upc/upc-act.c (upc_parse_init, upc_build_pointer_type,
+ upc_block_factor_insert, upc_pts_is_valid_p): Ditto.
+
+2011-09-08 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 178557 into gupc branch.
+
+2011-09-07 Gary Funck <gary@intrepid.com>
+
+ Ensure that UPC pointer-to-shared type alignment is
+ propagated to the final type. Revert to long-standing
+ alignment policy: twice the size of a "C" pointer.
+ * tree.c (build_pointer_type): Propagate the alignment
+ of the UPC pointer-to-shared representation type
+ into the newly built pointer type.
+
+2011-09-07 Gary Funck <gary@intrepid.com>
+
+ Ensure that UPC pointer-to-shared type alignment is
+ propagated to the final type. Revert to long-standing
+ alignment policy: twice the size of a "C" pointer.
+ * upc/upc-pts-struct.c (upc_pts_struct_init_type): Ensure that
+ shared pointers have twice the alignment of a pointer.
+ * upc/upc-act.c (upc_cpp_builtins): Unconditionally emit
+ the definition of __UPC_PTS_ALIGN__.
+
+2011-09-02 Gary Funck <gary@intrepid.com>
+
+ Align UPC pointers-to-shared, only if the target enforces
+ strict alignment.
+ * upc/upc-pts-struct.c (upc_pts_struct_init_type): Align a
+ UPC pointer-to-shared type, only if the target requires
+ strict alignment.
+ * upc/upc-act.c (upc_cpp_builtins): Output pre-defined macro,
+ __UPC_PTS_ALIGN__, only if the target requires strict alignment.
+
+2011-08-30 Gary Funck <gary@intrepid.com>
+
+ * tree.h (check_qualified_type): Change 'const_tree'
+ argument types back to 'tree' to avoid complaints
+ of assignment drops qualifiers for invocations of the
+ newly implemented TYPE_BLOCK_FACTOR() macro, which
+ invokes hash functions with 'tree' pointer values that
+ are not const qualified.
+ * tree.c (check_qualified_type, check_aligned_type): Ditto.
+ * c-typeck.c (comptypes_internal): Ditto.
+
+2011-08-29 Gary Funck <gary@intrepid.com>
+
+ Fixes for regressions noted running "make check"
+ versus GCC trunk.
+ * fold-const.c (fold_unary_loc): Execute UPC-specific
+ checks for a cast-of-a-cast, only if one of the
+ operands is a UPC pointer-to-shared value.
+ * opts.c (print_specific_help): Fix a comparison
+ in an assert that checks that there are enough
+ bits reserved for the number of languages defined
+ in the .opt files.
+
+2011-08-29 Gary Funck <gary@intrepid.com>
+
+ Implement a hash table to record UPC block factors.
+ * c-family/stub-upc.c (upc_block_factor_insert,
+ upc_block_factor_lookup): New dummy stub procedures.
+ * c-family/c-common.c (c_sizeof_or_alignof_type):
+ Rename UPC_TYPE_HAS_THREADS_FACTOR() to TYPE_HAS_THREADS_FACTOR().
+ * tree.c (copy_node_stat): call SET_TYPE_BLOCK_FACTOR()
+ to copy (hashed) UPC blocking factor.
+ (set_type_quals): Likewise.
+ * tree.h: Rename UPC_TYPE_HAS_THREADS_FACTOR() to
+ TYPE_HAS_THREADS_FACTOR().
+ (type_common.block_factor): Delete.
+ (TYPE_HAS_BLOCK_FACTOR_0, TYPE_HAS_BLOCK_FACTOR_X,
+ TYPE_HAS_BLOCK_FACTOR, SET_TYPE_BLOCK_FACTOR): New.
+ (TYPE_BLOCK_FACTOR): Re-implement, using hash table for
+ UPC blocking factors greater than one.
+ * dwarf2out.c (modified_type_die): Re-implement
+ logic that records UPC blocking factor in the generated
+ DWARF2 debugging information.
+ (add_subscript_info): Rename UPC_TYPE_HAS_THREADS_FACTOR() to
+ TYPE_HAS_THREADS_FACTOR().
+ * c-decl.c (finish_decl, grokdeclarator):
+ Rename UPC_TYPE_HAS_THREADS_FACTOR() to TYPE_HAS_THREADS_FACTOR().
+ * print-tree.c (print_node): Check for TYPE_LANG_FLAG_* flags
+ used by UPC, and print UPC-specific information.
+
+2011-08-29 Gary Funck <gary@intrepid.com>
+
+ Implement a hash table to record UPC block factors.
+ * upc/upc-act.c (upc_block_factor_for_type): New garbage-collected
+ hash table.
+ (upc_lang_init, upc_finish): Move to end of source file.
+ (upc_lang_init): create upc_block_factor_for_type hash table.
+ (upc_block_factor_lookup, upc_block_factor_insert): New.
+ (upc_grok_layout_qualifier, upc_lang_layout_decl, upc_pts_int_sum):
+ Rename UPC_TYPE_HAS_THREADS_FACTOR() to TYPE_HAS_THREADS_FACTOR().
+ (upc_grok_layout_qualifier): convert blocking factor to sizetype
+ before checking for equality to element type's blocking factor.
+
+2011-08-28 Gary Funck <gary@intrepid.com>
+
+ Re-work the type machinery to fully support and to unify support
+ for the UPC layout qualifier (blocking factor).
+ * c-family/stub-upc.c (upc_set_block_factor): Delete.
+ (upc_grok_layout_qualifier): rename from upc_apply_layout_qualifier()
+ and update prototype.
+ * c-family/c-common.c (complete_array_type): call newly
+ defined c_build_qualified_type_1() instead of
+ upc_set_block_factor().
+ * c-family/c-upc.h (pc_grok_layout_qualifier): rename from
+ upc_apply_layout_qualifier() and update prototype.
+ (upc_set_block_factor): Delete prototype.
+ * c-family/c-common.h (c_build_qualified_type): redefine
+ as a pre-processor macro that invokes c_build_qualified_type_1()
+ with a null UPC layout qualifier.
+ (c_build_qualified_type_1): New. Add layout qualifier argument
+ to old c_build_qualified_type() prototype.
+ * tree.c (set_type_quals, check_qualified_type):
+ Add layout qualifier as argument.
+ (check_aligned_type): Add check for UPC block factor equality.
+ (get_qualified_type_1): Rename from get_qualified_type() and
+ add layout qualifier as argument.
+ (build_qualified_type_1): Rename from build_qualified_type() and
+ add layout qualifier as argument.
+ * tree.h (check_qualified_type): Add layout qualifier as argument
+ to the prototype.
+ (get_qualified_type): Re-define as a as a pre-processor macro
+ that invokes get_qualified_type_1() with a null
+ UPC layout qualifier.
+ (get_qualified_type_1): Rename from get_qualified_type() and
+ add layout qualifier as argument.
+ * cp/tree.c (c_build_qualified_type_1): Rename from
+ c_build_qualified_type() and add (unused) layout qualifier
+ argument.
+ * c-decl.c (finish_decl): re-format long error messages.
+ (grokdeclarator): Re-work the logic so that it calls
+ upc_grok_layout_qualifier() to handle the UPC layout
+ qualifier, if present.
+ * c-typeck.c (qualify_type, common_pointer_type,
+ build_component_ref): Re-work the logic so that it calls
+ upc_grok_layout_qualifier() to handle the UPC layout qualifier,
+ if present.
+ (c_build_qualified_type_1): Rename from c_build_qualified_type()
+ and add layout qualifier argument.
+ * print_tree.c (print_node): Re-format a long line.
+
+2011-08-28 Gary Funck <gary@intrepid.com>
+
+ Re-work the type machinery to fully support and to unify support
+ for the UPC layout qualifier (blocking factor).
+ * upc/upc-genericize.c (upc_simplify_shared_ref): Call
+ c_build_qualified_type_1() instead of upc_set_block_factor()
+ to assert a zero blocking factor.
+ * upc/upc-pts-struct.c (upc_pts_struct_init_type): Call
+ c_build_qualified_type_1() to build predefined shared
+ qualified types, instead of build_variant_type_copy().
+ * upc/upc-pts-packed.c (upc_pts_packed_init_type): Call
+ c_build_qualified_type_1() to build predefined shared
+ qualified types, instead of build_variant_type_copy().
+ * upc/upc-act.c (upc_set_block_factor): Delete.
+ (upc_grok_layout_qualifier): Rename from upc_apply_layout_qualifier().
+ Rework logic so that it returns a blocking factor rather than
+ a qualified type. Add 'loc' argument and call error_at().
+ Add an ELEM_BLOCK_FACTOR argument and Implement logic that merges
+ the block size of the element type into the result type, and checks
+ for errors due to an attempt to merge differing blocking factors.
+
+2011-08-26 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 177949 into gupc branch.
+ * c-family/c-common.h (enum rid): Bump the number of type modifiers
+ in the comment.
+ * ../libcpp/init.c (struct lang_flags): Adjust the entry for UPC
+ to add new rliterals column value.
+
+2011-08-26 Gary Funck <gary@intrepid.com>
+
+ * convert.c (convert_to_integer): Fix the check for the
+ difference between two UPC pointers-to-shared values.
+
+2011-08-23 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Fix the name for --with-upc-pts-packed-bits
+ option. Support --with-upc-packed-bits as deprecated. Fix the code to
+ correctly check packed bits.
+ * configure: Re-generate.
+
+2011-08-16 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c (c_parser_upc_sync_statement): issue error diagnostic if
+ the barrier id expression is not an integer expression.
+
+2011-08-16 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_decl_init): Do not attempt to expand
+ an error mark node. Fixes ICE after error diagnostic.
+ * upc/upc-cmd.c (main): detect missing option argument for
+ options that require an argument, and print error diagnostic.
+ (get_print_cmd): Re-direct error output to /dev/null to
+ avoid issuing duplicate error messages.
+
+2011-08-12 Gary Funck <gary@intrepid.com>
+
+ * config/i386/i386.h (MAX_FIXED_MODE_SIZE): Delete
+ (revert to trunk).
+ * upc/upc-pts-struct.c (upc_pts_struct_init_type):
+ Set mode of UPC pointer-to-shared rep. to an
+ integral mode of size at least as large as the
+ size of the representation's struct type.
+
+2011-08-12 Gary Funck <gary@intrepid.com>
+
+ Rework/simplify the UPC genericize pass.
+ * c-family/stub-upc.c (upc_apply_layout_qualifier,
+ upc_build_pointer_type): New.
+ (upc_set_block_factor): Adjust to new calling sequence.
+ (upc_build_shared_var_addr): Delete.
+ * c-family/c-common.c (complete_array_type): Adjust call
+ to upc_set_block_factor().
+ * c-family/c-upc.h (upc_apply_layout_qualifier,
+ upc_build_pointer_type): New.
+ (upc_build_shared_var_addr): Delete.
+ (upc_set_block_factor): Adjust to new calling sequence.
+ * tree.h (TI_UPC_CHAR_PTS_TYPE, upc_char_pts_type_node): New.
+ * c-decl.c (grokdeclarator): Call newly defined
+ upc_apply_layout_qualifier() instead of upc_set_block_factor().
+ * c-decl.c (grokdeclarator): Split long UPC-related error
+ messages into two lines.
+ * c-typeck.c (build_unary_op): Do not call upc_build_shared_var_addr()
+ directly. Revert that change to trunk. (upc_genericize() will
+ handle lowering the expressions that take the address of a
+ UPC variable).
+ * config/i386/i386.c (ix86_promote_function_mode): For UPC
+ pointers-to-shared, return the type mode of the UPC pointer-to-shared
+ representation type.
+
+2011-08-12 Gary Funck <gary@intrepid.com>
+
+ Rework/simplify the UPC genericize pass.
+ * upc/upc-pts.h (upc_pts_ops_t): Remove 'add_offset' field.
+ * upc/upc-act.h: Cosmetic change.
+ * upc/config-lang.in (gtypes): Add upc-genericize.[ch] to the list.
+ * upc/upc-genericize.c (upc_expand_get):
+ Add WANT_STABLE_VALUE parameter.
+ (upc_build_shared_var_addr, upc_shared_addr_rep): New.
+ (uid_tree_map, unshared_vars, uid_tree_map_hash, uid_tree_map_eq,
+ create_unshared_var, lookup_unshared_var, map_unshared_var,
+ unshared_var_addr, unshared_var_name,
+ upc_free_unshared_var_table): Move from upc-act.c.
+ (upc_expand_get, upc_expand_put): Change their source and/or
+ destination parameters so that they are no longer addresses
+ of the objects, but rather references to the objects themselves.
+ (upc_simplify_shared_ref): Rewrite (simplify/generalize).
+ (upc_shared_addr_rep): New.
+ (upc_shared_addr): Adjust call to upc_build_shared_var_addr(),
+ and re-factor the logic.
+ (upc_genericize_sync_stmt): Re-format comment.
+ (upc_genericize_shared_var_ref): Adjust call to upc_expand_get().
+ (upc_genericize_addr_expr): Re-factor the logic.
+ (upc_genericize_indirect_ref, upc_genericize_field_ref):
+ Adjust call to upc_expand_get() and re-factor the logic.
+ (upc_genericize_modify_expr): Adjust call to upc_expand_put()
+ and re-factor the logic.
+ (upc_genericize_expr): Improve/fix comments.
+ (upc_genericize_finish, upc_genericize_init): New.
+ * upc/upc-pts-struct.c (upc_pts_struct_build_add_offset): Delete.
+ (upc_char_pts_type_node): Create new global type node.
+ (upc_pts_struct_is_null_p): Generalize variable names to
+ reflect the fact that the vaddr field can be either first/last.
+ (upc_pts_struct_build_sum): Make corrections to comments.
+ (upc_pts_struct_build_add_offset): Delete.
+ * upc/upc-genericize.h (upc_genericize_finish, upc_genericize_init):
+ New prototypes.
+ * upc/upc-pts-packed.c (upc_pts_packed_build_add_offset): Delete.
+ (upc_char_pts_type_node): Create new global type node.
+ * upc/Make-lang.in: Add dependencies to gtype-upc.h
+ and gt-upc-upc-genericize.h.
+ * upc/upc-act.c: Adjust includes to reflect moving the functions
+ that handle the UPC unshared "shadow variables" into
+ upc-genericize.c. Improve/fix various comments.
+ * upc/upc-act.c (upc_parse_init): Call upc_genericize_init().
+ (upc_build_pointer_type): New.
+ (upc_set_block_factor): Re-purpose. Move the front-end
+ related error checks into upc_apply_layout_qualifier().
+ (upc_apply_layout_qualifier): New.
+ (upc_write_global_declarations): Call upc_genericize_finish().
+
+2011-08-10 Gary Funck <gary@intrepid.com>
+
+ Implement additional fixes for recent merge with trunk.
+ * explow.c (promote_mode): Do not attempt to promote
+ the mode for UPC pointer-to-shared types.
+ * config/i386/i386.c (function_value_64): Ditto.
+
+2011-08-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 177548 into gupc branch.
+ * config/i386/i386.c (ix86_promote_function_mode):
+ Do not promote UPC pointers-to-shared to Pmode.
+ * c-family/c-common.c (pointer_int_sum):
+ Also check the pointer operand, rather than just
+ its type, when making the decision to derive
+ the equivalent unshared type.
+ * tree.c (build2_stat): If the type of the result
+ passed in as an argument is a UPC shared type,
+ derive the unshared equivalent when calculating
+ the result type of the node.
+
+2011-07-15 Nenad Vukicevic <nenad@intrepid.com>
+
+ * config/darwin.c: Disable var_tracking option
+ on -O0 as it is supposed to run only when optimization
+ is applied. See GCC bug 49743.
+
+2011-07-11 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-genericize.c (upc_expand_put): Fix bug, where strict/relaxed
+ qualification was incorrectly derived from the source operand.
+ (upc_genericize_fndecl): New.
+ (upc_genericize): Call upc_genericize_fndecl() to avoid calling
+ c_genericize() more than once in the event of nested procedures.
+ (upc_genericize_real_imag_ref): Rename,
+ was: upc_genericize_real_image_ref.
+ (upc_expand_put): call internal_error() with meaningful message
+ in lieu of abort().
+ (upc_genericize_real_imag_ref): call internal_error() with
+ meaningful message in lieu of gcc_unreachable().
+
+2011-07-06 Gary Funck <gary@intrepid.com>
+
+ Re-implement the pass that lowers trees generated by
+ the UPC front-end into GENERIC. Previously this was
+ done within the gimplification framework, but this
+ required that gimplification be run before inlining
+ and various other passes, which did not fit in well
+ with the current design of the middle-end passes.
+ Now, the lowering is done by a newly defined language
+ specific genericize hook. With this change, we are
+ are able to undo some extensions made to the gimplify
+ logic, and thus can revert several files to trunk.
+ * c-decl.c: Add a check for UPC deprecated names which
+ may appear as undefined function names.
+ * libfuncs.h (LTI_upc_barrier, LTI_upc_notify, LTI_upc_wait,
+ LTI_upc_getaddr): Remove definitions of unused UPC
+ library function names. These were defined back when
+ the libfunc interface was used to call these routines.
+ * timevar.def (TV_TREE_UPC_GENERICIZE): New. Track time spent
+ in UPC lowering (genericize) pass.
+ * langhooks.h (gimplify_expr): Revert to trunk's definition.
+ (instrument_func): Delete this hook. Now handled in
+ upc_genericize().
+ * tree-pass.h: Revert to trunk.
+ * c-typeck.c (build_unary_op): Adjust reference to
+ upc_genericize() in a comment.
+ * gimplify.c (create_tmp_var_raw): Delete logic that
+ was converting UPC shared types into unshared types
+ to be used for temporaries. Now handled in upc_genericize().
+ Replace with an assertion check.
+ (prepare_gimple_addressable): Revert to trunk's definition.
+ No longer needed as an externally called function.
+ (flag_instrument_functions_exclude_p): Re-define as
+ an externally called function.
+ (gimplify_function_tree): Delete code that implemented
+ call to UPC's language specific function instrumentation hook.
+ * gimple.h (flag_instrument_functions_exclude_p): Define as extern.
+ (prepare_gimple_addressable): Delete extern definition;
+ revert to trunk's definition.
+ * lnaghooks-def.h (lhd_gimplify_expr): Revert to trunk's definition.
+ (LANG_HOOKS_INSTRUMENT_FUNC): Remove, no longer needed for UPC.
+ * c-family/c-gimplify.c: Revert to trunk.
+ * cp/cp-gimplify.c: Revert to trunk.
+ * cp/cp-tree.h: Revert to trunk.
+ * explow.c: Revert to trunk.
+ * langhooks.c: Revert to trunk.
+ * libfuncs.h: Revert to trunk.
+ * objc/objc-act.c: Revert to trunk.
+
+2011-07-06 Gary Funck <gary@intrepid.com>
+
+ Improve/simplify the logic in upc_genericize.
+ * upc/upc-genericize.c (upc_create_tmp_var): Delete the
+ PREFIX argument. Aways use "UPC" as the prefix.
+ (upc_genericize_compound_expr): Add a WANT_VALUE argument.
+ (upc_genericize_cond_expr): New.
+ (upc_genericize_decl_expr): New.
+ (upc_genericize_stmt): New.
+ (upc_copy_value_to_tmp_var, upc_expand_get): Adjust call
+ to upc_create_tmp_var().
+ (upc_genericize_expr): Change the handling
+ of the want_value flag passed in the DATA argument.
+ Always assert this flag after processing EXPR_P.
+ (upc_genericize_compound_expr): Adjust call
+ to upc_genericize_compound_expr() and call
+ upc_genericize_cond_expr() and upc_genericize_decl_expr().
+
+2011-07-06 Gary Funck <gary@intrepid.com>
+
+ Re-implement the pass that lowers trees generated by
+ the UPC front-end into GENERIC. Previously this was
+ done within the gimplification framework, but this
+ required that gimplification be run before inlining
+ and various other passes, which did not fit in well
+ with the current design of the middle-end passes.
+ Now, the lowering is done by a newly defined language
+ specific genericize hook. With this change, we are
+ are able to undo some extensions made to the gimplify
+ logic, and thus can revert several files to trunk.
+ * upc/upc-genericize.c: Rename upc-gimplify.c to upc-genericize.c.
+ * upc/upc-genericize.h: Rename upc-gimplify.h to upc-genericize.h.
+ * upc/Make-lang.in: Adjust to refer to upc-genericize.[cho].
+ * upc/upc-lnag.c: refer to upc-genericize.h.
+ (LANG_HOOKS_GENERICIZE): define as upc_genericize.
+ (LANG_HOOKS_GIMPLIFY_EXPR): Delete.
+ (LANG_HOOKS_INSTRUMENT_FUNC): Delete.
+ * upc/upc-act.c: Minor code format fix.
+
+2011-06-30 Gary Funck <gary@intrepid.com>
+
+ * c-family/c.opt: Bring options definitions up-to-date
+ with respect to changes made in the trunk.
+
+2011-06-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 175584 into gupc branch.
+
+2011-06-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 175584 into gupc branch.
+ * upc/upc-act.c (upc_handle_option): Change reference to
+ have_named_sections so that it refers to the
+ targetm_common structure.
+
+2011-06-28 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.h (upc_write_init_func, upc_free_unshared_var_table):
+ Remove extern definitions. Now declared as 'static'.
+ * upc/upc-gimplify.c, upc/upc-lang.c,
+ upc-pts-struct.c, upc-gasp.c, upc-pts-packed.c,
+ upc-cmd.c, upc-act.c: Improve/add comments, fix
+ typos and spelling errors.
+
+2011-06-13 Gary Funck <gary@intrepid.com>
+
+ libcpp/
+ * include/cpplib.h (enum c_lang):
+ Move the entry for CLK_UPC so that it follows CLK_STDC1X.
+ This keeps all the "C" variants together.
+ * init.c (lang_defaults): Add an entry for UPC.
+
+2011-06-10 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_set_block_factor): Handle the case where
+ the UPC blocking factor expression overflowed.
+
+2011-06-09 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c (upc_localsizeof_type): Fix an ICE when compiling for
+ a 32-bit target, the size expression overflowed, the result was
+ error_mark_node, and an ICE was triggered on an attempt to evaluate
+ C_TYPE_VARIABLE_SIZE() on the error node.
+ (upc_blocksizeof_expr, upc_blocksizeof_type,
+ upc_elemsizeof_expr, upc_elemsizeof_type, upc_localsizeof_expr):
+ Make similar changes to avoid further processing of error_mark_node.
+
+2011-06-07 Gary Funck <gary@intrepid.com>
+
+ * sel-sched.c (move_op): Incorporate the following
+ patch to eliminate ICE at -O3 on IA64/Altix.
+
+2011-06-07 Alexander Monakov <amonakov@ispras.ru>
+
+ * sel-sched.c (move_op): Use correct type for 'res'. Verify that
+ code_motion_path_driver returned 0 or 1.
+ (sel_region_finish): Clear h_d_i_d.
+
+2011-06-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 174558 into gupc branch.
+
+2011-06-02 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 174558 into gupc branch.
+ * upc/upc-lang.c (upc_check_decl_init): Use recently defined
+ 'append_to_statement_list_force' function to add UPC
+ initialization statements to the UPC initialization
+ statement list ('upc_init_stmt_list').
+ (upc_build_init_func): Use recently defined
+ 'append_to_statement_list_force' function to add
+ statements listed in 'upc_init_stmt_list' onto the
+ function body constructed to implement initialization
+ of UPC declarations that require active initialization
+ at program start up. The previous methods of manipulating
+ statement lists no longer worked, due to changes in the
+ the statement list structure.
+
+2011-05-30 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Make the default order of the virtual
+ address field in a UPC pointer-to-shared to be "first".
+ This reverts to the previous setting, and is a short term
+ measure to work around a bug found on the IA64,
+ where vaddr=last led to incorrect code generation.
+ Rename UPC_PTS_VADDR_FIRST to HAVE_UPC_PTS_VADDR_FIRST
+ in AC_DEFINE(), to agree with recent changes in files
+ that reference this define.
+ configure, config.in: Regenerate.
+
+2011-05-26 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Fix typo when referring to $upc_vaddr_order.
+ configure: Regenerate.
+ * ../fixincludes/fixincl.x: Revert to trunk.
+ This file is auto-generated, and should not be merged.
+
+2011-05-23 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-pts-struct.c: Revert to code that aligned the
+ internal pointer-to-shared representation to
+ twice the alignment of a pointer. This fixes
+ an ICE that occurred when building the compiler
+ on an IA64 target.
+
+2011-05-18 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 173845 into gupc branch.
+
+2011-05-17 Gary Funck <gary@intrepid.com>
+
+ * c-family/stub-upc.c (upc_rts_forall_depth_var): New.
+ c-family/c-upc.h (upc_rts_forall_depth_var): Define.
+ * c-family/c-pragma.c: Remove conditional compilation
+ with HANDLE_PRAGMA_UPC and HANDLE_PRAGMA_PUPC.
+ Test 'compiling_upc' when compiling to determine if
+ the "upc" and "pupc" pragmas should be registered.
+ * defaults.h (UPC_SHARED_SECTION_NAME, UPC_SHARED_BEGIN_NAME,
+ UPC_SHARED_END_NAME, UPC_PGM_INFO_SECTION_NAME,
+ UPC_PGM_INFO_BEGIN_NAME, UPC_PGM_INFO_END_NAME,
+ UPC_INIT_SECTION_NAME, UPC_INIT_BEGIN_NAME,
+ UPC_INIT_END_NAME, UPC_INIT_ARRAY_SECTION_NAME,
+ UPC_INIT_ARRAY_BEGIN_NAME, UPC_INIT_ARRAY_END_NAME): New.
+ Move these target-dependent definitions from config/upc-conf.h
+ to here.
+ * configure.ac: Improve the logic for UPC-related options.
+ Delete references to pre-processor definitions that have
+ been moved to "upc/upc-pts.h".
+ * configure, config.in: Regenerate.
+ * Makefile.in (UPC_PTS_REP): Remove definition and revert
+ to trunk. This substitution variable was used to
+ configure the representation-specific versions of
+ the tree rewrites that operate on UPC pointer-to-shared
+ types and objects.
+ * c-parser.c (c_parser_upc_forall_statement): Remove
+ reference to UPC_FORALL_DEPTH_NAME, and call
+ newly defined upc_rts_forall_depth_var() instead.
+ * config/upc-config.h: Delete. Various definitions
+ moved to "upc/upc-rts-names.h", "defaults.h", and
+ "upc/upc-pts.h".
+ * doc/tm.texi.in (HAVE_UPC_PTS_VADDR_FIRST,
+ HAVE_UPC_PTS_PACKED_REP, HAVE_UPC_PTS_STRUCT_REP,
+ UPC_SHARED_SECTION_NAME, UPC_SHARED_BEGIN_NAME,
+ UPC_SHARED_END_NAME, UPC_PGM_INFO_SECTION_NAME,
+ UPC_PGM_INFO_BEGIN_NAME, UPC_PGM_INFO_END_NAME,
+ UPC_INIT_SECTION_NAME, UPC_INIT_BEGIN_NAME,
+ UPC_INIT_END_NAME, UPC_INIT_ARRAY_SECTION_NAME,
+ UPC_INIT_ARRAY_BEGIN_NAME, UPC_INIT_ARRAY_END_NAME):
+ New. Document UPC target macros.
+ doc/tm.texi: Regenerate.
+
+2011-05-17 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-pts.h (upc_pts_build_value, upc_pts_build_add_offset,
+ upc_pts_build_cond_expr, upc_pts_build_constant,
+ upc_pts_build_cvt, upc_pts_build_diff, upc_pts_build_sum,
+ upc_pts_build_threadof, upc_pts_init_type): Remove extern
+ definitions.
+ (upc_pts_ops_t): New. Define handler table that will
+ implement either the 'packed' or the 'struct' representation
+ of a UPC pointer-to-shared value.
+ (upc_pts_packed_ops, upc_pts_struct_ops): New. Define extern that
+ refers to the packed and the struct UPC pointer-to-shared
+ representation implementation.
+ (upc_pts): New. Define handler table that is set up at initialization
+ to refer to the handlers for the UPC pointer-to-shared
+ representation (packed/struct) that has been configured.
+ Add conditional compilation test for HAVE_UPC_PTS_PACKED_REP
+ and configure the UPC pointer-to-shared definitions that
+ are specific to the configured UPC pointer-to-shared
+ representation.
+ * upc/upc-act.h (upc_pts_is_valid_p): Rename extern definition from
+ is_valid_pts_p to upc_pts_is_valid_p.
+ * lang-specs.h: Reformat the UPC compilation specs.
+ to improve readability.
+ * upc/upc-rts-names.h: New. Define the names of UPC runtime
+ library functions that implement UPC language statement
+ semantics. These definitions were moved from config/upc-conf.h
+ * upc/upc-gimplify.c: Add include of "upc-rts-names.h".
+ Refer to newly defined pointer manipulation routines
+ by indirecting through the newly defined "pts" handler table.
+ Re-format, re-indent.
+ * upc/upc-lang.c: Add include of "upc-pts.h". Fix a comment.
+ * upc/config-lang.in: Remove logic that inserted "config/upc-conf.h"
+ into the target include and file path.
+ * upc/upc-pts-struct.c: Add include of "upc-rts-names.h".
+ (upc_pts_struct_ops): Define the pointer manipulation
+ handler table that implements operations on UPC
+ pointers-to-shared, represented as a struct.
+ Re-format and re-indent.
+ * upc/upc-gasp.c: Add include of "upc-rts-names.h".
+ Re-format and re-indent.
+ * upc/upc-pts-packed.c: Add include of "upc-rts-names.h".
+ (upc_pts_packed_ops): Define the pointer manipulation
+ handler table that implements operations on UPC
+ pointers-to-shared, represented as a packed integer.
+ Re-format and re-indent.
+ * upc/Make-lang.in: Compile both "upc-pts-packed.c" and
+ "upc-pts-struct.c". One/other will be selected at
+ compilation time to implement operations on UPC
+ on the UPC pointer-to-shared that has been configured.
+ Add dependencies on "upc-rts-names.h".
+ * upc/upc-cmd.c: Re-format and re-indent.
+ * upc/upc-act.c: Add include of "upc-rts-names.h".
+ (upc_pts): New. Add definition of the handler
+ table that implements representation specific
+ operations on trees that refer to UPC pointer-to-shared
+ objects and types. Re-format and re-indent.
+
+2011-05-07 Gary Funck <gary@intrepid.com>
+
+ * ../configure.ac: Disable build of libupc
+ on non POSIX hosted systems. Use AS_HELP_STRING
+ to define messages. Remove 'word-pair' as a
+ possible --with-upc-pts UPC pointer-to-shared
+ representation.
+ * ../configure: Regenerate.
+ * configure.ac: Use AS_HELP_STRING to define messages.
+ Remove 'word-pair' as a possible --with-upc-pts
+ UPC pointer-to-shared representation.
+ (UPC_MAX_THREADS): Limit the maximum value to 2^31-1.
+ (UPC_MAX_BLOCK_SIZE): Correct the default value.
+ * configure: Regenerate.
+ * config.in: Regenerate. Delete UPC_PTS_WORD_PAIR_REP
+ definition.
+ * ChangeLog.upc: Fix some typos.
+
+2011-05-07 Gary Funck <gary@intrepid.com>
+
+ * ../maintainer-scripts/gcc_release: Add "upc"
+ as one of the released languages.
+
+2011-05-06 Gary Funck <gary@intrepid.com>
+
+ Eliminate compilation warnings, by fixing
+ #include's and updating function prototypes.
+ * c-family/c-cppbuiltin.c: Include c-upc.h.
+ * optabs.c (gen_libfunc): Change type of 'suffix'
+ parameter to conform with prototype.
+ * cp/cp-gimplify.c (cp_gimplify_expr): Add extra parameters
+ ('gimple_test_f' and 'fallback') used by extended gimplify_expr
+ hook used by UPC.
+ * cp/cp-tree.h (cp_gimplify_expr): Add extra parameters to
+ the prototype.
+ * objc/objc-act.c (objc_gimplify_expr): Pass extra dummy
+ argument values to cp_gimplify_expr.
+ * config.in (HAVE_UPC_AFFINITY_SUPPORT,
+ HAVE_UPC_NUMA_SUPPORT): Regenerate. Remove
+ pre-processor definitions that are no longer
+ needed to build the 'upc' command (upc-cmd.c)
+ because the linker specs. defined in libupc
+ take care of linking in the needed libraries.
+ * c-parser.c (c_parser_upc_forall_statement):
+ initialize affinity_loc to avoid "maybe unused" warning.
+ (c_parser_upc_sync_statement): Remove un-needed
+ 'ret' variable. Cast return value from
+ 'upc_build_sync_stmt' to 'void' to avoid
+ compile-time warning.
+ * config/upc-conf.h (UPC_MAX_THREADS): Define as an
+ integer constant, not a string. Range is restricted
+ to maximum positive 32-bit integer (2+ billion) to
+ fit in with the use of 'int' in the front-end's
+ switch handling logic.
+
+2011-05-06 Gary Funck <gary@intrepid.com>
+
+ Upgrade c-family source files to conform with modularity
+ improvements. Mainly, remove #include of c-tree.h in files
+ under c-family, and define a new UPC-specific #include file,
+ c-upc.h, and use it.
+ * c-family/stub-upc.c: Remove #include of c-tree.h and
+ upc/upc-act.h. Replace with #include of c-common.h
+ and c-upc.h.
+ (upc_get_unshared_type, upc_pts_cvt_op_p, upc_blocksizeof_expr,
+ upc_blocksizeof_type, upc_elemsizeof_expr, upc_elemsizeof_type,
+ upc_localsizeof_expr, upc_localsizeof_type,
+ upc_shared_type_p): Delete.
+ * c-family/c-opts.c: Add #include of c-upc.h
+ * c-family/c-common.c: Remove #include of c-tree.h and
+ add #include of c-upc.h.
+ * c-family/c-upc.h: New. Define API for UPC-specific functions
+ (mostly implemented in upc/upc-act.c).
+ * c-family/c-common.h (upc_cpp_builtins,
+ upc_write_global_declarations): Remove extern definitions.
+ * c-family/c-pragma.c: Remove #include of c-tree.h.
+ Add #include of c-upc.h.
+ * tree.h (UPC_TYPE_HAS_THREADS_FACTOR): New. Move from
+ c-tree.h.
+ (upc_shared_type_p, upc_pts_cvt_op_p): New. Move from
+ upc/upc-act.c, and define as a macro.
+ (expand_affinity_test): Remove unused external definition.
+ (build_upc_unshared_type): Add external definition.
+ (upc_shared_type_p): Remove external definition.
+ * c-config-lang.in: Update gtfiles to refer to c-family/c-upc.h.
+ * dojump.c: Remove #include of c-tree.h.
+ * c-tree.h: Remove definition of UPC_TYPE_HAS_THREADS_FACTOR
+ and move to tree.h.
+ (count_upc_threads_refs, is_multiple_of_upc_threads,
+ set_upc_threads_refs_to_one, c_expr, upc_affinity_test,
+ upc_build_shared_var_addr, upc_build_sync_stmt,
+ upc_check_decl_init, upc_check_decl, upc_decl_init, c_expr,
+ upc_get_block_factor, upc_instrument_forall, upc_is_null_pts_p,
+ c_expr, upc_num_threads, upc_diagnose_deprecated_stmt,
+ upc_pts_cvt_op_p, upc_pts_diff, upc_pts_increment,
+ upc_pts_int_sum, upc_set_block_factor, upc_set_decl_section,
+ permit_pragma_upc, deny_pragma_upc, pragma_upc_permitted_p,
+ set_upc_consistency_mode, get_upc_consistency_mode,
+ push_upc_consistency_mode, pop_upc_consistency_mode,
+ get_upc_pupc_mode):
+ Move external definitions to c-family/c-upc.h.
+ (upc_blocksizeof_type, upc_localsizeof_type,
+ upc_elemsizeof_type): Remove external definitions;
+ these functions were moved to c-parser.c.
+ * c-decl.c: Add #include of c-upc.h.
+ * c-typeck.c: Add #include of c-upc.h.
+ * c-convert.c: Add #include of c-upc.h.
+ * ChangeLog.upc: Fix typo.
+ * Makefile.in: Add references to c-family/c-upc.h, everywhere
+ there is a reference to c-family/c-objc.h.
+ Remove extraneous reference to upc-act.h.
+ * c-parser.c: Add #include of c-upc.h.
+ (upc_blocksizeof_expr, upc_blocksizeof_type,
+ upc_elemsizeof_expr, upc_elemsizeof_type,
+ upc_localsizeof_expr, upc_localsizeof_type):
+ Move from upc/upc-act.c.
+ * tree.c (build_upc_unshared_type): New.
+ Move upc_get_unshared_type from upc/upc-act.c and rename
+ to build_upc_unshared_type.
+ c-family/c-common.c (pointer_int_sum): refer to renamed
+ build_upc_unshared_type function.
+ c-convert.c (convert): Ditto.
+ convert.c (convert_to_pointer): Ditto.
+ c-typeck.c (build_unary_op, build_modify_expr,
+ really_start_incremental_init): Ditto.
+ gimplify.c (create_tmp_var_raw): Ditto.
+ tree.c (build1_stat): Ditto.
+ tree.h (upc_get_unshared_type): Rename to
+ build_upc_unshared_type.
+
+2011-05-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 173471 into gupc branch.
+
+2011-05-06 Gary Funck <gary@intrepid.com>
+
+ Eliminate compilation warnings, by fixing
+ #include's and updating function prototypes.
+ * upc/upc-gimplify.c: Include bitmap.h.
+ (upc_gimplify_real_image_ref): Mark various parameters
+ as unused. This is a stub procedure for now.
+ * upc/upc-lang.c: Include c-family/c-upc.h.
+ upc-gasp.c: Ditto.
+ * upc/upc-cmd.c (no_start_files): Delete unused variable.
+ The -nostartfiles switch is now handled by the linker spec.
+ * ChangeLog: Spell check.
+
+2011-05-06 Gary Funck <gary@intrepid.com>
+
+ Upgrade c-family source files to conform with modularity
+ improvements. Mainly, remove #include of c-tree.h in files
+ under c-family, and define a new UPC-specific #include file,
+ c-upc.h, and use it.
+ * upc/upc-act.h (upc_write_global_declarations,
+ upc_check_decl, upc_build_sync_stmt, upc_affinity_test,
+ upc_num_threads, upc_diagnose_deprecated_stmt):
+ Move external definitions to c-family/c-upc.h
+ (upc_blocksizeof_expr, upc_blocksizeof_type,
+ upc_elemsizeof_expr, upc_elemsizeof_type,
+ upc_localsizeof_expr, upc_localsizeof_type):
+ Remove external definitions; these functions
+ were moved from upc-act.c to c-parser.c.
+ * upc/upc-gimplify.c: Add #include of c-family/c-upc.h.
+ upc-pts-packed.c: Ditto.
+ upc-pts-struct.c: Ditto.
+ * upc/config-lang.in: Update gtfiles to refer to c-upc.h
+ and other files.
+ * upc/upc-act.c: Add #include of c-family/c-upc.h.
+ (upc_blocksize, upc_elemsizeof, upc_localsizeof):
+ Make external so that it can be called from c-parser.c.
+ (upc_blocksizeof_expr, upc_blocksizeof_type,
+ upc_elemsizeof_expr, upc_elemsizeof_type,
+ upc_localsizeof_expr, upc_localsizeof_type):
+ Move from upc/upc-act.c to c-parser.c.
+ (upc_set_block_factor): Fix typo in error message.
+ (upc_shared_type_p, upc_pts_cvt_op_p): Delete.
+ Move to tree.h and define as a macro.
+ (upc_get_unshared_type): Delete. renamed to
+ build_upc_unshared_type and moved to tree.c.
+ * upc/upc-gimplify.c (upc_gimplify_lval, upc_gimplify_expr):
+ refer to renamed build_upc_unshared_type function.
+ upc-act.c (create_unshared_var): Ditto.
+
+2011-05-05 Gary Funck <gary@intrepid.com>
+
+ Make changes that bring the GUPC branch more closely in sync.
+ with the GCC trunk. Revert any fixes that are not UPC-specific.
+ Remove gratuitous re-formatting.
+ * ../libstdc++-v3/config/os/bionic/ctype_noninline.h: Delete.
+ This file should have been removed in a previous merge
+ with the trunk.
+ * ../configure.ac: Remove Cray Catamount/CNL support.
+ * ../configure: Regenerate.
+ * ../config.sub: Remove Cray Catamount/CNL support.
+ * config.gcc: Remove Cray Catamount/CNL support.
+ * ../maintainer-scripts/gcc_release: Revert to trunk.
+ * c-family/c-common.h: Define parse_optimize_options. Its definition
+ was missed in a previous merge with the trunk.
+ * dwarf2out.c: Revert a fix which removed the 'type_main_variant'
+ procedure.
+ * dwarf2out.c: Revert a fix that added a check for VECTOR_TYPE
+ in addition to ARRAY_TYPE.
+ * c-typeck.c: Remove an extra newline character.
+ * varasm.c: Revert a fix that improved an error message
+ when TLS common data is unimplemented.
+ * varasm.c: Revert a gcc_assert that had been added which
+ checked for a null DECL_SIZE_UNIT field.
+ * emultls.c: Revert to trunk. Remove possible fix.
+ * Makefile.in: Revert extra blank line that is present
+ in the trunk version.
+ * Makefile.in: Revert a fix that handled long shell
+ argument lists for plugin headers.
+ * config/ia64/ia64.opt: Revert an option setting
+ that increased the default TLS address range.
+ * config/ia64/crtbegin.asm: Revert to trunk.
+ Removes an extra newline character.
+ * ChangeLog.upc: Spell check.
+
+2011-05-03 Gary Funck <gary@intrepid.com>
+
+ * c-family/c-common.c: Remove extraneous FIXME/TODO comments.
+ (c_apply_type_quals_to_decl): Ditto.
+ * c-family/c-common.h: Ditto.
+ * dojump.c: Ditto.
+ * c-decl.c (merge_decls): Ditto.
+ * c-typeck.c (qualify_type, default_conversion,
+ build_component_ref, build_unary_op,
+ c_build_qualified_type): Ditto.
+ * gimplify.c (create_tmp_var_raw): Remove UPC-specific dead code.
+
+2011-05-03 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-lang.c: Remove extraneous FIXME/TODO comments.
+ * upc/upc-pts-packed.c (upc_pts_build_cvt): Ditto.
+ * upc/upc-act.c (upc_set_block_factor): Ditto.
+
+2011-04-29 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (finish_decl): Improve error diagnostics.
+ (grokdeclarator): Ditto.
+ * c-typeck.c (build_c_cast): Improve error diagnostics.
+ (convert_for_assignment): Ditto.
+ (build_binary_op): Ditto.
+ * c-parser.c (c_parser_upc_forall_statement):
+ Improve error diagnostics.
+ * convert.c (convert_to_integer): Improve error diagnostics.
+
+2011-04-29 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-gimplify.c (upc_expand_get): Improve error diagnostics.
+ (upc_expand_put): Ditto.
+ (upc_shared_addr): Ditto.
+ (upc_gimplify_sync_stmt): Ditto.
+ (upc_gimplify_field_ref): Ditto.
+ * upc/upc-pts-struct.c (upc_pts_build_diff): Improve error diagnostics.
+ (upc_pts_build_cvt): Ditto.
+ * upc/upc-act.c (upc_handle_option): Improve error diagnostics.
+ (upc_lang_init): Ditto.
+ (upc_sizeof_type_check): Ditto.
+ (upc_set_block_factor): Ditto.
+ (upc_decl_init): Ditto.
+ (upc_affinity_test): Ditto.
+ (upc_num_threads): Ditto.
+ (upc_diagnose_deprecated_stmt): Ditto.
+ (upc_build_shared_var_addr): Ditto.
+ (upc_pts_int_sum): Ditto.
+ (upc_pts_diff): Ditto.
+
+2011-04-28 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (create_unshared_var): call upc_get_unshared_type()
+ instead of using TYPE_MAIN_VARIANT() to create an equivalent type
+ that is not a UPC shared type. This is sometimes necessary
+ when the given shared type is derived from a typedef.
+
+2011-04-24 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c (c_parser_upc_sync_statement): Fix ICE that
+ occurred if there is an error in the barrier id
+ expression. Map error_mark_node into NULL.
+
+2011-04-24 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_handle_option): Fix incorrect error
+ diagnostic messages when both -fupc-debug and
+ -fupc-inline-lib are asserted.
+
+2011-04-24 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-cmd.c (GCC_WORD_SWITCH_TAKES_ARG): Add "--param"
+ to the list of switches that accept arguments.
+ (main): Check for switches that have a following
+ argument inside the loop that copies arguments and
+ adds '-x upc' or '-x none' as necessary.
+ (main): Misc. clean ups and simplifications.
+
+2011-04-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 172873 into gupc branch.
+
+2011-04-22 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 172873 into gupc branch.
+ * upc/upc-act.c (upc_build_init_func): assert DECL_PRESERVE_P()
+ on init_func() to prevent it from being removed from
+ the call graph.
+
+2011-04-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 172359 into gupc branch.
+
+2011-04-19 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 172359 into gupc branch.
+ * upc/upc-lang.c (upc_init_ts): New.
+ (LANG_HOOKS_INIT_TS): use upc_init_ts.
+
+2011-04-19 Gary Funck <gary@intrepid.com>
+
+ Eliminate warnings when compiling upc-cmd.c.
+ * upc/upc-cmd.c (file_exists): Remove.
+ (arg_copy): Remove const qualifier.
+
+2011-04-14 Gary Funck <gary@intrepid.com>
+
+ * c-family/c.opt: Add UPC as a valid language for various
+ switches where it is valid for "C", that were not updated
+ in previous merges with trunk.
+
+2011-04-13 Gary Funck <gary@intrepid.com>
+
+ * c-family/c.opt (fupc-pre-include): New option definition.
+ * gcc.c (upc_options): Do not add "-include gcc-upc.h" if
+ -fno-upc-pre-include is asserted.
+
+2011-04-13 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-cmd.c (GCC_WORD_SWITCH_TAKES_ARG): Add "dumpbase"
+ to the list, and alphabetize.
+
+2011-04-13 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-gimplify.c (upc_gimplify_real_image_ref): New.
+ Currently, a not-yet-implemented stub.
+ (upc_gimplify_lval): call upc_gimplify_real_image_ref to
+ rewrite UPC shared REALPART_EXPR and IMAGPART_EXPR lvalues.
+ This will avoid an ICE when compiling regular "C"
+ code that refers to those operators.
+
+2011-04-13 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-cmd.c: Do not add "-isystem <libupc_path>" if
+ -fno-upc-pre-include is asserted.
+
+2011-04-07 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 172158 into gupc branch.
+ to bring in the following fix.
+
+2011-04-05 Bernd Schmidt <bernds@codesourcery.com>
+
+ PR bootstrap/48403
+ * haifa-sched.c (schedule_block): Increment cycle_issued_insns only
+ if old and new states differ.
+
+2011-04-06 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 171966 into gupc branch.
+
+2011-04-01 Gary Funck <gary@intrepid.com>
+
+ * tree.h (tree_base): Move UPC flag bits into bit fields
+ located just before spare bits. Decrement spare bits.
+ Rename 'shared_flag' -> 'upc_shared_flag',
+ 'relaxed_flag' -> 'upc_relaxed_flag',
+ 'strict_flag' -> 'upc_strict_flag, and adjust macros
+ that reference them accordingly.
+
+2011-04-01 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (grokdeclarator): Fix formatting of
+ code that sets UPC block size on scalars.
+
+2011-04-01 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (grokdeclarator): Revert use of white space
+ to match the trunk (to rationalize diffs).
+ * c-typeck.c (convert_for_assignment): Ditto.
+ * tree-ssa.c (useless_type_conversion_p): Ditto.
+
+2011-03-23 Gary Funck <gary@intrepid.com>
+
+ * DEV-PHASE: bump to 4.7.0-1 to reflect recent creation of
+ the GCC 4.6 release branch.
+
+2011-03-22 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-cmd.c: Move linker switches into libupc/libupc.spec.
+ (UPC_LINKER_SCRIPT, LIBNUMA, LIBUPC, LIBUPC_PT) Remove.
+ (find_ld_script) Remove.
+
+2011-03-21 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 171202 into gupc branch.
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ * varasm.c: Call error() directly with a format specifier,
+ rather than using sprintf() to format the message.
+ This should make it easier to internationalize UPC's error messages.
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Fix the check for gnu ld when enabling
+ UPC link script support.
+ configure: Regenerate (also picks up changes from previous
+ merge with trunk).
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ Move UPC start files, end files, and linker specs.
+ into libupc. This reduces the impact on common GCC
+ configuration files, and ensures that these UPC-specific
+ components are only built when the UPC language dialect is selected.
+ * c-family/c.opt: Add -fupc-link switch, used to select UPC-specific
+ linker specs. Fix typo in -fupc-debug message.
+ * config/upc-conf.h, config/darwin.h: Move defines for
+ UPC-related section begins/ends into libupc/config/default/
+ upc-crt-config.h.
+ * config/darwin.h(LINK_COMMAND_SPEC_A): Add call outs to
+ UPC-related linker compiler specifications,
+ accessed via %:include().
+ * configure.ac, configure: Remove logic related to building
+ upc-crtbegin/end. Remove config. tests for numa and cpu
+ affinity (previously used by the 'upc' driver); these
+ settings are now propagated by target-specific compiler
+ specs. built by libupc. Regenerate autoconf.
+ * gcc.c (LINK_COMMAND_SPEC): Add call outs to UPC-related
+ linker compiler specifications, accessed via %:include().
+ Define 'upc_crtbegin_spec', 'upc_crtend_spec', and
+ 'link_upc_spec'.
+ * Makefile.in: Remove definition of UPC_CRTSTUFF_CFLAGS.
+ * config/linux.h, config/i386/darwin.h, config/i386/linux64.h,
+ config/i386/linux.h, config/i386/t-darwin, config/i386/t-darwin64,
+ config/ia64/linux.h, config/mips/t-iris,
+ config/mips/iris6.h: Revert to trunk version 167307.
+ libgcc/
+ * configure, configure.ac, config.host, Makefile.in:
+ Revert to trunk version 167307.
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c: Call error() directly with a format specifier,
+ rather than using sprintf() to format the message.
+ This should make it easier to internationalize UPC's error messages.
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ Move UPC start files, end files, and linker specs.
+ into libupc. This reduces the impact on common GCC
+ configuration files, and ensures that these UPC-specific
+ components are only built when the UPC language dialect is selected.
+ * upc/config-lang.in: Remove setting of 'upc_extra_parts', which
+ was used to specify which upc-crtbegin and upc-crtend files
+ need to built. Remove extraneous (commented out)
+ settings of 'cfiles'. The listed configuration files
+ have been reverted to trunk, and weren't referenced
+ via cfiles in any event.
+ * upc/upc-cmd.c: Remove test for HAVE_UPC_LINK_SCRIPT.
+ Simply test for the presence of the UPC link script
+ in the current directory or the libupc directory.
+ Add -B<path-to-libupc> to the switches passed to 'gcc';
+ this is needed in order to find the upc-crtbegin
+ and upc-crtend object files now built in libupc.
+ Remove test for and inclusion of UPC_LINKER_SWITCHES.
+ if extra switches are needed for a particular target
+ (like SGI/Irix), they will be defined by the custom
+ linker spec. built in libupc. Remove test for
+ HAVE_UPC_NUMA_SUPPORT; if '-lnuma' is needed, it
+ will be added to the custom linker specs. built
+ in libupc.
+ * upc/upc-crtstuff.c: Move to libupc.
+
+2011-02-23 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (undeclared_variable): fix typo. Inadvertently
+ removed negation on following 'if'.
+
+2011-02-22 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c (undeclared_variable): call upc_diagnose_deprecated_stmt
+ to check for the usage of certain deprecated UPC keywords.
+ * c-family/stub-upc.c (upc_diagnose_deprecated_stmt): New.
+ * c-tree.h (undeclared_variable): Define prototype.
+
+2011-02-22 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c (upc_diagnose_deprecated_stmt): New.
+ upc-act.h (upc_diagnose_deprecated_stmt): Define.
+ Check usage of deprecated keywords and issue
+ error message.
+
+2011-02-12 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: (build_c_cast, convert_for_assignment)
+ Diagnose an attempt to convert from an integer to
+ a pointer-to-shared as an error. Also, fix various
+ error messages so that they use the preferred term
+ pointer-to-shared instead of "shared pointer".
+
+2011-02-08 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-pts-struct.c: Fix bug: (pts + int) fails when int is negative
+ for struct-pts representation
+ Analysis indicated that for something like (+ ptr -80) this was
+ being represented as (+ ptr (- 80)) and further, when the
+ calculations were propagated into the individual operations on the
+ components of the 'struct' pointer, it would end up with something
+ like (+ ptr.vaddr (- 80)), and the type of (- 80) would end up as
+ "long unsigned int" because of the addition to the pointer. This
+ caused the calculations involving the signed 'int' operand to be
+ performed incorrectly. This fix insures that the 'int' operand is
+ signed.
+
+2011-02-08 Gary Funck <gary@intrepid.com>
+
+ * upc/config-lang.in, upc/lang-specs.h, upc/Makefile.in,
+ upc/Make-lang.in, upc/upc.1, upc/upc-act.c, upc/upc-act.h,
+ upc/upc-cmd.c, upc/upc-crtstuff.c, upc/upc-gasp.c,
+ upc/upc-gasp.h, upc/upc-gimplify.c, upc/upc-gimplify.h,
+ upc/upc-lang.c, upc/upc-pts.h, upc/upc-pts-packed.c,
+ upc/upc-pts-struct.c, upc/upc-tree.def, upc/upc-tree.h:
+ Update copyright notices.
+
+2011-02-07 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: (convert_for_assignment)
+ Fix typo. in error message.
+
+2011-01-23 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: (c_build_qualified_type)
+ derive UPC block size by calling upc_get_block_size(),
+ to ensure that the element type of an array of an array
+ is derived correctly.
+
+2011-01-09 Gary Funck <gary@intrepid.com>
+
+ Fix behavior of upc_localsizeof() when called in a dynamic
+ threads compilation environment. This bug, and the expected
+ behavior is documented in this bug report:
+ https://upc-bugs.lbl.gov/bugzilla/show_bug.cgi?id=2960.
+ * upc/_act.c (upc_localsizeof): Re-implement.
+
+2010-12-29 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 168314 into gupc branch.
+
+2010-12-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 167307 into gupc branch.
+
+2010-12-15 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 167307 into gupc branch.
+ * upc/_act.h: (upc_handle_option) add location and struct
+ cl_option_handlers * parameters.
+ (upc_finish_file) Remove.
+ (upc_write_global_declarations) New, replaces upc_finish_file.
+ * lang-spec.h: Disable multi-file compilation for .upc files.
+ This fixes an issue where file-scoped static variables were
+ diagnosed as multiply-defined. Both "C" and "ObjC" also disable
+ multi-file compilation.
+ * upc/upc-gimplify.c: (upc_expand_put) Check for INDIRECT_REF_P()
+ explicitly when deciding whether a UPC shared object is addressable.
+ is_gimple_addressable() used to do this, but now checks for MEM_REF
+ which does not apply to UPC shared objects.
+ (upc_gimplify_lval, upc_gimplify_expr) Delete references to
+ ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF.
+ These are no longer defined.
+ (upc_genericize) Add call to bitmap_obstack_initialize()
+ and bitmap_obstack_release() around call to gimplify_function_tree().
+ * upc/upc-lang.c: Add #include of "opts.h" and "options.h".
+ (flag_upc_debug, flag_upc_inline_lib, flag_upc_instrument,
+ flag_upc_instrument_functions) Remove. Use definitions
+ generated by the options file.
+ (upc_init_options) Use cl_decoded_option struct.
+ (LANG_HOOKS_WRITE_GLOBALS) Define as upc_write_global_declarations.
+ (finish_file) Delete.
+ (upc_init_options) Call control_warning_option() to specify
+ -Werror=pointer-arith as the default. Remove call to
+ enable_warning_as_error().
+ * upc/upc-pts-struct.c: (upc_pts_init_type) Move test that
+ UPC_PTS_THREAD_SIZE is a multiple of a byte into an "if" statement
+ rather than an #ifdef; this macro now depends upon a
+ target size macro which must be evaluated at runtime.
+ * upc/Make-lang.in: (cc1-dummy) Remove make target.
+ (cc1upc-checksum.c) Generate directly from object files.
+ * upc/upc-cmd.c: (SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG) Delete
+ references to these deprecated macro definitions.
+ (GCC_WORD_SWITCH_TAKES_ARG, GCC_WORD_SWITCH_TAKES_ARG) New.
+ (all_exec_args) Delete variable.
+ (exec_args) Re-define as (const char *).
+ (exec_arg_list) New. Make copy of exec_args to pass to 'exec'.
+ * upc/upc-act.c: (upc_handle_option) Update argument list to accept
+ (cl_option_handlers *) argument.
+ (upc_finish_file) Rename to upc_write_global_declarations.
+ (upc_write_global_declarations) New.
+
+2010-10-19 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: Fix typo in previous fix
+ which led to a mis-compare for equal block sizes.
+
+2010-10-18 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: Fix bug: Cast of (shared <type> * shared) not
+ diagnosed as an error
+ The conversion from any type (shared or not) to
+ a shared type is likely either meaningless or an error. This update
+ makes any conversion to a shared type, an error.
+
+2010-10-18 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: Fix bug: passing int to shared pointer arg.
+ generates spurious warning
+ Add a #define procedure that does the same thing as
+ WARN_FOR_ASSIGNMENT but issues an error diagnostic instead. Use
+ this procedure to diagnose passing an integer value to a
+ pointer-to-shared as an error.
+
+2010-10-18 Gary Funck <gary@intrepid.com>
+
+ * c-typeck.c: Fix bug: shared [] in prototype silently ignored when
+ matching routine declaration.
+ When checking for type compatibility, shared qualified types must
+ have the same block factor. This check was missing from
+ comptypes_internal(). This update adds the check for blocking
+ factor equality.
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * dwarf2out.c: Fix GCC Bug 45870 - note: non-delegitimized UNSPEC 5
+ found (-O1 -g)
+ See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45870#c6
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * tree-cfg.c: Implement the fix for GCC Bugzilla Bug
+ 45869 - [4.5/4.6 Regression] type mismatch in shift expression
+ produces ice with -O3 and -m32.
+ See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45869
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * c-common.c: Diagnose the application of the various "*sizeof"
+ operations on generic pointer-to-shared as a compilation error.
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix a segfault/ICE that occurred when printing an error
+ message regarding a function parameter being declared with a shared
+ qualifier.
+ The parameter's 'name' value is not defined at this point, and
+ cannot be used in the error message. This update removes the
+ reference to 'name', and eliminates the segfault.
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c: Issue a compilation error on attempts to perform
+ arithmetic on generic pointer-to-shared values.
+ (The rest of this update is a small code clean up.)
+
+2010-10-17 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-lang.c: For UPC only, issue errors for arithmetic and related
+ operations on void types.
+ This update simulates the effect of -Werror=pointer-arith, thus
+ causing arithmetic on void types, sizeof(void) and so on to be
+ considered compilation errors. This meets the expectations of some
+ harness tests and the RTED/CTED test suites. GCC is more
+ permissive, but since this is for UPC only, we can fairly safely
+ define this new policy.
+
+2010-10-16 Gary Funck <gary@intrepid.com>
+
+ * Makefile.in: Implement fixes for SGI/IRIX/MIPS port.
+ The gcc/Makefile.in rules for install-plugin had to be re-written to
+ break up a long list of header files that exceeded the command line
+ limitation imposed by Irix.
+ Access functions for TFmode types had to be implemented.
+ Apparently, this is the mode used for the SGI/MIPS port to represent
+ "long float".
+
+2010-10-16 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c: Fix bug: Static initialization of shared
+ arrays is unsupported -- issue an error message.
+ Currently, static initialization of a shared array is not
+ implemented correctly.
+ We do not plan to fix this for a while, therefore the compiler will
+ issue an error message indicating that this is an unsupported
+ operation.
+
+2010-10-14 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix bug: Multiple equal blocking factors specified
+ via typedef chain should not be diagnosed as an error.
+ If the block size that is given by the typedef is equal to the block
+ size given explicitly in the variable declaration, then do not
+ complain. The easiest way to make this check was to create a
+ temporary type that is a clone of the element type and then set its
+ block size using the given layout qualifier. Then compare the block
+ size of the temporary (the declaration) to the block size specified
+ in the typedef. This complexity is needed, because the '[*]' block
+ size needs to be calculated, and the '[]' needs to be mapped into a
+ zero block size.
+
+2010-10-13 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c: Fix bug: negative layout qualifiers not diagnosed
+ as an error.
+ The CTED_UPC test c_A_1_3_b.upc, specified a negative blocksize, but
+ it was not diagnosed as an error. With this fix, negative block
+ sizes will generate a translation error.
+
+2010-10-10 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix bug: ICE: two or more layout qualifiers
+ specified
+ The compiler properly detected the presence of two or more layout
+ qualifiers as an error, but then hit an assertion check, because the
+ code that followed the error expected to see a qualifier and not a
+ layout specifier. The fix is simple: just return immediately after
+ detecting the error.
+
+2010-10-10 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Improve error diagnostics for various cases of UPC
+ shared array type declarations.
+ Add the check for this error: "In the dynamic translation
+ environment, THREADS may not appear in declarations of shared arrays
+ with indefinite block size". Also, fix up a few of the other
+ related error diagnostics.
+
+2010-10-10 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c: Fix bug: ICE: Attempt to take the difference of
+ shared and non-shared pointers
+ The compiler detected the error, and then tried to return
+ error_mark_node. This apparently is not acceptable, as there is an
+ explicit assertion check to prevent this from happening in
+ build_binary_op. Return the more user-friendly size_one_node
+ instead.
+
+2010-10-09 Gary Funck <gary@intrepid.com>
+
+ * c-common.c: Fix bug: segfault on incomplete array definition.
+ This turned out to be a bit complicated. The logic in
+ upc_lang_layout_decl had to be re-arranged to avoid trying to lookup
+ the THREADS identifier in the case where the blocking factor has
+ been set to indefinite ([]). This can happen when indefinite array
+ declarations are processed for shared arrays. At that time, the
+ file scope has been closed and THREADS is no longer in scope. Some
+ more work is needed on upc_lang_layout_decl(). It has some
+ duplication, and notably duplicates the two branches of the if
+ having to do with TYPE_SIZE and TYPE_SIZE_UNIT, that appear in the
+ caller of this routine (layout_decl()).
+ The method of forcing a layout qualifier of [] in the indefinite
+ declaration handler is odd a well. The code that just does the
+ setting of the block factor, needs to moved into its own routine
+ that doesn't depend upon a declspec for '[]' to be passed in, just
+ in order to set the blocking factor to some value (in this case, 0).
+ Also, the logic for how that shared type is constructed is strange.
+ First the type with 0 blocking factor is set. Then the shared
+ qualifier is removed from the type, and then added back later. The
+ intermediate type has a blocking factor set, but it has no shared
+ qualifier. Fixing this will require some thought. It is tempting
+ just to make indefinite shared arrays an error, rather than forcing
+ the dimension to be '1'.
+ This likely fixes a serious error in the previous update to
+ upc_lang_layout_decl(), where it didn't have the logic to set
+ TYPE_SIZE_UNIT() in the main part of the 'if' statement. This means
+ the previous update would fail on many tests.
+
+2010-10-09 Gary Funck <gary@intrepid.com>
+
+ * varasm.c: Add an assertion check for the case that DECL_SIZE_UNIT
+ (decl) is null, which can happen if some layout error occurred
+ upstream.
+
+2010-10-09 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix bug: file scope shared arrays mis-diagnosed as
+ "variable-sized" when compiled in dynamic threads.
+ This long-standing bug is easily fixed. Just check
+ for the situation that the non-constant sized type is shared and
+ that it does not have a dimension that references a multiple of
+ threads. If this criteria is met, then issue a meaningful
+ diagnostic.
+
+2010-10-09 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c: Fix bug: segfault on incomplete array definition.
+ This turned out to be a bit complicated. The logic in
+ upc_lang_layout_decl had to be re-arranged to avoid trying to lookup
+ the THREADS identifier in the case where the blocking factor has
+ been set to indefinite ([]). This can happen when indefinite array
+ declarations are processed for shared arrays. At that time, the
+ file scope has been closed and THREADS is no longer in scope. Some
+ more work is needed on upc_lang_layout_decl(). It has some
+ duplication, and notably duplicates the two branches of the if
+ having to do with TYPE_SIZE and TYPE_SIZE_UNIT, that appear in the
+ caller of this routine (layout_decl()).
+ The method of forcing a layout qualifier of [] in the indefinite
+ declaration handler is odd a well. The code that just does the
+ setting of the block factor, needs to moved into its own routine
+ that doesn't depend upon a declspec for '[]' to be passed in, just
+ in order to set the blocking factor to some value (in this case, 0).
+ Also, the logic for how that shared type is constructed is strange.
+ First the type with 0 blocking factor is set. Then the shared
+ qualifier is removed from the type, and then added back later. The
+ intermediate type has a blocking factor set, but it has no shared
+ qualifier. Fixing this will require some thought. It is tempting
+ just to make indefinite shared arrays an error, rather than forcing
+ the dimension to be '1'.
+ This likely fixes a serious error in the previous update to
+ upc_lang_layout_decl(), where it didn't have the logic to set
+ TYPE_SIZE_UNIT() in the main part of the 'if' statement. This means
+ the previous update would fail on many tests.
+ See also: gcc/c-common.c gcc/upc/upc-act.c
+
+2010-10-01 Gary Funck <gary@intrepid.com>
+
+ * configure, configure.ac: Update manual page, and bug reporting
+ URL.
+ Update "man" page to reflect debugging switches. Also, some general
+ clean up. Change the bug reporting URL to point to gccupc.org.
+
+2010-10-01 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-manpage.html, upc.1: Update manual page, and bug reporting
+ URL.
+ Update "man" page to reflect debugging switches. Also, some general
+ clean up. Change the bug reporting URL to point to gccupc.org.
+ See also: gcc/configure gcc/configure.ac gcc/upc/upc-manpage.html
+ gcc/upc/upc.1
+
+2010-10-01 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c: Do not zap all qualifier bits when constructing a
+ non-shared result node.
+ This fix was suggested by Paul H. in the following Berkeley Bugzilla
+ report: https://upc-bugs.lbl.gov/bugzilla/show_bug.cgi?id=2061 The
+ use of "!" rather than "~" zapped all the type qualifier bits rather
+ than just those that are related to the "shared" qualifier. This
+ fix clears only the relevant bits.
+
+2010-09-27 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c, config/upc-conf.h: Issue a descriptive message when
+ the UPC forall depth count variable is not found.
+ The __upc_forall_depth variable should be defined in gcc-upc-lib.h.
+ The compiler will generate code that references this variable in
+ order to implement nested upc_forall semantics. If there is a
+ compiler build or install problem, this variable may not be found.
+ In this case, terminate with an internal_error().
+
+2010-09-26 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c: Fix Bug 240: upc_forall with empty clauses
+ mis-diagnosed as syntax error.
+ Fix a failure exhibited by the Berkeley test case,
+ bug873a.upc, which has the code:
+ double d;
+ upc_forall (;;;d) {...} The compiler did not properly handle
+ the empty "condition" clause, and did not recover well when it was
+ determined that the use of a double value, "d" above, was neither a
+ pointer-to-shared nor an integer expression. The update implements a
+ fix for both issues.
+ See also: gcc/c-parser.c gcc/upc/upc-act.c
+
+2010-09-26 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c: Fix bug: upc_forall with empty clauses
+ mis-diagnosed as syntax error.
+ A failure was exhibited by the Berkeley test case,
+ bug873a.upc, which has the code:
+ double d;
+ upc_forall (;;;d) {...} The compiler did not properly handle
+ the empty "condition" clause, and did not recover well when it was
+ determined that the use of a double value, "d" above, was neither a
+ pointer-to-shared nor an integer expression. The update implements a
+ fix for both issues.
+ See also: gcc/c-parser.c gcc/upc/upc-act.c
+
+2010-09-25 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-pts-struct.c: Fix an ICE on 32-bit/struct target: failed
+ gimple check when calculating affinity for upc_forall.
+ Intrepid test, test10.upc, failed to compile due a mis-match between
+ the COMPONENT_REF node and the internal 'thread' field. Changed the
+ code to make the types agree, and added a conversion to sizetype if
+ necessary.
+
+2010-09-23 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix Bug 29: Layout qualifier within a typedef is not
+ incorporated into the referencing type.
+ This was semi-fixed a few times before. This update fixes a few
+ more places where the layout qualifier wasn't being propagated
+ through typedef's properly. What made this a bit tricky is shown in
+ the example cited in the bug report:
+ typedef shared [5] int A_t; A_t A[5*THREADS];
+ In the typedef, the blocksize is being applied to a shared *scalar*,
+ and the code was applying the blocksize only to arrays. This update
+ handles shared scalars correctly.
+
+2010-09-23 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c: Fix bug: ICE: '[*]' layout factor applied to array
+ with static threads and size not a multiple of threads.
+ Add an extra check for an attempt to apply a '[*]' layout qualifier
+ to a shared array that does not specify a size that is a multiple of
+ THREADS, when compiled in a static THREADS compilation environment.
+
+2010-09-22 Gary Funck <gary@intrepid.com>
+
+ * c-parser.c, c-tree.h, stub-upc.c: Fix Bug 403: Nested
+ upc_forall() semantics are not implemented
+ The checkforall test in the Berkeley harness test suite indicated
+ that GCC/UPC was not properly implementing nested upc_forall
+ semantics. Nested upc_forall statements (both statically or
+ dynamically nested) must implement their affinity clause as if it
+ were "continue"; thus all steps in the loop must execute without
+ regard for affinity. To implement these semantics a global depth
+ counter, __upc_forall_depth, is maintained by the generated code
+ that implements upc_forall.
+ See also: gcc/c-parser.c gcc/c-tree.h gcc/stub-upc.c
+ gcc/upc/upc-act.c gcc/upc/upc-act.h libupc/include/gcc-upc-lib.in
+ libupc/include/upc.h libupc/smp/upc_main.c
+
+2010-09-22 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c, upc/upc-act.h: Fix bug: Nested upc_forall() semantics
+ are not implemented
+ The checkforall test in the Berkeley harness test suite indicated
+ that GCC/UPC was not properly implementing nested upc_forall
+ semantics. Nested upc_forall statements (both statically or
+ dynamically nested) must implement their affinity clause as if it
+ were "continue"; thus all steps in the loop must execute without
+ regard for affinity. To implement these semantics a global depth
+ counter, __upc_forall_depth, is maintained by the generated code
+ that implements upc_forall.
+ See also: gcc/c-parser.c gcc/c-tree.h gcc/stub-upc.c
+ gcc/upc/upc-act.c gcc/upc/upc-act.h libupc/include/gcc-upc-lib.in
+ libupc/include/upc.h libupc/smp/upc_main.c
+
+2010-09-19 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: c-decl.c: zero out the layout specifier, after
+ processing an array type.
+ Fix the previous fix, that moved the setting of the type's layout
+ qualifier to the outside of the array type processing loop. What is
+ missing from the fix is that the layout_qualifier variable needs to
+ be cleared after setting the type's blocksize.
+
+2010-09-19 Gary Funck <gary@intrepid.com>
+
+ * config/upc-conf.h: Fix Bug 375: error message is off-by-one when
+ given blocksize is greater than UPC_MAX_BLOCKSIZE.
+ The value we were using for UPC_MAX_BLOCK_SIZE was one bigger than
+ the actual maximum block size. Therefore, the message was correct,
+ but the underlying value that was being checked was wrong. Change
+ the values so that they agree with the actual implementation-defined
+ limit.
+
+2010-09-18 Gary Funck <gary@intrepid.com>
+
+ * upc/upc-act.c, upc/upc-pts-packed.c, upc/upc-pts-struct.c:
+ Implement -fupc-debug switch.
+
+2010-09-11 Gary Funck <gary@intrepid.com>
+
+ * c-decl.c: Fix Bug 402: ICE: '[*]' layout factor on
+ multi-dimensional shared array with dynamic threads.
+ This declaration caused an internal compiler error when compiled
+ with dynamic threads:
+ shared [*] int A[THREADS][16]; The bug was discovered when
+ compiling the RTED_UPC test suite.
+ The fix is to process layout qualifiers after the entire array type
+ has been built. Otherwise, we try to calculate the blocksize on a
+ shared array type that has not had its "size depends upon the value
+ of THREADS" flag set.
+ Also, added a test case.
+ See also: libupc/testsuite/libupc.upc/intrepid/test18.upc
+
+2010-07-11 Gary Funck <gary@intrepid.com>
+
+ Fix a bug where a statement in c_build_qualified_type()
+ in the trunk had been inadvertently deleted.
+ This bug showed up in the IA64 port, because jmpbuf's
+ on that architecture must be 16 byte aligned, and they were not.
+ c-typeck.c (c_build_qualified_type): Revive the deleted line.
+
+2010-07-08 Gary Funck <gary@intrepid.com>
+
+ Make changes so that other language compilers
+ will build and bootstrap.
+ * c-family/c-common.c (compiling_upc, flag_upc,
+ flag_upc_instrument, flag_upc_instrument_functions,
+ use_upc_dwarf2_extensions): Move to stub-upc.c and
+ upc-lang.c.
+ * c-family/c-common.h (use_upc_dwarf2_extensions,
+ compiling_upc): Add extern definitions - needed
+ to compile/build other language front ends.
+ * c-family/c.opt: Fix the spelling of ObjC.
+ It had been incorrectly spelled as Objc.
+ * c-family/c.opt: Add UPC for the various switches
+ that are valid for both C and ObjC.
+ * c-family/c-opts.c: Add CL_UPC to the list of
+ supported options switches when compiling assembly
+ language.
+ * lto/lto-lang.c (use_upc_dwarf2_extensions,
+ flag_upc_instrument, flag_upc_instrument_functions):
+ Remove these definitions. They have been moved
+ to c-family/stub-upc.c.
+ * upc/ChangeLog: Move relevant entries
+ to ChangeLog.upc.
+ * c-family/stub-upc.c (compiling_upc, flag_upc,
+ flag_upc_instrument, flag_upc_instrument_functions,
+ use_upc_dwarf2_extensions): Moved from c-common.c
+ * upc/upc-lang.c (compiling_upc, flag_upc,
+ flag_upc_instrument, flag_upc_instrument_functions,
+ use_upc_dwarf2_extensions): Moved from c-common.c
+ * objc/objc-act.c (objc_gimplify_expr): Add additional
+ parameters to c_gimplify_expr() call, that are used
+ by upc's tree rewrites.
+ * cp/cp-gimplify.c (cp_gimplify_expr): Likewise.
+ * gcc/cp/lex.c (init_reswords): If not compiling
+ UPC, then mask off the UPC keywords.
+ * cp/Make-lang.in (C_STUB_OBJS): Use this
+ make macro to link with c-family/stub-objc.o
+ and c-family/stub-upc.o.
+ * fortran/Make-lang.in (C_STUB_OBJS): Likewise.
+ * java/Make-lang.in (C_STUB_OBJS): Likewise.
+ * objc/Make-lang.in: Link with c-family/stub-upc.o
+ to avoid undefined references.
+ c-parser.c: Fix line indentation.
+ * libcpp/include/cpplib.h: Remove CL_UPC from
+ the list of language kinds accepted by the
+ C preprocessor. This is not necessary because
+ UPC is a derivative of C99, and does not need
+ a different language kind.
+ * c-family/c-opts.c (c_common_handle_option):
+ Call set_std_c99() when processing the
+ "--lang upc" switch, instead of setting the
+ language kind to CL_UPC.
+ * libupc/testsuite/libupc.upc/intrepid/ChangeLog: New.
+
+2010-07-03 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 161517 into gupc branch.
+ * gcc/stub-upc.c: Move to gcc/c-family/.
+ * libupc/testsuite/libupc.upc/intrepid/test19.upc:
+ Add 'unused' attributes to avoid "set, but
+ not referenced" warnings.
+ * libupc/testsuite/libupc.upc/intrepid/test18.upc:
+ Likewise.
+
+2010-07-03 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 161517 into gupc branch.
+ * upc/config-lang.in: Update references to files
+ moved into c-family/.
+ * upc/Make-lang.in: Likewise.
+ * upc/upc-act.c: Likewise.
+ * upc/upc-gasp.c: Likewise.
+ * upc/upc-gimplify.c: Likewise.
+ * upc/upc-lang.c: Likewise.
+ * upc/upc-pts-packed.c: Likewise.
+ * upc/upc-pts-struct.c: Likewise.
+ * upc/upc-act.c: (upc_handle_option) add parameters to
+ effect pass through call to c_common_handle_option.
+ * upc/upc-act.h: (upc_handle_option) Likewise.
+ * upc/upc-act.c: (map_unshared_var) used typed ggc allocation.
+ * upc/upc-act.c: (upc_build_init_func) add call to
+ to mark_decl_referenced(), to ensure that UPC shared
+ variable initializer function is not removed from
+ the call tree graph.
+
+2010-03-01 Gary Funck <gary@intrepid.com>
+
+ Create gupc branch from trunk version 157149.
diff --git a/gcc/DEV-PHASE b/gcc/DEV-PHASE
index e69de29bb2d..333991260ba 100644
--- a/gcc/DEV-PHASE
+++ b/gcc/DEV-PHASE
@@ -0,0 +1 @@
+GNU UPC 6.0.1-1
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6c5adc0bb58..15276fdea05 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2960,7 +2960,7 @@ install-no-fixedincludes:
doc: $(BUILD_INFO) $(GENERATED_MANPAGES)
-INFOFILES = doc/cpp.info doc/gcc.info doc/gccint.info \
+INFOFILES = doc/cpp.info doc/gcc.info doc/gupc.info doc/gccint.info \
doc/gccinstall.info doc/cppinternals.info
info: $(INFOFILES) lang.info @GENINSRC@ srcinfo lang.srcinfo
@@ -2992,6 +2992,8 @@ TEXI_GCCINT_FILES = gccint.texi gcc-common.texi gcc-vers.texi \
loop.texi generic.texi gimple.texi plugins.texi optinfo.texi \
match-and-simplify.texi
+TEXI_GUPC_FILES = gupc.texi gcc-common.texi gcc-vers.texi
+
TEXI_GCCINSTALL_FILES = install.texi install-old.texi fdl.texi \
gcc-common.texi gcc-vers.texi
@@ -3018,6 +3020,7 @@ gcc-vers.texi: $(BASEVER) $(DEVPHASE)
doc/cpp.info: $(TEXI_CPP_FILES)
doc/gcc.info: $(TEXI_GCC_FILES)
+doc/gupc.info: $(TEXI_GUPC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)
@@ -3098,7 +3101,7 @@ $(build_htmldir)/gccinstall/index.html: $(TEXI_GCCINSTALL_FILES)
DESTDIR=$(@D) \
$(SHELL) $(srcdir)/doc/install.texi2html
-MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 \
+MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gupc.1 doc/gfdl.7 doc/gpl.7 \
doc/fsf-funding.7 doc/gcov-tool.1
generated-manpages: man
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index f2846bb26e7..9afa214c0cf 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -228,6 +228,20 @@ int print_struct_values;
const char *constant_string_class_name;
+/* UPC language option variables. */
+
+/* Nonzero whenever UPC -fupc-threads=N is asserted.
+ The value N gives the number of UPC threads to be
+ defined at compile-time. */
+int flag_upc_threads;
+
+/* Nonzero whenever UPC -fupc-pthreads-model-* is asserted. */
+int flag_upc_pthreads;
+
+/* The implementation model for UPC threads that
+ are mapped to POSIX threads, specified at compilation
+ time by the -fupc-pthreads-model-* switch. */
+upc_pthreads_model_kind upc_pthreads_model;
/* C++ language option variables. */
@@ -406,8 +420,9 @@ static int resort_field_decl_cmp (const void *, const void *);
C --std=c89: D_C99 | D_CXXONLY | D_OBJC | D_CXX_OBJC
C --std=c99: D_CXXONLY | D_OBJC
ObjC is like C except that D_OBJC and D_CXX_OBJC are not set
- C++ --std=c98: D_CONLY | D_CXXOX | D_OBJC
- C++ --std=c0x: D_CONLY | D_OBJC
+ UPC is like C except that D_UPC is not set
+ C++ --std=c98: D_CONLY | D_CXXOX | D_OBJC | D_UPC
+ C++ --std=c0x: D_CONLY | D_OBJC | D_UPC
ObjC++ is like C++ except that D_OBJC is not set
If -fno-asm is used, D_ASM is added to the mask. If
@@ -623,6 +638,19 @@ const struct c_common_resword c_common_reswords[] =
{ "inout", RID_INOUT, D_OBJC },
{ "oneway", RID_ONEWAY, D_OBJC },
{ "out", RID_OUT, D_OBJC },
+
+ /* UPC keywords */
+ { "shared", RID_SHARED, D_UPC },
+ { "relaxed", RID_RELAXED, D_UPC },
+ { "strict", RID_STRICT, D_UPC },
+ { "upc_barrier", RID_UPC_BARRIER, D_UPC },
+ { "upc_blocksizeof", RID_UPC_BLOCKSIZEOF, D_UPC },
+ { "upc_elemsizeof", RID_UPC_ELEMSIZEOF, D_UPC },
+ { "upc_forall", RID_UPC_FORALL, D_UPC },
+ { "upc_localsizeof", RID_UPC_LOCALSIZEOF, D_UPC },
+ { "upc_notify", RID_UPC_NOTIFY, D_UPC },
+ { "upc_wait", RID_UPC_WAIT, D_UPC },
+
/* These are recognized inside a property attribute list */
{ "assign", RID_ASSIGN, D_OBJC },
{ "copy", RID_COPY, D_OBJC },
@@ -4252,6 +4280,11 @@ pointer_int_sum (location_t loc, enum tree_code resultcode,
/* The result is a pointer of the same type that is being added. */
tree result_type = TREE_TYPE (ptrop);
+ /* If the pointer lives in UPC shared memory, then
+ drop the 'shared' qualifier. */
+ if (TREE_SHARED (ptrop) || SHARED_TYPE_P (result_type))
+ result_type = build_unshared_type (result_type);
+
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
{
if (complain && warn_pointer_arith)
@@ -4667,6 +4700,17 @@ c_apply_type_quals_to_decl (int type_quals, tree decl)
|| !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type)))
error ("invalid use of %<restrict%>");
}
+ if (type_quals & TYPE_QUAL_SHARED)
+ {
+ TREE_SHARED (decl) = 1;
+ if (type_quals & TYPE_QUAL_STRICT)
+ TREE_STRICT(decl) = 1;
+ else if (type_quals & TYPE_QUAL_RELAXED)
+ TREE_RELAXED(decl) = 1;
+ /* The declaration's type should have been previously defined
+ as a UPC shared type. */
+ gcc_assert (SHARED_TYPE_P (type));
+ }
}
struct c_type_hasher : ggc_ptr_hash<tree_node>
@@ -4783,6 +4827,18 @@ c_common_get_alias_set (tree t)
return get_alias_set (t1);
}
+ /* For the time being, make UPC pointers-to-shared conflict
+ with everything else. Ideally, UPC pointers-to-shared should
+ only conflict with the internal type used to represent
+ the UPC pointer-to-shared (i.e., upc_pts_rep_type_node). */
+
+ if (TYPE_P (t) ? (TREE_CODE (t) == POINTER_TYPE
+ && SHARED_TYPE_P (TREE_TYPE (t)))
+ : (TREE_TYPE(t)
+ && TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE
+ && SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (t)))))
+ return 0;
+
/* Handle the case of multiple type nodes referring to "the same" type,
which occurs with IMA. These share an alias set. FIXME: Currently only
C90 is handled. (In C99 type compatibility is not transitive, which
@@ -4840,6 +4896,44 @@ c_common_get_alias_set (tree t)
return -1;
}
+/* Return the value of THREADS.
+
+ UPC defines a reserved variable, THREADS, which returns the
+ number of threads that will be created when the UPC program
+ executes. The value of threads can be specified at runtime via
+ the -fupc-threads=N switch, where N is an integer specifying
+ the number of threads. When the value of THREADS is specified
+ at compile-time, this is called the "static threads compilation
+ environment".
+
+ In the static threads compilation environment, THREADS is a
+ pre-defined preprocessor macro with the value, N.
+
+ If no value for threads is given at compile-time, then the value
+ must be specified when the application program is executed.
+ This method of establishing the value of THREADS is called
+ the "dynamic threads compilation environment". */
+
+tree
+upc_num_threads (void)
+{
+ tree n;
+ gcc_assert (flag_upc);
+ n = flag_upc_threads ? ssize_int (flag_upc_threads)
+ : lookup_name (get_identifier ("THREADS"));
+ if (!n)
+ {
+ error ("the UPC-required THREADS variable is undefined; "
+ "when compiling pre-processed source, "
+ "all -fupc-* switches must be passed on the command line, "
+ "asserting the same values as supplied when the "
+ "original source file was preprocessed");
+ abort ();
+ }
+
+ return n;
+}
+
/* Compute the value of 'sizeof (TYPE)' or '__alignof__ (TYPE)', where
the IS_SIZEOF parameter indicates which operator is being applied.
The COMPLAIN flag controls whether we should diagnose possibly
@@ -4886,11 +4980,16 @@ c_sizeof_or_alignof_type (location_t loc,
}
else if (type_code == VOID_TYPE || type_code == ERROR_MARK)
{
- if (type_code == VOID_TYPE
- && complain && warn_pointer_arith)
- pedwarn (loc, OPT_Wpointer_arith,
- "invalid application of %qs to a void type", op_name);
- else if (!complain)
+ if (complain)
+ {
+ if (type_code == VOID_TYPE && SHARED_TYPE_P (type))
+ error_at (loc, "invalid application of %qs"
+ " to %<shared void%> type", op_name);
+ else if (type_code == VOID_TYPE && warn_pointer_arith)
+ pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith,
+ "invalid application of %qs to a void type", op_name);
+ }
+ else
return error_mark_node;
value = size_one_node;
}
@@ -4923,6 +5022,14 @@ c_sizeof_or_alignof_type (location_t loc,
value = size_int (TYPE_ALIGN_UNIT (type));
}
+ if (is_sizeof && (TREE_CODE (type) == ARRAY_TYPE)
+ && SHARED_TYPE_P (type)
+ && TYPE_HAS_THREADS_FACTOR (type))
+ {
+ const tree n_threads = convert (sizetype, upc_num_threads ());
+ value = size_binop (MULT_EXPR, value, n_threads);
+ }
+
/* VALUE will have the middle-end integer type sizetype.
However, we should really return a value of type `size_t',
which is just a typedef for an ordinary integer type. */
@@ -10618,6 +10725,10 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default)
}
type = *ptype;
+ /* Force an indefinite UPC blocking factor. */
+ if (SHARED_TYPE_P (type))
+ type = c_build_qualified_type (type, TYPE_QUAL_SHARED,
+ size_zero_node);
elt = TREE_TYPE (type);
quals = TYPE_QUALS (strip_array_types (elt));
if (quals == 0)
@@ -12429,6 +12540,8 @@ c_common_init_ts (void)
MARK_TS_TYPED (C_MAYBE_CONST_EXPR);
MARK_TS_TYPED (EXCESS_PRECISION_EXPR);
MARK_TS_TYPED (ARRAY_NOTATION_REF);
+ MARK_TS_COMMON (UPC_FORALL_STMT);
+ MARK_TS_COMMON (UPC_SYNC_STMT);
}
/* Build a user-defined numeric literal out of an integer constant type VALUE
diff --git a/gcc/c-family/c-common.def b/gcc/c-family/c-common.def
index 1d3ee5316b6..a7fe20f49ec 100644
--- a/gcc/c-family/c-common.def
+++ b/gcc/c-family/c-common.def
@@ -62,6 +62,24 @@ DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", tcc_expression, 1)
Operand 3 is the stride. */
DEFTREECODE (ARRAY_NOTATION_REF, "array_notation_ref", tcc_reference, 4)
+/* Used to represent a `upc_forall' statement. The operands are
+ UPC_FORALL_INIT_STMT, UPC_FORALL_COND, UPC_FORALL_EXPR,
+ UPC_FORALL_BODY, and UPC_FORALL_AFFINITY respectively. */
+
+DEFTREECODE (UPC_FORALL_STMT, "upc_forall_stmt", tcc_statement, 5)
+
+/* Used to represent a UPC synchronization statement. The first
+ operand is the synchronization operation, UPC_SYNC_OP:
+ UPC_SYNC_NOTIFY_OP 1 Notify operation
+ UPC_SYNC_WAIT_OP 2 Wait operation
+ UPC_SYNC_BARRIER_OP 3 Barrier operation
+
+ The second operand, UPC_SYNC_ID is the (optional) expression
+ whose value specifies the barrier identifier which is checked
+ by the various synchronization operations. */
+
+DEFTREECODE (UPC_SYNC_STMT, "upc_sync_stmt", tcc_statement, 2)
+
/*
Local variables:
mode:c
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index dd74d0dd62e..185a80e55d3 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -54,9 +54,9 @@ never after.
*/
/* Reserved identifiers. This is the union of all the keywords for C,
- C++, and Objective-C. All the type modifiers have to be in one
+ C++, Objective-C, and UPC. All the type modifiers have to be in one
block at the beginning, because they are used as mask bits. There
- are 28 type modifiers; if we add many more we will have to redesign
+ are 31 type modifiers; if we add many more we will have to redesign
the mask mechanism. */
enum rid
@@ -69,6 +69,9 @@ enum rid
RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT,
RID_NORETURN, RID_ATOMIC,
+ /* UPC type qualifiers */
+ RID_SHARED, RID_RELAXED, RID_STRICT,
+
/* C extensions */
RID_COMPLEX, RID_THREAD, RID_SAT,
@@ -173,6 +176,11 @@ enum rid
RID_AT_INTERFACE,
RID_AT_IMPLEMENTATION,
+ /* UPC */
+ RID_UPC_BARRIER, RID_UPC_BLOCKSIZEOF, RID_UPC_ELEMSIZEOF,
+ RID_UPC_FORALL, RID_UPC_LOCALSIZEOF,
+ RID_UPC_NOTIFY, RID_UPC_WAIT,
+
/* Named address support, mapping the keyword to a particular named address
number. Named address space 0 is reserved for the generic address. If
there are more than 254 named addresses, the addr_space_t type will need
@@ -221,6 +229,10 @@ enum rid
RID_FIRST_CXX11 = RID_CONSTEXPR,
RID_LAST_CXX11 = RID_STATIC_ASSERT,
+ RID_FIRST_UPC_QUAL = RID_SHARED,
+ RID_LAST_UPC_QUAL = RID_STRICT,
+ RID_FIRST_UPC_KW = RID_UPC_BARRIER,
+ RID_LAST_UPC_KW = RID_UPC_WAIT,
RID_FIRST_AT = RID_AT_ENCODE,
RID_LAST_AT = RID_AT_IMPLEMENTATION,
RID_FIRST_PQ = RID_IN,
@@ -253,6 +265,13 @@ enum rid
|| rid == RID_PUBLIC || rid == RID_PROTECTED || rid == RID_PRIVATE \
|| rid == RID_TRY || rid == RID_THROW || rid == RID_CATCH)
+/* Test whether a reserved ID designates a UPC keyword. */
+#define UPC_IS_KEYWORD(rid) \
+ (((unsigned int) (rid) >= (unsigned int) RID_FIRST_UPC_QUAL && \
+ (unsigned int) (rid) <= (unsigned int) RID_LAST_UPC_QUAL) || \
+ ((unsigned int) (rid) >= (unsigned int) RID_FIRST_UPC_KW && \
+ (unsigned int) (rid) <= (unsigned int) RID_LAST_UPC_KW))
+
/* The elements of `ridpointers' are identifier nodes for the reserved
type names and storage classes. It is indexed by a RID_... value. */
extern GTY ((length ("(int) RID_MAX"))) tree *ridpointers;
@@ -395,6 +414,7 @@ extern machine_mode c_default_pointer_mode;
#define D_CXXWARN 0x200 /* In C warn with -Wcxx-compat. */
#define D_CXX_CONCEPTS 0x400 /* In C++, only with concepts. */
#define D_TRANSMEM 0X800 /* C++ transactional memory TS. */
+#define D_UPC 0x1000 /* In UPC, and neither C nor C++. */
#define D_CXX_CONCEPTS_FLAGS D_CXXONLY | D_CXX_CONCEPTS
@@ -612,6 +632,25 @@ extern const char *pch_file;
extern int flag_iso;
+/* Nonzero whenever UPC -fupc-threads=N is asserted.
+ The value N gives the number of UPC threads to be
+ defined at compile-time. */
+extern int flag_upc_threads;
+
+/* Nonzero whenever UPC -fupc-pthreads-model-* is asserted. */
+extern int flag_upc_pthreads;
+
+typedef enum
+ {
+ upc_pthreads_no_model = 0,
+ upc_pthreads_tls_model = 1
+ } upc_pthreads_model_kind;
+
+/* The implementation model for UPC threads that
+ are mapped to POSIX threads, specified at compilation
+ time by the -fupc-pthreads-model-* switch. */
+extern upc_pthreads_model_kind upc_pthreads_model;
+
/* C/ObjC language option variables. */
@@ -865,7 +904,8 @@ extern tree pointer_int_sum (location_t, enum tree_code, tree, tree,
bool = true);
/* Add qualifiers to a type, in the fashion for C. */
-extern tree c_build_qualified_type (tree, int, tree = NULL_TREE, size_t = 0);
+extern tree c_build_qualified_type (tree, int, tree = NULL_TREE,
+ tree = NULL_TREE, size_t = 0);
/* Build tree nodes and builtin functions common to both C and C++ language
frontends. */
@@ -895,6 +935,7 @@ extern int self_promoting_args_p (const_tree);
extern tree strip_pointer_operator (tree);
extern tree strip_pointer_or_array_types (tree);
extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT);
+extern tree upc_num_threads (void);
/* This is the basic parsing function. */
extern void c_parse_file (void);
@@ -1115,6 +1156,9 @@ extern void c_stddef_cpp_builtins (void);
extern void fe_file_change (const line_map_ordinary *);
extern void c_parse_error (const char *, enum cpp_ttype, tree, unsigned char);
+/* In c-lex.c */
+extern int c_header_level; /* In system header, if > 0. */
+
/* In c-ppoutput.c */
extern void init_pp_output (FILE *);
extern void preprocess_file (cpp_reader *);
@@ -1298,6 +1342,25 @@ c_tree_chain_next (tree t)
return NULL;
}
+/* Used to represent a UPC synchronization statement.
+ The first operand is the synchronization operation, UPC_SYNC_OP:
+ UPC_SYNC_NOTIFY_OP 1 Notify operation
+ UPC_SYNC_WAIT_OP 2 Wait operation
+ UPC_SYNC_BARRIER_OP 3 Barrier operation
+
+ The second operand, UPC_SYNC_ID is the (optional) expression
+ whose value specifies the barrier identifier which is checked
+ by the various synchronization operations. */
+
+#define UPC_SYNC_OP(NODE) TREE_OPERAND (UPC_SYNC_STMT_CHECK (NODE), 0)
+#define UPC_SYNC_ID(NODE) TREE_OPERAND (UPC_SYNC_STMT_CHECK (NODE), 1)
+
+/* Values of the first operand in a UPC_SYNC_STMT */
+
+#define UPC_SYNC_NOTIFY_OP 1 /* Notify operation */
+#define UPC_SYNC_WAIT_OP 2 /* Wait operation */
+#define UPC_SYNC_BARRIER_OP 3 /* Barrier operation */
+
/* Mask used by tm_stmt_attr. */
#define TM_STMT_ATTR_OUTER 2
#define TM_STMT_ATTR_ATOMIC 4
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 3d4587e6db6..2f63feaa3fb 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "stor-layout.h"
#include "flags.h"
#include "c-pragma.h"
+#include "c-upc-pts.h"
#include "output.h" /* For user_label_prefix. */
#include "debug.h" /* For dwarf2out_do_cfi_asm. */
#include "common/common-target.h"
@@ -766,6 +767,92 @@ cpp_iec_559_complex_value (void)
return ret;
}
+/* Return the section name with any leading "__DATA," or "__TEXT," removed.
+ (Darwin adds them to the section name). */
+static const char *
+strip_section_prefix (const char *section_name)
+{
+ const char *name = section_name;
+ if ((strncmp (name, "__DATA,", 7) == 0)
+ || (strncmp (name, "__TEXT,", 7) == 0))
+ name += 7;
+ return name;
+}
+
+/* Generate UPC specific pre-defined macros. */
+
+static void
+upc_cpp_builtins (cpp_reader * pfile)
+{
+ char def_buf[256];
+ cpp_define (pfile, "__UPC__=1");
+ cpp_define (pfile, "__GUPC__=1");
+ /* Define __GCC_UPC__ for backward compatibility. */
+ cpp_define (pfile, "__GCC_UPC__=1");
+ cpp_define (pfile, "__UPC_VERSION__=201311L");
+ (void) sprintf (def_buf, "UPC_MAX_BLOCK_SIZE=%lu",
+ (unsigned long) UPC_MAX_BLOCK_SIZE);
+ cpp_define (pfile, def_buf);
+ cpp_define (pfile, "__UPC_PTS_STRUCT_REP__=1");
+ (void) sprintf (def_buf, "__UPC_VADDR_TYPE__=%s", UPC_PTS_VADDR_TYPE);
+ cpp_define (pfile, def_buf);
+ (void) sprintf (def_buf, "__UPC_THREAD_TYPE__=%s", UPC_PTS_THREAD_TYPE);
+ cpp_define (pfile, def_buf);
+ (void) sprintf (def_buf, "__UPC_PHASE_TYPE__=%s", UPC_PTS_PHASE_TYPE);
+ cpp_define (pfile, def_buf);
+ (void) sprintf (def_buf, "__UPC_PTS_ALIGN__=%d",
+ (2 * POINTER_SIZE) / BITS_PER_UNIT);
+ cpp_define (pfile, def_buf);
+ cpp_define (pfile, "__UPC_VADDR_FIRST__=1");
+ (void) sprintf (def_buf, "__UPC_PTS_SIZE__=%d", UPC_PTS_SIZE);
+ cpp_define (pfile, def_buf);
+ (void) sprintf (def_buf, "__UPC_VADDR_SIZE__=%d", UPC_PTS_VADDR_SIZE);
+ cpp_define (pfile, def_buf);
+ (void) sprintf (def_buf, "__UPC_THREAD_SIZE__=%d", UPC_PTS_THREAD_SIZE);
+ cpp_define (pfile, def_buf);
+ (void) sprintf (def_buf, "__UPC_PHASE_SIZE__=%d", UPC_PTS_PHASE_SIZE);
+ cpp_define (pfile, def_buf);
+ if (flag_upc_threads)
+ {
+ cpp_define (pfile, "__UPC_STATIC_THREADS__=1");
+ (void) sprintf (def_buf, "THREADS=%d", flag_upc_threads);
+ cpp_define (pfile, def_buf);
+ }
+ else
+ {
+ cpp_define (pfile, "__UPC_DYNAMIC_THREADS__=1");
+ }
+ if (flag_upc_pthreads && (upc_pthreads_model == upc_pthreads_tls_model))
+ {
+ cpp_define (pfile, "__UPC_PTHREADS_MODEL_TLS__=1");
+ }
+ /* If debugging or instrumentation is enabled,
+ then disable inlining of the runtime. */
+ if (flag_upc_debug || flag_upc_instrument)
+ flag_upc_inline_lib = 0;
+ /* If -f[no-]upc-inline-lib hasn't been asserted, force inlining of the
+ runtime library if optimization is enabled. */
+ if (flag_upc_inline_lib < 0)
+ flag_upc_inline_lib = (optimize >= 1);
+ if (flag_upc_inline_lib)
+ cpp_define (parse_in, "__UPC_INLINE_LIB__=1");
+ /* UPC profiling instrumentation code will be generated. */
+ if (flag_upc_instrument)
+ {
+ cpp_define (parse_in, "__UPC_PUPC_INST__=1");
+ }
+ if (targetm.upc.link_script_p ())
+ {
+ cpp_define (parse_in, "__UPC_LINK_SCRIPT__=1");
+ }
+ builtin_define_with_value ("__UPC_SHARED_SECTION_NAME__",
+ strip_section_prefix (targetm.upc.shared_section_name ()), 0);
+ builtin_define_with_value ("__UPC_PGM_INFO_SECTION_NAME__",
+ strip_section_prefix (targetm.upc.pgm_info_section_name ()), 0);
+ builtin_define_with_value ("__UPC_INIT_ARRAY_SECTION_NAME__",
+ strip_section_prefix (targetm.upc.init_array_section_name ()), 0);
+}
+
/* Hook that registers front end and target-specific built-ins. */
void
c_cpp_builtins (cpp_reader *pfile)
@@ -1233,6 +1320,10 @@ c_cpp_builtins (cpp_reader *pfile)
if (flag_openmp)
cpp_define (pfile, "_OPENMP=201511");
+ /* Add UPC defines */
+ if (flag_upc)
+ upc_cpp_builtins (pfile);
+
for (i = 0; i < NUM_INT_N_ENTS; i ++)
if (int_n_enabled_p[i])
{
diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c
index 96da4fc974e..3db1aba5b05 100644
--- a/gcc/c-family/c-lex.c
+++ b/gcc/c-family/c-lex.c
@@ -35,7 +35,7 @@ static int header_time, body_time;
static splay_tree file_info_tree;
int pending_lang_change; /* If we need to switch languages - C++ only */
-int c_header_level; /* depth in C headers - C++ only */
+int c_header_level; /* depth in C headers - C++ and UPC */
static tree interpret_integer (const cpp_token *, unsigned int,
enum overflow_type *);
@@ -202,27 +202,27 @@ fe_file_change (const line_map_ordinary *new_map)
input_location = new_map->start_location;
(*debug_hooks->start_source_file) (line, LINEMAP_FILE (new_map));
-#ifndef NO_IMPLICIT_EXTERN_C
if (c_header_level)
++c_header_level;
else if (LINEMAP_SYSP (new_map) == 2)
{
c_header_level = 1;
+#ifndef NO_IMPLICIT_EXTERN_C
++pending_lang_change;
- }
#endif
+ }
}
}
else if (new_map->reason == LC_LEAVE)
{
-#ifndef NO_IMPLICIT_EXTERN_C
if (c_header_level && --c_header_level == 0)
{
if (LINEMAP_SYSP (new_map) == 2)
warning (0, "badly nested C headers from preprocessor");
+#ifndef NO_IMPLICIT_EXTERN_C
--pending_lang_change;
- }
#endif
+ }
input_location = new_map->start_location;
(*debug_hooks->end_source_file) (LINEMAP_LINE (new_map));
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index fec58bcf91f..31bed43663e 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h" /* For C_COMMON_OVERRIDE_OPTIONS. */
#include "diagnostic.h"
#include "c-pragma.h"
+#include "c-upc-pts.h"
#include "flags.h"
#include "toplev.h"
#include "langhooks.h"
@@ -208,6 +209,46 @@ c_common_init_options_struct (struct gcc_options *opts)
opts->x_flag_complex_method = 2;
}
+/* Initialize UPC-specific options. */
+static void
+upc_init_options ()
+{
+ struct cl_option_handlers handlers;
+
+ /* UPC is based upon the C99 dialect. Assert it here.
+ * We'll let the user override these options as he/she
+ * sees fit. For example, -traditional will disable
+ * prototype checking. */
+ set_std_c99 ( 0 /* iso=0 */ );
+
+ /* The consensus of the UPC community seems to be that
+ arithmetic on (void *) pointers and sizeof (void)
+ are compilation errors. Enable this warning-as-error
+ mode by default. */
+ warn_pointer_arith = 1;
+ set_default_handlers (&handlers);
+ control_warning_option (OPT_Wpointer_arith, (int) DK_ERROR, NULL, true,
+ UNKNOWN_LOCATION, CL_C,
+ &handlers, &global_options, &global_options_set,
+ global_dc);
+
+ /* By default, don't generate UPC's DWARF2 extensions. */
+ use_upc_dwarf2_extensions = 0;
+ flag_upc = 1;
+ flag_upc_threads = 0;
+ flag_upc_pthreads = 0;
+ /* By default, don't map UPC threads to POSIX threads. */
+ flag_upc_pthreads = 0;
+ upc_pthreads_model = upc_pthreads_no_model;
+ /* By default, GASP profiling is off. */
+ flag_upc_instrument = 0;
+ flag_upc_instrument_functions = 0;
+ /* By default, optimization level > 0 defines shared access routines
+ inlining, otherwise use the user specified flag to unconditionally
+ enable/disable inlining of the UPC shared memory access routines. */
+ flag_upc_inline_lib = -1;
+}
+
/* Common initialization before calling option handlers. */
void
c_common_init_options (unsigned int decoded_options_count,
@@ -235,15 +276,22 @@ c_common_init_options (unsigned int decoded_options_count,
{
/* The default for C is gnu11. */
set_std_c11 (false /* ISO */);
-
- /* If preprocessing assembly language, accept any of the C-family
- front end options since the driver may pass them through. */
for (i = 1; i < decoded_options_count; i++)
- if (decoded_options[i].opt_index == OPT_lang_asm)
- {
- accept_all_c_family_options = true;
- break;
- }
+ {
+ /* If preprocessing assembly language, accept any of the C-family
+ front end options since the driver may pass them through. */
+ if (decoded_options[i].opt_index == OPT_lang_asm)
+ {
+ accept_all_c_family_options = true;
+ break;
+ }
+ /* If compiling UPC, initialize appropriate default options. */
+ if (decoded_options[i].opt_index == OPT_fupc)
+ {
+ upc_init_options ();
+ break;
+ }
+ }
}
/* Set C++ standard to C++14 if not specified on the command line. */
@@ -253,6 +301,73 @@ c_common_init_options (unsigned int decoded_options_count,
global_dc->colorize_source_p = true;
}
+/* Process UPC specific command line switches */
+
+static bool
+upc_handle_option (const enum opt_code code, const char *arg, const int value)
+{
+ int result = 1;
+ if (!flag_upc)
+ {
+ error ("%s is supported only when -fupc is also present", arg);
+ return false;
+ }
+ switch (code)
+ {
+ default:
+ gcc_unreachable ();
+ break;
+ case OPT_fupc:
+ flag_upc = value;
+ break;
+ case OPT_dwarf_2_upc:
+ use_upc_dwarf2_extensions = value;
+ break;
+ case OPT_fupc_debug:
+ if ((value == 1) && (flag_upc_inline_lib == 1))
+ error ("-fupc-debug is incompatible with -fupc-inline-lib");
+ flag_upc_debug = value;
+ break;
+ case OPT_fupc_inline_lib:
+ if ((value == 1) && (flag_upc_instrument == 1))
+ error ("-fupc-inline-lib is incompatible with -fupc-instrument");
+ if ((value == 1) && (flag_upc_debug == 1))
+ error ("-fupc-inline-lib is incompatible with -fupc-debug");
+ flag_upc_inline_lib = value;
+ break;
+ case OPT_fupc_instrument:
+ if ((value == 1) && (flag_upc_inline_lib == 1))
+ error ("-fupc-instrument is incompatible with -fupc-inline-lib");
+ flag_upc_instrument = value;
+ break;
+ case OPT_fupc_instrument_functions:
+ if ((value == 1) && (flag_upc_inline_lib == 1))
+ error
+ ("-fupc-instrument-functions is incompatible "
+ "with -fupc-inline-lib");
+ flag_upc_instrument = value;
+ flag_upc_instrument_functions = value;
+ break;
+ case OPT_fupc_pthreads_model_tls:
+ flag_upc_pthreads = 1;
+ upc_pthreads_model = upc_pthreads_tls_model;
+ break;
+ case OPT_fupc_threads_:
+ {
+ int num_threads = value;
+ if (num_threads > UPC_MAX_THREADS)
+ {
+ error ("THREADS value exceeds UPC implementation limit of %d",
+ UPC_MAX_THREADS);
+ num_threads = 1;
+ }
+ flag_upc_threads = num_threads;
+ }
+ break;
+ }
+ return result;
+}
+
/* Handle switch SCODE with argument ARG. VALUE is true, unless no-
form of an -f or -W option was given. Returns false if the switch was
invalid, true if valid. Use HANDLERS in recursive handle_option calls. */
@@ -536,6 +651,17 @@ c_common_handle_option (size_t scode, const char *arg, int value,
cpp_opts->ext_numeric_literals = value;
break;
+ case OPT_fupc:
+ case OPT_dwarf_2_upc:
+ case OPT_fupc_debug:
+ case OPT_fupc_inline_lib:
+ case OPT_fupc_instrument:
+ case OPT_fupc_instrument_functions:
+ case OPT_fupc_pthreads_model_tls:
+ case OPT_fupc_threads_:
+ result = upc_handle_option (code, arg, value);
+ break;
+
case OPT_idirafter:
add_path (xstrdup (arg), AFTER, 0, true);
break;
@@ -1062,6 +1188,9 @@ c_common_parse_file (void)
pch_init ();
push_file_scope ();
c_parse_file ();
+ /* Generate UPC global initialization code, if required. */
+ if (flag_upc)
+ (*lang_hooks.upc.write_global_init_func) ();
pop_file_scope ();
/* And end the main input file, if the debug writer wants it */
if (debug_hooks->start_end_main_source_file)
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index c73aa822104..80d3b50cd86 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "varasm.h"
#include "c-pragma.h"
+#include "langhooks.h"
#include "opts.h"
#include "plugin.h"
@@ -553,6 +554,240 @@ add_to_renaming_pragma_list (tree oldname, tree newname)
/* The current prefix set by #pragma extern_prefix. */
GTY(()) tree pragma_extern_prefix;
+/* variables used to implement #pragma upc semantics */
+#ifndef UPC_CMODE_STACK_INCREMENT
+#define UPC_CMODE_STACK_INCREMENT 32
+#endif
+static int pragma_upc_permitted;
+static int upc_cmode;
+static int *upc_cmode_stack;
+static int upc_cmode_stack_in_use;
+static int upc_cmode_stack_allocated;
+
+static void init_pragma_upc (void);
+static void handle_pragma_upc (cpp_reader * ARG_UNUSED (dummy));
+
+/* Initialize the variables used to manage the current UPC consistency
+ mode (strict/relaxed). */
+
+static void
+init_pragma_upc (void)
+{
+ pragma_upc_permitted = 0;
+ upc_cmode = 0;
+ upc_cmode_stack = (int *) xcalloc (UPC_CMODE_STACK_INCREMENT,
+ sizeof (int));
+ upc_cmode_stack_allocated = UPC_CMODE_STACK_INCREMENT;
+ upc_cmode_stack_in_use = 0;
+}
+
+/*
+ * #pragma upc strict
+ * #pragma upc relaxed
+ * #pragma upc upc_code
+ * #pragma upc c_code
+ */
+static void
+handle_pragma_upc (cpp_reader * ARG_UNUSED (dummy))
+{
+ tree x;
+ enum cpp_ttype t;
+ enum upc_pragma_op {p_strict, p_relaxed, p_upc_code,
+ p_c_code, p_detect_upc, p_unknown};
+ enum upc_pragma_op upc_pragma = p_unknown;
+
+ t = pragma_lex (&x);
+ if (t == CPP_NAME)
+ {
+ const char *op = IDENTIFIER_POINTER (x);
+ if (!strcmp (op, "strict"))
+ upc_pragma = p_strict;
+ else if (!strcmp (op, "relaxed"))
+ upc_pragma = p_relaxed;
+ else if (!strcmp (op, "upc_code"))
+ upc_pragma = p_upc_code;
+ else if (!strcmp (op, "c_code"))
+ upc_pragma = p_c_code;
+ else if (!strcmp (op, "detect_upc"))
+ {
+ const char *detect_op;
+ upc_pragma = p_detect_upc;
+ t = pragma_lex (&x);
+ if (t != CPP_NAME)
+ GCC_BAD ("missing [suspend_insertion|resume_insertion]"
+ " after %<#pragma UPC detect_upc%>");
+ detect_op = IDENTIFIER_POINTER (x);
+ if (strcmp (detect_op, "suspend_insertion") == 0)
+ /* no action */;
+ else if (strcmp (detect_op, "resume_insertion") == 0)
+ /* no action */;
+ else
+ GCC_BAD ("expected [suspend_insertion|resume_insertion]"
+ " after %<#pragma UPC detect_upc%>");
+ }
+ else
+ GCC_BAD2 ("unknown action '%s' for '#pragma upc' - ignored", op);
+ }
+ else
+ warning (OPT_Wpragmas, "missing parameter after #pragma upc");
+
+ t = pragma_lex (&x);
+ if (t != CPP_EOF)
+ warning (OPT_Wpragmas, "junk at end of #pragma upc");
+
+ if ((upc_pragma == p_strict) || (upc_pragma == p_relaxed))
+ {
+ if (pragma_upc_permitted_p ())
+ {
+ int consistency_mode = (upc_pragma == p_strict);
+ set_upc_consistency_mode (consistency_mode);
+ }
+ else
+ warning (OPT_Wpragmas, "#pragma upc not allowed in this context");
+ }
+ else if ((upc_pragma == p_upc_code) || (upc_pragma == p_c_code))
+ {
+ flag_upc = (upc_pragma == p_upc_code);
+ lang_hooks.upc.toggle_keywords (flag_upc);
+ }
+ else if (upc_pragma == p_detect_upc)
+ {
+ /* Skip: This is a Berkeley-specific pragma that requires no action. */
+ }
+}
+
+/* Set the current setting of the UPC consistency mode
+ that is in effect. */
+
+void
+set_upc_consistency_mode (int mode)
+{
+ upc_cmode = mode;
+}
+
+/* Return the current setting of the UPC consistency mode. */
+
+int
+get_upc_consistency_mode (void)
+{
+ return upc_cmode;
+}
+
+/* Called from the parser just after the bracket that opens a compound
+ statement has been parsed. Set the flag that allows the pragma
+ in this context. */
+
+void
+permit_pragma_upc (void)
+{
+ pragma_upc_permitted = 1;
+}
+
+/* Called just before the body of a compound statement is parsed.
+ Clear the flag that allows the pragma. */
+
+void
+deny_pragma_upc (void)
+{
+ pragma_upc_permitted = 0;
+}
+
+/* A #pragma upc is permitted either at the outermost scope,
+ or directly after the bracket that opens a compound statement. */
+
+int
+pragma_upc_permitted_p (void)
+{
+ return !current_function_decl || pragma_upc_permitted;
+}
+
+/* Called at the beginning of every compound statement.
+ Pushes the old value of the current UPC consistency mode
+ onto the stack. */
+
+void
+push_upc_consistency_mode (void)
+{
+ if (upc_cmode_stack_in_use == upc_cmode_stack_allocated)
+ {
+ upc_cmode_stack_allocated += UPC_CMODE_STACK_INCREMENT;
+ upc_cmode_stack = (int *) xrealloc (upc_cmode_stack,
+ upc_cmode_stack_allocated * sizeof (int));
+ }
+ upc_cmode_stack[upc_cmode_stack_in_use++] = upc_cmode;
+}
+
+/* Called at the end of every compound statement.
+ Sets the current consistency mode to the previously saved value. */
+
+void
+pop_upc_consistency_mode (void)
+{
+ if (upc_cmode_stack_in_use <= 0)
+ abort ();
+ upc_cmode = upc_cmode_stack[--upc_cmode_stack_in_use];
+}
+
+static int pragma_pupc_on;
+static void init_pragma_pupc (void);
+static void handle_pragma_pupc (cpp_reader *);
+
+/* Pragma pupc defaults to being on */
+static void
+init_pragma_pupc (void)
+{
+ pragma_pupc_on = 1;
+}
+
+/* Return TRUE if PUPC processing is currently enabled. */
+int
+get_upc_pupc_mode (void)
+{
+ return pragma_pupc_on;
+}
+
+/* Disable PUPC processing. */
+int
+disable_pupc_mode (void)
+{
+ int old_pupc = pragma_pupc_on;
+ pragma_pupc_on = 0;
+ return old_pupc;
+}
+
+/* Set the current PUPC processing mode to on/off. */
+void
+set_pupc_mode (int new_pupc)
+{
+ pragma_pupc_on = new_pupc;
+}
+
+/*
+ * #pragma pupc on
+ * #pragma pupc off
+ */
+static void
+handle_pragma_pupc (cpp_reader *dummy ATTRIBUTE_UNUSED)
+{
+ tree x;
+ enum cpp_ttype t;
+
+ t = pragma_lex(&x);
+ if (t == CPP_NAME) {
+ const char *op = IDENTIFIER_POINTER (x);
+ if (!strcmp (op, "on"))
+ pragma_pupc_on = 1;
+ else if (!strcmp (op, "off"))
+ pragma_pupc_on = 0;
+ else
+ GCC_BAD2 ("unknown action '%s' for '#pragma pupc' - ignored", op);
+ }
+
+ t = pragma_lex (&x);
+ if (t != CPP_EOF)
+ warning (OPT_Wpragmas, "junk at end of #pragma pupc");
+}
+
/* Hook from the front ends to apply the results of one of the preceding
pragmas that rename variables. */
@@ -1558,6 +1793,14 @@ init_pragma (void)
c_register_pragma_with_expansion (0, "message", handle_pragma_message);
+ if (flag_upc)
+ {
+ c_register_pragma (0, "upc", handle_pragma_upc);
+ init_pragma_upc ();
+ c_register_pragma (0, "pupc", handle_pragma_pupc);
+ init_pragma_pupc ();
+ }
+
#ifdef REGISTER_TARGET_PRAGMAS
REGISTER_TARGET_PRAGMAS ();
#endif
diff --git a/gcc/c-family/c-pragma.h b/gcc/c-family/c-pragma.h
index 65f10db6e6f..516fd553ef1 100644
--- a/gcc/c-family/c-pragma.h
+++ b/gcc/c-family/c-pragma.h
@@ -238,6 +238,15 @@ extern void add_to_renaming_pragma_list (tree, tree);
extern enum cpp_ttype pragma_lex (tree *, location_t *loc = NULL);
+/* UPC-related pragma handling. */
+extern void deny_pragma_upc (void);
+extern int get_upc_consistency_mode (void);
+extern void permit_pragma_upc (void);
+extern void pop_upc_consistency_mode (void);
+extern int pragma_upc_permitted_p (void);
+extern void push_upc_consistency_mode (void);
+extern void set_upc_consistency_mode (int);
+
/* Flags for use with c_lex_with_flags. The values here were picked
so that 0 means to translate and join strings. */
#define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index 704d21daaaa..9e2e6024edb 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -186,6 +186,13 @@ pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type)
if (qualifiers & TYPE_QUAL_RESTRICT)
pp_c_ws_string (pp, (flag_isoc99 && !c_dialect_cxx ()
? "restrict" : "__restrict__"));
+ if (qualifiers & TYPE_QUAL_RELAXED)
+ pp_c_ws_string (pp, "relaxed");
+ if (qualifiers & TYPE_QUAL_STRICT)
+ pp_c_ws_string (pp, "strict");
+ if (qualifiers & TYPE_QUAL_SHARED)
+ pp_c_ws_string (pp, "shared");
+
}
/* Pretty-print T using the type-cast notation '( type-name )'. */
diff --git a/gcc/c-family/c-upc-pts.h b/gcc/c-family/c-upc-pts.h
new file mode 100644
index 00000000000..b38b98f5519
--- /dev/null
+++ b/gcc/c-family/c-upc-pts.h
@@ -0,0 +1,40 @@
+/* Define UPC pointer-to-shared representation characteristics.
+ Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_C_FAMILY_UPC_PTS_H
+#define GCC_C_FAMILY_UPC_PTS_H 1
+
+#define UPC_PTS_SIZE (LONG_TYPE_SIZE + POINTER_SIZE)
+#define UPC_PTS_PHASE_SIZE (LONG_TYPE_SIZE / 2)
+#define UPC_PTS_THREAD_SIZE (LONG_TYPE_SIZE / 2)
+#define UPC_PTS_VADDR_SIZE POINTER_SIZE
+#define UPC_PTS_PHASE_TYPE ((LONG_TYPE_SIZE == 64) \
+ ? "uint32_t" : "uint16_t")
+#define UPC_PTS_THREAD_TYPE ((LONG_TYPE_SIZE == 64) \
+ ? "uint32_t" : "uint16_t")
+#define UPC_PTS_VADDR_TYPE "char *"
+
+#define UPC_MAX_THREADS (1 << (((UPC_PTS_THREAD_SIZE) < 30) \
+ ? (UPC_PTS_THREAD_SIZE) : 30))
+#define UPC_MAX_BLOCK_SIZE ((1 << (((UPC_PTS_PHASE_SIZE) < 30) \
+ ? (UPC_PTS_PHASE_SIZE) : 30)) - 1)
+
+#endif /* !GCC_C_FAMILY_UPC_PTS_H */
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 88038a076f5..a79ee9a38af 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1008,6 +1008,10 @@ d
C ObjC C++ ObjC++ Joined
; Documented in common.opt. FIXME - what about -dI, -dD, -dN and -dD?
+dwarf-2-upc
+C Report Var(use_upc_dwarf2_extensions) Init(0)
+Generate DWARF-2 debug info with UPC extensions.
+
fabi-compat-version=
C++ ObjC++ Joined RejectNegative UInteger Var(flag_abi_compat_version) Init(-1)
The version of the C++ ABI used for -Wabi warnings and link compatibility aliases.
@@ -1528,6 +1532,46 @@ funsigned-char
C ObjC C++ ObjC++ LTO Var(flag_signed_char, 0)
Make \"char\" unsigned by default.
+fupc
+C Report Var(flag_upc) Init(0)
+Enable UPC.
+
+fupc-debug
+C Var(flag_upc_debug)
+Generate code that provides the UPC runtime with
+the file and line number where the runtime was called.
+
+fupc-inline-lib
+C Var(flag_upc_inline_lib)
+Generate code for inlined UPC runtime library routines.
+Default, at optimization levels greater than 0.
+
+fupc-pre-include
+C Init(1)
+Pre-include UPC runtime header file.
+
+fupc-pthreads-model-tls
+C
+Generate code for a POSIX threads based UPC runtime environment
+with TLS (Thread Local Storage) support.
+
+fupc-threads=
+C Joined RejectNegative UInteger
+Specify the compile-time value of THREADS.
+
+fupc-threads-
+C Joined RejectNegative UInteger Alias(fupc-threads=)
+Deprecated in favor of -fupc-threads=.
+
+fupc-instrument
+C Var(flag_upc_instrument)
+Instrument UPC shared accesses and library calls, using GASP tool support.
+
+fupc-instrument-functions
+C Var(flag_upc_instrument_functions)
+Instrument functions calls, using GASP tool support
+(implies -fupc-instrument).
+
fuse-cxa-atexit
C++ ObjC++ Var(flag_use_cxa_atexit) Init(DEFAULT_USE_CXA_ATEXIT)
Use __cxa_atexit to register destructors.
diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in
index 8525707f996..2f6f9e8db17 100644
--- a/gcc/c/Make-lang.in
+++ b/gcc/c/Make-lang.in
@@ -36,7 +36,7 @@
#
# Define the names for selecting c in LANGUAGES.
-c: cc1$(exeext)
+c: cc1$(exeext) gupc$(exeext)
# Tell GNU make to ignore these if they exist.
.PHONY: c gcc
@@ -46,12 +46,35 @@ c: cc1$(exeext)
# is to cc1 as e.g. g++ is to cc1plus, or gfortran is to f951).
CFLAGS-c/gccspec.o += $(DRIVER_DEFINES)
+# The UPC compiler driver: gupc.
+
+GUPC_INSTALL_NAME := $(shell echo gupc|sed '$(program_transform_name)')
+UPC_INSTALL_NAME := $(shell echo upc|sed '$(program_transform_name)')
+GUPC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gupc|sed '$(program_transform_name)')
+
+gupcspec.o: $(srcdir)/c/gupcspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) \
+ $(CONFIG_H) coretypes.h intl.h $(OPTS_H)
+ (SHLIB='$(SHLIB)'; \
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
+ $(INCLUDES) $(srcdir)/c/gupcspec.c)
+
+GUPC_D_OBJS = gupcspec.o $(GCC_OBJS)
+gupc$(exeext): $(GUPC_D_OBJS) $(EXTRA_GCC_OBJS) \
+ libcommon-target.a $(LIBDEPS)
+ $(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
+ $(GUPC_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
+ $(EXTRA_GCC_LIBS) $(LIBS)
+
+# UPC specific object files. Presently, available only for C.
+UPC_OBJS = c/c-upc-gasp.o c/c-upc-lang.o c/c-upc-low.o \
+ c/c-upc-pts-ops.o c/c-upc.o
+
# The C compiler itself.
# Language-specific object files for C and Objective C.
C_AND_OBJC_OBJS = attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o \
c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o \
- c/c-array-notation.o c/c-fold.o $(C_COMMON_OBJS) $(C_TARGET_OBJS)
+ c/c-array-notation.o c/c-fold.o $(C_COMMON_OBJS) $(UPC_OBJS) $(C_TARGET_OBJS)
# Language-specific object files for C.
C_OBJS = c/c-lang.o c-family/stub-objc.o $(C_AND_OBJC_OBJS)
@@ -105,7 +128,14 @@ check-c : check-gcc
# Install hooks:
# cc1 is installed elsewhere as part of $(COMPILERS).
-c.install-common:
+c.install-common: gupc$(exeext) installdirs
+ -rm -f $(DESTDIR)$(bindir)/$(GUPC_INSTALL_NAME)$(exeext)
+ $(INSTALL_PROGRAM) -m 755 gupc$(exeext) $(DESTDIR)$(bindir)/$(GUPC_INSTALL_NAME)$(exeext)
+ -rm -f $(DESTDIR)$(bindir)/$(GUPC_TARGET_INSTALL_NAME)$(exeext)
+ cd $(DESTDIR)$(bindir) && \
+ $(LN) $(GUPC_INSTALL_NAME)$(exeext) $(GUPC_TARGET_INSTALL_NAME)$(exeext)
+ -rm -f $(DESTDIR)$(bindir)/$(UPC_INSTALL_NAME)$(exeext)
+ cd $(DESTDIR)$(bindir) && $(LN_S) $(GUPC_INSTALL_NAME)$(exeext) $(UPC_INSTALL_NAME)$(exeext)
c.install-man:
c.install-plugin:
c.uninstall:
diff --git a/gcc/c/c-convert.c b/gcc/c/c-convert.c
index 4167c3461f3..3d27101549e 100644
--- a/gcc/c/c-convert.c
+++ b/gcc/c/c-convert.c
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "c-tree.h"
#include "convert.h"
+#include "c-upc.h"
#include "langhooks.h"
#include "ubsan.h"
@@ -87,6 +88,11 @@ convert (tree type, tree expr)
STRIP_TYPE_NOPS (e);
+ /* Drop 'shared' qualifier when considering conversions
+ of expression values. */
+ if (SHARED_TYPE_P (type))
+ type = build_unshared_type(type);
+
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr))
&& (TREE_CODE (TREE_TYPE (expr)) != COMPLEX_TYPE
|| TREE_CODE (e) == COMPLEX_EXPR))
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 0dd2121b868..ae99c112e3f 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -38,6 +38,8 @@ along with GCC; see the file COPYING3. If not see
#include "stor-layout.h"
#include "varasm.h"
#include "attribs.h"
+#include "c-upc.h"
+#include "c-upc-low.h"
#include "toplev.h"
#include "debug.h"
#include "c-family/c-objc.h"
@@ -635,6 +637,8 @@ c_build_pointer_type (tree to_type)
: TYPE_ADDR_SPACE (to_type);
machine_mode pointer_mode;
+ if (SHARED_TYPE_P (to_type))
+ return build_pointer_type (to_type);
if (as != ADDR_SPACE_GENERIC || c_default_pointer_mode == VOIDmode)
pointer_mode = targetm.addr_space.pointer_mode (as);
else
@@ -2426,6 +2430,13 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
if (TREE_THIS_VOLATILE (newdecl))
TREE_THIS_VOLATILE (olddecl) = 1;
+ if (TREE_SHARED (newdecl))
+ {
+ TREE_SHARED (olddecl) = 1;
+ if (TREE_CODE (newdecl) == VAR_DECL)
+ TREE_THIS_VOLATILE (olddecl) = 1;
+ }
+
/* Merge deprecatedness. */
if (TREE_DEPRECATED (newdecl))
TREE_DEPRECATED (olddecl) = 1;
@@ -3118,6 +3129,8 @@ pushdecl_top_level (tree x)
static void
implicit_decl_warning (location_t loc, tree id, tree olddecl)
{
+ if (upc_diagnose_deprecated_stmt (input_location, id))
+ return;
if (warn_implicit_function_declaration)
{
bool warned;
@@ -3448,6 +3461,8 @@ undeclared_variable (location_t loc, tree id)
}
else
{
+ if (upc_diagnose_deprecated_stmt (loc, id))
+ return;
if (!objc_diagnose_private_ivar (id))
error_at (loc, "%qE undeclared (first use in this function)", id);
if (!already)
@@ -4281,6 +4296,9 @@ quals_from_declspecs (const struct c_declspecs *specs)
| (specs->volatile_p ? TYPE_QUAL_VOLATILE : 0)
| (specs->restrict_p ? TYPE_QUAL_RESTRICT : 0)
| (specs->atomic_p ? TYPE_QUAL_ATOMIC : 0)
+ | (specs->shared_p ? TYPE_QUAL_SHARED : 0)
+ | (specs->strict_p ? TYPE_QUAL_STRICT : 0)
+ | (specs->relaxed_p ? TYPE_QUAL_RELAXED : 0)
| (ENCODE_QUAL_ADDR_SPACE (specs->address_space)));
gcc_assert (!specs->type
&& !specs->decl_attr
@@ -4832,7 +4850,24 @@ finish_decl (tree decl, location_t init_loc, tree init,
constant_expression_warning (DECL_SIZE (decl));
else
{
- error ("storage size of %q+D isn%'t constant", decl);
+ if (SHARED_TYPE_P (TREE_TYPE (decl)))
+ {
+ gcc_assert (!flag_upc_threads);
+ if (TYPE_HAS_THREADS_FACTOR (TREE_TYPE (decl)))
+ error ("in the UPC dynamic translation environment, "
+ "THREADS may not appear in declarations "
+ "of shared arrays with indefinite block size; "
+ "the storage size of %q+D cannot be calculated",
+ decl);
+ else
+ error ("in the UPC dynamic translation environment, "
+ "THREADS must appear exactly once in "
+ "declarations of shared arrays; "
+ "the storage size of %q+D cannot be calculated",
+ decl);
+ }
+ else
+ error ("storage size of %q+D isn%'t constant", decl);
TREE_TYPE (decl) = error_mark_node;
}
}
@@ -4871,6 +4906,10 @@ finish_decl (tree decl, location_t init_loc, tree init,
if (c_dialect_objc ())
objc_check_decl (decl);
+ /* Give UPC a chance to check the declaration. */
+ if (flag_upc)
+ upc_check_decl (decl);
+
if (asmspec)
{
/* If this is not a static variable, issue a warning.
@@ -5373,6 +5412,9 @@ grokdeclarator (const struct c_declarator *declarator,
int restrictp;
int volatilep;
int atomicp;
+ int sharedp;
+ int strictp;
+ int relaxedp;
int type_quals = TYPE_UNQUALIFIED;
tree name = NULL_TREE;
bool funcdef_flag = false;
@@ -5384,6 +5426,10 @@ grokdeclarator (const struct c_declarator *declarator,
int array_parm_static = 0;
bool array_parm_vla_unspec_p = false;
tree returned_attrs = NULL_TREE;
+ int upc_threads_ref = 0; /* for static declarations of shared arrays */
+ tree upc_layout_qualifier;
+ tree upc_elem_block_factor;
+ tree upc_block_factor = NULL;
bool bitfield = width != NULL;
tree element_type;
tree orig_qual_type = NULL;
@@ -5485,6 +5531,8 @@ grokdeclarator (const struct c_declarator *declarator,
size_varies = C_TYPE_VARIABLE_SIZE (type) != 0;
+ upc_threads_ref = TYPE_HAS_THREADS_FACTOR (type);
+
/* Diagnose defaulting to "int". */
if (declspecs->default_int_p && !in_system_header_at (input_location))
@@ -5530,6 +5578,11 @@ grokdeclarator (const struct c_declarator *declarator,
restrictp = declspecs->restrict_p + TYPE_RESTRICT (element_type);
volatilep = declspecs->volatile_p + TYPE_VOLATILE (element_type);
atomicp = declspecs->atomic_p + TYPE_ATOMIC (element_type);
+ sharedp = declspecs->shared_p + SHARED_TYPE_P (element_type);
+ strictp = declspecs->strict_p + TYPE_STRICT (element_type);
+ relaxedp = declspecs->relaxed_p + TYPE_RELAXED (element_type);
+ upc_elem_block_factor = TYPE_BLOCK_FACTOR (element_type);
+ upc_layout_qualifier = declspecs->upc_layout_qualifier;
as1 = declspecs->address_space;
as2 = TYPE_ADDR_SPACE (element_type);
address_space = ADDR_SPACE_GENERIC_P (as1)? as2 : as1;
@@ -5542,6 +5595,21 @@ grokdeclarator (const struct c_declarator *declarator,
pedwarn_c90 (loc, OPT_Wpedantic, "duplicate %<volatile%>");
if (atomicp > 1)
pedwarn_c90 (loc, OPT_Wpedantic, "duplicate %<_Atomic%>");
+ if (sharedp > 1)
+ pedwarn_c90 (loc, OPT_Wpedantic, "duplicate %<shared%>");
+ if (strictp > 1)
+ pedwarn_c90 (loc, OPT_Wpedantic, "duplicate %<strict%>");
+ if (relaxedp > 1)
+ pedwarn_c90 (loc, OPT_Wpedantic, "duplicate %<relaxed%>");
+ if (strictp && relaxedp)
+ error_at (loc, "UPC shared variable %qE is declared "
+ "both strict and relaxed", name);
+ if (strictp && !sharedp)
+ error_at (loc, "%qE is declared with UPC strict qualifier "
+ "but not shared", name);
+ if (relaxedp && !sharedp)
+ error_at (loc, "%qE is declared with UPC relaxed qualifier "
+ "but not shared", name);
if (!ADDR_SPACE_GENERIC_P (as1) && !ADDR_SPACE_GENERIC_P (as2) && as1 != as2)
error_at (loc, "conflicting named address spaces (%s vs %s)",
@@ -5558,6 +5626,9 @@ grokdeclarator (const struct c_declarator *declarator,
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
| (volatilep ? TYPE_QUAL_VOLATILE : 0)
| (atomicp ? TYPE_QUAL_ATOMIC : 0)
+ | (sharedp ? TYPE_QUAL_SHARED : 0)
+ | (strictp ? TYPE_QUAL_STRICT : 0)
+ | (relaxedp ? TYPE_QUAL_RELAXED : 0)
| ENCODE_QUAL_ADDR_SPACE (address_space));
if (type_quals != TYPE_QUALS (element_type))
orig_qual_type = NULL_TREE;
@@ -5847,6 +5918,40 @@ grokdeclarator (const struct c_declarator *declarator,
warn_variable_length_array (name, size);
}
}
+ else if (sharedp && count_upc_threads_refs (size))
+ {
+ /* We have a shared array with a non-constant
+ dimension. If the expression is a factor of
+ THREADS, then we'll need to set the flag
+ in the result type. Otherwise, it is an error. */
+ int n_thread_refs = count_upc_threads_refs (size);
+ if (upc_threads_ref || n_thread_refs > 1)
+ {
+ error_at (loc, "UPC shared array declaration references THREADS "
+ "more than once; the size of %qE "
+ "cannot be calculated", name);
+ size = integer_one_node;
+ }
+ else if (!is_multiple_of_upc_threads (size))
+ {
+ error_at (loc, "UPC shared array dimension is not a simple multiple "
+ "of THREADS; the size of %qE "
+ "cannot be calculated.", name);
+ size = integer_one_node;
+ }
+ else
+ {
+ upc_threads_ref = 1;
+ set_upc_threads_refs_to_one (&size);
+ size = fold (size);
+ if (TREE_CODE (size) != INTEGER_CST)
+ {
+ error_at (loc, "UPC forbids variable-size shared array %qE",
+ name);
+ size = integer_one_node;
+ }
+ }
+ }
else if ((decl_context == NORMAL || decl_context == FIELD)
&& current_scope == file_scope)
{
@@ -6031,6 +6136,18 @@ grokdeclarator (const struct c_declarator *declarator,
C_TYPE_VARIABLE_SIZE (type) = 1;
}
+ if (upc_threads_ref)
+ {
+ /* We need a unique type copy here for UPC shared
+ array types compiled in a dynamic threads environment
+ that reference THREADS as a multiplier; to avoid
+ setting the "has threads factor" bit in
+ a re-used non- UPC shared array type node. */
+ if (size && TREE_CODE (size) == INTEGER_CST)
+ type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type));
+ TYPE_HAS_THREADS_FACTOR (type) = 1;
+ }
+
/* The GCC extension for zero-length arrays differs from
ISO flexible array members in that sizeof yields
zero. */
@@ -6092,6 +6209,8 @@ grokdeclarator (const struct c_declarator *declarator,
continue;
size_varies = false;
+ upc_threads_ref = 0;
+ upc_layout_qualifier = 0;
/* Warn about some types functions can't return. */
if (TREE_CODE (type) == FUNCTION_TYPE)
@@ -6139,6 +6258,12 @@ grokdeclarator (const struct c_declarator *declarator,
if (VOID_TYPE_P (type) && really_funcdef)
pedwarn (loc, 0,
"function definition has qualified void return type");
+ else if (type_quals & TYPE_QUAL_SHARED)
+ {
+ error_at (loc, "function definition has UPC shared qualified return type");
+ type_quals &= ~(TYPE_QUAL_SHARED | TYPE_QUAL_STRICT
+ | TYPE_QUAL_RELAXED);
+ }
else
warning_at (loc, OPT_Wignored_qualifiers,
"type qualifiers ignored on function return type");
@@ -6177,11 +6302,21 @@ grokdeclarator (const struct c_declarator *declarator,
&& type_quals)
pedwarn (loc, OPT_Wpedantic,
"ISO C forbids qualified function types");
+
+ if (upc_layout_qualifier)
+ upc_block_factor = upc_grok_layout_qualifier (
+ loc, POINTER_TYPE, type,
+ NULL_TREE, upc_layout_qualifier);
+
if (type_quals)
- type = c_build_qualified_type (type, type_quals, orig_qual_type,
+ type = c_build_qualified_type (type, type_quals,
+ upc_block_factor,
+ orig_qual_type,
orig_qual_indirect);
orig_qual_type = NULL_TREE;
size_varies = false;
+ upc_threads_ref = 0;
+ upc_block_factor = 0;
/* When the pointed-to type involves components of variable size,
care must be taken to ensure that the size evaluation code is
@@ -6221,7 +6356,9 @@ grokdeclarator (const struct c_declarator *declarator,
/* Process type qualifiers (such as const or volatile)
that were given inside the `*'. */
- type_quals = declarator->u.pointer_quals;
+ type_quals = declarator->u.pointer.quals;
+ upc_layout_qualifier = declarator->u.pointer.upc_layout_qual;
+ sharedp = ((type_quals & TYPE_QUAL_SHARED) != 0);
declarator = declarator->declarator;
break;
@@ -6305,6 +6442,14 @@ grokdeclarator (const struct c_declarator *declarator,
}
}
+ /* Check for UPC's layout qualifier. */
+ if (upc_layout_qualifier || upc_elem_block_factor)
+ {
+ upc_block_factor = upc_grok_layout_qualifier (loc, TREE_CODE (type), type,
+ upc_elem_block_factor, upc_layout_qualifier);
+ upc_layout_qualifier = 0;
+ }
+
/* Reject invalid uses of _Alignas. */
if (declspecs->alignas_p)
{
@@ -6362,7 +6507,9 @@ grokdeclarator (const struct c_declarator *declarator,
pedwarn (loc, OPT_Wpedantic,
"ISO C forbids qualified function types");
if (type_quals)
- type = c_build_qualified_type (type, type_quals, orig_qual_type,
+ type = c_build_qualified_type (type, type_quals,
+ upc_block_factor,
+ orig_qual_type,
orig_qual_indirect);
decl = build_decl (declarator->id_loc,
TYPE_DECL, declarator->u.id, type);
@@ -6416,7 +6563,9 @@ grokdeclarator (const struct c_declarator *declarator,
pedwarn (loc, OPT_Wpedantic,
"ISO C forbids const or volatile function types");
if (type_quals)
- type = c_build_qualified_type (type, type_quals, orig_qual_type,
+ type = c_build_qualified_type (type, type_quals,
+ upc_block_factor,
+ orig_qual_type,
orig_qual_indirect);
return type;
}
@@ -6472,7 +6621,9 @@ grokdeclarator (const struct c_declarator *declarator,
orig_qual_indirect--;
}
if (type_quals)
- type = c_build_qualified_type (type, type_quals, orig_qual_type,
+ type = c_build_qualified_type (type, type_quals,
+ upc_block_factor,
+ orig_qual_type,
orig_qual_indirect);
type = c_build_pointer_type (type);
type_quals = array_ptr_quals;
@@ -6503,6 +6654,12 @@ grokdeclarator (const struct c_declarator *declarator,
type = c_build_pointer_type (type);
type_quals = TYPE_UNQUALIFIED;
}
+ else if (type_quals & TYPE_QUAL_SHARED)
+ {
+ error_at (loc, "parameter declared with UPC shared qualifier");
+ type_quals &= ~(TYPE_QUAL_SHARED | TYPE_QUAL_STRICT
+ | TYPE_QUAL_RELAXED);
+ }
else if (type_quals)
type = c_build_qualified_type (type, type_quals);
@@ -6564,7 +6721,16 @@ grokdeclarator (const struct c_declarator *declarator,
TYPE_DOMAIN (type) = build_range_type (sizetype, size_zero_node,
NULL_TREE);
}
- type = c_build_qualified_type (type, type_quals, orig_qual_type,
+ else if (type_quals & TYPE_QUAL_SHARED)
+ {
+ error_at (loc, "field %qE declared with UPC shared qualifier",
+ name);
+ type_quals &= ~(TYPE_QUAL_SHARED | TYPE_QUAL_STRICT
+ | TYPE_QUAL_RELAXED);
+ }
+ type = c_build_qualified_type (type, type_quals,
+ NULL /* layout_qualifier */,
+ orig_qual_type,
orig_qual_indirect);
decl = build_decl (declarator->id_loc,
FIELD_DECL, declarator->u.id, type);
@@ -6677,8 +6843,18 @@ grokdeclarator (const struct c_declarator *declarator,
/* An uninitialized decl with `extern' is a reference. */
int extern_ref = !initialized && storage_class == csc_extern;
- type = c_build_qualified_type (type, type_quals, orig_qual_type,
- orig_qual_indirect);
+ if ((type_quals & TYPE_QUAL_SHARED)
+ && !extern_ref
+ && !((current_scope == file_scope)
+ || (storage_class == csc_static)))
+ {
+ error_at (loc, "UPC does not support shared auto variables");
+ type = error_mark_node;
+ }
+ type = c_build_qualified_type (type, type_quals,
+ upc_block_factor,
+ orig_qual_type,
+ orig_qual_indirect);
/* C99 6.2.2p7: It is invalid (compile-time undefined
behavior) to create an 'extern' declaration for a
@@ -6727,6 +6903,10 @@ grokdeclarator (const struct c_declarator *declarator,
else
{
TREE_STATIC (decl) = (storage_class == csc_static);
+ /* UPC's 'shared' attribute implies that the storage
+ is 'static' to the extent it is stored in memory. */
+ if (type_quals & TYPE_QUAL_SHARED)
+ TREE_STATIC (decl) = 1;
TREE_PUBLIC (decl) = extern_ref;
}
@@ -6801,6 +6981,13 @@ grokdeclarator (const struct c_declarator *declarator,
"questionable in C++"),
decl);
+ /* Shared variables are given their own link section on
+ most target platforms, and if compiling in pthreads mode
+ regular local file scope variables are made thread local. */
+ if ((TREE_CODE(decl) == VAR_DECL)
+ && !threadp && (TREE_SHARED (decl) || flag_upc_pthreads))
+ upc_set_decl_section (decl);
+
return decl;
}
}
@@ -9141,6 +9328,8 @@ finish_function (void)
if (!decl_function_context (fndecl))
{
invoke_plugin_callbacks (PLUGIN_PRE_GENERICIZE, fndecl);
+ if (flag_upc)
+ upc_genericize (fndecl);
c_genericize (fndecl);
/* ??? Objc emits functions after finalizing the compilation unit.
@@ -9470,18 +9659,21 @@ make_pointer_declarator (struct c_declspecs *type_quals_attrs,
{
tree attrs;
int quals = 0;
+ tree upc_layout_qual = 0;
struct c_declarator *itarget = target;
struct c_declarator *ret = XOBNEW (&parser_obstack, struct c_declarator);
if (type_quals_attrs)
{
attrs = type_quals_attrs->attrs;
quals = quals_from_declspecs (type_quals_attrs);
+ upc_layout_qual = type_quals_attrs->upc_layout_qualifier;
if (attrs != NULL_TREE)
itarget = build_attrs_declarator (attrs, target);
}
ret->kind = cdk_pointer;
ret->declarator = itarget;
- ret->u.pointer_quals = quals;
+ ret->u.pointer.quals = quals;
+ ret->u.pointer.upc_layout_qual = upc_layout_qual;
return ret;
}
@@ -9493,6 +9685,7 @@ build_null_declspecs (void)
{
struct c_declspecs *ret = XOBNEW (&parser_obstack, struct c_declspecs);
memset (ret, 0, sizeof *ret);
+ ret->upc_layout_qualifier = 0;
ret->align_log = -1;
ret->typespec_word = cts_none;
ret->storage_class = csc_none;
@@ -9536,6 +9729,23 @@ declspecs_add_qual (source_location loc,
bool dupe = false;
specs->non_sc_seen_p = true;
specs->declspecs_seen_p = true;
+
+ /* A UPC layout qualifier is encoded as an ARRAY_REF,
+ further, it implies the presence of the 'shared' keyword. */
+ if (TREE_CODE (qual) == ARRAY_REF)
+ {
+ if (specs->upc_layout_qualifier)
+ {
+ error_at (loc, "two or more layout qualifiers specified");
+ return specs;
+ }
+ else
+ {
+ specs->upc_layout_qualifier = qual;
+ qual = ridpointers[RID_SHARED];
+ }
+ }
+
gcc_assert (TREE_CODE (qual) == IDENTIFIER_NODE
&& C_IS_RESERVED_WORD (qual));
i = C_RID_CODE (qual);
@@ -9560,6 +9770,18 @@ declspecs_add_qual (source_location loc,
dupe = specs->atomic_p;
specs->atomic_p = true;
break;
+ case RID_SHARED:
+ dupe = specs->shared_p;
+ specs->shared_p = true;
+ break;
+ case RID_STRICT:
+ dupe = specs->strict_p;
+ specs->strict_p = true;
+ break;
+ case RID_RELAXED:
+ dupe = specs->relaxed_p;
+ specs->relaxed_p = true;
+ break;
default:
gcc_unreachable ();
}
diff --git a/gcc/c/c-fold.c b/gcc/c/c-fold.c
index 6c82f242bf1..2507bb1aa7b 100644
--- a/gcc/c/c-fold.c
+++ b/gcc/c/c-fold.c
@@ -389,11 +389,14 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
goto out;
/* ??? Cope with user tricks that amount to offsetof. The middle-end is
- not prepared to deal with them if they occur in initializers. */
+ not prepared to deal with them if they occur in initializers.
+ Avoid attempts to fold references to UPC shared components
+ due to the complexities of UPC pointer-to-shared arithmetic. */
if (op0 != orig_op0
&& code == ADDR_EXPR
&& (op1 = get_base_address (op0)) != NULL_TREE
&& INDIRECT_REF_P (op1)
+ && !SHARED_TYPE_P (TREE_TYPE (op1))
&& TREE_CONSTANT (TREE_OPERAND (op1, 0)))
ret = fold_convert_loc (loc, TREE_TYPE (expr), fold_offsetof_1 (op0));
else if (op0 != orig_op0 || in_init)
diff --git a/gcc/c/c-lang.c b/gcc/c/c-lang.c
index 89954b749cf..9ef87c5a528 100644
--- a/gcc/c/c-lang.c
+++ b/gcc/c/c-lang.c
@@ -25,6 +25,8 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "langhooks-def.h"
#include "c-objc-common.h"
+#include "c-upc-lang.h"
+#include "c-upc-low.h"
enum c_language_kind c_language = clk_c;
@@ -37,6 +39,14 @@ enum c_language_kind c_language = clk_c;
#define LANG_HOOKS_INIT c_objc_common_init
#undef LANG_HOOKS_INIT_TS
#define LANG_HOOKS_INIT_TS c_common_init_ts
+#undef LANG_HOOKS_UPC_TOGGLE_KEYWORDS
+#define LANG_HOOKS_UPC_TOGGLE_KEYWORDS upc_toggle_keywords
+#undef LANG_HOOKS_UPC_WRITE_GLOBAL_INIT_FUNC
+#define LANG_HOOKS_UPC_WRITE_GLOBAL_INIT_FUNC upc_write_global_init
+#undef LANG_HOOKS_LAYOUT_DECL_P
+#define LANG_HOOKS_LAYOUT_DECL_P upc_lang_layout_decl_p
+#undef LANG_HOOKS_LAYOUT_DECL
+#define LANG_HOOKS_LAYOUT_DECL upc_lang_layout_decl
/* Each front end provides its own lang hook initializer. */
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
diff --git a/gcc/c/c-objc-common.c b/gcc/c/c-objc-common.c
index 20dc024b859..a047c960603 100644
--- a/gcc/c/c-objc-common.c
+++ b/gcc/c/c-objc-common.c
@@ -21,11 +21,14 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "c-tree.h"
+#include "options.h"
#include "intl.h"
#include "c-family/c-pretty-print.h"
#include "tree-pretty-print.h"
#include "langhooks.h"
#include "c-objc-common.h"
+#include "c-upc-lang.h"
+#include "c-upc.h"
static bool c_tree_printer (pretty_printer *, text_info *, const char *,
int, bool, bool, bool);
@@ -57,7 +60,14 @@ c_objc_common_init (void)
{
c_init_decl_processing ();
- return c_common_init ();
+ if (c_common_init () == false)
+ return false;
+
+ if (flag_upc)
+ upc_lang_init ();
+
+ return true;
+
}
/* Called during diagnostic message formatting process to print a
@@ -210,10 +220,87 @@ c_initialize_diagnostics (diagnostic_context *context)
diagnostic_format_decoder (context) = &c_tree_printer;
}
+/* Check for the possible need to convert UPC-specific types. */
+
+static int
+upc_types_compatible_p (tree x, tree y)
+{
+ if (POINTER_TYPE_P (x) && POINTER_TYPE_P (y))
+ {
+ const tree ttx = TREE_TYPE (x);
+ const tree tty = TREE_TYPE (y);
+ if (SHARED_TYPE_P (ttx) && SHARED_TYPE_P (tty))
+ {
+ tree bx, by, sx, sy;
+ int x_has_zero_phase, y_has_zero_phase;
+ int result;
+ /* If both types are generic UPC pointers-to-shared,
+ then they're compatible. */
+ if (VOID_TYPE_P (ttx) && VOID_TYPE_P (tty))
+ return 1;
+ /* Intermediate conversions to (shared void *) (defined
+ to be a "generic pointer-to-shared" in the UPC
+ specification) cannot always be optimized away.
+ For example,
+ p1 = (shared void *) p2;
+ preserves the phase of p2, when assigning to p1.
+ We need to be conservative, and not consider conversions
+ involving a generic UPC pointer-to-shared value to be
+ equivalent. */
+ if (VOID_TYPE_P (ttx) != VOID_TYPE_P (tty))
+ return 0;
+ bx = get_block_factor (ttx);
+ by = get_block_factor (tty);
+ sx = TYPE_SIZE (ttx);
+ sy = TYPE_SIZE (tty);
+ x_has_zero_phase = (integer_zerop (bx) || integer_onep (bx));
+ y_has_zero_phase = (integer_zerop (by) || integer_onep (by));
+ /* Normalize type size so that 0 => NULL. */
+ if (sx && integer_zerop (sx))
+ sx = NULL_TREE;
+ if (sy && integer_zerop (sy))
+ sy = NULL_TREE;
+ /* If the target types have the same UPC block size
+ (or they both have a phase value of zero)
+ and the same size and the target types are
+ otherwise compatible, then the pointer-to-shared
+ types are compatible. */
+ result = (tree_int_cst_equal (bx, by)
+ || (x_has_zero_phase && y_has_zero_phase))
+ && tree_int_cst_equal (sx, sy);
+ return result;
+ }
+ /* If one operand has a UPC shared type,
+ and the other operand's type is not a UPC shared type,
+ then they aren't equivalent. */
+ else if (SHARED_TYPE_P (ttx) != SHARED_TYPE_P (tty))
+ return 0;
+ }
+ else if (SHARED_TYPE_P (x) || SHARED_TYPE_P (y))
+ {
+ /* In UPC, blocking factors can be applied to
+ non-pointer objects/types. They're compatible
+ if the block sizes are equal. */
+ const tree bx = get_block_factor (x);
+ const tree by = get_block_factor (y);
+ return tree_int_cst_equal (bx, by)
+ && c_types_compatible_p (TYPE_MAIN_VARIANT (x),
+ TYPE_MAIN_VARIANT (y));
+ }
+ /* Otherwise, they're not compatible.
+ comptypes() should be called before this function
+ in order to implement a full "C" compatibility check. */
+ return 0;
+}
+
int
c_types_compatible_p (tree x, tree y)
{
- return comptypes (TYPE_MAIN_VARIANT (x), TYPE_MAIN_VARIANT (y));
+ int result;
+ result = comptypes (TYPE_MAIN_VARIANT (x), TYPE_MAIN_VARIANT (y));
+ if (!result && flag_upc)
+ result = upc_types_compatible_p (x, y);
+ return result;
}
/* Determine if the type is a vla type for the backend. */
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index c9eb8ddbae3..8f8ca505b78 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -51,6 +51,9 @@ along with GCC; see the file COPYING3. If not see
#include "c-family/c-pragma.h"
#include "c-lang.h"
#include "c-family/c-objc.h"
+#include "c-upc.h"
+#include "c-upc-gasp.h"
+#include "c-upc-pts-ops.h"
#include "plugin.h"
#include "omp-low.h"
#include "builtins.h"
@@ -115,6 +118,9 @@ c_parse_init (void)
if (!c_dialect_objc ())
mask |= D_OBJC | D_CXX_OBJC;
+ if (!flag_upc)
+ mask |= D_UPC;
+
ridpointers = ggc_cleared_vec_alloc<tree> ((int) RID_MAX);
for (i = 0; i < num_c_common_reswords; i++)
{
@@ -571,6 +577,11 @@ c_token_starts_typename (c_token *token)
case RID_SAT:
case RID_AUTO_TYPE:
return true;
+ /* UPC qualifiers */
+ case RID_SHARED:
+ case RID_STRICT:
+ case RID_RELAXED:
+ return true;
default:
if (token->keyword >= RID_FIRST_INT_N
&& token->keyword < RID_FIRST_INT_N + NUM_INT_N_ENTS
@@ -652,6 +663,11 @@ c_token_is_qualifier (c_token *token)
case RID_ATTRIBUTE:
case RID_ATOMIC:
return true;
+ case RID_SHARED:
+ case RID_STRICT:
+ case RID_RELAXED:
+ /* UPC qualifiers */
+ return true;
default:
return false;
}
@@ -733,6 +749,11 @@ c_token_starts_declspecs (c_token *token)
case RID_ATOMIC:
case RID_AUTO_TYPE:
return true;
+ /* UPC qualifiers */
+ case RID_SHARED:
+ case RID_STRICT:
+ case RID_RELAXED:
+ return true;
default:
if (token->keyword >= RID_FIRST_INT_N
&& token->keyword < RID_FIRST_INT_N + NUM_INT_N_ENTS
@@ -1397,6 +1418,14 @@ static tree c_parser_array_notation (location_t, c_parser *, tree, tree);
static tree c_parser_cilk_clause_vectorlength (c_parser *, tree, bool);
static void c_parser_cilk_grainsize (c_parser *, bool *);
+/* These UPC parser functions are only ever called when
+ compiling UPC. */
+static void c_parser_upc_forall_statement (c_parser *);
+static void c_parser_upc_sync_statement (c_parser *, int);
+static void c_parser_upc_shared_qual (source_location,
+ c_parser *,
+ struct c_declspecs *);
+
/* Parse a translation unit (C90 6.7, C99 6.9).
translation-unit:
@@ -2601,6 +2630,17 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
declspecs_add_qual (loc, specs, c_parser_peek_token (parser)->value);
c_parser_consume_token (parser);
break;
+ /* UPC qualifiers */
+ case RID_SHARED:
+ attrs_ok = true;
+ c_parser_upc_shared_qual (loc, parser, specs);
+ break;
+ case RID_STRICT:
+ case RID_RELAXED:
+ attrs_ok = true;
+ declspecs_add_qual (loc, specs, c_parser_peek_token (parser)->value);
+ c_parser_consume_token (parser);
+ break;
case RID_ATTRIBUTE:
if (!attrs_ok)
goto out;
@@ -4756,6 +4796,19 @@ c_parser_compound_statement_nostart (c_parser *parser)
c_parser_consume_token (parser);
return;
}
+ /* Process all #pragma's just after the opening brace. This
+ handles #pragma upc, which can only appear just after
+ the opening brace, when it appears within a function body. */
+ push_upc_consistency_mode ();
+ permit_pragma_upc ();
+ while (c_parser_next_token_is (parser, CPP_PRAGMA))
+ {
+ location_t loc ATTRIBUTE_UNUSED = c_parser_peek_token (parser)->location;
+ if (c_parser_pragma (parser, pragma_compound, NULL))
+ last_label = false, last_stmt = true;
+ parser->error = false;
+ }
+ deny_pragma_upc ();
while (c_parser_next_token_is_not (parser, CPP_CLOSE_BRACE))
{
location_t loc = c_parser_peek_token (parser)->location;
@@ -4863,6 +4916,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
if (last_label)
error_at (label_loc, "label at end of compound statement");
c_parser_consume_token (parser);
+ pop_upc_consistency_mode ();
/* Restore the value we started with. */
mark_valid_location_for_stdc_pragma (save_valid_for_pragma);
}
@@ -5260,6 +5314,22 @@ c_parser_statement_after_labels (c_parser *parser, bool *if_p,
gcc_assert (c_dialect_objc ());
c_parser_objc_synchronized_statement (parser);
break;
+ case RID_UPC_FORALL:
+ gcc_assert (flag_upc);
+ c_parser_upc_forall_statement (parser);
+ break;
+ case RID_UPC_NOTIFY:
+ gcc_assert (flag_upc);
+ c_parser_upc_sync_statement (parser, UPC_SYNC_NOTIFY_OP);
+ goto expect_semicolon;
+ case RID_UPC_WAIT:
+ gcc_assert (flag_upc);
+ c_parser_upc_sync_statement (parser, UPC_SYNC_WAIT_OP);
+ goto expect_semicolon;
+ case RID_UPC_BARRIER:
+ gcc_assert (flag_upc);
+ c_parser_upc_sync_statement (parser, UPC_SYNC_BARRIER_OP);
+ goto expect_semicolon;
default:
goto expr_stmt;
}
@@ -6899,6 +6969,11 @@ c_parser_unary_expression (c_parser *parser)
{
case RID_SIZEOF:
return c_parser_sizeof_expression (parser);
+ case RID_UPC_BLOCKSIZEOF:
+ case RID_UPC_ELEMSIZEOF:
+ case RID_UPC_LOCALSIZEOF:
+ gcc_assert (flag_upc);
+ return c_parser_sizeof_expression (parser);
case RID_ALIGNOF:
return c_parser_alignof_expression (parser);
case RID_EXTENSION:
@@ -6931,6 +7006,147 @@ c_parser_unary_expression (c_parser *parser)
}
}
+/* Return the result of upc_blocksizeof applied to EXPR. */
+
+static
+struct c_expr
+upc_blocksizeof_expr (location_t loc, struct c_expr expr)
+{
+ struct c_expr ret;
+ ret.original_code = ERROR_MARK;
+ ret.original_type = NULL_TREE;
+ if (expr.value == error_mark_node)
+ {
+ ret.value = error_mark_node;
+ pop_maybe_used (false);
+ }
+ else
+ {
+ ret.value = upc_blocksizeof (loc, TREE_TYPE (expr.value));
+ pop_maybe_used (C_TYPE_VARIABLE_SIZE (TREE_TYPE (expr.value)));
+ }
+ return ret;
+}
+
+/* Return the result of upc_blocksizeof applied to T, a structure
+ for the type name passed to sizeof (rather than the type itself). */
+
+static
+struct c_expr
+upc_blocksizeof_type (location_t loc, struct c_type_name *t)
+{
+ tree type;
+ struct c_expr ret;
+ ret.original_code = ERROR_MARK;
+ ret.original_type = NULL_TREE;
+ type = groktypename (t, NULL, NULL);
+ if (type == error_mark_node)
+ {
+ ret.value = error_mark_node;
+ pop_maybe_used (false);
+ }
+ else
+ {
+ ret.value = upc_blocksizeof (loc, type);
+ pop_maybe_used (C_TYPE_VARIABLE_SIZE (type));
+ }
+ return ret;
+}
+
+/* Return the result of upc_elemsizeof applied to EXPR. */
+
+static
+struct c_expr
+upc_elemsizeof_expr (location_t loc, struct c_expr expr)
+{
+ struct c_expr ret;
+ ret.original_code = ERROR_MARK;
+ ret.original_type = NULL_TREE;
+ if (expr.value == error_mark_node)
+ {
+ ret.value = error_mark_node;
+ pop_maybe_used (false);
+ }
+ else
+ {
+ ret.value = upc_elemsizeof (loc, TREE_TYPE (expr.value));
+ pop_maybe_used (C_TYPE_VARIABLE_SIZE (TREE_TYPE (expr.value)));
+ }
+ return ret;
+}
+
+/* Return the result of upc_elemsizeof applied to T, a structure
+ for the type name passed to sizeof (rather than the type itself). */
+
+static
+struct c_expr
+upc_elemsizeof_type (location_t loc, struct c_type_name *t)
+{
+ tree type;
+ struct c_expr ret;
+ ret.original_code = ERROR_MARK;
+ ret.original_type = NULL_TREE;
+ type = groktypename (t, NULL, NULL);
+ if (type == error_mark_node)
+ {
+ ret.value = error_mark_node;
+ pop_maybe_used (false);
+ }
+ else
+ {
+ ret.value = upc_elemsizeof (loc, type);
+ pop_maybe_used (C_TYPE_VARIABLE_SIZE (type));
+ }
+ return ret;
+}
+
+/* Return the result of upc_localsizeof applied to EXPR. */
+
+static
+struct c_expr
+upc_localsizeof_expr (location_t loc, struct c_expr expr)
+{
+ struct c_expr ret;
+ ret.original_code = ERROR_MARK;
+ ret.original_type = NULL_TREE;
+ if (expr.value == error_mark_node)
+ {
+ ret.value = error_mark_node;
+ pop_maybe_used (false);
+ }
+ else
+ {
+ ret.value = upc_localsizeof (loc, TREE_TYPE (expr.value));
+ pop_maybe_used (C_TYPE_VARIABLE_SIZE (TREE_TYPE (expr.value)));
+ }
+ return ret;
+}
+
+/* Return the result of upc_localsizeof applied to T, a structure
+ for the type name passed to sizeof (rather than the type itself). */
+
+static
+struct c_expr
+upc_localsizeof_type (location_t loc, struct c_type_name *t)
+{
+ tree type;
+ struct c_expr ret;
+ ret.original_code = ERROR_MARK;
+ ret.original_type = NULL_TREE;
+ type = groktypename (t, NULL, NULL);
+ if (type == error_mark_node)
+ {
+ ret.value = error_mark_node;
+ pop_maybe_used (false);
+ }
+ else
+ {
+ ret.value = upc_localsizeof (loc, type);
+ pop_maybe_used (C_TYPE_VARIABLE_SIZE (type));
+ }
+ return ret;
+}
+
/* Parse a sizeof expression. */
static struct c_expr
@@ -6939,7 +7155,7 @@ c_parser_sizeof_expression (c_parser *parser)
struct c_expr expr;
struct c_expr result;
location_t expr_loc;
- gcc_assert (c_parser_next_token_is_keyword (parser, RID_SIZEOF));
+ enum rid keyword = c_parser_peek_token (parser)->keyword;
location_t start;
location_t finish = UNKNOWN_LOCATION;
@@ -6981,7 +7197,23 @@ c_parser_sizeof_expression (c_parser *parser)
/* sizeof ( type-name ). */
c_inhibit_evaluation_warnings--;
in_sizeof--;
- result = c_expr_sizeof_type (expr_loc, type_name);
+ /* Handle sizeof (type) and upc_*_sizeof (type) operations. */
+ switch (keyword)
+ {
+ case RID_SIZEOF:
+ result = c_expr_sizeof_type (expr_loc, type_name);
+ break;
+ case RID_UPC_BLOCKSIZEOF:
+ result = upc_blocksizeof_type (expr_loc, type_name);
+ break;
+ case RID_UPC_ELEMSIZEOF:
+ result = upc_elemsizeof_type (expr_loc, type_name);
+ break;
+ case RID_UPC_LOCALSIZEOF:
+ result = upc_localsizeof_type (expr_loc, type_name);
+ break;
+ default: gcc_unreachable ();
+ }
}
else
{
@@ -6995,7 +7227,23 @@ c_parser_sizeof_expression (c_parser *parser)
if (TREE_CODE (expr.value) == COMPONENT_REF
&& DECL_C_BIT_FIELD (TREE_OPERAND (expr.value, 1)))
error_at (expr_loc, "%<sizeof%> applied to a bit-field");
- result = c_expr_sizeof_expr (expr_loc, expr);
+ /* Handle sizeof (expr) and upc_*_sizeof (expr) operations. */
+ switch (keyword)
+ {
+ case RID_SIZEOF:
+ result = c_expr_sizeof_expr (expr_loc, expr);
+ break;
+ case RID_UPC_BLOCKSIZEOF:
+ result = upc_blocksizeof_expr (expr_loc, expr);
+ break;
+ case RID_UPC_ELEMSIZEOF:
+ result = upc_elemsizeof_expr (expr_loc, expr);
+ break;
+ case RID_UPC_LOCALSIZEOF:
+ result = upc_localsizeof_expr (expr_loc, expr);
+ break;
+ default: gcc_unreachable ();
+ }
}
if (finish != UNKNOWN_LOCATION)
set_c_expr_source_range (&result, start, finish);
@@ -10013,6 +10261,316 @@ c_parser_objc_at_dynamic_declaration (c_parser *parser)
objc_add_dynamic_declaration (loc, list);
}
+/* Parse UPC shared qualifier
+
+ shared-type-qualifier: shared layout-qualifier-opt
+ layout-qualifier: [ constant-expression-opt ] | [ * ]
+
+*/
+static void
+c_parser_upc_shared_qual (source_location loc,
+ c_parser *parser,
+ struct c_declspecs *specs)
+{
+ tree array_qual, arg1;
+
+ /* consume "shared" part */
+ c_parser_consume_token (parser);
+
+ /* check for shared array layout specifier */
+ if (!c_parser_next_token_is (parser, CPP_OPEN_SQUARE))
+ {
+ declspecs_add_qual (loc, specs, ridpointers[RID_SHARED]);
+ return;
+ }
+ c_parser_consume_token (parser);
+ if (c_parser_next_token_is (parser, CPP_CLOSE_SQUARE))
+ {
+ /* [] layout specifier */
+ arg1 = size_zero_node;
+ }
+ else if (c_parser_next_token_is (parser, CPP_MULT))
+ {
+ /* [*] layout specifier */
+ arg1 = build1 (INDIRECT_REF, NULL_TREE, NULL_TREE);
+ c_parser_consume_token (parser);
+ }
+ else
+ {
+ /* [ expression ] layout specifier */
+ arg1 = c_parser_expression (parser).value;
+ }
+ array_qual = build4 (ARRAY_REF, NULL_TREE, NULL_TREE,
+ arg1, NULL_TREE, NULL_TREE);
+ declspecs_add_qual (loc, specs, array_qual);
+
+ if (!c_parser_next_token_is (parser, CPP_CLOSE_SQUARE))
+ {
+ c_parser_error (parser, "expected ]");
+ }
+ c_parser_consume_token (parser);
+}
+
+/* Implement UPC's upc_forall 'affinity' test.
+ If the type of AFFINITY is a UPC pointer-to-shared type,
+ rewrite it into:
+ upc_threadof (AFFINITY) == MYTHREAD
+ If AFFINITY is an integer expression, then
+ rewrite it into:
+ (AFFINITY % THREADS) == MYTHREAD */
+
+static tree
+upc_affinity_test (location_t loc, tree affinity)
+{
+ tree mythread;
+ tree affinity_test;
+
+ gcc_assert (affinity != NULL_TREE);
+
+ if (TREE_CODE (TREE_TYPE (affinity)) == POINTER_TYPE
+ && SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (affinity))))
+ {
+ /* We have a pointer to a UPC shared object and the affinity is
+ determined by the thread component of the address. */
+ const tree pts_rep = build1 (VIEW_CONVERT_EXPR, upc_pts_rep_type_node,
+ save_expr (affinity));
+ affinity = upc_pts_build_threadof (loc, pts_rep);
+ }
+ else if (TREE_CODE (TREE_TYPE (affinity)) == INTEGER_TYPE)
+ {
+ tree n_threads = upc_num_threads ();
+ affinity =
+ build_binary_op (loc, FLOOR_MOD_EXPR, affinity, n_threads, 0);
+ }
+ else
+ {
+ error
+ ("UPC affinity expression is neither an integer nor the address of "
+ "a shared object");
+ return error_mark_node;
+ }
+
+ /* Generate an external reference to the "MYTHREAD" identifier. */
+
+ mythread = lookup_name (get_identifier ("MYTHREAD"));
+ gcc_assert (mythread != NULL_TREE);
+ TREE_USED (mythread) = 1;
+
+ /* AFFINITY now contains an integer value that can be compared to MY_THREAD.
+ Create an expression that tests if AFFINITY is equal to MYTHREAD. */
+
+ if (!c_types_compatible_p (TREE_TYPE (affinity), TREE_TYPE (mythread)))
+ affinity = convert (TREE_TYPE (mythread), affinity);
+ affinity_test = c_objc_common_truthvalue_conversion (loc,
+ build_binary_op (loc, EQ_EXPR,
+ affinity, mythread, 1));
+ /* Remove any MAYBE_CONST_EXPR's. */
+
+ affinity_test = c_fully_fold (affinity_test, false, NULL);
+
+ return affinity_test;
+}
+
+/* Parse a UPC upc_forall statement
+
+ upc_forall-statement:
+ upc_forall ( expression[opt] ; expression[opt] ;
+ expression[opt] ; affinity[opt] ) statement
+ affinity: expression | continue */
+
+static void
+c_parser_upc_forall_statement (c_parser *parser)
+{
+ tree block, cond, incr, save_break, save_cont, body;
+ tree affinity;
+ location_t loc = c_parser_peek_token (parser)->location;
+ location_t affinity_loc = UNKNOWN_LOCATION;
+ const int profile_upc_forall = flag_upc_instrument && get_upc_pupc_mode();
+ gcc_assert (c_parser_next_token_is_keyword (parser, RID_UPC_FORALL));
+ c_parser_consume_token (parser);
+ block = c_begin_compound_stmt (flag_isoc99);
+ if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ {
+ /* Parse the initialization declaration or expression. */
+ if (c_parser_next_token_is (parser, CPP_SEMICOLON))
+ {
+ c_parser_consume_token (parser);
+ c_finish_expr_stmt (loc, NULL_TREE);
+ }
+ else if (c_parser_next_token_starts_declspecs (parser))
+ {
+ c_parser_declaration_or_fndef (parser, true, true, true,
+ true, true, NULL, vNULL);
+ check_for_loop_decls (loc, true);
+ }
+ else if (c_parser_next_token_is_keyword (parser, RID_EXTENSION))
+ {
+ /* __extension__ can start a declaration, but is also an
+ unary operator that can start an expression. Consume all
+ but the last of a possible series of __extension__ to
+ determine which. */
+ while (c_parser_peek_2nd_token (parser)->type == CPP_KEYWORD
+ && (c_parser_peek_2nd_token (parser)->keyword
+ == RID_EXTENSION))
+ c_parser_consume_token (parser);
+ if (c_token_starts_declspecs (c_parser_peek_2nd_token (parser)))
+ {
+ int ext;
+ ext = disable_extension_diagnostics ();
+ c_parser_consume_token (parser);
+ c_parser_declaration_or_fndef (parser, true, true, true, true, true,
+ NULL, vNULL);
+ restore_extension_diagnostics (ext);
+ check_for_loop_decls (loc, true);
+ }
+ else
+ goto init_expr;
+ }
+ else
+ {
+ init_expr:
+ c_finish_expr_stmt (loc, c_parser_expression (parser).value);
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
+ }
+ /* Parse the loop condition. */
+ if (c_parser_next_token_is (parser, CPP_SEMICOLON))
+ {
+ c_parser_consume_token (parser);
+ cond = NULL_TREE;
+ }
+ else
+ {
+ cond = c_parser_condition (parser);
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
+ }
+ /* Parse the increment expression. */
+ if (c_parser_next_token_is (parser, CPP_SEMICOLON))
+ incr = c_process_expr_stmt (loc, NULL_TREE);
+ else
+ incr = c_process_expr_stmt (loc, c_parser_expression (parser).value);
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
+ /* Parse the UPC affinity expression. */
+ affinity_loc = c_parser_peek_token (parser)->location;
+ if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
+ {
+ affinity = NULL_TREE;
+ }
+ else if (c_parser_peek_token (parser)->type == CPP_KEYWORD
+ && c_parser_peek_token (parser)->keyword == RID_CONTINUE)
+ {
+ affinity = NULL_TREE;
+ c_parser_consume_token (parser);
+ }
+ else
+ {
+ affinity = c_parser_expression_conv (parser).value;
+ affinity = c_fully_fold (affinity, false, NULL);
+ }
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+ if (affinity)
+ affinity = upc_affinity_test (affinity_loc, affinity);
+ }
+ else
+ {
+ cond = error_mark_node;
+ incr = error_mark_node;
+ affinity = error_mark_node;
+ }
+ save_break = c_break_label;
+ c_break_label = NULL_TREE;
+ save_cont = c_cont_label;
+ c_cont_label = NULL_TREE;
+ body = c_parser_c99_block_statement (parser, NULL);
+ if (profile_upc_forall)
+ {
+ const tree gasp_start = upc_instrument_forall (loc, 1 /* start */);
+ add_stmt (gasp_start);
+ }
+ loc = c_parser_peek_token (parser)->location;
+ if (affinity != NULL_TREE && affinity != error_mark_node)
+ {
+ tree upc_forall_depth = upc_rts_forall_depth_var ();
+ tree inc_depth, depth_gt_one;
+ inc_depth = build_unary_op (loc, PREINCREMENT_EXPR, upc_forall_depth, 0);
+ c_finish_expr_stmt (loc, inc_depth);
+ depth_gt_one = build_binary_op (affinity_loc,
+ GT_EXPR, upc_forall_depth, integer_one_node, 0);
+ depth_gt_one = c_objc_common_truthvalue_conversion (affinity_loc, depth_gt_one);
+ depth_gt_one = c_fully_fold (depth_gt_one, false, NULL);
+ affinity = build_binary_op (affinity_loc, TRUTH_OR_EXPR,
+ depth_gt_one, affinity, 0);
+ body = build3 (COND_EXPR, void_type_node, affinity,
+ body, NULL_TREE);
+ c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, true);
+ c_finish_expr_stmt (loc,
+ build_unary_op (loc, PREDECREMENT_EXPR, upc_forall_depth, 0));
+ }
+ else
+ c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, true);
+ if (profile_upc_forall)
+ {
+ const tree gasp_end = upc_instrument_forall (loc, 0 /* start */);
+ add_stmt (gasp_end);
+ }
+ add_stmt (c_end_compound_stmt (loc, block, flag_isoc99));
+ c_break_label = save_break;
+ c_cont_label = save_cont;
+}
+
+/* For the given kind of UPC synchronization statement given
+ by SYNC_KIND (UPC_SYNC_NOTIFY_OP, UPC_SYNC_WAIT_OP,
+ or UPC_SYNC_BARRIER_OP), build a UPC_SYNC_STMT tree node,
+ and add it to the current statement list. The value of
+ SYNC_EXPR will be non-null if an expression is present
+ in the UPC statement being compiled.
+
+ If SYNC_EXPR is supplied, it must be assignment compatible
+ with type 'int'. */
+
+static tree
+upc_build_sync_stmt (location_t loc, tree sync_kind, tree sync_expr)
+{
+ if (sync_expr != NULL_TREE)
+ {
+ mark_exp_read (sync_expr);
+ sync_expr = c_cvt_expr_for_assign (loc, integer_type_node, sync_expr);
+ if (sync_expr == error_mark_node)
+ {
+ inform (loc, "UPC synchronization statement expressions "
+ "must be assignment compatible with type `int'");
+ sync_expr = NULL_TREE;
+ }
+ }
+ return add_stmt (build_stmt (loc, UPC_SYNC_STMT, sync_kind, sync_expr));
+}
+
+/* Parse an upc-sync-statement.
+
+ upc_barrier, upc_wait, upc_notify
+*/
+
+static void
+c_parser_upc_sync_statement (c_parser *parser, int sync_kind)
+{
+ location_t loc;
+ tree expr = NULL_TREE;
+ tree stmt;
+ gcc_assert (c_parser_next_token_is_keyword (parser, RID_UPC_BARRIER) ||
+ c_parser_next_token_is_keyword (parser, RID_UPC_NOTIFY) ||
+ c_parser_next_token_is_keyword (parser, RID_UPC_WAIT));
+ loc = c_parser_peek_token (parser)->location;
+ c_parser_consume_token (parser);
+ if (c_parser_peek_token (parser)->type != CPP_SEMICOLON)
+ {
+ loc = c_parser_peek_token (parser)->location;
+ expr = c_parser_expression (parser).value;
+ if (expr == error_mark_node)
+ expr = NULL;
+ }
+ stmt = size_int (sync_kind);
+ (void) upc_build_sync_stmt (loc, stmt, expr);
+}
+
/* Handle pragmas. Some OpenMP pragmas are associated with, and therefore
should be considered, statements. ALLOW_STMT is true if we're within
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index bb12a200f70..fe355bd27cd 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -288,6 +288,9 @@ struct c_declspecs {
NULL; attributes (possibly from multiple lists) will be passed
separately. */
tree attrs;
+ /* For UPC, this is the blocking factor (layout qualifier).
+ For example, shared [10] int x; */
+ tree upc_layout_qualifier;
/* The base-2 log of the greatest alignment required by an _Alignas
specifier, in bytes, or -1 if no such specifiers with nonzero
alignment. */
@@ -354,6 +357,12 @@ struct c_declspecs {
BOOL_BITFIELD atomic_p : 1;
/* Whether "_Sat" was specified. */
BOOL_BITFIELD saturating_p : 1;
+ /* Whether "shared" was specified. */
+ BOOL_BITFIELD shared_p : 1;
+ /* Whether "strict" was specified. */
+ BOOL_BITFIELD strict_p : 1;
+ /* Whether "relaxed" was specified. */
+ BOOL_BITFIELD relaxed_p : 1;
/* Whether any alignment specifier (even with zero alignment) was
specified. */
BOOL_BITFIELD alignas_p : 1;
@@ -431,7 +440,10 @@ struct c_declarator {
BOOL_BITFIELD vla_unspec_p : 1;
} array;
/* For pointers, the qualifiers on the pointer type. */
- int pointer_quals;
+ struct {
+ int quals;
+ tree upc_layout_qual;
+ } pointer;
/* For attributes. */
tree attrs;
} u;
@@ -673,6 +685,7 @@ extern void c_finish_omp_cancellation_point (location_t, tree);
extern tree c_finish_omp_clauses (tree, bool, bool = false);
extern tree c_build_va_arg (location_t, tree, location_t, tree);
extern tree c_finish_transaction (location_t, tree, int);
+extern tree c_cvt_expr_for_assign (location_t, tree, tree);
extern bool c_tree_equal (tree, tree);
extern tree c_build_function_call_vec (location_t, vec<location_t>, tree,
vec<tree, va_gc> *, vec<tree, va_gc> *);
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index b6b45558a54..4cd52d36ac3 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -43,6 +43,8 @@ along with GCC; see the file COPYING3. If not see
#include "gimplify.h"
#include "tree-inline.h"
#include "omp-low.h"
+#include "c-upc.h"
+#include "c-upc-low.h"
#include "c-family/c-objc.h"
#include "c-family/c-ubsan.h"
#include "cilk.h"
@@ -91,6 +93,7 @@ static tree lookup_field (tree, tree);
static int convert_arguments (location_t, vec<location_t>, tree,
vec<tree, va_gc> *, vec<tree, va_gc> *, tree,
tree);
+static tree c_pointer_int_sum (location_t, enum tree_code, tree, tree);
static tree pointer_diff (location_t, tree, tree);
static tree convert_for_assignment (location_t, location_t, tree, tree, tree,
enum impl_conv, bool, tree, tree, int);
@@ -317,9 +320,12 @@ addr_space_superset (addr_space_t as1, addr_space_t as2, addr_space_t *common)
static tree
qualify_type (tree type, tree like)
{
+ tree result_type;
addr_space_t as_type = TYPE_ADDR_SPACE (type);
addr_space_t as_like = TYPE_ADDR_SPACE (like);
addr_space_t as_common;
+ int result_quals;
+ tree result_block_factor = NULL_TREE;
/* If the two named address spaces are different, determine the common
superset address space. If there isn't one, raise an error. */
@@ -330,10 +336,31 @@ qualify_type (tree type, tree like)
type, like);
}
- return c_build_qualified_type (type,
- TYPE_QUALS_NO_ADDR_SPACE (type)
- | TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (like)
- | ENCODE_QUAL_ADDR_SPACE (as_common));
+ result_quals = TYPE_QUALS_NO_ADDR_SPACE (type)
+ | TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (like)
+ | ENCODE_QUAL_ADDR_SPACE (as_common);
+
+ if (result_quals & TYPE_QUAL_SHARED)
+ {
+ tree b1 = TYPE_BLOCK_FACTOR (type);
+ tree b2 = TYPE_BLOCK_FACTOR (like);
+ /* We can merge in a new UPC blocking factor only
+ if one/other is NULL. Otherwise, they must match. */
+ if (b1 != b2)
+ {
+ if (b1 && !b2)
+ result_block_factor = b1;
+ else if (!b1 && b2)
+ result_block_factor = b2;
+ else
+ gcc_unreachable ();
+ }
+ }
+
+ result_type = c_build_qualified_type (type, result_quals,
+ result_block_factor);
+
+ return result_type;
}
/* Return true iff the given tree T is a variable length array. */
@@ -626,6 +653,7 @@ common_pointer_type (tree t1, tree t2)
tree pointed_to_2, mv2;
tree target;
unsigned target_quals;
+ tree target_block_factor = NULL_TREE;
addr_space_t as1, as2, as_common;
int quals1, quals2;
@@ -668,6 +696,10 @@ common_pointer_type (tree t1, tree t2)
else
target_quals = (quals1 | quals2);
+ if (target_quals & TYPE_QUAL_SHARED)
+ target_block_factor = TYPE_BLOCK_FACTOR (
+ strip_array_types (pointed_to_1));
+
/* If the two named address spaces are different, determine the common
superset address space. This is guaranteed to exist due to the
assumption that comp_target_type returned non-zero. */
@@ -677,8 +709,9 @@ common_pointer_type (tree t1, tree t2)
gcc_unreachable ();
target_quals |= ENCODE_QUAL_ADDR_SPACE (as_common);
+ t2 = c_build_qualified_type (target, target_quals, target_block_factor);
- t1 = build_pointer_type (c_build_qualified_type (target, target_quals));
+ t1 = build_pointer_type (t2);
return build_type_attribute_variant (t1, attributes);
}
@@ -1086,6 +1119,13 @@ comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p,
if (TYPE_QUALS (t1) != TYPE_QUALS (t2))
return 0;
+ /* If the type is UPC qualified, the block sizes have
+ to be equal. The block sizes are either NULL
+ or are the same integer constant. */
+ if ((TYPE_QUALS (t1) & TYPE_QUAL_SHARED)
+ && (TYPE_BLOCK_FACTOR (t1) != TYPE_BLOCK_FACTOR (t2)))
+ return 0;
+
/* Allow for two different type nodes which have essentially the same
definition. Note that we already checked for equality of the type
qualifiers (just above). */
@@ -2096,6 +2136,10 @@ default_conversion (tree exp)
/* Functions and arrays have been converted during parsing. */
gcc_assert (code != FUNCTION_TYPE);
+
+ if (code == ARRAY_TYPE && SHARED_TYPE_P (type))
+ return array_to_pointer_conversion (input_location, exp);
+
if (code == ARRAY_TYPE)
return exp;
@@ -2350,6 +2394,7 @@ build_component_ref (location_t loc, tree datum, tree component)
error_at (loc, "%qT has no member named %qE", type, component);
return error_mark_node;
}
+ gcc_assert (!TREE_SHARED (field));
/* Accessing elements of atomic structures or unions is undefined
behavior (C11 6.5.2.3#5). */
@@ -2371,6 +2416,8 @@ build_component_ref (location_t loc, tree datum, tree component)
do
{
tree subdatum = TREE_VALUE (field);
+ tree sub_elem_type = strip_array_types (TREE_TYPE (subdatum));
+ tree upc_block_factor = NULL_TREE;
int quals;
tree subtype;
bool use_datum_quals;
@@ -2385,10 +2432,15 @@ build_component_ref (location_t loc, tree datum, tree component)
use_datum_quals = (datum_lvalue
|| TREE_CODE (TREE_TYPE (subdatum)) != ARRAY_TYPE);
- quals = TYPE_QUALS (strip_array_types (TREE_TYPE (subdatum)));
+ quals = TYPE_QUALS (sub_elem_type);
if (use_datum_quals)
quals |= TYPE_QUALS (TREE_TYPE (datum));
- subtype = c_build_qualified_type (TREE_TYPE (subdatum), quals);
+ /* All references to UPC shared struct components
+ are defined to have an indefinite (zero) blocking factor. */
+ if (quals & TYPE_QUAL_SHARED)
+ upc_block_factor = size_zero_node;
+ subtype = c_build_qualified_type (TREE_TYPE (subdatum),
+ quals, upc_block_factor);
ref = build3 (COMPONENT_REF, subtype, datum, subdatum,
NULL_TREE);
@@ -2399,6 +2451,8 @@ build_component_ref (location_t loc, tree datum, tree component)
if (TREE_THIS_VOLATILE (subdatum)
|| (use_datum_quals && TREE_THIS_VOLATILE (datum)))
TREE_THIS_VOLATILE (ref) = 1;
+ if (TREE_SHARED (datum))
+ TREE_SHARED (ref) = 1;
if (TREE_DEPRECATED (subdatum))
warn_deprecated_use (subdatum, NULL_TREE);
@@ -2496,6 +2550,7 @@ build_indirect_ref (location_t loc, tree ptr, ref_operator errstring)
TREE_SIDE_EFFECTS (ref)
= TYPE_VOLATILE (t) || TREE_SIDE_EFFECTS (pointer);
TREE_THIS_VOLATILE (ref) = TYPE_VOLATILE (t);
+ TREE_SHARED (ref) = SHARED_TYPE_P (t);
protected_set_expr_location (ref, loc);
return ref;
}
@@ -2584,7 +2639,8 @@ build_array_ref (location_t loc, tree array, tree index)
bool non_lvalue
= convert_vector_to_pointer_for_subscript (loc, &array, index);
- if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE)
+ if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE
+ && !SHARED_TYPE_P (TREE_TYPE (array)))
{
tree rval, type;
@@ -3644,6 +3700,23 @@ parser_build_binary_op (location_t location, enum tree_code code,
return result;
}
+/* Return a tree for the sum or difference (RESULTCODE says which)
+ of pointer PTROP and integer INTOP. */
+
+static
+tree
+c_pointer_int_sum (location_t location, enum tree_code resultcode,
+ tree ptrop, tree intop)
+{
+ /* The result is a pointer of the same type that is being added. */
+ tree result_type = TREE_TYPE (ptrop);
+
+ if (SHARED_TYPE_P (TREE_TYPE (result_type)))
+ return upc_pts_int_sum (location, resultcode, ptrop, intop);
+
+ return pointer_int_sum (location, resultcode, ptrop, intop);
+}
+
/* Return a tree for the difference of pointers OP0 and OP1.
The resulting tree has type int. */
@@ -3656,6 +3729,7 @@ pointer_diff (location_t loc, tree op0, tree op1)
addr_space_t as0 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op0)));
addr_space_t as1 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op1)));
tree target_type = TREE_TYPE (TREE_TYPE (op0));
+ tree subtrahend_type = TREE_TYPE (TREE_TYPE (op1));
tree orig_op1 = op1;
/* If the operands point into different address spaces, we need to
@@ -3692,6 +3766,9 @@ pointer_diff (location_t loc, tree op0, tree op1)
pedwarn (loc, OPT_Wpointer_arith,
"pointer to a function used in subtraction");
+ if (SHARED_TYPE_P (target_type) || SHARED_TYPE_P (subtrahend_type))
+ return upc_pts_diff (op0, op1);
+
/* First do the subtraction as integers;
then drop through to build the divide operator.
Do not do default conversions on the minus operator
@@ -4293,6 +4370,11 @@ build_unary_op (location_t location,
"wrong type argument to decrement");
}
+ /* UPC pointer-to-shared types cannot be
+ incremented/decremented directly. */
+ if (SHARED_TYPE_P (TREE_TYPE (argtype)))
+ return upc_pts_increment (location, code, arg);
+
inc = c_size_in_bytes (TREE_TYPE (argtype));
inc = convert_to_ptrofftype_loc (location, inc);
}
@@ -4507,6 +4589,10 @@ build_unary_op (location_t location,
ret = build1 (code, argtype, arg);
return_build_unary_op:
gcc_assert (ret != error_mark_node);
+ /* The result of an operation on objects that
+ are UPC shared qualified, must not be shared qualified. */
+ if (SHARED_TYPE_P (TREE_TYPE (ret)))
+ TREE_TYPE (ret) = build_unshared_type (TREE_TYPE (ret));
if (TREE_CODE (ret) == INTEGER_CST && !TREE_OVERFLOW (ret)
&& !(TREE_CODE (xarg) == INTEGER_CST && !TREE_OVERFLOW (xarg)))
ret = build1 (NOP_EXPR, TREE_TYPE (ret), ret);
@@ -4950,7 +5036,8 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
"pointer/integer type mismatch in conditional expression");
else
{
- op2 = null_pointer_node;
+ op2 = !SHARED_TYPE_P (TREE_TYPE (type1))
+ ? null_pointer_node : upc_null_pts_node;
}
result_type = type1;
}
@@ -4961,7 +5048,8 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
"pointer/integer type mismatch in conditional expression");
else
{
- op1 = null_pointer_node;
+ op1 = !SHARED_TYPE_P (TREE_TYPE (type2))
+ ? null_pointer_node : upc_null_pts_node;
}
result_type = type2;
}
@@ -5256,6 +5344,12 @@ build_c_cast (location_t loc, tree type, tree expr)
if (objc_is_object_ptr (type) && objc_is_object_ptr (TREE_TYPE (expr)))
return build1 (NOP_EXPR, type, expr);
+ if (SHARED_TYPE_P (type))
+ {
+ error_at (loc, "UPC does not allow casts to a shared type");
+ return error_mark_node;
+ }
+
type = TYPE_MAIN_VARIANT (type);
if (TREE_CODE (type) == ARRAY_TYPE)
@@ -5277,6 +5371,22 @@ build_c_cast (location_t loc, tree type, tree expr)
return error_mark_node;
}
+ if (integer_zerop (value)
+ && POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type))
+ && POINTER_TYPE_P (TREE_TYPE (expr))
+ && ! SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (expr))))
+ {
+ value = upc_null_pts_node;
+ }
+
+ if (!SHARED_TYPE_P (type) && SHARED_TYPE_P (TREE_TYPE (expr)))
+ {
+ /* UPC disallows things like:
+ (int)p = <expr>; (where p is a shared int) */
+ value = non_lvalue (value);
+ }
+
if (type == TYPE_MAIN_VARIANT (TREE_TYPE (value)))
{
if (RECORD_OR_UNION_TYPE_P (type))
@@ -5327,6 +5437,17 @@ build_c_cast (location_t loc, tree type, tree expr)
otype = TREE_TYPE (value);
+ if (TREE_CODE (type) == POINTER_TYPE
+ && TREE_CODE (otype) == POINTER_TYPE)
+ {
+ int t_shared = SHARED_TYPE_P (TREE_TYPE (type));
+ int o_shared = SHARED_TYPE_P (TREE_TYPE (otype));
+ if ((!t_shared && o_shared)
+ || (t_shared && o_shared
+ && !lang_hooks.types_compatible_p (type, otype)))
+ return build1 (CONVERT_EXPR, type, value);
+ }
+
/* Optionally warn about potentially worrisome casts. */
if (warn_cast_qual
&& TREE_CODE (type) == POINTER_TYPE
@@ -5377,6 +5498,33 @@ build_c_cast (location_t loc, tree type, tree expr)
warning_at (loc, OPT_Wcast_align,
"cast increases required alignment of target type");
+ if (POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type))
+ && POINTER_TYPE_P (otype)
+ && !SHARED_TYPE_P (TREE_TYPE (otype)))
+ {
+ error_at (loc, "UPC does not allow casts from a local pointer to a pointer-to-shared");
+ return error_mark_node;
+ }
+
+ if (TREE_CODE (type) == POINTER_TYPE
+ && TREE_CODE (otype) == INTEGER_TYPE
+ && SHARED_TYPE_P (TREE_TYPE (type))
+ && !integer_zerop (value))
+ {
+ error_at (loc, "UPC does not allow casts from an integer to a pointer-to-shared");
+ return error_mark_node;
+ }
+
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && TREE_CODE (otype) == POINTER_TYPE
+ && SHARED_TYPE_P (TREE_TYPE (otype)))
+ {
+ /* UPC pointer-to-shared -> integer
+ This will be lowered by the genericize pass. */
+ return build1 (CONVERT_EXPR, type, value);
+ }
+
if (TREE_CODE (type) == INTEGER_TYPE
&& TREE_CODE (otype) == POINTER_TYPE
&& TYPE_PRECISION (type) != TYPE_PRECISION (otype))
@@ -5699,6 +5847,12 @@ build_modify_expr (location_t location, tree lhs, tree lhs_origtype,
newrhs = c_fully_fold (newrhs, false, NULL);
if (rhs_semantic_type)
newrhs = build1 (EXCESS_PRECISION_EXPR, rhs_semantic_type, newrhs);
+ /* If the lhs is UPC 'shared' qualified, we drop the qualifier
+ for the purposes of conversions from rhstype to lhstype.
+ This will prevent the inadvertent creation of temporaries
+ with "shared" asserted. */
+ if (SHARED_TYPE_P (lhstype))
+ lhstype = build_unshared_type (lhstype);
newrhs = convert_for_assignment (location, rhs_loc, lhstype, newrhs,
rhs_origtype, ic_assign, npc,
NULL_TREE, NULL_TREE, 0);
@@ -6012,6 +6166,34 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
} \
} while (0)
+ /* Similar to WARN_FOR_ASSIGNMENT, but used to diagnose certain
+ error conditions defined by the UPC language specification
+ when converting between pointer-to-shared types and other types. */
+#define ERROR_FOR_ASSIGNMENT(LOCATION, OPT, AR, AS, IN, RE) \
+ do { \
+ switch (errtype) \
+ { \
+ case ic_argpass: \
+ error_at (LOCATION, AR, parmnum, rname); \
+ inform ((fundecl && !DECL_IS_BUILTIN (fundecl)) \
+ ? DECL_SOURCE_LOCATION (fundecl) : LOCATION, \
+ "expected %qT but argument is of type %qT", \
+ type, rhstype); \
+ break; \
+ case ic_assign: \
+ error_at (LOCATION, AS); \
+ break; \
+ case ic_init: \
+ error_at (LOCATION, IN); \
+ break; \
+ case ic_return: \
+ error_at (LOCATION, RE); \
+ break; \
+ default: \
+ gcc_unreachable (); \
+ } \
+ } while (0)
+
/* This macro is used to emit diagnostics to ensure that all format
strings are complete sentences, visible to gettext and checked at
compile time. It is the same as PEDWARN_FOR_ASSIGNMENT but with an
@@ -6255,7 +6437,9 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
/* Can convert integer zero to any pointer type. */
if (null_pointer_constant)
{
- rhs = null_pointer_node;
+ tree ttl = TREE_TYPE (memb_type);
+ rhs = !SHARED_TYPE_P (ttl)
+ ? null_pointer_node : upc_null_pts_node;
break;
}
}
@@ -6345,6 +6529,43 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
? c_build_qualified_type (TYPE_MAIN_VARIANT (mvr),
TYPE_QUAL_ATOMIC)
: TYPE_MAIN_VARIANT (mvr));
+ if ((SHARED_TYPE_P (ttl) && !SHARED_TYPE_P (ttr))
+ && !integer_zerop (rhs))
+ {
+ error_at (location, "UPC does not allow assignments from a local pointer "
+ "to a pointer-to-shared");
+ return error_mark_node;
+ }
+ if (!SHARED_TYPE_P (ttl) && SHARED_TYPE_P (ttr))
+ {
+ if (upc_is_null_pts_p (rhs))
+ {
+ return null_pointer_node;
+ }
+ else
+ {
+ error_at (location, "UPC does not allow assignments "
+ "from a pointer-to-shared to a local pointer");
+ return error_mark_node;
+ }
+ }
+ if (SHARED_TYPE_P (ttl) && SHARED_TYPE_P (ttr) && (ttl != ttr)
+ && !(VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr)))
+ {
+ const tree bs_l = get_block_factor (ttl);
+ const tree bs_r = get_block_factor (ttr);
+ /* Both source and destination are non-void pointers to shared,
+ whose target types are not equal.
+ UPC dictates that their blocking factors must be equal. */
+ if (!tree_int_cst_equal (bs_l, bs_r))
+ {
+ error_at (location, "UPC does not allow assignment "
+ "between pointers to shared with "
+ "differing block sizes without a cast");
+ return error_mark_node;
+ }
+ }
+
/* Opaque pointers are treated like void pointers. */
is_opaque_pointer = vector_targets_convertible_p (ttl, ttr);
@@ -6583,6 +6804,19 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
}
else if (codel == POINTER_TYPE && coder == INTEGER_TYPE)
{
+ if (!null_pointer_constant && SHARED_TYPE_P (TREE_TYPE (type)))
+ {
+ ERROR_FOR_ASSIGNMENT (location, 0,
+ G_("passing argument %d of %qE attempts to make "
+ "a UPC pointer-to-shared value from an integer"),
+ G_("assignment attempts to make a UPC pointer-to-shared "
+ "value from an integer"),
+ G_("initialization attempts to make a UPC pointer-to-shared "
+ "value from an integer without a cast"),
+ G_("return makes a UPC pointer-to-shared value from an "
+ "integer"));
+ return error_mark_node;
+ }
/* An explicit constant 0 can convert to a pointer,
or one that results from arithmetic, even including
a cast to integer type. */
@@ -6688,21 +6922,31 @@ valid_compound_expr_initializer (tree value, tree endtype)
void
store_init_value (location_t init_loc, tree decl, tree init, tree origtype)
{
- tree value, type;
- bool npc = false;
+ const bool npc = init && null_pointer_constant_p (init);
+ const bool is_upc_decl_init = upc_check_decl_init (decl, init);
+ const bool require_constant = TREE_STATIC (decl) && !is_upc_decl_init;
+ tree type = TREE_TYPE (decl);
+ tree value;
/* If variable's type was invalidly declared, just ignore it. */
- type = TREE_TYPE (decl);
if (TREE_CODE (type) == ERROR_MARK)
return;
/* Digest the specified initializer into an expression. */
- if (init)
- npc = null_pointer_constant_p (init);
value = digest_init (init_loc, type, init, origtype, npc,
- true, TREE_STATIC (decl));
+ true, require_constant);
+
+ /* UPC cannot initialize certain values at compile time.
+ For example, the address of a UPC 'shared' variable must
+ be evaluated at runtime. */
+
+ if (is_upc_decl_init)
+ {
+ upc_decl_init (decl, value);
+ return;
+ }
/* Store the expression if valid; else report error. */
@@ -7508,6 +7752,9 @@ really_start_incremental_init (tree type)
designator_depth = 0;
designator_erroneous = 0;
+ /* The result of the constructor must not be UPC shared qualified */
+ if (SHARED_TYPE_P (constructor_type))
+ constructor_type = build_unshared_type (constructor_type);
if (RECORD_OR_UNION_TYPE_P (constructor_type))
{
constructor_fields = TYPE_FIELDS (constructor_type);
@@ -9793,6 +10040,20 @@ c_finish_return (location_t loc, tree retval, tree origtype)
TREE_NO_WARNING (ret_stmt) |= no_warning;
return add_stmt (ret_stmt);
}
+
+/* Convert EXPR to TYPE if the type of EXPR is
+ assignment compatible with TYPE.
+ Otherwise, issue an error (or warning) as appropriate. */
+
+tree
+c_cvt_expr_for_assign (location_t loc, tree type, tree expr)
+{
+ if (expr == NULL_TREE || expr == error_mark_node)
+ return expr;
+ return convert_for_assignment (loc, UNKNOWN_LOCATION, type,
+ expr, TREE_TYPE (expr),
+ ic_assign, false, NULL_TREE, NULL_TREE, 0);
+}
struct c_switch {
/* The SWITCH_EXPR being built. */
@@ -10736,12 +10997,12 @@ build_binary_op (location_t location, enum tree_code code,
/* Handle the pointer + int case. */
if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
- ret = pointer_int_sum (location, PLUS_EXPR, op0, op1);
+ ret = c_pointer_int_sum (location, PLUS_EXPR, op0, op1);
goto return_build_binary_op;
}
else if (code1 == POINTER_TYPE && code0 == INTEGER_TYPE)
{
- ret = pointer_int_sum (location, PLUS_EXPR, op1, op0);
+ ret = c_pointer_int_sum (location, PLUS_EXPR, op1, op0);
goto return_build_binary_op;
}
else
@@ -10760,7 +11021,7 @@ build_binary_op (location_t location, enum tree_code code,
/* Handle pointer minus int. Just like pointer plus int. */
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
- ret = pointer_int_sum (location, MINUS_EXPR, op0, op1);
+ ret = c_pointer_int_sum (location, MINUS_EXPR, op0, op1);
goto return_build_binary_op;
}
else
@@ -11116,6 +11377,33 @@ build_binary_op (location_t location, enum tree_code code,
addr_space_t as1 = TYPE_ADDR_SPACE (tt1);
addr_space_t as_common = ADDR_SPACE_GENERIC;
+ if ((SHARED_TYPE_P (tt0)
+ && !(SHARED_TYPE_P (tt1) || integer_zerop(op1)))
+ || (SHARED_TYPE_P (tt1)
+ && !(SHARED_TYPE_P (tt0) || integer_zerop(op0))))
+ {
+ error_at (location, "UPC does not allow comparisons "
+ "between pointers to shared and "
+ "local pointers");
+ return error_mark_node;
+ }
+ if (SHARED_TYPE_P (tt0)
+ && SHARED_TYPE_P (tt1) && (tt0 != tt1)
+ && !(VOID_TYPE_P (tt0) || VOID_TYPE_P (tt1)))
+ {
+ const tree bs_0 = get_block_factor (tt0);
+ const tree bs_1 = get_block_factor (tt1);
+ /* Both source and destination are non-void pointers to shared,
+ whose target types are not equal.
+ UPC dictates that their blocking factors must be equal. */
+ if (!tree_int_cst_equal (bs_0, bs_1))
+ {
+ error_at (location, "UPC does not allow comparison "
+ "between pointers to shared with "
+ "differing block sizes without a cast");
+ return error_mark_node;
+ }
+ }
/* Anything compares with void *. void * compares with anything.
Otherwise, the targets must be compatible
and both must be object or both incomplete. */
@@ -11147,9 +11435,17 @@ build_binary_op (location_t location, enum tree_code code,
if (result_type == NULL_TREE)
{
- int qual = ENCODE_QUAL_ADDR_SPACE (as_common);
- result_type = build_pointer_type
- (build_qualified_type (void_type_node, qual));
+ if (SHARED_TYPE_P(tt0) || SHARED_TYPE_P(tt1))
+ {
+ result_type = upc_pts_type_node;
+ }
+ else
+ {
+ int qual = ENCODE_QUAL_ADDR_SPACE (as_common);
+ result_type = build_pointer_type
+ (build_qualified_type (void_type_node,
+ qual));
+ }
}
}
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
@@ -11221,10 +11517,35 @@ build_binary_op (location_t location, enum tree_code code,
short_compare = 1;
else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
{
- addr_space_t as0 = TYPE_ADDR_SPACE (TREE_TYPE (type0));
- addr_space_t as1 = TYPE_ADDR_SPACE (TREE_TYPE (type1));
+ const tree tt0 = TREE_TYPE (type0);
+ const tree tt1 = TREE_TYPE (type1);
+ addr_space_t as0 = TYPE_ADDR_SPACE (tt0);
+ addr_space_t as1 = TYPE_ADDR_SPACE (tt1);
addr_space_t as_common;
+ if (SHARED_TYPE_P (tt0) != SHARED_TYPE_P (tt1))
+ {
+ error_at (location, "UPC does not allow comparisons between "
+ "pointers to shared and local pointers");
+ return error_mark_node;
+ }
+ if (SHARED_TYPE_P (tt0)
+ && SHARED_TYPE_P (tt1) && (tt0 != tt1)
+ && !(VOID_TYPE_P (tt0) || VOID_TYPE_P (tt1)))
+ {
+ const tree bs_0 = get_block_factor (tt0);
+ const tree bs_1 = get_block_factor (tt1);
+ /* Both source and destination are non-void pointers to shared,
+ whose target types are not equal.
+ UPC dictates that their blocking factors must be equal. */
+ if (!tree_int_cst_equal (bs_0, bs_1))
+ {
+ error_at (location, "UPC does not allow comparison "
+ "between pointers to shared with "
+ "differing block sizes without a cast");
+ return error_mark_node;
+ }
+ }
if (comp_target_types (location, type0, type1))
{
result_type = common_pointer_type (type0, type1);
@@ -11247,6 +11568,11 @@ build_binary_op (location_t location, enum tree_code code,
"disjoint address spaces");
return error_mark_node;
}
+ else if (SHARED_TYPE_P (TREE_TYPE (type0))
+ || SHARED_TYPE_P (TREE_TYPE (type1)))
+ {
+ result_type = upc_pts_type_node;
+ }
else
{
int qual = ENCODE_QUAL_ADDR_SPACE (as_common);
@@ -13461,10 +13787,16 @@ c_finish_transaction (location_t loc, tree block, int flags)
NULL, then it should be used as the qualified type
ORIG_QUAL_INDIRECT levels down in array type derivation (to
preserve information about the typedef name from which an array
- type was derived). */
+ type was derived).
+
+ LAYOUT_QUALIFIER is the UPC "blocking factor". It is an integral
+ constant that specifies the size of the blocks that will be
+ distributed across threads. It is NULL, when not compiling UPC. */
tree
-c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
+c_build_qualified_type (tree type, int type_quals,
+ tree layout_qualifier,
+ tree orig_qual_type,
size_t orig_qual_indirect)
{
if (type == error_mark_node)
@@ -13474,7 +13806,9 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
{
tree t;
tree element_type = c_build_qualified_type (TREE_TYPE (type),
- type_quals, orig_qual_type,
+ type_quals,
+ layout_qualifier,
+ orig_qual_type,
orig_qual_indirect - 1);
/* See if we already have an identically qualified type. */
@@ -13483,7 +13817,10 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
else
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
{
- if (TYPE_QUALS (strip_array_types (t)) == type_quals
+ const tree t_elem_type = strip_array_types (t);
+ tree t_elem_block_factor = TYPE_BLOCK_FACTOR (t_elem_type);
+ if (TYPE_QUALS (t_elem_type) == type_quals
+ && t_elem_block_factor == layout_qualifier
&& TYPE_NAME (t) == TYPE_NAME (type)
&& TYPE_CONTEXT (t) == TYPE_CONTEXT (type)
&& attribute_list_equal (TYPE_ATTRIBUTES (t),
@@ -13514,7 +13851,8 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
TYPE_REVERSE_STORAGE_ORDER (unqualified_canon) = 1;
}
TYPE_CANONICAL (t)
- = c_build_qualified_type (unqualified_canon, type_quals);
+ = c_build_qualified_type (unqualified_canon, type_quals,
+ layout_qualifier);
}
else
TYPE_CANONICAL (t) = t;
@@ -13535,7 +13873,8 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
tree var_type = (orig_qual_type && orig_qual_indirect == 0
? orig_qual_type
- : build_qualified_type (type, type_quals));
+ : build_qualified_type (type, type_quals,
+ layout_qualifier));
/* A variant type does not inherit the list of incomplete vars from the
type main variant. */
if (RECORD_OR_UNION_TYPE_P (var_type)
diff --git a/gcc/c/c-upc-gasp.c b/gcc/c/c-upc-gasp.c
new file mode 100644
index 00000000000..273e4adfc14
--- /dev/null
+++ b/gcc/c/c-upc-gasp.c
@@ -0,0 +1,130 @@
+/* c-upc-gasp.c: UPC GASP (GAS Performance) instrumentation support
+ Copyright (C) 2005-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+ Based on original Implementation by Adam Leko <leko@hcs.ufl.edu>.
+
+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 "stringpool.h"
+#include "c-tree.h"
+#include "tree-iterator.h"
+#include "c-upc-gasp.h"
+#include "c-upc-rts-names.h"
+
+static tree build_string_ref (const char *string);
+
+/* Build a reference to a literal string.
+ (cribbed from mf_build_string in tree-mudflap.c) */
+
+static tree
+build_string_ref (const char *string)
+{
+ size_t len = strlen (string);
+ tree result = build_string (len + 1, string);
+ TREE_TYPE (result) = build_array_type
+ (char_type_node, build_index_type (build_int_cst (NULL_TREE, len)));
+ TREE_CONSTANT (result) = 1;
+ TREE_READONLY (result) = 1;
+ TREE_STATIC (result) = 1;
+ result = build1 (ADDR_EXPR, build_pointer_type (char_type_node), result);
+ return result;
+}
+
+/* Add source args to the argument list. */
+
+tree
+upc_gasp_add_src_args (tree args, const char *filename, int lineno)
+{
+ return chainon (args,
+ tree_cons (NULL_TREE, build_string_ref (filename),
+ tree_cons (NULL_TREE,
+ build_int_cst (NULL_TREE, lineno),
+ NULL_TREE)));
+}
+
+/* Instrument `upc_forall' statement begin/end.
+ Return a call to the profiling function. */
+
+tree
+upc_instrument_forall (location_t loc, int start)
+{
+ const char *filename = LOCATION_FILE (loc);
+ const int lineno = LOCATION_LINE (loc);
+ tree pfunc;
+
+ pfunc = lookup_name (get_identifier (UPC_INSTRUMENT_FORALL));
+ if (!pfunc)
+ internal_error ("UPC profiling function `%s' not found",
+ UPC_INSTRUMENT_FORALL);
+
+ return build_call_expr (pfunc, 3,
+ build_int_cst (NULL_TREE, start),
+ build_string_ref (filename),
+ build_int_cst (NULL_TREE, lineno));
+}
+
+/* If UPC function profiling has been enabled, rewrite the
+ body of FNDECL so that the GASP instrumentation function
+ is called before the body of the function is executed,
+ and then after it is executed (as a TRY_FINALLY_EXPR). */
+
+void
+upc_instrument_func (tree fndecl)
+{
+ tree tf, x, pfunc, bind;
+ const char *filename, *funcname;
+ int lineno;
+
+ /* Skip, if profiling disabled via #pragma pupc. */
+ if (!get_upc_pupc_mode ())
+ return;
+
+ pfunc = lookup_name (get_identifier (UPC_INSTRUMENT_FUNC));
+ if (!pfunc)
+ internal_error ("UPC profiling function `%s' not found",
+ UPC_INSTRUMENT_FUNC);
+ funcname = "<unknown>";
+ if (DECL_NAME (fndecl))
+ funcname = IDENTIFIER_POINTER (DECL_NAME (fndecl));
+ lineno = DECL_SOURCE_LINE (fndecl);
+ filename = DECL_SOURCE_FILE (fndecl);
+ tf = build2 (TRY_FINALLY_EXPR, void_type_node, NULL, NULL);
+ TREE_SIDE_EFFECTS (tf) = 1;
+ x = DECL_SAVED_TREE (fndecl);
+ append_to_statement_list (x, &TREE_OPERAND (tf, 0));
+ x = build_call_expr (pfunc, 4, integer_zero_node, /* start == 0 */
+ build_string_ref (funcname),
+ build_string_ref (filename),
+ build_int_cst (NULL_TREE, lineno));
+ append_to_statement_list (x, &TREE_OPERAND (tf, 1));
+
+ bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL);
+ TREE_SIDE_EFFECTS (bind) = 1;
+ x = build_call_expr (pfunc, 4, integer_one_node, /* start == 1 */
+ build_string_ref (funcname),
+ build_string_ref (filename),
+ build_int_cst (NULL_TREE, lineno));
+ append_to_statement_list (x, &BIND_EXPR_BODY (bind));
+ append_to_statement_list (tf, &BIND_EXPR_BODY (bind));
+
+ DECL_SAVED_TREE (fndecl) = bind;
+
+}
diff --git a/gcc/c/c-upc-gasp.h b/gcc/c/c-upc-gasp.h
new file mode 100644
index 00000000000..933532c6129
--- /dev/null
+++ b/gcc/c/c-upc-gasp.h
@@ -0,0 +1,32 @@
+/* c-upc-gasp.h: GASP instrumentation API.
+ Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_C_UPC_GASP_H
+#define GCC_C_UPC_GASP_H 1
+
+extern int disable_pupc_mode(void);
+extern int get_upc_pupc_mode(void);
+extern tree upc_gasp_add_src_args (tree, const char *, int);
+extern tree upc_instrument_forall (location_t, int);
+extern void set_pupc_mode(int);
+extern void upc_instrument_func (tree);
+
+#endif /* !GCC_C_UPC_GASP_H */
diff --git a/gcc/c/c-upc-lang.c b/gcc/c/c-upc-lang.c
new file mode 100644
index 00000000000..063141cc9bc
--- /dev/null
+++ b/gcc/c/c-upc-lang.c
@@ -0,0 +1,203 @@
+/* c-upc-lang.c: UPC language-specific functions.
+ Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "alias.h"
+#include "stringpool.h"
+#include "tree-iterator.h"
+#include "c-tree.h"
+#include "stor-layout.h"
+#include "c-upc.h"
+#include "c-upc-low.h"
+#include "c-upc-pts-ops.h"
+#include "c-upc-rts-names.h"
+#include "common/common-target.h"
+#include "varasm.h"
+#include "target.h"
+
+/* Return TRUE if DECL's size is zero,
+ and DECL is a UPC shared array. */
+bool
+upc_lang_layout_decl_p (tree decl, tree type)
+{
+ int need_to_size_shared_array_decl = 0;
+ tree t = type;
+
+ if (decl && DECL_SIZE (decl) == 0)
+ {
+ while (t != NULL && TREE_CODE (t) == ARRAY_TYPE
+ && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
+ t = TREE_TYPE (t);
+
+ if (t && TREE_CODE (t) == ARRAY_TYPE)
+ {
+ tree tt = TREE_TYPE (t);
+ tree tt_size = TYPE_SIZE (tt);
+ need_to_size_shared_array_decl =
+ SHARED_TYPE_P (tt)
+ && tt_size != NULL_TREE
+ && !integer_zerop (tt_size);
+ }
+ }
+ return need_to_size_shared_array_decl;
+}
+
+/* Given that TYPE describes a UPC shared array, and that DECL's size hasn't
+ been calculated, calculate the size of the type and adjust the size
+ attributes in DECL. */
+
+void
+upc_lang_layout_decl (tree decl, tree type)
+{
+ tree t = type;
+ gcc_checking_assert (upc_lang_layout_decl_p (decl, type));
+ while (TREE_CODE (t) == ARRAY_TYPE
+ && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
+ t = TREE_TYPE (t);
+
+ {
+ const tree elt_type = TREE_TYPE (t);
+ const tree elt_size = TYPE_SIZE (elt_type);
+ const tree block_factor = TYPE_HAS_BLOCK_FACTOR (elt_type)
+ ? convert (bitsizetype, TYPE_BLOCK_FACTOR (elt_type)) : NULL;
+ if (block_factor && integer_zerop (block_factor))
+ {
+ /* Allocate the entire UPC shared array on thread 0. */
+ if (TYPE_HAS_THREADS_FACTOR (type))
+ {
+ const tree n_threads =
+ convert (bitsizetype, upc_num_threads ());
+ DECL_SIZE (decl) = size_binop (MULT_EXPR, elt_size, n_threads);
+ }
+ else
+ DECL_SIZE (decl) = TYPE_SIZE (type);
+ }
+ else
+ {
+ const tree t_size = TYPE_SIZE (type);
+ const tree n_elem = size_binop (FLOOR_DIV_EXPR, t_size, elt_size);
+ const tree n_threads = convert (bitsizetype, upc_num_threads ());
+ if (TYPE_HAS_THREADS_FACTOR (type))
+ {
+ if (block_factor)
+ {
+ const tree blk_size = convert (bitsizetype, block_factor);
+ tree t1, t2;
+ t1 = size_binop (CEIL_DIV_EXPR, n_elem, blk_size);
+ t2 = size_binop (MULT_EXPR, t1, blk_size);
+ DECL_SIZE (decl) = size_binop (MULT_EXPR, t2, elt_size);
+ }
+ else
+ DECL_SIZE (decl) = t_size;
+ }
+ else
+ {
+ /* We want to allocate ceiling (N_ELEM / N_THREADS)
+ elements per thread, where N_ELEM is the total number of
+ elements in the array. If the array is blocked,
+ then we allocate (ceiling (ceiling
+ (N_ELEM / BLOCK_FACTOR) / N_THREADS)
+ * block_factor) * N_ELEM_PER_THREAD. */
+ tree n_elem_per_thread;
+ if (block_factor)
+ {
+ tree block_count, blocks_per_thread;
+ block_count = size_binop (CEIL_DIV_EXPR,
+ n_elem, block_factor);
+ blocks_per_thread = size_binop (CEIL_DIV_EXPR,
+ block_count, n_threads);
+ n_elem_per_thread = size_binop (MULT_EXPR,
+ blocks_per_thread,
+ block_factor);
+ }
+ else
+ n_elem_per_thread = size_binop (CEIL_DIV_EXPR,
+ n_elem, n_threads);
+
+ /* In the special case of an array of size 1, we know that
+ we want a constant size no matter what N_THREADS is. Make
+ the size a constant so that declarations of the form:
+ shared int x[1];
+ will work in a dynamic THREADS compilation environment. */
+ if (integer_onep (n_elem))
+ DECL_SIZE (decl) = elt_size;
+ else
+ DECL_SIZE (decl) = size_binop (MULT_EXPR, n_elem_per_thread,
+ elt_size);
+ }
+ }
+ if (DECL_SIZE_UNIT (decl) == 0)
+ DECL_SIZE_UNIT (decl)
+ = fold_convert (sizetype,
+ size_binop (CEIL_DIV_EXPR, DECL_SIZE (decl),
+ bitsize_unit_node));
+ }
+}
+
+/* Initialize the UPC-specific parts of the compiler. */
+
+static void
+upc_parse_init (void)
+{
+ upc_pts_init ();
+ upc_genericize_init ();
+}
+
+/* Enable/Disable UPC keywords.
+ If ENABLE is true, UPC keywords are enabled.
+ If ENABLE is false, UPC keywords are removed from consideration.
+ This routine is used by the implementation of
+ "#pragma upc upc_code" and "#pragma upc c_code" respectively. */
+
+void
+upc_toggle_keywords (bool enable)
+{
+ unsigned int i;
+ tree id;
+ for (i = 0; i < num_c_common_reswords; i++)
+ {
+ if (UPC_IS_KEYWORD (c_common_reswords[i].rid))
+ {
+ id = get_identifier (c_common_reswords[i].word);
+ C_IS_RESERVED_WORD (id) = enable;
+ }
+ }
+}
+
+/* UPC language-specific initialization. */
+
+void
+upc_lang_init (void)
+{
+ gcc_assert (flag_upc);
+ if (!targetm_common.have_named_sections)
+ {
+ fatal_error (input_location,
+ "UPC is not implemented on this target; "
+ "the target linker does not support separately "
+ "linked sections");
+ }
+ upc_parse_init ();
+}
diff --git a/gcc/c/c-upc-lang.h b/gcc/c/c-upc-lang.h
new file mode 100644
index 00000000000..2bcaa04228d
--- /dev/null
+++ b/gcc/c/c-upc-lang.h
@@ -0,0 +1,28 @@
+/* c-upc-lang.h: UPC language-specific functions.
+ Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_C_UPC_LANG_H
+#define GCC_C_UPC_LANG_H 1
+extern void upc_toggle_keywords (bool);
+extern bool upc_lang_layout_decl_p (tree, tree);
+extern void upc_lang_layout_decl (tree, tree);
+extern void upc_lang_init (void);
+#endif /* !GCC_C_UPC_LANG_H */
diff --git a/gcc/c/c-upc-low.c b/gcc/c/c-upc-low.c
new file mode 100644
index 00000000000..b886c5f318a
--- /dev/null
+++ b/gcc/c/c-upc-low.c
@@ -0,0 +1,1514 @@
+/* c-upc-low.c: UPC language specific tree lowering pass
+ Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "alias.h"
+#include "fold-const.h"
+#include "stringpool.h"
+#include "hard-reg-set.h"
+#include "c-tree.h"
+#include "c-family/c-pragma.h"
+#include "output.h"
+#include "langhooks.h"
+#include "function.h"
+#include "tree-hasher.h"
+#include "is-a.h"
+#include "cgraph.h"
+#include "gimple-expr.h"
+#include "gimple-low.h"
+#include "gimplify.h"
+#include "stor-layout.h"
+#include "target.h"
+#include "varasm.h"
+#include "timevar.h"
+#include "tree-iterator.h"
+#include "c-upc-low.h"
+#include "c-upc.h"
+#include "c-upc-gasp.h"
+#include "c-upc-pts-ops.h"
+#include "c-upc-rts-names.h"
+
+static GTY (()) tree upc_init_stmt_list;
+
+static void get_lc_mode_name (char *, machine_mode);
+static tree upc_expand_get (location_t, tree, int);
+static tree upc_expand_put (location_t, tree, tree, int);
+static tree upc_create_tmp_var (tree);
+static tree upc_copy_value_to_tmp_var (tree *, tree);
+static tree upc_make_bit_field_ref (tree, tree, int, int);
+static tree upc_build_shared_var_addr (location_t, tree);
+static tree upc_shared_addr (location_t, tree);
+static tree upc_shared_addr_rep (location_t, tree);
+static tree upc_simplify_shared_ref (location_t, tree);
+static void upc_strip_useless_generic_pts_cvt (tree *);
+static tree upc_create_static_var (tree, const char *);
+static void upc_build_init_func (tree);
+static void upc_write_init_func (void);
+
+/* Given a shared variable's VAR_DECL node, map to another
+ VAR_DECL that has a similar external symbol name, with
+ the "shared" qualifier removed from its type. This
+ "shadow variable" is used to generate conventional
+ address constants when referring to a shared variable. */
+static int_tree_htab_type *unshared_vars_map;
+
+static tree create_unshared_var (location_t, const tree);
+static tree lookup_unshared_var (const tree);
+static void map_unshared_var (const tree, const tree);
+static tree unshared_var_addr (location_t, const tree);
+static tree unshared_var_name (const tree);
+static void upc_free_unshared_var_table (void);
+
+static void upc_genericize_addr_expr (location_t, tree *);
+static void upc_genericize_array_ref (location_t, tree *);
+static void upc_genericize_compound_expr (tree *, int);
+static void upc_genericize_cond_expr (tree *, int);
+static void upc_genericize_decl_expr (tree *);
+static tree upc_genericize_expr (tree *, int *, void *);
+static void upc_genericize_function (tree);
+static void upc_genericize_field_ref (location_t, tree *);
+static void upc_genericize_forall_stmt (tree *);
+static void upc_genericize_indirect_ref (location_t, tree *);
+static void upc_genericize_modify_expr (location_t, tree *, int);
+static void upc_genericize_pts_arith_expr (location_t, tree *);
+static void upc_genericize_pts_cond_expr (location_t, tree *);
+static void upc_genericize_pts_cvt (location_t, tree *);
+static void upc_genericize_pts_to_int_cvt (location_t, tree *);
+static void upc_genericize_real_imag_ref (location_t, tree *);
+static void upc_genericize_shared_inc_dec_expr (location_t, tree *, int);
+static void upc_genericize_shared_var_ref (location_t, tree *);
+static void upc_genericize_walk (tree *, int);
+static void upc_genericize_stmt_list (tree *);
+static void upc_genericize_sync_stmt (location_t, tree *);
+
+/* Create a new temporary variable declaration of type TYPE.
+ Push the variable into the current function binding. */
+
+static tree
+upc_create_tmp_var (tree type)
+{
+ tree tmp_var;
+ /* We don't allow types that are addressable or incomplete. */
+ gcc_assert (!TREE_ADDRESSABLE (type) && COMPLETE_TYPE_P (type));
+ /* The temp. must not be shared qualified. If it is, then
+ remove the 'shared' qualifier. */
+ if (SHARED_TYPE_P (type))
+ type = build_unshared_type (type);
+ tmp_var = create_tmp_var_raw (type, "UPC");
+ DECL_CONTEXT (tmp_var) = current_function_decl;
+ DECL_SEEN_IN_BIND_EXPR_P (tmp_var) = 1;
+ /* record_vars() will do what we want, but not if GIMPLE_DF is set.
+ (since we haven't gimplified yet, it should not be set). */
+ gcc_assert (!cfun->gimple_df);
+ record_vars (tmp_var);
+ return tmp_var;
+}
+
+/* Create a temporary variable and initialize it to VAL.
+ The expression used to initialize the temporary value
+ is returned in *VAL_EXPR. */
+
+static tree
+upc_copy_value_to_tmp_var (tree *val_expr, tree val)
+{
+ const tree type = TREE_TYPE (val);
+ const tree tmp_var = upc_create_tmp_var (type);
+ *val_expr = build2 (INIT_EXPR, type, tmp_var, val);
+ SET_EXPR_LOCATION (*val_expr, EXPR_LOC_OR_LOC (val, input_location));
+ return tmp_var;
+}
+
+/* Return a lower-cased mode name. */
+
+static void
+get_lc_mode_name (char *mname, machine_mode mode)
+{
+ char *m = mname;
+ const char *m_upper = GET_MODE_NAME (mode);
+ while (*m_upper)
+ *m++ = TOLOWER (*m_upper++);
+ *m = '\0';
+}
+
+/* Generate a call to the runtime to implement a 'get' of a shared
+ object. SRC is a reference to a UPC shared value; it must
+ be addressable. */
+
+static tree
+upc_expand_get (location_t loc, tree src, int want_stable_value)
+{
+ tree type = TREE_TYPE (src);
+ /* Drop the shared qualifier. */
+ tree result_type = TYPE_MAIN_VARIANT (type);
+ int strict_mode = TYPE_STRICT (type)
+ || (!TYPE_RELAXED (type) && get_upc_consistency_mode ());
+ int doprofcall = flag_upc_debug
+ || (flag_upc_instrument && get_upc_pupc_mode ());
+ machine_mode mode = TYPE_MODE (type);
+ machine_mode op_mode = (mode == TImode) ? BLKmode : mode;
+ expanded_location s = expand_location (loc);
+ const char *src_filename = s.file;
+ const int src_line = s.line;
+ char libfunc_name[16], mname[8];
+ tree src_addr, result, result_tmp, libfunc, lib_args, lib_call;
+ src_addr = upc_shared_addr_rep (loc, src);
+ gcc_assert (TREE_TYPE (src_addr) == upc_pts_rep_type_node);
+ get_lc_mode_name (mname, (op_mode));
+ sprintf (libfunc_name, "__get%s%s%s%s",
+ strict_mode ? "s" : "",
+ doprofcall ? "g" : "",
+ mname,
+ (op_mode == BLKmode)
+ ? (doprofcall ? "5" : "3")
+ : (doprofcall ? "3" : "2"));
+ libfunc = identifier_global_value (get_identifier (libfunc_name));
+ if (!libfunc)
+ internal_error ("UPC runtime function %s not found", libfunc_name);
+ if (op_mode == BLKmode)
+ {
+ tree size = size_in_bytes (result_type);
+ tree result_addr;
+ result_tmp = upc_create_tmp_var (result_type);
+ TREE_ADDRESSABLE (result_tmp) = 1;
+ result_addr = build_fold_addr_expr_loc (loc, result_tmp);
+ /* A DECL_EXPR is sometimes needed (for example when applying
+ sizeof() to a UPC shared VLA) to properly declare
+ the type of the temp. variable used to hold the result
+ of the expression. */
+ result_addr = build2 (COMPOUND_EXPR, TREE_TYPE (result_addr),
+ build1 (DECL_EXPR, TREE_TYPE (result_tmp),
+ result_tmp),
+ result_addr);
+ lib_args = tree_cons (NULL_TREE, result_addr,
+ tree_cons (NULL_TREE, src_addr,
+ tree_cons (NULL_TREE, size,
+ NULL_TREE)));
+ if (doprofcall)
+ lib_args = upc_gasp_add_src_args (lib_args,
+ src_filename, src_line);
+ lib_call = build_function_call (loc, libfunc, lib_args);
+ result = build2 (COMPOUND_EXPR, result_type, lib_call, result_tmp);
+ }
+ else
+ {
+ lib_args = tree_cons (NULL_TREE, src_addr, NULL_TREE);
+ if (doprofcall)
+ lib_args = upc_gasp_add_src_args (lib_args,
+ src_filename, src_line);
+ lib_call = build_function_call (loc, libfunc, lib_args);
+ if (!lang_hooks.types_compatible_p (result_type, TREE_TYPE (lib_call)))
+ lib_call = build1 (NOP_EXPR, result_type, lib_call);
+ result = lib_call;
+ if (want_stable_value)
+ {
+ tree result_tmp_init_expr;
+ result_tmp = upc_copy_value_to_tmp_var (&result_tmp_init_expr,
+ result);
+ result = build2 (COMPOUND_EXPR, result_type,
+ result_tmp_init_expr, result_tmp);
+ }
+ }
+ return result;
+}
+
+/* Generate a call to the runtime to implement a 'put' into a shared
+ object. DEST is a reference to the destination in UPC shared memory;
+ it must be addressable. SRC is the value to be stored into the
+ destination. If WANT_VALUE is set, then return a compound expression
+ which evaluates to the value of SRC. */
+
+static tree
+upc_expand_put (location_t loc, tree dest, tree src, int want_value)
+{
+ tree type = TREE_TYPE (dest);
+ int strict_mode = TYPE_STRICT (type)
+ || (!TYPE_RELAXED (type) && get_upc_consistency_mode ());
+ int doprofcall = flag_upc_debug
+ || (flag_upc_instrument && get_upc_pupc_mode ());
+ machine_mode mode = TYPE_MODE (type);
+ machine_mode op_mode = (mode == TImode) ? BLKmode : mode;
+ int is_src_shared = (TREE_SHARED (src)
+ || SHARED_TYPE_P (TREE_TYPE (src)));
+ int local_copy = want_value
+ || (op_mode == BLKmode
+ && !(is_src_shared && INDIRECT_REF_P (src))
+ && (!is_gimple_addressable (src)
+ || !is_gimple_variable (src)
+ || needs_to_live_in_memory (src)));
+ int is_shared_copy = !local_copy && (op_mode == BLKmode) && is_src_shared;
+ char libfunc_name[16], mname[8];
+ expanded_location s = expand_location (loc);
+ const char *src_filename = s.file;
+ const int src_line = s.line;
+ tree dest_addr, libfunc, lib_args, src_tmp_init_expr, result;
+ dest_addr = upc_shared_addr_rep (loc, dest);
+ gcc_assert (TREE_TYPE (dest_addr) == upc_pts_rep_type_node);
+ if (local_copy)
+ src = upc_copy_value_to_tmp_var (&src_tmp_init_expr, src);
+ lib_args = tree_cons (NULL_TREE, dest_addr, NULL_TREE);
+ if (is_shared_copy)
+ {
+ sprintf (libfunc_name, "__copy%s%sblk%s",
+ strict_mode ? "s" : "",
+ doprofcall ? "g" : "",
+ doprofcall ? "5" : "3");
+ }
+ else
+ {
+ get_lc_mode_name (mname, op_mode);
+ sprintf (libfunc_name, "__put%s%s%s%s",
+ strict_mode ? "s" : "",
+ doprofcall ? "g" : "",
+ mname,
+ (op_mode == BLKmode)
+ ? (doprofcall ? "5" : "3")
+ : (doprofcall ? "4" : "2"));
+ }
+ libfunc = identifier_global_value (get_identifier (libfunc_name));
+ if (!libfunc)
+ internal_error ("UPC runtime function %s not found", libfunc_name);
+ if (op_mode == BLKmode)
+ {
+ const tree size = tree_expr_size (src);
+ tree src_addr;
+ if (is_shared_copy)
+ src_addr = upc_shared_addr_rep (loc, src);
+ else
+ src_addr = build_fold_addr_expr_loc (loc, src);
+ lib_args = chainon (lib_args,
+ tree_cons (NULL_TREE, src_addr,
+ tree_cons (NULL_TREE, size, NULL_TREE)));
+ if (doprofcall)
+ lib_args = upc_gasp_add_src_args (lib_args, src_filename, src_line);
+ }
+ else
+ {
+ tree src_type = lang_hooks.types.type_for_mode (mode, 0);
+ tree libfunc_arg_types = TYPE_ARG_TYPES (TREE_TYPE (libfunc));
+ tree put_arg_type = TREE_VALUE (TREE_CHAIN (libfunc_arg_types));
+ if (TYPE_PRECISION (put_arg_type) != TYPE_PRECISION (src_type))
+ internal_error ("%s: UPC put operation argument precision mismatch",
+ libfunc_name);
+ /* Avoid warnings about implicit conversion between
+ the actual parameter value's type, and the type of the
+ runtime routine's parameter. */
+ if (!lang_hooks.types_compatible_p (src_type, TREE_TYPE (src)))
+ src = build1 (AGGREGATE_TYPE_P (TREE_TYPE (src))
+ ? VIEW_CONVERT_EXPR : NOP_EXPR, src_type, src);
+ lib_args = chainon (lib_args, tree_cons (NULL_TREE, src, NULL_TREE));
+ if (doprofcall)
+ lib_args = upc_gasp_add_src_args (lib_args, src_filename, src_line);
+ }
+ result = build_function_call (loc, libfunc, lib_args);
+ if (want_value)
+ result = build2 (COMPOUND_EXPR, TREE_TYPE (src), result, src);
+ if (local_copy)
+ result = build2 (COMPOUND_EXPR, TREE_TYPE (result),
+ src_tmp_init_expr, result);
+ return result;
+}
+
+/* Return a BIT_FIELD_REF of type TYPE to refer to BITSIZE bits of INNER
+ starting at BITPOS. The field is unsigned if UNSIGNEDP is nonzero. */
+
+static tree
+upc_make_bit_field_ref (tree inner, tree type, int bitsize, int bitpos)
+{
+ tree result;
+ if (bitpos == 0)
+ {
+ tree size = TYPE_SIZE (TREE_TYPE (inner));
+ if ((INTEGRAL_TYPE_P (TREE_TYPE (inner))
+ || POINTER_TYPE_P (TREE_TYPE (inner)))
+ && tree_fits_shwi_p (size)
+ && tree_to_shwi (size) == bitsize)
+ return fold_convert (type, inner);
+ }
+ result = build3 (BIT_FIELD_REF, type, inner,
+ size_int (bitsize), bitsize_int (bitpos));
+ return result;
+}
+
+/* On entry, EXP points to a shared field reference
+ or array reference. Simplify it so that is in
+ one of two forms:
+ 1) (INDIRECT_REF <pointer to shared object>)
+ 2) (BIT_FIELD_REF (INDIRECT_REF <pointer to shared object>) ...)
+ The first form is returned for all shared field references
+ except those that require access to bit fields within
+ a storage unit. */
+
+static tree
+upc_simplify_shared_ref (location_t loc, tree exp)
+{
+ tree ref_type = TREE_TYPE (exp);
+ tree base, base_addr, ref, t_offset;
+ machine_mode mode = VOIDmode;
+ HOST_WIDE_INT bitsize = 0;
+ HOST_WIDE_INT bitpos = 0;
+ int unsignedp = 0;
+ int reversep = 0;
+ int volatilep = 0;
+ tree offset = NULL_TREE;
+ base = get_inner_reference (exp, &bitsize, &bitpos, &offset,
+ &mode, &unsignedp, &reversep, &volatilep,
+ false);
+ gcc_assert (SHARED_TYPE_P (TREE_TYPE (base)));
+ base_addr = build_fold_addr_expr (base);
+ if (bitpos)
+ {
+ t_offset = size_int (bitpos / BITS_PER_UNIT);
+ if (offset)
+ t_offset = fold (build_binary_op (loc, PLUS_EXPR,
+ offset, t_offset, 0));
+ }
+ else
+ t_offset = offset;
+ {
+ const tree base_addr_type = TREE_TYPE (base_addr);
+ const enum tree_code cvt_op =
+ lang_hooks.types_compatible_p (upc_char_pts_type_node, base_addr_type)
+ ? NOP_EXPR : CONVERT_EXPR;
+ /* Convert the base address to (shared [] char *), which may
+ reset the pointer's phase to zero. This is the behavior
+ that is required to reference a field in a structure and
+ to meaningfully add an offset to the base address. */
+ base_addr = build1 (cvt_op, upc_char_pts_type_node, base_addr);
+ if (t_offset)
+ {
+ /* Adjust the base address so that it points to the
+ simplified lvalue. */
+ base_addr = fold (build_binary_op (loc, PLUS_EXPR,
+ base_addr, t_offset, 0));
+ base_addr = convert (base_addr_type, base_addr);
+ }
+ }
+ /* We need to construct a pointer-to-shared type that
+ will be used to point to the referenced value. However,
+ for a COMPONENT_REF, the original type will likely not have
+ SHARED_TYPE_P() asserted, but rather, the expression node itself
+ will have TREE_SHARED asserted. We need to first propagate
+ this information into a new shared type, which will in turn be
+ used to build the required pointer-to-shared type. Further,
+ any pointer to a shared component must be constrained to have
+ a blocking factor of zero. */
+ if (!SHARED_TYPE_P (ref_type))
+ {
+ const int shared_quals = TYPE_QUALS (TREE_TYPE (exp))
+ | TREE_QUALS (exp);
+ gcc_assert (shared_quals & TYPE_QUAL_SHARED);
+ ref_type = c_build_qualified_type (ref_type, shared_quals,
+ size_zero_node);
+ }
+ if (TREE_TYPE (TREE_TYPE (base_addr)) != ref_type)
+ base_addr = convert (build_pointer_type (ref_type), base_addr);
+ /* The simplified reference is an indirect ref., using
+ the adjusted base_addr */
+ ref = build_fold_indirect_ref_loc (loc, base_addr);
+ /* If this is a BIT_FIELD_REF then adjust its base address. */
+ if (TREE_CODE (exp) == BIT_FIELD_REF)
+ ref = upc_make_bit_field_ref (ref, ref_type, bitsize, bitpos);
+ return ref;
+}
+
+/* Create and return a "shadow variable" that has the same type as VAR,
+ but with all UPC shared qualifiers removed from the type.
+ The assembler name of this shadow variable is the same
+ as that of the original variable, VAR. */
+
+static tree
+create_unshared_var (location_t loc, const tree var)
+{
+ tree u_name, u_type, u;
+ gcc_assert (var && TREE_CODE (var) == VAR_DECL);
+ u_name = unshared_var_name (var);
+ u_type = build_unshared_type (TREE_TYPE (var));
+ u = build_decl (loc, VAR_DECL, u_name, u_type);
+ TREE_USED (u) = 1;
+ TREE_ADDRESSABLE (u) = 1;
+ TREE_PUBLIC (u) = TREE_PUBLIC (var);
+ TREE_STATIC (u) = TREE_STATIC (var);
+ DECL_ARTIFICIAL (u) = 1;
+ DECL_IGNORED_P (u) = 1;
+ set_decl_section_name (u, DECL_SECTION_NAME (var));
+ DECL_CONTEXT (u) = DECL_CONTEXT (var);
+ /* Define it as 'external' so that no data is allocated. */
+ DECL_EXTERNAL (u) = 1;
+ /* Alias the unshared variable to the shared variable. */
+ SET_DECL_ASSEMBLER_NAME (u, DECL_ASSEMBLER_NAME (var));
+ /* Make sure the variable is referenced. */
+ mark_decl_referenced (var);
+ return u;
+}
+
+/* Return the "shadow variable" created for VAR that
+ has the same type as VAR, but with the UPC shared
+ qualifiers removed. */
+
+static tree
+lookup_unshared_var (const tree var)
+{
+ struct int_tree_map in;
+ unsigned int uid;
+ gcc_assert (var && TREE_CODE (var) == VAR_DECL);
+ uid = DECL_UID (var);
+ in.uid = uid;
+ in.to = NULL_TREE;
+ return unshared_vars_map->find_with_hash (in, uid).to;
+}
+
+#define UNSHARE_PREFIX "_u_"
+
+/* Return an identifier that will be used to declare the "shadow variable"
+ which has the same type as VAR, but with all UPC shared qualifiers
+ removed from the type. The identifier has the same name as
+ that of VAR, prefixed with the string given by the
+ value of `UNSHARE_PREFIX'. */
+
+static tree
+unshared_var_name (const tree var)
+{
+ const tree name = DECL_NAME (var);
+ const size_t len = IDENTIFIER_LENGTH (name);
+ char *tmp_name = (char *) alloca (len + sizeof (UNSHARE_PREFIX));
+ strcpy (tmp_name, UNSHARE_PREFIX);
+ strcat (tmp_name, IDENTIFIER_POINTER (name));
+ return get_identifier (tmp_name);
+}
+
+/* Register the mapping between the UPC shared variable, VAR,
+ and its unshared counter-part, U_VAR. "unshared" in
+ this context means that the shadow variable U_VAR
+ has the same type as VAR, with the UPC shared,
+ strict, and relaxed qualifiers removed. */
+
+static void
+map_unshared_var (const tree var, const tree u_var)
+{
+ int_tree_map h;
+ unsigned int uid;
+ int_tree_map *loc;
+ gcc_assert (var && TREE_CODE (var) == VAR_DECL);
+ gcc_assert (u_var && TREE_CODE (u_var) == VAR_DECL);
+ uid = DECL_UID (var);
+ h.uid = uid;
+ loc = unshared_vars_map->find_slot_with_hash (h, uid, INSERT);
+ loc->uid = uid;
+ loc->to = u_var;
+}
+
+/* Return a tree node that evaluates to the address that the
+ linker assigns to the UPC shared variable, VAR. This is not
+ the final location of the UPC shared variable. The linker is
+ used only to lay out a given UPC thread's contribution to the
+ UPC shared global memory region.
+
+ The address expression returned will point to a "shadow
+ variable" declaration that is created from the UPC shared
+ variable declaration, VAR. This shadow variable has the same
+ type and other attributes as VAR, with the UPC shared type
+ qualifiers removed. */
+
+static tree
+unshared_var_addr (location_t loc, const tree var)
+{
+ tree unshared_var, addr;
+ unshared_var = lookup_unshared_var (var);
+ if (!unshared_var)
+ {
+ unshared_var = create_unshared_var (loc, var);
+ map_unshared_var (var, unshared_var);
+ }
+ addr = build_fold_addr_expr (unshared_var);
+ TREE_CONSTANT (addr) = 1;
+ TREE_READONLY (addr) = 1;
+ return addr;
+}
+
+/* Free the hash table used to map UPC VAR_DECL's
+ into the "unshared" shadow variables that were created
+ in order to establish the offset of a UPC shared
+ variable with the special linker section that is
+ created to collect the UPC shared variables. */
+
+static void
+upc_free_unshared_var_table (void)
+{
+ if (unshared_vars_map)
+ {
+ delete unshared_vars_map;
+ unshared_vars_map = NULL;
+ }
+}
+
+/* Convert the shared variable reference VAR into a UPC pointer-to-shared
+ value of the form {0, 0, &VAR}. */
+
+static tree
+upc_build_shared_var_addr (location_t loc, tree var)
+{
+ tree var_addr, val;
+ gcc_assert (TREE_CODE (var) == VAR_DECL && TREE_SHARED (var));
+ /* Refer to a shadow variable that has the same type as VAR, but
+ with the shared qualifier removed. */
+ var_addr = unshared_var_addr (loc, var);
+ val = upc_pts_build_value (loc, build_pointer_type (TREE_TYPE (var)),
+ var_addr, integer_zero_node, integer_zero_node);
+ return val;
+}
+
+/* Return the UPC shared address of the lvalue
+ identified by EXP. The type of the result is
+ the UPC pointer-to-shared representation type. */
+
+static tree
+upc_shared_addr_rep (location_t loc, tree exp)
+{
+ tree addr = upc_shared_addr (loc, exp);
+ /* Convert to internal UPC pointer-to-shared representation,
+ possibly removing an unnecessary chain of VIEW_CONVERT_EXPR's. */
+ addr = fold (build1 (VIEW_CONVERT_EXPR, upc_pts_rep_type_node, addr));
+ return addr;
+}
+
+/* Return the UPC shared address of the lvalue
+ identified by EXP. The type of the result is
+ the UPC pointer-to-shared representation type. */
+
+static tree
+upc_shared_addr (location_t loc, tree exp)
+{
+ tree ref = exp;
+ const enum tree_code code = TREE_CODE (exp);
+ tree addr;
+ switch (code)
+ {
+ case VAR_DECL:
+ addr = upc_build_shared_var_addr (loc, exp);
+ break;
+ case ARRAY_REF:
+ case COMPONENT_REF:
+ ref = upc_simplify_shared_ref (loc, exp);
+ if (TREE_CODE (ref) == ERROR_MARK)
+ return ref;
+ addr = build_fold_addr_expr_loc (loc, ref);
+ upc_genericize_walk (&addr, /* want_value */ 1);
+ break;
+ case INDIRECT_REF:
+ /* Remove the indirection by taking the address and simplifying. */
+ addr = build_fold_addr_expr_loc (loc, ref);
+ upc_genericize_walk (&addr, /* want_value */ 1);
+ break;
+ case BIT_FIELD_REF:
+ error_at (loc, "invalid & operation applied to a UPC shared bit field");
+ return error_mark_node;
+ default:
+ gcc_unreachable ();
+ }
+ return addr;
+}
+
+/* Rewrite a 'upc_forall' statement into a
+ regular 'for' statement. */
+
+static void
+upc_genericize_forall_stmt (tree *expr_p ATTRIBUTE_UNUSED)
+{
+ /* Handled in c-parser.c. */
+ gcc_unreachable ();
+}
+
+/* Rewrite a UPC synchronization statement (upc_wait, upc_notify,
+ and upc_barrier) into a call to the runtime. */
+
+static void
+upc_genericize_sync_stmt (location_t loc, tree *stmt_p)
+{
+ /* The first operand is the synchronization operation, UPC_SYNC_OP:
+ UPC_SYNC_NOTIFY_OP 1 Notify operation
+ UPC_SYNC_WAIT_OP 2 Wait operation
+ UPC_SYNC_BARRIER_OP 3 Barrier operation
+ The second operand, UPC_SYNC_ID is the (optional) expression
+ whose value specifies the barrier identifier which is checked
+ by the various synchronization operations. */
+ tree stmt = *stmt_p;
+ tree sync_op = UPC_SYNC_OP (stmt);
+ tree sync_id = UPC_SYNC_ID (stmt);
+ const int op = tree_to_shwi (sync_op);
+ const char *libfunc_name = (char *) 0;
+ int doprofcall = flag_upc_debug
+ || (flag_upc_instrument && get_upc_pupc_mode ());
+ tree libfunc, lib_args;
+ switch (op)
+ {
+ case UPC_SYNC_NOTIFY_OP:
+ libfunc_name = doprofcall ? UPC_NOTIFYG_LIBCALL : UPC_NOTIFY_LIBCALL;
+ break;
+ case UPC_SYNC_WAIT_OP:
+ libfunc_name = doprofcall ? UPC_WAITG_LIBCALL : UPC_WAIT_LIBCALL;
+ break;
+ case UPC_SYNC_BARRIER_OP:
+ libfunc_name = doprofcall ? UPC_BARRIERG_LIBCALL : UPC_BARRIER_LIBCALL;
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ libfunc = identifier_global_value (get_identifier (libfunc_name));
+ if (!libfunc)
+ internal_error ("UPC runtime function %s not found", libfunc_name);
+ if (!sync_id)
+ sync_id = build_int_cst (NULL_TREE, INT_MIN);
+ lib_args = tree_cons (NULL_TREE, sync_id, NULL_TREE);
+ if (doprofcall)
+ lib_args = upc_gasp_add_src_args (lib_args,
+ LOCATION_FILE (input_location),
+ LOCATION_LINE (input_location));
+ *stmt_p = build_function_call (loc, libfunc, lib_args);
+}
+
+/* Rewrite a reference to a UPC shared variable into a 'get' operation. */
+
+static void
+upc_genericize_shared_var_ref (location_t loc, tree *expr_p)
+{
+ tree src = *expr_p;
+ *expr_p = upc_expand_get (loc, src, 0);
+}
+
+/* Expand & of a UPC shared object into equivalent code. */
+
+static void
+upc_genericize_addr_expr (location_t loc, tree *expr_p)
+{
+ const tree op0 = TREE_OPERAND (*expr_p, 0);
+ *expr_p = upc_shared_addr (loc, op0);
+}
+
+/* Expand indirection through a UPC pointer-to-shared
+ into a UPC get operation. */
+
+static void
+upc_genericize_indirect_ref (location_t loc, tree *expr_p)
+{
+ tree src = *expr_p;
+ *expr_p = upc_expand_get (loc, src, 0);
+}
+
+/* Expand .real and .imag applied to a UPC shared object. */
+
+static void
+upc_genericize_real_imag_ref (location_t loc,
+ tree *expr_p ATTRIBUTE_UNUSED)
+{
+ error_at (loc, "accesses to .real and .imag are not yet implemented");
+ *expr_p = error_mark_node;
+}
+
+/* Rewrite a[i] into *(a + i). This code is derived from
+ build_array_ref(). We could call build_array_ref()
+ directly, and depend upon it to do this rewrite if
+ the array is shared, but it is clearer to handle
+ it explicitly here. */
+
+static void
+upc_genericize_array_ref (location_t loc, tree *expr_p)
+{
+ tree exp = *expr_p;
+ tree array = TREE_OPERAND (exp, 0);
+ tree index = TREE_OPERAND (exp, 1);
+ tree ar = default_conversion (array);
+ gcc_assert (TREE_CODE (exp) == ARRAY_REF);
+ if (ar == error_mark_node)
+ return;
+ gcc_assert (TREE_CODE (TREE_TYPE (ar)) == POINTER_TYPE);
+ gcc_assert (TREE_CODE (TREE_TYPE (TREE_TYPE (ar))) != FUNCTION_TYPE);
+ *expr_p = build_indirect_ref (loc,
+ build_binary_op (loc, PLUS_EXPR, ar, index,
+ 0), RO_ARRAY_INDEXING);
+ upc_genericize_indirect_ref (loc, expr_p);
+}
+
+/* Handle conversions between UPC pointers-to-shared and
+ local pointers, or between UPC pointers-to-shared which
+ have differing block factors. */
+
+static void
+upc_genericize_pts_cvt (location_t loc, tree *expr_p)
+{
+ *expr_p = upc_pts_build_cvt (loc, *expr_p);
+}
+
+/* Handle conversions from a UPC pointer-to-shared into
+ an integer value. */
+
+static void
+upc_genericize_pts_to_int_cvt (location_t loc, tree *expr_p)
+{
+ tree pts, pts_arg, ref_type, upc_addrfield;
+ tree *pts_p;
+ int shared_quals;
+ upc_addrfield = identifier_global_value (get_identifier ("upc_addrfield"));
+ if (!upc_addrfield)
+ internal_error ("UPC runtime function `upc_addrfield` not found");
+ pts_p = &TREE_OPERAND (*expr_p, 0);
+ pts = *pts_p;
+ ref_type = TREE_TYPE (TREE_TYPE (pts));
+ shared_quals = TYPE_QUALS (ref_type) | TREE_QUALS (pts);
+ gcc_assert (shared_quals & TYPE_QUAL_SHARED);
+ if ((shared_quals & TYPE_QUAL_CONST) != 0)
+ {
+ /* Drop 'const' qualifier to arg. type mis-match. */
+ shared_quals &= ~TYPE_QUAL_CONST;
+ ref_type = c_build_qualified_type (ref_type, shared_quals,
+ size_zero_node);
+ TREE_TYPE (pts) = build_pointer_type (ref_type);
+ }
+ pts_arg = tree_cons (NULL_TREE, pts, NULL_TREE);
+ *pts_p = build_function_call (loc, upc_addrfield, pts_arg);
+}
+
+/* Rewrite op0 CMP op1 into either a bitwise
+ comparison of the UPC pointer-to-shared operands
+ or by taking the difference, and comparing it
+ to zero. */
+
+static void
+upc_genericize_pts_cond_expr (location_t loc, tree *expr_p)
+{
+ *expr_p = upc_pts_build_cond_expr (loc, *expr_p);
+}
+
+/* Rewrite a reference to a bit field within a UPC shared struct/union.
+ When implemented, the translated tree will need to fetch
+ the container for this bit-field from UPC shared memory,
+ and then isolate the bit field within the container. */
+
+static void
+upc_genericize_field_ref (location_t loc, tree *expr_p)
+{
+ tree ref = upc_simplify_shared_ref (loc, *expr_p);
+ if (TREE_CODE (ref) == BIT_FIELD_REF)
+ {
+ error_at (loc, "accesses to UPC shared bit fields "
+ "are not yet implemented");
+ ref = error_mark_node;
+ }
+ else
+ ref = upc_expand_get (loc, ref, 0);
+ *expr_p = ref;
+}
+
+/* Expand the addition of UPC pointer-to-shared value and an integer.
+ When the operation is subtraction, rewrite the expression (p - i)
+ into (p + (-i)) and expand the sum. The special handling of
+ subtraction is required because addition/subtraction of UPC
+ pointers-to-shared is a non-trivial operation, and it simpler
+ to only implement addition. */
+
+static void
+upc_genericize_pts_arith_expr (location_t loc, tree *expr_p)
+{
+ tree exp = *expr_p;
+ if (TREE_CODE (exp) == PLUS_EXPR || TREE_CODE (exp) == POINTER_PLUS_EXPR)
+ {
+ *expr_p = upc_pts_build_sum (loc, exp);
+ }
+ else if (TREE_CODE (exp) == MINUS_EXPR)
+ {
+ const tree type0 = TREE_TYPE (TREE_OPERAND (exp, 0));
+ const tree type1 = TREE_TYPE (TREE_OPERAND (exp, 1));
+ if ((TREE_CODE (type0) == POINTER_TYPE)
+ && (TREE_CODE (type1) == INTEGER_TYPE))
+ {
+ /* Rewrite the expression p - i into p + (-i),
+ and expand the sum. */
+ tree int_op = TREE_OPERAND (exp, 1);
+ if (TREE_CODE (int_op) == INTEGER_CST
+ && TREE_CODE (TREE_TYPE (int_op)) == POINTER_TYPE)
+ {
+ /* Earlier passes have altered the type of the integer
+ constant to be a UPC pointer-to-shared type. This won't
+ play well when we try to negate it. For now, convert
+ it back to a size type. */
+ int_op = ssize_int (tree_to_shwi (int_op));
+ }
+ TREE_SET_CODE (exp, PLUS_EXPR);
+ /* Make sure that int_op is a signed type to
+ ensure negation works properly. */
+ if (TYPE_UNSIGNED (TREE_TYPE (int_op)))
+ int_op = convert (ssizetype, int_op);
+ TREE_OPERAND (exp, 1) =
+ build_unary_op (loc, NEGATE_EXPR, int_op, 0);
+ *expr_p = upc_pts_build_sum (loc, exp);
+ }
+ else
+ *expr_p = upc_pts_build_diff (loc, exp);
+ }
+ else
+ gcc_unreachable ();
+}
+
+/* Rewrite the increment/decrement of a UPC shared value into
+ an equivalent assignment statement. (Although some future
+ implementations of the UPC runtime API might be able to
+ implement these operations atomically, that is not currently
+ defined in the runtime API.) If WANT_VALUE is set, then
+ generate a compound expression that yields the appropriate value. */
+
+static void
+upc_genericize_shared_inc_dec_expr (location_t loc, tree *expr_p,
+ int want_value)
+{
+ const tree exp = *expr_p;
+ const enum tree_code code = TREE_CODE (exp);
+ const tree op0 = TREE_OPERAND (exp, 0);
+ const int is_inc_op = (code == POSTINCREMENT_EXPR
+ || code == PREINCREMENT_EXPR);
+ const enum tree_code inc_dec_code = is_inc_op ? PLUS_EXPR : MINUS_EXPR;
+ tree val, val_init_expr, inc_dec_expr, mod_expr;
+ val = upc_copy_value_to_tmp_var (&val_init_expr, op0);
+ inc_dec_expr = build_binary_op (loc, inc_dec_code,
+ val, integer_one_node, 0);
+ mod_expr = build2 (MODIFY_EXPR, TREE_TYPE (val), op0, inc_dec_expr);
+ if (want_value)
+ {
+ if (code == PREDECREMENT_EXPR || code == PREINCREMENT_EXPR)
+ upc_genericize_modify_expr (loc, &mod_expr, 1);
+ else
+ {
+ upc_genericize_modify_expr (loc, &mod_expr, 0);
+ mod_expr = build2 (COMPOUND_EXPR, TREE_TYPE (val), mod_expr, val);
+ }
+ }
+ else
+ upc_genericize_modify_expr (loc, &mod_expr, 0);
+ *expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (mod_expr),
+ val_init_expr, mod_expr);
+}
+
+/* Simplify assignments to generic pointer-to-shared objects,
+ where an intermediate conversion appears on the right hand
+ side of the assignment. Conversions from non-generic
+ pointer-to-shared to generic pointer-to-shared are preserved
+ up to the point of the final assignment, because a conversion
+ from generic pointer-to-shared to non-generic pointer-to-shared
+ may reset the phase in some cases, and we can only determine
+ that the conversion is unnecessary when we know the target
+ of the assignment expression. */
+
+static void
+upc_strip_useless_generic_pts_cvt (tree *expr_p)
+{
+ while (TREE_CODE (*expr_p) == CONVERT_EXPR
+ && POINTER_TYPE_P (TREE_TYPE (*expr_p))
+ && VOID_TYPE_P (TREE_TYPE (TREE_TYPE (*expr_p))))
+ {
+ *expr_p = TREE_OPERAND (*expr_p, 0);
+ }
+}
+
+/* Generify the MODIFY_EXPR node of the 'shared' value
+ pointed to by EXPR_P. If the target of the assignment
+ is a UPC 'shared' reference, or an indirection via a UPC
+ pointer-to-shared, the assignment statement is rewritten into
+ a call to a runtime routine that does a remote 'put'.
+ If WANT_VALUE is set, then return a compound expression
+ that evaluates to the value of the source operand. */
+
+static void
+upc_genericize_modify_expr (location_t loc, tree *expr_p, int want_value)
+{
+ const tree dest = TREE_OPERAND (*expr_p, 0);
+ tree src = TREE_OPERAND (*expr_p, 1);
+ if (TREE_SHARED (dest)
+ || (TREE_TYPE (dest) && SHARED_TYPE_P (TREE_TYPE (dest))))
+ {
+ /* <shared dest> = <(shared|unshared) src> */
+ *expr_p = upc_expand_put (loc, dest, src, want_value);
+ }
+ else if (TREE_SHARED (src)
+ || (TREE_TYPE (src) && SHARED_TYPE_P (TREE_TYPE (src))))
+ {
+ /* <unshared dest> = <shared src> */
+ /* We could check for BLKmode and in
+ that case perform a upc_memget() here. */
+ src = upc_expand_get (loc, src, want_value);
+ TREE_OPERAND (*expr_p, 1) = src;
+ }
+}
+
+typedef struct walk_data_struct
+{
+ int want_value;
+} walk_data_t;
+typedef walk_data_t *walk_data_p;
+
+/* This routine is called to convert UPC specific constructs
+ into GENERIC. It is called from 'walk_tree' as it traverses
+ the function body.
+
+ The DATA parameter will point to a 'walk_data_t'
+ structure, which presently has a single field,
+ 'want_value'. If 'want_value' is non-zero, it
+ indicates that the value of the expression should
+ be returned. */
+
+static tree
+upc_genericize_expr (tree *expr_p, int *walk_subtrees, void *data)
+{
+ const walk_data_p wdata = (walk_data_p) data;
+ const tree expr = *expr_p;
+ const enum tree_code code = TREE_CODE (expr);
+ const tree type = CODE_CONTAINS_STRUCT (code, TS_TYPED)
+ ? TREE_TYPE (expr) : NULL;
+ const int want_value = wdata->want_value
+ && !(type && VOID_TYPE_P (type));
+ const tree op0 = (TREE_CODE_LENGTH (code) >= 1)
+ ? TREE_OPERAND (expr, 0) : NULL_TREE;
+ const tree type0 = (op0 != NULL_TREE) ? TREE_TYPE (op0) : NULL_TREE;
+ tree op1 = (TREE_CODE_LENGTH (code) >= 2)
+ ? TREE_OPERAND (expr, 1) : NULL_TREE;
+ tree type1 = (op1 != NULL_TREE) ? TREE_TYPE (op1) : NULL_TREE;
+ location_t saved_location = input_location;
+ location_t loc;
+ if (EXPR_HAS_LOCATION (expr))
+ input_location = EXPR_LOCATION (expr);
+ loc = input_location;
+ switch (code)
+ {
+ case UPC_FORALL_STMT:
+ upc_genericize_forall_stmt (expr_p);
+ break;
+
+ case UPC_SYNC_STMT:
+ upc_genericize_sync_stmt (loc, expr_p);
+ break;
+
+ case ADDR_EXPR:
+ if (POINTER_TYPE_P (type) && TREE_TYPE (type)
+ && SHARED_TYPE_P (TREE_TYPE (type)))
+ upc_genericize_addr_expr (loc, expr_p);
+ break;
+
+ case ARRAY_REF:
+ case ARRAY_RANGE_REF:
+ if (op0 && TREE_SHARED (op0))
+ upc_genericize_array_ref (loc, expr_p);
+ break;
+
+ case BIT_FIELD_REF:
+ case COMPONENT_REF:
+ if (op0 && TREE_SHARED (op0))
+ upc_genericize_field_ref (loc, expr_p);
+ break;
+
+ case INDIRECT_REF:
+ if (type0 && (TREE_CODE (type0) == POINTER_TYPE)
+ && SHARED_TYPE_P (TREE_TYPE (type0)))
+ upc_genericize_indirect_ref (loc, expr_p);
+ break;
+
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ if (op0 && TREE_SHARED (op0))
+ upc_genericize_real_imag_ref (loc, expr_p);
+ break;
+
+ case VAR_DECL:
+ if (type && SHARED_TYPE_P (type))
+ upc_genericize_shared_var_ref (loc, expr_p);
+ break;
+
+ case VIEW_CONVERT_EXPR:
+ if (type && SHARED_TYPE_P (type))
+ TREE_TYPE (expr) = build_unshared_type (type);
+ gcc_assert (!TREE_SHARED (expr));
+ break;
+
+ case NON_LVALUE_EXPR:
+ case NOP_EXPR:
+ case CONVERT_EXPR:
+ /* Conversions to a UPC shared type aren't valid.
+ The front-end will sometimes convert
+ an expression operand to the type of another
+ operand. If that operand has UPC shared type,
+ then the conversion target type is 'shared' qualified.
+ We unshare the type in order to produce a
+ valid tree. */
+ if (type && SHARED_TYPE_P (type))
+ TREE_TYPE (expr) = build_unshared_type (type);
+ if (PTS_CVT_OP_P (expr))
+ upc_genericize_pts_cvt (loc, expr_p);
+ else if (code == CONVERT_EXPR && TREE_CODE (type) == INTEGER_TYPE
+ && POINTER_TYPE_P (type0)
+ && SHARED_TYPE_P (TREE_TYPE (type0)))
+ upc_genericize_pts_to_int_cvt (loc, expr_p);
+ break;
+
+ case EQ_EXPR:
+ case GE_EXPR:
+ case GT_EXPR:
+ case LE_EXPR:
+ case LT_EXPR:
+ case NE_EXPR:
+ if ((type0 && (TREE_CODE (type0) == POINTER_TYPE)
+ && SHARED_TYPE_P (TREE_TYPE (type0)))
+ || (type1 && (TREE_CODE (type1) == POINTER_TYPE)
+ && SHARED_TYPE_P (TREE_TYPE (type1))))
+ upc_genericize_pts_cond_expr (loc, expr_p);
+ break;
+
+ case MINUS_EXPR:
+ case PLUS_EXPR:
+ case POINTER_PLUS_EXPR:
+ if ((type0 && (TREE_CODE (type0) == POINTER_TYPE)
+ && SHARED_TYPE_P (TREE_TYPE (type0)))
+ || (type1 && (TREE_CODE (type1) == POINTER_TYPE)
+ && SHARED_TYPE_P (TREE_TYPE (type1))))
+ upc_genericize_pts_arith_expr (loc, expr_p);
+ break;
+
+ case MODIFY_EXPR:
+ case INIT_EXPR:
+ if (POINTER_TYPE_P (type0) && SHARED_TYPE_P (TREE_TYPE (type0))
+ && VOID_TYPE_P (TREE_TYPE (type0))
+ && TREE_CODE (op1) == CONVERT_EXPR
+ && POINTER_TYPE_P (type1) && VOID_TYPE_P (TREE_TYPE (type1)))
+ {
+ upc_strip_useless_generic_pts_cvt (&TREE_OPERAND (expr, 1));
+ /* Recalculate OP1 and TYPE1 because TREE_OPERAND (expr, 1)
+ was rewritten, above. */
+ op1 = TREE_OPERAND (expr, 1);
+ type1 = TREE_TYPE (op1);
+ }
+ if ((op0 && (TREE_SHARED (op0)
+ || (type0 && SHARED_TYPE_P (type0))))
+ || (op1 && (TREE_SHARED (op1)
+ || (type1 && SHARED_TYPE_P (type1)))))
+ upc_genericize_modify_expr (loc, expr_p, want_value);
+ break;
+
+ case POSTDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case PREINCREMENT_EXPR:
+ if ((op0 && TREE_SHARED (op0))
+ || (type0 && (SHARED_TYPE_P (type0)
+ || (POINTER_TYPE_P (type0)
+ && SHARED_TYPE_P (TREE_TYPE (type0))))))
+ upc_genericize_shared_inc_dec_expr (loc, expr_p, want_value);
+ break;
+
+ case INTEGER_CST:
+ /* Integer constants can't be UPC 'shared' qualified.
+ The front-end can create integer constants with shared
+ type when changing the type to agree with that of another
+ expression operand.
+
+ Unsharing an integer constant requires special handling
+ because an internal hash table is kept on a type by type
+ basis. Thus, we can't rewrite TREE_TYPE() directly.
+ We re-create the constant with its unshared type to
+ ensure that the hash table is updated. */
+ if (type && SHARED_TYPE_P (type))
+ {
+ const tree u_type = build_unshared_type (type);
+ *expr_p = wide_int_to_tree (u_type, expr);
+ }
+ gcc_assert (!TREE_SHARED (expr));
+ break;
+
+ case REAL_CST:
+ case COMPLEX_CST:
+ case STRING_CST:
+ case VECTOR_CST:
+ case CONSTRUCTOR:
+ /* A constant's type can't be UPC 'shared' qualified.
+ The front-end will sometimes convert
+ an expression operand to the type of another
+ operand. If that other operand has UPC shared type,
+ then the converted constant's type will be shared.
+ We unshare the type in order to produce a
+ valid constant. */
+ if (type && SHARED_TYPE_P (type))
+ TREE_TYPE (expr) = build_unshared_type (type);
+ gcc_assert (!TREE_SHARED (expr));
+ break;
+
+ case STATEMENT_LIST:
+ upc_genericize_stmt_list (expr_p);
+ *walk_subtrees = 0;
+ break;
+
+ case COMPOUND_EXPR:
+ upc_genericize_compound_expr (expr_p, want_value);
+ *walk_subtrees = 0;
+ break;
+
+ case COND_EXPR:
+ upc_genericize_cond_expr (expr_p, want_value);
+ *walk_subtrees = 0;
+ break;
+
+ case DECL_EXPR:
+ upc_genericize_decl_expr (expr_p);
+ *walk_subtrees = 0;
+ break;
+
+ default:
+ gcc_assert (!TREE_SHARED (expr));
+ break;
+ }
+
+ /* Restore the input location. */
+ input_location = saved_location;
+
+ /* After evaluating the current node, assert the
+ want_value flag so that all subtrees of this root node
+ will be fully evaluated. */
+ if (!wdata->want_value)
+ wdata->want_value = 1;
+
+ /* Continue tree traversal. */
+ return NULL_TREE;
+}
+
+/* Convert a compound expression into GENERIC form.
+ A compound expression contains two expressions to compute,
+ one (the LHS) followed by the other (the RHS).
+ The LHS value is ignored. The RHS value is used. */
+
+static void
+upc_genericize_compound_expr (tree *expr_p, int want_value)
+{
+ tree *lhs_p = &TREE_OPERAND (*expr_p, 0);
+ tree *rhs_p = &TREE_OPERAND (*expr_p, 1);
+ upc_genericize_walk (lhs_p, 0);
+ upc_genericize_walk (rhs_p, want_value);
+}
+
+/* Convert a conditional expression into GENERIC form.
+ A conditional expression contains three expressions
+ and is of the form expression ( ... ? ... : ... in C).
+ The first operand is the condition, the second is
+ the then-value and the third is the else-value. */
+
+static void
+upc_genericize_cond_expr (tree *expr_p, int want_value)
+{
+ tree *cond_p = &TREE_OPERAND (*expr_p, 0);
+ tree *then_p = &TREE_OPERAND (*expr_p, 1);
+ tree *else_p = &TREE_OPERAND (*expr_p, 2);
+ upc_genericize_walk (cond_p, 1);
+ if (*then_p)
+ upc_genericize_walk (then_p, want_value);
+ if (*else_p)
+ upc_genericize_walk (else_p, want_value);
+}
+
+/* Convert a declaration expression into GENERIC form.
+ A declaration expression is used to represent a local declaration.
+ The operand refers to the DECL associated with
+ the given declaration statement. */
+
+static void
+upc_genericize_decl_expr (tree *expr_p)
+{
+ tree decl = DECL_EXPR_DECL (*expr_p);
+ tree *decl_init_p = &DECL_INITIAL (decl);
+ if (*decl_init_p)
+ upc_genericize_walk (decl_init_p, 0);
+}
+
+/* Convert the tree rooted at EXPR_P into GENERIC.
+ WANT_VALUE is the initial value the flag that
+ upc_genericize_expr() will query to determine
+ whether the expression node should return a value.
+ NOTE: EXPR_P can point to any kind of expression node. */
+
+static void
+upc_genericize_walk (tree *expr_p, int want_value)
+{
+ walk_data_t wdata;
+ wdata.want_value = want_value;
+ (void) walk_tree (expr_p, upc_genericize_expr, &wdata, NULL);
+}
+
+/* Convert a statement list to GENERIC. */
+
+static void
+upc_genericize_stmt_list (tree *stmt_list_p)
+{
+ tree_stmt_iterator s = tsi_start (*stmt_list_p);
+ while (!tsi_end_p (s))
+ {
+ tree *stmt_p = tsi_stmt_ptr (s);
+ upc_genericize_walk (stmt_p, 0);
+ tsi_next (&s);
+ }
+}
+
+/* Convert the function body identified by BODY_P into GENERIC.
+ Traverse the function body by calling upc_genericize_walk().
+ Initially assert WANT_VALUE as FALSE. */
+
+static void
+upc_genericize_body (tree *body_p, tree fndecl)
+{
+ location_t saved_location = input_location;
+
+ timevar_push (TV_TREE_UPC_GENERICIZE);
+
+ input_location = DECL_SOURCE_LOCATION (fndecl);
+
+ upc_genericize_walk (body_p, /* want_value */ 0);
+
+ timevar_pop (TV_TREE_UPC_GENERICIZE);
+
+ input_location = saved_location;
+}
+
+/* Convert the tree representation of FNDECL, along with all nested
+ functions defined within it, into the GENERIC form. */
+
+static void
+upc_genericize_function (tree fndecl)
+{
+ struct cgraph_node *cgn;
+
+ gcc_assert (DECL_SAVED_TREE (fndecl));
+
+ if (DECL_STRUCT_FUNCTION (fndecl))
+ push_cfun (DECL_STRUCT_FUNCTION (fndecl));
+ else
+ push_struct_function (fndecl);
+
+ upc_genericize_body (&DECL_SAVED_TREE (fndecl), fndecl);
+
+ if (flag_upc_instrument_functions
+ && !DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl)
+ && !flag_instrument_functions_exclude_p (fndecl))
+ {
+ upc_instrument_func (fndecl);
+ }
+
+ pop_cfun ();
+
+ cgn = cgraph_node::get_create (fndecl);
+ for (cgn = cgn->nested; cgn; cgn = cgn->next_nested)
+ upc_genericize_function (cgn->decl);
+}
+
+/* Create a static variable of type 'type'.
+ This routine mimics the behavior of 'objc_create_temporary_var'
+ with the change that it creates a static (file scoped) variable. */
+
+static tree
+upc_create_static_var (tree type, const char *name)
+{
+ tree id = get_identifier (name);
+ tree decl = build_decl (input_location, VAR_DECL, id, type);
+ TREE_USED (decl) = 1;
+ TREE_STATIC (decl) = 1;
+ TREE_READONLY (decl) = 1;
+ TREE_THIS_VOLATILE (decl) = 0;
+ TREE_ADDRESSABLE (decl) = 0;
+ DECL_PRESERVE_P (decl) = 1;
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_EXTERNAL (decl) = 0;
+ DECL_IGNORED_P (decl) = 1;
+ DECL_CONTEXT (decl) = NULL;
+ pushdecl_top_level (decl);
+ return decl;
+}
+
+/* Build a function that will be called by the UPC runtime
+ to initialize UPC shared variables and/or to initialize
+ "C" pointer-to-shared variables that reference the address
+ of UPC shared variables.
+
+ STMT_LIST is a list of initialization statements. */
+
+static void
+upc_build_init_func (tree stmt_list)
+{
+ tree init_func_id = get_identifier (UPC_INIT_DECLS_FUNC);
+ struct c_declspecs *specs;
+ struct c_typespec void_spec;
+ struct c_declarator *init_func_decl;
+ struct c_arg_info args;
+ tree init_func, fn_body;
+ tree init_func_ptr_type, init_func_addr;
+ location_t loc = input_location;
+ int decl_ok;
+ memset (&void_spec, '\0', sizeof (struct c_typespec));
+ void_spec.kind = ctsk_typedef;
+ void_spec.spec = lookup_name (get_identifier ("void"));
+ specs = declspecs_add_type (loc, build_null_declspecs (), void_spec);
+ init_func_decl = build_id_declarator (init_func_id);
+ init_func_decl->id_loc = loc;
+ memset (&args, '\0', sizeof (struct c_arg_info));
+ args.types = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
+ init_func_decl = build_function_declarator (&args, init_func_decl);
+ decl_ok = start_function (specs, init_func_decl, NULL_TREE);
+ gcc_assert (decl_ok);
+ store_parm_decls ();
+ init_func = current_function_decl;
+ DECL_SOURCE_LOCATION (current_function_decl) = loc;
+ TREE_PUBLIC (current_function_decl) = 0;
+ TREE_USED (current_function_decl) = 1;
+ fn_body = c_begin_compound_stmt (true);
+ append_to_statement_list_force (stmt_list, &fn_body);
+ fn_body = c_end_compound_stmt (loc, fn_body, true);
+ add_stmt (fn_body);
+ finish_function ();
+ gcc_assert (DECL_RTL (init_func));
+ mark_decl_referenced (init_func);
+ DECL_PRESERVE_P (init_func) = 1;
+ init_func_ptr_type = build_pointer_type (TREE_TYPE (init_func));
+ init_func_addr = upc_create_static_var (init_func_ptr_type,
+ "__upc_init_func_addr");
+ DECL_INITIAL (init_func_addr) = build_unary_op (loc, ADDR_EXPR,
+ init_func, 0);
+ set_decl_section_name (init_func_addr,
+ targetm.upc.init_array_section_name ());
+}
+
+/* If the accumulated UPC initialization statement list is
+ not empty, then build (and define) the per-file UPC
+ global initialization function. */
+
+static void
+upc_write_init_func (void)
+{
+ if (upc_init_stmt_list)
+ {
+ int pupc_mode = disable_pupc_mode ();
+ upc_build_init_func (upc_init_stmt_list);
+ set_pupc_mode (pupc_mode);
+ upc_init_stmt_list = NULL;
+ }
+}
+
+/* Convert the tree representation of FNDECL built by the UPC front-end
+ into the GENERIC form. Then call the "C" genericize hook. */
+
+void
+upc_genericize (tree fndecl)
+{
+ upc_genericize_function (fndecl);
+}
+
+/* Return TRUE if either DECL's type is a UPC shared type, or if
+ the value on the right-hand-side of the initialization has a
+ type that is a UPC shared type. Initializations that meet
+ this criteria generally need to be actively initialized
+ at runtime. */
+
+int
+upc_check_decl_init (tree decl, tree init)
+{
+ tree init_type;
+ int is_shared_var_decl_init;
+ int is_decl_init_with_shared_addr_refs;
+ int is_upc_decl;
+ if (!(decl && init && TREE_TYPE (decl) && TREE_TYPE (init)))
+ return 0;
+ if ((TREE_CODE (decl) == ERROR_MARK)
+ || (TREE_CODE (TREE_TYPE (decl)) == ERROR_MARK)
+ || (TREE_CODE (init) == ERROR_MARK)
+ || (TREE_CODE (TREE_TYPE (init)) == ERROR_MARK))
+ return 0;
+ init_type = TREE_TYPE (init);
+ is_shared_var_decl_init = (TREE_CODE (decl) == VAR_DECL)
+ && TREE_TYPE (decl) && SHARED_TYPE_P (TREE_TYPE (decl));
+ is_decl_init_with_shared_addr_refs = TREE_STATIC (decl)
+ && upc_contains_pts_refs_p (init_type);
+ is_upc_decl = (is_shared_var_decl_init
+ || is_decl_init_with_shared_addr_refs);
+ return is_upc_decl;
+}
+
+/* Add the initialization statement:
+ DECL = INIT;
+ onto a list, `upc_init_stmt_list', which collects
+ initializations that must be made at runtime.
+
+ This runtime initialization necessary because, in general, UPC
+ shared addresses are not known, or cannot be easily generated
+ at compile-time. */
+
+void
+upc_decl_init (tree decl, tree init)
+{
+ tree init_stmt;
+ if (TREE_CODE (init) == ERROR_MARK)
+ return;
+ if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
+ {
+ error ("initialization of UPC shared arrays "
+ "is currently not supported");
+ return;
+ }
+ if (!upc_init_stmt_list)
+ upc_init_stmt_list = alloc_stmt_list ();
+ init_stmt = build2 (INIT_EXPR, void_type_node, decl, init);
+ append_to_statement_list_force (init_stmt, &upc_init_stmt_list);
+}
+
+/* Write out the UPC global initialization function, if required
+ and call upc_genericize_finish() to free the hash table
+ used to track the "shadow" variables that are created
+ to generate addresses of UPC shared variables.
+
+ This function is called from c_common_parse_file(), just after
+ parsing the main source file. */
+
+void
+upc_write_global_init (void)
+{
+ upc_write_init_func ();
+ upc_genericize_finish ();
+}
+
+/* Clean up resources used by the UPC genericize pass. */
+
+void
+upc_genericize_finish (void)
+{
+ upc_free_unshared_var_table ();
+ upc_init_stmt_list = NULL;
+}
+
+/* Initialize/allocate resources used by the UPC genericize pass. */
+
+void
+upc_genericize_init (void)
+{
+ unshared_vars_map = new int_tree_htab_type (10);
+ upc_init_stmt_list = NULL;
+}
+
+#include "gt-c-c-upc-low.h"
diff --git a/gcc/c/c-upc-low.h b/gcc/c/c-upc-low.h
new file mode 100644
index 00000000000..024277602ea
--- /dev/null
+++ b/gcc/c/c-upc-low.h
@@ -0,0 +1,33 @@
+/* c-upc-low.h: declarations for upc-low.c
+ Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_C_UPC_LOW_H
+#define GCC_C_UPC_LOW_H 1
+
+extern void upc_genericize (tree);
+extern void upc_genericize_init (void);
+extern void upc_genericize_finish (void);
+
+extern int upc_check_decl_init (tree, tree);
+extern void upc_decl_init (tree, tree);
+extern void upc_write_global_init (void);
+
+#endif /* !GCC_C_UPC_LOW_H */
diff --git a/gcc/c/c-upc-pts-ops.c b/gcc/c/c-upc-pts-ops.c
new file mode 100644
index 00000000000..ca845ca7d3d
--- /dev/null
+++ b/gcc/c/c-upc-pts-ops.c
@@ -0,0 +1,655 @@
+/* c-upc-pts-ops.c: implement UPC pointer-to-shared-operations.
+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+ Based on original implementation
+ by Jesse M. Draper <jdraper@super.org>
+ and William W. Carlson <wwc@super.org>.
+
+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 "alias.h"
+#include "fold-const.h"
+#include "stringpool.h"
+#include "stor-layout.h"
+#include "c-tree.h"
+#include "langhooks.h"
+#include "gimplify.h"
+#include "c-upc.h"
+#include "c-family/c-upc-pts.h"
+#include "c-upc-gasp.h"
+#include "c-upc-pts-ops.h"
+#include "c-upc-rts-names.h"
+
+
+/* Build the internal representation of UPC's pointer-to-shared type. */
+
+static void
+upc_pts_init_type (void)
+{
+ tree fields = NULL_TREE;
+ tree name = NULL_TREE;
+ tree ref;
+ machine_mode pts_mode;
+ const location_t loc = UNKNOWN_LOCATION;
+ struct c_struct_parse_info *null_struct_parse_info = NULL;
+ int save_pedantic = pedantic;
+ ref = start_struct (loc, RECORD_TYPE, name, &null_struct_parse_info);
+ /* Ensure that shared pointers have twice the alignment of a pointer. */
+ TYPE_ALIGN (ref) = 2 * TYPE_ALIGN (ptr_type_node);
+ TYPE_USER_ALIGN (ref) = 1;
+ name = get_identifier ("vaddr");
+ upc_vaddr_field_node = build_decl (loc, FIELD_DECL, name,
+ build_pointer_type (char_type_node));
+ fields = chainon (fields, upc_vaddr_field_node);
+ DECL_NONADDRESSABLE_P (upc_vaddr_field_node) = 0;
+ DECL_INITIAL (upc_vaddr_field_node) = NULL_TREE;
+ upc_thread_field_node =
+ build_decl (loc, FIELD_DECL, get_identifier ("thread"),
+ c_common_type_for_size (UPC_PTS_THREAD_SIZE, 1));
+ fields = chainon (fields, upc_thread_field_node);
+ if (!(UPC_PTS_THREAD_SIZE % 8))
+ {
+ DECL_NONADDRESSABLE_P (upc_thread_field_node) = 0;
+ DECL_INITIAL (upc_thread_field_node) = NULL_TREE;
+ }
+ else
+ {
+ DECL_NONADDRESSABLE_P (upc_thread_field_node) = 1;
+ DECL_INITIAL (upc_thread_field_node) = size_int (UPC_PTS_THREAD_SIZE);
+ }
+ upc_phase_field_node =
+ build_decl (loc, FIELD_DECL, get_identifier ("phase"),
+ c_common_type_for_size (UPC_PTS_PHASE_SIZE, 1));
+ fields = chainon (fields, upc_phase_field_node);
+ if (!(UPC_PTS_PHASE_SIZE % 8))
+ {
+ DECL_NONADDRESSABLE_P (upc_phase_field_node) = 0;
+ DECL_INITIAL (upc_phase_field_node) = NULL_TREE;
+ }
+ else
+ {
+ DECL_NONADDRESSABLE_P (upc_phase_field_node) = 1;
+ DECL_INITIAL (upc_phase_field_node) = size_int (UPC_PTS_PHASE_SIZE);
+ }
+ /* Avoid spurious complaints regarding the definition of
+ `phase' and `thread'. */
+ pedantic = 0;
+ upc_pts_rep_type_node = finish_struct (loc, ref, fields, NULL_TREE,
+ null_struct_parse_info);
+ pedantic = save_pedantic;
+ gcc_assert (TYPE_SIZE (upc_pts_rep_type_node));
+ gcc_assert (tree_fits_uhwi_p (TYPE_SIZE (upc_pts_rep_type_node)));
+ gcc_assert (tree_to_uhwi (TYPE_SIZE (upc_pts_rep_type_node))
+ == 2 * POINTER_SIZE);
+ pts_mode = mode_for_size_tree (TYPE_SIZE (upc_pts_rep_type_node),
+ MODE_INT, 0);
+ gcc_assert (pts_mode != BLKmode);
+ SET_TYPE_MODE(upc_pts_rep_type_node, pts_mode);
+ record_builtin_type (RID_SHARED, "upc_shared_ptr_t",
+ upc_pts_rep_type_node);
+}
+/* Build the internal representation of UPC's pointer-to-shared type. */
+
+void
+upc_pts_init (void)
+{
+ tree shared_void_type, shared_char_type;
+ upc_pts_init_type ();
+ shared_void_type = c_build_qualified_type (void_type_node,
+ TYPE_QUAL_SHARED,
+ NULL_TREE);
+ upc_pts_type_node = build_pointer_type (shared_void_type);
+ shared_char_type = c_build_qualified_type (char_type_node,
+ TYPE_QUAL_SHARED,
+ size_zero_node);
+ upc_char_pts_type_node = build_pointer_type (shared_char_type);
+ upc_null_pts_node = upc_pts_build_value (UNKNOWN_LOCATION,
+ upc_pts_type_node,
+ integer_zero_node,
+ integer_zero_node,
+ integer_zero_node);
+}
+
+/* Called to expand a UPC specific constant into something the
+ backend can handle. Upon return a UPC pointer-to-shared will be
+ seen as the representation type of a UPC pointer-to-shared, with
+ individual (thread, phase, and virtual address) fields. */
+
+tree
+upc_pts_build_constant (location_t loc, tree c)
+{
+ tree result = c;
+ if (upc_pts_is_valid_p (c))
+ {
+ const enum tree_code code = TREE_CODE (c);
+ if (!((code == VIEW_CONVERT_EXPR || code == NOP_EXPR)
+ && (TREE_CODE (TREE_OPERAND (c, 0)) == CONSTRUCTOR)
+ && (TREE_TYPE (TREE_OPERAND (c, 0)) == upc_pts_rep_type_node)))
+ {
+ const tree val = build1 (VIEW_CONVERT_EXPR, upc_pts_rep_type_node,
+ save_expr (c));
+ const tree p_t = TREE_TYPE (upc_phase_field_node);
+ const tree t_t = TREE_TYPE (upc_thread_field_node);
+ const tree v_t = TREE_TYPE (upc_vaddr_field_node);
+ const tree vaddr = build3 (COMPONENT_REF, v_t, val,
+ upc_vaddr_field_node, NULL_TREE);
+ const tree thread = build3 (COMPONENT_REF, t_t, val,
+ upc_thread_field_node, NULL_TREE);
+ const tree phase = build3 (COMPONENT_REF, p_t, val,
+ upc_phase_field_node, NULL_TREE);
+ result = upc_pts_build_value (loc, TREE_TYPE (c),
+ vaddr, thread, phase);
+
+ }
+ }
+ return result;
+}
+
+/* Build a constructor of the form {phase, thread, vaddr}. */
+
+tree
+upc_pts_build_value (location_t loc ATTRIBUTE_UNUSED, tree type,
+ tree vaddr, tree thread, tree phase)
+{
+ tree elts, result;
+ const int is_const = TREE_CONSTANT (vaddr)
+ && TREE_CONSTANT (thread) && TREE_CONSTANT (phase);
+ vaddr = fold_convert (TREE_TYPE (upc_vaddr_field_node), vaddr);
+ thread = fold_convert (TREE_TYPE (upc_thread_field_node), thread);
+ phase = fold_convert (TREE_TYPE (upc_phase_field_node), phase);
+ elts = tree_cons (upc_phase_field_node, phase, NULL_TREE);
+ elts = tree_cons (upc_thread_field_node, thread, elts);
+ elts = tree_cons (upc_vaddr_field_node, vaddr, elts);
+ result = build_constructor_from_list (upc_pts_rep_type_node, elts);
+ TREE_CONSTANT (result) = is_const;
+
+ /* Wrap the constructor into the specified pointer to shared type. */
+ result = build1 (VIEW_CONVERT_EXPR, type, result);
+ result = fold (result);
+ TREE_CONSTANT (result) = is_const;
+ /* Force all shared constant pointer values to memory. */
+ TREE_STATIC (result) = is_const;
+ return result;
+}
+
+/* Return TRUE if EXP is a null UPC pointer-to-shared. */
+
+int
+upc_pts_is_null_p (tree exp)
+{
+ int result = 0;
+ if (exp && upc_pts_is_valid_p (exp))
+ {
+ tree value;
+ for (value = exp;
+ TREE_CODE (value) == NOP_EXPR
+ || TREE_CODE (value) == CONVERT_EXPR
+ || TREE_CODE (value) == VIEW_CONVERT_EXPR
+ || TREE_CODE (value) == NON_LVALUE_EXPR;
+ value = TREE_OPERAND (value, 0)) /* loop */ ;
+ if ((TREE_CODE (value) == CONSTRUCTOR)
+ && (TREE_TYPE (value) == upc_pts_rep_type_node)
+ && TREE_CONSTANT (value))
+ {
+ vec<constructor_elt, va_gc> *c = CONSTRUCTOR_ELTS (value);
+ /* Check that all the fields are zero, independent
+ of whether vaddr comes first/last. */
+ const tree phase_or_vaddr = (*c)[0].value;
+ const tree thread = (*c)[1].value;
+ const tree vaddr_or_phase = (*c)[2].value;
+ result = integer_zerop (phase_or_vaddr) && integer_zerop (thread)
+ && integer_zerop (vaddr_or_phase);
+ }
+ }
+ return result;
+}
+
+/* Given, EXP, whose type must be the UPC pointer-to-shared
+ representation type, isolate the thread field,
+ and return it. Caller must insure that EXP is a
+ stable reference, if required. */
+
+tree
+upc_pts_build_threadof (location_t loc ATTRIBUTE_UNUSED, tree exp)
+{
+ tree affinity;
+ tree type = TREE_TYPE (upc_thread_field_node);
+ gcc_assert (TREE_TYPE (exp) == upc_pts_rep_type_node);
+ affinity = build3 (COMPONENT_REF, type, exp,
+ upc_thread_field_node, NULL_TREE);
+ affinity = fold_convert (sizetype, affinity);
+ return affinity;
+}
+
+/* Rewrite EXP, an expression involving addition of an
+ integer to a UPC pointer-to-shared, into representation-specific
+ lower level operations. */
+
+tree
+upc_pts_build_sum (location_t loc, tree exp)
+{
+ const tree op0 = TREE_OPERAND (exp, 0);
+ const tree op1 = TREE_OPERAND (exp, 1);
+ const enum tree_code op0_code = TREE_CODE (TREE_TYPE (op0));
+ const tree targ_type = TREE_TYPE (TREE_TYPE (exp));
+ const tree elem_type = strip_array_types (targ_type);
+ const tree elem_size = !VOID_TYPE_P (elem_type)
+ ? size_in_bytes (elem_type) : integer_one_node;
+ const tree block_factor = get_block_factor (elem_type);
+ const int has_phase = !(integer_zerop (block_factor)
+ || integer_onep (block_factor));
+ const tree elem_per_block = block_factor;
+ const tree ptrop = (op0_code == POINTER_TYPE) ? op0 : op1;
+ const tree intop = (op0_code == POINTER_TYPE) ? op1 : op0;
+ const tree index = save_expr (intop);
+ const tree ptrop_as_pts_rep = fold (build1 (VIEW_CONVERT_EXPR,
+ upc_pts_rep_type_node,
+ ptrop));
+ const tree sptrop = save_expr (ptrop_as_pts_rep);
+ const tree p_t = TREE_TYPE (upc_phase_field_node);
+ const tree t_t = TREE_TYPE (upc_thread_field_node);
+ const tree v_t = TREE_TYPE (upc_vaddr_field_node);
+ tree n_threads = upc_num_threads ();
+ tree old_phase, old_thread, old_vaddr;
+ tree phase, thread, vaddr;
+ tree tincr, t1, t2;
+ tree result;
+
+ old_phase = build3 (COMPONENT_REF, p_t, sptrop,
+ upc_phase_field_node, NULL_TREE);
+ old_thread = build3 (COMPONENT_REF, t_t, sptrop,
+ upc_thread_field_node, NULL_TREE);
+ old_vaddr = build3 (COMPONENT_REF, v_t, sptrop,
+ upc_vaddr_field_node, NULL_TREE);
+ thread = old_thread;
+ phase = old_phase;
+ if (VOID_TYPE_P (targ_type) || integer_zerop (block_factor))
+ {
+ vaddr = build_binary_op (loc, PLUS_EXPR, old_vaddr,
+ build_binary_op (loc, MULT_EXPR,
+ index, elem_size, 0), 0);
+ }
+ else
+ {
+ /* Make sure n_threads is a signed integer to ensure
+ that the FLOOR_MOD and FLOOR_DIV operations below are performed
+ with signed operations. */
+ if (TYPE_UNSIGNED (TREE_TYPE (n_threads)))
+ n_threads = convert (integer_type_node, n_threads);
+ if (has_phase)
+ {
+ tree nt_elems;
+ tree phase_diff;
+ old_phase = save_expr (old_phase);
+ /* tincr = old_thread * elem_per_block + old_phase + index; */
+ tincr = build_binary_op (loc, PLUS_EXPR,
+ build_binary_op (loc, PLUS_EXPR,
+ build_binary_op (loc, MULT_EXPR,
+ old_thread, elem_per_block, 0),
+ old_phase, 0),
+ index, 0);
+ if (TYPE_UNSIGNED (TREE_TYPE (tincr)))
+ tincr = convert (integer_type_node, tincr);
+ /* nt_elems = n_threads * elem_per_block; */
+ nt_elems = build_binary_op (loc, MULT_EXPR, n_threads,
+ elem_per_block, 0);
+ if (TYPE_UNSIGNED (TREE_TYPE (nt_elems)))
+ nt_elems = convert (integer_type_node, nt_elems);
+ /* floor_divmod (tincr, nt_elems, &t1, &t2); */
+ t1 = build_binary_op (loc, FLOOR_DIV_EXPR, tincr, nt_elems, 0);
+ t2 = build_binary_op (loc, FLOOR_MOD_EXPR, tincr, nt_elems, 0);
+ t2 = save_expr (t2);
+ /* thread = t2 / elem_per_block; */
+ thread = build_binary_op (loc, TRUNC_DIV_EXPR, t2,
+ elem_per_block, 0);
+ /* phase = t2 % elem_per_block; */
+ phase = build_binary_op (loc, TRUNC_MOD_EXPR, t2,
+ elem_per_block, 0);
+ phase_diff =
+ build_binary_op (loc, MINUS_EXPR, phase, old_phase, 0);
+ /* vaddr = old_vaddr + (t1 * elem_per_block + phase_diff)
+ * elem_size; */
+ vaddr = build_binary_op (loc, PLUS_EXPR,
+ old_vaddr,
+ build_binary_op (loc, MULT_EXPR,
+ build_binary_op (loc, PLUS_EXPR,
+ build_binary_op (loc, MULT_EXPR,
+ t1, elem_per_block, 0),
+ phase_diff, 0),
+ elem_size, 0), 0);
+ }
+ else
+ {
+ /* tincr = old_thread * elem_per_block + index; */
+ tincr = build_binary_op (loc, PLUS_EXPR,
+ build_binary_op (loc, MULT_EXPR,
+ old_thread,
+ elem_per_block, 0),
+ index, 0);
+ if (TYPE_UNSIGNED (TREE_TYPE (tincr)))
+ tincr = convert (integer_type_node, tincr);
+ /* floor_divmod (tincr, n_threads, &t1, &t2); */
+ t1 = build_binary_op (loc, FLOOR_DIV_EXPR, tincr, n_threads, 0);
+ t2 = build_binary_op (loc, FLOOR_MOD_EXPR, tincr, n_threads, 0);
+ /* vaddr = old_vaddr + t1 * elem_size; */
+ vaddr = build_binary_op (loc, PLUS_EXPR, old_vaddr,
+ build_binary_op (loc, MULT_EXPR, t1,
+ elem_size, 0), 0);
+ /* thread = t2; */
+ thread = t2;
+ }
+ }
+ result =
+ upc_pts_build_value (loc, TREE_TYPE (exp), vaddr, thread, phase);
+ return result;
+}
+
+/* Expand the expression EXP, which calculates the difference
+ between two UPC pointers-to-shared. */
+
+tree
+upc_pts_build_diff (location_t loc, tree exp)
+{
+ tree op0 = TREE_OPERAND (exp, 0);
+ tree op1 = TREE_OPERAND (exp, 1);
+ const tree result_type = ptrdiff_type_node;
+ const tree p_t = TREE_TYPE (upc_phase_field_node);
+ const tree t_t = TREE_TYPE (upc_thread_field_node);
+ const tree v_t = TREE_TYPE (upc_vaddr_field_node);
+ const tree target_type = TREE_TYPE (TREE_TYPE (op0));
+ const tree n_threads = upc_num_threads ();
+ const tree elem_size = convert (ssizetype, size_in_bytes (target_type));
+ const tree block_factor = get_block_factor (target_type);
+ tree thread0, thread1, thread_diff;
+ tree phase_diff;
+ tree off0, off1, offset_diff, elem_diff;
+ tree result;
+
+ /* The two pointers must both point to shared objects, and we
+ have to perform the reverse of addition on UPC pointers-to-shared */
+
+ if ((SHARED_TYPE_P (target_type)
+ && !SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (op1))))
+ || (SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (op1)))
+ && !SHARED_TYPE_P (target_type)))
+ {
+ error_at (loc, "attempt to take the difference of a UPC "
+ "pointer-to-shared and a local pointer");
+ return error_mark_node;
+ }
+ op0 = save_expr (op0);
+ op1 = save_expr (op1);
+ op0 = build1 (VIEW_CONVERT_EXPR, upc_pts_rep_type_node, op0);
+ op1 = build1 (VIEW_CONVERT_EXPR, upc_pts_rep_type_node, op1);
+ off0 = build3 (COMPONENT_REF, v_t, op0, upc_vaddr_field_node, NULL_TREE);
+ off1 = build3 (COMPONENT_REF, v_t, op1, upc_vaddr_field_node, NULL_TREE);
+ /* Convert offset fields into ptrdiff_t types so that the
+ result of the difference comes out as a signed type. */
+ off0 = convert (result_type, off0);
+ off1 = convert (result_type, off1);
+ offset_diff = build_binary_op (loc, MINUS_EXPR, off0, off1, 0);
+ elem_diff =
+ build_binary_op (loc, EXACT_DIV_EXPR, offset_diff, elem_size, 0);
+ if (integer_zerop (block_factor))
+ {
+ return elem_diff;
+ }
+ thread0 = convert (ssizetype,
+ build3 (COMPONENT_REF, t_t, op0,
+ upc_thread_field_node, NULL_TREE));
+ thread1 = convert (ssizetype,
+ build3 (COMPONENT_REF, t_t, op1,
+ upc_thread_field_node, NULL_TREE));
+ thread_diff = build_binary_op (loc, MINUS_EXPR, thread0, thread1, 0);
+ phase_diff = integer_zero_node;
+ if (!tree_int_cst_equal (block_factor, integer_one_node))
+ {
+ tree phase0 = convert (ssizetype,
+ build3 (COMPONENT_REF, p_t, op0,
+ upc_phase_field_node, NULL_TREE));
+ tree phase1 = convert (ssizetype,
+ build3 (COMPONENT_REF, p_t, op1,
+ upc_phase_field_node, NULL_TREE));
+ phase_diff =
+ save_expr (build_binary_op (loc, MINUS_EXPR, phase0, phase1, 0));
+ }
+ /* The expression below calculates the following:
+ (elem_diff - phase_diff) * THREADS
+ + (thread_diff * block_factor) + phase_diff; */
+ result = build_binary_op (loc, PLUS_EXPR,
+ build_binary_op (loc, PLUS_EXPR,
+ build_binary_op (loc, MULT_EXPR,
+ build_binary_op (loc, MINUS_EXPR,
+ elem_diff, phase_diff, 0),
+ n_threads, 0),
+ build_binary_op (loc, MULT_EXPR,
+ thread_diff,
+ block_factor, 0), 0),
+ phase_diff, 0);
+ result = fold_convert (result_type, result);
+ return result;
+}
+
+/* Handle conversions between UPC pointers-to-shared and
+ local pointers, or between UPC pointers-to-shared which
+ have differing block factors. */
+
+tree
+upc_pts_build_cvt (location_t loc, tree exp)
+{
+ const tree type = TREE_TYPE (exp);
+ const tree p_t = ptr_type_node;
+ const tree t_t = TREE_TYPE (upc_thread_field_node);
+ const tree ptr = TREE_OPERAND (exp, 0);
+ tree tt1, tt2, b1, b2;
+ tree result = exp;
+
+ tt1 = TREE_TYPE (TREE_TYPE (exp));
+ tt2 = TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0)));
+ b1 = get_block_factor (tt1);
+ b2 = get_block_factor (tt2);
+ if (SHARED_TYPE_P (tt1) != SHARED_TYPE_P (tt2))
+ {
+ if (SHARED_TYPE_P (tt1))
+ {
+ /* Error: local -> shared */
+ result = error_mark_node;
+ }
+ else
+ {
+ /* shared -> local */
+ int doprofcall = flag_upc_debug
+ || (flag_upc_instrument && get_upc_pupc_mode ());
+ const char *libfunc_name =
+ doprofcall ? UPC_GETADDRG_LIBCALL : UPC_GETADDR_LIBCALL;
+ tree src = build1 (NOP_EXPR, upc_pts_rep_type_node,
+ TREE_OPERAND (exp, 0));
+ tree libfunc, lib_args, lib_call;
+ libfunc = identifier_global_value (get_identifier (libfunc_name));
+ if (!libfunc)
+ internal_error ("UPC runtime library function %s not found",
+ libfunc_name);
+ lib_args = tree_cons (NULL_TREE, src, NULL_TREE);
+ if (doprofcall)
+ lib_args =
+ upc_gasp_add_src_args (lib_args,
+ LOCATION_FILE (input_location),
+ LOCATION_LINE (input_location));
+ lib_call = build_function_call (loc, libfunc, lib_args);
+ result = build1 (VIEW_CONVERT_EXPR, type, lib_call);
+ }
+ }
+ else if ((SHARED_TYPE_P (tt1) && !VOID_TYPE_P (tt1))
+ && !(integer_zerop (b1) && integer_zerop (b2)))
+ {
+ /* below, we handle the case of conversions to non-generic
+ shared types. If the target is a generic type, we can
+ safely use the source value directly. */
+ tree s1 = TYPE_SIZE (tt1);
+ tree s2 = TYPE_SIZE (tt2);
+ /* normalize block sizes, so that [0] => NULL */
+ if (integer_zerop (b1))
+ b1 = NULL;
+ if (integer_zerop (b2))
+ b2 = NULL;
+ /* normalize type size so that 0 => NULL */
+ if (s1 && integer_zerop (s1))
+ s1 = NULL;
+ if (s2 && integer_zerop (s2))
+ s2 = NULL;
+ /* If the source type is an array type, then bypass
+ the check for equal type sizes. This arises when
+ an array is implicitly converted to a pointer to
+ the element type. */
+ if ((TREE_CODE (tt1) != ARRAY_TYPE)
+ && (TREE_CODE (tt2) == ARRAY_TYPE))
+ {
+ const tree elem_type1 = strip_array_types (tt1);
+ const tree elem_type2 = strip_array_types (tt2);
+ if (TYPE_MAIN_VARIANT (elem_type1)
+ == TYPE_MAIN_VARIANT (elem_type2))
+ s2 = s1;
+ }
+ /* If the source type is a not a generic pointer to shared, and
+ either its block size or type size differs from the target,
+ then the result must have zero phase. If the source type is
+ a generic pointer to shared and the target type is a pointer
+ to a shared type with either an indefinite block size, or
+ a block size of one, then the resulting value must have a
+ phase of zero. */
+ if ((!VOID_TYPE_P (tt2)
+ && !(tree_int_cst_equal (b1, b2) && tree_int_cst_equal (s1, s2)))
+ || (VOID_TYPE_P (tt2)
+ && ((b1 == NULL)
+ || tree_int_cst_equal (b1, integer_one_node))))
+ {
+ const tree ptr_as_pts_rep = fold (build1 (VIEW_CONVERT_EXPR,
+ upc_pts_rep_type_node,
+ ptr));
+ const tree sptr = save_expr (ptr_as_pts_rep);
+ const tree ptr_with_zero_phase =
+ upc_pts_build_value (loc, type,
+ build3 (COMPONENT_REF, p_t, sptr,
+ upc_vaddr_field_node,
+ NULL_TREE),
+ build3 (COMPONENT_REF, t_t, sptr,
+ upc_thread_field_node,
+ NULL_TREE),
+ integer_zero_node);
+ result = ptr_with_zero_phase;
+ }
+ }
+ return result;
+}
+
+
+/* Expand the expression EXP, which is a comparison between two
+ UPC pointers-to-shared.
+
+ Per 6.4.2p6:
+ Two compatible pointers-to-shared which point to the same object
+ (i.e. having the same address and thread components) shall compare
+ as equal according to == and !=, regardless of whether the phase
+ components match.
+
+ Thus, for the equality comparison, the phase component of the
+ pointers is omitted from the comparison. In that case,
+ rewrite the pointer-to-shared comparison operation into a
+ field by field comparison the vaddr and thread fields
+ of the UPC pointer-to-shared operands.
+
+ If the bit-wise comparison cannot be performed, then the difference
+ between the pointers is compared to zero. */
+
+tree
+upc_pts_build_cond_expr (location_t loc, tree exp)
+{
+ tree result;
+ const enum tree_code code = TREE_CODE (exp);
+ const int is_eq_op = (code == EQ_EXPR || code == NE_EXPR);
+ tree op0 = TREE_OPERAND (exp, 0);
+ tree op1 = TREE_OPERAND (exp, 1);
+ const tree type0 = TREE_TYPE (op0);
+ const tree type1 = TREE_TYPE (op1);
+ gcc_assert (POINTER_TYPE_P (type0));
+ gcc_assert (POINTER_TYPE_P (type1));
+ {
+ const tree ttype0 = TREE_TYPE (type0);
+ const tree ttype1 = TREE_TYPE (type1);
+ const tree elem_type0 = strip_array_types (ttype0);
+ const tree elem_type1 = strip_array_types (ttype1);
+ gcc_assert (TREE_SHARED (elem_type0));
+ gcc_assert (TREE_SHARED (elem_type1));
+ /* For == and !=, per 6.4.2p6 only compare (vaddr, thread). */
+ if (is_eq_op)
+ {
+ const tree t_t = TREE_TYPE (upc_thread_field_node);
+ const tree v_t = TREE_TYPE (upc_vaddr_field_node);
+ const enum tree_code code0 = TREE_CODE (op0);
+ const enum tree_code code1 = TREE_CODE (op1);
+ const enum tree_code tcode = (code == EQ_EXPR)
+ ? TRUTH_ANDIF_EXPR : TRUTH_ORIF_EXPR;
+ if (code0 == VIEW_CONVERT_EXPR
+ && TREE_TYPE (TREE_OPERAND (op0, 0)) == upc_pts_rep_type_node)
+ op0 = TREE_OPERAND (op0, 0);
+ else
+ op0 = build1 (VIEW_CONVERT_EXPR, upc_pts_rep_type_node, op0);
+ if (code1 == VIEW_CONVERT_EXPR
+ && TREE_TYPE (TREE_OPERAND (op1, 0)) == upc_pts_rep_type_node)
+ op1 = TREE_OPERAND (op1, 0);
+ else
+ op1 = build1 (VIEW_CONVERT_EXPR, upc_pts_rep_type_node, op1);
+ op0 = save_expr (op0);
+ op1 = save_expr (op1);
+ {
+ const tree off0 = build3 (COMPONENT_REF, v_t, op0,
+ upc_vaddr_field_node, NULL_TREE);
+ const tree off1 = build3 (COMPONENT_REF, v_t, op1,
+ upc_vaddr_field_node, NULL_TREE);
+ const tree off_cmp = build_binary_op (loc, code, off0, off1, 0);
+ const tree thread0 = build3 (COMPONENT_REF, t_t, op0,
+ upc_thread_field_node, NULL_TREE);
+ const tree thread1 = build3 (COMPONENT_REF, t_t, op1,
+ upc_thread_field_node, NULL_TREE);
+ const tree thread_cmp =
+ build_binary_op (loc, code, thread0, thread1, 0);
+ result = build_binary_op (loc, tcode, off_cmp, thread_cmp, 0);
+ /* Remove possible C_MAYBE_EXPR operands. */
+ result = c_fully_fold (result, 0, NULL);
+ result = gimple_boolify (result);
+ result = fold_convert (TREE_TYPE (exp), result);
+ }
+ }
+ else
+ {
+ const tree ptr_diff =
+ build_binary_op (loc, MINUS_EXPR, op0, op1, 0);
+ op0 = ptr_diff;
+ op1 = build_int_cst (TREE_TYPE (op0), 0);
+ TREE_OPERAND (exp, 0) = op0;
+ TREE_OPERAND (exp, 1) = op1;
+ result = exp;
+ }
+ }
+ return result;
+}
diff --git a/gcc/c/c-upc-pts-ops.h b/gcc/c/c-upc-pts-ops.h
new file mode 100644
index 00000000000..ac3b028b532
--- /dev/null
+++ b/gcc/c/c-upc-pts-ops.h
@@ -0,0 +1,35 @@
+/* Define UPC pointer-to-shared representation-independent operations
+ Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_C_UPC_PTS_OPS_H
+#define GCC_C_UPC_PTS_OPS_H 1
+
+extern tree upc_pts_build_cond_expr (location_t, tree);
+extern tree upc_pts_build_constant (location_t, tree);
+extern tree upc_pts_build_cvt (location_t, tree);
+extern tree upc_pts_build_diff (location_t, tree);
+extern tree upc_pts_build_sum (location_t, tree);
+extern tree upc_pts_build_threadof (location_t, tree);
+extern tree upc_pts_build_value (location_t, tree, tree, tree, tree);
+extern void upc_pts_init (void);
+extern int upc_pts_is_null_p (tree);
+
+#endif /* !GCC_C_UPC_PTS_OPS_H */
diff --git a/gcc/c/c-upc-rts-names.h b/gcc/c/c-upc-rts-names.h
new file mode 100644
index 00000000000..8ce1a1d1dc9
--- /dev/null
+++ b/gcc/c/c-upc-rts-names.h
@@ -0,0 +1,64 @@
+/* Define compiler-visible UPC runtime entry points and variables.
+ Copyright (C) 2004-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_C_C_UPC_RTS_NAMES_H
+#define GCC_C_C_UPC_RTS_NAMES_H 1
+
+/* Name of initialization routine that is called to initialize
+ shared variables and calculate shared address. Both of these
+ operations must be performed at runtime before UPC's main
+ program is called. */
+#define UPC_INIT_DECLS_FUNC "__upc_init_decls"
+
+/* Name of runtime variable that is used by the code generated
+ for the 'upc_forall' statement to implement nested upc_forall
+ semantics. Per the language specification, a dynamically nested
+ upc_forall statement with an affinity clause will operate
+ as if "continue" had been supplied for the affinity clause. */
+#define UPC_FORALL_DEPTH_NAME "__upc_forall_depth"
+
+/* Name of the runtime variable holding the address of the beginning of
+ the global shared region. */
+#define UPC_GLOBAL_BASE_NAME "__upc_global_base"
+
+/* Names of various UPC runtime library routines that implement various
+ UPC statement constructs. */
+#define UPC_BARRIER_LIBCALL "__upc_barrier"
+#define UPC_GETADDR_LIBCALL "__getaddr"
+#define UPC_NOTIFY_LIBCALL "__upc_notify"
+#define UPC_WAIT_LIBCALL "__upc_wait"
+
+/* Profiled/debugged runtime library routines */
+#define UPC_BARRIERG_LIBCALL "__upc_barrierg"
+#define UPC_GETADDRG_LIBCALL "__getaddrg"
+#define UPC_NOTIFYG_LIBCALL "__upc_notifyg"
+#define UPC_NOTIFYG_LIBCALL "__upc_notifyg"
+#define UPC_WAITG_LIBCALL "__upc_waitg"
+
+/* Runtime library function that records upc_forall begin/end
+ when -fupc-instrument is asserted. */
+#define UPC_INSTRUMENT_FORALL "__upc_forallg"
+
+/* Runtime library function that records function entry/exit
+ when -fupc-instrument-functions is asserted. */
+#define UPC_INSTRUMENT_FUNC "__upc_funcg"
+
+#endif /* !GCC_C_C_UPC_RTS_NAMES_H */
diff --git a/gcc/c/c-upc.c b/gcc/c/c-upc.c
new file mode 100644
index 00000000000..a14ded90fda
--- /dev/null
+++ b/gcc/c/c-upc.c
@@ -0,0 +1,798 @@
+/* c-upc.c: implement UPC-related actions
+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+ Based on original implementation
+ by Jesse M. Draper <jdraper@super.org>
+ and William W. Carlson <wwc@super.org>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "c-family/c-common.h"
+#include "langhooks.h"
+#include "tree.h"
+#include "alias.h"
+#include "fold-const.h"
+#include "stringpool.h"
+#include "stor-layout.h"
+#include "output.h"
+#include "attribs.h"
+#include "target.h"
+#include "varasm.h"
+#include "c-upc.h"
+#include "c-family/c-upc-pts.h"
+#include "c-upc-pts-ops.h"
+#include "c-upc-rts-names.h"
+
+
+static int recursive_count_upc_threads_refs (tree);
+static int upc_sizeof_type_check (const char *, tree);
+
+
+/* Return a UPC pointer-to-shared type with target type, TO_TYPE.
+ If the UPC pointer-to-shared representation has a "register mode",
+ then build a pointer type with that mode. If the UPC pointer-to-shared
+ representation type has BLKmode, then calculate its size based
+ upon the representation type. */
+
+tree
+upc_build_pointer_type (tree to_type)
+{
+ machine_mode pointer_mode;
+ tree ptr_type;
+ if (to_type == NULL_TREE || TREE_CODE (to_type) == ERROR_MARK)
+ return error_mark_node;
+ pointer_mode = TYPE_MODE (upc_pts_rep_type_node);
+ ptr_type = build_pointer_type_for_mode (to_type, pointer_mode, false);
+ if (!integer_zerop (TYPE_SIZE (ptr_type)))
+ return ptr_type;
+ /* If the UPC pointer-to-shared representation has a size of zero,
+ then it must have BLKmode. In that case, calculate the sizes
+ and alignment from the underlying representation type. This
+ situation may arise when the 'struct PTS' representation is
+ configured on targets that do not assign TImode to aligned
+ 128 bit structs. */
+ gcc_assert (pointer_mode == BLKmode);
+ TYPE_SIZE (ptr_type) = TYPE_SIZE (upc_pts_rep_type_node);
+ TYPE_SIZE_UNIT (ptr_type) = TYPE_SIZE_UNIT (upc_pts_rep_type_node);
+ TYPE_ALIGN (ptr_type) = TYPE_ALIGN (upc_pts_rep_type_node);
+ TYPE_UNSIGNED (ptr_type) = TYPE_UNSIGNED (upc_pts_rep_type_node);
+ TYPE_PRECISION (ptr_type) = TYPE_PRECISION (upc_pts_rep_type_node);
+ return ptr_type;
+}
+
+/* Check the type of the operand passed to a
+ upc_*sizeof () operator.
+
+ The type must *not* be:
+ - an error mark node
+ - an incomplete type
+ - a function type
+ - a void type
+
+ The type *must* be a UPC 'shared' type.
+
+ UPC defines the following flavors of sizeof operators:
+ upc_blocksizeof, upc_elemsizeof, and upc_localsizeof.
+ These operations have similar syntax and constraints
+ as the "C" language sizeof operator. */
+
+static int
+upc_sizeof_type_check (const char *op_name, tree type)
+{
+ enum tree_code code = TREE_CODE (type);
+ if (code == ERROR_MARK)
+ {
+ return 0;
+ }
+ else if (!COMPLETE_TYPE_P (type))
+ {
+ lang_hooks.types.incomplete_type_error (NULL_TREE, type);
+ return 0;
+ }
+ else if (code == FUNCTION_TYPE)
+ {
+ error ("UPC operator %s applied to a function type", op_name);
+ return 0;
+ }
+ else if (code == VOID_TYPE)
+ {
+ error ("UPC operator %s applied to a void type", op_name);
+ return 0;
+ }
+ else if (!SHARED_TYPE_P (type))
+ {
+ error ("UPC operator %s applied to a non-shared type", op_name);
+ return 0;
+ }
+ return 1;
+}
+
+/* Compute the value of the `upc_blocksizeof' operator.
+ The UPC block size is the value of UPC's "layout qualifier".
+ For example:
+
+ Declaration upc_blocksizeof()
+ ----------- ----------------
+ shared int A[5*THREADS]; 1 (default)
+ shared [5] int A[5*THREADS]; 5
+ shared [] int A[5*100]; 0 (indefinite)
+ shared [*] int A[5*THREADS]; 5 (distributed by compiler) */
+
+tree
+upc_blocksizeof (location_t ARG_UNUSED (loc), tree type)
+{
+ tree block_factor = size_one_node;
+ if (!type || TREE_CODE (type) == ERROR_MARK)
+ return error_mark_node;
+ if (upc_sizeof_type_check ("upc_blocksizeof", type))
+ block_factor = get_block_factor (type);
+ return block_factor;
+}
+
+/* Compute the value of the `upc_elemsizeof' operator. */
+
+tree
+upc_elemsizeof (location_t loc, tree type)
+{
+ tree elem_size;
+
+ if (!(type && upc_sizeof_type_check ("upc_elemsizeof", type)))
+ return size_int (1);
+ elem_size = c_sizeof (loc, strip_array_types (type));
+ return elem_size;
+}
+
+/* Compute the value of the `upc_localsizeof' operator.
+ Per the language spec:
+ The upc_localsizeof operator returns the size, in bytes, of the
+ local portion of its operand, which may be a shared object or a
+ shared-qualified type. It returns the same value on all threads; the
+ value is an upper bound of the size allocated with affinity to any
+ single thread and may include an unspecified amount of padding.
+ The result of upc_localsizeof is an integer constant. */
+
+tree
+upc_localsizeof (location_t loc, tree type)
+{
+ tree block_factor, local_size, total_size;
+
+ if (!(type && upc_sizeof_type_check ("upc_localsizeof", type)))
+ return size_one_node;
+
+ /* for scalars, return sizeof */
+
+ if (TREE_CODE (type) != ARRAY_TYPE)
+ return c_sizeof (loc, type);
+
+ block_factor = upc_blocksizeof (loc, type);
+ block_factor = convert (bitsizetype, block_factor);
+ total_size = TYPE_SIZE (type);
+
+ if (integer_zerop (block_factor))
+ {
+ /* local size is total size, because the entire
+ object lives on a single thread. This is the
+ case for declarations of types with an "indefinite"
+ layout qualifier. For example, given:
+ shared [] int A[100];
+ the value returned for upc_localsizeof (A)
+ will be: 100 * sizeof (int). */
+ local_size = total_size;
+ }
+ else
+ {
+ tree elt_type, elt_size, n_elts;
+ tree t_factor, n_full_blocks;
+ tree n_full_blocks_per_thread, n_elts_in_full_blocks;
+ tree n_rem_elts, n_local_elts;
+ elt_type = strip_array_types (type);
+ if (!elt_type || TREE_CODE (elt_type) == ERROR_MARK)
+ return size_one_node;
+ elt_size = TYPE_SIZE (elt_type);
+ n_elts = size_binop (EXACT_DIV_EXPR, total_size, elt_size);
+ /* Use the worst case size, if compiling in a dynamic
+ threads environment. The worst case size can
+ be derived by setting T_FACTOR to 1 in the calculations
+ that follow. Otherwise T_FACTOR is equal to THREADS. */
+ t_factor = flag_upc_threads ? upc_num_threads () : size_one_node;
+ t_factor = convert (bitsizetype, t_factor);
+ n_full_blocks = size_binop (FLOOR_DIV_EXPR, n_elts, block_factor);
+ n_full_blocks_per_thread = size_binop (FLOOR_DIV_EXPR,
+ n_full_blocks, t_factor);
+ n_elts_in_full_blocks = size_binop (MULT_EXPR,
+ size_binop (MULT_EXPR,
+ n_full_blocks_per_thread,
+ t_factor),
+ block_factor);
+ n_rem_elts = size_binop (MINUS_EXPR, n_elts, n_elts_in_full_blocks);
+ n_local_elts = size_binop (MULT_EXPR,
+ n_full_blocks_per_thread, block_factor);
+ /* If any elements remain, add a full block size. */
+ if (!integer_zerop (n_rem_elts))
+ n_local_elts = size_binop (PLUS_EXPR, n_local_elts, block_factor);
+ local_size = size_binop (MULT_EXPR, n_local_elts, elt_size);
+ }
+
+ /* Convert local size into bytes, and return result. */
+
+ local_size = convert (sizetype, local_size);
+ local_size = size_binop (CEIL_DIV_EXPR, local_size,
+ size_int (BITS_PER_UNIT));
+ return local_size;
+}
+
+/* Traverse the expression and return the number of times
+ THREADS is referenced. This is used to check the restriction
+ on UPC shared array declarations, that the predefined THREADS
+ variable can be mentioned only once. */
+
+static int
+recursive_count_upc_threads_refs (tree expr)
+{
+ enum tree_code code;
+ int i;
+ int count = 0;
+ if (expr == NULL_TREE)
+ return 0;
+ code = TREE_CODE (expr);
+ switch (TREE_CODE_CLASS (code))
+ {
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_comparison:
+ case tcc_expression:
+ case tcc_reference:
+ case tcc_statement:
+ for (i = 0; i < TREE_CODE_LENGTH (code); i++)
+ count += recursive_count_upc_threads_refs (TREE_OPERAND (expr, i));
+ break;
+ case tcc_declaration:
+ if (expr == lookup_name (get_identifier ("THREADS")))
+ count = 1;
+ break;
+ default:
+ break;
+ }
+ return count;
+}
+
+/* Count the number of references to THREADS inside `expr'. */
+
+int
+count_upc_threads_refs (tree expr)
+{
+ return recursive_count_upc_threads_refs (expr);
+}
+
+/* Test that EXPR is an expression tree where THREADS appears on
+ the left or the right hand side of a multiply, in a series
+ of zero or more multiplies. For proper operation, the caller
+ should ensure that THREADS is referenced only once,
+ by calling count_upc_threads_refs () prior to calling this routine. */
+
+int
+is_multiple_of_upc_threads (tree expr)
+{
+ enum tree_code code;
+ if (expr == NULL_TREE)
+ return 0;
+ if (expr == lookup_name (get_identifier ("THREADS")))
+ return 1;
+ code = TREE_CODE (expr);
+ if (code == MULT_EXPR)
+ return is_multiple_of_upc_threads (TREE_OPERAND (expr, 0))
+ | is_multiple_of_upc_threads (TREE_OPERAND (expr, 1));
+ if ((code == NOP_EXPR) || (code == NON_LVALUE_EXPR)
+ || (code == CONVERT_EXPR))
+ return is_multiple_of_upc_threads (TREE_OPERAND (expr, 0));
+ return 0;
+}
+
+/* Find all references to THREADS and change them into the constant `1'.
+ This is done so that fold () when applied to the dimension of a
+ UPC shared array will yield the local size of the array. */
+
+void
+set_upc_threads_refs_to_one (tree *expr)
+{
+ enum tree_code code;
+ int i;
+ if (*expr == NULL_TREE)
+ return;
+ code = TREE_CODE (*expr);
+ switch (TREE_CODE_CLASS (code))
+ {
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_comparison:
+ case tcc_expression:
+ case tcc_reference:
+ case tcc_statement:
+ for (i = 0; i < TREE_CODE_LENGTH (code); i++)
+ set_upc_threads_refs_to_one (&TREE_OPERAND (*expr, i));
+ break;
+ case tcc_declaration:
+ if (*expr == lookup_name (get_identifier ("THREADS")))
+ *expr = integer_one_node;
+ break;
+ default:
+ break;
+ }
+ return;
+}
+
+/* As part of declaration processing, for a particular kind
+ of declaration, DECL_KIND, and a given LAYOUT_QUALIFIER, calculate
+ the resulting blocking factor and return it. Issue an error
+ diagnostic if the LAYOUT_QUALIFIER specification is invalid.
+ For array types, the TYPE parameter may be the MAIN_VARIANT,
+ and not shared qualified; in that case - ELEM_BLOCK_FACTOR
+ is the blocking factor derived from the original element type.
+ If LAYOUT_QUALIFIER is NULL and ELEM_BLOCK_FACTOR is non-null,
+ then the ELEM_BLOCK_FACTOR will be used. This situation occurs
+ when the element type is a typedef, for example. If both
+ LAYOUT_QUALIFIER and ELEM_BLOCK_FACTOR are non-NULL, then they
+ must be equal. */
+
+tree
+upc_grok_layout_qualifier (location_t loc, const enum tree_code decl_kind,
+ tree type, tree elem_block_factor,
+ tree layout_qualifier)
+{
+ tree block_factor = NULL_TREE;
+
+ if (!type || (TREE_CODE (type) == ERROR_MARK))
+ return error_mark_node;
+
+ if (TREE_CODE (type) == VOID_TYPE)
+ {
+ error_at (loc, "UPC layout qualifier cannot be applied to a void type");
+ return NULL_TREE;
+ }
+
+ /* If no explicit layout qualifier was supplied, then
+ use the blocking factor derived from the element type. */
+ if (!layout_qualifier && elem_block_factor)
+ return elem_block_factor;
+
+ /* The layout qualifier is given as the subscript operand
+ of an array ref. */
+ gcc_assert (layout_qualifier);
+ gcc_assert (TREE_CODE (layout_qualifier) == ARRAY_REF);
+ layout_qualifier = TREE_OPERAND (layout_qualifier, 1);
+
+ if (layout_qualifier == NULL_TREE)
+ {
+ /* The layout qualifier is [], which is
+ equivalent to specifying [0]. */
+ block_factor = size_zero_node;
+ }
+ else if ((TREE_CODE (layout_qualifier) == INDIRECT_REF)
+ && ((TREE_OPERAND (layout_qualifier, 0)) == NULL_TREE))
+ {
+ tree elt_size, elt_type, n_threads;
+ /* The layout qualifier is [*]. The compiler must calculate
+ a blocking factor that evenly distributes the array's
+ elements over all the UPC threads. */
+ if (!COMPLETE_TYPE_P (type))
+ {
+ error_at (loc, "UPC layout qualifier of the form [*] cannot be "
+ "applied to an incomplete type");
+ return NULL_TREE;
+ }
+ if (decl_kind == POINTER_TYPE)
+ {
+ error_at (loc, "UPC [*] qualifier may not be used in "
+ "declaration of pointers");
+ return NULL_TREE;
+ }
+ /* The blocking factor is given by this expression:
+ (sizeof (a) / upc_elemsizeof (a) + (THREADS - 1)) / THREADS,
+ where 'a' is the array being distributed. */
+ elt_type = strip_array_types (type);
+ elt_size = TYPE_SIZE (elt_type);
+ if (TYPE_HAS_THREADS_FACTOR (type))
+ block_factor =
+ size_binop (FLOOR_DIV_EXPR, TYPE_SIZE (type), elt_size);
+ else
+ {
+ n_threads = convert (bitsizetype, upc_num_threads ());
+ if (TREE_CODE (n_threads) != INTEGER_CST)
+ {
+ error_at (loc, "a UPC layout qualifier of '[*]' requires that "
+ "the array size is either an integral constant "
+ "or an integral multiple of THREADS");
+ block_factor = size_one_node;
+ }
+ else
+ {
+ block_factor = size_binop (CEIL_DIV_EXPR,
+ size_binop (FLOOR_DIV_EXPR,
+ TYPE_SIZE (type),
+ elt_size),
+ n_threads);
+ }
+ }
+ }
+ else
+ {
+ STRIP_NOPS (layout_qualifier);
+ if (TREE_CODE (layout_qualifier) != INTEGER_CST)
+ {
+ error_at (loc, "UPC layout qualifier is not an integral constant");
+ block_factor = size_one_node;
+ }
+ else if (tree_to_shwi (layout_qualifier) < 0)
+ {
+ error_at (loc, "UPC layout qualifier must be a non-negative "
+ "integral constant");
+ block_factor = size_one_node;
+ }
+ else
+ block_factor = fold (layout_qualifier);
+ }
+
+ if (TREE_OVERFLOW_P (block_factor)
+ || tree_to_shwi (block_factor) > UPC_MAX_BLOCK_SIZE)
+ {
+ error_at (loc, "the maximum UPC block size in this implementation "
+ "is %ld", (long int) UPC_MAX_BLOCK_SIZE);
+ return NULL_TREE;
+ }
+
+ if (tree_int_cst_compare (block_factor, integer_zero_node) < 0)
+ {
+ error_at (loc, "UPC layout qualifier must be a "
+ "non-negative integral constant");
+ return NULL_TREE;
+ }
+
+ /* Make sure that the UPC blocking factors are of type
+ 'size_t' so that a compare of the tree pointers
+ is sufficient to match block sizes. */
+ if (block_factor)
+ block_factor = convert (sizetype, block_factor);
+
+ if ((block_factor && elem_block_factor)
+ && block_factor != elem_block_factor)
+ {
+ error_at (loc, "UPC layout qualifier is incompatible with "
+ "the referenced type");
+ return elem_block_factor;
+ }
+
+ /* A block size of [1] is the same as specifying no
+ block size at all. */
+ if (block_factor == size_one_node)
+ block_factor = NULL_TREE;
+
+ return block_factor;
+}
+
+/* If DECL is a UPC shared variable, make sure that it ends up
+ in the executable file. */
+
+void
+upc_check_decl (tree decl)
+{
+ if (decl
+ && TREE_CODE (decl) == VAR_DECL
+ && TREE_TYPE (decl) && SHARED_TYPE_P (TREE_TYPE (decl)))
+ {
+ TREE_USED (decl) = 1;
+ TREE_ADDRESSABLE (decl) = 1;
+ TREE_STATIC (decl) = 1;
+ /* Work-around a problem where the front-end doesn't
+ properly process the used flags set above, on
+ static variables when flag_unit_at_a_time isn't set. */
+ if ((TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
+ && !flag_unit_at_a_time
+ && !lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
+ {
+ tree used_id = get_identifier ("used");
+ tree used_attrib = tree_cons (used_id, NULL_TREE, NULL_TREE);
+ decl_attributes (&decl, used_attrib, 0);
+ }
+ }
+}
+
+/* Return TRUE if TYPE contains any references to UPC pointers-to-shared. */
+
+int
+upc_contains_pts_refs_p (tree type)
+{
+ switch (TREE_CODE (type))
+ {
+ case POINTER_TYPE:
+ case REFERENCE_TYPE:
+ return SHARED_TYPE_P (TREE_TYPE (type));
+
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ case QUAL_UNION_TYPE:
+ {
+ tree fields;
+ /* For a type that has fields, see if the fields have pointers. */
+ for (fields = TYPE_FIELDS (type); fields;
+ fields = TREE_CHAIN (fields))
+ if (TREE_CODE (fields) == FIELD_DECL
+ && upc_contains_pts_refs_p (TREE_TYPE (fields)))
+ return 1;
+ return 0;
+ }
+
+ case ARRAY_TYPE:
+ /* An array type contains pointers if its element type does. */
+ return upc_contains_pts_refs_p (TREE_TYPE (type));
+
+ default:
+ return 0;
+ }
+}
+
+/* Assign DECL to a specific linker section, if required.
+ UPC shared variables are given their own link section on
+ most target platforms, and if compiling in "pthreads mode"
+ regular local file scope variables are made thread local. */
+
+void
+upc_set_decl_section (tree decl)
+{
+ if (TREE_SHARED (decl)
+ && targetm.upc.shared_section_name ())
+ {
+ /* UPC shared variables are placed in their own shared section */
+ set_decl_section_name (decl, targetm.upc.shared_section_name ());
+ }
+ else if (flag_upc_pthreads
+ && ((TREE_STATIC (decl)
+ && (DECL_SECTION_NAME (decl) == NULL))
+ || DECL_EXTERNAL (decl)))
+ {
+ /* If we're compiling with -fupc-pthreads-model-tls asserted
+ and this is a regular "C" static scoped object which
+ is either not declared in a system header file,
+ or is being compiled in a UPC setting,
+ then assign the object to the thread local storage
+ (TLS) section. */
+ if (flag_upc && (c_header_level <= 0))
+ {
+ if (upc_pthreads_model == upc_pthreads_tls_model)
+ {
+ set_decl_tls_model (decl, decl_default_tls_model (decl));
+ DECL_COMMON (decl) = 0;
+ }
+ else
+ /* Only the TLS model is currently implemented. */
+ gcc_unreachable ();
+ }
+ }
+}
+
+/* Return an external reference to an integer variable maintained
+ by the compiler and runtime to track the dynamic nesting
+ of 'upc_forall' statements. The variable's name is given by
+ UPC_FORALL_DEPTH_NAME. */
+
+tree
+upc_rts_forall_depth_var (void)
+{
+ tree upc_forall_depth = lookup_name (
+ get_identifier (UPC_FORALL_DEPTH_NAME));
+ if (upc_forall_depth == NULL_TREE)
+ internal_error ("the UPC runtime variable '" UPC_FORALL_DEPTH_NAME "' "
+ "cannot be located; this variable should be defined "
+ "in a compiler-supplied include file");
+ assemble_external (upc_forall_depth);
+ TREE_USED (upc_forall_depth) = 1;
+ return upc_forall_depth;
+}
+
+/* Diagnose instances of UPC statements that were
+ defined in very early UPC language specifications and that
+ have since been deprecated. */
+
+int
+upc_diagnose_deprecated_stmt (location_t loc, tree id)
+{
+ const char *name = IDENTIFIER_POINTER (id);
+ struct deprecated_stmt_entry
+ {
+ const char *deprecated_id;
+ const char *correct_id;
+ };
+ static const struct deprecated_stmt_entry deprecated_stmts[] =
+ { {"barrier", "upc_barrier"},
+ {"barrier_wait", "upc_wait"},
+ {"barrier_notify", "upc_notify"},
+ {"fence", "upc_fence"},
+ {"forall", "upc_forall"} };
+ const int n_deprecated_stmts = sizeof (deprecated_stmts)
+ / sizeof (struct deprecated_stmt_entry);
+ int i;
+ for (i = 0; i < n_deprecated_stmts; ++i)
+ {
+ if (!strcmp (name, deprecated_stmts[i].deprecated_id))
+ {
+ error_at (loc, "%qs was supported in version 1.0 of the UPC "
+ "specification, it has been deprecated, "
+ "use %qs instead",
+ name, deprecated_stmts[i].correct_id);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* Expand the pre/post increment/decrement of UPC pointer-to-shared
+ into its equivalent expression tree. */
+
+tree
+upc_pts_increment (location_t location ATTRIBUTE_UNUSED,
+ enum tree_code code, tree arg)
+{
+ /* The result type is a pointer of the same type as the argument
+ type after dropping the shared qualifier (for PTS's that happen
+ to live in shared memory). */
+ tree stable_arg = stabilize_reference (arg);
+ tree val = (code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR)
+ ? stable_arg : save_expr (stable_arg);
+ enum tree_code incr_op = (code == PREINCREMENT_EXPR
+ || code == POSTINCREMENT_EXPR)
+ ? PLUS_EXPR : MINUS_EXPR;
+ tree incr_val, result;
+ incr_val = upc_pts_int_sum (location, incr_op, val, integer_one_node);
+ TREE_SIDE_EFFECTS (incr_val) = 1;
+ result = build_modify_expr (location, arg, NULL_TREE, NOP_EXPR,
+ location, incr_val, NULL_TREE);
+ if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR)
+ result = build2 (COMPOUND_EXPR, TREE_TYPE (incr_val), result, val);
+ return result;
+}
+
+/* Return an expression that calculates the sum of a UPC
+ pointer-to-shared value and an integer value. The sum
+ operator may be PLUS_EXPR or MINUS_EXPR. The result is a
+ POINTER_PLUS_EXPR with a properly scaled integer operand.
+ This POINTER_PLUS_EXPR will be translated by the UPC lowering
+ pass into the sequence of operations dictated both by the
+ properties of the UPC pointer-to-shared type, and the UPC
+ pointer-to-shared representation. */
+
+tree
+upc_pts_int_sum (location_t loc,
+ enum tree_code resultcode, tree ptrop, tree intop)
+{
+
+ /* The result type is a pointer of the same type that is being added,
+ after dropping the UPC shared qualifier. For example, this would
+ apply to UPC pointers-to-shared that happen to live in shared memory;
+ the result of the expression must not be UPC shared qualified. */
+
+ const tree ttype = TREE_TYPE (ptrop);
+ const int shared_quals =
+ (TYPE_QUAL_SHARED | TYPE_QUAL_STRICT | TYPE_QUAL_RELAXED);
+ const int quals_minus_shared = TYPE_QUALS (ttype) & ~shared_quals;
+ const tree result_type = c_build_qualified_type (ttype, quals_minus_shared);
+ const tree result_targ_type = TREE_TYPE (result_type);
+ const tree base_type = strip_array_types (result_targ_type);
+ tree result;
+
+ if (TREE_CODE (result_targ_type) == VOID_TYPE)
+ error_at (loc, "UPC does not allow a pointer of type %<shared void *%> "
+ "to be used in arithmetic");
+
+ /* We have a pointer to a UPC shared object. For pointers to
+ simple objects, just build a "resultcode" tree with the intop and
+ let upc_genericize() handle the arithmetic correctly. For pointers to
+ arrays, compute the number of elements represented by the intop
+ and build a "resultcode" tree with the ptrop and that number. */
+
+ if (result_targ_type != base_type)
+ {
+ tree elt_cnt;
+ gcc_assert (TREE_CODE (result_targ_type) == ARRAY_TYPE);
+ if (TREE_CODE (TYPE_SIZE (result_targ_type)) == INTEGER_CST)
+ {
+ tree n_threads = convert (sizetype, upc_num_threads ());
+ int size = TREE_INT_CST_LOW (TYPE_SIZE (result_targ_type));
+ int elt_size = TREE_INT_CST_LOW (TYPE_SIZE (base_type));
+ elt_cnt = size_int (size / elt_size);
+ if (TYPE_HAS_THREADS_FACTOR (result_targ_type))
+ elt_cnt = size_binop (MULT_EXPR, n_threads, elt_cnt);
+ }
+ else
+ {
+ tree size = TYPE_SIZE (result_targ_type);
+ tree elt_size = TYPE_SIZE (base_type);
+ elt_cnt = build2 (EXACT_DIV_EXPR, sizetype, size, elt_size);
+ }
+ intop = convert (sizetype, intop);
+ intop = size_binop (MULT_EXPR, intop, elt_cnt);
+ }
+ gcc_assert (resultcode == PLUS_EXPR || resultcode == MINUS_EXPR);
+ if (resultcode == MINUS_EXPR)
+ intop = build1 (NEGATE_EXPR, TREE_TYPE (intop), intop);
+ intop = fold (intop);
+
+ /* POINTER_PLUS expects the operand to be sizetype, which
+ is potentially unsigned. This will have to be dealt
+ with later, when expanding the UPC pointer-to-shared arithmetic. */
+
+ intop = convert (sizetype, intop);
+ result = build2 (POINTER_PLUS_EXPR, result_type, ptrop, intop);
+
+ /* Although there may be some specific cases where the
+ addition of a constant integer to a UPC pointer-to-shared can
+ be calculated at compile-time, in the more general
+ cases the calculation must be made at runtime, so
+ we mark the resulting sum as non-constant. This will
+ avoid situations where the compiler attempts to convert
+ things like &A[14] where A is a shared array into a
+ compile-time constant. */
+
+ TREE_CONSTANT (result) = 0;
+ return result;
+}
+
+/* Return an expression that calculates the difference between
+ two UPC pointers-to-shared values. */
+
+tree
+upc_pts_diff (tree op0, tree op1)
+{
+ const tree target_type = TREE_TYPE (TREE_TYPE (op0));
+ tree result;
+
+ /* The two pointers must both point to shared objects. */
+
+ if ((SHARED_TYPE_P (target_type)
+ && !SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (op1))))
+ || (SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (op1)))
+ && !SHARED_TYPE_P (target_type)))
+ {
+ error ("attempt to take the difference of a UPC pointer-to-shared "
+ "and a local pointer");
+ return size_one_node;
+ }
+ result = build2 (MINUS_EXPR, ptrdiff_type_node, op0, op1);
+ return result;
+}
+
+/* Return TRUE if EXP is a null UPC pointer-to-shared value.
+ (Call the representation-specific hook routine to
+ perform the check.) */
+
+int
+upc_is_null_pts_p (tree exp)
+{
+ return upc_pts_is_null_p (exp);
+}
+
+/* Return TRUE if the type of EXP is a UPC pointer-to-shared type. */
+
+int
+upc_pts_is_valid_p (tree exp)
+{
+ tree type = TREE_TYPE (exp);
+ return (TREE_CODE (type) == POINTER_TYPE)
+ && SHARED_TYPE_P (TREE_TYPE (type));
+}
diff --git a/gcc/c/c-upc.h b/gcc/c/c-upc.h
new file mode 100644
index 00000000000..2cf52c0c9c8
--- /dev/null
+++ b/gcc/c/c-upc.h
@@ -0,0 +1,50 @@
+/* Definitions of UPC front-end entry points used for C and C++.
+ that are called from within the C front end.
+ respectively.
+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.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 2, 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 COPYING. If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
+
+#ifndef GCC_C_UPC_H
+#define GCC_C_UPC_H
+
+/* UPC-related functions called by the C front-end. */
+
+extern int count_upc_threads_refs (tree);
+extern int is_multiple_of_upc_threads (tree);
+extern void set_upc_threads_refs_to_one (tree *);
+extern tree upc_build_pointer_type (tree);
+extern tree upc_blocksizeof (location_t, tree);
+extern void upc_check_decl (tree);
+extern int upc_contains_pts_refs_p (tree);
+extern int upc_diagnose_deprecated_stmt (location_t, tree);
+extern tree upc_elemsizeof (location_t, tree);
+extern tree upc_grok_layout_qualifier (location_t, enum tree_code,
+ tree, tree, tree);
+extern int upc_is_null_pts_p (tree);
+extern tree upc_localsizeof (location_t, tree);
+extern tree upc_pts_diff (tree, tree);
+extern tree upc_pts_increment (location_t, enum tree_code, tree);
+extern tree upc_pts_int_sum (location_t, enum tree_code, tree, tree);
+extern int upc_pts_is_valid_p (tree);
+extern tree upc_rts_forall_depth_var (void);
+extern void upc_set_decl_section (tree);
+
+#endif /* ! GCC_C_UPC_H */
diff --git a/gcc/c/config-lang.in b/gcc/c/config-lang.in
index b9cdc8e66ce..43fd967e3eb 100644
--- a/gcc/c/config-lang.in
+++ b/gcc/c/config-lang.in
@@ -29,4 +29,4 @@ compilers="cc1\$(exeext)"
target_libs=
-gtfiles="\$(srcdir)/c/c-lang.c \$(srcdir)/c/c-tree.h \$(srcdir)/c/c-decl.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/c/c-objc-common.c \$(srcdir)/c/c-parser.c \$(srcdir)/c/c-lang.h"
+gtfiles="\$(srcdir)/c/c-lang.c \$(srcdir)/c/c-tree.h \$(srcdir)/c/c-decl.c \$(srcdir)/c/c-upc-lang.c \$(srcdir)/c/c-upc-low.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/c/c-objc-common.c \$(srcdir)/c/c-parser.c \$(srcdir)/c/c-lang.h"
diff --git a/gcc/c/gupcspec.c b/gcc/c/gupcspec.c
new file mode 100644
index 00000000000..e11ebe163f7
--- /dev/null
+++ b/gcc/c/gupcspec.c
@@ -0,0 +1,307 @@
+/* gupcspec.c: the UPC compiler driver program
+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "gcc.h"
+#include "opts.h"
+
+#include "tm.h"
+
+
+/* GUPC driver - derived from fortran/gfortranspec.c. */
+
+/* The original argument list and related info is copied here. */
+static unsigned int gupc_xargc;
+static const struct cl_decoded_option *gupc_x_decoded_options;
+static void append_arg (const struct cl_decoded_option *);
+
+/* The new argument list will be built here. */
+static unsigned int gupc_newargc;
+static struct cl_decoded_option *gupc_new_decoded_options;
+
+static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
+static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
+
+/* By default the linker is always invoked. */
+static int invoke_linker = 1;
+
+static int match_suffix (const char *s, const char *suffix);
+
+#define END_ARGS ((char *) 0)
+
+/* Return true if the strings S1 and S2 are either both NULL
+ * or both the same string. */
+
+static bool
+strings_same (const char *s1, const char *s2)
+{
+ return s1 == s2 || (s1 != NULL && s2 != NULL && strcmp (s1, s2) == 0);
+}
+
+/* Return whether decoded option structures OPT1 and OPT2 are the
+ same. */
+
+static bool
+options_same (const struct cl_decoded_option *opt1,
+ const struct cl_decoded_option *opt2)
+{
+ return (opt1->opt_index == opt2->opt_index
+ && strings_same (opt1->arg, opt2->arg)
+ && strings_same (opt1->orig_option_with_args_text,
+ opt2->orig_option_with_args_text)
+ && strings_same (opt1->canonical_option[0],
+ opt2->canonical_option[0])
+ && strings_same (opt1->canonical_option[1],
+ opt2->canonical_option[1])
+ && strings_same (opt1->canonical_option[2],
+ opt2->canonical_option[2])
+ && strings_same (opt1->canonical_option[3],
+ opt2->canonical_option[3])
+ && (opt1->canonical_option_num_elements
+ == opt2->canonical_option_num_elements)
+ && opt1->value == opt2->value && opt1->errors == opt2->errors);
+}
+
+/* Append another argument to the list being built. As long as it is
+ identical to the corresponding arg in the original list, just increment
+ the new arg count. Otherwise allocate a new list, etc. */
+
+static void
+append_arg (const struct cl_decoded_option *arg)
+{
+ static unsigned int newargsize;
+
+ if (gupc_new_decoded_options == gupc_x_decoded_options
+ && gupc_newargc < gupc_xargc
+ && options_same (arg, &gupc_x_decoded_options[gupc_newargc]))
+ {
+ ++gupc_newargc;
+ return; /* Nothing new here. */
+ }
+
+ if (gupc_new_decoded_options == gupc_x_decoded_options)
+ { /* Make new arglist. */
+ unsigned int i;
+
+ newargsize = (gupc_xargc << 2) + 20; /* This should handle all. */
+ gupc_new_decoded_options =
+ XNEWVEC (struct cl_decoded_option, newargsize);
+
+ /* Copy what has been done so far. */
+ for (i = 0; i < gupc_newargc; ++i)
+ gupc_new_decoded_options[i] = gupc_x_decoded_options[i];
+ }
+
+ if (gupc_newargc == newargsize)
+ fatal_error (input_location, "overflowed output arg list for %qs",
+ arg->orig_option_with_args_text);
+
+ gupc_new_decoded_options[gupc_newargc++] = *arg;
+}
+
+/* Append an option described by OPT_INDEX, ARG and VALUE to the list
+ being built. */
+static void
+append_option (size_t opt_index, const char *arg, int value)
+{
+ struct cl_decoded_option decoded;
+
+ generate_option (opt_index, arg, value, CL_DRIVER, &decoded);
+ append_arg (&decoded);
+}
+
+/* Return TRUE if SUFFIX is found at the end of the string S. */
+
+static int
+match_suffix (const char *s, const char *suffix)
+{
+ int slen = strlen (s);
+ int xlen = strlen (suffix);
+ const char *start = (xlen <= slen) ? s + slen - xlen : 0;
+ return start && !strncmp (start, suffix, xlen);
+}
+
+/* The UPC-specific aspects of the 'gupc' compiler driver. */
+
+void
+lang_specific_driver (struct cl_decoded_option **in_decoded_options,
+ unsigned int *in_decoded_options_count,
+ int *in_added_libraries ATTRIBUTE_UNUSED)
+{
+ struct cl_decoded_option *decoded_options = *in_decoded_options;
+ unsigned int i;
+ int is_x_in_effect = 0;
+ int is_x_upc_in_effect = 0;
+ int verbose = 0;
+ int n_infiles = 0;
+ int n_outfiles = 0;
+ int pre_processed = 0;
+
+ gupc_xargc = *in_decoded_options_count;
+ gupc_x_decoded_options = decoded_options;
+ gupc_newargc = 0;
+ gupc_new_decoded_options = decoded_options;
+
+ /* First pass through the argument list. */
+
+ /* Check to see if any switches are asserted that inhibit linking
+ and record the presence of other switches that may require
+ special handling. */
+ for (i = 1; i < gupc_xargc; ++i)
+ {
+ if (decoded_options[i].errors & CL_ERR_MISSING_ARG)
+ continue;
+
+ switch (decoded_options[i].opt_index)
+ {
+
+ case OPT_SPECIAL_input_file:
+ ++n_infiles;
+ continue;
+
+ case OPT_nostdlib:
+ case OPT_nodefaultlibs:
+ case OPT_c:
+ case OPT_S:
+ case OPT_fsyntax_only:
+ case OPT_E:
+ /* These options disable linking entirely or linking of the
+ standard libraries. */
+ invoke_linker = 0;
+ break;
+
+ case OPT_fpreprocessed:
+ pre_processed = 1;
+ break;
+
+ case OPT_l:
+ ++n_infiles;
+ break;
+
+ case OPT_o:
+ ++n_outfiles;
+ break;
+
+ case OPT_v:
+ verbose = 1;
+ break;
+
+ case OPT__version:
+ /* Optional GUPC version string. Let GCC handle it for now. */
+ break;
+
+ case OPT__help:
+ /* Let gcc.c handle this, as it has a really
+ cool facility for handling --help and --verbose --help. */
+ return;
+
+ default:
+ break;
+ }
+ }
+
+ /* Create the new argument list. */
+
+ /* Start with the compiler itself. */
+ append_arg (&decoded_options[0]);
+
+ /* Always assert -fupc. */
+ append_option (OPT_fupc, NULL, 1);
+
+ /* If there are no input files, no need for the library. */
+ if (n_infiles == 0)
+ invoke_linker = 0;
+
+ /* Copy in the arguments as passed to 'upc' */
+ is_x_in_effect = 0;
+ is_x_upc_in_effect = 0;
+ for (i = 1; i < gupc_xargc; ++i)
+ {
+ /* Skip -fupc, we asserted it above. */
+ if (decoded_options[i].opt_index == OPT_fupc)
+ continue;
+
+ /* Check for "-x [c,upc,..]". */
+ if (decoded_options[i].opt_index == OPT_x)
+ {
+ /* Go to default if "none" found. */
+ if (!strcmp (decoded_options[i].arg, "none"))
+ {
+ is_x_in_effect = 0;
+ is_x_upc_in_effect = 0;
+ }
+ else
+ is_x_in_effect = 1;
+ }
+
+ /* By default, driver accepts C files as UPC files. Unless there
+ is "-x" option in affect. */
+ if (decoded_options[i].opt_index == OPT_SPECIAL_input_file)
+ {
+ const int is_c_file = match_suffix (decoded_options[i].arg, ".c")
+ || match_suffix (decoded_options[i].arg, ".h")
+ || (pre_processed && match_suffix (decoded_options[i].arg, ".i"));
+ if (is_c_file)
+ {
+ if ( !(is_x_in_effect || is_x_upc_in_effect))
+ {
+ append_option (OPT_x, "upc", 1);
+ is_x_upc_in_effect = 1;
+ }
+ append_arg (&decoded_options[i]);
+ continue;
+ }
+ else
+ {
+ if (is_x_upc_in_effect)
+ {
+ is_x_upc_in_effect = 0;
+ append_option (OPT_x, "none", 1);
+ }
+ }
+ }
+ append_arg (&decoded_options[i]);
+ }
+
+ if (verbose)
+ {
+ fprintf (stderr, "Driving:");
+ for (i = 0; i < gupc_newargc; i++)
+ fprintf (stderr, " %s",
+ gupc_new_decoded_options[i].orig_option_with_args_text);
+ fprintf (stderr, "\n");
+ }
+
+ *in_decoded_options_count = gupc_newargc;
+ *in_decoded_options = gupc_new_decoded_options;
+}
+
+/* Called before linking. Returns 0 on success and -1 on failure. */
+int
+lang_specific_pre_link (void)
+{
+ return 0;
+}
+
+/* Number of extra output files that lang_specific_pre_link may generate. */
+int lang_specific_extra_outfiles = 0; /* Not used for GUPC. */
diff --git a/gcc/config.in b/gcc/config.in
index 86bd5b0dd53..042d70c9b11 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1828,6 +1828,12 @@
#endif
+/* Define to 1 if UPC link script is supported. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_UPC_LINK_SCRIPT
+#endif
+
+
/* Define if valgrind's valgrind/memcheck.h header is installed. */
#ifndef USED_FOR_TARGET
#undef HAVE_VALGRIND_MEMCHECK_H
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 0277cf2238b..6583266cf4e 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -176,17 +176,20 @@ extern GTY(()) int darwin_ms_struct;
%{e*} %{r} \
%{o*}%{!o:-o a.out} \
%{!nostdlib:%{!nostartfiles:%S}} \
+ %{!nostdlib:%{!nostartfiles:%{fupc:%:include(upc-crtbegin.spec)%(upc_crtbegin)}}}\
%{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): \
%{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
%{fcilkplus:%:include(libcilkrts.spec)%(link_cilkrts)} \
%{fgnu-tm: \
%{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
+ %{fupc:%:include(libgupc.spec)%(link_upc)} \
%{!nostdlib:%{!nodefaultlibs:\
%{%:sanitize(address): -lasan } \
%{%:sanitize(undefined): -lubsan } \
%(link_ssp) %(link_gcc_c_sequence)\
}}\
+ %{!nostdlib:%{!nostartfiles:%{fupc:%:include(upc-crtend.spec)%(upc_crtend)}}}\
%{!nostdlib:%{!nostartfiles:%E}} %{T*} %{F*} }}}}}}}"
#define DSYMUTIL "\ndsymutil"
@@ -924,6 +927,11 @@ extern void darwin_driver_init (unsigned int *,struct cl_decoded_option **);
#undef SUPPORTS_INIT_PRIORITY
#define SUPPORTS_INIT_PRIORITY 0
+/* UPC section names */
+#define UPC_SHARED_SECTION_NAME "__DATA,upc_shared"
+#define UPC_PGM_INFO_SECTION_NAME "__DATA,upc_pgm_info"
+#define UPC_INIT_ARRAY_SECTION_NAME "__DATA,upc_init_array"
+
/* When building cross-compilers (and native crosses) we shall default to
providing an osx-version-min of this unless overridden by the User.
10.5 is the only version that fully supports all our archs so that's the
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 861a029a317..ff87333b07d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -8018,6 +8018,15 @@ classify_argument (machine_mode mode, const_tree type,
&& targetm.calls.must_pass_in_stack (mode, type))
return 0;
+ /* Special case check for pointer to shared, on 64-bit target. */
+ if (TARGET_64BIT && mode == TImode
+ && type && TREE_CODE (type) == POINTER_TYPE
+ && SHARED_TYPE_P (TREE_TYPE (type)))
+ {
+ classes[0] = classes[1] = X86_64_INTEGER_CLASS;
+ return 2;
+ }
+
if (type && AGGREGATE_TYPE_P (type))
{
int i;
@@ -9611,7 +9620,8 @@ function_value_64 (machine_mode orig_mode, machine_mode mode,
return gen_rtx_REG (mode, regno);
}
- else if (POINTER_TYPE_P (valtype))
+ else if (POINTER_TYPE_P (valtype)
+ && !SHARED_TYPE_P (TREE_TYPE (valtype)))
{
/* Pointers are always returned in word_mode. */
mode = word_mode;
@@ -9755,6 +9765,11 @@ ix86_promote_function_mode (const_tree type, machine_mode mode,
{
if (type != NULL_TREE && POINTER_TYPE_P (type))
{
+ if (SHARED_TYPE_P (TREE_TYPE (type)))
+ {
+ *punsignedp = 1;
+ return TYPE_MODE (upc_pts_rep_type_node);
+ }
*punsignedp = POINTERS_EXTEND_UNSIGNED;
return word_mode;
}
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 000946735b3..9d048cc4074 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -10203,12 +10203,21 @@ rs6000_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
NULL, NULL))
return false;
+ /* TRUE if TYPE is a UPC pointer-to-shared type
+ and its underlying representation is an aggregate. */
+ bool upc_struct_pts_p = (POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type)))
+ && AGGREGATE_TYPE_P (upc_pts_rep_type_node);
+ /* If TYPE is a UPC struct PTS type, handle it as an aggregate type. */
+ bool aggregate_p = AGGREGATE_TYPE_P (type)
+ || upc_struct_pts_p;
+
/* The ELFv2 ABI returns aggregates up to 16B in registers */
- if (DEFAULT_ABI == ABI_ELFv2 && AGGREGATE_TYPE_P (type)
+ if (DEFAULT_ABI == ABI_ELFv2 && aggregate_p
&& (unsigned HOST_WIDE_INT) int_size_in_bytes (type) <= 16)
return false;
- if (AGGREGATE_TYPE_P (type)
+ if (aggregate_p
&& (aix_struct_return
|| (unsigned HOST_WIDE_INT) int_size_in_bytes (type) > 8))
return true;
@@ -10564,6 +10573,18 @@ rs6000_function_arg_boundary (machine_mode mode, const_tree type)
|| DEFAULT_ABI == ABI_ELFv2)
&& type && TYPE_ALIGN (type) > 64)
{
+
+ /* If the underlying UPC pointer-to-shared representation
+ is an aggregate, and TYPE is either a pointer-to-shared
+ or the PTS representation type, then return 16-byte
+ alignment and skip the ABI warning. */
+ if (upc_pts_rep_type_node
+ && AGGREGATE_TYPE_P (upc_pts_rep_type_node)
+ && ((POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type)))
+ || (TYPE_MAIN_VARIANT (type) == upc_pts_rep_type_node)))
+ return 128;
+
/* "Aggregate" means any AGGREGATE_TYPE except for single-element
or homogeneous float/vector aggregates here. We already handled
vector aggregates above, but still need to check for float here. */
@@ -11836,7 +11857,16 @@ rs6000_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
return 1;
}
- if (DEFAULT_ABI == ABI_V4 && AGGREGATE_TYPE_P (type))
+ /* TRUE if TYPE is a UPC pointer-to-shared type
+ and its underlying representation is an aggregate. */
+ bool upc_struct_pts_p = (POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type)))
+ && AGGREGATE_TYPE_P (upc_pts_rep_type_node);
+ /* If TYPE is a UPC struct PTS type, handle it as an aggregate type. */
+ bool aggregate_p = AGGREGATE_TYPE_P (type)
+ || upc_struct_pts_p;
+
+ if (DEFAULT_ABI == ABI_V4 && aggregate_p)
{
if (TARGET_DEBUG_ARG)
fprintf (stderr, "function_arg_pass_by_reference: V4 aggregate\n");
@@ -35293,7 +35323,8 @@ rs6000_function_value (const_tree valtype,
if ((INTEGRAL_TYPE_P (valtype)
&& GET_MODE_BITSIZE (mode) < (TARGET_32BIT ? 32 : 64))
- || POINTER_TYPE_P (valtype))
+ || (POINTER_TYPE_P (valtype)
+ && !SHARED_TYPE_P (TREE_TYPE (valtype))))
mode = TARGET_32BIT ? SImode : DImode;
if (DECIMAL_FLOAT_MODE_P (mode) && TARGET_HARD_FLOAT && TARGET_FPRS)
diff --git a/gcc/configure b/gcc/configure
index fc83cc8ec6e..f69aa90e8a9 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -736,6 +736,7 @@ USE_NLS
extra_opt_files
extra_modes_file
NATIVE_SYSTEM_HEADER_DIR
+PERL
objext
manext
LIBICONV_DEP
@@ -915,6 +916,7 @@ with_multilib_list
enable_rpath
with_libiconv_prefix
enable_sjlj_exceptions
+enable_upc_link_script
enable_secureplt
enable_leading_mingw64_underscores
enable_cld
@@ -1626,6 +1628,11 @@ Optional Features:
--disable-rpath do not hardcode runtime library paths
--enable-sjlj-exceptions
arrange to use setjmp/longjmp exception handling
+ --enable-upc-link-script
+ enable UPC's use of a custom linker script; this
+ will define the UPC shared section as a no load
+ section on targets where this feature is supported
+ (requires GNU LD)
--enable-secureplt enable -msecure-plt by default for PowerPC
--enable-leading-mingw64-underscores
enable leading underscores on 64 bit mingw targets
@@ -11608,6 +11615,116 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+#
+# UPC linker script check.
+# (Placed here because depends upon the previous checks for GNU ld.)
+#
+# Check whether --enable-upc-link-script was given.
+if test "${enable_upc_link_script+set}" = set; then :
+ enableval=$enable_upc_link_script;
+ case $enableval in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-link-script accepts only yes or no." "$LINENO" 5
+ ;;
+ esac
+
+else
+
+ # Assume that by default UPC link scripts aren't supported.
+ enable_upc_link_script=no
+ if test -n "$gnu_ld" && test x$host = x$target; then
+ case "$target" in
+ # disable linker script for Apple Mac OS X
+ *-*-darwin*) ;;
+ *)
+ # Fedora Linux reports as:
+ # GNU ld version 2.20.51.0.7-8.fc14 20100318
+ # SuSE (IA64) Linux reports as:
+ # GNU ld (GNU Binutils; SUSE Linux Enterprise 11)
+ # 2.20.0.20100122-0.7.9
+ ld_version=`${LD} --version | \
+ sed -ne '
+ /^GNU ld version \([0-9][0-9]*\.[0-9][0-9]*\)/ \
+ {s/^GNU ld version \([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p; q}
+ /^GNU ld ([^)]*) \([0-9][0-9]*\.[0-9][0-9]*\)/ \
+ {s/^GNU ld ([^)]*) \([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p; q}'`
+ # Get the major/minor version number.
+ ld_major=`echo $ld_version | sed -e 's/\..*//'`
+ ld_minor=`echo $ld_version | sed -e 's/.*\.//'`
+ # Only GNU ld versions 2.18 and up are supported.
+ if (test $ld_major -eq 2 && test $ld_minor -ge 18) \
+ || test $ld_major -gt 2; then
+ # Tentatively enable the UPC link script.
+ enable_upc_link_script=yes
+ fi
+ ;;
+ esac
+ fi
+
+fi
+
+# Perl is required for checking the linker script.
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_PERL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PERL"; then
+ ac_cv_prog_PERL="$PERL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_PERL="perl"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PERL=$ac_cv_prog_PERL
+if test -n "$PERL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test "$enable_upc_link_script" = yes; then
+ libgupc_srcdir=`cd ${srcdir}/../libgupc 2>/dev/null && pwd`
+ gen_ld_script="${libgupc_srcdir}/gen-upc-ld-script.pl"
+ if ! (test -f "${gen_ld_script}" \
+ && test -n "$PERL" \
+ && ${LD} --verbose | ${PERL} "${gen_ld_script}" >/dev/null 2>&1); then
+ # if gen-upc-ld-script did not accept the output of the linker
+ # then disable UPC link script support.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot parse 'ld' output. Disabling UPC link scripts." >&5
+$as_echo "$as_me: WARNING: Cannot parse 'ld' output. Disabling UPC link scripts." >&2;}
+ enable_upc_link_script=no
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC link script support" >&5
+$as_echo_n "checking for UPC link script support... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_link_script" >&5
+$as_echo "$enable_upc_link_script" >&6; }
+if test "$enable_upc_link_script" = yes; then
+
+$as_echo "#define HAVE_UPC_LINK_SCRIPT 1" >>confdefs.h
+
+fi
+
count=a
for f in $host_xm_file; do
count=${count}x
@@ -18453,7 +18570,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18456 "configure"
+#line 18573 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18559,7 +18676,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18562 "configure"
+#line 18679 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index dc22d3ce93c..0df24af5b87 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1514,6 +1514,78 @@ AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.])
gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi`
AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.])
+#
+# UPC linker script check.
+# (Placed here because depends upon the previous checks for GNU ld.)
+#
+AC_ARG_ENABLE(upc-link-script,
+AS_HELP_STRING(
+ [--enable-upc-link-script],
+ [enable UPC's use of a custom linker script;
+ this will define the UPC shared section as a no load section on
+ targets where this feature is supported (requires GNU LD)]),
+[
+ case $enableval in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-link-script accepts only yes or no.])
+ ;;
+ esac
+],
+[
+ # Assume that by default UPC link scripts aren't supported.
+ enable_upc_link_script=no
+ if test -n "$gnu_ld" && test x$host = x$target; then
+ case "$target" in
+ # disable linker script for Apple Mac OS X
+ *-*-darwin*) ;;
+ *)
+ # Fedora Linux reports as:
+ # GNU ld version 2.20.51.0.7-8.fc14 20100318
+ # SuSE (IA64) Linux reports as:
+ # GNU ld (GNU Binutils; SUSE Linux Enterprise 11)
+ # 2.20.0.20100122-0.7.9
+changequote(,)dnl
+ ld_version=`${LD} --version | \
+ sed -ne '
+ /^GNU ld version \([0-9][0-9]*\.[0-9][0-9]*\)/ \
+ {s/^GNU ld version \([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p; q}
+ /^GNU ld ([^)]*) \([0-9][0-9]*\.[0-9][0-9]*\)/ \
+ {s/^GNU ld ([^)]*) \([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p; q}'`
+changequote([,])dnl
+ # Get the major/minor version number.
+ ld_major=`echo $ld_version | sed -e 's/\..*//'`
+ ld_minor=`echo $ld_version | sed -e 's/.*\.//'`
+ # Only GNU ld versions 2.18 and up are supported.
+ if (test $ld_major -eq 2 && test $ld_minor -ge 18) \
+ || test $ld_major -gt 2; then
+ # Tentatively enable the UPC link script.
+ enable_upc_link_script=yes
+ fi
+ ;;
+ esac
+ fi
+])
+# Perl is required for checking the linker script.
+AC_CHECK_PROG(PERL, perl, perl)
+if test "$enable_upc_link_script" = yes; then
+ libgupc_srcdir=`cd ${srcdir}/../libgupc 2>/dev/null && pwd`
+ gen_ld_script="${libgupc_srcdir}/gen-upc-ld-script.pl"
+ if ! (test -f "${gen_ld_script}" \
+ && test -n "$PERL" \
+ && ${LD} --verbose | ${PERL} "${gen_ld_script}" >/dev/null 2>&1); then
+ # if gen-upc-ld-script did not accept the output of the linker
+ # then disable UPC link script support.
+ AC_MSG_WARN([Cannot parse 'ld' output. Disabling UPC link scripts.])
+ enable_upc_link_script=no
+ fi
+fi
+AC_MSG_CHECKING([for UPC link script support])
+AC_MSG_RESULT($enable_upc_link_script)
+if test "$enable_upc_link_script" = yes; then
+ AC_DEFINE(HAVE_UPC_LINK_SCRIPT, 1, [Define to 1 if UPC link script is supported.])
+fi
+
count=a
for f in $host_xm_file; do
count=${count}x
diff --git a/gcc/convert.c b/gcc/convert.c
index e6b4d295c4e..dbb8add6a9e 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -53,6 +53,14 @@ convert_to_pointer_1 (tree type, tree expr, bool fold_p)
if (TREE_TYPE (expr) == type)
return expr;
+ if (integer_zerop (expr) && POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type)))
+ {
+ expr = copy_node (upc_null_pts_node);
+ TREE_TYPE (expr) = build_unshared_type (type);
+ return expr;
+ }
+
switch (TREE_CODE (TREE_TYPE (expr)))
{
case POINTER_TYPE:
@@ -438,6 +446,16 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
return error_mark_node;
}
+ /* Can't optimize the conversion of UPC shared pointer difference. */
+ if (ex_form == MINUS_EXPR
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0)))
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 1)))
+ && SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (TREE_OPERAND (expr, 0))))
+ && SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (TREE_OPERAND (expr, 1)))))
+ {
+ return build1 (CONVERT_EXPR, type, expr);
+ }
+
if (ex_form == COMPOUND_EXPR)
{
tree t = convert_to_integer_1 (type, TREE_OPERAND (expr, 1), dofold);
@@ -582,6 +600,12 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
{
case POINTER_TYPE:
case REFERENCE_TYPE:
+ if (SHARED_TYPE_P (TREE_TYPE (intype)))
+ {
+ error ("invalid conversion from a UPC pointer-to-shared "
+ "to an integer");
+ expr = integer_zero_node;
+ }
if (integer_zerop (expr))
return build_int_cst (type, 0);
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index e69793e7f35..b1da04c7df7 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -179,6 +179,9 @@ init_reswords (void)
/* The Objective-C keywords are all context-dependent. */
mask |= D_OBJC;
+ /* UPC constructs are not supported in C++. */
+ mask |= D_UPC;
+
ridpointers = ggc_cleared_vec_alloc<tree> ((int) RID_MAX);
for (i = 0; i < num_c_common_reswords; i++)
{
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index df2981fd3f4..d6f7ff2adcb 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1002,7 +1002,9 @@ move (tree expr)
the C version of this function does not properly maintain canonical
types (which are not used in C). */
tree
-c_build_qualified_type (tree type, int type_quals, tree /* orig_qual_type */,
+c_build_qualified_type (tree type, int type_quals,
+ tree /* layout_qualifier */,
+ tree /* orig_qual_type */,
size_t /* orig_qual_indirect */)
{
return cp_build_qualified_type (type, type_quals);
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 3e18338c99a..2806ce63918 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1492,4 +1492,23 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
#endif
+/* UPC section names. */
+
+/* Name of section used to assign addresses to shared data items. */
+#ifndef UPC_SHARED_SECTION_NAME
+#define UPC_SHARED_SECTION_NAME "upc_shared"
+#endif
+
+/* Name of section used to hold info. describing how
+ a UPC source file was compiled. */
+#ifndef UPC_PGM_INFO_SECTION_NAME
+#define UPC_PGM_INFO_SECTION_NAME "upc_pgm_info"
+#endif
+
+/* Name of section that holds an array of addresses that points to
+ the UPC initialization routines. */
+#ifndef UPC_INIT_ARRAY_SECTION_NAME
+#define UPC_INIT_ARRAY_SECTION_NAME "upc_init_array"
+#endif
+
#endif /* ! GCC_DEFAULTS_H */
diff --git a/gcc/doc/gupc.texi b/gcc/doc/gupc.texi
new file mode 100644
index 00000000000..110add9b195
--- /dev/null
+++ b/gcc/doc/gupc.texi
@@ -0,0 +1,394 @@
+\input texinfo @c -*-texinfo-*-
+@setfilename gupc
+@settitle GNU project UPC compiler
+
+@c Merge the standard indexes into a single one.
+@syncodeindex fn cp
+@syncodeindex vr cp
+@syncodeindex ky cp
+@syncodeindex pg cp
+@syncodeindex tp cp
+
+@include gcc-common.texi
+
+@c Copyright (C) 2001-2016 Free Software Foundation, Inc.
+@c Contributed by Gary Funck <gary@intrepid.com>
+@c and Nenad Vukicevic <nenad@intrepid.com>.
+@c Based on original implementation
+@c by Jesse M. Draper <jdraper@super.org>
+@c and William W. Carlson <wwc@super.org>.
+
+@copying
+@c man begin COPYRIGHT
+Copyright @copyright{} 2001-2016 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being ``GNU General Public License'' and ``Funding
+Free Software'', the Front-Cover texts being (a) (see below), and with
+the Back-Cover Texts being (b) (see below). A copy of the license is
+included in the
+@c man end
+section entitled ``GNU Free Documentation License''.
+@ignore
+@c man begin COPYRIGHT
+man page gfdl(7).
+@c man end
+@end ignore
+@c man begin COPYRIGHT
+
+(a) The FSF's Front-Cover Text is:
+
+ A GNU Manual
+
+(b) The FSF's Back-Cover Text is:
+
+ You have freedom to copy and modify this GNU Manual, like GNU
+ software. Copies published by the Free Software Foundation raise
+ funds for GNU development.
+@c man end
+@end copying
+@c Set file name and title for the man page.
+
+@ifinfo
+@dircategory Software development
+@direntry
+* GNU UPC: (gupc). A GCC-based compiler for the UPC language
+@end direntry
+
+@insertcopying
+@end ifinfo
+
+@titlepage
+@title The GNU UPC Compiler
+@versionsubtitle
+@author Gary Funck and Nenad Vukicevic
+
+@page
+@vskip 0pt plus 1filll
+Published by the Free Software Foundation @*
+51 Franklin Street, Fifth Floor@*
+Boston, MA 02110-1301, USA@*
+@sp 1
+@insertcopying
+@end titlepage
+@contents
+@page
+
+@node Top
+@chapter @command{gupc}--- UPC compiler for parallel computers
+
+@command{gupc} provides a compilation and execution environment for
+programs written in the UPC (Unified Parallel C) language.
+
+@menu
+* GUPC Intro:: Introduction to gupc.
+* Threads:: Number of Execution Threads.
+* Invoking GUPC:: How to use gupc.
+* GUPC Options:: GUPC Options.
+* See also:: References.
+* Contributors:: GUPC Contributors.
+* Index:: Index.
+@end menu
+
+@node GUPC Intro
+@section Introduction to @command{gupc}
+@c man begin DESCRIPTION
+
+@command{gupc} is an extension to the GNU Compiler Collection from the
+Free Software Foundation. In addition to the options specified here,
+all of the normal options listed in the man pages for @command{gcc}
+are available.
+
+The @command{gupc} compiler is integrated with the @command{gcc} compiler.
+The @command{gupc} compiler processes input files through one or more of
+four stages: pre-processing, compilation, assembly, and linking.
+
+Suffixes of source file names indicate the language and kind of
+processing to be done:
+
+@table @gcctabopt
+@item @file{file}.upc
+UPC source; pre-process, compile, assemble
+
+@item @file{file}.h
+Pre-processor header file; not usually named on command line
+
+@item @file{file}.c
+Files will be compiled as UPC source, unless preceded by @option{-x c}
+
+@item @file{file}.i
+Pre-processed source code; compile, assemble
+
+@item @file{file}.s
+Assembler source files; assemble
+@end table
+
+Files with other suffixes are passed to the linker. Common cases include:
+
+@table @gcctabopt
+@item @file{file}.o
+Object file
+@item @file{file}.a
+Archive file
+@end table
+
+Linking is always the last stage unless you use one of the @option{-c},
+@option{-S}, or @option{-E} options to avoid linking. Compilation errors
+also stop the process, and the linker is not invoked. For the link stage,
+all @file{.o} files correspond to source files, and all @option{-l}
+options correspond to libraries. Named @file{.o} object files, @file{.a}
+archives, and any file names unrecognized by @command{gupc} are passed
+to the linker in command-line order.
+
+@node Threads
+@section Number of Threads
+
+Within a UPC program, the special symbol @var{THREADS} refers to the number
+of parallel execution threads. On each thread, the special symbol
+@var{MYTHREAD} refers to the thread number. The number of threads in a UPC
+application can be specified statically at compile-time or dynamically
+at execution time. Generally, the number of threads should not exceed
+the number of physical central processing units or cores.
+
+If the number of threads is specified statically at compile-time, the
+special symbol @var{THREADS} is a constant and can be used freely
+in any context where a constant is required by the C language
+specification (for example, in array dimensions in an array
+declaration). See the @option{-fupc-threads=N} compilation option.
+
+If the number of threads is specified dynamically at execution
+time, the special symbol @var{THREADS} is assigned at run-time,
+and @var{THREADS} can be used in array declarations only if the
+array is qualified as @code{shared} and only if one and only one of
+the shared array's dimensions is specified as an integral multiple
+of @var{THREADS}. See the @option{-fupc-threads=N} execution option.
+
+@c man end
+
+@node Invoking GUPC
+@section Invoking @command{gupc}
+
+@c man begin SYNOPSIS
+gupc @r{[}@var{options}@r{]} @file{files}
+@c man end
+
+@node GUPC Options
+@section @command{gupc} Options
+
+@c man begin OPTIONS
+@command{gupc} accepts the following UPC-specific options:
+
+@subsection Information Options
+@table @gcctabopt
+@item -v
+@cindex @option{-v}
+Print (on standard error output) the commands executed to run the stages
+of compilation. Also print the version number of the compiler driver
+program and of the preprocessor and the compiler proper.
+@end table
+
+@subsection Language Options
+
+@table @gcctabopt
+@item -x upc
+@cindex @option{-x}
+All source files ending in @file{.upc} or @file{.c} will
+be compiled by the @command{gupc} compiler. The @option{-x upc} option
+tells the compiler to process all of the following file names as
+UPC source code, ignoring the default language typically associated
+with filename extensions.
+
+@item -fupc-threads=N
+@cindex @option{-fupc-threads}
+Specify the number of threads at compile-time as @option{N}. See the
+Number of Threads section, above.
+
+@item -fupc-pthreads-model-tls
+@cindex @option{-fupc-pthreads-model-tls}
+Compile for the POSIX threads (pthreads) environment. Each UPC thread
+is directly mapped to one pthread.
+
+@item -fupc-inline-lib
+@cindex @option{-fupc-inline-lib}
+Inline UPC run-time library calls. This option is turned on by default
+when compiled with optimization and the @option{-fno-upc-inline-lib} option
+must be specified to turn it off. In general, inlining of run-time
+library calls produces larger code. Turn it off if more
+condensed code is required.
+
+@item -fupc-pre-include
+@cindex @option{-fupc-pre-include}
+Pre-include UPC runtime header files. This option is turned on by default.
+@end table
+
+@subsection Debugging Options
+
+@table @gcctabopt
+@item -g
+@cindex @option{-g}
+Produce symbolic debugging information
+
+@item -dwarf-2-upc
+@cindex @option{-dwarf-2-upc}
+Generate UPC-specific symbolic DWARF-2 debugging information. This
+debugging information is processed by UPC-aware debuggers including
+GDB-UPC, a variant of the GDB debugger, and the commercially available
+Totalview debugger.
+
+@item -fupc-debug
+@cindex @option{-fupc-debug}
+Generate calls to the UPC run-time library that include source filename
+and line number information that is used to print more informative
+error messages when errors are detected at run-time.
+@end table
+
+@subsection Instrumentation Options
+
+@table @gcctabopt
+@item -fupc-instrument
+@cindex @option{-fupc-instrument}
+Instrument UPC shared accesses and library calls using GASP tool
+support. This option implies @option{-fno-upc-inline-lib}.
+
+@item -fupc-instrument-functions
+@cindex @option{-fupc-instrument-functions}
+Instrument functions calls using GASP tool support. This option implies
+@option{-fupc-instrument} and @option{-fno-upc-inline-lib}.
+@end table
+
+@subsection Optimization Options
+
+@table @gcctabopt
+@item -O0, -O1, -O2, -O3
+Specify the optimization level. Nearly all GCC supported
+optimizations are performed.
+@end table
+
+@subsection Execution (Run-time) Options
+
+This section describes options that are specified on the command
+line when you invoke a UPC program. These options are recognized by
+the UPC run-time. Before calling the @code{main()} function of a UPC
+program, the UPC run-time removes all options that begin with the prefix
+@option{-fupc-} and that immediately follow the UPC program name on the
+command line.
+
+@file{UPC_program}
+@r{[}@option{number of threads}@r{]}
+@r{[}@option{heap size}@r{]}
+@r{[}@option{affinity options}@r{]}
+@r{[}@option{program arguments}@r{]}
+
+@table @gcctabopt
+@item -n N
+@cindex @option{-n}
+@itemx -fupc-threads=N
+@cindex @option{-fupc-threads=}
+Specifies, at run-time, the number of parallel execution threads
+as @option{N}. If the UPC program was not compiled with the
+@option{-fupc-threads=N} option, either the @option{-fupc-threads=N}
+or @option{-n N} command-line option is required when you invoke the
+UPC program. The deprecated form, @option{-fupc-threads-N} is also
+accepted. See the Number of Threads section, above.
+
+@item -fupc-heap=HEAPSIZE
+@cindex @option{-fupc-heap=}
+@itemx -heap HEAPSIZE
+@cindex @option{-heap}
+Specifies the size of the heap available to each thread
+as @option{HEAPSIZE}. A suffix of @option{K} indicates that
+@option{HEAPSIZE} is expressed in kilobytes (2^10 bytes). A suffix
+of @option{M} indicates that @option{HEAPSIZE} is expressed in
+megabytes (2^20 bytes). A suffix of @option{G} indicates that
+@option{HEAPSIZE} is expressed in gigabytes (2^30 bytes). If a
+suffix is not present, @option{HEAPSIZE} is expressed in bytes.
+The deprecated from, @option{-fupc-heap-HEAPSIZE} is also
+accepted.
+@end table
+
+The following options specify thread scheduling and NUMA policies:
+
+@table @gcctabopt
+@item -sched-policy @r{[}cpu|strict|node|auto@r{]}
+@cindex @option{-sched-policy}
+Specifies the scheduling policy for threads.
+
+@table @gcctabopt
+@item cpu
+specifies that threads are evenly scheduled over available CPUs.
+(A CPU is a processor with a single core or a core unit in a multicore
+processor.)
+@item strict
+is similar to cpu scheduling except that one to one mapping of
+threads and CPUs is required.
+@item node
+specifies that threads are scheduled on nodes if a NUMA-aware kernel
+is available.
+@item auto
+specifies that the UPC run-time should not manage scheduling of UPC threads.
+@end table
+
+@item -sched-cpu-avoid n1,n2,..
+@cindex @option{-sched-cpu-avoid}
+Specifies the availability of CPUs for UPC thread scheduling. The UPC
+run-time will not schedule any thread on the specified CPUs.
+
+@item -mem-policy @r{[}node,strict,auto@r{]}
+@cindex @option{-mem-policy}
+Specifies the memory allocation policy if a NUMA-aware kernel is available.
+
+@table @gcctabopt
+@item node
+allocates memory first from the node on which a thread is scheduled to run.
+@item strict
+allocates memory only from the node on which a thread is scheduled to run.
+@item auto
+lets the kernel decide the memory allocation policy.
+@end table
+@end table
+@c man end
+
+@node See also
+@section References
+@c man begin SEEALSO
+gcc(1), cpp(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1).
+
+
+@w{@uref{http://upc.lbl.gov/publications/UPC-TR-Original99.pdf}}
+Introduction to UPC and Language Specification,
+William W. Carlson et al., LLNL, CCS-TR-99-157, May 13, 1999
+
+
+@w{@uref{http://upc.lbl.gov/publications/upc-spec-1.3.pdf}}
+UPC Language Specifications, Version 1.3
+A publication of the UPC Consortium, November 16, 2013.
+
+@uref{http://www.gccupc.org}
+GNU UPC web site
+@c man end
+
+@node Contributors
+@section Contributors to GUPC
+
+The current developers and maintainers of GUPC are
+Gary Funck @email{gary@@intrepid.com} and
+Nenad Vukicevic @email{nenad@@intrepid.com}.
+
+GUPC was originally implemented by
+Jesse M. Draper @email{jdraper@@super.org} and
+William W. Carlson @email{wwc@@super.org}.
+
+@c man begin AUTHOR
+See the Info entry for @command{gupc}, or
+@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}
+for contributors to GCC and GUPC.
+@c man end
+
+@node Index
+@section Index
+
+@printindex cp
+
+@bye
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 84c028f6c92..9b8b1d66a83 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1612,6 +1612,9 @@ support for @code{libquadmath} on systems supporting it.
Specify that the GNU Offloading and Multi Processing Runtime Library
should not be built.
+@item --disable-libgupc
+Specify that the run-time libraries used by GNU UPC should not be built.
+
@item --disable-libvtv
Specify that the run-time libraries used by vtable verification
should not be built.
@@ -2130,6 +2133,24 @@ When you use this option, you should ensure that @var{dir} includes
tools.
@end table
+@subheading UPC-Specific Options
+
+The following options apply to the build of the GCC front end;
+they control aspects of UPC code generation.
+
+@table @code
+
+@item --enable-upc-link-script
+Enable UPC's use of a custom linker script; this
+will define the UPC shared section as a no load
+section on targets where this feature is supported.
+The @file{configure} script will by default enable this
+option if the feature is available on the target platform.
+You can use this switch to explicitly enable or disable
+this feature.
+
+@end table
+
@subheading Java-Specific Options
The following option applies to the build of the Java front end.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 2ed92858e6c..18303b9813c 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -181,6 +181,9 @@ in the following sections.
-aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
-fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
+-fupc -fupc-threads=@var{N} -fupc-pthreads-model-tls @gol
+-fupc-inline-lib -fupc-pre-include -fupc-debug -dwarf-2-upc @gol
+-fupc-instrument -fupc-instrument-functions @gol
-fms-extensions -fplan9-extensions -fsso-struct=@var{endianness}
-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
-fsigned-bitfields -fsigned-char @gol
@@ -1992,6 +1995,71 @@ Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
are ignored.
+@item -fupc
+@opindex fupc
+@cindex Enable UPC
+Enable the usage of UPC language extension features for C.
+When @option{-fupc} is specified, enable the UPC language
+extension features for C. The present implementation conforms
+to version 1.3 of the UPC language and library specifications
+@w{@uref{http://upc.lbl.gov/publications/upc-spec-1.3.pdf}}.
+This is an experimental feature, and the compiler ABI is subject
+to change in future versions of GCC.
+
+@item -fupc-threads=N
+@opindex fupc-threads
+Specify the number of UPC threads at compile-time as @option{N}. If this
+option is not present or the value of @option{N} is 0, the number of
+threads will be specified dynamically when the program is executed.
+The @option{-fupc} must also be present for this option to take effect.
+
+@item -fupc-pthreads-model-tls
+@opindex fupc-pthreads-model-tls
+Compile for the POSIX threads (pthreads) environment. Each UPC thread
+is directly mapped to one pthread.
+The @option{-fupc} must also be present for this option to take effect.
+
+@item -fupc-inline-lib
+@opindex fupc-inline-lib
+Inline various UPC run-time library routines. This option is
+enabled by default when compiled with @option{-O1} or higher.
+The @option{-fno-upc-inline-lib} option will disable inlining
+of the UPC runtime.
+The @option{-fupc} must also be present for this option to take effect.
+
+@item -fupc-pre-include
+@opindex fupc-pre-include
+Pre-include the UPC runtime header files. This option is enabled
+by default when @option{-fupc} is asserted.
+The @option{-fupc} must also be present for this option to take effect.
+
+@item -dwarf-2-upc
+@opindex dwarf-2-upc
+Generate UPC-specific symbolic DWARF-2 debugging information. This
+debugging information is processed by UPC-aware debuggers including
+GDB-UPC, a variant of the GDB debugger, and the commercially available
+Rogue Wave Totalview and Allinea DDT debuggers.
+The @option{-fupc} must also be present for this option to take effect.
+
+@item -fupc-debug
+@opindex fupc-debug
+Generate calls to the UPC run-time library that include source filename
+and line number information; this information is used to print more
+informative error messages when errors are detected at run-time.
+The @option{-fupc} must also be present for this option to take effect.
+
+@item -fupc-instrument
+@opindex fupc-instrument
+Instrument UPC shared accesses and library calls using GASP tool
+support API. This option implies @option{-fno-upc-inline-lib}.
+The @option{-fupc} must also be present for this option to take effect.
+
+@item -fupc-instrument-functions
+@opindex fupc-instrument-functions
+Instrument functions calls using GASP tool support. This option implies
+@option{-fupc-instrument} and @option{-fno-upc-inline-lib}.
+The @option{-fupc} must also be present for this option to take effect.
+
@item -fcilkplus
@opindex fcilkplus
@cindex Enable Cilk Plus
diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi
index ef5548b2aa6..5abaade2610 100644
--- a/gcc/doc/passes.texi
+++ b/gcc/doc/passes.texi
@@ -18,6 +18,7 @@ where near complete.
@menu
* Parsing pass:: The language front end turns text into bits.
+* UPC Transformation:: Transform UPC constructs into equivalent C.
* Cilk Plus Transformation:: Transform Cilk Plus Code to equivalent C/C++.
* Gimplification pass:: The bits are turned into something we can optimize.
* Pass manager:: Sequencing the optimization passes.
@@ -104,6 +105,100 @@ that is more descriptive than "rest_of".
The middle-end will, at its option, emit the function and data
definitions immediately or queue them for later processing.
+@node UPC Transformation
+@section UPC Transformation
+@cindex UPC
+
+If UPC compilation is enabled via the flag @option{-fupc},
+all UPC constructs are transformed into equivalent C operations
+and/or calls to the UPC runtime library (@file{libgupc}).
+The majority of this transformation occurs near the end of the parsing pass
+and before the gimplification pass. This transformation
+pass is implemented in the file @file{c-family/c-upc-low.c}.
+
+UPC constructs are handled in the @code{C} parser when the
+@option{-fupc} option is asserted. The UPC language is specified as
+a series of extensions to ISO C99. GNU UPC conforms to version 1.3
+of the UPC Language Specification
+@w{(@uref{http://upc.lbl.gov/publications/upc-spec-1.3.pdf}).}
+
+UPC introduces three type qualifiers: ``shared'', ``strict'',
+and ``relaxed''. `shared'' qualified memory may be remote to
+the currently executing UPC thread. The ``strict'' and ``relaxed''
+qualifiers further modify accesses to UPC shared memory. A ``strict''
+UPC shared access has more stronger memory consistency properties
+than a ``relaxed'' access. UPC introduces an additional ``layout qualifier''
+(also known as the blocking factor) which controls the layout of
+UPC shared arrays. The following example illustrates the use of
+UPC-specific type qualifiers:
+@smallexample
+ shared strict int x;
+ shared relaxed int y;
+ /* Below, ``[100]'' is the layout qualifier. */
+ shared [100] float A[100*THREADS*10];
+@end smallexample
+
+UPC also defines several synchronization statements
+which are specified as reserved words: ``upc_barrier'', ``upc_fence'',
+``upc_notify'', and ``upc_wait''. Additionally, an
+iterator statement, ``upc_forall'' is defined; it is similar
+to the ``for'' statement, but has an additional (fourth)
+``affinity clause'' which constrains UPC shared accesses for
+each iteration of the loop.
+
+UPC introduces two reserved identifiers:
+@table @code
+@item MYTHREAD
+The thread number (in the range @code{0..THREADS-1})
+of the currently executing UPC thread.
+@item THREADS
+The number of UPC threads specified for the current
+program execution.
+@end table
+
+The major components of the UPC language extension transform passes are:
+@itemize @bullet
+@item UPC shared memory accesses:
+Read accesses to UPC shared memory are translated into calls
+to various ``get'' functions implemented in the UPC runtime library.
+Write accesses to UPC shared memory are translated into calls
+to various ``put'' routines implemented in the UPC runtime library.
+@item UPC shared variable allocation and references:
+Variables qualified by the UPC ``shared'' qualifier must be allocated
+in UPC shared memory which can be accessed by all UPC threads.
+It is common for a UPC thread to be implemented as an operating
+system process and for UPC threads to execute on different computing
+nodes often connected by specialized high speed networks.
+Therefore, UPC shared variable declarations must be consolidated
+and allocated separately from regular @code{C} global variables.
+
+@item UPC pointer-to-shared arithmetic:
+UPC pointers-to-shared have three components: ``thread'',
+``phase'', and ``offset''. The ``thread'' gives the thread number
+of the thread that has affinity to the globally shared data. The ``offset''
+gives the offset of the data within shared data allocated on the
+target thread. The ``phase'' is used to implement the properties
+defined by the UPC ``layout qualifier''. UPC pointer-to-shared
+arithmetic requires several multiplications and modulo operations
+to implement the more general cases. The UPC transformation pass
+translates UPC pointer-to-shared arithmetic into an equivalent
+series of @code{C} arithmetic operations.
+
+@item UPC pointer-to-shared conversions:
+UPC pointers-to-shared can be converted into @code{C}
+pointers if the current UPC has affinity to the referenced
+UPC shared memory. The UPC transformation pass translates
+conversions from UPC pointers-to-shared into a call to
+the UPC runtime which will implement the conversion if it
+it meets the affinity constraint.
+
+@item UPC synchronization statements:
+The UPC language defined synchronization statements
+(for example, ``upc_barrier'') are translated into
+calls to the UPC runtime.
+
+@end itemize
+
@node Cilk Plus Transformation
@section Cilk Plus Transformation
@cindex CILK_PLUS
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index c5354cfc8f3..71df81050b7 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -91,6 +91,9 @@ The Go runtime library. The bulk of this library is mirrored from the
@item libgomp
The GNU Offloading and Multi Processing Runtime Library.
+@item libgupc
+The GNU UPC runtime library.
+
@item libiberty
The @code{libiberty} library, used for portability and for some
generally useful data structures and algorithms. @xref{Top, ,
@@ -1905,6 +1908,9 @@ Target supports @option{-freorder-blocks-and-partition}.
@item fstack_protector
Target supports @option{-fstack-protector}.
+@item fupc
+Target supports UPC via @option{-fupc}.
+
@item gas
Target uses GNU @command{as}.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 745910f9a33..385ef5803f7 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -53,6 +53,7 @@ through the macros defined in the @file{.h} file.
* PCH Target:: Validity checking for precompiled headers.
* C++ ABI:: Controlling C++ ABI changes.
* Named Address Spaces:: Adding support for named address spaces
+* UPC Language:: Defining UPC-related configuration items
* Misc:: Everything else.
@end menu
@@ -10398,6 +10399,26 @@ Define this to define how the address space is encoded in dwarf.
The result is the value to be used with @code{DW_AT_address_class}.
@end deftypefn
+@node UPC Language
+@section UPC Language Support
+@cindex UPC, pointer-to-shared, libgupc
+
+@deftypefn {Target Hook} bool TARGET_UPC_LINK_SCRIPT_P (void)
+This hook returns true if a linker script will be used to origin the UPC shared section at 0.
+@end deftypefn
+
+@deftypefn {Target Hook} {const char *} TARGET_UPC_SHARED_SECTION_NAME (void)
+This hook returns the name of the section used to assign addresses to UPC shared data items.
+@end deftypefn
+
+@deftypefn {Target Hook} {const char *} TARGET_UPC_PGM_INFO_SECTION_NAME (void)
+This hook returns the name of the section used to hold information describing how a UPC source file was compiled.
+@end deftypefn
+
+@deftypefn {Target Hook} {const char *} TARGET_UPC_INIT_ARRAY_SECTION_NAME (void)
+This hook returns the name of the section used to hold an array of addresses of UPC initialization routines.
+@end deftypefn
+
@node Misc
@section Miscellaneous Parameters
@cindex parameters, miscellaneous
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index f31c763991c..e5a94c956eb 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -53,6 +53,7 @@ through the macros defined in the @file{.h} file.
* PCH Target:: Validity checking for precompiled headers.
* C++ ABI:: Controlling C++ ABI changes.
* Named Address Spaces:: Adding support for named address spaces
+* UPC Language:: Defining UPC-related configuration items
* Misc:: Everything else.
@end menu
@@ -7466,6 +7467,18 @@ c_register_addr_space ("__ea", ADDR_SPACE_EA);
@hook TARGET_ADDR_SPACE_DEBUG
+@node UPC Language
+@section UPC Language Support
+@cindex UPC, pointer-to-shared, libgupc
+
+@hook TARGET_UPC_LINK_SCRIPT_P
+
+@hook TARGET_UPC_SHARED_SECTION_NAME
+
+@hook TARGET_UPC_PGM_INFO_SECTION_NAME
+
+@hook TARGET_UPC_INIT_ARRAY_SECTION_NAME
+
@node Misc
@section Miscellaneous Parameters
@cindex parameters, miscellaneous
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 6e0c01cc95f..a9abec7540e 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -468,6 +468,10 @@ do_jump (tree exp, rtx_code_label *if_false_label,
< TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0)))))
goto normal;
case NON_LVALUE_EXPR:
+ /* if a shared pointer conversion that will change representation,
+ then we have to compare in the result type. */
+ if (PTS_CVT_OP_P (exp))
+ goto normal;
case ABS_EXPR:
case NEGATE_EXPR:
case LROTATE_EXPR:
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index f01c15bbe9e..8d58e8f5048 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -11406,6 +11406,53 @@ modified_type_die (tree type, int cv_quals, bool reverse,
first_quals |= dwarf_qual_info[i].q;
}
}
+ else if (use_upc_dwarf2_extensions
+ && (cv_quals & TYPE_QUAL_SHARED))
+ {
+ HOST_WIDE_INT block_factor = 1;
+
+ /* Inside the compiler,
+ "shared int x;" TYPE_BLOCK_FACTOR is null.
+ "shared [] int *p;" TYPE_BLOCK_FACTOR is zero.
+ "shared [10] int x[50];" TYPE_BLOCK_FACTOR is 10 * bitsize(int)
+ The DWARF2 encoding is as follows:
+ "shared int x;" DW_AT_count: 1
+ "shared [] int *p;" <no DW_AT_count attribute>
+ "shared [10] int x[50];" DW_AT_count: 10
+ The logic below handles thse various contingencies. */
+
+ mod_type_die = new_die (DW_TAG_upc_shared_type,
+ comp_unit_die (), type);
+
+ if (TYPE_HAS_BLOCK_FACTOR (type))
+ block_factor = TREE_INT_CST_LOW (TYPE_BLOCK_FACTOR (type));
+
+ if (block_factor != 0)
+ add_AT_unsigned (mod_type_die, DW_AT_count, block_factor);
+
+ sub_die = modified_type_die (type,
+ cv_quals & ~TYPE_QUAL_SHARED,
+ false,
+ context_die);
+ }
+ else if (use_upc_dwarf2_extensions && cv_quals & TYPE_QUAL_STRICT)
+ {
+ mod_type_die = new_die (DW_TAG_upc_strict_type,
+ comp_unit_die (), type);
+ sub_die = modified_type_die (type,
+ cv_quals & ~TYPE_QUAL_STRICT,
+ false,
+ context_die);
+ }
+ else if (use_upc_dwarf2_extensions && cv_quals & TYPE_QUAL_RELAXED)
+ {
+ mod_type_die = new_die (DW_TAG_upc_relaxed_type,
+ comp_unit_die (), type);
+ sub_die = modified_type_die (type,
+ cv_quals & ~TYPE_QUAL_RELAXED,
+ false,
+ context_die);
+ }
else if (code == POINTER_TYPE || code == REFERENCE_TYPE)
{
dwarf_tag tag = DW_TAG_pointer_type;
@@ -18422,6 +18469,12 @@ add_subscript_info (dw_die_ref type_die, tree type, bool collapse_p)
if (!subrange_die)
subrange_die = new_die (DW_TAG_subrange_type, type_die, NULL);
+
+ if (use_upc_dwarf2_extensions && TYPE_HAS_THREADS_FACTOR (type))
+ {
+ add_AT_flag (subrange_die, DW_AT_upc_threads_scaled, 1);
+ }
+
if (domain)
{
/* We have an array type with specified bounds. */
@@ -21809,6 +21862,10 @@ gen_compile_unit_die (const char *filename)
if (dwarf_version >= 5 /* || !dwarf_strict */)
if (strcmp (language_string, "GNU C11") == 0)
language = DW_LANG_C11;
+
+ if (use_upc_dwarf2_extensions && flag_upc)
+ language = DW_LANG_Upc;
+
}
}
else if (strncmp (language_string, "GNU C++", 7) == 0)
diff --git a/gcc/explow.c b/gcc/explow.c
index e0ce201b86b..cfc5cc581c9 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -800,6 +800,8 @@ promote_mode (const_tree type ATTRIBUTE_UNUSED, machine_mode mode,
case REFERENCE_TYPE:
case POINTER_TYPE:
*punsignedp = POINTERS_EXTEND_UNSIGNED;
+ if (SHARED_TYPE_P (TREE_TYPE (type)))
+ return TYPE_MODE (upc_pts_type_node);
return targetm.addr_space.address_mode
(TYPE_ADDR_SPACE (TREE_TYPE (type)));
break;
diff --git a/gcc/expr.c b/gcc/expr.c
index 29d22b07256..d1d9ca5d167 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -138,7 +138,6 @@ static void emit_single_push_insn (machine_mode, rtx, tree);
static void do_tablejump (rtx, machine_mode, rtx, rtx, rtx, int);
static rtx const_vector_from_tree (tree);
static rtx const_scalar_mask_from_tree (tree);
-static tree tree_expr_size (const_tree);
static HOST_WIDE_INT int_expr_size (tree);
@@ -11602,18 +11601,6 @@ get_personality_function (tree decl)
return XEXP (DECL_RTL (personality), 0);
}
-/* Returns a tree for the size of EXP in bytes. */
-
-static tree
-tree_expr_size (const_tree exp)
-{
- if (DECL_P (exp)
- && DECL_SIZE_UNIT (exp) != 0)
- return DECL_SIZE_UNIT (exp);
- else
- return size_in_bytes (TREE_TYPE (exp));
-}
-
/* Return an rtx for the size in bytes of the value of EXP. */
rtx
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ee7d4f58ba7..016bf921615 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7884,10 +7884,16 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
/* Convert (T1)(X p+ Y) into ((T1)X p+ Y), for pointer type, when the new
cast (T1)X will fold away. We assume that this happens when X itself
- is a cast. */
+ is a cast.
+
+ Do not perform this simplification if either of the types
+ are UPC pointer-to-shared types. */
if (POINTER_TYPE_P (type)
&& TREE_CODE (arg0) == POINTER_PLUS_EXPR
- && CONVERT_EXPR_P (TREE_OPERAND (arg0, 0)))
+ && CONVERT_EXPR_P (TREE_OPERAND (arg0, 0))
+ && !SHARED_TYPE_P (TREE_TYPE (type))
+ && !SHARED_TYPE_P (TREE_TYPE (
+ TREE_TYPE (TREE_OPERAND (arg0, 0)))))
{
tree arg00 = TREE_OPERAND (arg0, 0);
tree arg01 = TREE_OPERAND (arg0, 1);
@@ -9449,6 +9455,14 @@ fold_binary_loc (location_t loc,
return NULL_TREE;
case PLUS_EXPR:
+ /* Disable further optimizations involving UPC shared pointers,
+ because integers are not interoperable with shared pointers. */
+ if ((TREE_TYPE (arg0) && POINTER_TYPE_P (TREE_TYPE (arg0))
+ && SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (arg0))))
+ || (TREE_TYPE (arg1) && POINTER_TYPE_P (TREE_TYPE (arg1))
+ && SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (arg1)))))
+ return NULL_TREE;
+
if (INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type))
{
/* X + (X / CST) * -CST is X % CST. */
@@ -9858,6 +9872,16 @@ fold_binary_loc (location_t loc,
return NULL_TREE;
case MINUS_EXPR:
+
+ /* Disable further optimizations involving UPC shared pointers,
+ because integers are not interoperable with shared pointers.
+ (The test below also detects pointer difference between
+ shared pointers, which cannot be folded. */
+
+ if (TREE_TYPE (arg0) && POINTER_TYPE_P (TREE_TYPE (arg0))
+ && SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (arg0))))
+ return NULL_TREE;
+
/* (-A) - B -> (-B) - A where B is easily negated and we can swap. */
if (TREE_CODE (arg0) == NEGATE_EXPR
&& negate_expr_p (op1)
diff --git a/gcc/function.c b/gcc/function.c
index 401f8f90160..2625ec816df 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -2078,6 +2078,17 @@ aggregate_value_p (const_tree exp, const_tree fntype)
if (flag_pcc_struct_return && AGGREGATE_TYPE_P (type))
return 1;
+ /* Pointers-to-shared must be considered as aggregates for
+ the purpose of passing them as return values, but only
+ when the underlying mode of the representation would
+ require that its value be passed on the stack.
+ This occurs when using the 'struct' representation
+ of a shared pointer. */
+ if (flag_pcc_struct_return && POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type))
+ && AGGREGATE_TYPE_P (upc_pts_rep_type_node))
+ return 1;
+
if (targetm.calls.return_in_memory (type, fntype))
return 1;
@@ -3392,6 +3403,13 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
set_dst_reg_note (linsn, REG_EQUIV, equiv_stack_parm, parmreg);
}
+ /* Do not target UPC pointers-to-shared values into a pointer
+ register if they are represented as struct's. */
+ if (POINTER_TYPE_P (TREE_TYPE (parm))
+ && SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (parm)))
+ && AGGREGATE_TYPE_P (upc_pts_rep_type_node))
+ return;
+
/* For pointer data type, suggest pointer register. */
if (POINTER_TYPE_P (TREE_TYPE (parm)))
mark_reg_pointer (parmreg,
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 483644284c3..0d0ffef141b 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1016,16 +1016,20 @@ proper position among the other output files. */
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\
- %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \
+ %{s} %{t} %{u*} %{z} %{Z}\
+ %{!nostdlib:%{!nostartfiles:%{fupc:%:include(upc-crtbegin.spec)%(upc_crtbegin)}}}\
+ %{!nostdlib:%{!nostartfiles:%S}} \
%{static:} %{L*} %(mfwrap) %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
%:include(libgomp.spec)%(link_gomp)}\
%{fcilkplus:%:include(libcilkrts.spec)%(link_cilkrts)}\
%{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
+ %{fupc:%:include(libgupc.spec)%(link_upc)}\
%(mflib) " STACK_SPLIT_SPEC "\
%{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
%{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
+ %{!nostdlib:%{!nostartfiles:%{fupc:%:include(upc-crtend.spec)%(upc_crtend)}}}\
%{!nostdlib:%{!nostartfiles:%E}} %{T*} \n%(post_link) }}}}}}"
#endif
@@ -1061,6 +1065,9 @@ static const char *asm_final_spec = ASM_FINAL_SPEC;
static const char *link_spec = LINK_SPEC;
static const char *lib_spec = LIB_SPEC;
static const char *link_gomp_spec = "";
+static const char *upc_crtbegin_spec = "";
+static const char *link_upc_spec = "";
+static const char *upc_crtend_spec = "";
static const char *libgcc_spec = LIBGCC_SPEC;
static const char *endfile_spec = ENDFILE_SPEC;
static const char *startfile_spec = STARTFILE_SPEC;
@@ -1134,6 +1141,9 @@ static const char *cc1_options =
%{fsyntax-only:-o %j} %{-param*}\
%{coverage:-fprofile-arcs -ftest-coverage}";
+static const char *upc_options =
+ "-fupc %{!fno-upc-pre-include:-include gcc-upc.h}";
+
static const char *asm_options =
"%{-target-help:%:print-asm-header()} "
#if HAVE_GNU_AS
@@ -1345,6 +1355,21 @@ static const struct compiler default_compilers[] =
as %(asm_debug) %(asm_options) %m.s %A }}}}"
#endif
, 0, 0, 0},
+ {".upc", "@upc", 0, 0, 0},
+ {"@upc",
+ /* Same as "@c" above, with the addition of %(upc_options). */
+ "%{E|M|MM:cc1 -E %(upc_options) %(cpp_options) %(cpp_debug_options)}\
+ %{!E:%{!M:%{!MM:\
+ %{traditional|ftraditional|traditional-cpp:\
+ %e UPC does not support traditional compilation}\
+ %{save-temps|no-integrated-cpp:\
+ cc1 -E %(upc_options) %(cpp_options)\
+ %{save-temps:%b.mi} %{!save-temps:%g.mi} \n\
+ cc1 -fpreprocessed %{save-temps:%b.mi} %{!save-temps:%g.mi}\
+ %(upc_options) %(cc1_options)}\
+ %{!save-temps:%{!no-integrated-cpp:\
+ cc1 %(cpp_unique_options) %(upc_options) %(cc1_options)}}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
#include "specs.h"
/* Mark end of table. */
@@ -1555,6 +1580,7 @@ static struct spec_list static_specs[] =
INIT_STATIC_SPEC ("trad_capable_cpp", &trad_capable_cpp),
INIT_STATIC_SPEC ("cc1", &cc1_spec),
INIT_STATIC_SPEC ("cc1_options", &cc1_options),
+ INIT_STATIC_SPEC ("upc_options", &upc_options),
INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec),
INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec),
INIT_STATIC_SPEC ("link_ssp", &link_ssp_spec),
@@ -1562,6 +1588,9 @@ static struct spec_list static_specs[] =
INIT_STATIC_SPEC ("link", &link_spec),
INIT_STATIC_SPEC ("lib", &lib_spec),
INIT_STATIC_SPEC ("link_gomp", &link_gomp_spec),
+ INIT_STATIC_SPEC ("upc_crtbegin", &upc_crtbegin_spec),
+ INIT_STATIC_SPEC ("link_upc", &link_upc_spec),
+ INIT_STATIC_SPEC ("upc_crtend", &upc_crtend_spec),
INIT_STATIC_SPEC ("libgcc", &libgcc_spec),
INIT_STATIC_SPEC ("startfile", &startfile_spec),
INIT_STATIC_SPEC ("cross_compile", &cross_compile),
diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c
index 29e9c0a33dc..083691dd284 100644
--- a/gcc/gimple-expr.c
+++ b/gcc/gimple-expr.c
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-ssa.h"
#include "fold-const.h"
#include "tree-eh.h"
+#include "langhooks.h"
#include "gimplify.h"
#include "stor-layout.h"
#include "demangle.h"
@@ -67,6 +68,19 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type))
{
+ int i_shared = SHARED_TYPE_P (TREE_TYPE (inner_type));
+ int o_shared = SHARED_TYPE_P (TREE_TYPE (outer_type));
+
+ /* Retain conversions from a UPC shared pointer to
+ a regular C pointer. */
+ if (!o_shared && i_shared)
+ return false;
+
+ /* Retain conversions between incompatible UPC shared pointers. */
+ if (o_shared && i_shared
+ && !lang_hooks.types_compatible_p (inner_type, outer_type))
+ return false;
+
/* Do not lose casts between pointers to different address spaces. */
if (TYPE_ADDR_SPACE (TREE_TYPE (outer_type))
!= TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 656c8fb9656..ea2649ffa90 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -11564,7 +11564,7 @@ typedef char *char_p; /* For DEF_VEC_P. */
/* Return whether we should exclude FNDECL from instrumentation. */
-static bool
+bool
flag_instrument_functions_exclude_p (tree fndecl)
{
vec<char_p> *v;
diff --git a/gcc/gimplify.h b/gcc/gimplify.h
index fd003a0e127..649c95d24fe 100644
--- a/gcc/gimplify.h
+++ b/gcc/gimplify.h
@@ -77,6 +77,7 @@ extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
extern void gimplify_type_sizes (tree, gimple_seq *);
extern void gimplify_one_sizepos (tree *, gimple_seq *);
extern gbind *gimplify_body (tree, bool);
+extern bool flag_instrument_functions_exclude_p (tree);
extern enum gimplify_status gimplify_arg (tree *, gimple_seq *, location_t);
extern void gimplify_function_tree (tree);
extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index a2566ec30a9..effd875c803 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -35,7 +35,9 @@ struct diagnostic_info;
/* See langhooks.h for the definition and documentation of each hook. */
extern void lhd_do_nothing (void);
+extern void lhd_do_nothing_b (bool);
extern void lhd_do_nothing_t (tree);
+extern void lhd_do_nothing_t_t (tree, tree);
extern void lhd_do_nothing_f (struct function *);
extern tree lhd_pass_through_t (tree);
extern bool lhd_post_options (const char **);
@@ -176,6 +178,8 @@ extern tree lhd_make_node (enum tree_code);
#define LANG_HOOKS_GET_TYPE_BIAS NULL
#define LANG_HOOKS_DESCRIPTIVE_TYPE NULL
#define LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE reconstruct_complex_type
+#define LANG_HOOKS_UPC_TOGGLE_KEYWORDS lhd_do_nothing_b
+#define LANG_HOOKS_UPC_WRITE_GLOBAL_INIT_FUNC lhd_do_nothing
#define LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE lhd_enum_underlying_base_type
#define LANG_HOOKS_GET_DEBUG_TYPE NULL
#define LANG_HOOKS_GET_FIXED_POINT_TYPE_INFO NULL
@@ -225,6 +229,8 @@ extern tree lhd_make_node (enum tree_code);
#define LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR NULL
#define LANG_HOOKS_OMP_CLAUSE_DTOR hook_tree_tree_tree_null
#define LANG_HOOKS_OMP_FINISH_CLAUSE lhd_omp_finish_clause
+#define LANG_HOOKS_LAYOUT_DECL_P hook_bool_tree_tree_false
+#define LANG_HOOKS_LAYOUT_DECL lhd_do_nothing_t_t
#define LANG_HOOKS_DECLS { \
LANG_HOOKS_GLOBAL_BINDINGS_P, \
@@ -249,7 +255,9 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, \
LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR, \
LANG_HOOKS_OMP_CLAUSE_DTOR, \
- LANG_HOOKS_OMP_FINISH_CLAUSE \
+ LANG_HOOKS_OMP_FINISH_CLAUSE, \
+ LANG_HOOKS_LAYOUT_DECL_P, \
+ LANG_HOOKS_LAYOUT_DECL \
}
/* LTO hooks. */
@@ -267,6 +275,11 @@ extern void lhd_end_section (void);
LANG_HOOKS_END_SECTION \
}
+#define LANG_HOOKS_UPC { \
+ LANG_HOOKS_UPC_TOGGLE_KEYWORDS, \
+ LANG_HOOKS_UPC_WRITE_GLOBAL_INIT_FUNC \
+}
+
/* The whole thing. The structure is defined in langhooks.h. */
#define LANG_HOOKS_INITIALIZER { \
LANG_HOOKS_NAME, \
@@ -306,6 +319,7 @@ extern void lhd_end_section (void);
LANG_HOOKS_DECLS, \
LANG_HOOKS_FOR_TYPES_INITIALIZER, \
LANG_HOOKS_LTO, \
+ LANG_HOOKS_UPC, \
LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, \
LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, \
LANG_HOOKS_FUNCTION_PARAMETER_PACK_P, \
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 7c07175d810..a54a58d30a3 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -43,6 +43,13 @@ lhd_do_nothing (void)
{
}
+/* Do nothing (bool). */
+
+void
+lhd_do_nothing_b (bool ARG_UNUSED (b))
+{
+}
+
/* Do nothing (tree). */
void
@@ -50,6 +57,14 @@ lhd_do_nothing_t (tree ARG_UNUSED (t))
{
}
+/* Do nothing (tree, tree). */
+
+void
+lhd_do_nothing_t_t (tree ARG_UNUSED (a),
+ tree ARG_UNUSED (b))
+{
+}
+
/* Pass through (tree). */
tree
lhd_pass_through_t (tree t)
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index bcfd389aa7e..f424554bd0b 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -256,6 +256,13 @@ struct lang_hooks_for_decls
/* Do language specific checking on an implicitly determined clause. */
void (*omp_finish_clause) (tree clause, gimple_seq *pre_p);
+
+ /* Return true if language-specific layout is needed. */
+ bool (*layout_decl_p) (tree decl, tree type);
+
+ /* Perform language-specific layout.
+ (Should be called only if the layout_decl_p hook is ture.) */
+ void (*layout_decl) (tree decl, tree type);
};
/* Language hooks related to LTO serialization. */
@@ -275,6 +282,18 @@ struct lang_hooks_for_lto
void (*end_section) (void);
};
+/* Language hooks related to UPC. */
+
+struct lang_hooks_for_upc
+{
+ /* Enable/Disable UPC keywords. */
+ void (*toggle_keywords) (bool);
+
+ /* Write the UPC global initialization function
+ for the current compilation unit. */
+ void (*write_global_init_func) (void);
+};
+
/* Language-specific hooks. See langhooks-def.h for defaults. */
struct lang_hooks
@@ -442,6 +461,8 @@ struct lang_hooks
struct lang_hooks_for_lto lto;
+ struct lang_hooks_for_upc upc;
+
/* Returns a TREE_VEC of the generic parameters of an instantiation of
a generic type or decl, e.g. C++ template instantiation. If
TREE_CHAIN of the return value is set, it is an INTEGER_CST
diff --git a/gcc/match.pd b/gcc/match.pd
index e2e33ed012f..f1d07dd59fa 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -943,10 +943,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(if (!fail && wi::bit_and (@1, zero_mask_not) == 0)
(inner_op @2 { wide_int_to_tree (type, cst_emit); }))))))
-/* Associate (p +p off1) +p off2 as (p +p (off1 + off2)). */
+/* Associate (p +p off1) +p off2 as (p +p (off1 + off2)).
+ (Do not apply this simplification to UPC pointers-to-shared
+ because they are not directly convertible to integers.) */
(simplify
- (pointer_plus (pointer_plus:s @0 @1) @3)
- (pointer_plus @0 (plus @1 @3)))
+ (pointer_plus (pointer_plus:s@2 @0 @1) @3)
+ (if (!SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (@2))))
+ (pointer_plus @0 (plus @1 @3))))
/* Pattern match
tem1 = (long) ptr1;
@@ -1440,19 +1443,31 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(view_convert @0))
/* For integral conversions with the same precision or pointer
- conversions use a NOP_EXPR instead. */
+ conversions use a NOP_EXPR instead.
+ (Do not apply this simplification to UPC pointers-to-shared
+ because they are not directly convertible to integers.) */
(simplify
(view_convert @0)
- (if ((INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))
- && (INTEGRAL_TYPE_P (TREE_TYPE (@0)) || POINTER_TYPE_P (TREE_TYPE (@0)))
+ (if ((INTEGRAL_TYPE_P (type)
+ || (POINTER_TYPE_P (type)
+ && !SHARED_TYPE_P (TREE_TYPE (type))))
+ && (INTEGRAL_TYPE_P (TREE_TYPE (@0))
+ || (POINTER_TYPE_P (TREE_TYPE (@0))
+ && !SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (@0)))))
&& TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (@0)))
(convert @0)))
-/* Strip inner integral conversions that do not change precision or size. */
+/* Strip inner integral conversions that do not change precision or size.
+ (Do not apply this simplification to UPC pointers-to-shared
+ because they are not directly convertible to integers.) */
(simplify
(view_convert (convert@0 @1))
- (if ((INTEGRAL_TYPE_P (TREE_TYPE (@0)) || POINTER_TYPE_P (TREE_TYPE (@0)))
- && (INTEGRAL_TYPE_P (TREE_TYPE (@1)) || POINTER_TYPE_P (TREE_TYPE (@1)))
+ (if ((INTEGRAL_TYPE_P (TREE_TYPE (@0))
+ || (POINTER_TYPE_P (TREE_TYPE (@0))
+ && !SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (@0)))))
+ && (INTEGRAL_TYPE_P (TREE_TYPE (@1))
+ || (POINTER_TYPE_P (TREE_TYPE (@1))
+ && !SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (@1)))))
&& (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (TREE_TYPE (@1)))
&& (TYPE_SIZE (TREE_TYPE (@0)) == TYPE_SIZE (TREE_TYPE (@1))))
(view_convert @1)))
@@ -1493,6 +1508,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
int final_vec = VECTOR_TYPE_P (type);
unsigned int final_prec = TYPE_PRECISION (type);
int final_unsignedp = TYPE_UNSIGNED (type);
+ int final_pts = final_ptr
+ && SHARED_TYPE_P (TREE_TYPE (type));
+ int inter_pts = inter_ptr
+ && SHARED_TYPE_P (TREE_TYPE (inter_type));
+ int inside_pts = inside_ptr
+ && SHARED_TYPE_P (TREE_TYPE (inside_type));
}
(switch
/* In addition to the cases of two conversions in a row
@@ -1541,7 +1562,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
- the initial type is a pointer type and the precisions of the
intermediate and final types differ, or
- the final type is a pointer type and the precisions of the
- initial and intermediate types differ. */
+ initial and intermediate types differ, or
+ - the final type, intermediate type, and initial type are not either
+ all regular C pointer types or all UPC pointer-to-shared types, or
+ - the final type is a UPC pointer-to-shared and the intermediate type
+ is a UPC-pointer-to-shared and their target types differ, or
+ - the final type is a UPC pointer-to-shared and the intermediate type
+ is a UPC-pointer-to-shared and their target types differ. */
(if (! inside_float && ! inter_float && ! final_float
&& ! inside_vec && ! inter_vec && ! final_vec
&& (inter_prec >= inside_prec || inter_prec >= final_prec)
@@ -1553,7 +1580,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& ! (inside_ptr && inter_prec != final_prec)
&& ! (final_ptr && inside_prec != inter_prec)
&& ! (final_prec != GET_MODE_PRECISION (TYPE_MODE (type))
- && TYPE_MODE (type) == TYPE_MODE (inter_type)))
+ && TYPE_MODE (type) == TYPE_MODE (inter_type))
+ && (final_pts == inter_pts) && (inter_pts == inside_pts)
+ && ! (inter_pts
+ && (TREE_TYPE (inter_type) != TREE_TYPE (inside_type)))
+ && ! (final_pts && (TREE_TYPE (type) != TREE_TYPE (inter_type))))
(ocvt @0))
/* A truncation to an unsigned type (a zero-extension) should be
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index aa6593f28f4..b0b2ad22cee 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -299,6 +299,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
fputs (" readonly", file);
if (TYPE_P (node) && TYPE_ATOMIC (node))
fputs (" atomic", file);
+ if (TREE_SHARED (node))
+ fputs (" shared", file);
if (!TYPE_P (node) && TREE_CONSTANT (node))
fputs (" constant", file);
else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node))
@@ -607,6 +609,14 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
print_node (file, "size", TYPE_SIZE (node), indent + 4);
print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4);
+ if (TYPE_SHARED (node))
+ {
+ if (TYPE_HAS_THREADS_FACTOR(node))
+ fputs (" THREADS factor", file);
+ if (TYPE_HAS_BLOCK_FACTOR (node))
+ print_node (file, "block factor",
+ TYPE_BLOCK_FACTOR (node), indent + 4);
+ }
indent_to (file, indent + 3);
if (TYPE_USER_ALIGN (node))
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index dd40ca00af8..05ee996a03b 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -617,7 +617,11 @@ layout_decl (tree decl, unsigned int known_align)
if (DECL_MODE (decl) == VOIDmode)
DECL_MODE (decl) = TYPE_MODE (type);
- if (DECL_SIZE (decl) == 0)
+ if (lang_hooks.decls.layout_decl_p (decl, type))
+ {
+ lang_hooks.decls.layout_decl (decl, type);
+ }
+ else if (DECL_SIZE (decl) == 0)
{
DECL_SIZE (decl) = TYPE_SIZE (type);
DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (type);
diff --git a/gcc/target.def b/gcc/target.def
index 20f2b32da1e..4bcb149f04a 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -5492,6 +5492,41 @@ DEFHOOK
HOOK_VECTOR_END (cxx)
+/* Functions and data for UPC support. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_UPC_"
+HOOK_VECTOR (TARGET_UPC, upc)
+
+DEFHOOK
+(link_script_p,
+"This hook returns true if a linker script will be used to\
+ origin the UPC shared section at 0.",
+ bool, (void),
+ default_upc_link_script_p)
+
+DEFHOOK
+(shared_section_name,
+"This hook returns the name of the section used to assign addresses to\
+ UPC shared data items.",
+ const char *, (void),
+ default_upc_shared_section_name)
+
+DEFHOOK
+(pgm_info_section_name,
+"This hook returns the name of the section used to hold information\
+ describing how a UPC source file was compiled.",
+ const char *, (void),
+ default_upc_pgm_info_section_name)
+
+DEFHOOK
+(init_array_section_name,
+"This hook returns the name of the section used to hold an array\
+ of addresses of UPC initialization routines.",
+ const char *, (void),
+ default_upc_init_array_section_name)
+
+HOOK_VECTOR_END (upc)
+
/* Functions and data for emulated TLS support. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_EMUTLS_"
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index a34227705d2..30073df1848 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1965,4 +1965,49 @@ default_optab_supported_p (int, machine_mode, machine_mode, optimization_type)
return true;
}
+/* Default implementation of the UPC-specific target hook,
+ which returns TRUE if UPC linker scripts are supported. */
+
+bool
+default_upc_link_script_p (void)
+{
+#ifdef HAVE_UPC_LINK_SCRIPT
+ return true;
+#else
+ return false;
+#endif
+}
+
+/* Default implementation of the UPC-specific target hook,
+ which returns the name of the linker section used
+ to coalesce shared qualified variables. */
+
+const char *
+default_upc_shared_section_name (void)
+{
+ return UPC_SHARED_SECTION_NAME;
+}
+
+/* Default implementation of the UPC-specific target hook,
+ which returns the name of the linker section used
+ to collect information about all of the compiled
+ UPC source files. */
+
+const char *
+default_upc_pgm_info_section_name (void)
+{
+ return UPC_PGM_INFO_SECTION_NAME;
+}
+
+/* Default implementation of the UPC-specific target hook,
+ which returns the name of the linker section used
+ to record a table of address of routines that
+ initialize UPC file-scoped shared-qualified variables. */
+
+const char *
+default_upc_init_array_section_name (void)
+{
+ return UPC_INIT_ARRAY_SECTION_NAME;
+}
+
#include "gt-targhooks.h"
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 7687c39b53b..135cab1f40b 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -251,7 +251,13 @@ extern void default_setup_incoming_vararg_bounds (cumulative_args_t ca ATTRIBUTE
tree type ATTRIBUTE_UNUSED,
int *pretend_arg_size ATTRIBUTE_UNUSED,
int second_time ATTRIBUTE_UNUSED);
+
extern bool default_optab_supported_p (int, machine_mode, machine_mode,
optimization_type);
+extern bool default_upc_link_script_p (void);
+extern const char *default_upc_shared_section_name (void);
+extern const char *default_upc_pgm_info_section_name (void);
+extern const char *default_upc_init_array_section_name (void);
+
#endif /* GCC_TARGHOOKS_H */
diff --git a/gcc/testsuite/gcc.dg/gupc/addr-of-shared-bit-field.upc b/gcc/testsuite/gcc.dg/gupc/addr-of-shared-bit-field.upc
new file mode 100644
index 00000000000..28d24d1ab3d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/addr-of-shared-bit-field.upc
@@ -0,0 +1,22 @@
+/* Invalid & operation applied to a UPC shared bit field.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared struct
+ {
+ int a;
+ int b : 8;
+ int c : 24;
+ } x;
+
+shared int *pts;
+
+int main (void)
+{
+ pts = &x.b; /* { dg-error "cannot take address of bit-field 'b'" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/assign-local-ptr-to-pts.upc b/gcc/testsuite/gcc.dg/gupc/assign-local-ptr-to-pts.upc
new file mode 100644
index 00000000000..2ae4a270f0e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/assign-local-ptr-to-pts.upc
@@ -0,0 +1,20 @@
+/* UPC does not allow assignments from a local pointer
+ to a pointer-to-shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x;
+
+shared int *pts;
+
+int main (void)
+{
+ int *local_ptr = &x;
+ pts = local_ptr; /* { dg-error "UPC does not allow assignments from a local pointer to a pointer-to-shared" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/assign-pts-to-local-ptr.upc b/gcc/testsuite/gcc.dg/gupc/assign-pts-to-local-ptr.upc
new file mode 100644
index 00000000000..8525f5d9b49
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/assign-pts-to-local-ptr.upc
@@ -0,0 +1,18 @@
+/* UPC does not allow assignments
+ from a pointer-to-shared to a local pointer.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int *pts;
+
+int main (void)
+{
+ int *local_ptr = pts; /* { dg-error "UPC does not allow assignments from a pointer-to-shared to a local pointer" } */
+ *local_ptr = 1;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/assign-pts-with-diff-block-factors-no-cast.upc b/gcc/testsuite/gcc.dg/gupc/assign-pts-with-diff-block-factors-no-cast.upc
new file mode 100644
index 00000000000..380ff19c2f9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/assign-pts-with-diff-block-factors-no-cast.upc
@@ -0,0 +1,22 @@
+/* UPC does not allow assignment
+ between pointers to shared with
+ differing block sizes without a cast.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [3] int A3[3*THREADS];
+shared [5] int A5[5*THREADS];
+
+shared [3] int *p3 = A3;
+shared [5] int *p5 = A5;
+
+int main (void)
+{
+ p3 = p5; /* { dg-error "UPC does not allow assignment between pointers to shared with differing block sizes without a cast" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/barrier-notify-wait.upc b/gcc/testsuite/gcc.dg/gupc/barrier-notify-wait.upc
new file mode 100644
index 00000000000..378eaade537
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/barrier-notify-wait.upc
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* Runtime API */
+extern void __upc_barrier (int);
+extern void __upc_notify (int);
+extern void __upc_wait (int);
+
+int main () {
+ /* { dg-final { scan-tree-dump-times "__upc_barrier \\\(123\\\)" 1 "original" } } */
+ upc_barrier 123;
+ /* { dg-final { scan-tree-dump-times "__upc_notify \\\(456\\\)" 1 "original" } } */
+ upc_notify 456;
+ /* { dg-final { scan-tree-dump-times "__upc_wait \\\(456\\\)" 1 "original" } } */
+ upc_wait 456;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/block-factor-applied-to-void-type.upc b/gcc/testsuite/gcc.dg/gupc/block-factor-applied-to-void-type.upc
new file mode 100644
index 00000000000..985a24d9b47
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/block-factor-applied-to-void-type.upc
@@ -0,0 +1,10 @@
+/* UPC layout qualifier cannot be applied to a void type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [5] void *pts; /* { dg-error "UPC layout qualifier cannot be applied to a void type" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/block-factor-incompatible-with-ref-type.upc b/gcc/testsuite/gcc.dg/gupc/block-factor-incompatible-with-ref-type.upc
new file mode 100644
index 00000000000..61530baf848
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/block-factor-incompatible-with-ref-type.upc
@@ -0,0 +1,12 @@
+/* UPC layout qualifier is incompatible with the referenced type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+typedef shared [3] int array_blocked_3_type[30];
+
+shared [5] array_blocked_3_type A[THREADS]; /* { dg-error "UPC layout qualifier is incompatible with the referenced type" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/block-factor-not-int-constant.upc b/gcc/testsuite/gcc.dg/gupc/block-factor-not-int-constant.upc
new file mode 100644
index 00000000000..9c7dc4629c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/block-factor-not-int-constant.upc
@@ -0,0 +1,10 @@
+/* UPC layout qualifier is not an integral constant.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [0.5] int A[10*THREADS]; /* { dg-error "UPC layout qualifier is not an integral constant" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/cast-int-to-pts.upc b/gcc/testsuite/gcc.dg/gupc/cast-int-to-pts.upc
new file mode 100644
index 00000000000..e5ca67d061b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/cast-int-to-pts.upc
@@ -0,0 +1,16 @@
+/* UPC does not allow casts from an integer to a pointer-to-shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+extern void __putsi2 (upc_shared_ptr_t, int);
+
+
+
+int main (void)
+{
+ shared int *pts = (shared int *)0x400; /* { dg-error "UPC does not allow casts from an integer to a pointer-to-shared" } */
+ *pts = 1;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/cast-local-ptr-to-pts.upc b/gcc/testsuite/gcc.dg/gupc/cast-local-ptr-to-pts.upc
new file mode 100644
index 00000000000..1483893f3fd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/cast-local-ptr-to-pts.upc
@@ -0,0 +1,19 @@
+/* UPC does not allow casts from a local pointer to a pointer-to-shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+extern void __putsi2 (upc_shared_ptr_t, int);
+
+
+
+int x;
+
+int main (void)
+{
+ int *local_ptr = &x;
+ shared int *pts = (shared int *)local_ptr; /* { dg-error "UPC does not allow casts from a local pointer to a pointer-to-shared" } */
+ *pts = 1;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/cmp-pts-and-local-ptr.upc b/gcc/testsuite/gcc.dg/gupc/cmp-pts-and-local-ptr.upc
new file mode 100644
index 00000000000..c30d1f0be2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/cmp-pts-and-local-ptr.upc
@@ -0,0 +1,22 @@
+/* UPC does not allow comparisons between pointers to shared and
+ local pointers.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x;
+shared int v;
+
+shared int *pts;
+int *local_ptr;
+
+int main (void)
+{
+ local_ptr = &x;
+ pts = &v;
+ return pts == local_ptr; /* { dg-error "UPC does not allow comparisons between pointers to shared and local pointers" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-1.upc b/gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-1.upc
new file mode 100644
index 00000000000..5b444fc5f8e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-1.upc
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [10] int *p10;
+
+shared [20] int *p20;
+
+int
+main ()
+{
+ return p10 == p20; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-2.upc b/gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-2.upc
new file mode 100644
index 00000000000..a9a45289329
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-2.upc
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared int *p1;
+
+shared [20] int *p20;
+
+int
+main ()
+{
+ return p1 == p20; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-3.upc b/gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-3.upc
new file mode 100644
index 00000000000..43289a24188
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/cmp-pts-eq-diff-block-factor-3.upc
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [] int *p0;
+
+shared int *p1;
+
+int
+main ()
+{
+ return p0 == p1; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-1.upc b/gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-1.upc
new file mode 100644
index 00000000000..954393dae34
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-1.upc
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [10] int *p10;
+
+shared [20] int *p20;
+
+int
+main ()
+{
+ return p10 > p20; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-2.upc b/gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-2.upc
new file mode 100644
index 00000000000..c8d8b56eb0d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-2.upc
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared int *p1;
+
+shared [20] int *p20;
+
+int
+main ()
+{
+ return p1 > p20; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-3.upc b/gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-3.upc
new file mode 100644
index 00000000000..79b6c7a9a5b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/cmp-pts-gt-diff-block-factor-3.upc
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [] int *p0;
+
+shared int *p1;
+
+int
+main ()
+{
+ return p0 > p1; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/decl-multiple-layout-quals.upc b/gcc/testsuite/gcc.dg/gupc/decl-multiple-layout-quals.upc
new file mode 100644
index 00000000000..50b8cdb3d6d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/decl-multiple-layout-quals.upc
@@ -0,0 +1,10 @@
+/* Two or more layout qualifiers specified.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [10] shared [20] int x[200*THREADS]; /* { dg-error "two or more layout qualifiers specified" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/deprecated-barrier-notify-stmt.upc b/gcc/testsuite/gcc.dg/gupc/deprecated-barrier-notify-stmt.upc
new file mode 100644
index 00000000000..f7ae570a6c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/deprecated-barrier-notify-stmt.upc
@@ -0,0 +1,15 @@
+/* ‘barrier_notify’ was supported in version 1.0 of the UPC specification,
+ it has been deprecated, use ‘upc_notify’ instead.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int main()
+{
+ barrier_notify; /* { dg-error "'barrier_notify' was supported in version 1.0 of the UPC specification, it has been deprecated, use 'upc_notify' instead" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/deprecated-barrier-stmt.upc b/gcc/testsuite/gcc.dg/gupc/deprecated-barrier-stmt.upc
new file mode 100644
index 00000000000..7f9ca435f7a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/deprecated-barrier-stmt.upc
@@ -0,0 +1,15 @@
+/* ‘barrier’ was supported in version 1.0 of the UPC specification,
+ it has been deprecated, use ‘upc_barrier’ instead.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int main()
+{
+ barrier; /* { dg-error "'barrier' was supported in version 1.0 of the UPC specification, it has been deprecated, use 'upc_barrier' instead" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/deprecated-barrier-wait-stmt.upc b/gcc/testsuite/gcc.dg/gupc/deprecated-barrier-wait-stmt.upc
new file mode 100644
index 00000000000..0e031a03b9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/deprecated-barrier-wait-stmt.upc
@@ -0,0 +1,15 @@
+/* ‘barrier_wait’ was supported in version 1.0 of the UPC specification,
+ it has been deprecated, use ‘upc_wait’ instead.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int main()
+{
+ barrier_wait; /* { dg-error "'barrier_wait' was supported in version 1.0 of the UPC specification, it has been deprecated, use 'upc_wait' instead" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/diff-pts-and-local-ptr.upc b/gcc/testsuite/gcc.dg/gupc/diff-pts-and-local-ptr.upc
new file mode 100644
index 00000000000..a9e9e93ff5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/diff-pts-and-local-ptr.upc
@@ -0,0 +1,24 @@
+/* Attempt to take the difference of a UPC pointer-to-shared
+ and a local pointer.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x;
+shared int v;
+
+shared int *pts;
+int *local_ptr;
+int diff;
+
+int main (void)
+{
+ local_ptr = &x;
+ pts = &v;
+ diff = (pts - local_ptr); /* { dg-error "attempt to take the difference of a UPC pointer-to-shared and a local pointer" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/dyn-array-decl-threads-more-than-once.upc b/gcc/testsuite/gcc.dg/gupc/dyn-array-decl-threads-more-than-once.upc
new file mode 100644
index 00000000000..fcfb1962fa2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/dyn-array-decl-threads-more-than-once.upc
@@ -0,0 +1,12 @@
+/* UPC shared array declaration references THREADS
+ more than once; the size cannot be calculated.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[THREADS][THREADS]; /* { dg-error "UPC shared array declaration references THREADS more than once; the size of 'A' cannot be calculated" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/dyn-array-dim-not-simple-multiple-of-threads.upc b/gcc/testsuite/gcc.dg/gupc/dyn-array-dim-not-simple-multiple-of-threads.upc
new file mode 100644
index 00000000000..caa13d5bd6c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/dyn-array-dim-not-simple-multiple-of-threads.upc
@@ -0,0 +1,12 @@
+/* UPC shared array dimension is not a simple multiple
+ of THREADS; the size cannot be calculated.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[10*THREADS + 1]; /* { dg-error "UPC shared array dimension is not a simple multiple of THREADS; the size of 'A' cannot be calculated." } */
diff --git a/gcc/testsuite/gcc.dg/gupc/dyn-star-layout-dim-not-multiple-of-threads.upc b/gcc/testsuite/gcc.dg/gupc/dyn-star-layout-dim-not-multiple-of-threads.upc
new file mode 100644
index 00000000000..f718626c5b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/dyn-star-layout-dim-not-multiple-of-threads.upc
@@ -0,0 +1,14 @@
+/* A UPC layout qualifier of '[*]' requires that
+ the array size is either an integral constant
+ or an integral multiple of THREADS.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [*] int A[THREADS+1]; /* { dg-error "UPC shared array dimension is not a simple multiple of THREADS; the size of 'A' cannot be calculated." } */
+/* { dg-prune-output "a UPC layout qualifier of '\\\[\\*\\\]' requires that the array size is either an integral constant or an integral multiple of THREADS" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/dyn-threads-more-than-once.upc b/gcc/testsuite/gcc.dg/gupc/dyn-threads-more-than-once.upc
new file mode 100644
index 00000000000..4d633196bfe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/dyn-threads-more-than-once.upc
@@ -0,0 +1,14 @@
+/* In the UPC dynamic translation environment,
+ THREADS must appear exactly once in
+ declarations of shared arrays;
+ the storage size cannot be calculated.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[THREADS*THREADS]; /* { dg-error "UPC shared array declaration references THREADS more than once; the size of 'A' cannot be calculated" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/dyn-threads-with-indef-block-size.upc b/gcc/testsuite/gcc.dg/gupc/dyn-threads-with-indef-block-size.upc
new file mode 100644
index 00000000000..94003035acf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/dyn-threads-with-indef-block-size.upc
@@ -0,0 +1,13 @@
+/* In the UPC dynamic translation environment,
+ THREADS may not appear in declarations
+ of shared arrays with indefinite block size;
+ the storage size cannot be calculated.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [] int A[THREADS]; /* { dg-error "in the UPC dynamic translation environment, THREADS may not appear in declarations of shared arrays with indefinite block size; the storage size of 'A' cannot be calculated" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/field-decl-with-shared-qual.upc b/gcc/testsuite/gcc.dg/gupc/field-decl-with-shared-qual.upc
new file mode 100644
index 00000000000..dd6026036f8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/field-decl-with-shared-qual.upc
@@ -0,0 +1,15 @@
+/* Field declared with UPC shared qualifier.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+struct S_struct
+ {
+ int field1;
+ shared double field2; /* { dg-error "field 'field2' declared with UPC shared qualifier" } */
+ char field3;
+ };
diff --git a/gcc/testsuite/gcc.dg/gupc/func-decl-has-shared_qual.upc b/gcc/testsuite/gcc.dg/gupc/func-decl-has-shared_qual.upc
new file mode 100644
index 00000000000..ded292c600a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/func-decl-has-shared_qual.upc
@@ -0,0 +1,13 @@
+/* Function definition has UPC shared qualified return type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int return_shared_int (void) /* { dg-error "function definition has UPC shared qualified return type" } */
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/get-blk-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/get-blk-relaxed.upc
new file mode 100644
index 00000000000..bdb8662bafb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-blk-relaxed.upc
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef struct { unsigned char c[16]; } blk_t;
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern blk_t __getblk3 (void *, upc_shared_ptr_t, size_t);
+
+relaxed shared blk_t x;
+blk_t local_x;
+
+void p () {
+ local_x = x;
+}
+
+/* { dg-final { scan-tree-dump-times "getblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-blk-strict.upc b/gcc/testsuite/gcc.dg/gupc/get-blk-strict.upc
new file mode 100644
index 00000000000..6e5ada2adba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-blk-strict.upc
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef struct { unsigned char c[16]; } blk_t;
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern blk_t __getsblk3 (void *, upc_shared_ptr_t, size_t);
+
+strict shared blk_t x;
+blk_t local_x;
+
+void p () {
+ local_x = x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-df-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/get-df-relaxed.upc
new file mode 100644
index 00000000000..73d9ab56b3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-df-relaxed.upc
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern double __getdf2 (upc_shared_ptr_t);
+
+relaxed shared double x;
+
+double p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getdf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-df-strict.upc b/gcc/testsuite/gcc.dg/gupc/get-df-strict.upc
new file mode 100644
index 00000000000..9d9f572a2bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-df-strict.upc
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern double __getsdf2 (upc_shared_ptr_t);
+
+strict shared double x;
+
+double p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsdf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-di-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/get-di-relaxed.upc
new file mode 100644
index 00000000000..db10c87df03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-di-relaxed.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_di_t __attribute__ ((__mode__(__DI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_di_t __getdi2 (upc_shared_ptr_t);
+
+relaxed shared uint_di_t x;
+
+uint_di_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getdi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-di-strict.upc b/gcc/testsuite/gcc.dg/gupc/get-di-strict.upc
new file mode 100644
index 00000000000..20c89d32d5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-di-strict.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_di_t __attribute__ ((__mode__(__DI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_di_t __getsdi2 (upc_shared_ptr_t);
+
+strict shared uint_di_t x;
+
+uint_di_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsdi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-hi-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/get-hi-relaxed.upc
new file mode 100644
index 00000000000..0372319917c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-hi-relaxed.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_hi_t __attribute__ ((__mode__(__HI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_hi_t __gethi2 (upc_shared_ptr_t);
+
+relaxed shared uint_hi_t x;
+
+uint_hi_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "gethi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-hi-strict.upc b/gcc/testsuite/gcc.dg/gupc/get-hi-strict.upc
new file mode 100644
index 00000000000..ab43e38f1d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-hi-strict.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_hi_t __attribute__ ((__mode__(__HI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_hi_t __getshi2 (upc_shared_ptr_t);
+
+strict shared uint_hi_t x;
+
+uint_hi_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getshi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-qi-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/get-qi-relaxed.upc
new file mode 100644
index 00000000000..3d4f17e637d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-qi-relaxed.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_qi_t __attribute__ ((__mode__(__QI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_qi_t __getqi2 (upc_shared_ptr_t);
+
+relaxed shared uint_qi_t x;
+
+uint_qi_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getqi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-qi-strict.upc b/gcc/testsuite/gcc.dg/gupc/get-qi-strict.upc
new file mode 100644
index 00000000000..d032df0fa65
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-qi-strict.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_qi_t __attribute__ ((__mode__(__QI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_qi_t __getsqi2 (upc_shared_ptr_t);
+
+strict shared uint_qi_t x;
+
+uint_qi_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsqi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-sf-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/get-sf-relaxed.upc
new file mode 100644
index 00000000000..f1128b1b122
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-sf-relaxed.upc
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern float __getsf2 (upc_shared_ptr_t);
+
+relaxed shared float x;
+
+float p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-sf-strict.upc b/gcc/testsuite/gcc.dg/gupc/get-sf-strict.upc
new file mode 100644
index 00000000000..bb85747681e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-sf-strict.upc
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern float __getssf2 (upc_shared_ptr_t);
+
+strict shared float x;
+
+float p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getssf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-si-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/get-si-relaxed.upc
new file mode 100644
index 00000000000..567b204ed34
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-si-relaxed.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_si_t __attribute__ ((__mode__(__SI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_si_t __getsi2 (upc_shared_ptr_t);
+
+relaxed shared uint_si_t x;
+
+uint_si_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-si-strict.upc b/gcc/testsuite/gcc.dg/gupc/get-si-strict.upc
new file mode 100644
index 00000000000..e3c65e15667
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-si-strict.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_si_t __attribute__ ((__mode__(__SI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_si_t __getssi2 (upc_shared_ptr_t);
+
+strict shared uint_si_t x;
+
+uint_si_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getssi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-tf-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/get-tf-relaxed.upc
new file mode 100644
index 00000000000..af5335fa69f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-tf-relaxed.upc
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target longdouble128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern long double __gettf2 (upc_shared_ptr_t);
+extern long double __getxf2 (upc_shared_ptr_t);
+
+relaxed shared long double x;
+
+long double p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "get\[tx\]f2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-tf-strict.upc b/gcc/testsuite/gcc.dg/gupc/get-tf-strict.upc
new file mode 100644
index 00000000000..88204a5371f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-tf-strict.upc
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target longdouble128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern long double __getstf2 (upc_shared_ptr_t);
+extern long double __getsxf2 (upc_shared_ptr_t);
+
+strict shared long double x;
+
+long double p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "gets\[tx\]f2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-ti-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/get-ti-relaxed.upc
new file mode 100644
index 00000000000..227e754b644
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-ti-relaxed.upc
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target int128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_ti_t __attribute__ ((__mode__(__TI__)));
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern uint_ti_t __getblk3 (void *, upc_shared_ptr_t, size_t);
+
+relaxed shared uint_ti_t x;
+
+uint_ti_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/get-ti-strict.upc b/gcc/testsuite/gcc.dg/gupc/get-ti-strict.upc
new file mode 100644
index 00000000000..90e7b7d8f9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/get-ti-strict.upc
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target int128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_ti_t __attribute__ ((__mode__(__TI__)));
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern uint_ti_t __getsblk3 (void *, upc_shared_ptr_t, size_t);
+
+strict shared uint_ti_t x;
+
+uint_ti_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/getaddr.upc b/gcc/testsuite/gcc.dg/gupc/getaddr.upc
new file mode 100644
index 00000000000..5dfa42f741a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/getaddr.upc
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* Runtime API */
+extern void * __getaddr (upc_shared_ptr_t);
+
+shared int *p;
+
+int main () {
+ int *local_p;
+ /* { dg-final { scan-tree-dump-times "local_p = .*__getaddr.* p\\\)" 1 "original" } } */
+ local_p = (void *)p;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/gupc.exp b/gcc/testsuite/gcc.dg/gupc/gupc.exp
new file mode 100644
index 00000000000..00bde298546
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/gupc.exp
@@ -0,0 +1,40 @@
+# Copyright (C) 2006-2016 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/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+if ![check_effective_target_fupc] {
+ return
+}
+
+# For all the test files in the 'gcc.dg/gupc' directory,
+# we only *compile* the programs and must disable the
+# pre-include of gcc-upc.h via -fno-upc-pre-include.
+set upc_flags "-fno-upc-pre-include"
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [find $srcdir/$subdir *.upc]] "$upc_flags" ""
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/gupc/init-makes-pts-from-int.upc b/gcc/testsuite/gcc.dg/gupc/init-makes-pts-from-int.upc
new file mode 100644
index 00000000000..6166af8c68c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/init-makes-pts-from-int.upc
@@ -0,0 +1,18 @@
+/* Initialization attempts to make a UPC pointer-to-shared value
+ from an integer without a cast.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int *p_4000;
+
+int main()
+{
+ shared int *p = 0x4000; /* { dg-error "initialization attempts to make a UPC pointer-to-shared value from an integer without a cast" } */
+ p_4000 = p;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/invalid-local-ptr-to-void-arith.upc b/gcc/testsuite/gcc.dg/gupc/invalid-local-ptr-to-void-arith.upc
new file mode 100644
index 00000000000..676e09e8e42
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/invalid-local-ptr-to-void-arith.upc
@@ -0,0 +1,21 @@
+/* The consensus of the UPC community seems to be that
+ arithmetic on (void *) pointers is a compilation error.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int A[10];
+void *p;
+
+int main()
+{
+ p = (void *)A;
+ p = p + 1; /* { dg-error "pointer of type 'void \\*' used in arithmetic \\\[-Werror=pointer-arith\\\]" } */
+ *((int *)p) = 1;
+ return 0;
+}
+/* { dg-excess-errors "some warnings being treated as errors" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/invalid-sizeof-shared-void.upc b/gcc/testsuite/gcc.dg/gupc/invalid-sizeof-shared-void.upc
new file mode 100644
index 00000000000..40a3f5f21fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/invalid-sizeof-shared-void.upc
@@ -0,0 +1,21 @@
+/* Invalid application of <op> to shared void.
+ (where <op> is sizeof(0) or __alignof())
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[THREADS];
+
+size_t size;
+
+int main()
+{
+ shared void *p = (shared void *)A;
+ size = sizeof (*p); /* { dg-error "invalid application of 'sizeof' to 'shared void' type" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/invalid-sizeof-void.upc b/gcc/testsuite/gcc.dg/gupc/invalid-sizeof-void.upc
new file mode 100644
index 00000000000..67cafdd50a7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/invalid-sizeof-void.upc
@@ -0,0 +1,16 @@
+/* The consensus of the UPC community seems to be that
+ sizeof (void) is a compilation errors.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int main()
+{
+ return sizeof (void); /* { dg-error "invalid application of 'sizeof' to a void type \\\[-Werror=pointer-arith\\\]" } */
+}
+
+/* { dg-excess-errors "some warnings being treated as errors" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/lt-pts-and-local-ptr.upc b/gcc/testsuite/gcc.dg/gupc/lt-pts-and-local-ptr.upc
new file mode 100644
index 00000000000..58d3eb39aa0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/lt-pts-and-local-ptr.upc
@@ -0,0 +1,22 @@
+/* UPC does not allow comparisons between pointers to shared and
+ local pointers.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x;
+shared int v;
+
+shared int *pts;
+int *local_ptr;
+
+int main (void)
+{
+ local_ptr = &x;
+ pts = &v;
+ return pts < local_ptr; /* { dg-error "UPC does not allow comparisons between pointers to shared and local pointers" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/max-block-size-exceeded.upc b/gcc/testsuite/gcc.dg/gupc/max-block-size-exceeded.upc
new file mode 100644
index 00000000000..735ef05a40d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/max-block-size-exceeded.upc
@@ -0,0 +1,10 @@
+/* Maximum UPC block size in this implementation exceeded.
+ { dg-do compile }
+ { dg-options "-fupc-threads=1" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [UPC_MAX_BLOCK_SIZE+1] int A[(UPC_MAX_BLOCK_SIZE+1)*THREADS]; /* { dg-error "the maximum UPC block size in this implementation is \[0-9\]\*" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/no-closing-layout-qual-bracket.upc b/gcc/testsuite/gcc.dg/gupc/no-closing-layout-qual-bracket.upc
new file mode 100644
index 00000000000..cbd60891c0a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/no-closing-layout-qual-bracket.upc
@@ -0,0 +1,11 @@
+/* Expected ] after UPC layout qualifier expression.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [5 int A[5 * THREADS]; /* { dg-error "expected \\\] before 'int'" } */
+
diff --git a/gcc/testsuite/gcc.dg/gupc/parm-decl-with-shared-qual.upc b/gcc/testsuite/gcc.dg/gupc/parm-decl-with-shared-qual.upc
new file mode 100644
index 00000000000..e59f1b3c14e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/parm-decl-with-shared-qual.upc
@@ -0,0 +1,13 @@
+/* Parameter declared with UPC shared qualifier.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int decl_shared_parameter (shared int p) /* { dg-error "parameter declared with UPC shared qualifier" } */
+{
+ return p;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/passing-arg-makes-pts-from-int.upc b/gcc/testsuite/gcc.dg/gupc/passing-arg-makes-pts-from-int.upc
new file mode 100644
index 00000000000..c173c43ddfa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/passing-arg-makes-pts-from-int.upc
@@ -0,0 +1,18 @@
+/* Passing argument attempts to make a UPC pointer-to-shared
+ value from an integer.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+
+extern void proc (shared int *arg);
+
+int main()
+{
+ proc (0x4000); /* { dg-error "passing argument 1 of 'proc' attempts to make a UPC pointer-to-shared value from an integer" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/pts-to-void-in-arith.upc b/gcc/testsuite/gcc.dg/gupc/pts-to-void-in-arith.upc
new file mode 100644
index 00000000000..b0e565aa9a6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/pts-to-void-in-arith.upc
@@ -0,0 +1,23 @@
+/* UPC does not allow a pointer of type `shared void *'
+ to be used in arithmetic.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+extern int MYTHREAD;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[THREADS];
+shared void *pts;
+shared int *pts2;
+size_t diff;
+
+int main()
+{
+ pts = (shared void *)&A[0];
+ pts += (MYTHREAD + 1) % THREADS; /* { dg-error "UPC does not allow a pointer of type 'shared void \\*' to be used in arithmetic" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/put-blk-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/put-blk-relaxed.upc
new file mode 100644
index 00000000000..27530435d5a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-blk-relaxed.upc
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef struct { unsigned char c[16]; } blk_t;
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern void __putblk3 (upc_shared_ptr_t, void *, size_t);
+
+relaxed shared blk_t x;
+blk_t local_x;
+
+void p () {
+ x = local_x;
+}
+
+/* { dg-final { scan-tree-dump-times "putblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-blk-strict.upc b/gcc/testsuite/gcc.dg/gupc/put-blk-strict.upc
new file mode 100644
index 00000000000..13dd6267336
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-blk-strict.upc
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef struct { unsigned char c[16]; } blk_t;
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern void __putsblk3 (upc_shared_ptr_t, void *, size_t);
+
+strict shared blk_t x;
+blk_t local_x;
+
+void p () {
+ x = local_x;
+}
+
+/* { dg-final { scan-tree-dump-times "putsblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-df-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/put-df-relaxed.upc
new file mode 100644
index 00000000000..8e3963e1c89
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-df-relaxed.upc
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putdf2 (upc_shared_ptr_t, double);
+
+relaxed shared double x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putdf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-df-strict.upc b/gcc/testsuite/gcc.dg/gupc/put-df-strict.upc
new file mode 100644
index 00000000000..fc4748e0937
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-df-strict.upc
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putsdf2 (upc_shared_ptr_t, double);
+
+strict shared double x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsdf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-di-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/put-di-relaxed.upc
new file mode 100644
index 00000000000..72bd973e226
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-di-relaxed.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_di_t __attribute__ ((__mode__(__DI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putdi2 (upc_shared_ptr_t, uint_di_t);
+
+relaxed shared uint_di_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putdi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-di-strict.upc b/gcc/testsuite/gcc.dg/gupc/put-di-strict.upc
new file mode 100644
index 00000000000..eafc874635f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-di-strict.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_di_t __attribute__ ((__mode__(__DI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putsdi2 (upc_shared_ptr_t, uint_di_t);
+
+strict shared uint_di_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsdi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-hi-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/put-hi-relaxed.upc
new file mode 100644
index 00000000000..6a304b31fd7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-hi-relaxed.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_hi_t __attribute__ ((__mode__(__HI__)));
+
+/* UPC runtime remote access prototype */
+extern void __puthi2 (upc_shared_ptr_t, uint_hi_t);
+
+relaxed shared uint_hi_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "puthi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-hi-strict.upc b/gcc/testsuite/gcc.dg/gupc/put-hi-strict.upc
new file mode 100644
index 00000000000..9507f93bb08
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-hi-strict.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_hi_t __attribute__ ((__mode__(__HI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putshi2 (upc_shared_ptr_t, uint_hi_t);
+
+strict shared uint_hi_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putshi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-qi-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/put-qi-relaxed.upc
new file mode 100644
index 00000000000..981c763a06c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-qi-relaxed.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_qi_t __attribute__ ((__mode__(__QI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putqi2 (upc_shared_ptr_t, uint_qi_t);
+
+relaxed shared uint_qi_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putqi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-qi-strict.upc b/gcc/testsuite/gcc.dg/gupc/put-qi-strict.upc
new file mode 100644
index 00000000000..a9d3ceb86fd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-qi-strict.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_qi_t __attribute__ ((__mode__(__QI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putsqi2 (upc_shared_ptr_t, uint_qi_t);
+
+strict shared uint_qi_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsqi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-sf-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/put-sf-relaxed.upc
new file mode 100644
index 00000000000..20820828f13
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-sf-relaxed.upc
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putsf2 (upc_shared_ptr_t, float);
+
+relaxed shared float x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-sf-strict.upc b/gcc/testsuite/gcc.dg/gupc/put-sf-strict.upc
new file mode 100644
index 00000000000..1569ec312a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-sf-strict.upc
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putssf2 (upc_shared_ptr_t, float);
+
+strict shared float x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putssf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-si-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/put-si-relaxed.upc
new file mode 100644
index 00000000000..d0549f58b52
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-si-relaxed.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_si_t __attribute__ ((__mode__(__SI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putsi2 (upc_shared_ptr_t, uint_si_t);
+
+relaxed shared uint_si_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-si-strict.upc b/gcc/testsuite/gcc.dg/gupc/put-si-strict.upc
new file mode 100644
index 00000000000..e43016463e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-si-strict.upc
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_si_t __attribute__ ((__mode__(__SI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putssi2 (upc_shared_ptr_t, uint_si_t);
+
+strict shared uint_si_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putssi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-tf-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/put-tf-relaxed.upc
new file mode 100644
index 00000000000..a20b355d1e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-tf-relaxed.upc
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target longdouble128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __puttf2 (upc_shared_ptr_t, long double);
+extern void __putxf2 (upc_shared_ptr_t, long double);
+
+relaxed shared long double x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "put\[tx\]f2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-tf-strict.upc b/gcc/testsuite/gcc.dg/gupc/put-tf-strict.upc
new file mode 100644
index 00000000000..f54a41a4270
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-tf-strict.upc
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target longdouble128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putstf2 (upc_shared_ptr_t, long double);
+extern void __putsxf2 (upc_shared_ptr_t, long double);
+
+strict shared long double x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "puts\[tx\]f2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-ti-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/put-ti-relaxed.upc
new file mode 100644
index 00000000000..664e4dbaba7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-ti-relaxed.upc
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target int128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_ti_t __attribute__ ((__mode__(__TI__)));
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern void __putblk3 (upc_shared_ptr_t, void *, size_t);
+
+relaxed shared uint_ti_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/put-ti-strict.upc b/gcc/testsuite/gcc.dg/gupc/put-ti-strict.upc
new file mode 100644
index 00000000000..ac53893368d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/put-ti-strict.upc
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target int128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_ti_t __attribute__ ((__mode__(__TI__)));
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern void __putsblk3 (upc_shared_ptr_t, void *, size_t);
+
+strict shared uint_ti_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/relaxed-qual-but-not-shared.upc b/gcc/testsuite/gcc.dg/gupc/relaxed-qual-but-not-shared.upc
new file mode 100644
index 00000000000..05c222d324b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/relaxed-qual-but-not-shared.upc
@@ -0,0 +1,11 @@
+/* Variable is declared with UPC relaxed qualifier
+ but not shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+relaxed int x; /* { dg-error "'x' is declared with UPC relaxed qualifier but not shared" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/return-makes-pts-from-int.upc b/gcc/testsuite/gcc.dg/gupc/return-makes-pts-from-int.upc
new file mode 100644
index 00000000000..db39172ae60
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/return-makes-pts-from-int.upc
@@ -0,0 +1,13 @@
+/* Return makes a UPC pointer-to-shared value from an integer.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int *func ()
+{
+ return 0x4000; /* { dg-error "return makes a UPC pointer-to-shared value from an integer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/shared-array-init-unsupported.upc b/gcc/testsuite/gcc.dg/gupc/shared-array-init-unsupported.upc
new file mode 100644
index 00000000000..180f9b7ad48
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/shared-array-init-unsupported.upc
@@ -0,0 +1,10 @@
+/* Initialization of UPC shared arrays is currently not supported.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[3*THREADS] = {1, 2, 3}; /* { dg-error "initialization of UPC shared arrays is currently not supported" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/shared-auto-var-decl.upc b/gcc/testsuite/gcc.dg/gupc/shared-auto-var-decl.upc
new file mode 100644
index 00000000000..d6398e7f9e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/shared-auto-var-decl.upc
@@ -0,0 +1,14 @@
+/* UPC does not support shared auto variables.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int decl_shared_local (int p)
+{
+ shared int x = p; /* { dg-error "UPC does not support shared auto variables" } */
+ return x;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/shared-init-addr.upc b/gcc/testsuite/gcc.dg/gupc/shared-init-addr.upc
new file mode 100644
index 00000000000..656eb9b5c3b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/shared-init-addr.upc
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+/* Runtime API */
+extern void __upc_init_decls (void);
+extern void __putsi2 (upc_shared_ptr_t, int);
+
+shared int x = 10;
+
+shared int *xp = &x;
+
+int main () {
+ return 0;
+}
+/* { dg-final { scan-tree-dump-times "Function __upc_init_decls" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "__putsi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "xp = " 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/gupc/shared-var-both-strict-and-relaxed.upc b/gcc/testsuite/gcc.dg/gupc/shared-var-both-strict-and-relaxed.upc
new file mode 100644
index 00000000000..09c4fc6b633
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/shared-var-both-strict-and-relaxed.upc
@@ -0,0 +1,11 @@
+/* UPC shared variable %qE is declared
+ both strict and relaxed.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared strict relaxed int x; /* { dg-error "UPC shared variable 'x' is declared both strict and relaxed" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/shared-vla-not-allowed.upc b/gcc/testsuite/gcc.dg/gupc/shared-vla-not-allowed.upc
new file mode 100644
index 00000000000..3ed95283685
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/shared-vla-not-allowed.upc
@@ -0,0 +1,15 @@
+/* UPC forbids the declaration of a variable-size shared array.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+void declare_shared_vla (int N)
+{
+ shared int A[N*THREADS]; /* { dg-error "UPC does not support shared auto variables" } */
+ A[0] = 1;
+}
+/* { dg-prune-output "UPC forbids variable-size shared array 'A'" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/star-block-factor-applied-to-incomplete-type.upc b/gcc/testsuite/gcc.dg/gupc/star-block-factor-applied-to-incomplete-type.upc
new file mode 100644
index 00000000000..6f0c2bbaaf9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/star-block-factor-applied-to-incomplete-type.upc
@@ -0,0 +1,11 @@
+/* UPC layout qualifier of the form [*] cannot be
+ applied to an incomplete type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [*] struct s_struct A5_icomplete[5*THREADS]; /* { dg-error "array type has incomplete element type" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/star-block-factor-in-pts-decl.upc b/gcc/testsuite/gcc.dg/gupc/star-block-factor-in-pts-decl.upc
new file mode 100644
index 00000000000..174acb6fd93
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/star-block-factor-in-pts-decl.upc
@@ -0,0 +1,10 @@
+/* UPC [*] qualifier may not be used in declaration of pointers.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [*] int *pts; /* { dg-error "UPC \\\[\\*\\\] qualifier may not be used in declaration of pointers" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/static-threads-val-too-big.upc b/gcc/testsuite/gcc.dg/gupc/static-threads-val-too-big.upc
new file mode 100644
index 00000000000..59570e8d21e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/static-threads-val-too-big.upc
@@ -0,0 +1,12 @@
+/* THREADS value exceeds UPC implementation limit.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2147483647" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+/* Must be compiled with large static value of THREADS. */
+shared int A[THREADS];
+/* { dg-excess-errors "THREADS value exceeds UPC implementation limit of 1024" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/strict-qual-but-not-shared.upc b/gcc/testsuite/gcc.dg/gupc/strict-qual-but-not-shared.upc
new file mode 100644
index 00000000000..adc7c4b2ffb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/strict-qual-but-not-shared.upc
@@ -0,0 +1,11 @@
+/* Variable is declared with UPC strict qualifier
+ but not shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+strict int x; /* { dg-error "'x' is declared with UPC strict qualifier but not shared" } */
diff --git a/gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-func-type.upc b/gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-func-type.upc
new file mode 100644
index 00000000000..2722d6acc9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-func-type.upc
@@ -0,0 +1,20 @@
+/* UPC operator applied to a function type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+
+void func(void) {}
+
+size_t s;
+
+int main()
+{
+ s = upc_blocksizeof (func); /* { dg-error "UPC operator upc_blocksizeof applied to a function type" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-non-shared-type.upc b/gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-non-shared-type.upc
new file mode 100644
index 00000000000..122cb51c059
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-non-shared-type.upc
@@ -0,0 +1,18 @@
+/* UPC operator applied to a non-shared type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x[10];
+size_t s;
+
+int main()
+{
+ s = upc_blocksizeof (x); /* { dg-error "UPC operator upc_blocksizeof applied to a non-shared type" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-void-type.upc b/gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-void-type.upc
new file mode 100644
index 00000000000..3f8240ce233
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/upc-blocksizeof-void-type.upc
@@ -0,0 +1,19 @@
+/* UPC operator applied to a void type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+void *p;
+size_t s;
+
+
+int main()
+{
+ s = upc_blocksizeof (*p); /* { dg-error "invalid use of void expression" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-func-type.upc b/gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-func-type.upc
new file mode 100644
index 00000000000..681af337347
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-func-type.upc
@@ -0,0 +1,20 @@
+/* UPC operator applied to a function type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+
+void func(void) {}
+
+size_t s;
+
+int main()
+{
+ s = upc_elemsizeof (func); /* { dg-error "UPC operator upc_elemsizeof applied to a function type" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-non-shared-type.upc b/gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-non-shared-type.upc
new file mode 100644
index 00000000000..5cdf8951f96
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-non-shared-type.upc
@@ -0,0 +1,18 @@
+/* UPC operator applied to a non-shared type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x[10];
+size_t s;
+
+int main()
+{
+ s = upc_elemsizeof (x); /* { dg-error "UPC operator upc_elemsizeof applied to a non-shared type" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-void-type.upc b/gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-void-type.upc
new file mode 100644
index 00000000000..3c1ee6ce5a7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/upc-elemsizeof-void-type.upc
@@ -0,0 +1,19 @@
+/* UPC operator applied to a void type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+void *p;
+size_t s;
+
+
+int main()
+{
+ s = upc_elemsizeof (*p); /* { dg-error "invalid use of void expression" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/upc-localsizeof-func-type.upc b/gcc/testsuite/gcc.dg/gupc/upc-localsizeof-func-type.upc
new file mode 100644
index 00000000000..7b948b7746b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/upc-localsizeof-func-type.upc
@@ -0,0 +1,20 @@
+/* UPC operator applied to a function type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+
+void func(void) {}
+
+size_t s;
+
+int main()
+{
+ s = upc_localsizeof (func); /* { dg-error "UPC operator upc_localsizeof applied to a function type" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/upc-localsizeof-non-shared-type.upc b/gcc/testsuite/gcc.dg/gupc/upc-localsizeof-non-shared-type.upc
new file mode 100644
index 00000000000..bf7c70e33cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/upc-localsizeof-non-shared-type.upc
@@ -0,0 +1,18 @@
+/* UPC operator applied to a non-shared type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x[10];
+size_t s;
+
+int main()
+{
+ s = upc_localsizeof (x); /* { dg-error "UPC operator upc_localsizeof applied to a non-shared type" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/upc-localsizeof-void-type.upc b/gcc/testsuite/gcc.dg/gupc/upc-localsizeof-void-type.upc
new file mode 100644
index 00000000000..416c7b7d5af
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/upc-localsizeof-void-type.upc
@@ -0,0 +1,19 @@
+/* UPC operator applied to a void type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+void *p;
+size_t s;
+
+
+int main()
+{
+ s = upc_localsizeof (*p); /* { dg-error "invalid use of void expression" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gupc/warn-junk-at-end-pragma-upc.upc b/gcc/testsuite/gcc.dg/gupc/warn-junk-at-end-pragma-upc.upc
new file mode 100644
index 00000000000..40bed6fad35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/warn-junk-at-end-pragma-upc.upc
@@ -0,0 +1,12 @@
+/* Warning: junk at end of #pragma upc.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+#pragma upc strict junk /* { dg-warning "junk at end of #pragma upc \\\[-Wpragmas\\\]" } */
+shared int x;
+
diff --git a/gcc/testsuite/gcc.dg/gupc/warn-missing-param-after-pragma-upc.upc b/gcc/testsuite/gcc.dg/gupc/warn-missing-param-after-pragma-upc.upc
new file mode 100644
index 00000000000..060be9c1c02
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/warn-missing-param-after-pragma-upc.upc
@@ -0,0 +1,12 @@
+/* Warning: missing parameter after #pragma upc.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+#pragma upc /* { dg-warning "missing parameter after #pragma upc \\\[-Wpragmas\\\]" } */
+shared int x;
+
diff --git a/gcc/testsuite/gcc.dg/gupc/warn-pragma-upc-bad-context.upc b/gcc/testsuite/gcc.dg/gupc/warn-pragma-upc-bad-context.upc
new file mode 100644
index 00000000000..9bffc344e2e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gupc/warn-pragma-upc-bad-context.upc
@@ -0,0 +1,22 @@
+/* Warning: #pragma upc not allowed in this context.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+extern void __putsi2 (upc_shared_ptr_t, int);
+
+
+shared int v;
+
+shared int *pts;
+
+int main (void)
+{
+ pts = &v;
+ /* pragma upc must appear contextually as first token
+ after opening brace. Invalid here. */
+ #pragma upc strict /* { dg-warning "#pragma upc not allowed in this context \\\[-Wpragmas\\\]" } */
+ *pts = 1;
+ return 0;
+}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 6d9b4882173..9310242abf4 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -876,6 +876,15 @@ proc check_effective_target_fopenmp {} {
} "-fopenmp"]
}
+# Return 1 if compilation with -fupc is error-free for trivial
+# code, 0 otherwise.
+
+proc check_effective_target_fupc {} {
+ return [check_no_compiler_messages fupc object {
+ void foo (void) { }
+ } "-fupc -fno-upc-pre-include"]
+}
+
# Return 1 if compilation with -fgnu-tm is error-free for trivial
# code, 0 otherwise.
@@ -6212,6 +6221,33 @@ proc add_options_for_double_vectors { flags } {
return $flags
}
+# Add to FLAGS the flags needed to disable inlining of
+# UPC run-time access routines.
+
+proc add_options_for_upc_library_calls { flags } {
+ return "$flags -fno-upc-inline-lib"
+}
+
+# Check if UPC struct pts build
+
+proc check_effective_target_upc_struct_pts { } {
+ return [check_no_compiler_messages upc_struct_pts object {
+ #ifndef __UPC_PTS_STRUCT_REP__
+ # error struct PTS is not supported
+ #endif
+ } "-fupc -fno-upc-pre-include" ]
+}
+
+# Check if UPC packed pts build
+
+proc check_effective_target_upc_packed_pts { } {
+ return [check_no_compiler_messages upc_packed_pts object {
+ #ifndef __UPC_PTS_PACKED_REP__
+ # error packed PTS is not supported
+ #endif
+ } "-fupc -fno-upc-pre-include" ]
+}
+
# Return 1 if the target provides a full C99 runtime.
proc check_effective_target_c99_runtime { } {
diff --git a/gcc/timevar.def b/gcc/timevar.def
index 76b008ec9c1..12a135c130c 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -142,6 +142,7 @@ DEFTIMEVAR (TV_EARLY_INLINING , "early inlining heuristics")
DEFTIMEVAR (TV_INLINE_PARAMETERS , "inline parameters")
DEFTIMEVAR (TV_INTEGRATION , "integration")
DEFTIMEVAR (TV_TREE_GIMPLIFY , "tree gimplify")
+DEFTIMEVAR (TV_TREE_UPC_GENERICIZE , "tree UPC genericize")
DEFTIMEVAR (TV_TREE_EH , "tree eh")
DEFTIMEVAR (TV_TREE_CFG , "tree CFG construction")
DEFTIMEVAR (TV_TREE_CLEANUP_CFG , "tree CFG cleanup")
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 41c1a9bd329..0a6480e073d 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -503,7 +503,11 @@ enum cv_qualifier {
TYPE_QUAL_CONST = 0x1,
TYPE_QUAL_VOLATILE = 0x2,
TYPE_QUAL_RESTRICT = 0x4,
- TYPE_QUAL_ATOMIC = 0x8
+ TYPE_QUAL_ATOMIC = 0x8,
+ /* UPC qualifiers */
+ TYPE_QUAL_SHARED = 0x10,
+ TYPE_QUAL_RELAXED = 0x20,
+ TYPE_QUAL_STRICT = 0x40
};
/* Standard named or nameless data types of the C compiler. */
@@ -580,6 +584,14 @@ enum tree_index {
TI_FILEPTR_TYPE,
TI_POINTER_SIZED_TYPE,
+ TI_UPC_PTS_TYPE,
+ TI_UPC_PTS_REP_TYPE,
+ TI_UPC_CHAR_PTS_TYPE,
+ TI_UPC_PHASE_FIELD,
+ TI_UPC_THREAD_FIELD,
+ TI_UPC_VADDR_FIELD,
+ TI_UPC_NULL_PTS,
+
TI_POINTER_BOUNDS_TYPE,
TI_DFLOAT32_TYPE,
@@ -882,9 +894,14 @@ struct GTY(()) tree_base {
unsigned user_align : 1;
unsigned nameless_flag : 1;
unsigned atomic_flag : 1;
- unsigned spare0 : 3;
-
- unsigned spare1 : 8;
+ unsigned shared_flag : 1;
+ unsigned strict_flag : 1;
+ unsigned relaxed_flag : 1;
+
+ unsigned threads_factor_flag : 1;
+ unsigned block_factor_0 : 1;
+ unsigned block_factor_x : 1;
+ unsigned spare1 : 5;
/* This field is only used with TREE_TYPE nodes; the only reason it is
present in tree_base instead of tree_type is to save space. The size
diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c
index 05228a0afe1..7f9b6c34958 100644
--- a/gcc/tree-dump.c
+++ b/gcc/tree-dump.c
@@ -387,10 +387,13 @@ dequeue_and_dump (dump_info_p di)
if (quals != TYPE_UNQUALIFIED)
{
- fprintf (di->stream, "qual: %c%c%c ",
+ fprintf (di->stream, "qual: %c%c%c%c%c%c ",
(quals & TYPE_QUAL_CONST) ? 'c' : ' ',
(quals & TYPE_QUAL_VOLATILE) ? 'v' : ' ',
- (quals & TYPE_QUAL_RESTRICT) ? 'r' : ' ');
+ (quals & TYPE_QUAL_RESTRICT) ? 'r' : ' ',
+ (quals & TYPE_QUAL_SHARED) ? 's' : ' ',
+ (quals & TYPE_QUAL_STRICT) ? 't' : ' ',
+ (quals & TYPE_QUAL_RELAXED) ? 'x' : ' ');
di->column += 14;
}
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index c393d34b5ec..d3832841232 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1196,6 +1196,27 @@ dump_block_node (pretty_printer *pp, tree block, int spc, int flags)
}
}
+/* Dump UPC type qualifiers ("shared", "strict", "relaxed"),
+ and the "layout qualifier" (blocking factor), if present. */
+
+static void
+dump_upc_type_quals (pretty_printer *buffer, tree type, int quals)
+{
+ gcc_assert (type && TYPE_CHECK (type));
+ gcc_assert (quals & TYPE_QUAL_SHARED);
+ if (quals & TYPE_QUAL_STRICT)
+ pp_string (buffer, "strict ");
+ if (quals & TYPE_QUAL_RELAXED)
+ pp_string (buffer, "relaxed ");
+ pp_string (buffer, "shared ");
+ if (TYPE_HAS_BLOCK_FACTOR (type))
+ {
+ tree block_factor = TYPE_BLOCK_FACTOR (type);
+ pp_string (buffer, "[");
+ pp_wide_integer (buffer, TREE_INT_CST_LOW (block_factor));
+ pp_string (buffer, "] ");
+ }
+}
/* Dump the node NODE on the pretty_printer PP, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
@@ -1296,6 +1317,8 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
pp_string (pp, "volatile ");
else if (quals & TYPE_QUAL_RESTRICT)
pp_string (pp, "restrict ");
+ else if (quals & TYPE_QUAL_SHARED)
+ dump_upc_type_quals (pp, node, quals);
if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
{
@@ -1438,6 +1461,14 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
pp_string (pp, " volatile");
if (quals & TYPE_QUAL_RESTRICT)
pp_string (pp, " restrict");
+ if (quals & TYPE_QUAL_SHARED)
+ {
+ if (quals & TYPE_QUAL_STRICT)
+ pp_string (pp, " strict");
+ if (quals & TYPE_QUAL_RELAXED)
+ pp_string (pp, " relaxed");
+ pp_string (pp, " shared");
+ }
if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
{
@@ -1607,6 +1638,8 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
pp_string (pp, "const ");
if (quals & TYPE_QUAL_VOLATILE)
pp_string (pp, "volatile ");
+ if (quals & TYPE_QUAL_SHARED)
+ dump_upc_type_quals (pp, node, quals);
/* Print the name of the structure. */
if (TREE_CODE (node) == RECORD_TYPE)
@@ -1614,7 +1647,12 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
else if (TREE_CODE (node) == UNION_TYPE)
pp_string (pp, "union ");
- if (TYPE_NAME (node))
+ if (upc_pts_rep_type_node && node == upc_pts_rep_type_node)
+ /* Normally, builtin types will not be printed.
+ We short-circuit that check for the UPC "struct PTS"
+ representation type. */
+ pp_string (pp, "upc_shared_ptr_t");
+ else if (TYPE_NAME (node))
dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
else if (!(flags & TDF_SLIM))
/* FIXME: If we eliminate the 'else' above and attempt
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 2808875e4be..8d42e06b7db 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3985,6 +3985,7 @@ find_param_candidates (void)
if (TREE_CODE (type) == FUNCTION_TYPE
|| TYPE_VOLATILE (type)
+ || SHARED_TYPE_P (type)
|| (TREE_CODE (type) == ARRAY_TYPE
&& TYPE_NONALIASED_COMPONENT (type))
|| !is_gimple_reg (parm)
diff --git a/gcc/tree.c b/gcc/tree.c
index 1b472cc0560..57587cc0152 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -243,7 +243,23 @@ struct tree_vec_map_cache_hasher : ggc_cache_ptr_hash<tree_vec_map>
static GTY ((cache))
hash_table<tree_vec_map_cache_hasher> *debug_args_for_decl;
-static void set_type_quals (tree, int);
+struct tm_block_factor_hasher : ggc_cache_ptr_hash<tree_map>
+{
+ static hashval_t hash (tree_map *m) { return tree_map_hash (m); }
+ static bool equal (tree_map *a, tree_map *b) { return tree_map_eq (a, b); }
+
+ static int
+ keep_cache_entry (tree_map *&e)
+ {
+ return ggc_marked_p (e->base.from);
+ }
+};
+
+/* Hash table for block factor lookups when the block factor
+ is not 0 (the indefinite block factor) or 1 (the default). */
+static GTY((cache)) hash_table<tm_block_factor_hasher> *block_factor_htab;
+
+static void set_type_quals (tree, int, tree);
static void print_type_hash_statistics (void);
static void print_debug_expr_statistics (void);
static void print_value_expr_statistics (void);
@@ -639,6 +655,9 @@ init_ttree (void)
type_hash_table
= hash_table<type_cache_hasher>::create_ggc (TYPE_HASH_INITIAL_SIZE);
+ /* Initialize hash table used to manage blocking factors. */
+ block_factor_lookup_init ();
+
debug_expr_for_decl
= hash_table<tree_decl_map_cache_hasher>::create_ggc (512);
@@ -1197,6 +1216,9 @@ copy_node_stat (tree node MEM_STAT_DECL)
TYPE_CACHED_VALUES_P (t) = 0;
TYPE_CACHED_VALUES (t) = NULL_TREE;
}
+
+ if (TYPE_HAS_BLOCK_FACTOR (node))
+ SET_TYPE_BLOCK_FACTOR (t, TYPE_BLOCK_FACTOR (node));
}
else if (code == TARGET_OPTION_NODE)
{
@@ -2963,6 +2985,18 @@ size_in_bytes (const_tree type)
return t;
}
+/* Returns a tree for the size of EXP in bytes. */
+
+tree
+tree_expr_size (const_tree exp)
+{
+ if (DECL_P (exp)
+ && DECL_SIZE_UNIT (exp) != 0)
+ return DECL_SIZE_UNIT (exp);
+ else
+ return size_in_bytes (TREE_TYPE (exp));
+}
+
/* Return the size of TYPE (in bytes) as a wide integer
or return -1 if the size can vary or is larger than an integer. */
@@ -4185,6 +4219,9 @@ stabilize_reference_1 (tree e)
TREE_READONLY (result) = TREE_READONLY (e);
TREE_SIDE_EFFECTS (result) = TREE_SIDE_EFFECTS (e);
TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e);
+ TREE_SHARED (result) = TREE_SHARED (e);
+ TREE_STRICT (result) = TREE_STRICT (e);
+ TREE_RELAXED (result) = TREE_RELAXED (e);
return result;
}
@@ -4268,6 +4305,9 @@ stabilize_reference (tree ref)
TREE_READONLY (result) = TREE_READONLY (ref);
TREE_SIDE_EFFECTS (result) = TREE_SIDE_EFFECTS (ref);
TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (ref);
+ TREE_SHARED (result) = TREE_SHARED (ref);
+ TREE_STRICT (result) = TREE_STRICT (ref);
+ TREE_RELAXED (result) = TREE_RELAXED (ref);
return result;
}
@@ -4411,6 +4451,7 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
/* Whether a dereference is readonly has nothing to do with whether
its operand is readonly. */
TREE_READONLY (t) = 0;
+ TREE_SHARED (t) = SHARED_TYPE_P (type);
break;
case ADDR_EXPR:
@@ -4426,6 +4467,12 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
if (TREE_CODE_CLASS (code) == tcc_reference
&& node && TREE_THIS_VOLATILE (node))
TREE_THIS_VOLATILE (t) = 1;
+ /* Drop the "shared" type qualifier for
+ expressions involving shared objects. */
+ if (TREE_CODE_CLASS (code) == tcc_unary
+ && node && !TYPE_P (node)
+ && SHARED_TYPE_P (type))
+ TREE_TYPE (t) = build_unshared_type (type);
break;
}
@@ -4469,6 +4516,10 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
&& ptrofftype_p (TREE_TYPE (arg1)));
t = make_node_stat (code PASS_MEM_STAT);
+
+ /* Remove shared type qualifiers from the result type. */
+ if (SHARED_TYPE_P (tt))
+ tt = build_unshared_type (tt);
TREE_TYPE (t) = tt;
/* Below, we automatically set TREE_SIDE_EFFECTS and TREE_READONLY for the
@@ -4546,6 +4597,14 @@ build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
TREE_THIS_VOLATILE (t)
= (TREE_CODE_CLASS (code) == tcc_reference
&& arg0 && TREE_THIS_VOLATILE (arg0));
+ TREE_SHARED (t)
+ = (TREE_CODE_CLASS (code) == tcc_reference
+ && arg0 && TREE_SHARED (arg0));
+ if (TREE_SHARED (t))
+ {
+ TREE_STRICT (t) = TREE_STRICT (arg0);
+ TREE_RELAXED (t) = TREE_RELAXED (arg0);
+ }
return t;
}
@@ -6506,16 +6565,22 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
#endif /* TARGET_DLLIMPORT_DECL_ATTRIBUTES */
/* Set the type qualifiers for TYPE to TYPE_QUALS, which is a bitmask
- of the various TYPE_QUAL values. */
+ of the various TYPE_QUAL values. Also, set the blocking factor,
+ which is either null or a reference to an integral constant. */
static void
-set_type_quals (tree type, int type_quals)
+set_type_quals (tree type, int type_quals, tree block_factor)
{
TYPE_READONLY (type) = (type_quals & TYPE_QUAL_CONST) != 0;
TYPE_VOLATILE (type) = (type_quals & TYPE_QUAL_VOLATILE) != 0;
TYPE_RESTRICT (type) = (type_quals & TYPE_QUAL_RESTRICT) != 0;
TYPE_ATOMIC (type) = (type_quals & TYPE_QUAL_ATOMIC) != 0;
TYPE_ADDR_SPACE (type) = DECODE_QUAL_ADDR_SPACE (type_quals);
+ TYPE_SHARED (type) = (type_quals & TYPE_QUAL_SHARED) != 0;
+ TYPE_STRICT (type) = (type_quals & TYPE_QUAL_STRICT) != 0;
+ TYPE_RELAXED (type) = (type_quals & TYPE_QUAL_RELAXED) != 0;
+ if (TYPE_SHARED (type))
+ SET_TYPE_BLOCK_FACTOR (type, block_factor);
}
/* Returns true iff unqualified CAND and BASE are equivalent. */
@@ -6532,12 +6597,16 @@ check_base_type (const_tree cand, const_tree base)
TYPE_ATTRIBUTES (base)));
}
-/* Returns true iff CAND is equivalent to BASE with TYPE_QUALS. */
+/* Returns true iff CAND is equivalent to BASE with TYPE_QUALS
+ and BLOCK_FACTOR.
+ BLOCK_FACTOR is null, unless compiling UPC. */
bool
-check_qualified_type (const_tree cand, const_tree base, int type_quals)
+check_qualified_type (const_tree cand, const_tree base,
+ int type_quals, tree block_factor)
{
return (TYPE_QUALS (cand) == type_quals
+ && TYPE_BLOCK_FACTOR (cand) == block_factor
&& check_base_type (cand, base));
}
@@ -6547,6 +6616,8 @@ static bool
check_aligned_type (const_tree cand, const_tree base, unsigned int align)
{
return (TYPE_QUALS (cand) == TYPE_QUALS (base)
+ /* TYPE_BLOCK_FACTOR() is null, unless compiling UPC. */
+ && TYPE_BLOCK_FACTOR (cand) == TYPE_BLOCK_FACTOR (base)
&& TYPE_NAME (cand) == TYPE_NAME (base)
/* Apparently this is needed for Objective-C. */
&& TYPE_CONTEXT (cand) == TYPE_CONTEXT (base)
@@ -6599,11 +6670,12 @@ find_atomic_core_type (tree type)
}
/* Return a version of the TYPE, qualified as indicated by the
- TYPE_QUALS, if one exists. If no qualified version exists yet,
- return NULL_TREE. */
+ TYPE_QUALS, and BLOCK_FACTOR if one exists.
+ BLOCK_FACTOR is null, unless compiling UPC.
+ If no qualified version exists yet, return NULL_TREE. */
tree
-get_qualified_type (tree type, int type_quals)
+get_qualified_type (tree type, int type_quals, tree block_factor)
{
tree t;
@@ -6614,28 +6686,30 @@ get_qualified_type (tree type, int type_quals)
like the one we need to have. If so, use that existing one. We must
preserve the TYPE_NAME, since there is code that depends on this. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
- if (check_qualified_type (t, type, type_quals))
+ if (check_qualified_type (t, type, type_quals, block_factor))
return t;
return NULL_TREE;
}
/* Like get_qualified_type, but creates the type if it does not
- exist. This function never returns NULL_TREE. */
+ exist. This function never returns NULL_TREE.
+ BLOCK_FACTOR is null, unless compiling UPC. */
tree
-build_qualified_type (tree type, int type_quals)
+build_qualified_type (tree type, int type_quals,
+ tree block_factor)
{
tree t;
/* See if we already have the appropriate qualified variant. */
- t = get_qualified_type (type, type_quals);
+ t = get_qualified_type (type, type_quals, block_factor);
/* If not, build it. */
if (!t)
{
t = build_variant_type_copy (type);
- set_type_quals (t, type_quals);
+ set_type_quals (t, type_quals, block_factor);
if (((type_quals & TYPE_QUAL_ATOMIC) == TYPE_QUAL_ATOMIC))
{
@@ -7976,6 +8050,16 @@ build_pointer_type (tree to_type)
addr_space_t as = to_type == error_mark_node? ADDR_SPACE_GENERIC
: TYPE_ADDR_SPACE (to_type);
machine_mode pointer_mode = targetm.addr_space.pointer_mode (as);
+ if (SHARED_TYPE_P (to_type))
+ {
+ tree upc_pts_type;
+ pointer_mode = TYPE_MODE (upc_pts_rep_type_node);
+ upc_pts_type = build_pointer_type_for_mode (to_type, pointer_mode,
+ false);
+ TYPE_USER_ALIGN (upc_pts_type) = TYPE_USER_ALIGN (upc_pts_rep_type_node);
+ TYPE_ALIGN (upc_pts_type) = TYPE_ALIGN (upc_pts_rep_type_node);
+ return upc_pts_type;
+ }
return build_pointer_type_for_mode (to_type, pointer_mode, false);
}
@@ -10033,7 +10117,7 @@ build_atomic_base (tree type, unsigned int align)
return t;
t = build_variant_type_copy (type);
- set_type_quals (t, TYPE_QUAL_ATOMIC);
+ set_type_quals (t, TYPE_QUAL_ATOMIC, NULL_TREE);
if (align)
TYPE_ALIGN (t) = align;
@@ -12260,6 +12344,7 @@ static inline bool
tree_nop_conversion (const_tree exp)
{
tree outer_type, inner_type;
+ int outer_is_pts_p, inner_is_pts_p;
if (!CONVERT_EXPR_P (exp)
&& TREE_CODE (exp) != NON_LVALUE_EXPR)
@@ -12273,6 +12358,22 @@ tree_nop_conversion (const_tree exp)
if (!inner_type)
return false;
+ outer_is_pts_p = (POINTER_TYPE_P (outer_type)
+ && SHARED_TYPE_P (TREE_TYPE (outer_type)));
+ inner_is_pts_p = (POINTER_TYPE_P (inner_type)
+ && SHARED_TYPE_P (TREE_TYPE (inner_type)));
+
+ /* Pointer-to-shared types have special
+ equivalence rules that must be checked. */
+ if (outer_is_pts_p && inner_is_pts_p
+ && lang_hooks.types_compatible_p)
+ return lang_hooks.types_compatible_p (outer_type, inner_type);
+
+ /* Pointer-to-shared types are not interchangeable
+ with integral types. */
+ if (outer_is_pts_p || inner_is_pts_p)
+ return false;
+
return tree_nop_conversion_p (outer_type, inner_type);
}
@@ -13975,6 +14076,106 @@ nonnull_arg_p (const_tree arg)
return false;
}
+/* Return the blocking factor of the shared type, TYPE.
+ If the blocking factor is NULL, then return the default blocking
+ factor of 1. */
+
+tree
+get_block_factor (const tree type)
+{
+ tree block_factor = size_one_node;
+ const tree elt_type = strip_array_types (type);
+ if (elt_type && (TREE_CODE (elt_type) != ERROR_MARK)
+ && TYPE_HAS_BLOCK_FACTOR (elt_type))
+ block_factor = TYPE_BLOCK_FACTOR (elt_type);
+ return block_factor;
+}
+
+/* Return a variant of TYPE, where the shared, strict, and relaxed
+ qualifiers have been removed. */
+
+tree
+build_unshared_type (tree type)
+{
+ tree u_type = type;
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ const tree elem_type = TREE_TYPE(type);
+ const tree u_elem_type = build_unshared_type (elem_type);
+ if (u_elem_type != elem_type)
+ {
+ for (u_type = TYPE_MAIN_VARIANT (type);
+ u_type && TREE_TYPE(u_type) != u_elem_type;
+ u_type = TYPE_NEXT_VARIANT (u_type)) /* loop */;
+ if (!u_type)
+ {
+ u_type = build_variant_type_copy (type);
+ TREE_TYPE (u_type) = u_elem_type;
+ }
+ }
+ }
+ else
+ {
+ const int quals = TYPE_QUALS (type);
+ const int u_quals = quals & ~(TYPE_QUAL_SHARED
+ | TYPE_QUAL_RELAXED
+ | TYPE_QUAL_STRICT);
+ u_type = build_qualified_type (type, u_quals);
+ }
+ return u_type;
+}
+
+/* Lookup the block size of TYPE, and return it if we find one. */
+
+tree
+block_factor_lookup (const_tree type)
+{
+ struct tree_map in;
+ union
+ {
+ const_tree ct;
+ tree t;
+ } ct_to_t;
+ ct_to_t.ct = type;
+ /* Drop the const qualifier, avoid the warning. */
+ in.base.from = ct_to_t.t;
+ in.hash = TYPE_HASH (in.base.from);
+ struct tree_map **loc = block_factor_htab->
+ find_slot_with_hash (&in, in.hash, NO_INSERT);
+ gcc_assert (loc != NULL);
+ struct tree_map *h = *loc;
+ if (h)
+ return h->to;
+ return NULL_TREE;
+}
+
+/* Insert a mapping TYPE->BLOCK_FACTOR in the block factor hashtable. */
+
+void
+block_factor_insert (tree type, tree block_factor)
+{
+
+ gcc_assert (type && TYPE_P (type));
+ gcc_assert (block_factor && INTEGRAL_TYPE_P (TREE_TYPE (block_factor)));
+ gcc_assert (!(integer_zerop (block_factor) || integer_onep (block_factor)));
+ tree_map *h = ggc_alloc<tree_map> ();
+ h->base.from = type;
+ h->hash = TYPE_HASH (type);
+ h->to = block_factor;
+ tree_map **loc = block_factor_htab->
+ find_slot_with_hash (h, h->hash, INSERT);
+ *loc = h;
+}
+
+/* Create the hash table that maps a tree node to its corresponding
+ UPC "layout qualifier" (blocking factor). */
+
+void
+block_factor_lookup_init (void)
+{
+ block_factor_htab = hash_table<tm_block_factor_hasher>::create_ggc (17);
+}
+
/* Given location LOC, strip away any packed range information
or ad-hoc information. */
diff --git a/gcc/tree.h b/gcc/tree.h
index c39b58e1a6d..1dad7f9874a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -636,6 +636,24 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
#define FUNC_OR_METHOD_TYPE_P(NODE) \
(TREE_CODE (NODE) == FUNCTION_TYPE || TREE_CODE (NODE) == METHOD_TYPE)
+/* Return TRUE if TYPE is a shared type. For arrays,
+ the element type must be queried, because array types
+ are never qualified. */
+#define SHARED_TYPE_P(TYPE) \
+ ((TYPE) && TYPE_P (TYPE) \
+ && TYPE_SHARED ((TREE_CODE (TYPE) != ARRAY_TYPE \
+ ? (TYPE) : strip_array_types (TYPE))))
+
+/* Return TRUE if EXP is a conversion operation involving
+ pointers-to-shared. If either of the types involved
+ in the conversion is a pointer-to-shared type, return TRUE. */
+#define PTS_CVT_OP_P(EXP) \
+ ((EXP) && ((POINTER_TYPE_P (TREE_TYPE (EXP)) \
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (EXP, 0)))) \
+ && (SHARED_TYPE_P (TREE_TYPE (TREE_TYPE (EXP))) \
+ || SHARED_TYPE_P (TREE_TYPE ( \
+ TREE_TYPE (TREE_OPERAND (EXP, 0)))))))
+
/* Define many boolean fields that all tree nodes have. */
/* In VAR_DECL, PARM_DECL and RESULT_DECL nodes, nonzero means address
@@ -812,6 +830,14 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
#define DECL_UNSIGNED(NODE) \
(DECL_COMMON_CHECK (NODE)->base.u.bits.unsigned_flag)
+/* Convert tree flags to type qualifiers. */
+#define TREE_QUALS(NODE) \
+ ((TREE_READONLY(NODE) * TYPE_QUAL_CONST) | \
+ (TREE_THIS_VOLATILE(NODE) * TYPE_QUAL_VOLATILE) | \
+ (TREE_SHARED(NODE) * TYPE_QUAL_SHARED) | \
+ (TREE_STRICT(NODE) * TYPE_QUAL_STRICT) | \
+ (TREE_RELAXED(NODE) * TYPE_QUAL_RELAXED))
+
/* In integral and pointer types, means an unsigned type. */
#define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->base.u.bits.unsigned_flag)
@@ -941,6 +967,11 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
#define IDENTIFIER_TRANSPARENT_ALIAS(NODE) \
(IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag)
+/* Shared, strict, and relaxed common tree flags */
+#define TREE_SHARED(NODE) ((NODE)->base.u.bits.shared_flag)
+#define TREE_STRICT(NODE) ((NODE)->base.u.bits.strict_flag)
+#define TREE_RELAXED(NODE) ((NODE)->base.u.bits.relaxed_flag)
+
/* In an aggregate type, indicates that the scalar fields of the type are
stored in reverse order from the target order. This effectively
toggles BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN within the type. */
@@ -1903,6 +1934,21 @@ extern machine_mode element_mode (const_tree t);
the term. */
#define TYPE_RESTRICT(NODE) (TYPE_CHECK (NODE)->type_common.restrict_flag)
+/* If nonzero, this type is `shared'-qualified, in the UPC dialect */
+#define TYPE_SHARED(NODE) (TYPE_CHECK (NODE)->base.u.bits.shared_flag)
+
+/* If nonzero, this type is `strict'-qualified, in the UPC dialect */
+#define TYPE_STRICT(NODE) (TYPE_CHECK (NODE)->base.u.bits.strict_flag)
+
+/* If nonzero, this type is `relaxed'-qualified, in the UPC dialect */
+#define TYPE_RELAXED(NODE) \
+ (TYPE_CHECK (NODE)->base.u.bits.relaxed_flag)
+
+/* Record that we are processing a UPC shared array declaration
+ or type definition that refers to THREADS in its array dimension.*/
+#define TYPE_HAS_THREADS_FACTOR(NODE) \
+ (TYPE_CHECK (NODE)->base.u.bits.threads_factor_flag)
+
/* If nonzero, type's name shouldn't be emitted into debug info. */
#define TYPE_NAMELESS(NODE) (TYPE_CHECK (NODE)->base.u.bits.nameless_flag)
@@ -1927,13 +1973,24 @@ extern machine_mode element_mode (const_tree t);
| (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE) \
| (TYPE_ATOMIC (NODE) * TYPE_QUAL_ATOMIC) \
| (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT) \
+ | (TYPE_SHARED (NODE) * TYPE_QUAL_SHARED) \
+ | (TYPE_STRICT (NODE) * TYPE_QUAL_STRICT) \
+ | (TYPE_RELAXED (NODE) * TYPE_QUAL_RELAXED) \
| (ENCODE_QUAL_ADDR_SPACE (TYPE_ADDR_SPACE (NODE)))))
+/* The set of qualifiers pertinent to a FUNCTION_DECL node. */
+#define TREE_FUNC_QUALS(NODE) \
+ ((TREE_READONLY (NODE) * TYPE_QUAL_CONST) \
+ | (TREE_THIS_VOLATILE (NODE) * TYPE_QUAL_VOLATILE))
+
/* The same as TYPE_QUALS without the address space qualifications. */
#define TYPE_QUALS_NO_ADDR_SPACE(NODE) \
((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST) \
| (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE) \
| (TYPE_ATOMIC (NODE) * TYPE_QUAL_ATOMIC) \
+ | (TYPE_SHARED (NODE) * TYPE_QUAL_SHARED) \
+ | (TYPE_STRICT (NODE) * TYPE_QUAL_STRICT) \
+ | (TYPE_RELAXED (NODE) * TYPE_QUAL_RELAXED) \
| (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT)))
/* The same as TYPE_QUALS without the address space and atomic
@@ -1941,8 +1998,72 @@ extern machine_mode element_mode (const_tree t);
#define TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC(NODE) \
((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST) \
| (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE) \
+ | (TYPE_SHARED (NODE) * TYPE_QUAL_SHARED) \
+ | (TYPE_STRICT (NODE) * TYPE_QUAL_STRICT) \
+ | (TYPE_RELAXED (NODE) * TYPE_QUAL_RELAXED) \
| (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT)))
+/* Non-zero if the blocking factor is 0. */
+#define TYPE_HAS_BLOCK_FACTOR_0(NODE) \
+ TYPE_CHECK (NODE)->base.u.bits.block_factor_0
+
+/* Non-zero if the blocking factor is greater than 1.
+ In this case, the blocking factor value is stored in a hash table. */
+#define TYPE_HAS_BLOCK_FACTOR_X(NODE) \
+ TYPE_CHECK (NODE)->base.u.bits.block_factor_x
+
+/* Non-zero if the blocking factor is not equal to 1 (the default). */
+#define TYPE_HAS_BLOCK_FACTOR(NODE) \
+ (TYPE_SHARED(NODE) \
+ && (TYPE_HAS_BLOCK_FACTOR_0 (NODE) \
+ || TYPE_HAS_BLOCK_FACTOR_X (NODE)))
+
+/* Return the blocking factor of the type given by NODE..
+ The default block factor is one. The additional flag bits
+ over-ride the default. */
+#define TYPE_BLOCK_FACTOR(NODE) \
+ (TYPE_SHARED (NODE) \
+ ? (TYPE_HAS_BLOCK_FACTOR_0 (NODE) ? size_zero_node \
+ : TYPE_HAS_BLOCK_FACTOR_X (NODE) ? block_factor_lookup (NODE) \
+ : NULL_TREE) \
+ : NULL_TREE)
+
+/* Set the block factor in the type described by NODE.
+ For a zero blocking factor set TYPE_BLOCK_FACTOR_0 (NODE).
+ For a blocking factor greater than 1, insert the value
+ into a hash table indexed by NODE, and then set the
+ flag TYPE_BLOCK_FACTOR_X (NODE). */
+#define SET_TYPE_BLOCK_FACTOR(NODE, VAL) \
+ do { \
+ if (TYPE_SHARED (NODE)) \
+ { \
+ TYPE_HAS_BLOCK_FACTOR_0 (NODE) = 0; \
+ TYPE_HAS_BLOCK_FACTOR_X (NODE) = 0; \
+ if (VAL) \
+ { \
+ gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (VAL))); \
+ if (!integer_onep (VAL)) \
+ { \
+ if (integer_zerop (VAL)) \
+ TYPE_HAS_BLOCK_FACTOR_0 (NODE) = 1; \
+ else \
+ { \
+ TYPE_HAS_BLOCK_FACTOR_X (NODE) = 1; \
+ block_factor_insert (NODE, VAL); \
+ } \
+ } \
+ } \
+ } \
+ else \
+ gcc_assert (!VAL); \
+ } while (0)
+
+extern void block_factor_insert (tree, tree);
+extern tree block_factor_lookup (const_tree);
+extern tree build_unshared_type (tree);
+extern void block_factor_lookup_init (void);
+extern tree get_block_factor (const tree);
+
/* These flags are available for each language front end to use internally. */
#define TYPE_LANG_FLAG_0(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_0)
#define TYPE_LANG_FLAG_1(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_1)
@@ -2192,7 +2313,7 @@ extern machine_mode element_mode (const_tree t);
/* Nonzero if DECL represents an SSA name or a variable that can possibly
have an associated SSA name. */
#define SSA_VAR_P(DECL) \
- (TREE_CODE (DECL) == VAR_DECL \
+ ((TREE_CODE (DECL) == VAR_DECL && !TREE_SHARED (DECL)) \
|| TREE_CODE (DECL) == PARM_DECL \
|| TREE_CODE (DECL) == RESULT_DECL \
|| TREE_CODE (DECL) == SSA_NAME)
@@ -3627,6 +3748,17 @@ tree_operand_check_code (const_tree __t, enum tree_code __code, int __i,
#define boolean_false_node global_trees[TI_BOOLEAN_FALSE]
#define boolean_true_node global_trees[TI_BOOLEAN_TRUE]
+/* The UPC type `void *'. */
+#define upc_pts_type_node global_trees[TI_UPC_PTS_TYPE]
+
+/* UPC pointer to shared qualified object representation */
+#define upc_pts_rep_type_node global_trees[TI_UPC_PTS_REP_TYPE]
+#define upc_char_pts_type_node global_trees[TI_UPC_CHAR_PTS_TYPE]
+#define upc_phase_field_node global_trees[TI_UPC_PHASE_FIELD]
+#define upc_thread_field_node global_trees[TI_UPC_THREAD_FIELD]
+#define upc_vaddr_field_node global_trees[TI_UPC_VADDR_FIELD]
+#define upc_null_pts_node global_trees[TI_UPC_NULL_PTS]
+
/* The decimal floating point types. */
#define dfloat32_type_node global_trees[TI_DFLOAT32_TYPE]
#define dfloat64_type_node global_trees[TI_DFLOAT64_TYPE]
@@ -4169,20 +4301,26 @@ extern tree handle_dll_attribute (tree *, tree, tree, int, bool *);
extern bool check_base_type (const_tree cand, const_tree base);
/* Check whether CAND is suitable to be returned from get_qualified_type
- (BASE, TYPE_QUALS). */
+ (BASE, TYPE_QUALS, BLOCK_FACTOR). */
-extern bool check_qualified_type (const_tree, const_tree, int);
+extern bool check_qualified_type (const_tree cand, const_tree base,
+ int type_quals,
+ tree block_factor = NULL_TREE);
/* Return a version of the TYPE, qualified as indicated by the
- TYPE_QUALS, if one exists. If no qualified version exists yet,
- return NULL_TREE. */
+ TYPE_QUALS, if one exists.
+ If no qualified version exists yet, return NULL_TREE.
+ BLOCK_FACTOR is null, unless compiling UPC. */
-extern tree get_qualified_type (tree, int);
+extern tree get_qualified_type (tree type, int type_quals,
+ tree block_factor = NULL_TREE);
/* Like get_qualified_type, but creates the type if it does not
- exist. This function never returns NULL_TREE. */
+ exist. This function never returns NULL_TREE.
+ BLOCK_FACTOR is null, unless compiling UPC. */
-extern tree build_qualified_type (tree, int);
+extern tree build_qualified_type (tree type, int type_quals,
+ tree block_factor = NULL_TREE);
/* Create a variant of type T with alignment ALIGN. */
@@ -4213,6 +4351,7 @@ extern tree type_hash_canon (unsigned int, tree);
extern tree convert (tree, tree);
extern unsigned int expr_align (const_tree);
extern tree size_in_bytes (const_tree);
+extern tree tree_expr_size (const_tree);
extern HOST_WIDE_INT int_size_in_bytes (const_tree);
extern HOST_WIDE_INT max_int_size_in_bytes (const_tree);
extern tree bit_position (const_tree);
diff --git a/gcc/varasm.c b/gcc/varasm.c
index b0f2af03de4..e240eb248ca 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -6204,6 +6204,21 @@ default_section_type_flags (tree decl, const char *name, int reloc)
|| strcmp (name, ".preinit_array") == 0))
flags |= SECTION_NOTYPE;
+ /* The UPC shared section is not loaded into memory.
+ It is used only to layout shared variables. */
+ if (!(flags & (SECTION_CODE | SECTION_BSS | SECTION_TLS)))
+ {
+ const char *upc_shared_section_name =
+ targetm.upc.shared_section_name ();
+ if (upc_shared_section_name
+ && (strcmp (name, upc_shared_section_name) == 0))
+ {
+ flags |= SECTION_BSS;
+ if (targetm.upc.link_script_p ())
+ flags = SECTION_DEBUG | (flags & ~SECTION_WRITE);
+ }
+ }
+
return flags;
}
diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
index b3512442850..5ae7692087a 100644
--- a/libatomic/Makefile.am
+++ b/libatomic/Makefile.am
@@ -40,7 +40,8 @@ AM_CCASFLAGS = $(XCFLAGS)
AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
toolexeclib_LTLIBRARIES = libatomic.la
-noinst_LTLIBRARIES = libatomic_convenience.la
+noinst_LTLIBRARIES = libatomic_convenience.la \
+ libatomic_convenience_no_lock.la
if LIBAT_BUILD_VERSIONED_SHLIB
if LIBAT_BUILD_VERSIONED_SHLIB_GNU
@@ -67,8 +68,9 @@ endif
libatomic_version_info = -version-info $(libtool_VERSION)
libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
-libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
+LIBAT_SRC_NO_LOCK = gload.c gstore.c gcas.c gexch.c glfree.c 0 init.c \
fenv.c fence.c flag.c
+libatomic_la_SOURCES = $(LIBAT_SRC_NO_LOCK) lock.c
SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
SIZES = @SIZES@
@@ -140,6 +142,12 @@ endif
libatomic_convenience_la_SOURCES = $(libatomic_la_SOURCES)
libatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD)
+# The "no lock" convenience library is used by libgupc to
+# avoid lock.c's use of pthread_mutex, which won't work
+# for processes using atomics on shared memory.
+libatomic_convenience_no_lock_la_SOURCES = $(LIBAT_SRC_NO_LOCK)
+libatomic_convenience_no_lock_la_LIBADD = $(libatomic_la_LIBADD)
+
# Override the automake generated all-multi rule to guarantee that all-multi
# is not run in parallel with the %_.lo rules which generate $(DEPDIR)/*.Ppo
# makefile fragments to avoid broken *.Ppo getting included into the Makefile
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index a083d8702e4..d24b55966b4 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -113,18 +113,23 @@ am__uninstall_files_from_dir = { \
}
am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
-am_libatomic_la_OBJECTS = gload.lo gstore.lo gcas.lo gexch.lo \
- glfree.lo lock.lo init.lo fenv.lo fence.lo flag.lo
+am__objects_1 = gload.lo gstore.lo gcas.lo gexch.lo glfree.lo init.lo \
+ fenv.lo fence.lo flag.lo
+am_libatomic_la_OBJECTS = $(am__objects_1) lock.lo
libatomic_la_OBJECTS = $(am_libatomic_la_OBJECTS)
libatomic_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libatomic_la_LDFLAGS) $(LDFLAGS) -o $@
libatomic_convenience_la_DEPENDENCIES = $(libatomic_la_LIBADD)
-am__objects_1 = gload.lo gstore.lo gcas.lo gexch.lo glfree.lo lock.lo \
- init.lo fenv.lo fence.lo flag.lo
-am_libatomic_convenience_la_OBJECTS = $(am__objects_1)
+am__objects_2 = $(am__objects_1) lock.lo
+am_libatomic_convenience_la_OBJECTS = $(am__objects_2)
libatomic_convenience_la_OBJECTS = \
$(am_libatomic_convenience_la_OBJECTS)
+libatomic_convenience_no_lock_la_DEPENDENCIES = \
+ $(libatomic_la_LIBADD)
+am_libatomic_convenience_no_lock_la_OBJECTS = $(am__objects_1)
+libatomic_convenience_no_lock_la_OBJECTS = \
+ $(am_libatomic_convenience_no_lock_la_OBJECTS)
depcomp = $(SHELL) $(top_srcdir)/../depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
@@ -138,7 +143,8 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libatomic_la_SOURCES) $(EXTRA_libatomic_la_SOURCES) \
- $(libatomic_convenience_la_SOURCES)
+ $(libatomic_convenience_la_SOURCES) \
+ $(libatomic_convenience_no_lock_la_SOURCES)
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
@@ -307,7 +313,9 @@ AM_CFLAGS = $(XCFLAGS)
AM_CCASFLAGS = $(XCFLAGS)
AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
toolexeclib_LTLIBRARIES = libatomic.la
-noinst_LTLIBRARIES = libatomic_convenience.la
+noinst_LTLIBRARIES = libatomic_convenience.la \
+ libatomic_convenience_no_lock.la
+
@LIBAT_BUILD_VERSIONED_SHLIB_FALSE@libatomic_version_script =
@LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_script = -Wl,--version-script,$(top_srcdir)/libatomic.map
@LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_script = -Wl,-M,libatomic.map-sun
@@ -316,9 +324,10 @@ noinst_LTLIBRARIES = libatomic_convenience.la
@LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun
libatomic_version_info = -version-info $(libtool_VERSION)
libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
-libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
+LIBAT_SRC_NO_LOCK = gload.c gstore.c gcas.c gexch.c glfree.c 0 init.c \
fenv.c fence.c flag.c
+libatomic_la_SOURCES = $(LIBAT_SRC_NO_LOCK) lock.c
SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
EXTRA_libatomic_la_SOURCES = $(addsuffix _n.c,$(SIZEOBJS))
libatomic_la_DEPENDENCIES = $(libatomic_la_LIBADD) $(libatomic_version_dep)
@@ -350,6 +359,12 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \
@ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16
libatomic_convenience_la_SOURCES = $(libatomic_la_SOURCES)
libatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD)
+
+# The "no lock" convenience library is used by libgupc to
+# avoid lock.c's use of pthread_mutex, which won't work
+# for processes using atomics on shared memory.
+libatomic_convenience_no_lock_la_SOURCES = $(LIBAT_SRC_NO_LOCK)
+libatomic_convenience_no_lock_la_LIBADD = $(libatomic_la_LIBADD)
all: auto-config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -449,6 +464,8 @@ libatomic.la: $(libatomic_la_OBJECTS) $(libatomic_la_DEPENDENCIES) $(EXTRA_libat
$(libatomic_la_LINK) -rpath $(toolexeclibdir) $(libatomic_la_OBJECTS) $(libatomic_la_LIBADD) $(LIBS)
libatomic_convenience.la: $(libatomic_convenience_la_OBJECTS) $(libatomic_convenience_la_DEPENDENCIES) $(EXTRA_libatomic_convenience_la_DEPENDENCIES)
$(LINK) $(libatomic_convenience_la_OBJECTS) $(libatomic_convenience_la_LIBADD) $(LIBS)
+libatomic_convenience_no_lock.la: $(libatomic_convenience_no_lock_la_OBJECTS) $(libatomic_convenience_no_lock_la_DEPENDENCIES) $(EXTRA_libatomic_convenience_no_lock_la_DEPENDENCIES)
+ $(LINK) $(libatomic_convenience_no_lock_la_OBJECTS) $(libatomic_convenience_no_lock_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
diff --git a/libgupc/ChangeLog b/libgupc/ChangeLog
new file mode 100644
index 00000000000..f853c927a1c
--- /dev/null
+++ b/libgupc/ChangeLog
@@ -0,0 +1,1644 @@
+2015-11-28 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_main.c (__upc_process_switches): Accept -fupc-threads=N
+ and -fupc-heap=N switches as well as their deprecated forms.
+ (__upc_print_help_and_exit): Print -fupc-threads=N
+ and -fupc-heap=N forms in the usage summary.
+ * smp/gcc-upc-lib.in: Refer to -fupc-threads=N compilation switch.
+ * portals4/gcc-upc-lib.in: Ditto.
+
+2015-11-25 Gary Funck <gary@intrepid.com>
+
+ * Makefile.am: Fix spelling.
+ * Makefile.in: Re-generate.
+ * collectives/upc_coll_init.upc: Ditto.
+ * collectives/upc_coll_prefix_reduce.in: Ditto.
+ * include/gasp_upc.h: Ditto.
+ * portals4/gupcr_barrier.c: Ditto.
+ * portals4/gupcr_pts.h: Ditto.
+ * smp/upc_gum.c: Ditto.
+ * smp/upc_main.c: Ditto.
+ * smp/upc_pts.h: Ditto.
+
+2015-11-22 Gary Funck <gary@intrepid.com>
+
+ * ax_prog_doxygen.m4: Fix spelling.
+ * configure.ac: Ditto.
+ * portals4/doxygen.cfg.in: Ditto.
+ * portals4/gupcr_coll_sup.c: Ditto.
+ * portals4/gupcr_gmem.h: Ditto.
+ * portals4/gupcr_nb_sup.c: Ditto.
+ * smp/upc_affinity.c: Ditto.
+ * smp/upc_main.c: Ditto.
+ * configure: Re-generate.
+
+2015-11-04 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_sync.h (GUPCR_WRITE_FENCE, GUPCR_READ_FENCE):
+ Define for __aarch64__.
+
+2015-10-21 Gary Funck <gary@intrepid.com>
+
+ * upc-crtbegin.spec.in, upc-crtend.spec.in:
+ Refer to -fupc, not -fupc-link, in comment.
+
+2015-10-17 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_sup.h (upc_shared_ptr_alias_t): Delete.
+ Remove this type, no longer needed because the runtime is
+ built with -fno-strict-aliasing.
+
+2015-10-13 Gary Funck <gary@intrepid.com>
+
+ * testsuite/lib/libgupc.exp: Load multiline.exp before prune.exp,
+ using load_gcc_lib.
+
+2015-10-07 Gary Funck <gary@intrepid.com>
+
+ * config/default/upc-crt-begin-end.h (GUPCR_SHARED_BEGIN_NAME,
+ GUPCR_SHARED_END_NAME, GUPCR_PGM_INFO_BEGIN_NAME,
+ GUPCR_PGM_INFO_END_NAME, GUPCR_INIT_ARRAY_BEGIN_NAME,
+ GUPCR_INIT_ARRAY_END_NAME): New. Move from gcc/defaults.h
+ and rename UPC_* to GUPCR_*.
+ * configure.ac: Determine UPC linker support by querying
+ GUPC builtin preprocessor symbol.
+ Remove --enable-upc-link-script option.
+ * upc-crtstuff.c: Include upc-crt-begin-end.h.
+ * configure: Re-generate.
+
+2015-10-04 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Extract UPC-related section names from
+ pre-defined's passed by the UPC compiler.
+ * configure.tgt: Remove logic for finding and setting
+ the UPC crt make file fragment ('upc_crtstuff_mak').
+ * Makefile.am: Re-do logic for generating UPC crtbegin/end files.
+ Removes dependency on libgcc and gcc build directories.
+ They are un-needed for UPC, because its "crt" files define
+ only section start/end symbols.
+ * upc-crtstuff.c: Removes dependency on libgcc and gcc source
+ and build directories.
+ * config/default/upc-crtstuff.mak: Remove.
+ * config/darwin/upc-crt-config.h: Parameterize by section
+ names passed by the UPC compiler as pre-defined's.
+ * config/default/upc-crt-config.h: Ditto.
+ * configure: Re-generate.
+ * config.h.in: Re-generate.
+ * Makefile.in: Re-generate.
+
+2015-09-26 Gary Funck <gary@intrepid.com>
+
+ * config.h.in (GUPCR_SHARED_SECTION_NAME,
+ GUPCR_PGM_INFO_SECTION_NAME, GUPCR_INIT_ARRAY_SECTION_NAMEA):
+ Move from gcc/defaults.h and rename UPC_* to GUPCR_*.
+
+2015-09-17 Gary Funck <gary@intrepid.com>
+
+ Update copyright notices.
+
+2015-09-09 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_barrier.upc (__upc_btree): Make this a UPC 'strict'
+ shared array in order to avoid potential race conditions
+ in the implementation of barrier.
+
+2015-08-25 Gary Funck <gary@intrepid.com>
+
+ * configure.tgt: Add configure checking for supported targets.
+
+2015-08-15 Gary Funck <gary@intrepid.com>
+
+ * testsuite/lib/libgupc.exp: Load target-utils.exp.
+ Move load of target-supports.exp earlier.
+
+2015-08-14 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Fix the previous update for netbsd checking.
+ * configure: Re-generate.
+
+2015-08-08 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Check for existence of execinfo library
+ on BSD systems as it is required for backtrace.
+ * configure: Re-generate.
+ * configure.tgt: Add execinfo library on the link line if
+ necessary.
+ * portals4/gupcr_node.c (gupcr_mem_private): File number must
+ be -1 on BSD systems for anonymous maps.
+ * smp/upc_sysdep.c (__upc_strsignal): Add support for SUN. Do
+ not declare sys_siglist on netBSD (already in signal.h).
+ (__upc_create_runtime_heap): File number must be -1 on BSD
+ systems for anonymous maps.
+ * smp/upc_backtrace.c: Fix compile warnings.
+
+2015-08-03 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Remove unnecessary check for
+ -rdynamic.
+ * configure: Re-generate.
+ * configure.tgt: Add option for exporting dynamic symbols
+ only if linker supports it.
+
+2015-07-25 Gary Funck <gary@intrepid.com>
+
+ * libgupc.texi: Change menu ordering to agree with node ordering.
+
+2015-07-24 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_pts.h (GUPCR_ONE): Define as unsigned constant,
+ to avoid overflow warnings.
+ * portals4/gupcr_pts.h (GUPCR_ONE): Ditto.
+
+2015-07-03 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_nb.upc (upc_memset_nb, upc_memset_nbi): Complete
+ upc_memset() with upc fence. Otherwise it will not be completed by
+ the non-blocking sync functions.
+
+2015-05-18 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Set minimum automake version to 1.11.6.
+ * aclocal.m4, configure, Makefile.in, testsuite/Makefile.in:
+ Re-generate with automake 1.11.6.
+
+2015-04-30 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_nb_sup.c (gupc_nb_put/get): Fix bug. Increment
+ number of outstanding implicit transfers.
+
+2014-11-01 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_gmem.c (gupc_gmem_get): Advance remote offset
+ if more then one PtlGet() are executed.
+
+2014-08-15 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_mem.c (upc_memcpy): Make sure outstanding
+ strict puts are completed before transferring data from
+ the remote node as local thread can have an outstanding
+ memory put to the same location.
+
+2014-08-01 Gary Funck <gary@intrepid.com>
+
+ * configure.ac (GUPCR_PORTALS_RUNTIME): New AC_DEFINE().
+ * config.h.in: Re-generate.
+ * configure: Re-generate.
+ * libgupc.spec.in: Fix comment.
+ * testsuite/lib/libgupc-dg.exp
+ (libgupc_load): Simplify logic.
+ (upc_run_cmd): Rename from run_command.
+ (upc_portals): Use newly added GUPCR_PORTALS_RUNTIME config. variable.
+ (upc_runtime_yod): Make compile-only.
+ * testsuite/lib/libgupc.exp: Bring in line with gomp's libgomp.exp.
+ (libgupc_target_compile): Simplify logic.
+ * testsuite/libgupc.upc/upc.exp:
+ Bring in line with gomp's libgomp.c/c.exp.
+ * testsuite/libgupc.upc/intrepid/test07.upc
+ * testsuite/libgupc.upc/intrepid/test07_sep.upc
+ * testsuite/libgupc.upc/intrepid/test08.upc
+ * testsuite/libgupc.upc/intrepid/test08_sep.upc
+ Add dg-options to properly support separate compilation.
+
+2014-07-16 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_lock.upc (upc_lock): Add upc_fence to flush
+ caches after write and before read from shared space. Fixes
+ occasional lockup in the lock code.
+
+2014-07-02 Nenad Vukicevic <nenad@intrepid.com>
+
+ * Makefile.am (UPC_LINK_SCRIPT): Change the UPC link script
+ build procedure. The previous way was always generating
+ an error as not source file was provided. This error string
+ ended up in the UPC link script on some of the systems.
+ * Makefile.in: Regenerate.
+
+2014-07-02 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gcc-upc-lib.in: Use stddef.h for size_t
+ instead of sys/types.h as it might break on some
+ systems.
+
+2014-05-27 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc_main.c (__upc_run_threads): Set O_APPEND flag
+ on stdout/stderr to fix occasional garbled output when
+ output from multiple threads is saved to a file.
+
+2014-04-21 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.tgt: Fix check for the presence of -rdynamic
+ compiler switch.
+
+2014-04-09 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_atomic.upc (upc_atomic_relaxed): Fix PTS
+ CSWAP operation to return target value on failures too.
+
+2014-04-08 Gary Funck <gary@intrepid.com>
+
+ Fix UPC atomic operations on types that have no builtin
+ compiler support. Build a version of the libatomic convenience
+ library that has no locking support, and then provide
+ locks in the UPC runtime library. These lock functions
+ serialize atomic operations on types with no builtin atomics.
+ * libatomic/Makefile.am: Add rule to build
+ libatomic_convenience_nolock library.
+ * libatomic/Makefile.in: Re-generate.
+ * Makefile.am: Use libatomic_convenience_nolock library.
+ Compile libat lock support. Add convenience library to
+ pthreads version of the UPC runtime library.
+ * Makefile.in: Re-generate.
+ * smp/upc_atomic.tpl: Simplify compare/swap support.
+ * smp/upc_atomic.upc: Re-generate.
+ * smp/upc_libat_lock.c: New. UPC-specific libat lock support.
+ * smp/upc_libat_lock.h: New. UPC-specific libat lock support.
+
+2014-03-18 Nenad Vukicevic <nenad@intrepid.com>
+
+ As per UPC spec 1.3 query function is upc_atomic_isfast().
+ * include/upc_atomic.h (upc_atomic_query): Rename to
+ upc_atomic_isfast().
+ * portals4/gupcr_atomic.upc (upc_atomic_query): Rename to
+ upc_atomic_isfast().
+ * smp/upc_atomic.tpl (upc_atomic_query): Rename to
+ upc_atomic_isfast().
+ * smp/upc_atomic.upc: Regenerate.
+
+2014-01-17 Nenad Vukicevic <nenad@intrepid.com>
+
+ * smp/upc_barrier.upc: Remove unnecessary include.
+ * smp/upc_pts.hi (GUPCR_PTS_SET_VADDR): Fix the cast. Some other
+ compilers might issues a warning.
+ * smp/upc_vm.c (__upc_vm_map_addr): Add a cast to avoid a possible
+ warning on void * arithmetic.
+
+2014-01-17 Nenad Vukicevic <nenad@intrepid.com>
+
+ * smp/gcc-upc-lib.in: Add defines for __UPC_CASTABLE__,
+ __UPC_COLLECTIVE__, __UPC_TICK__, and __UPC_PUCP__ defines.
+ * portals4/gcc-upc-lib.in: Ditto.
+
+2014-01-10 Gary Funck <gary@intrepid.com>
+
+ Update copyright notices.
+
+2014-01-09 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_alloc.upc (gupcr_pts_add_offset): Moved from
+ gupcr_utils.h.
+ (gupcr_pts_diff): Ditto.
+ * portals4/gupcr_utils.h (gupcr_pts_add_offset): Remove.
+ (gupcr_pts_diff): Ditto.
+
+2014-01-04 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Remove check for cc1upc.
+ * configure: Re-generate.
+ * portals4/gcc-upc-lib.in: Protect upc_atomicdomain_t declaration
+ with #pragma upc upc_code.
+ * smp/gcc-upc-lib.in: Ditto.
+
+2013-11-03 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_atomic.upc (gupcr_set_optype_val): Add missing
+ break on case statement.
+ (gupcr_negate_atomic_type): Ditto.
+
+2013-10-23 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Rework checking of GDB availability for backtracing.
+ Usage of GDB backtracing is enabled only if GDB was found or the
+ path was specified by the user. Change was needed as Mac OS X
+ 10.9 does not have gdb installed.
+ Additional fix for printing correct result if "-rdynamic" option
+ is available.
+ * configure: Re-generate.
+
+2013-10-04 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add UPC backtrace to Portals4 runtime.
+ * Makefile.am: UPC_BACKTRACE_SUP is common define now.
+ (UPC_RUNTIME_SRC): Portals4, add UPC backtrace files.
+ * Makefile.in: Re-generate.
+ * configure.ac: Check for UPC backtrace options is common
+ to SMP and Portals4 runtimes.
+ * configure: Re-generate.
+ * portals4/gupcr_backtrace.c: New. Port from the SMP implementation.
+ * portals4/gupcr_backtrace.h: Ditto.
+ * portals4/gupcr_barrier.c (gupcr_barrier_id): Make it global.
+ * portals4/gupcr_barrier.h: Ditto.
+ * portals4/gupcr_env.c (gupcr_env_kind): Add ENV_UPC_BACKTRACE.
+ (gupcr_env_var_table): Add ENV_UPC_BACKTRACE.
+ (gupcr_env_init): Add support for ENV_UPC_BACKTRACE.
+ * portals4/gupcr_main.c (gupcr_init): Initialized UPC backtrace
+ if enabled.
+ * portals4/gupcr_utils.c (gupcr_backtrace): Add.
+ (gupcr_create_temp_file): Add.
+ (gupcr_set_backtrace):Add.
+ (gupcr_is_backtrace_enabled): Add.
+ * portals4/gupcr_utils.h: Add prototypes for the new utility
+ functions.
+
+2013-09-27 Gary Funck <gary@intrepid.com>
+
+ Implement non-blocking transfer operations for SMP runtime.
+ * Makefile.am (UPC_RUNTIME_SRC): Add upc_nb.upc.
+ * Makefile.in: Re-generate.
+ * configure: Re-generate.
+ * smp/gcc-upc-lib.in: Add __UPC_NB__ definition.
+ * smp/gupcr_nb.upc: New. Non-blocking transfers library.
+
+2013-09-26 Nenad Vukicevic <nenad@intrepid.com>
+
+ * Makefile.am (UPC_BACKTRACE_SUP): Remove upc_backtrace_sup.c.
+ * Makefile.in: Re-generate.
+ * configure.ac: Remove detection of libbfd. Add
+ HAVE_UPC_BACKTRACE_ADDR2LINE and GUPCR_BACKTRACE_ADDR2LINE
+ definitions.
+ * configure: Re-generate.
+ * config.h.in: Re-generate.
+ * configure.tgt (LIBS): Remove libbfd and libdl.
+ * smp/upc_backtrace.c (__upc_backtrace): Use addr2line to generate
+ source code references.
+ (__upc_abs_execname): Use pointer instead of large array declaration.
+ (__upc_backtrace_init): Allocate space for __upc_abs_execname.
+ * smp/upc_backtrace.h: Remove libbfd support function prototype.
+ * smp/upc_backtrace_sup.c: Delete.
+
+2013-09-10 Nenad Vukicevic <nenad@intrepid.com>
+
+ Implement non-blocking transfer operations for Portals4 runtime.
+ * Makefile.am (UPC_RUNTIME_SRC): Add upc_nb.upc, upc_nb_sup.h,
+ upc_nb_sup.c for Portals4 source files.
+ * Makefile.in: Re-generate.
+ * portals4/gcc-upc-lib.in: Add __UPC_NB__ definition.
+ * portals4/gupcr_env.c (gupcr_facility_table): Add FC_NB facility.
+ * portals4/gupcr_main.c (gupcr_init): Add NB initialization.
+ (gupcr_fini): Add NB finalization.
+ * portals4/gupcr_nb.upc: New. Non-blocking transfers library.
+ * portals4/gupcr_nb_sup.c: New. Non-blocking transfers support.
+ * portals4/gupcr_nb_sup.h: New. Non-blocking transfers support.
+ * portals4/gupcr_portals.h: Add GUPCR_PTL_PTE_NB for non-blocking
+ transfers.
+ (gupcr_portals_call_with_status): PTL_EQ_EMPTY is not an error.
+ * portals4/gupcr_utils.h (gupcr_facility_t): Add enum value for FC_NB.
+
+2013-09-09 Nenad Vukicevic <nenad@intrepid.com>
+
+ Added UPC non-blocking transfer header file.
+ * Makefile.am (UPC_HDRS): Add upc_nb.h
+ * Makefile.in: Re-generate.
+ * include/upc_nb.h: New. Required per 1.3 spec.
+
+2013-08-06 Gary Funck <gary@intrepid.com>
+
+ Implement atomic operations library for SMP runtime.
+ * ../Makefile.def: Add dependencies for libatomic and libbacktrace.
+ * ../Makefile.in: Re-generate.
+ * Makefile.am: Add gen-inline-libgupc.pl gen-upc-ld-script.pl.
+ Add autogen rules to build smp/upc_atomic.upc.
+ * Makefile.in: Re-generate.
+ * include/upc_atomic.h: Add UPC_*_OP definitions.
+ * include/upc_ops.def: New. Describe UPC atomic operations.
+ * include/upc_types.def: New. Describe UPC atomic types.
+ * include/upc_types.h: Add UPC_*_OP definitions.
+ * smp/gcc-upc-lib.in: Define __UPC_ATOMIC__ and add typedef
+ for upc_atomicdomain_t.
+ * smp/upc_atomic.def: New. Autogen definition file for upc_atomic.upc.
+ * smp/upc_atomic.tpl: New. Autogen template file for upc_atomic.upc.
+ * smp/upc_atomic.upc: New. Generate from smp/upc_atomic.def.
+ * smp/upc_config.h: Add defines for LONG_LONG_BITS and SIZE_T_BITS.
+ * smp/upc_main.c: (__upc_fatal) Fix bug in handling of variadic args.
+
+2013-07-24 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_atomic_sup.c: Use correct type for EQ declaration.
+ * portals4/gupcr_coll_sup.c: Ditto.
+ * portals4/gupcr_shutdown.c: Ditto.
+
+2013-06-12 Nenad Vukicevic <nenad@intrepid.com>
+
+ * testsuite/lib/libgupc-dg.exp: Check GUPC P4 runtime for SLURM
+ or YOD configuration and use appropriate commands to run tests.
+
+2013-06-07 Nenad Vukicevic <nenad@intrepid.com>
+
+ * testsuite/libgupc.upc/upc.exp: Changed list of tests to exclude
+ separate compilation units (*_sep.upc).
+
+2013-06-07 Nenad Vukicevic <nenad@intrepid.com>
+
+ * include/gasp_upc.h: Cleanup to conform to GCC codding style
+ (mainly fixing comments, but also some prototypes, defiens, ...).
+ include/gcc-upc.h: Ditto.
+ * include/pupc.h: Ditto.
+ * include/upc.h: Ditto.
+ * include/upc_collective.h: Ditto.
+ * include/upc_tick.h: Ditto.
+ * include/upc_types.h: Ditto.
+ * portals4/gcc-upc-lib.in: Ditto.
+ * portals4/gupcr_access.c: Ditto.
+ * portals4/gupcr_access.h: Ditto.
+ * portals4/gupcr_addr.c: Ditto.
+ * portals4/gupcr_alloc.upc: Ditto.
+ * portals4/gupcr_clock.c: Ditto.
+ * portals4/gupcr_coll_broadcast.upc: Ditto.
+ * portals4/gupcr_coll_reduce.in: Ditto.
+ * portals4/gupcr_coll_reduce.upc: Ditto.
+ * portals4/gupcr_config.h: Ditto.
+ * portals4/gupcr_defs.h: Ditto.
+ * portals4/gupcr_gmem.c: Ditto.
+ * portals4/gupcr_gmem.h: Ditto.
+ * portals4/gupcr_lock_sup.h: Ditto.
+ * portals4/gupcr_main.c: Ditto.
+ * portals4/gupcr_mem.c: Ditto.
+ * portals4/gupcr_pgm_info.c: Ditto.
+ * portals4/gupcr_portals.c: Ditto.
+ * portals4/gupcr_pts.h: Ditto.
+ * portals4/gupcr_runtime.c: Ditto.
+ * portals4/gupcr_shutdown.c: Ditto.
+ * portals4/gupcr_tick.c: Ditto.
+ * portals4/gupcr_utils.c: Ditto.
+ * portals4/gupcr_utils.h: Ditto.
+
+2013-06-07 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_atomic.upc: Cleanup calls to gupc_fatal_error.
+ Message starts with lowercase letter, no need for thread
+ identification as it will be included automatically, cleanup
+ message content.
+ * portals4/gupcr_atomic_sup.c: Ditto.
+ * portals4/gupcr_barrier.c: Ditto.
+ * portals4/gupcr_broadcast.c: Ditto.
+ * portals4/gupcr_coll_init.upc: Ditto.
+ * portals4/gupcr_coll_reduce.in: Ditto.
+ * portals4/gupcr_coll_reduce.upc: Ditto.
+ * portals4/gupcr_coll_sup.c: Ditto.
+ * portals4/gupcr_env.c: Ditto.
+ * portals4/gupcr_lock.upc: Ditto.
+ * portals4/gupcr_lock_sup.c: Ditto.
+
+2013-06-06 Nenad Vukicevic <nenad@intrepid.com>
+
+ Update copyright years.
+
+2013-06-06 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_atomic.upc (upc_atomic_query): Compile error fix.
+
+2013-06-06 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_main.c (__upc_fatal): Extend interface to
+ support printf-like formatting of fatal error messages.
+ * smp/upc_sup.h (__upc_fatal): Adjust prototype.
+ (__upc_exit): Add nothrow attribute to prototype.
+
+2013-06-06 Gary Funck <gary@intrepid.com>
+
+ * include/upc.h: Re-fix. Delete all of the (deprecated) declarations
+ of prototype for upc_local_alloc(). It has been
+ removed in the UPC 1.3 spec.
+
+2013-06-05 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add support for UPC atomics to Portals4 runtime.
+ * Makefile.am (UPC_RUNTIME_SRC): Add atomic files.
+ (UPC_HDRS): Add atomic files.
+ * Makefile.in: Re-generate.
+ * include/upc_atomic.h: New. UPC atomic interface.
+ * portals4/gcc-upc-lib.in (__UPC_ATOMIC__): Add.
+ Add definition of upc_atomicdomain_t.
+ * portals4/gupcr_atomic.upc: New. UPC atomic implementation.
+ * portals4/gupcr_atomic_sup.c: New. UPC atomic support functions.
+ * portals4/gupcr_atomic_sup.h: New.
+ * portals4/gupcr_env.c (gupcr_facility_table): Add atomic facility.
+ * portals4/gupcr_main.c (gupcr_init): Add atomic initialization.
+ (gupcr_fini): Add atomic finalization.
+ * portals4/gupcr_portals.c (gupcr_get_atomic_size): Add.
+ * portals4/gupcr_portals.h (gupcr_get_atomic_size): Add.
+ * portals4/gupcr_utils.c (gupcr_get_buf_as_hex): Add.
+ * portals4/gupcr_utils.h (gupcr_facility_t): Add atomic facility.
+
+2013-05-09 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_env.c: Add UPC_FIRSTTOUCH environment variable
+ as a no-op. Misc fixes in comments for ON/OFF -> YES/NO.
+ (gupcr_env_init): Handle UPC_FIRSTTOUCH as no-op.
+
+2013-05-09 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add support for remote put optimization with usage of volatile MD.
+ configure.ac: Add configuration option
+ (--with-upc-max-outstanding-puts) for maximum number of
+ outstanding remote put operations.
+ * config.h.in: Re-generate.
+ configure: Re-generate.
+ * portals4/gupcr_gmem.c: Add gupcr_gmem_high_mark_puts variable.
+ Add gupcr_gmem_low_mark_puts variable.
+ (gupcr_gmem_put): Use volatile MD if transfer size is
+ smaller then the volatile maximum size. Add checking for maximum
+ number of outstanding puts (flow control).
+ * portals4/gupcr_gmem.h (gupcr_gmem_xfer_info_t): Add md_volatile
+ field.
+ * portals4/gupcr_portals.c: Add gupcr_max_volatile_size variable.
+ (gupcr_portals_ni_init): Initialize max volatile size from NI
+ limits.
+ * portals4/gupcr_portals.h: Add GUPCR_PORTALS_MAX_VOLATILE_SIZE
+ define. Add gupcr_max_volatile_size extern definition.
+
+2013-04-18 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_gmem.c (gupcr_gmem_init): Add debug logging for
+ GMEM location/size.
+ * portals4/gupcr_lock_sup.c (gupcr_lock_init): Fix the debug print
+ format for GMEM size.
+
+2013-04-11 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Fix check for correct bounce buffer size value where
+ suffix multiplier (e.g. "k") was always expected. Small fix for
+ correct checking of the "multilib" setting.
+ * configure: Re-generate.
+
+2013-04-09 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_lock.upc (upc_unlock): Add missing upc_fence.
+ * smp/upc_lock.upc (upc_unlock): Ditto.
+
+2013-04-02 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_utils.c (gupcr_is_node_local_memory_enabled); Rename
+ from gupcr_is_node_local_memory. Fixing error from the previous
+ update.
+
+2013-04-01 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_env.c (gupcr_env_boolean): Rename from gupcr_env_switch.
+ Change options to NO/no/0 or YES/yes/1.
+ (gupcr_env_init): New names for node memory and forcetouch options
+ set routines.
+ * portals4/gupcr_node.c (gupcr_node_local_alloc): Ditto.
+ (gupcr_node_init): Ditto.
+ * portals4/gupcr_utils.c (gupcr_set_node_local_memory): Rename from
+ gupcr_set_node_local_mem_enabled.
+ (gupcr_set_forcetouch): Rename from gupcr_set_forcetouch_enabled.
+ * portals4/gupcr_utils.h: Ditto.
+
+2013-04-01 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add shared memory page by page touch on startup.
+ * configure.ac: Add --with-upc-memory-page-size switch.
+ * config.h.in: Re-generate.
+ * configure: Re-generate.
+ * portals4/gupcr_env.c: Add UPC_FORCETOUCH env variable. Set to
+ 1 (one) by default.
+ (gupcr_env_init): Decode UPC_FORCETOUCH env variable.
+ * portals4/gupcr_node.c (gupcr_mem_check): Touch each page
+ of the local shared memory to make sure that memory is NUMA local.
+ * portals4/gupcr_utils.c (gupcr_set_forcetouch_enabled): Add.
+ (gupcr_is_forcetouch_enabled): Add.
+ * portals4/gupcr_utils.h (gupcr_set_forcetouch_enabled): Add.
+ (gupcr_is_forcetouch_enabled): Add.
+
+2013-04-01 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_main.c (gupcr_init): Initialize runtime
+ interface first and set MYTHREAD right after, making sure that
+ MYTHREAD is valid while going through the Portals runtime
+ initialization.
+ Fix the error reporting on threads number mismatch.
+
+2013-03-30 Gary Funck <gary@intrepid.com>
+
+ * include/upc.h: Delete (deprecated) declaration
+ of prototype for upc_local_alloc(). It has been
+ removed in the UPC 1.3 spec.
+
+2013-03-30 Gary Funck <gary@intrepid.com>
+
+ Implement upc_castable library support (per UPC 1.3 spec.)
+ * Makefile.am: Add upc_castable.h as an exported header file.
+ Add smp/upc_castable.upc and portals4/gupcr_castable.upc
+ to list of runtime source files.
+ * Makefile.in: Re-generate.
+ * include/upc_castable.h: New.
+ * portals4/gupcr_castable.upc: New.
+ * smp/upc_castable.upc: New.
+
+2013-03-30 Gary Funck <gary@intrepid.com>
+
+ * portals4/gupcr_coll_reduce.in: Change printf format in
+ error message to match the type of upc_op_t, which is
+ now 'unsigned long'.
+ * portals4/gupcr_coll_reduce.upc: Re-generate.
+
+2013-03-29 Gary Funck <gary@intrepid.com>
+
+ Implement and use upc_types.h (per UPC 1.3 spec.)
+ * Makefile.am: Add upc_types.h as an exported header file.
+ * Makefile.in: Re-generate.
+ * collectives/upc_coll_err.upc: Fix check for out-of-range
+ collective operation op code. Use UPC_MAX_COLL_OP.
+ * include/upc_collective.h: #include upc_types.h
+ Define UPC_MAX_COLL_OP, the maximum collectives opcode value.
+ * include/upc_types.h: New.
+
+2013-03-27 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Add configuration option for selecting a job
+ launcher (slurm, yod). Default is slurm.
+ * configure: Regenerate.
+ * config.h.in: Regenerate.
+ * portals4/gupcr_runtime.c: Select the right pmi.h based on
+ the job launcher configuration.
+
+2013-02-20 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.tgt: Add "-lpthread" if linking with
+ portals4 runtime. Newer systems are linking with
+ the ld.gold which does no allow for linking to
+ required libraries through intermediate objects/libraries.
+
+2012-12-11 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: As libgupc is not built yet, make sure
+ that UPC compiler does not pre-include gcc-upc.h and
+ gcc-upc-lib.h while performing configuration checks.
+ * configure: Regenerate.
+
+2012-11-27 Gary Funck <gary@intrepid.com>
+
+ * config/default/upc-crt-config.h: Remove check for
+ TARGET_ASM_NAMED_SECTION.
+ * smp/upc_config.h: Avoid multiple definition of __USE_GNU.
+ * smp/upc_lock.upc: Use local search (") quoting in #include.
+ * upc-crtstuff.c: Update copyright notice and fix minor typos.
+
+2012-11-19 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_mem.c (upc_memput): Add appropriate checks
+ for proper UPC data ordering. All requests in size above the
+ GUPCR_PORTALS_MAX_ORDERED_SIZE must be treated as strict.
+ (upc_memcopy): Ditto.
+ (upc_memset): Ditto.
+
+2012-11-08 Nenad Vukicevic <nenad@intrepid.com>
+
+ * portals4/gupcr_portals.c (gupcr_get_datatype): Rename
+ to gupcr_get_atomic_datatype to name it correctly. Use
+ PTL_DOUBLE_COMPLEX atomic type as a container for 16 bytes
+ CSWAP operations. The MCS lock implementation requires CSWAP
+ on a pointer to shared which is 16 bytes in the struct
+ configuration.
+ * portals4/gupcr_portals.h: Rename gupcr_get_datatype.
+ * portals4/gupcr_lock_sup.c (gupcr_lock_swap): Ditto.
+ (gupcr_lock_cswap): Ditto.
+
+2012-11-08 Nenad Vukicevic <nenad@intrepid.com>
+
+ Prevent data tearing on accessing a pointer to shared in
+ the shared address space.
+ * portals4/gupcr_lock_sup.c (gupcr_lock_get): New.
+ * portals4/gupcr_lock_sup.h: Add extern def for gupcr_lock_get.
+ * portals4/gupcr_lock.upc (upc_unlock): Access data that can
+ be changed by other threads via Portals interface.
+
+2012-11-08 Nenad Vukicevic <nenad@intrepid.com>
+
+ Replace the usage of spin locks to regular UPC locks in
+ the heap allocation implementation.
+ * Makefile.am (UPC_RUNTIME_SRC): Remove spin lock source
+ files. Add gupcr_lock.h.
+ * Makefile.in; Regenerate.
+ * portals4/gupcr_lock.h: New. External definitions for heap
+ allocation locks.
+ * portals4/gupcr_lock.upc: Declare heap allocation locks.
+ (gupcr_lock_heap_sup_init): New. Initialize heap allocation locks.
+ * portals4/gupcr_alloc.upc: Remove spin lock declarations.
+ (gupcr_alloc_init): Remove spin lock initialization.
+ (gupcr_heap_init_info): Replace spin lock with UPC lock.
+ (gupcr_heap_region_alloc): Ditto.
+ (gupcr_heap_alloc): Ditto.
+ (gupcr_heap_free): Ditto.
+ * portals4/gupcr_lock_sup.h (gupcr_lock_heap_sup_init): Add external
+ definition.
+ * portals4/gupcr_lock_sup.c (gupcr_lock_init): Call the heap
+ allocation locks initialization.
+ * portals4/gupcr_slock.h: Delete.
+ * portals4/gupcr_slock.upc: Delete.
+
+2012-11-08 Nenad Vukicevic <nenad@intrepid.com>
+
+ * testsuite/lib/libgupc.exp: Set the "-B" option at the right
+ place so we support command that runs the tests on multiple
+ targets. The previous version failed on building RPMs that
+ tested "unix,unix/-fstack-protector" targets.
+
+2012-10-26 Nenad Vukicevic <nenad@intrepid.com>
+
+ Place shared initialization code into the .text
+ section instead of a separate .upc_init section.
+ * config/default/upc-crt-config.h (UPC_INIT_SECTION_BEGIN):
+ Delete.
+ (UPC_INIT_SECTION_END): Delete.
+ * config/darwin/upc-crt-config.h: Ditto.
+ * upc-crtstuff.c: Remove declarations for .upc_init
+ section start/end.
+
+2012-10-24 Nenad Vukicevic <nenad@intrepid.com>
+
+ * smp/upc_main.c (__upc_monitor_threads): Allow for MPIR
+ debug connection while waiting for threads. STAT requires
+ job launcher to periodically call MPIR_Breakpoint(). If
+ killpg() fails call exit() instead of abort to avoid recursion
+ in handling signals.
+
+2012-10-24 Nenad Vukicevic <nenad@intrepid.com>
+
+ * Makefile.am: Add more files for cleanup.
+ * Makefile.in: Regenerate.
+ * smp/upc_tick.c: Add proper casting for calculating
+ nanoseconds from sec/micro-sec if gettimeofday() call was used.
+
+2012-10-23 Nenad Vukicevic <nenad@intrepid.com>
+ Gary Funck <gary@intrepid.com>
+
+ Implement Portals4-based UPC runtime.
+ * configure.ac: Add a check for --with-upc-runtime=portals4.
+ Disable multilib when building libgupc for the portals4 based
+ UPC runtime. Portals4 does not currently support
+ 32-bit targets. Implement additional UPC runtime configuration
+ switches, currently supported by the portals4 based UPC
+ runtime. Check if the user has requested that 'doxygen'
+ design documentation generation is enabled.
+ * configure.tgt: Add portals4 library linker switches if
+ the portals4 based runtime has been enabled via a configure option.
+ * Makefile.am: Add make rules to build the portals4 based runtime
+ when enabled via a configuration option.
+ * aclocal.m4: Re-generate.
+ * config.h.in: Re-generate.
+ * configure: Re-generate.
+ * Makefile.in: Re-generate.
+ * testsuite/Makefile.in: Re-generate.
+ * ax_prog_doxygen.m4: New. Doxygen support.
+ * dox-filter-config-h: New. Doxygen support.
+ * doxygen-include.am: New. Doxygen support.
+ * doxygen.sty.in: New. Doxygen support.
+ * header.tex.in: New. Doxygen support.
+ * portals4/doxygen.cfg.in: New. Doxygen support.
+ * collectives/gen-upc-coll-reduce.pl: Add additional pattern
+ substitutions when expanding collectives customized for use
+ with portals.
+ * collectives/upc_coll_prefix_reduce.in: Ditto.
+ * collectives/upc_coll_reduce.in: Ditto.
+ * portals4/gcc-upc-lib.in: New.
+ * portals4/gupcr_access.c: New.
+ * portals4/gupcr_access.h: New.
+ * portals4/gupcr_addr.c: New.
+ * portals4/gupcr_alloc.h: New.
+ * portals4/gupcr_alloc.upc: New.
+ * portals4/gupcr_barrier.c: New.
+ * portals4/gupcr_barrier.h: New.
+ * portals4/gupcr_broadcast.c: New.
+ * portals4/gupcr_broadcast.h: New.
+ * portals4/gupcr_clock.c: New.
+ * portals4/gupcr_coll_broadcast.upc: New. Collectives support
+ that uses portals4 collective operations.
+ * portals4/gupcr_coll_init.upc: New. Ditto.
+ * portals4/gupcr_coll_reduce.in: New. Ditto.
+ * portals4/gupcr_coll_reduce.upc: New. Ditto.
+ * portals4/gupcr_coll_sup.c: New. Ditto.
+ * portals4/gupcr_coll_sup.h: New. Ditto.
+ * portals4/upc_coll.h: New. Ditto.
+ * portals4/gupcr_config.h: New.
+ * portals4/gupcr_defs.h: New.
+ * portals4/gupcr_env.c: New.
+ * portals4/gupcr_gmem.c: New.
+ * portals4/gupcr_gmem.h: New.
+ * portals4/gupcr_lib.h: New.
+ * portals4/gupcr_lock_sup.c: New.
+ * portals4/gupcr_lock_sup.h: New.
+ * portals4/gupcr_lock.upc: New.
+ * portals4/gupcr_main.c: New.
+ * portals4/gupcr_mem.c: New.
+ * portals4/gupcr_node.c: New.
+ * portals4/gupcr_node.h: New.
+ * portals4/gupcr_node_mem_mmap.c: New.
+ * portals4/gupcr_node_mem_posix.c: New.
+ * portals4/gupcr_pgm_info.c: New.
+ * portals4/gupcr_portals.c: New.
+ * portals4/gupcr_portals.h: New.
+ * portals4/gupcr_pts.h: New.
+ * portals4/gupcr_runtime.c: New.
+ * portals4/gupcr_runtime.h: New.
+ * portals4/gupcr_shutdown.c: New.
+ * portals4/gupcr_shutdown.h: New.
+ * portals4/gupcr_slock.h: New.
+ * portals4/gupcr_slock.upc: New.
+ * portals4/gupcr_sup.h: New.
+ * portals4/gupcr_sync.h: New.
+ * portals4/gupcr_tick.c: New.
+ * portals4/gupcr_utils.c: New.
+ * portals4/gupcr_utils.h: New.
+ * testsuite/lib/libgupc-dg.exp: Build 'yod' command line
+ when running tests with the portals4 based UPC runtime.
+ * testsuite/lib/libgupc.exp: Add 'yod' switches
+ when running tests with the portals4 based UPC runtime.
+
+2012-10-16 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add MCS lock implementation - fix for some 32 bit targets.
+ * Makefile.am (UPC_RUNTIME_SRC): Add upc_lock_sup.c file.
+ * Makefile.in: Regenerate.
+ * smp/upc_lock_sup.c: New. Provide 8 byte CSWAP for targets
+ that don't have it (PowerPC).
+
+2012-10-15 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add MCS lock implementation.
+ * configure.ac: Add max number of locks held by a thread.
+ * configure: Regenerate.
+ * Makefile.am (UPC_RUNTIME_SRC): Add lock related new files.
+ Removed upc_lock.c.
+ * Makefile.in: Regenerate.
+ * config.h.in: Regenerate.
+ * smp/upc_defs.h: Remove definition of upc_lock_t (new
+ implementation has more fields that are lock implementation
+ specific). Remove alloc lock from the upc_info_p as UPC lock
+ is used to protect alloc routines.
+ * smp/upc_lock.c: Delete.
+ * smp/upc_lock.h: Add prototype for lock init routine.
+ * smp/upc_lock_sup.h: MCS lock support routines for
+ signaling, swap, and compare/swap.
+ * smp/upc_main.c (__upc_per_thread_init): Call lock init.
+ (GUPCR_START): Remove init of alloc lock.
+ * smp/upc_lock.upc: New. New MCS lock implementation.
+
+2012-10-03 Gary Funck <gary@intrepid.com>
+
+ * gen-inline-libgupc.pl: Add logic to check for //begin
+ directives with no matching end.
+
+2012-10-02 nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Check for backtrace additional libraries only
+ if backtrace is enabled.
+ * configure: Regenerate.
+ * smp/upc_backtrace.c (__upc_backtrace): Change default trace
+ file to 'backtrace.THREAD-ID'.
+ (__upc_backtrace_init): Install backtrace signal handler only
+ if backtrace is enabled for faults.
+ (__upc_fault_handler): Do not announce signals, just restore
+ signals, print backtrace, and return. This causes a signal to
+ be taken again, but this time monitor thread is informed.
+ (__upc_fatal_backtrace): No need to check env variable as signal
+ handler is conditionally installed.
+
+2012-09-26 Gary Funck <gary@intrepid.com>
+
+ * collectives/upc_coll_sort.upc: Remove reference to
+ deprecated upc_local_alloc function.
+ * configure.ac: Revert - do not restore saved LIBS value
+ when checking for librt.
+ * configure: Re-generate.
+ * include/upc.h (upc_all_free, upc_all_freeg, upc_all_lock_free,
+ upc_all_lock_freeg): New. Define collective de-allocation functions.
+ (upc_local_allocg, upc_local_alloc): Add "deprecated" attribute.
+ * include/upc_tick.h: New. Define wall/clock timer library functions.
+ * Makefile.am (include/upc_tick.h, smp/upc_tick.c): New.
+ * Makefile.in: Re-generate.
+ * smp/upc_allocg.upc (upc_all_freeg): New.
+ * smp/upc_alloc.upc (upc_local_alloc): Delete.
+ (upc_all_free): New.
+ * smp/upc_config.h: Include time-related system header files.
+ * smp/upc_libg.c (upc_all_lock_freeg): New.
+ * smp/upc_lib.h (upc_local_alloc): Delete prototype.
+ (upc_all_free, upc_all_lock_free): New prototype.
+ (upc_tick_t): New typedef.
+ (upc_ticks_now, upc_ticks_to_ns): New prototype.
+ * smp/upc_lock.c (upc_all_lock_free): New.
+ * smp/upc_tick.c: New.
+
+2012-09-20 Nenad Vukicevic <nenad@intrepid.com>
+
+ * smp/upc_main.c (__upc_monitor_threads): Install
+ SIGTERM handler for the monitor thread. Use process
+ group (instead of PID) for killpg(). Announce child
+ KILL signal if upc global exit is not underway.
+ (__upc_sigterm_handler): New. Terminate the program on
+ SIGTERM to the monitor thread.
+
+2012-09-04 Nenad Vukicevic <nenad@intrepid.com>
+
+ Move MPIR related variables/functions into a separate file.
+ * Makefile.am (UPC_RUNTIME_SRC): Add upc_debug.c
+ * Makefile.in: Regenerate.
+ * smp/upc_main.c: Move MPIR specific variables into upc_debug.c.
+ (MPIR_Breakpoint): Delete. Move into upc_debug.c.
+ (MPIR_i_am_starter): Delete. Move into upc_debug.c.
+ (MPIR_ignore_queues): Delete. Move into upc_debug.c.
+ (MPIR_force_to_main): Delete. Move into upc_debug.c.
+ * smp/upc_debug.c: New. All MPIR related variables and procedures
+ are in this file now.
+
+2012-09-04 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add backtrace logging into files.
+ * upc_backtrace.h (GUPCR_BACKTRACE_FILE_ENV): New. File prefix
+ for backtrace log file.
+ * upc_backtrace.c (__upc_backtrace): Save backtrace logs into the
+ file if environment variable UPC_BACKTRACEFILE is defined. Do not
+ show traces above upc_main.
+ (__upc_backtrace_thread_map): Rename to __upc_backtrace_monitor.
+ (__upc_backtrace_monitor): If logging into files is specified, monitor
+ thread sends backtrace signal to all UPC threads.
+
+2012-08-30 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc_defs.h (upc_info_struct): Added host name and
+ flag for MPIR partial attach support.
+ * upc_main.c: Add MPIR_partial_attach_ok support.
+ (__upc_init): Set start flag for all threads based on
+ the debugging mode. Initialize hostname in the info
+ structure.
+ (__upc_run_this_thread): Wait on start flag if necessary.
+ (__upc_run_threads): Release threads after MPIR_Breakpoint().
+ Set host_name and executable_name in the info structure.
+ (__upc_print_help_and_exit): Removed help for unused flag
+ -fupc-pthreads-per-process-N.
+
+2012-08-29 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc_backtrace.h (__upc_backtrace_restore_handlers): New.
+ Prototype.
+ * upc_backtrace.c (__upc_backtrace_restore_handlers): New.
+ Restore default signal handlers.
+ (__upc_backtrace_init): Install handlers for additional signals:
+ SIGABRT, SIGILL, SIGFPE, and SIGBUS.
+ (__upc_fault_handlers): Add handling of additional signals.
+ * upc_main.c (__upc_fatal): Restore default handlers before calling
+ backtrace and abort.
+
+2012-08-28 Nenad Vukicevic <nenad@intrepid.com>
+
+ * include/gcc-upc.h (upc_fence): Delete. Replaced with the
+ library specific definition in gcc-upc-lib.h
+ (__BERKELEY_UPC_RUNTIME__): Delete. Remove conditional compile
+ for upc_fence and upc_poll if compiled with the Berkeley
+ runtime as they are already provided in gcc-upc-lib.h.
+ * smp/gcc-upc-lib.in (upc_fence): Add.
+ * smp/upc_access.h (__upc_fence): Add prototype.
+ * smp/upc_access.c (__upc_fence): Add SMP upc_fence implementation.
+
+2012-08-22 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc_defs.h: Additional clean-up related to the new barrier
+ implementation.
+ (upc_barrier_id_t): Delete.
+ (upc_barrier_info_t): Delete.
+ (upc_barrier_info_p): Delete.
+ (upc_info_t): Remove barrier from the upc info structure.
+ (__upc_barrier_id): New.
+ * upc_barrier.upc (__upc_barrier_id): Make it global.
+ * upc_backtrace.c (__upc_backtrace): Print barrier ID from the
+ new implementation.
+
+2012-08-15 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add tree based barrier implementation for SMP-based UPC run-time.
+ * configure.ac: Add configuration for the barrier tree fanout.
+ Add checking for __sync_fetch_and_add built-in function.
+ * configure: Re-generate.
+ * config.h.in: Re-generate.
+ * Makefile.am (AM_UPCFLAGS): Added -fno-strict-aliasing
+ to prevent alias warning when converting from pointer-to-shared
+ into its internal representation.
+ (UPC_RUNTIME_SRC): Remove upc_barrier.c.
+ (UPC_RUNTIME_SRC): Add upc_barrier.upc.
+ * Makefile.in: Re-generate.
+ * smp/gcc-upc-lib.in: Add inclusion of atomic/spin_until code when
+ compiling inside the target library. Replace lib_atomic_cas name
+ to lib_atomic to cover more then CAS atomic.
+ * smp/upc_barrier.c: Delete.
+ * smp/upc_barrier.upc: Add. A new tree based barrier implementation.
+ * smp/upc_config.h (INT_MIN): Make it available for inlined code
+ under int_min_max.
+ * smp/upc_main.c (__upc_per_thread_init): Add call to initialize
+ barrier implementation.
+ * smp/upc_sync.h (__upc_atomic_cas): Move from upc_sysdep.h.
+ (__upc_sync_fetch_and_add): New.
+ (__upc_spin_until): Move from upc_sysdep.h.
+ (__upc_num_cpus): Move from upc_sysdep.h.
+ * smp/upc_sysdep.h (__upc_atomic_cas): Delete.
+ (__upc_spin_until): Delete.
+ (__upc_num_cpus): Delete.
+ * smp/upc_sup.h (__upc_barrier_init): Add external definition.
+ (__upc_map_to_local): New. Map shared pointer into local address.
+
+2012-07-31 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Added help description for --with-bfd,
+ --with-bfd-include, and --with-bfd-lib.
+ * configure: Re-generate.
+
+2012-07-31 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Remove extra white space at end-of-line.
+ * Makefile.am: Ditto.
+ * Makefile.in: Re-generate.
+
+2012-07-31 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Improve diagnostics for options
+ that control UPC stack backtrace support.
+ * configure: Re-generate.
+
+2012-07-31 Gary Funck <gary@intrepid.com>
+
+ * configure.ac: Shorten long lines. Improve the
+ consistency of first letter capitalization and
+ remove periods from all except AC_DEFINE's.
+ * acinclude.m4: Ditto.
+ * configure: Re-generate.
+ * config.h.in: Re-generate.
+
+2012-07-14 Gary Funck <gary@intrepid.com>
+
+ * acinclude.m4 (LIBGUPC_CHECK_SYNC_BUILTINS): Remove
+ set-but-not-used variable in the check for builtin sync. ops.
+ * configure: Re-generate.
+
+2012-07-03 Gary Funck <gary@intrepid.com>
+
+ * libgupc.texi: Include gpl_v3.texi instead of gpl.texi.
+
+2012-06-09 Nenad Vukicevic <nenad@intrepid.com>
+
+ * Makefile.am: Removed indented spaces on if/endif.
+
+2012-06-08 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add backtrace support for UPC SMP run-time.
+ * configure.ac: Added UPC backtrace configuration
+ options (--enable-upc-backtrace, --enable-upc-backtrace-gdb,
+ --with-upc-backtrace-gdb, --enable-upc-backtrace-signal,
+ --with_upc-backtrace-signal). Fix the check for 'gettime' to
+ save/restore libraries on the check line.
+ * configure: Regenerate.
+ * config.h.in: Regenerate.
+ * Makefile.am (AM_CPPFLAGS): Add include path for bfd.h.
+ (UPC_RUNTIME_SRC): Add new source files for backtrace.
+ (UPC_BACKTRACE_SUP): New.
+ * Makefile.in: Regenerate.
+ * testsuite/Makefile.in: Regenerate.
+ * configure.tgt (LIBS): Added options for linking with libbfd,
+ libdl. Added -export-dynamic if -rdynamic option is supported.
+ * smp/upc_backtrace.h: New. Backtrace API.
+ * smp/upc_backtrace.c: New. Backtrace support functions.
+ * smp/upc_backtrace_sup.c: New. Source file/line search support
+ functions.
+ * smp/upc_main.c (__upc_fatal): Added call to backtrace.
+ (__upc_monitor_threads): Added code to continue monitoring threads
+ if the wait() was interrupted by a signal (e.g. backtrace request
+ signal).
+ * smp/upc_sysdep.h (__upc_create_temp_file): Add prototype.
+ * smp/upc_sysdep.c (__upc_create_temp_file): Made public.
+
+2012-05-19 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_main.c (__upc_per_thread_init):
+ Change the declaration of GUPCR_INIT_ARRAY_START
+ and GUPCR_INIT_ARRAY_END so that the optimizer does
+ not conclude that the per-thread initialization procedure table
+ has only a single element.
+
+2012-05-04 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Check for gupc driver only.
+ Use gupc driver instead of xgupc. Add -fno-upc-pre-include
+ on the command line to prevent inclusion of gcc-upc.h
+ * configure: Regenerate.
+ * Makefile.am (AM_CPPFLAGS): Add -isystem option to
+ allow compiler to find upc.h.
+ * Makefile.in: Regenerate.
+ * include/upc.h (upc_global_lock_alloc): Fix prototype.
+ (upc_all_lock_alloc): Fix prototype.
+ * include/upc_collective.h (upc_coll_init): Fix prototype.
+ * testsuite/lib/libgupc.exp: Added appropriate options to
+ compile the tests with gupc from the build tree.
+
+2012-05-02 Nenad Vukicevic <nenad@intrepid.com>
+
+ Add memory fence to the low level lock support routines
+ that are called for multiple places in the run-time.
+ * smp/upc_sysdep.c (__upc_acquire_lock): Add a memory fence
+ once lock is acquired.
+ (__upc_try_acquire_lock): Add a memory fence is lock is
+ acquired.
+ (__upc_release_lock): Add a memory fence before releasing
+ the lock.
+ * smp/upc_lock.c (upc_lock): Remove memory fence.
+ (upc_lock_attempt): Ditto.
+ (upc_unlock): Ditto.
+
+2012-04-30 Nenad Vukicevic <nenad@intrepid.com>
+
+ * testsuite/libgupc.upc/upc.exp: Use '-fupc-threads'
+ option instead of '-n' as the new GUPC driver does not
+ support it.
+
+2012-04-16 Nenad Vukicevic <nenad@intrepid.com>
+
+ * smp/upc_lock.c (upc_lock): Adding a fence as per the
+ language specification. This also forces the processor to
+ discard all speculative memory fetches.
+ (upc_lock_attempt): Ditto.
+ (upc_ulock): Ditto.
+
+2012-04-13 Nenad Vukicevic <nenad@intrepid.com>
+
+ * smp/upc_sync.h (GUPCR_WRITE_FENCE): Change write fence
+ for PPC processors to use light weight sync instruction.
+ * smp/upc_sysdep.c (__upc_atomic_get_bit): Introduce a read barrier
+ to force processor to discard all speculative memory fetches.
+
+2012-03-26 Nenad Vukicevic <nenad@intrepid.com>
+
+ * testsuite/lib/libgupc.exp: Added fortran-modules.exp
+ for explicit load from the gcc testsuite directory. It is
+ a required file for gcc-dg.exp.
+
+2012-02-02 Nenad Vukicevic <nenad@intrepid.com>
+
+ * Makefile.am: Prevent install from adding suffix to the
+ link script (gupc.ld).
+ (toolexeclib_SCRIPTS) remove upc link script.
+ (nodist_toolexeclib_HEADERS) add upc link script.
+ * Makefile: Regenerate.
+ * configure: Regenerate.
+
+2012-01-24 Nenad Vukicevic <nenad@intrepid.com>
+
+ * smp/upc_pgm_info.c (__upc_validate_pgm_info): Fix the error
+ where the very first entry on the compiled thread info list is
+ not checked.
+
+2012-01-09 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_pgm_info.c (__upc_validate_pgm_info): Ignore intervening
+ null bytes in the UPC program information section, to ensure that
+ all configuration information strings are processed. Allow
+ static THREADS compilations to be mixed with dynamic THREADS
+ compilations as long as the static THREADS values all match.
+
+2011-12-19 Nenad Vukicevic <nenad@intrepid.com>
+
+ Improve handling of shared pointer vaddr field. Make sure
+ that upc_addrfield() always returns an offset of the shared variable
+ from the beginning of the shared section.
+ * smp/upc_pts.h (GUPCR_PTS_VADDR): Macro definition returns the
+ offset of the shared variable in the shared section.
+ (GUPCR_PTS_SET_VADDR): Macro definition accepts the offset of the
+ shared variable in the shared section and sets the value of the
+ vaddr: offset for packed pts rep, address for struct pts rep.
+ * smp/upc_main.c (__upc_init): Adjust the argument for setting of
+ pointer-to-shared vaddr field.
+ * smp/upc_alloc.upc: Adjust the argument for building a
+ pointer-to-shared to the offset of the shared variable in the
+ shared section.
+
+2011-12-17 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Remove erroneous check for enable_shared. Build
+ libgupc only as a static library as shared data sections from
+ all the UPC compilations must be combined into a single
+ contiguous section.
+ * configure.tgt: Always include the necessary libraries required by
+ libgupc on the command line. This is necessary as we don't build
+ libgupc as a dynamic link library.
+ * configure: Re-generate.
+
+2011-11-19 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_sync.h (GUPCR_WRITE_FENCE, GUPCR_READ_FENCE):
+ For powerpc, also check __PPC__ pre-processor definition,
+ as 'PPC' is apparently not defined on 64-bit PPC targets.
+ * smp/upc_sysdep.c (__upc_atomic_cas): Implement as external
+ procedure only if builtin compare-and-swap is unavailable.
+ * smp/upc_sysdep.h (__upc_atomic_cas): Ditto.
+
+2011-11-09 Nenad Vukicevic <nenad@intrepid.com>
+
+ * config/default/upc-crtstuff.mak (ALL_CRT_CFLAGS): Remove
+ $(INCLUDES) as it might contain relative include paths that
+ are not correct for current build directory.
+ (GCC_SRCDIR_INC): Rename from GCC_SRCDIR_CONF_INC. Added necessary
+ include paths to build in the current libgupc build directory.
+
+2011-10-27 Nenad Vukicevic <nenad@intrepid.com>
+
+ * smp/upc_sup.h (__upc_sptr_to_addr): Fixed the warning where
+ 'void *' type was used in arithmetic.
+ * smp/upc_mem.h (__upc_memget): Ditto.
+ * (__upc_memput): Ditto.
+
+2011-10-27 Nenad Vukicevic <nenad@intrepid.com>
+
+ * upc-crtstuff.c: Remove unnecessary includes that caused
+ multiple defined warnings.
+
+2011-10-26 Gary Funck <gary@intrepid.com>
+
+ Rename "GCC/UPC" to "GNU UPC", "UPC" to "GUPC", and
+ "libupc" to "libgupc".
+ * top-level/libgupc: rename from libupc.
+ * configure.ac: Change "GCC UPC" references to "GNU UPC".
+ Change "libupc" references to "libgupc". Change "xupc" references
+ to "xgupc". Change "upc-cmd" references to "gupc".
+ Change "gen-gccupc-ld-script.pl" references to "gen-upc-ld-script.pl".
+ Change "libupc.spec" references to "libgupc.spec".
+ * configure: Re-generate.
+ * Makefile.am: Change "libupc" references to "libgupc".
+ * Makefile.in: Re-generate.
+ * config.h.in: Adjust for rename of libupc to libgupc.
+ * configure.tgt: Ditto.
+ * acinclude.m4: Ditto.
+ * gen-inline-libgupc.pl: Re-name from gen-gccupc-inline-lib.pl
+ Change "GCC/UPC" to "GUPC".
+ * gen-upc-ld-script.pl: Re-name from gen-gccupc-ld-script.pl.
+ * libgupc.texi: Re-name from libupc.texi.
+ * libgupc.spec.in: Re-name from libupc.spec.in.
+ * smp/upc_pgm_info.c (__upc_validate_pgm_info): Change "GCC/UPC"
+ references to "GUPC".
+ * smp/upc_main.c (__upc_run_threads): Ditto.
+ * smp/upc_gasp.c: Ditto.
+ * smp/upc_sysdep.h: Ditto.
+ * testsuite/lib/libgupc-dg.exp: Re-name form libupc-dg.exp.
+ * testsuite/lib/libgupc.exp: Re-name from libupc.a.
+ * testsuite/libgupc.upc: Re-name from libupc.upc.
+
+2011-10-18 Nenad Vukicevic <nenad@intrepid.com>
+
+ Fix support for large file support on 32-bit machines.
+
+ * smp/upc_config.h: Move inclusion of 'config.h' to the top
+ of the include list. This allows all system include files
+ to see definition of _FILE_OFFSET_BITS=64 that enables large
+ file support.
+
+2011-10-02 Gary Funck <gary@intrepid.com>
+
+ Move the collectives library sources into their own directory
+ and add support for additional runtime implementation models.
+ * collectives/gen-upc-coll-reduce.pl: Moved from 'smp' directory.
+ * collectives/upc_coll_broadcast.upc: Ditto.
+ * collectives/upc_coll_err.upc: Ditto.
+ * collectives/upc_coll_exchange.upc: Ditto.
+ * collectives/upc_coll_gather_all.upc: Ditto.
+ * collectives/upc_coll_gather.upc: Ditto.
+ * collectives/upc_coll.h: Ditto.
+ * collectives/upc_coll_init.upc: Ditto.
+ * collectives/upc_coll_permute.upc: Ditto.
+ * collectives/upc_coll_prefix_reduce.in: Ditto.
+ * collectives/upc_coll_prefix_reduce.upc: Ditto.
+ * collectives/upc_coll_readme.txt: Ditto.
+ * collectives/upc_coll_reduce.in: Ditto.
+ * collectives/upc_coll_reduce.upc: Ditto.
+ * collectives/upc_coll_scatter.upc: Ditto.
+ * collectives/upc_coll_sort.upc: Ditto.
+ * smp/gcc-upc-lib.in: Moved from 'include' directory.
+ * gen-gccupc-inline-lib.pl: Moved from 'smp' directory.
+ * gen-gccupc-ld-script.pl: Ditto.
+ * configure.ac: Implement support for additional runtime
+ models. (Currently, only 'smp' is supported.)
+ Build the collectives library from sources in the
+ collectives directory.
+ * Makefile.am: Likewise.
+ * configure: Re-generate.
+ * config.h.in: Re-generate.
+ * Makefile.in: Re-generate.
+
+2011-09-30 Gary Funck <gary@intrepid.com>
+
+ Generalize collectives library to support indefinite block sizes.
+ * smp/upc_coll_prefix_reduce.in: If 'blk_size' is zero, then set it
+ to 'nelems'.
+ * smp/upc_coll_reduce.in: Ditto.
+ * smp/upc_coll_prefix_reduce.upc: Re-generate.
+ * smp/upc_coll_reduce.upc: Re-generate.
+
+2011-09-19 Gary Funck <gary@intrepid.com>
+
+ * libupc/smp/upc_access.c (__getstf2, __getsxf2):
+ Define temporary as "long double" rather than "double" to avoid
+ loss of precision.
+ * testsuite/libupc.upc/intrepid/test29.upc: Improve the test of
+ "long double" by adding checks that required accuracy
+ exceeds the accuracy of "double".
+
+2011-09-02 Gary Funck <gary@intrepid.com>
+
+ Align UPC pointers-to-shared, only if the target enforces
+ strict alignment.
+ * configure.ac: Derive GUPCR_PTS_ALIGN from __UPC_PTS_ALIGN__,
+ if present. Define GUPCR_PTS_ALIGN as a config.h variable.
+ * smp/upc_pts.h (GUPCR_PTS_ALIGN): Use only if defined.
+ * config.h.in: Re-generate.
+ * configure: Re-generate.
+
+2011-08-23 Nenad Vukicevic <nenad@intrepid.com>
+
+ * configure.ac: Enable detection of large file support on
+ 32-bit machines.
+ * configure: Re-generate.
+ * config.h.in: Added define for large file support on 32-bit
+ machines.
+ * smp/upc_config.h: Limit number of VM pages to the number
+ of configured VADDR bits.
+ * smp/upc_sup.h: Prototype change.
+ * smp/upc_vm.c (__upc_vm_alloc): Return an error if no
+ more virtual pages can be allocated.
+ (__upc_vm_alloc): Abort if initial number of VM pages cannot
+ be allocated.
+ (__upc_vm_get_cur_page_alloc): Check for error before NUMA
+ memory region mapping.
+ * smp/upc_alloc.upc (__upc_global_heap_alloc): Return NULL pointer
+ if VM pages cannot be allocated.
+ (__upc_local_alloc): Return NULL pointer if memory is not available.
+
+2011-08-16 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_barrier.c (__upc_notify, __upc_wait):
+ Improve error messages.
+
+2011-08-10 Gary Funck <gary@intrepid.com>
+
+ Define UPCFLAGS so that it is available in the Makefile,
+ and assign CFLAGS as its default value.
+
+ * configure.ac (UPCFLAGS): Default to CFLAGS if not set.
+ (UPCFLAGS): Make it an AC_SUBST() so that it can
+ be referenced in the Makefile.
+ * Makefile.am (AM_UPCFLAGS): Make sure that it is update
+ the same as AM_CFLAGS.
+ * configure, Makefile.in: Re-generate.
+
+2011-06-06 Nenad Vukicevic <nenad@intrepid.com>
+
+ * smp/upc_config.h: Change default scheduling policy.
+ Allow the kernel to schedule UPC threads on its own.
+
+2011-05-17 Gary Funck <gary@intrepid.com>
+
+ * configure.ac (GUPCR_PTS_VADDR_FIELD,
+ Delete unused definitions.
+ configure: Regenerate.
+
+ * smp/upc_pts.h (GUPCR_PTS_THREAD_FIELD,
+ GUPCR_PTS_PHASE_FIELD): Delete unused definitions
+ and references.
+
+ * config.h.in (GUPCR_PTS_THREAD_FIELD,
+ GUPCR_PTS_PHASE_FIELD): Delete unused definitions
+ and references.
+
+ * upc-crtstuff.c: Delete include of "upc-conf.h".
+
+2011-05-03 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_alloc.upc (__upc_global_heap_alloc,
+ upc_free): Remove extraneous FIXME/TODO comments.
+
+2011-05-01 Gary Funck <gary@intrepid.com>
+
+ * configure.ac (upc_crtstuff_mak): New AC_SUBST variable.
+ * configure.tgt (upc_crtstuff_mak): Find upc-crtstuff.mak
+ on $config_path.
+ * Makefile.am (upc_crtstuff_mak): Set make variable to value
+ of configured AC_SUBST value. This eliminates an automake
+ error caused by a nested 'if' statement.
+ * configure, Makefile.in, testsuite/Makefile.in: Regenerate.
+
+2011-04-13 Gary Funck <gary@intrepid.com>
+
+ * testsuite/lib/libupc.exp (ALWAYS_CFLAGS):
+ Remove -lupc from required default switches.
+ The appropriate library is selected by the
+ libupc.spec file.
+
+2011-03-22 Gary Funck <gary@intrepid.com>
+
+ * configure.tgt: Move linker switches into libupc.spec.
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ Place error message strings directly into the calls to
+ __upc_fatal(), rather than listing them separately
+ as #define's. The intent of this change is to make
+ it easier to internationalize the message text
+ using standard tools.
+
+ * include/gcc-upc-lib.in: Remove include of lib_config_msgs
+ named code segment.
+
+ * smp/upc_config.h: Remove #define's used to provide named
+ references to error messages.
+
+ * smp/upc_lock.c, smp/upc_numa.c, smp/upc_access.c,
+ smp/upc_vm.c, smp/upc_main.c, smp/upc_alloc.upc,
+ smp/upc_sysdep.c, smp/upc_affinity.c, smp/upc_addr.c,
+ smp/upc_mem.h, smp/upc_barrier.c: Replace named references
+ with actual error message text strings.
+
+2011-03-20 Gary Funck <gary@intrepid.com>
+
+ Move UPC start files, end files, and linker specs.
+ into libupc. This reduces the impact on common GCC
+ configuration files, and ensures that these UPC-specific
+ components are only built when the UPC language dialect is built.
+
+ * upc-crtstuff.c: New file. Moved from gcc/upc/upc-crtstuff.c.
+
+ * config/darwin/upc-crt-config.h: New file. Move defines for
+ UPC-related section begins/ends from gcc/config/darwin.h to here.
+
+ * config/default/upc-crt-config.h: New file. Move defines for
+ UPC-related section begins/ends from gcc/config/upc-conf.h to here.
+
+ * config/default/upc-crtstuff.mak: New file. Default makefile fragment for
+ building the upc-crtbegin and upc-crtend object files.
+ This logic was moved from libgcc/Makefile.in to here.
+
+ * config.h.in: Regenerate with autoheader. Rename HAVE_GUM_DEBUG
+ to GUPCR_HAVE_GUM_DEBUG. Add define for HAVE_UPC_LINK_SCRIPT.
+
+ * configure.ac, configure: Include new configure.tgt script
+ towards the end of the logic that configures the smp runtime.
+ Define substitutions for 'config_path', 'XCFLAGS',
+ 'XLDFLAGS', 'link_upc_spec', 'upc_crtbegin_spec',
+ 'upc_crtend_spec', 'upc_crtstuff_objs'. Add LIBUPC_CRTSTUFF
+ automake conditional. Fix copyright date in AM_TOP() comment.
+ Define upc-crtbegin.spec libupc.spec upc-crtend.spec as
+ autoconf generated config. files. Regenerate 'configure'.
+
+ * configure.tgt: New. Target-specific configuration logic.
+ Defines 'config_path', 'upc_crtstuff', 'upc_crtbegin_spec',
+ 'upc_crtend_spec', 'upc_crtstuff_objs' variables; these are used
+ to control the build of the UPC-related begin/end files
+ and associated target-specific compiler specification files.
+
+ * libupc.spec.in, upc-crtbegin.spec.in, upc-crtend.spec.in: New.
+ Define target-specific compiler specifications for linking
+ and for inclusion of UPC-related start/end object files
+ when a UPC program is linked. These files are used
+ to create resulting .spec files that are included via
+ GCC's link spec. when a UPC program is linked.
+
+ * Makefile.am: Add rules to build and install upc-crtbegin.spec,
+ libupc.spec, and upc-crtend.spec from there .in files.
+ Add rules to build the UPC-specific start/end files if the
+ automake conditional LIBUPC_CRTSTUFF is enabled.
+ Fix references to make variables $(UPC_COLL_PREFIX_REDUCE_UPC)
+ and $(UPC_COLL_REDUCE_UPC) in MAINTAINER_MODE block.
+
+ * Makefile.in, testsuite/Makefile.in: Regenerate with automake.
+
+ * smp/Make-defs, smp/Make-deps, smp/Make-rules: Remove.
+ These Makefile fragments have not been used since libupc
+ was re-worked to use automake (when the gupc branch
+ was first checked in).
+
+ * smp/upc_config.h: Move the definitions of GUPCR_INIT_ARRAY_START
+ and GUPCR_INIT_ARRAY_END from smp/upc_main.c to here.
+
+ * smp/upc_main.c: Rename HAVE_GUM_DEBUG to GUPCR_HAVE_GUM_DEBUG.
+ Move the definitions of GUPCR_INIT_ARRAY_START and
+ GUPCR_INIT_ARRAY_END to smp/upc_config.h.
+
+2011-02-22 Gary Funck <gary@intrepid.com>
+
+ * include/gcc-upc.h (barrier, barrier_notify, barrier_wait,
+ forall, fence): Remove #define's that renamed these deprecated
+ UPC keywords into their equivalents in the current UPC
+ language specification.
+
+2011-02-08 Gary Funck <gary@intrepid.com>
+
+ * acinclude.m4, configure.ac, include/gasp.h,
+ include/gasp_upc.h, include/gcc-upc.h, include/gcc-upc-lib.in,
+ include/pupc.h, include/upc_collective.h, include/upc.h,
+ include/upc_relaxed.h, include/upc_strict.h, libupc.texi,
+ smp/upc_access.c, smp/upc_accessg.c, smp/upc_access.h,
+ smp/upc_addr.c, smp/upc_affinity.c, smp/upc_affinity.h,
+ smp/upc_affinity_stub.c, smp/upc_allocg.upc,
+ smp/upc_alloc.upc, smp/upc_barrier.c, smp/upc_config.h,
+ smp/upc_debug.h, smp/upc_defs.h, smp/upc_gasp.c, smp/upc_gum.c,
+ smp/upc_libg.c, smp/upc_lib.h, smp/upc_lock.c, smp/upc_main.c,
+ smp/upc_mem.c, smp/upc_mem.h, smp/upc_numa.c, smp/upc_numa.h,
+ smp/upc_numa_stub.c, smp/upc_pgm_info.c, smp/upc_pts.h,
+ smp/upc_pupc.c, smp/upc_pupc.h, smp/upc_sup.h, smp/upc_sync.h,
+ smp/upc_sysdep.c, smp/upc_sysdep.h, smp/upc_vm.c:
+ Update copyright notices.
+
+2010-10-18 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_alloc.upc: upc_alloc.upc: remove pointer arithmetic on
+ (shared void *) types.
+
+ Now that GCC/UPC prohibits arithmetic on "(shared void *)" types,
+ re-work the logic in upc_alloc.upc to avoid operating directly on
+ "(shared void *)" type.
+
+2010-10-16 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_main.c: Fix comment format.
+
+2010-10-16 Gary Funck <gary@intrepid.com>
+
+ * smp/: upc_access.c, upc_access.h, upc_accessg.c: Implement fixes
+ for SGI/IRIX/MIPS port.
+
+ The gcc/Makefile.in rules for install-plugin had to be re-written to
+ break up a long list of header files that exceeded the command line
+ limitation imposed by Irix.
+
+ Access functions for TFmode types had to be implemented.
+ Apparently, this is the mode used for the SGI/MIPS port to represent
+ "long float".
+
+ See also: gcc/Makefile.in libupc/smp/upc_access.c
+ libupc/smp/upc_access.h libupc/smp/upc_accessg.c
+
+2010-10-16 Nenad Vukicevic <nenad@intrepid.com>
+
+ * include/gcc-upc.h, smp/upc_main.c: Fix rand() implementation for
+ pthreads run-time.
+
+ For the pthreads implementation we keep a per-thread random seed
+ number. This way, calls to rand() function will return the same
+ value on each thread.
+
+ rand() and srand() functions are redefined as __upc_random and
+ __upc_srandom.
+
+2010-10-10 Gary Funck <gary@intrepid.com>
+
+ * include/upc_collective.h, smp/gen-upc-coll-reduce.pl,
+ smp/upc_coll_prefix_reduce.upc, smp/upc_coll_reduce.upc:
+ Implement collectives on "long double" objects.
+
+ See also: libupc/include/upc_collective.h
+ libupc/smp/gen-upc-coll-reduce.pl
+ libupc/smp/upc_coll_prefix_reduce.upc libupc/smp/upc_coll_reduce.upc
+
+2010-10-09 Gary Funck <gary@intrepid.com>
+
+ * smp/: upc_access.c, upc_access.h, upc_accessg.c: Implement shared
+ access to "long float" data type.
+
+ See also: libupc/smp/upc_access.c libupc/smp/upc_access.h
+ libupc/smp/upc_accessg.c
+
+2010-09-24 Gary Funck <gary@intrepid.com>
+
+ * smp/upc_main.c: Fix bug: Failure to initialize per-thread
+ static variables that refer to shared addresses.
+
+ The shared data initialization routine created by the compiler needs
+ to be called on each thread, because in some cases it will
+ initialize per thread data. At the moment, the compiler does not
+ generate code that will differentiate between initialization code
+ that should only occur on thread 0, so some additional work may get
+ done. In the future, that aspect of initialization will be
+ corrected.
+
+2010-09-22 Gary Funck <gary@intrepid.com>
+
+ * include/gcc-upc-lib.in, include/upc.h, smp/upc_main.c:
+ Fix bug: Nested upc_forall() semantics are not implemented
+
+ The checkforall test in the Berkeley harness test suite indicated
+ that GCC/UPC was not properly implementing nested upc_forall
+ semantics. Nested upc_forall statements (both statically or
+ dynamically nested) must implement their affinity clause as if it
+ were "continue"; thus all steps in the loop must execute without
+ regard for affinity. To implement these semantics a global depth
+ counter, __upc_forall_depth, is maintained by the generated code
+ that implements upc_forall.
+
+ See also: gcc/c-parser.c gcc/c-tree.h gcc/stub-upc.c
+ gcc/upc/upc-act.c gcc/upc/upc-act.h libupc/include/gcc-upc-lib.in
+ libupc/include/upc.h libupc/smp/upc_main.c
+
+2010-09-18 Gary Funck <gary@intrepid.com>
+
+ * Makefile.in, config.h.in, configure, configure.ac, include/upc.h,
+ smp/Make-defs, smp/upc_accessg.c, smp/upc_allocg.upc,
+ smp/upc_defs.h, smp/upc_libg.c, smp/upc_main.c, smp/upc_sup.h:
+ Implement -fupc-debug switch.
+
+2010-02-28 Gary Funck <gary@intrepid.com>
+
+ Initial implementation and checkin.
+
diff --git a/libgupc/Makefile.am b/libgupc/Makefile.am
new file mode 100644
index 00000000000..9f5ef141a82
--- /dev/null
+++ b/libgupc/Makefile.am
@@ -0,0 +1,404 @@
+# Process this file with automake to produce Makefile.in
+
+ WARN_CFLAGS =
+if LIBGUPC_SMP_RUNTIME
+ targ_runtime_dir = smp
+ WARN_CFLAGS += -W -Wall -Wwrite-strings -Wstrict-prototypes -Werror
+ INC_CFLAGS =
+endif
+if LIBGUPC_PORTALS4_RUNTIME
+ targ_runtime_dir = portals4
+ WARN_CFLAGS += -W -Wall -Wwrite-strings -Wstrict-prototypes -Werror
+ PORTALS4_IFLAG = @portals4inc@
+ INC_CFLAGS = $(PORTALS4_IFLAG)
+endif
+
+ACLOCAL_AMFLAGS = -I . -I .. -I ../config
+
+## May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+
+config_path = @config_path@
+
+libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+
+LINK = $(LIBTOOL) --tag CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+ $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LTLDFLAGS) -o $@
+
+
+UPC_HDRS = include/upc_atomic.h include/upc_castable.h \
+ include/gasp.h include/gasp_upc.h include/gcc-upc.h \
+ include/pupc.h include/upc_collective.h include/upc.h \
+ include/upc_nb.h \
+ include/upc_relaxed.h include/upc_strict.h \
+ include/upc_tick.h include/upc_types.h
+
+libsubinclude_HEADERS = $(UPC_HDRS)
+nodist_noinst_HEADERS =
+nodist_libsubinclude_HEADERS =
+
+
+IN_LIB_CPPFLAGS = -DIN_GCC -DIN_TARGET_LIBS
+AM_CPPFLAGS = $(IN_LIB_CPPFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(INC_CFLAGS)
+AM_UPCFLAGS = $(WARN_CFLAGS) $(INC_CFLAGS) -fno-strict-aliasing
+
+
+SUBDIRS = testsuite
+
+
+if LIBGUPC_GENERIC_COLLECTIVES
+ collectives_dir = $(addprefix $(top_srcdir)/, collectives)
+else
+ collectives_dir =
+endif
+
+search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) \
+ $(addprefix $(top_srcdir)/, $(targ_runtime_dir)) \
+ $(collectives_dir) \
+ $(addprefix $(top_srcdir)/, include) \
+ $(top_srcdir)
+
+vpath % $(strip $(search_path))
+
+AM_CPPFLAGS += $(addprefix -I, $(search_path))
+AM_CPPFLAGS += $(addprefix -isystem, '.')
+AM_CPPFLAGS += @bfdinc@
+AM_CFLAGS += $(XCFLAGS)
+AM_UPCFLAGS += $(XCFLAGS)
+AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
+
+### Explicit build rules
+
+LIBGUPC_SRCDIR = $(top_srcdir)/$(targ_runtime_dir)
+
+MOSTLYCLEANFILES =
+UPC_RUNTIME_SRC =
+
+EXTRA_DIST = gen-inline-libgupc.pl gen-upc-ld-script.pl
+
+LIBGUPC_COLL_SRCDIR = $(top_srcdir)/collectives
+LIBGUPC_INC_SRCDIR = $(top_srcdir)/include
+LIBGUPC_PORTALS4_SRCDIR = $(top_srcdir)/portals4
+LIBGUPC_SMP_SRCDIR = $(top_srcdir)/smp
+UPC_OPS_DEF = $(LIBGUPC_INC_SRCDIR)/upc_ops.def
+UPC_TYPES_DEF = $(LIBGUPC_INC_SRCDIR)/upc_types.def
+
+EXTRA_DIST += $(UPC_OPS_DEFS) $(UPC_TYPES_DEF)
+
+AUTOGEN = autogen
+
+UPC_BACKTRACE_SUP =
+if LIBGUPC_BACKTRACE
+if LIBGUPC_PORTALS4_RUNTIME
+ UPC_BACKTRACE_SUP += portals4/gupcr_backtrace.h portals4/gupcr_backtrace.c
+else
+ UPC_BACKTRACE_SUP += smp/upc_backtrace.h smp/upc_backtrace.c
+endif
+endif
+if LIBGUPC_SMP_RUNTIME
+
+EXTRA_DIST += smp/gcc-upc-lib.in
+
+if LIBGUPC_PTHREADS
+libgupc_pt = libgupc_pt.la
+else
+libgupc_pt =
+endif
+
+# Even though we're using vpath, we have to qualify the
+# filenames with "smp/", because the libgupc_pt.la rules
+# won't find the dependents because the name of the target
+# doesn't match (ie, upc_access.c compiles into pt_upc_access_pt.lo)
+
+if LIBGUPC_AFFINITY
+ UPC_AFFINITY_SUP = smp/upc_affinity.c
+else
+ UPC_AFFINITY_SUP = smp/upc_affinity_stub.c
+endif
+if LIBGUPC_GUM
+ UPC_GUM_SUP = smp/upc_gum.c
+else
+ UPC_GUM_SUP =
+endif
+if LIBGUPC_NUMA
+ UPC_NUMA_SUP = smp/upc_numa.c
+else
+ UPC_NUMA_SUP = smp/upc_numa_stub.c
+endif
+
+if MAINTAINER_MODE
+
+UPC_ATOMIC_DEF = $(LIBGUPC_SMP_SRCDIR)/upc_atomic.def
+UPC_ATOMIC_TPL = $(LIBGUPC_SMP_SRCDIR)/upc_atomic.tpl
+UPC_ATOMIC_UPC = $(LIBGUPC_SMP_SRCDIR)/upc_atomic.upc
+
+EXTRA_DIST += $(UPC_ATOMIC_DEF) $(UPC_ATOMIC_TPL)
+
+$(UPC_ATOMIC_UPC): $(UPC_ATOMIC_DEF) $(UPC_ATOMIC_TPL) \
+ $(UPC_OP_DEF) $(UPC_TYPE_DEF)
+ cd $(LIBGUPC_SMP_SRCDIR); \
+ $(AUTOGEN) -L ../include upc_atomic.def
+endif
+
+UPC_RUNTIME_SRC += smp/upc_access.c smp/upc_accessg.c smp/upc_access.h \
+ smp/upc_addr.c smp/upc_affinity.h $(UPC_AFFINITY_SUP) \
+ smp/upc_allocg.upc smp/upc_alloc.upc \
+ smp/upc_atomic.upc \
+ $(UPC_BACKTRACE_SUP) \
+ smp/upc_barrier.upc smp/upc_castable.upc smp/upc_config.h \
+ smp/upc_debug.h smp/upc_debug.c \
+ smp/upc_defs.h smp/upc_gasp.c $(UPC_GUM_SUP) \
+ smp/upc_libat_lock.c smp/upc_libat_lock.h \
+ smp/upc_libg.c smp/upc_lib.h \
+ smp/upc_lock.upc smp/upc_lock.h \
+ smp/upc_lock_sup.h smp/upc_lock_sup.c \
+ smp/upc_main.c smp/upc_mem.c smp/upc_mem.h \
+ smp/upc_nb.upc smp/upc_numa.h $(UPC_NUMA_SUP) \
+ smp/upc_pgm_info.c smp/upc_pts.h smp/upc_pupc.c \
+ smp/upc_pupc.h smp/upc_sup.h smp/upc_sync.h smp/upc_sysdep.c \
+ smp/upc_sysdep.h smp/upc_tick.c smp/upc_vm.c
+
+UPC_RUNTIME_SRC_INLINE = config.h smp/upc_access.c smp/upc_access.h \
+ smp/upc_config.h smp/upc_defs.h smp/upc_mem.h smp/upc_pts.h \
+ smp/upc_sup.h smp/upc_sync.h
+
+endif ### LIBGUPC_SMP_RUNTIME ####
+
+if LIBGUPC_PORTALS4_RUNTIME
+
+EXTRA_DIST += portals4/gcc-upc-lib.in
+
+UPC_RUNTIME_SRC += portals4/gupcr_access.c portals4/gupcr_access.h \
+ portals4/gupcr_addr.c \
+ portals4/gupcr_alloc.upc portals4/gupcr_alloc.h \
+ portals4/gupcr_atomic.upc \
+ portals4/gupcr_atomic_sup.h portals4/gupcr_atomic_sup.c \
+ $(UPC_BACKTRACE_SUP) \
+ portals4/gupcr_barrier.h portals4/gupcr_barrier.c \
+ portals4/gupcr_broadcast.h portals4/gupcr_broadcast.c \
+ portals4/gupcr_castable.upc \
+ portals4/gupcr_clock.c \
+ portals4/gupcr_coll_sup.h portals4/gupcr_coll_sup.c \
+ portals4/gupcr_config.h portals4/gupcr_defs.h \
+ portals4/gupcr_env.c portals4/gupcr_gmem.h portals4/gupcr_gmem.c \
+ portals4/gupcr_lib.h \
+ portals4/gupcr_lock.upc portals4/gupcr_lock.h \
+ portals4/gupcr_lock_sup.c portals4/gupcr_lock_sup.h \
+ portals4/gupcr_main.c \
+ portals4/gupcr_nb.upc \
+ portals4/gupcr_nb_sup.c portals4/gupcr_nb_sup.h \
+ portals4/gupcr_node.c portals4/gupcr_node.h \
+ portals4/gupcr_mem.c portals4/gupcr_portals.c \
+ portals4/gupcr_pgm_info.c portals4/gupcr_pts.h \
+ portals4/gupcr_runtime.h portals4/gupcr_runtime.c \
+ portals4/gupcr_shutdown.h portals4/gupcr_shutdown.c \
+ portals4/gupcr_sup.h portals4/gupcr_sync.h \
+ portals4/gupcr_tick.c \
+ portals4/gupcr_utils.h portals4/gupcr_utils.c
+
+UPC_RUNTIME_SRC_INLINE = config.h portals4/gupcr_access.c \
+ portals4/gupcr_access.h portals4/gupcr_config.h \
+ portals4/gupcr_defs.h portals4/gupcr_gmem.h \
+ portals4/gupcr_node.h \
+ portals4/gupcr_portals.h portals4/gupcr_pts.h \
+ portals4/gupcr_sup.h portals4/gupcr_sync.h \
+ portals4/gupcr_utils.h
+
+if LIBGUPC_NODE_LOCAL_MEM_POSIX
+ UPC_RUNTIME_SRC += portals4/gupcr_node_mem_posix.c
+endif
+if LIBGUPC_NODE_LOCAL_MEM_MMAP
+ UPC_RUNTIME_SRC += portals4/gupcr_node_mem_mmap.c
+endif
+
+include doxygen-include.am
+MOSTLYCLEANFILES += $(DX_CLEANFILES)
+EXTRA_DIST += $(DX_CONFIG)
+
+# Portals runtime only partially uses generic collectives
+
+# We need full pathnames here, because vpath won't find
+# the files if they don't exist yet.
+UPC_COLL_PREFIX_REDUCE_UPC = $(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+UPC_COLL_REDUCE_UPC = $(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc
+
+if MAINTAINER_MODE
+$(UPC_COLL_PREFIX_REDUCE_UPC): gen-upc-coll-reduce.pl \
+ upc_coll_prefix_reduce.in
+ $(PERL) $+ > $@
+
+$(UPC_COLL_REDUCE_UPC): gen-upc-coll-reduce.pl gupcr_coll_reduce.in
+ $(PERL) $+ > $@
+endif
+
+UPC_RUNTIME_SRC += \
+ portals4/upc_coll.h portals4/gupcr_coll_broadcast.upc \
+ portals4/gupcr_coll_init.upc $(UPC_COLL_REDUCE_UPC)
+
+UPC_COLLECTIVES_SRC = \
+ collectives/upc_coll_err.upc collectives/upc_coll_exchange.upc \
+ collectives/upc_coll_gather_all.upc collectives/upc_coll_gather.upc \
+ collectives/upc_coll_permute.upc $(UPC_COLL_PREFIX_REDUCE_UPC) \
+ collectives/upc_coll_scatter.upc collectives/upc_coll_sort.upc
+
+UPC_RUNTIME_SRC += $(UPC_COLLECTIVES_SRC)
+
+EXTRA_DIST += gen-upc-coll-reduce.pl \
+ upc_coll_prefix_reduce.in \
+ gupcr_coll_reduce.in
+
+endif ### LIBGUPC_PORTALS_RUNTIME ####
+
+if LIBGUPC_GENERIC_COLLECTIVES
+
+# We need full pathnames here, because vpath won't find
+# the files if they don't exist yet.
+UPC_COLL_PREFIX_REDUCE_UPC = $(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+UPC_COLL_REDUCE_UPC = $(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc
+
+if MAINTAINER_MODE
+$(UPC_COLL_PREFIX_REDUCE_UPC): gen-upc-coll-reduce.pl \
+ upc_coll_prefix_reduce.in
+ $(PERL) $+ > $@
+
+$(UPC_COLL_REDUCE_UPC): gen-upc-coll-reduce.pl upc_coll_reduce.in
+ $(PERL) $+ > $@
+endif
+
+UPC_COLLECTIVES_SRC = collectives/upc_coll_broadcast.upc \
+ collectives/upc_coll_err.upc collectives/upc_coll_exchange.upc \
+ collectives/upc_coll_gather_all.upc collectives/upc_coll_gather.upc \
+ collectives/upc_coll.h collectives/upc_coll_init.upc \
+ collectives/upc_coll_permute.upc $(UPC_COLL_PREFIX_REDUCE_UPC) \
+ $(UPC_COLL_REDUCE_UPC) collectives/upc_coll_scatter.upc \
+ collectives/upc_coll_sort.upc
+
+UPC_RUNTIME_SRC += $(UPC_COLLECTIVES_SRC)
+
+EXTRA_DIST += gen-upc-coll-reduce.pl \
+ upc_coll_prefix_reduce.in \
+ upc_coll_reduce.in
+
+endif
+
+toolexeclib_LTLIBRARIES = libgupc.la $(libgupc_pt)
+nodist_toolexeclib_HEADERS = upc-crtbegin.spec libgupc.spec upc-crtend.spec
+
+gcc-upc-lib.h: gen-inline-libgupc.pl gcc-upc-lib.in \
+ $(UPC_RUNTIME_SRC_INLINE)
+ $(PERL) $+ > $@
+
+libsubinclude_HEADERS += gcc-upc-lib.h
+
+BUILT_SOURCES = gcc-upc-lib.h
+
+if LIBGUPC_LINK_SCRIPT
+UPC_LINK_SCRIPT = gupc.ld
+$(UPC_LINK_SCRIPT): gen-upc-ld-script.pl
+ -echo "int main(){}" | $(CC) $(LDFLAGS) -Xlinker --verbose \
+ -o /dev/null -xc - | $(PERL) $+ > $@
+BUILT_SOURCES += $(UPC_LINK_SCRIPT)
+else
+UPC_LINK_SCRIPT =
+endif
+nodist_toolexeclib_HEADERS += $(UPC_LINK_SCRIPT)
+
+libgupc_la_SOURCES = $(UPC_RUNTIME_SRC)
+libgupc_version_info = -version-info $(libtool_VERSION)
+libgupc_la_LDFLAGS = $(libgupc_version_info)
+libgupc_la_LINK = $(LINK) $(libgupc_la_LDFLAGS)
+libgupc_la_LIBADD = \
+ ../libatomic/libatomic_convenience_no_lock.la
+libgupc_la_DEPENDENCIES = $(libgupc_la_LIBADD)
+
+if LIBGUPC_PTHREADS
+nodist_libgupc_pt_la_SOURCES = $(UPC_RUNTIME_SRC)
+libgupc_pt_la_LIBADD = \
+ ../libatomic/libatomic_convenience_no_lock.la
+libgupc_pt_la_DEPENDENCIES = $(libgupc_pt_la_LIBADD)
+libgupc_pt_la_CPPFLAGS = $(AM_CPPFLAGS) -DGUPCR_USE_PTHREADS=1
+libgupc_pt_la_UPCFLAGS = $(AM_UPCFLAGS) -fupc-pthreads-model-tls
+libgupc_pt_la_LINK = $(libgupc_la_LINK)
+endif
+
+if LIBGUPC_CRTSTUFF
+
+toolexeclib_DATA = @upc_crtstuff_objs@
+
+ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(UPC_CRTSTUFF_CFLAGS)
+
+crt_compile = $(CC) $(ALL_CRT_CFLAGS) $(AM_CPPFLAGS)
+
+upc_crtstuff_src = $(top_srcdir)/upc-crtstuff.c
+
+#
+# UPC related begin/end files
+# Note: at the moment, $(CRTSTUFF_T_CFLAGS*) is empty.
+# Given that upc-crtstuff.c declares only data items,
+# there is no need for options such as -fpic.
+#
+upc-crtbegin.$(OBJEXT): $(upc_crtstuff_src)
+ $(crt_compile) -DCRT_BEGIN $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+upc-crtend.$(OBJEXT): $(upc_crtstuff_src)
+ $(crt_compile) -DCRT_END $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+# upc-crtbegin and upc-crtend for shared libraries
+upc-crtbeginS.$(OBJEXT): $(upc_crtstuff_src)
+ $(crt_compile) -DCRT_BEGIN $(CRTSTUFF_T_CFLAGS_S) -c $< -o $@
+
+upc-crtendS.$(OBJEXT): $(upc_crtstuff_src)
+ $(crt_compile) -DCRT_END $(CRTSTUFF_T_CFLAGS_S) -c $< -o $@
+
+# upc-crtbegin and upc-crtend for -static links
+upc-crtbeginT.$(OBJEXT): $(upc_crtstuff_src)
+ $(crt_compile) -DCRT_BEGIN $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+upc-crtendT.$(OBJEXT): $(upc_crtstuff_src)
+ $(crt_compile) -DCRT_END $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+endif
+
+# Automake Documentation:
+# If your package has Texinfo files in many directories, you can use the
+# variable TEXINFO_TEX to tell Automake where to find the canonical
+# `texinfo.tex' for your package. The value of this variable should be
+# the relative path from the current `Makefile.am' to `texinfo.tex'.
+TEXINFO_TEX = ../../gcc/doc/include/texinfo.tex
+
+# Defines info, dvi, pdf and html targets
+MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include
+info_TEXINFOS = libgupc.texi
+
+# AM_CONDITIONAL on configure option --generated-files-in-srcdir
+if GENINSRC
+STAMP_GENINSRC = stamp-geninsrc
+else
+STAMP_GENINSRC =
+endif
+
+# AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO])
+if BUILD_INFO
+STAMP_BUILD_INFO = stamp-build-info
+else
+STAMP_BUILD_INFO =
+endif
+
+all-local: $(STAMP_GENINSRC)
+
+stamp-geninsrc: libgupc.info
+ cp -p $(top_builddir)/libgupc.info $(srcdir)/libgupc.info
+ @touch $@
+
+libgupc.info: $(STAMP_BUILD_INFO)
+
+stamp-build-info: libgupc.texi
+ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -o libgupc.info $(srcdir)/libgupc.texi
+ @touch $@
+
+CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) libgupc.info \
+ $(nodist_toolexeclib_HEADERS) gupc.ld gcc-upc-lib.h
+MAINTAINERCLEANFILES = $(srcdir)/libgupc.info
diff --git a/libgupc/Makefile.in b/libgupc/Makefile.in
new file mode 100644
index 00000000000..052f73c8f59
--- /dev/null
+++ b/libgupc/Makefile.in
@@ -0,0 +1,3086 @@
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Process this file with automake to produce Makefile.in
+
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+@LIBGUPC_SMP_RUNTIME_TRUE@am__append_1 = -W -Wall -Wwrite-strings -Wstrict-prototypes -Werror
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__append_2 = -W -Wall -Wwrite-strings -Wstrict-prototypes -Werror
+@LIBGUPC_BACKTRACE_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__append_3 = portals4/gupcr_backtrace.h portals4/gupcr_backtrace.c
+@LIBGUPC_BACKTRACE_TRUE@@LIBGUPC_PORTALS4_RUNTIME_FALSE@am__append_4 = smp/upc_backtrace.h smp/upc_backtrace.c
+@LIBGUPC_SMP_RUNTIME_TRUE@am__append_5 = smp/gcc-upc-lib.in
+@LIBGUPC_SMP_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@am__append_6 = $(UPC_ATOMIC_DEF) $(UPC_ATOMIC_TPL)
+@LIBGUPC_SMP_RUNTIME_TRUE@am__append_7 = smp/upc_access.c smp/upc_accessg.c smp/upc_access.h \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_addr.c smp/upc_affinity.h $(UPC_AFFINITY_SUP) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_allocg.upc smp/upc_alloc.upc \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_atomic.upc \
+@LIBGUPC_SMP_RUNTIME_TRUE@ $(UPC_BACKTRACE_SUP) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_barrier.upc smp/upc_castable.upc smp/upc_config.h \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_debug.h smp/upc_debug.c \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_defs.h smp/upc_gasp.c $(UPC_GUM_SUP) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_libat_lock.c smp/upc_libat_lock.h \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_libg.c smp/upc_lib.h \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_lock.upc smp/upc_lock.h \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_lock_sup.h smp/upc_lock_sup.c \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_main.c smp/upc_mem.c smp/upc_mem.h \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_nb.upc smp/upc_numa.h $(UPC_NUMA_SUP) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_pgm_info.c smp/upc_pts.h smp/upc_pupc.c \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_pupc.h smp/upc_sup.h smp/upc_sync.h smp/upc_sysdep.c \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_sysdep.h smp/upc_tick.c smp/upc_vm.c
+
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__append_8 = portals4/gcc-upc-lib.in \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CONFIG) \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gen-upc-coll-reduce.pl \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ upc_coll_prefix_reduce.in \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_coll_reduce.in
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__append_9 = portals4/gupcr_access.c portals4/gupcr_access.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_addr.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_alloc.upc portals4/gupcr_alloc.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_atomic.upc \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_atomic_sup.h portals4/gupcr_atomic_sup.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(UPC_BACKTRACE_SUP) \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_barrier.h portals4/gupcr_barrier.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_broadcast.h portals4/gupcr_broadcast.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_castable.upc \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_clock.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_coll_sup.h portals4/gupcr_coll_sup.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_config.h portals4/gupcr_defs.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_env.c portals4/gupcr_gmem.h portals4/gupcr_gmem.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_lib.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_lock.upc portals4/gupcr_lock.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_lock_sup.c portals4/gupcr_lock_sup.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_main.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_nb.upc \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_nb_sup.c portals4/gupcr_nb_sup.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_node.c portals4/gupcr_node.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_mem.c portals4/gupcr_portals.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_pgm_info.c portals4/gupcr_pts.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_runtime.h portals4/gupcr_runtime.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_shutdown.h portals4/gupcr_shutdown.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_sup.h portals4/gupcr_sync.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_tick.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_utils.h portals4/gupcr_utils.c
+
+@LIBGUPC_NODE_LOCAL_MEM_POSIX_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__append_10 = portals4/gupcr_node_mem_posix.c
+@LIBGUPC_NODE_LOCAL_MEM_MMAP_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__append_11 = portals4/gupcr_node_mem_mmap.c
+DIST_COMMON = $(am__configure_deps) $(libsubinclude_HEADERS) \
+ $(srcdir)/../config.guess $(srcdir)/../config.sub \
+ $(srcdir)/../depcomp $(srcdir)/../install-sh \
+ $(srcdir)/../ltmain.sh $(srcdir)/../missing \
+ $(srcdir)/../mkinstalldirs $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(srcdir)/doxygen-include.am $(srcdir)/doxygen.sty.in \
+ $(srcdir)/header.tex.in $(srcdir)/libgupc.spec.in \
+ $(srcdir)/upc-crtbegin.spec.in $(srcdir)/upc-crtend.spec.in \
+ $(top_srcdir)/configure $(top_srcdir)/portals4/doxygen.cfg.in \
+ ChangeLog
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__append_12 = $(DX_CLEANFILES)
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__append_13 = portals4/upc_coll.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_coll_broadcast.upc \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_coll_init.upc \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(UPC_COLL_REDUCE_UPC) \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(UPC_COLLECTIVES_SRC)
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__append_14 = $(UPC_COLLECTIVES_SRC)
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__append_15 = gen-upc-coll-reduce.pl \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_prefix_reduce.in \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_reduce.in
+
+@LIBGUPC_LINK_SCRIPT_TRUE@am__append_16 = $(UPC_LINK_SCRIPT)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/enable.m4 \
+ $(top_srcdir)/../config/futex.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/multi.m4 \
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/stdint.m4 \
+ $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 \
+ $(top_srcdir)/ax_prog_doxygen.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = header.tex doxygen.sty doxygen.cfg \
+ upc-crtbegin.spec libgupc.spec upc-crtend.spec
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" \
+ "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(libsubincludedir)" \
+ "$(DESTDIR)$(libsubincludedir)" "$(DESTDIR)$(toolexeclibdir)"
+LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+am__libgupc_la_SOURCES_DIST = smp/upc_access.c smp/upc_accessg.c \
+ smp/upc_access.h smp/upc_addr.c smp/upc_affinity.h \
+ smp/upc_affinity_stub.c smp/upc_affinity.c smp/upc_allocg.upc \
+ smp/upc_alloc.upc smp/upc_atomic.upc \
+ portals4/gupcr_backtrace.h portals4/gupcr_backtrace.c \
+ smp/upc_backtrace.h smp/upc_backtrace.c smp/upc_barrier.upc \
+ smp/upc_castable.upc smp/upc_config.h smp/upc_debug.h \
+ smp/upc_debug.c smp/upc_defs.h smp/upc_gasp.c smp/upc_gum.c \
+ smp/upc_libat_lock.c smp/upc_libat_lock.h smp/upc_libg.c \
+ smp/upc_lib.h smp/upc_lock.upc smp/upc_lock.h \
+ smp/upc_lock_sup.h smp/upc_lock_sup.c smp/upc_main.c \
+ smp/upc_mem.c smp/upc_mem.h smp/upc_nb.upc smp/upc_numa.h \
+ smp/upc_numa_stub.c smp/upc_numa.c smp/upc_pgm_info.c \
+ smp/upc_pts.h smp/upc_pupc.c smp/upc_pupc.h smp/upc_sup.h \
+ smp/upc_sync.h smp/upc_sysdep.c smp/upc_sysdep.h \
+ smp/upc_tick.c smp/upc_vm.c portals4/gupcr_access.c \
+ portals4/gupcr_access.h portals4/gupcr_addr.c \
+ portals4/gupcr_alloc.upc portals4/gupcr_alloc.h \
+ portals4/gupcr_atomic.upc portals4/gupcr_atomic_sup.h \
+ portals4/gupcr_atomic_sup.c portals4/gupcr_barrier.h \
+ portals4/gupcr_barrier.c portals4/gupcr_broadcast.h \
+ portals4/gupcr_broadcast.c portals4/gupcr_castable.upc \
+ portals4/gupcr_clock.c portals4/gupcr_coll_sup.h \
+ portals4/gupcr_coll_sup.c portals4/gupcr_config.h \
+ portals4/gupcr_defs.h portals4/gupcr_env.c \
+ portals4/gupcr_gmem.h portals4/gupcr_gmem.c \
+ portals4/gupcr_lib.h portals4/gupcr_lock.upc \
+ portals4/gupcr_lock.h portals4/gupcr_lock_sup.c \
+ portals4/gupcr_lock_sup.h portals4/gupcr_main.c \
+ portals4/gupcr_nb.upc portals4/gupcr_nb_sup.c \
+ portals4/gupcr_nb_sup.h portals4/gupcr_node.c \
+ portals4/gupcr_node.h portals4/gupcr_mem.c \
+ portals4/gupcr_portals.c portals4/gupcr_pgm_info.c \
+ portals4/gupcr_pts.h portals4/gupcr_runtime.h \
+ portals4/gupcr_runtime.c portals4/gupcr_shutdown.h \
+ portals4/gupcr_shutdown.c portals4/gupcr_sup.h \
+ portals4/gupcr_sync.h portals4/gupcr_tick.c \
+ portals4/gupcr_utils.h portals4/gupcr_utils.c \
+ portals4/gupcr_node_mem_posix.c portals4/gupcr_node_mem_mmap.c \
+ portals4/upc_coll.h portals4/gupcr_coll_broadcast.upc \
+ portals4/gupcr_coll_init.upc \
+ $(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc \
+ $(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc \
+ collectives/upc_coll_broadcast.upc \
+ collectives/upc_coll_err.upc collectives/upc_coll_exchange.upc \
+ collectives/upc_coll_gather_all.upc \
+ collectives/upc_coll_gather.upc collectives/upc_coll.h \
+ collectives/upc_coll_init.upc collectives/upc_coll_permute.upc \
+ $(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc \
+ collectives/upc_coll_scatter.upc collectives/upc_coll_sort.upc
+@LIBGUPC_AFFINITY_FALSE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_1 = upc_affinity_stub.lo
+@LIBGUPC_AFFINITY_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_1 = upc_affinity.lo
+@LIBGUPC_BACKTRACE_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_2 = gupcr_backtrace.lo
+@LIBGUPC_BACKTRACE_TRUE@@LIBGUPC_PORTALS4_RUNTIME_FALSE@am__objects_3 = upc_backtrace.lo
+am__objects_4 = $(am__objects_2) $(am__objects_3)
+@LIBGUPC_GUM_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_5 = \
+@LIBGUPC_GUM_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@ upc_gum.lo
+@LIBGUPC_NUMA_FALSE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_6 = upc_numa_stub.lo
+@LIBGUPC_NUMA_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_6 = \
+@LIBGUPC_NUMA_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@ upc_numa.lo
+@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_7 = upc_access.lo upc_accessg.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_addr.lo $(am__objects_1) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_allocg.lo upc_alloc.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_atomic.lo $(am__objects_4) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_barrier.lo upc_castable.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_debug.lo upc_gasp.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ $(am__objects_5) upc_libat_lock.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_libg.lo upc_lock.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_lock_sup.lo upc_main.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_mem.lo upc_nb.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ $(am__objects_6) upc_pgm_info.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_pupc.lo upc_sysdep.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ upc_tick.lo upc_vm.lo
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_8 = gupcr_access.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_addr.lo gupcr_alloc.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_atomic.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_atomic_sup.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(am__objects_4) \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_barrier.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_broadcast.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_castable.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_clock.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_coll_sup.lo gupcr_env.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_gmem.lo gupcr_lock.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_lock_sup.lo gupcr_main.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_nb.lo gupcr_nb_sup.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_node.lo gupcr_mem.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_portals.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_pgm_info.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_runtime.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_shutdown.lo gupcr_tick.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_utils.lo
+@LIBGUPC_NODE_LOCAL_MEM_POSIX_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_9 = gupcr_node_mem_posix.lo
+@LIBGUPC_NODE_LOCAL_MEM_MMAP_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_10 = gupcr_node_mem_mmap.lo
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_11 = gupcr_coll_reduce.lo
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__objects_11 = upc_coll_reduce.lo
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_12 = upc_coll_prefix_reduce.lo
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__objects_12 = \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_prefix_reduce.lo
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_13 = upc_coll_err.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ upc_coll_exchange.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ upc_coll_gather_all.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ upc_coll_gather.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ upc_coll_permute.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(am__objects_12) \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ upc_coll_scatter.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ upc_coll_sort.lo
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__objects_13 = \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_broadcast.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_err.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_exchange.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_gather_all.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_gather.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_init.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_permute.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ $(am__objects_12) \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ $(am__objects_11) \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_scatter.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ upc_coll_sort.lo
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_14 = \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_coll_broadcast.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ gupcr_coll_init.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(am__objects_11) \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(am__objects_13)
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__objects_15 = $(am__objects_13)
+am__objects_16 = $(am__objects_7) $(am__objects_8) $(am__objects_9) \
+ $(am__objects_10) $(am__objects_14) $(am__objects_15)
+am_libgupc_la_OBJECTS = $(am__objects_16)
+libgupc_la_OBJECTS = $(am_libgupc_la_OBJECTS)
+@LIBGUPC_AFFINITY_FALSE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_17 = libgupc_pt_la-upc_affinity_stub.lo
+@LIBGUPC_AFFINITY_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_17 = libgupc_pt_la-upc_affinity.lo
+@LIBGUPC_BACKTRACE_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_18 = libgupc_pt_la-gupcr_backtrace.lo
+@LIBGUPC_BACKTRACE_TRUE@@LIBGUPC_PORTALS4_RUNTIME_FALSE@am__objects_19 = libgupc_pt_la-upc_backtrace.lo
+am__objects_20 = $(am__objects_18) $(am__objects_19)
+@LIBGUPC_GUM_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_21 = libgupc_pt_la-upc_gum.lo
+@LIBGUPC_NUMA_FALSE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_22 = libgupc_pt_la-upc_numa_stub.lo
+@LIBGUPC_NUMA_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_22 = libgupc_pt_la-upc_numa.lo
+@LIBGUPC_SMP_RUNTIME_TRUE@am__objects_23 = \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_access.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_accessg.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_addr.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ $(am__objects_17) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_allocg.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_alloc.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_atomic.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ $(am__objects_20) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_barrier.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_castable.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_debug.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_gasp.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ $(am__objects_21) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_libat_lock.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_libg.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_lock.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_lock_sup.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_main.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_mem.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_nb.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ $(am__objects_22) \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_pgm_info.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_pupc.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_sysdep.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_tick.lo \
+@LIBGUPC_SMP_RUNTIME_TRUE@ libgupc_pt_la-upc_vm.lo
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_24 = \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_access.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_addr.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_alloc.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_atomic.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_atomic_sup.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(am__objects_20) \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_barrier.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_broadcast.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_castable.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_clock.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_coll_sup.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_env.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_gmem.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_lock.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_lock_sup.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_main.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_nb.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_nb_sup.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_node.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_mem.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_portals.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_pgm_info.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_runtime.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_shutdown.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_tick.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_utils.lo
+@LIBGUPC_NODE_LOCAL_MEM_POSIX_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_25 = libgupc_pt_la-gupcr_node_mem_posix.lo
+@LIBGUPC_NODE_LOCAL_MEM_MMAP_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_26 = libgupc_pt_la-gupcr_node_mem_mmap.lo
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_27 = libgupc_pt_la-gupcr_coll_reduce.lo
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__objects_27 = libgupc_pt_la-upc_coll_reduce.lo
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_28 = libgupc_pt_la-upc_coll_prefix_reduce.lo
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__objects_28 = libgupc_pt_la-upc_coll_prefix_reduce.lo
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_29 = libgupc_pt_la-upc_coll_err.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-upc_coll_exchange.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-upc_coll_gather_all.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-upc_coll_gather.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-upc_coll_permute.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(am__objects_28) \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-upc_coll_scatter.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-upc_coll_sort.lo
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__objects_29 = libgupc_pt_la-upc_coll_broadcast.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ libgupc_pt_la-upc_coll_err.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ libgupc_pt_la-upc_coll_exchange.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ libgupc_pt_la-upc_coll_gather_all.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ libgupc_pt_la-upc_coll_gather.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ libgupc_pt_la-upc_coll_init.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ libgupc_pt_la-upc_coll_permute.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ $(am__objects_28) \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ $(am__objects_27) \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ libgupc_pt_la-upc_coll_scatter.lo \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ libgupc_pt_la-upc_coll_sort.lo
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@am__objects_30 = libgupc_pt_la-gupcr_coll_broadcast.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ libgupc_pt_la-gupcr_coll_init.lo \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(am__objects_27) \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(am__objects_29)
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@am__objects_31 = $(am__objects_29)
+am__objects_32 = $(am__objects_23) $(am__objects_24) $(am__objects_25) \
+ $(am__objects_26) $(am__objects_30) $(am__objects_31)
+@LIBGUPC_PTHREADS_TRUE@nodist_libgupc_pt_la_OBJECTS = \
+@LIBGUPC_PTHREADS_TRUE@ $(am__objects_32)
+libgupc_pt_la_OBJECTS = $(nodist_libgupc_pt_la_OBJECTS)
+@LIBGUPC_PTHREADS_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@am_libgupc_pt_la_rpath = \
+@LIBGUPC_PTHREADS_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@ -rpath \
+@LIBGUPC_PTHREADS_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@ $(toolexeclibdir)
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/../depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+UPCCOMPILE = $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)
+LTUPCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)
+UPCLD = $(UPC)
+UPCLINK = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+ $(UPCLD) $(AM_UPCFLAGS) $(UPCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(libgupc_la_SOURCES) $(nodist_libgupc_pt_la_SOURCES)
+DIST_SOURCES = $(am__libgupc_la_SOURCES_DIST)
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+INFO_DEPS = libgupc.info
+am__TEXINFO_TEX_DIR = $(srcdir)/../../gcc/doc/include
+DVIS = libgupc.dvi
+PDFS = libgupc.pdf
+PSS = libgupc.ps
+HTMLS = libgupc.html
+TEXINFOS = libgupc.texi
+TEXI2DVI = texi2dvi
+TEXI2PDF = $(TEXI2DVI) --pdf --batch
+MAKEINFOHTML = $(MAKEINFO) --html
+AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
+DVIPS = dvips
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DATA = $(toolexeclib_DATA)
+HEADERS = $(libsubinclude_HEADERS) $(nodist_libsubinclude_HEADERS) \
+ $(nodist_noinst_HEADERS) $(nodist_toolexeclib_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ADDR2LINE = @ADDR2LINE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOXYGEN_AUTHOR = @DOXYGEN_AUTHOR@
+DOXYGEN_DATE = @DOXYGEN_DATE@
+DOXYGEN_DATETIME = @DOXYGEN_DATETIME@
+DOXYGEN_HTML_LOGO = @DOXYGEN_HTML_LOGO@
+DOXYGEN_LOGO = @DOXYGEN_LOGO@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_TITLE = @DOXYGEN_TITLE@
+DOXYGEN_VERSION = @DOXYGEN_VERSION@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FILE = @DX_FILE@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_DOT = @HAVE_DOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_GDB = @PATH_TO_GDB@
+PERL = @PERL@
+RANLIB = @RANLIB@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+UPC = @UPC@
+UPCDEPMODE = @UPCDEPMODE@
+UPCFLAGS = @UPCFLAGS@
+VERSION = @VERSION@
+XCFLAGS = @XCFLAGS@
+XLDFLAGS = @XLDFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_UPC = @ac_ct_UPC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bfdinc = @bfdinc@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+config_path = @config_path@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_upc_runtime_debug = @enable_upc_runtime_debug@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libtool_VERSION = @libtool_VERSION@
+link_upc_spec = @link_upc_spec@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+portals4inc = @portals4inc@
+portals4libs = @portals4libs@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+upc_crtbegin_spec = @upc_crtbegin_spec@
+upc_crtend_spec = @upc_crtend_spec@
+upc_crtstuff_cflags = @upc_crtstuff_cflags@
+upc_crtstuff_objs = @upc_crtstuff_objs@
+WARN_CFLAGS = $(am__append_1) $(am__append_2)
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@targ_runtime_dir = portals4
+@LIBGUPC_SMP_RUNTIME_TRUE@targ_runtime_dir = smp
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@INC_CFLAGS = $(PORTALS4_IFLAG)
+@LIBGUPC_SMP_RUNTIME_TRUE@INC_CFLAGS =
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@PORTALS4_IFLAG = @portals4inc@
+ACLOCAL_AMFLAGS = -I . -I .. -I ../config
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LINK = $(LIBTOOL) --tag CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+ $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LTLDFLAGS) -o $@
+
+UPC_HDRS = include/upc_atomic.h include/upc_castable.h \
+ include/gasp.h include/gasp_upc.h include/gcc-upc.h \
+ include/pupc.h include/upc_collective.h include/upc.h \
+ include/upc_nb.h \
+ include/upc_relaxed.h include/upc_strict.h \
+ include/upc_tick.h include/upc_types.h
+
+libsubinclude_HEADERS = $(UPC_HDRS) gcc-upc-lib.h
+nodist_noinst_HEADERS =
+nodist_libsubinclude_HEADERS =
+IN_LIB_CPPFLAGS = -DIN_GCC -DIN_TARGET_LIBS
+AM_CPPFLAGS = $(IN_LIB_CPPFLAGS) $(addprefix -I, $(search_path)) \
+ $(addprefix -isystem, '.') @bfdinc@
+AM_CFLAGS = $(WARN_CFLAGS) $(INC_CFLAGS) $(XCFLAGS)
+AM_UPCFLAGS = $(WARN_CFLAGS) $(INC_CFLAGS) -fno-strict-aliasing \
+ $(XCFLAGS)
+SUBDIRS = testsuite
+@LIBGUPC_GENERIC_COLLECTIVES_FALSE@collectives_dir =
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@collectives_dir = $(addprefix $(top_srcdir)/, collectives)
+search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) \
+ $(addprefix $(top_srcdir)/, $(targ_runtime_dir)) \
+ $(collectives_dir) \
+ $(addprefix $(top_srcdir)/, include) \
+ $(top_srcdir)
+
+AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
+
+### Explicit build rules
+LIBGUPC_SRCDIR = $(top_srcdir)/$(targ_runtime_dir)
+MOSTLYCLEANFILES = $(am__append_12)
+UPC_RUNTIME_SRC = $(am__append_7) $(am__append_9) $(am__append_10) \
+ $(am__append_11) $(am__append_13) $(am__append_14)
+EXTRA_DIST = gen-inline-libgupc.pl gen-upc-ld-script.pl \
+ $(UPC_OPS_DEFS) $(UPC_TYPES_DEF) $(am__append_5) \
+ $(am__append_6) $(am__append_8) $(am__append_15)
+LIBGUPC_COLL_SRCDIR = $(top_srcdir)/collectives
+LIBGUPC_INC_SRCDIR = $(top_srcdir)/include
+LIBGUPC_PORTALS4_SRCDIR = $(top_srcdir)/portals4
+LIBGUPC_SMP_SRCDIR = $(top_srcdir)/smp
+UPC_OPS_DEF = $(LIBGUPC_INC_SRCDIR)/upc_ops.def
+UPC_TYPES_DEF = $(LIBGUPC_INC_SRCDIR)/upc_types.def
+AUTOGEN = autogen
+UPC_BACKTRACE_SUP = $(am__append_3) $(am__append_4)
+@LIBGUPC_PTHREADS_FALSE@@LIBGUPC_SMP_RUNTIME_TRUE@libgupc_pt =
+@LIBGUPC_PTHREADS_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@libgupc_pt = libgupc_pt.la
+@LIBGUPC_AFFINITY_FALSE@@LIBGUPC_SMP_RUNTIME_TRUE@UPC_AFFINITY_SUP = smp/upc_affinity_stub.c
+
+# Even though we're using vpath, we have to qualify the
+# filenames with "smp/", because the libgupc_pt.la rules
+# won't find the dependents because the name of the target
+# doesn't match (ie, upc_access.c compiles into pt_upc_access_pt.lo)
+@LIBGUPC_AFFINITY_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@UPC_AFFINITY_SUP = smp/upc_affinity.c
+@LIBGUPC_GUM_FALSE@@LIBGUPC_SMP_RUNTIME_TRUE@UPC_GUM_SUP =
+@LIBGUPC_GUM_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@UPC_GUM_SUP = smp/upc_gum.c
+@LIBGUPC_NUMA_FALSE@@LIBGUPC_SMP_RUNTIME_TRUE@UPC_NUMA_SUP = smp/upc_numa_stub.c
+@LIBGUPC_NUMA_TRUE@@LIBGUPC_SMP_RUNTIME_TRUE@UPC_NUMA_SUP = smp/upc_numa.c
+@LIBGUPC_SMP_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@UPC_ATOMIC_DEF = $(LIBGUPC_SMP_SRCDIR)/upc_atomic.def
+@LIBGUPC_SMP_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@UPC_ATOMIC_TPL = $(LIBGUPC_SMP_SRCDIR)/upc_atomic.tpl
+@LIBGUPC_SMP_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@UPC_ATOMIC_UPC = $(LIBGUPC_SMP_SRCDIR)/upc_atomic.upc
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@UPC_RUNTIME_SRC_INLINE = config.h portals4/gupcr_access.c \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_access.h portals4/gupcr_config.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_defs.h portals4/gupcr_gmem.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_node.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_portals.h portals4/gupcr_pts.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_sup.h portals4/gupcr_sync.h \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ portals4/gupcr_utils.h
+
+@LIBGUPC_SMP_RUNTIME_TRUE@UPC_RUNTIME_SRC_INLINE = config.h smp/upc_access.c smp/upc_access.h \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_config.h smp/upc_defs.h smp/upc_mem.h smp/upc_pts.h \
+@LIBGUPC_SMP_RUNTIME_TRUE@ smp/upc_sup.h smp/upc_sync.h
+
+
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
+# ===========================================================================
+#
+# LICENSE
+#
+# Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+#
+#
+@DX_COND_doc_TRUE@@DX_COND_html_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEAN_HTML = @DX_DOCDIR@/html
+@DX_COND_chm_TRUE@@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEAN_CHM = @DX_DOCDIR@/chm
+@DX_COND_chi_TRUE@@DX_COND_chm_TRUE@@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
+@DX_COND_doc_TRUE@@DX_COND_man_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEAN_MAN = @DX_DOCDIR@/man
+@DX_COND_doc_TRUE@@DX_COND_rtf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+@DX_COND_doc_TRUE@@DX_COND_xml_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEAN_XML = @DX_DOCDIR@/xml
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_PS_GOAL = doxygen-ps
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_PDF_GOAL = doxygen-pdf
+@DX_COND_doc_TRUE@@DX_COND_latex_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@DX_CLEANFILES = \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ @DX_DOCDIR@/@PACKAGE@.tag \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ -r \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CLEAN_HTML) \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CLEAN_CHM) \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CLEAN_CHI) \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CLEAN_MAN) \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CLEAN_RTF) \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CLEAN_XML) \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CLEAN_PS) \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CLEAN_PDF) \
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_CLEAN_LATEX)
+
+
+# We need full pathnames here, because vpath won't find
+# the files if they don't exist yet.
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@UPC_COLL_PREFIX_REDUCE_UPC = $(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+
+# Portals runtime only partially uses generic collectives
+
+# We need full pathnames here, because vpath won't find
+# the files if they don't exist yet.
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@UPC_COLL_PREFIX_REDUCE_UPC = $(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@UPC_COLL_REDUCE_UPC = $(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@UPC_COLL_REDUCE_UPC = $(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@UPC_COLLECTIVES_SRC = collectives/upc_coll_broadcast.upc \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ collectives/upc_coll_err.upc collectives/upc_coll_exchange.upc \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ collectives/upc_coll_gather_all.upc collectives/upc_coll_gather.upc \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ collectives/upc_coll.h collectives/upc_coll_init.upc \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ collectives/upc_coll_permute.upc $(UPC_COLL_PREFIX_REDUCE_UPC) \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ $(UPC_COLL_REDUCE_UPC) collectives/upc_coll_scatter.upc \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@ collectives/upc_coll_sort.upc
+
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@UPC_COLLECTIVES_SRC = \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ collectives/upc_coll_err.upc collectives/upc_coll_exchange.upc \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ collectives/upc_coll_gather_all.upc collectives/upc_coll_gather.upc \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ collectives/upc_coll_permute.upc $(UPC_COLL_PREFIX_REDUCE_UPC) \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@ collectives/upc_coll_scatter.upc collectives/upc_coll_sort.upc
+
+toolexeclib_LTLIBRARIES = libgupc.la $(libgupc_pt)
+nodist_toolexeclib_HEADERS = upc-crtbegin.spec libgupc.spec \
+ upc-crtend.spec $(UPC_LINK_SCRIPT)
+BUILT_SOURCES = gcc-upc-lib.h $(am__append_16)
+@LIBGUPC_LINK_SCRIPT_FALSE@UPC_LINK_SCRIPT =
+@LIBGUPC_LINK_SCRIPT_TRUE@UPC_LINK_SCRIPT = gupc.ld
+libgupc_la_SOURCES = $(UPC_RUNTIME_SRC)
+libgupc_version_info = -version-info $(libtool_VERSION)
+libgupc_la_LDFLAGS = $(libgupc_version_info)
+libgupc_la_LINK = $(LINK) $(libgupc_la_LDFLAGS)
+libgupc_la_LIBADD = \
+ ../libatomic/libatomic_convenience_no_lock.la
+
+libgupc_la_DEPENDENCIES = $(libgupc_la_LIBADD)
+@LIBGUPC_PTHREADS_TRUE@nodist_libgupc_pt_la_SOURCES = $(UPC_RUNTIME_SRC)
+@LIBGUPC_PTHREADS_TRUE@libgupc_pt_la_LIBADD = \
+@LIBGUPC_PTHREADS_TRUE@ ../libatomic/libatomic_convenience_no_lock.la
+
+@LIBGUPC_PTHREADS_TRUE@libgupc_pt_la_DEPENDENCIES = $(libgupc_pt_la_LIBADD)
+@LIBGUPC_PTHREADS_TRUE@libgupc_pt_la_CPPFLAGS = $(AM_CPPFLAGS) -DGUPCR_USE_PTHREADS=1
+@LIBGUPC_PTHREADS_TRUE@libgupc_pt_la_UPCFLAGS = $(AM_UPCFLAGS) -fupc-pthreads-model-tls
+@LIBGUPC_PTHREADS_TRUE@libgupc_pt_la_LINK = $(libgupc_la_LINK)
+@LIBGUPC_CRTSTUFF_TRUE@toolexeclib_DATA = @upc_crtstuff_objs@
+@LIBGUPC_CRTSTUFF_TRUE@ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(UPC_CRTSTUFF_CFLAGS)
+@LIBGUPC_CRTSTUFF_TRUE@crt_compile = $(CC) $(ALL_CRT_CFLAGS) $(AM_CPPFLAGS)
+@LIBGUPC_CRTSTUFF_TRUE@upc_crtstuff_src = $(top_srcdir)/upc-crtstuff.c
+
+# Automake Documentation:
+# If your package has Texinfo files in many directories, you can use the
+# variable TEXINFO_TEX to tell Automake where to find the canonical
+# `texinfo.tex' for your package. The value of this variable should be
+# the relative path from the current `Makefile.am' to `texinfo.tex'.
+TEXINFO_TEX = ../../gcc/doc/include/texinfo.tex
+
+# Defines info, dvi, pdf and html targets
+MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include
+info_TEXINFOS = libgupc.texi
+@GENINSRC_FALSE@STAMP_GENINSRC =
+
+# AM_CONDITIONAL on configure option --generated-files-in-srcdir
+@GENINSRC_TRUE@STAMP_GENINSRC = stamp-geninsrc
+@BUILD_INFO_FALSE@STAMP_BUILD_INFO =
+
+# AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO])
+@BUILD_INFO_TRUE@STAMP_BUILD_INFO = stamp-build-info
+CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) libgupc.info \
+ $(nodist_toolexeclib_HEADERS) gupc.ld gcc-upc-lib.h
+
+MAINTAINERCLEANFILES = $(srcdir)/libgupc.info
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .dvi .lo .o .obj .ps .upc
+am--refresh: Makefile
+ @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/doxygen-include.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+$(srcdir)/doxygen-include.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @if test ! -f $@; then rm -f stamp-h1; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+header.tex: $(top_builddir)/config.status $(srcdir)/header.tex.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+doxygen.sty: $(top_builddir)/config.status $(srcdir)/doxygen.sty.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+doxygen.cfg: $(top_builddir)/config.status $(top_srcdir)/portals4/doxygen.cfg.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+upc-crtbegin.spec: $(top_builddir)/config.status $(srcdir)/upc-crtbegin.spec.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+libgupc.spec: $(top_builddir)/config.status $(srcdir)/libgupc.spec.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+upc-crtend.spec: $(top_builddir)/config.status $(srcdir)/upc-crtend.spec.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \
+ }
+
+uninstall-toolexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \
+ done
+
+clean-toolexeclibLTLIBRARIES:
+ -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
+ @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgupc.la: $(libgupc_la_OBJECTS) $(libgupc_la_DEPENDENCIES) $(EXTRA_libgupc_la_DEPENDENCIES)
+ $(libgupc_la_LINK) -rpath $(toolexeclibdir) $(libgupc_la_OBJECTS) $(libgupc_la_LIBADD) $(LIBS)
+libgupc_pt.la: $(libgupc_pt_la_OBJECTS) $(libgupc_pt_la_DEPENDENCIES) $(EXTRA_libgupc_pt_la_DEPENDENCIES)
+ $(libgupc_pt_la_LINK) $(am_libgupc_pt_la_rpath) $(libgupc_pt_la_OBJECTS) $(libgupc_pt_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_access.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_addr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_alloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_atomic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_atomic_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_backtrace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_barrier.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_broadcast.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_castable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_clock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_coll_broadcast.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_coll_init.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_coll_reduce.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_coll_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_env.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_gmem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_lock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_lock_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_main.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_mem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_nb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_nb_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_node.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_node_mem_mmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_node_mem_posix.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_pgm_info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_portals.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_runtime.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_shutdown.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_tick.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupcr_utils.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_access.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_addr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_alloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_atomic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_atomic_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_backtrace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_barrier.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_broadcast.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_castable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_clock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_coll_broadcast.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_coll_init.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_coll_reduce.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_coll_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_env.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_gmem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_lock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_lock_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_main.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_mem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_nb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_nb_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_node.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_node_mem_mmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_node_mem_posix.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_pgm_info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_portals.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_runtime.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_shutdown.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_tick.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-gupcr_utils.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_access.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_accessg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_addr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_affinity.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_affinity_stub.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_alloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_allocg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_atomic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_backtrace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_barrier.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_castable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_broadcast.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_err.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_exchange.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_gather.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_gather_all.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_init.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_permute.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_prefix_reduce.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_reduce.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_scatter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_coll_sort.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_debug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_gasp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_gum.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_libat_lock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_libg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_lock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_lock_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_main.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_mem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_nb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_numa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_numa_stub.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_pgm_info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_pupc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_sysdep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_tick.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgupc_pt_la-upc_vm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_access.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_accessg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_addr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_affinity.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_affinity_stub.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_alloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_allocg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_atomic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_backtrace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_barrier.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_castable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_broadcast.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_err.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_exchange.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_gather.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_gather_all.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_init.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_permute.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_prefix_reduce.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_reduce.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_scatter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_coll_sort.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_debug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_gasp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_gum.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_libat_lock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_libg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_lock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_lock_sup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_main.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_mem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_nb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_numa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_numa_stub.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_pgm_info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_pupc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_sysdep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_tick.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upc_vm.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+upc_access.lo: smp/upc_access.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_access.lo -MD -MP -MF $(DEPDIR)/upc_access.Tpo -c -o upc_access.lo `test -f 'smp/upc_access.c' || echo '$(srcdir)/'`smp/upc_access.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_access.Tpo $(DEPDIR)/upc_access.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_access.c' object='upc_access.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_access.lo `test -f 'smp/upc_access.c' || echo '$(srcdir)/'`smp/upc_access.c
+
+upc_accessg.lo: smp/upc_accessg.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_accessg.lo -MD -MP -MF $(DEPDIR)/upc_accessg.Tpo -c -o upc_accessg.lo `test -f 'smp/upc_accessg.c' || echo '$(srcdir)/'`smp/upc_accessg.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_accessg.Tpo $(DEPDIR)/upc_accessg.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_accessg.c' object='upc_accessg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_accessg.lo `test -f 'smp/upc_accessg.c' || echo '$(srcdir)/'`smp/upc_accessg.c
+
+upc_addr.lo: smp/upc_addr.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_addr.lo -MD -MP -MF $(DEPDIR)/upc_addr.Tpo -c -o upc_addr.lo `test -f 'smp/upc_addr.c' || echo '$(srcdir)/'`smp/upc_addr.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_addr.Tpo $(DEPDIR)/upc_addr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_addr.c' object='upc_addr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_addr.lo `test -f 'smp/upc_addr.c' || echo '$(srcdir)/'`smp/upc_addr.c
+
+upc_affinity_stub.lo: smp/upc_affinity_stub.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_affinity_stub.lo -MD -MP -MF $(DEPDIR)/upc_affinity_stub.Tpo -c -o upc_affinity_stub.lo `test -f 'smp/upc_affinity_stub.c' || echo '$(srcdir)/'`smp/upc_affinity_stub.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_affinity_stub.Tpo $(DEPDIR)/upc_affinity_stub.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_affinity_stub.c' object='upc_affinity_stub.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_affinity_stub.lo `test -f 'smp/upc_affinity_stub.c' || echo '$(srcdir)/'`smp/upc_affinity_stub.c
+
+upc_affinity.lo: smp/upc_affinity.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_affinity.lo -MD -MP -MF $(DEPDIR)/upc_affinity.Tpo -c -o upc_affinity.lo `test -f 'smp/upc_affinity.c' || echo '$(srcdir)/'`smp/upc_affinity.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_affinity.Tpo $(DEPDIR)/upc_affinity.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_affinity.c' object='upc_affinity.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_affinity.lo `test -f 'smp/upc_affinity.c' || echo '$(srcdir)/'`smp/upc_affinity.c
+
+gupcr_backtrace.lo: portals4/gupcr_backtrace.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_backtrace.lo -MD -MP -MF $(DEPDIR)/gupcr_backtrace.Tpo -c -o gupcr_backtrace.lo `test -f 'portals4/gupcr_backtrace.c' || echo '$(srcdir)/'`portals4/gupcr_backtrace.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_backtrace.Tpo $(DEPDIR)/gupcr_backtrace.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_backtrace.c' object='gupcr_backtrace.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_backtrace.lo `test -f 'portals4/gupcr_backtrace.c' || echo '$(srcdir)/'`portals4/gupcr_backtrace.c
+
+upc_backtrace.lo: smp/upc_backtrace.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_backtrace.lo -MD -MP -MF $(DEPDIR)/upc_backtrace.Tpo -c -o upc_backtrace.lo `test -f 'smp/upc_backtrace.c' || echo '$(srcdir)/'`smp/upc_backtrace.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_backtrace.Tpo $(DEPDIR)/upc_backtrace.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_backtrace.c' object='upc_backtrace.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_backtrace.lo `test -f 'smp/upc_backtrace.c' || echo '$(srcdir)/'`smp/upc_backtrace.c
+
+upc_debug.lo: smp/upc_debug.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_debug.lo -MD -MP -MF $(DEPDIR)/upc_debug.Tpo -c -o upc_debug.lo `test -f 'smp/upc_debug.c' || echo '$(srcdir)/'`smp/upc_debug.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_debug.Tpo $(DEPDIR)/upc_debug.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_debug.c' object='upc_debug.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_debug.lo `test -f 'smp/upc_debug.c' || echo '$(srcdir)/'`smp/upc_debug.c
+
+upc_gasp.lo: smp/upc_gasp.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_gasp.lo -MD -MP -MF $(DEPDIR)/upc_gasp.Tpo -c -o upc_gasp.lo `test -f 'smp/upc_gasp.c' || echo '$(srcdir)/'`smp/upc_gasp.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_gasp.Tpo $(DEPDIR)/upc_gasp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_gasp.c' object='upc_gasp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_gasp.lo `test -f 'smp/upc_gasp.c' || echo '$(srcdir)/'`smp/upc_gasp.c
+
+upc_gum.lo: smp/upc_gum.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_gum.lo -MD -MP -MF $(DEPDIR)/upc_gum.Tpo -c -o upc_gum.lo `test -f 'smp/upc_gum.c' || echo '$(srcdir)/'`smp/upc_gum.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_gum.Tpo $(DEPDIR)/upc_gum.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_gum.c' object='upc_gum.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_gum.lo `test -f 'smp/upc_gum.c' || echo '$(srcdir)/'`smp/upc_gum.c
+
+upc_libat_lock.lo: smp/upc_libat_lock.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_libat_lock.lo -MD -MP -MF $(DEPDIR)/upc_libat_lock.Tpo -c -o upc_libat_lock.lo `test -f 'smp/upc_libat_lock.c' || echo '$(srcdir)/'`smp/upc_libat_lock.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_libat_lock.Tpo $(DEPDIR)/upc_libat_lock.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_libat_lock.c' object='upc_libat_lock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_libat_lock.lo `test -f 'smp/upc_libat_lock.c' || echo '$(srcdir)/'`smp/upc_libat_lock.c
+
+upc_libg.lo: smp/upc_libg.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_libg.lo -MD -MP -MF $(DEPDIR)/upc_libg.Tpo -c -o upc_libg.lo `test -f 'smp/upc_libg.c' || echo '$(srcdir)/'`smp/upc_libg.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_libg.Tpo $(DEPDIR)/upc_libg.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_libg.c' object='upc_libg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_libg.lo `test -f 'smp/upc_libg.c' || echo '$(srcdir)/'`smp/upc_libg.c
+
+upc_lock_sup.lo: smp/upc_lock_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_lock_sup.lo -MD -MP -MF $(DEPDIR)/upc_lock_sup.Tpo -c -o upc_lock_sup.lo `test -f 'smp/upc_lock_sup.c' || echo '$(srcdir)/'`smp/upc_lock_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_lock_sup.Tpo $(DEPDIR)/upc_lock_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_lock_sup.c' object='upc_lock_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_lock_sup.lo `test -f 'smp/upc_lock_sup.c' || echo '$(srcdir)/'`smp/upc_lock_sup.c
+
+upc_main.lo: smp/upc_main.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_main.lo -MD -MP -MF $(DEPDIR)/upc_main.Tpo -c -o upc_main.lo `test -f 'smp/upc_main.c' || echo '$(srcdir)/'`smp/upc_main.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_main.Tpo $(DEPDIR)/upc_main.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_main.c' object='upc_main.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_main.lo `test -f 'smp/upc_main.c' || echo '$(srcdir)/'`smp/upc_main.c
+
+upc_mem.lo: smp/upc_mem.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_mem.lo -MD -MP -MF $(DEPDIR)/upc_mem.Tpo -c -o upc_mem.lo `test -f 'smp/upc_mem.c' || echo '$(srcdir)/'`smp/upc_mem.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_mem.Tpo $(DEPDIR)/upc_mem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_mem.c' object='upc_mem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_mem.lo `test -f 'smp/upc_mem.c' || echo '$(srcdir)/'`smp/upc_mem.c
+
+upc_numa_stub.lo: smp/upc_numa_stub.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_numa_stub.lo -MD -MP -MF $(DEPDIR)/upc_numa_stub.Tpo -c -o upc_numa_stub.lo `test -f 'smp/upc_numa_stub.c' || echo '$(srcdir)/'`smp/upc_numa_stub.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_numa_stub.Tpo $(DEPDIR)/upc_numa_stub.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_numa_stub.c' object='upc_numa_stub.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_numa_stub.lo `test -f 'smp/upc_numa_stub.c' || echo '$(srcdir)/'`smp/upc_numa_stub.c
+
+upc_numa.lo: smp/upc_numa.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_numa.lo -MD -MP -MF $(DEPDIR)/upc_numa.Tpo -c -o upc_numa.lo `test -f 'smp/upc_numa.c' || echo '$(srcdir)/'`smp/upc_numa.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_numa.Tpo $(DEPDIR)/upc_numa.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_numa.c' object='upc_numa.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_numa.lo `test -f 'smp/upc_numa.c' || echo '$(srcdir)/'`smp/upc_numa.c
+
+upc_pgm_info.lo: smp/upc_pgm_info.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_pgm_info.lo -MD -MP -MF $(DEPDIR)/upc_pgm_info.Tpo -c -o upc_pgm_info.lo `test -f 'smp/upc_pgm_info.c' || echo '$(srcdir)/'`smp/upc_pgm_info.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_pgm_info.Tpo $(DEPDIR)/upc_pgm_info.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_pgm_info.c' object='upc_pgm_info.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_pgm_info.lo `test -f 'smp/upc_pgm_info.c' || echo '$(srcdir)/'`smp/upc_pgm_info.c
+
+upc_pupc.lo: smp/upc_pupc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_pupc.lo -MD -MP -MF $(DEPDIR)/upc_pupc.Tpo -c -o upc_pupc.lo `test -f 'smp/upc_pupc.c' || echo '$(srcdir)/'`smp/upc_pupc.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_pupc.Tpo $(DEPDIR)/upc_pupc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_pupc.c' object='upc_pupc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_pupc.lo `test -f 'smp/upc_pupc.c' || echo '$(srcdir)/'`smp/upc_pupc.c
+
+upc_sysdep.lo: smp/upc_sysdep.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_sysdep.lo -MD -MP -MF $(DEPDIR)/upc_sysdep.Tpo -c -o upc_sysdep.lo `test -f 'smp/upc_sysdep.c' || echo '$(srcdir)/'`smp/upc_sysdep.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_sysdep.Tpo $(DEPDIR)/upc_sysdep.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_sysdep.c' object='upc_sysdep.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_sysdep.lo `test -f 'smp/upc_sysdep.c' || echo '$(srcdir)/'`smp/upc_sysdep.c
+
+upc_tick.lo: smp/upc_tick.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_tick.lo -MD -MP -MF $(DEPDIR)/upc_tick.Tpo -c -o upc_tick.lo `test -f 'smp/upc_tick.c' || echo '$(srcdir)/'`smp/upc_tick.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_tick.Tpo $(DEPDIR)/upc_tick.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_tick.c' object='upc_tick.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_tick.lo `test -f 'smp/upc_tick.c' || echo '$(srcdir)/'`smp/upc_tick.c
+
+upc_vm.lo: smp/upc_vm.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT upc_vm.lo -MD -MP -MF $(DEPDIR)/upc_vm.Tpo -c -o upc_vm.lo `test -f 'smp/upc_vm.c' || echo '$(srcdir)/'`smp/upc_vm.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/upc_vm.Tpo $(DEPDIR)/upc_vm.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_vm.c' object='upc_vm.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o upc_vm.lo `test -f 'smp/upc_vm.c' || echo '$(srcdir)/'`smp/upc_vm.c
+
+gupcr_access.lo: portals4/gupcr_access.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_access.lo -MD -MP -MF $(DEPDIR)/gupcr_access.Tpo -c -o gupcr_access.lo `test -f 'portals4/gupcr_access.c' || echo '$(srcdir)/'`portals4/gupcr_access.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_access.Tpo $(DEPDIR)/gupcr_access.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_access.c' object='gupcr_access.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_access.lo `test -f 'portals4/gupcr_access.c' || echo '$(srcdir)/'`portals4/gupcr_access.c
+
+gupcr_addr.lo: portals4/gupcr_addr.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_addr.lo -MD -MP -MF $(DEPDIR)/gupcr_addr.Tpo -c -o gupcr_addr.lo `test -f 'portals4/gupcr_addr.c' || echo '$(srcdir)/'`portals4/gupcr_addr.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_addr.Tpo $(DEPDIR)/gupcr_addr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_addr.c' object='gupcr_addr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_addr.lo `test -f 'portals4/gupcr_addr.c' || echo '$(srcdir)/'`portals4/gupcr_addr.c
+
+gupcr_atomic_sup.lo: portals4/gupcr_atomic_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_atomic_sup.lo -MD -MP -MF $(DEPDIR)/gupcr_atomic_sup.Tpo -c -o gupcr_atomic_sup.lo `test -f 'portals4/gupcr_atomic_sup.c' || echo '$(srcdir)/'`portals4/gupcr_atomic_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_atomic_sup.Tpo $(DEPDIR)/gupcr_atomic_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_atomic_sup.c' object='gupcr_atomic_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_atomic_sup.lo `test -f 'portals4/gupcr_atomic_sup.c' || echo '$(srcdir)/'`portals4/gupcr_atomic_sup.c
+
+gupcr_barrier.lo: portals4/gupcr_barrier.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_barrier.lo -MD -MP -MF $(DEPDIR)/gupcr_barrier.Tpo -c -o gupcr_barrier.lo `test -f 'portals4/gupcr_barrier.c' || echo '$(srcdir)/'`portals4/gupcr_barrier.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_barrier.Tpo $(DEPDIR)/gupcr_barrier.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_barrier.c' object='gupcr_barrier.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_barrier.lo `test -f 'portals4/gupcr_barrier.c' || echo '$(srcdir)/'`portals4/gupcr_barrier.c
+
+gupcr_broadcast.lo: portals4/gupcr_broadcast.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_broadcast.lo -MD -MP -MF $(DEPDIR)/gupcr_broadcast.Tpo -c -o gupcr_broadcast.lo `test -f 'portals4/gupcr_broadcast.c' || echo '$(srcdir)/'`portals4/gupcr_broadcast.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_broadcast.Tpo $(DEPDIR)/gupcr_broadcast.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_broadcast.c' object='gupcr_broadcast.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_broadcast.lo `test -f 'portals4/gupcr_broadcast.c' || echo '$(srcdir)/'`portals4/gupcr_broadcast.c
+
+gupcr_clock.lo: portals4/gupcr_clock.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_clock.lo -MD -MP -MF $(DEPDIR)/gupcr_clock.Tpo -c -o gupcr_clock.lo `test -f 'portals4/gupcr_clock.c' || echo '$(srcdir)/'`portals4/gupcr_clock.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_clock.Tpo $(DEPDIR)/gupcr_clock.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_clock.c' object='gupcr_clock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_clock.lo `test -f 'portals4/gupcr_clock.c' || echo '$(srcdir)/'`portals4/gupcr_clock.c
+
+gupcr_coll_sup.lo: portals4/gupcr_coll_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_coll_sup.lo -MD -MP -MF $(DEPDIR)/gupcr_coll_sup.Tpo -c -o gupcr_coll_sup.lo `test -f 'portals4/gupcr_coll_sup.c' || echo '$(srcdir)/'`portals4/gupcr_coll_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_coll_sup.Tpo $(DEPDIR)/gupcr_coll_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_coll_sup.c' object='gupcr_coll_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_coll_sup.lo `test -f 'portals4/gupcr_coll_sup.c' || echo '$(srcdir)/'`portals4/gupcr_coll_sup.c
+
+gupcr_env.lo: portals4/gupcr_env.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_env.lo -MD -MP -MF $(DEPDIR)/gupcr_env.Tpo -c -o gupcr_env.lo `test -f 'portals4/gupcr_env.c' || echo '$(srcdir)/'`portals4/gupcr_env.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_env.Tpo $(DEPDIR)/gupcr_env.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_env.c' object='gupcr_env.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_env.lo `test -f 'portals4/gupcr_env.c' || echo '$(srcdir)/'`portals4/gupcr_env.c
+
+gupcr_gmem.lo: portals4/gupcr_gmem.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_gmem.lo -MD -MP -MF $(DEPDIR)/gupcr_gmem.Tpo -c -o gupcr_gmem.lo `test -f 'portals4/gupcr_gmem.c' || echo '$(srcdir)/'`portals4/gupcr_gmem.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_gmem.Tpo $(DEPDIR)/gupcr_gmem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_gmem.c' object='gupcr_gmem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_gmem.lo `test -f 'portals4/gupcr_gmem.c' || echo '$(srcdir)/'`portals4/gupcr_gmem.c
+
+gupcr_lock_sup.lo: portals4/gupcr_lock_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_lock_sup.lo -MD -MP -MF $(DEPDIR)/gupcr_lock_sup.Tpo -c -o gupcr_lock_sup.lo `test -f 'portals4/gupcr_lock_sup.c' || echo '$(srcdir)/'`portals4/gupcr_lock_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_lock_sup.Tpo $(DEPDIR)/gupcr_lock_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_lock_sup.c' object='gupcr_lock_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_lock_sup.lo `test -f 'portals4/gupcr_lock_sup.c' || echo '$(srcdir)/'`portals4/gupcr_lock_sup.c
+
+gupcr_main.lo: portals4/gupcr_main.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_main.lo -MD -MP -MF $(DEPDIR)/gupcr_main.Tpo -c -o gupcr_main.lo `test -f 'portals4/gupcr_main.c' || echo '$(srcdir)/'`portals4/gupcr_main.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_main.Tpo $(DEPDIR)/gupcr_main.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_main.c' object='gupcr_main.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_main.lo `test -f 'portals4/gupcr_main.c' || echo '$(srcdir)/'`portals4/gupcr_main.c
+
+gupcr_nb_sup.lo: portals4/gupcr_nb_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_nb_sup.lo -MD -MP -MF $(DEPDIR)/gupcr_nb_sup.Tpo -c -o gupcr_nb_sup.lo `test -f 'portals4/gupcr_nb_sup.c' || echo '$(srcdir)/'`portals4/gupcr_nb_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_nb_sup.Tpo $(DEPDIR)/gupcr_nb_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_nb_sup.c' object='gupcr_nb_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_nb_sup.lo `test -f 'portals4/gupcr_nb_sup.c' || echo '$(srcdir)/'`portals4/gupcr_nb_sup.c
+
+gupcr_node.lo: portals4/gupcr_node.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_node.lo -MD -MP -MF $(DEPDIR)/gupcr_node.Tpo -c -o gupcr_node.lo `test -f 'portals4/gupcr_node.c' || echo '$(srcdir)/'`portals4/gupcr_node.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_node.Tpo $(DEPDIR)/gupcr_node.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_node.c' object='gupcr_node.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_node.lo `test -f 'portals4/gupcr_node.c' || echo '$(srcdir)/'`portals4/gupcr_node.c
+
+gupcr_mem.lo: portals4/gupcr_mem.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_mem.lo -MD -MP -MF $(DEPDIR)/gupcr_mem.Tpo -c -o gupcr_mem.lo `test -f 'portals4/gupcr_mem.c' || echo '$(srcdir)/'`portals4/gupcr_mem.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_mem.Tpo $(DEPDIR)/gupcr_mem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_mem.c' object='gupcr_mem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_mem.lo `test -f 'portals4/gupcr_mem.c' || echo '$(srcdir)/'`portals4/gupcr_mem.c
+
+gupcr_portals.lo: portals4/gupcr_portals.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_portals.lo -MD -MP -MF $(DEPDIR)/gupcr_portals.Tpo -c -o gupcr_portals.lo `test -f 'portals4/gupcr_portals.c' || echo '$(srcdir)/'`portals4/gupcr_portals.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_portals.Tpo $(DEPDIR)/gupcr_portals.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_portals.c' object='gupcr_portals.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_portals.lo `test -f 'portals4/gupcr_portals.c' || echo '$(srcdir)/'`portals4/gupcr_portals.c
+
+gupcr_pgm_info.lo: portals4/gupcr_pgm_info.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_pgm_info.lo -MD -MP -MF $(DEPDIR)/gupcr_pgm_info.Tpo -c -o gupcr_pgm_info.lo `test -f 'portals4/gupcr_pgm_info.c' || echo '$(srcdir)/'`portals4/gupcr_pgm_info.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_pgm_info.Tpo $(DEPDIR)/gupcr_pgm_info.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_pgm_info.c' object='gupcr_pgm_info.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_pgm_info.lo `test -f 'portals4/gupcr_pgm_info.c' || echo '$(srcdir)/'`portals4/gupcr_pgm_info.c
+
+gupcr_runtime.lo: portals4/gupcr_runtime.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_runtime.lo -MD -MP -MF $(DEPDIR)/gupcr_runtime.Tpo -c -o gupcr_runtime.lo `test -f 'portals4/gupcr_runtime.c' || echo '$(srcdir)/'`portals4/gupcr_runtime.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_runtime.Tpo $(DEPDIR)/gupcr_runtime.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_runtime.c' object='gupcr_runtime.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_runtime.lo `test -f 'portals4/gupcr_runtime.c' || echo '$(srcdir)/'`portals4/gupcr_runtime.c
+
+gupcr_shutdown.lo: portals4/gupcr_shutdown.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_shutdown.lo -MD -MP -MF $(DEPDIR)/gupcr_shutdown.Tpo -c -o gupcr_shutdown.lo `test -f 'portals4/gupcr_shutdown.c' || echo '$(srcdir)/'`portals4/gupcr_shutdown.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_shutdown.Tpo $(DEPDIR)/gupcr_shutdown.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_shutdown.c' object='gupcr_shutdown.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_shutdown.lo `test -f 'portals4/gupcr_shutdown.c' || echo '$(srcdir)/'`portals4/gupcr_shutdown.c
+
+gupcr_tick.lo: portals4/gupcr_tick.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_tick.lo -MD -MP -MF $(DEPDIR)/gupcr_tick.Tpo -c -o gupcr_tick.lo `test -f 'portals4/gupcr_tick.c' || echo '$(srcdir)/'`portals4/gupcr_tick.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_tick.Tpo $(DEPDIR)/gupcr_tick.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_tick.c' object='gupcr_tick.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_tick.lo `test -f 'portals4/gupcr_tick.c' || echo '$(srcdir)/'`portals4/gupcr_tick.c
+
+gupcr_utils.lo: portals4/gupcr_utils.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_utils.lo -MD -MP -MF $(DEPDIR)/gupcr_utils.Tpo -c -o gupcr_utils.lo `test -f 'portals4/gupcr_utils.c' || echo '$(srcdir)/'`portals4/gupcr_utils.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_utils.Tpo $(DEPDIR)/gupcr_utils.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_utils.c' object='gupcr_utils.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_utils.lo `test -f 'portals4/gupcr_utils.c' || echo '$(srcdir)/'`portals4/gupcr_utils.c
+
+gupcr_node_mem_posix.lo: portals4/gupcr_node_mem_posix.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_node_mem_posix.lo -MD -MP -MF $(DEPDIR)/gupcr_node_mem_posix.Tpo -c -o gupcr_node_mem_posix.lo `test -f 'portals4/gupcr_node_mem_posix.c' || echo '$(srcdir)/'`portals4/gupcr_node_mem_posix.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_node_mem_posix.Tpo $(DEPDIR)/gupcr_node_mem_posix.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_node_mem_posix.c' object='gupcr_node_mem_posix.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_node_mem_posix.lo `test -f 'portals4/gupcr_node_mem_posix.c' || echo '$(srcdir)/'`portals4/gupcr_node_mem_posix.c
+
+gupcr_node_mem_mmap.lo: portals4/gupcr_node_mem_mmap.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gupcr_node_mem_mmap.lo -MD -MP -MF $(DEPDIR)/gupcr_node_mem_mmap.Tpo -c -o gupcr_node_mem_mmap.lo `test -f 'portals4/gupcr_node_mem_mmap.c' || echo '$(srcdir)/'`portals4/gupcr_node_mem_mmap.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_node_mem_mmap.Tpo $(DEPDIR)/gupcr_node_mem_mmap.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_node_mem_mmap.c' object='gupcr_node_mem_mmap.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gupcr_node_mem_mmap.lo `test -f 'portals4/gupcr_node_mem_mmap.c' || echo '$(srcdir)/'`portals4/gupcr_node_mem_mmap.c
+
+libgupc_pt_la-upc_access.lo: smp/upc_access.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_access.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_access.Tpo -c -o libgupc_pt_la-upc_access.lo `test -f 'smp/upc_access.c' || echo '$(srcdir)/'`smp/upc_access.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_access.Tpo $(DEPDIR)/libgupc_pt_la-upc_access.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_access.c' object='libgupc_pt_la-upc_access.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_access.lo `test -f 'smp/upc_access.c' || echo '$(srcdir)/'`smp/upc_access.c
+
+libgupc_pt_la-upc_accessg.lo: smp/upc_accessg.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_accessg.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_accessg.Tpo -c -o libgupc_pt_la-upc_accessg.lo `test -f 'smp/upc_accessg.c' || echo '$(srcdir)/'`smp/upc_accessg.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_accessg.Tpo $(DEPDIR)/libgupc_pt_la-upc_accessg.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_accessg.c' object='libgupc_pt_la-upc_accessg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_accessg.lo `test -f 'smp/upc_accessg.c' || echo '$(srcdir)/'`smp/upc_accessg.c
+
+libgupc_pt_la-upc_addr.lo: smp/upc_addr.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_addr.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_addr.Tpo -c -o libgupc_pt_la-upc_addr.lo `test -f 'smp/upc_addr.c' || echo '$(srcdir)/'`smp/upc_addr.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_addr.Tpo $(DEPDIR)/libgupc_pt_la-upc_addr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_addr.c' object='libgupc_pt_la-upc_addr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_addr.lo `test -f 'smp/upc_addr.c' || echo '$(srcdir)/'`smp/upc_addr.c
+
+libgupc_pt_la-upc_affinity_stub.lo: smp/upc_affinity_stub.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_affinity_stub.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_affinity_stub.Tpo -c -o libgupc_pt_la-upc_affinity_stub.lo `test -f 'smp/upc_affinity_stub.c' || echo '$(srcdir)/'`smp/upc_affinity_stub.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_affinity_stub.Tpo $(DEPDIR)/libgupc_pt_la-upc_affinity_stub.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_affinity_stub.c' object='libgupc_pt_la-upc_affinity_stub.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_affinity_stub.lo `test -f 'smp/upc_affinity_stub.c' || echo '$(srcdir)/'`smp/upc_affinity_stub.c
+
+libgupc_pt_la-upc_affinity.lo: smp/upc_affinity.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_affinity.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_affinity.Tpo -c -o libgupc_pt_la-upc_affinity.lo `test -f 'smp/upc_affinity.c' || echo '$(srcdir)/'`smp/upc_affinity.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_affinity.Tpo $(DEPDIR)/libgupc_pt_la-upc_affinity.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_affinity.c' object='libgupc_pt_la-upc_affinity.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_affinity.lo `test -f 'smp/upc_affinity.c' || echo '$(srcdir)/'`smp/upc_affinity.c
+
+libgupc_pt_la-gupcr_backtrace.lo: portals4/gupcr_backtrace.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_backtrace.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_backtrace.Tpo -c -o libgupc_pt_la-gupcr_backtrace.lo `test -f 'portals4/gupcr_backtrace.c' || echo '$(srcdir)/'`portals4/gupcr_backtrace.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_backtrace.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_backtrace.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_backtrace.c' object='libgupc_pt_la-gupcr_backtrace.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_backtrace.lo `test -f 'portals4/gupcr_backtrace.c' || echo '$(srcdir)/'`portals4/gupcr_backtrace.c
+
+libgupc_pt_la-upc_backtrace.lo: smp/upc_backtrace.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_backtrace.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_backtrace.Tpo -c -o libgupc_pt_la-upc_backtrace.lo `test -f 'smp/upc_backtrace.c' || echo '$(srcdir)/'`smp/upc_backtrace.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_backtrace.Tpo $(DEPDIR)/libgupc_pt_la-upc_backtrace.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_backtrace.c' object='libgupc_pt_la-upc_backtrace.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_backtrace.lo `test -f 'smp/upc_backtrace.c' || echo '$(srcdir)/'`smp/upc_backtrace.c
+
+libgupc_pt_la-upc_debug.lo: smp/upc_debug.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_debug.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_debug.Tpo -c -o libgupc_pt_la-upc_debug.lo `test -f 'smp/upc_debug.c' || echo '$(srcdir)/'`smp/upc_debug.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_debug.Tpo $(DEPDIR)/libgupc_pt_la-upc_debug.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_debug.c' object='libgupc_pt_la-upc_debug.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_debug.lo `test -f 'smp/upc_debug.c' || echo '$(srcdir)/'`smp/upc_debug.c
+
+libgupc_pt_la-upc_gasp.lo: smp/upc_gasp.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_gasp.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_gasp.Tpo -c -o libgupc_pt_la-upc_gasp.lo `test -f 'smp/upc_gasp.c' || echo '$(srcdir)/'`smp/upc_gasp.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_gasp.Tpo $(DEPDIR)/libgupc_pt_la-upc_gasp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_gasp.c' object='libgupc_pt_la-upc_gasp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_gasp.lo `test -f 'smp/upc_gasp.c' || echo '$(srcdir)/'`smp/upc_gasp.c
+
+libgupc_pt_la-upc_gum.lo: smp/upc_gum.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_gum.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_gum.Tpo -c -o libgupc_pt_la-upc_gum.lo `test -f 'smp/upc_gum.c' || echo '$(srcdir)/'`smp/upc_gum.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_gum.Tpo $(DEPDIR)/libgupc_pt_la-upc_gum.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_gum.c' object='libgupc_pt_la-upc_gum.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_gum.lo `test -f 'smp/upc_gum.c' || echo '$(srcdir)/'`smp/upc_gum.c
+
+libgupc_pt_la-upc_libat_lock.lo: smp/upc_libat_lock.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_libat_lock.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_libat_lock.Tpo -c -o libgupc_pt_la-upc_libat_lock.lo `test -f 'smp/upc_libat_lock.c' || echo '$(srcdir)/'`smp/upc_libat_lock.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_libat_lock.Tpo $(DEPDIR)/libgupc_pt_la-upc_libat_lock.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_libat_lock.c' object='libgupc_pt_la-upc_libat_lock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_libat_lock.lo `test -f 'smp/upc_libat_lock.c' || echo '$(srcdir)/'`smp/upc_libat_lock.c
+
+libgupc_pt_la-upc_libg.lo: smp/upc_libg.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_libg.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_libg.Tpo -c -o libgupc_pt_la-upc_libg.lo `test -f 'smp/upc_libg.c' || echo '$(srcdir)/'`smp/upc_libg.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_libg.Tpo $(DEPDIR)/libgupc_pt_la-upc_libg.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_libg.c' object='libgupc_pt_la-upc_libg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_libg.lo `test -f 'smp/upc_libg.c' || echo '$(srcdir)/'`smp/upc_libg.c
+
+libgupc_pt_la-upc_lock_sup.lo: smp/upc_lock_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_lock_sup.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_lock_sup.Tpo -c -o libgupc_pt_la-upc_lock_sup.lo `test -f 'smp/upc_lock_sup.c' || echo '$(srcdir)/'`smp/upc_lock_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_lock_sup.Tpo $(DEPDIR)/libgupc_pt_la-upc_lock_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_lock_sup.c' object='libgupc_pt_la-upc_lock_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_lock_sup.lo `test -f 'smp/upc_lock_sup.c' || echo '$(srcdir)/'`smp/upc_lock_sup.c
+
+libgupc_pt_la-upc_main.lo: smp/upc_main.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_main.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_main.Tpo -c -o libgupc_pt_la-upc_main.lo `test -f 'smp/upc_main.c' || echo '$(srcdir)/'`smp/upc_main.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_main.Tpo $(DEPDIR)/libgupc_pt_la-upc_main.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_main.c' object='libgupc_pt_la-upc_main.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_main.lo `test -f 'smp/upc_main.c' || echo '$(srcdir)/'`smp/upc_main.c
+
+libgupc_pt_la-upc_mem.lo: smp/upc_mem.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_mem.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_mem.Tpo -c -o libgupc_pt_la-upc_mem.lo `test -f 'smp/upc_mem.c' || echo '$(srcdir)/'`smp/upc_mem.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_mem.Tpo $(DEPDIR)/libgupc_pt_la-upc_mem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_mem.c' object='libgupc_pt_la-upc_mem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_mem.lo `test -f 'smp/upc_mem.c' || echo '$(srcdir)/'`smp/upc_mem.c
+
+libgupc_pt_la-upc_numa_stub.lo: smp/upc_numa_stub.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_numa_stub.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_numa_stub.Tpo -c -o libgupc_pt_la-upc_numa_stub.lo `test -f 'smp/upc_numa_stub.c' || echo '$(srcdir)/'`smp/upc_numa_stub.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_numa_stub.Tpo $(DEPDIR)/libgupc_pt_la-upc_numa_stub.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_numa_stub.c' object='libgupc_pt_la-upc_numa_stub.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_numa_stub.lo `test -f 'smp/upc_numa_stub.c' || echo '$(srcdir)/'`smp/upc_numa_stub.c
+
+libgupc_pt_la-upc_numa.lo: smp/upc_numa.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_numa.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_numa.Tpo -c -o libgupc_pt_la-upc_numa.lo `test -f 'smp/upc_numa.c' || echo '$(srcdir)/'`smp/upc_numa.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_numa.Tpo $(DEPDIR)/libgupc_pt_la-upc_numa.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_numa.c' object='libgupc_pt_la-upc_numa.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_numa.lo `test -f 'smp/upc_numa.c' || echo '$(srcdir)/'`smp/upc_numa.c
+
+libgupc_pt_la-upc_pgm_info.lo: smp/upc_pgm_info.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_pgm_info.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_pgm_info.Tpo -c -o libgupc_pt_la-upc_pgm_info.lo `test -f 'smp/upc_pgm_info.c' || echo '$(srcdir)/'`smp/upc_pgm_info.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_pgm_info.Tpo $(DEPDIR)/libgupc_pt_la-upc_pgm_info.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_pgm_info.c' object='libgupc_pt_la-upc_pgm_info.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_pgm_info.lo `test -f 'smp/upc_pgm_info.c' || echo '$(srcdir)/'`smp/upc_pgm_info.c
+
+libgupc_pt_la-upc_pupc.lo: smp/upc_pupc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_pupc.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_pupc.Tpo -c -o libgupc_pt_la-upc_pupc.lo `test -f 'smp/upc_pupc.c' || echo '$(srcdir)/'`smp/upc_pupc.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_pupc.Tpo $(DEPDIR)/libgupc_pt_la-upc_pupc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_pupc.c' object='libgupc_pt_la-upc_pupc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_pupc.lo `test -f 'smp/upc_pupc.c' || echo '$(srcdir)/'`smp/upc_pupc.c
+
+libgupc_pt_la-upc_sysdep.lo: smp/upc_sysdep.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_sysdep.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_sysdep.Tpo -c -o libgupc_pt_la-upc_sysdep.lo `test -f 'smp/upc_sysdep.c' || echo '$(srcdir)/'`smp/upc_sysdep.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_sysdep.Tpo $(DEPDIR)/libgupc_pt_la-upc_sysdep.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_sysdep.c' object='libgupc_pt_la-upc_sysdep.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_sysdep.lo `test -f 'smp/upc_sysdep.c' || echo '$(srcdir)/'`smp/upc_sysdep.c
+
+libgupc_pt_la-upc_tick.lo: smp/upc_tick.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_tick.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_tick.Tpo -c -o libgupc_pt_la-upc_tick.lo `test -f 'smp/upc_tick.c' || echo '$(srcdir)/'`smp/upc_tick.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_tick.Tpo $(DEPDIR)/libgupc_pt_la-upc_tick.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_tick.c' object='libgupc_pt_la-upc_tick.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_tick.lo `test -f 'smp/upc_tick.c' || echo '$(srcdir)/'`smp/upc_tick.c
+
+libgupc_pt_la-upc_vm.lo: smp/upc_vm.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-upc_vm.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_vm.Tpo -c -o libgupc_pt_la-upc_vm.lo `test -f 'smp/upc_vm.c' || echo '$(srcdir)/'`smp/upc_vm.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_vm.Tpo $(DEPDIR)/libgupc_pt_la-upc_vm.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smp/upc_vm.c' object='libgupc_pt_la-upc_vm.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-upc_vm.lo `test -f 'smp/upc_vm.c' || echo '$(srcdir)/'`smp/upc_vm.c
+
+libgupc_pt_la-gupcr_access.lo: portals4/gupcr_access.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_access.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_access.Tpo -c -o libgupc_pt_la-gupcr_access.lo `test -f 'portals4/gupcr_access.c' || echo '$(srcdir)/'`portals4/gupcr_access.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_access.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_access.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_access.c' object='libgupc_pt_la-gupcr_access.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_access.lo `test -f 'portals4/gupcr_access.c' || echo '$(srcdir)/'`portals4/gupcr_access.c
+
+libgupc_pt_la-gupcr_addr.lo: portals4/gupcr_addr.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_addr.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_addr.Tpo -c -o libgupc_pt_la-gupcr_addr.lo `test -f 'portals4/gupcr_addr.c' || echo '$(srcdir)/'`portals4/gupcr_addr.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_addr.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_addr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_addr.c' object='libgupc_pt_la-gupcr_addr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_addr.lo `test -f 'portals4/gupcr_addr.c' || echo '$(srcdir)/'`portals4/gupcr_addr.c
+
+libgupc_pt_la-gupcr_atomic_sup.lo: portals4/gupcr_atomic_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_atomic_sup.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_atomic_sup.Tpo -c -o libgupc_pt_la-gupcr_atomic_sup.lo `test -f 'portals4/gupcr_atomic_sup.c' || echo '$(srcdir)/'`portals4/gupcr_atomic_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_atomic_sup.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_atomic_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_atomic_sup.c' object='libgupc_pt_la-gupcr_atomic_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_atomic_sup.lo `test -f 'portals4/gupcr_atomic_sup.c' || echo '$(srcdir)/'`portals4/gupcr_atomic_sup.c
+
+libgupc_pt_la-gupcr_barrier.lo: portals4/gupcr_barrier.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_barrier.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_barrier.Tpo -c -o libgupc_pt_la-gupcr_barrier.lo `test -f 'portals4/gupcr_barrier.c' || echo '$(srcdir)/'`portals4/gupcr_barrier.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_barrier.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_barrier.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_barrier.c' object='libgupc_pt_la-gupcr_barrier.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_barrier.lo `test -f 'portals4/gupcr_barrier.c' || echo '$(srcdir)/'`portals4/gupcr_barrier.c
+
+libgupc_pt_la-gupcr_broadcast.lo: portals4/gupcr_broadcast.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_broadcast.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_broadcast.Tpo -c -o libgupc_pt_la-gupcr_broadcast.lo `test -f 'portals4/gupcr_broadcast.c' || echo '$(srcdir)/'`portals4/gupcr_broadcast.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_broadcast.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_broadcast.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_broadcast.c' object='libgupc_pt_la-gupcr_broadcast.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_broadcast.lo `test -f 'portals4/gupcr_broadcast.c' || echo '$(srcdir)/'`portals4/gupcr_broadcast.c
+
+libgupc_pt_la-gupcr_clock.lo: portals4/gupcr_clock.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_clock.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_clock.Tpo -c -o libgupc_pt_la-gupcr_clock.lo `test -f 'portals4/gupcr_clock.c' || echo '$(srcdir)/'`portals4/gupcr_clock.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_clock.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_clock.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_clock.c' object='libgupc_pt_la-gupcr_clock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_clock.lo `test -f 'portals4/gupcr_clock.c' || echo '$(srcdir)/'`portals4/gupcr_clock.c
+
+libgupc_pt_la-gupcr_coll_sup.lo: portals4/gupcr_coll_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_coll_sup.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_coll_sup.Tpo -c -o libgupc_pt_la-gupcr_coll_sup.lo `test -f 'portals4/gupcr_coll_sup.c' || echo '$(srcdir)/'`portals4/gupcr_coll_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_coll_sup.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_coll_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_coll_sup.c' object='libgupc_pt_la-gupcr_coll_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_coll_sup.lo `test -f 'portals4/gupcr_coll_sup.c' || echo '$(srcdir)/'`portals4/gupcr_coll_sup.c
+
+libgupc_pt_la-gupcr_env.lo: portals4/gupcr_env.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_env.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_env.Tpo -c -o libgupc_pt_la-gupcr_env.lo `test -f 'portals4/gupcr_env.c' || echo '$(srcdir)/'`portals4/gupcr_env.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_env.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_env.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_env.c' object='libgupc_pt_la-gupcr_env.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_env.lo `test -f 'portals4/gupcr_env.c' || echo '$(srcdir)/'`portals4/gupcr_env.c
+
+libgupc_pt_la-gupcr_gmem.lo: portals4/gupcr_gmem.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_gmem.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_gmem.Tpo -c -o libgupc_pt_la-gupcr_gmem.lo `test -f 'portals4/gupcr_gmem.c' || echo '$(srcdir)/'`portals4/gupcr_gmem.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_gmem.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_gmem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_gmem.c' object='libgupc_pt_la-gupcr_gmem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_gmem.lo `test -f 'portals4/gupcr_gmem.c' || echo '$(srcdir)/'`portals4/gupcr_gmem.c
+
+libgupc_pt_la-gupcr_lock_sup.lo: portals4/gupcr_lock_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_lock_sup.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_lock_sup.Tpo -c -o libgupc_pt_la-gupcr_lock_sup.lo `test -f 'portals4/gupcr_lock_sup.c' || echo '$(srcdir)/'`portals4/gupcr_lock_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_lock_sup.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_lock_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_lock_sup.c' object='libgupc_pt_la-gupcr_lock_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_lock_sup.lo `test -f 'portals4/gupcr_lock_sup.c' || echo '$(srcdir)/'`portals4/gupcr_lock_sup.c
+
+libgupc_pt_la-gupcr_main.lo: portals4/gupcr_main.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_main.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_main.Tpo -c -o libgupc_pt_la-gupcr_main.lo `test -f 'portals4/gupcr_main.c' || echo '$(srcdir)/'`portals4/gupcr_main.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_main.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_main.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_main.c' object='libgupc_pt_la-gupcr_main.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_main.lo `test -f 'portals4/gupcr_main.c' || echo '$(srcdir)/'`portals4/gupcr_main.c
+
+libgupc_pt_la-gupcr_nb_sup.lo: portals4/gupcr_nb_sup.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_nb_sup.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_nb_sup.Tpo -c -o libgupc_pt_la-gupcr_nb_sup.lo `test -f 'portals4/gupcr_nb_sup.c' || echo '$(srcdir)/'`portals4/gupcr_nb_sup.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_nb_sup.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_nb_sup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_nb_sup.c' object='libgupc_pt_la-gupcr_nb_sup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_nb_sup.lo `test -f 'portals4/gupcr_nb_sup.c' || echo '$(srcdir)/'`portals4/gupcr_nb_sup.c
+
+libgupc_pt_la-gupcr_node.lo: portals4/gupcr_node.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_node.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_node.Tpo -c -o libgupc_pt_la-gupcr_node.lo `test -f 'portals4/gupcr_node.c' || echo '$(srcdir)/'`portals4/gupcr_node.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_node.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_node.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_node.c' object='libgupc_pt_la-gupcr_node.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_node.lo `test -f 'portals4/gupcr_node.c' || echo '$(srcdir)/'`portals4/gupcr_node.c
+
+libgupc_pt_la-gupcr_mem.lo: portals4/gupcr_mem.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_mem.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_mem.Tpo -c -o libgupc_pt_la-gupcr_mem.lo `test -f 'portals4/gupcr_mem.c' || echo '$(srcdir)/'`portals4/gupcr_mem.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_mem.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_mem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_mem.c' object='libgupc_pt_la-gupcr_mem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_mem.lo `test -f 'portals4/gupcr_mem.c' || echo '$(srcdir)/'`portals4/gupcr_mem.c
+
+libgupc_pt_la-gupcr_portals.lo: portals4/gupcr_portals.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_portals.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_portals.Tpo -c -o libgupc_pt_la-gupcr_portals.lo `test -f 'portals4/gupcr_portals.c' || echo '$(srcdir)/'`portals4/gupcr_portals.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_portals.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_portals.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_portals.c' object='libgupc_pt_la-gupcr_portals.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_portals.lo `test -f 'portals4/gupcr_portals.c' || echo '$(srcdir)/'`portals4/gupcr_portals.c
+
+libgupc_pt_la-gupcr_pgm_info.lo: portals4/gupcr_pgm_info.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_pgm_info.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_pgm_info.Tpo -c -o libgupc_pt_la-gupcr_pgm_info.lo `test -f 'portals4/gupcr_pgm_info.c' || echo '$(srcdir)/'`portals4/gupcr_pgm_info.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_pgm_info.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_pgm_info.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_pgm_info.c' object='libgupc_pt_la-gupcr_pgm_info.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_pgm_info.lo `test -f 'portals4/gupcr_pgm_info.c' || echo '$(srcdir)/'`portals4/gupcr_pgm_info.c
+
+libgupc_pt_la-gupcr_runtime.lo: portals4/gupcr_runtime.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_runtime.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_runtime.Tpo -c -o libgupc_pt_la-gupcr_runtime.lo `test -f 'portals4/gupcr_runtime.c' || echo '$(srcdir)/'`portals4/gupcr_runtime.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_runtime.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_runtime.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_runtime.c' object='libgupc_pt_la-gupcr_runtime.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_runtime.lo `test -f 'portals4/gupcr_runtime.c' || echo '$(srcdir)/'`portals4/gupcr_runtime.c
+
+libgupc_pt_la-gupcr_shutdown.lo: portals4/gupcr_shutdown.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_shutdown.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_shutdown.Tpo -c -o libgupc_pt_la-gupcr_shutdown.lo `test -f 'portals4/gupcr_shutdown.c' || echo '$(srcdir)/'`portals4/gupcr_shutdown.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_shutdown.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_shutdown.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_shutdown.c' object='libgupc_pt_la-gupcr_shutdown.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_shutdown.lo `test -f 'portals4/gupcr_shutdown.c' || echo '$(srcdir)/'`portals4/gupcr_shutdown.c
+
+libgupc_pt_la-gupcr_tick.lo: portals4/gupcr_tick.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_tick.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_tick.Tpo -c -o libgupc_pt_la-gupcr_tick.lo `test -f 'portals4/gupcr_tick.c' || echo '$(srcdir)/'`portals4/gupcr_tick.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_tick.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_tick.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_tick.c' object='libgupc_pt_la-gupcr_tick.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_tick.lo `test -f 'portals4/gupcr_tick.c' || echo '$(srcdir)/'`portals4/gupcr_tick.c
+
+libgupc_pt_la-gupcr_utils.lo: portals4/gupcr_utils.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_utils.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_utils.Tpo -c -o libgupc_pt_la-gupcr_utils.lo `test -f 'portals4/gupcr_utils.c' || echo '$(srcdir)/'`portals4/gupcr_utils.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_utils.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_utils.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_utils.c' object='libgupc_pt_la-gupcr_utils.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_utils.lo `test -f 'portals4/gupcr_utils.c' || echo '$(srcdir)/'`portals4/gupcr_utils.c
+
+libgupc_pt_la-gupcr_node_mem_posix.lo: portals4/gupcr_node_mem_posix.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_node_mem_posix.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_node_mem_posix.Tpo -c -o libgupc_pt_la-gupcr_node_mem_posix.lo `test -f 'portals4/gupcr_node_mem_posix.c' || echo '$(srcdir)/'`portals4/gupcr_node_mem_posix.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_node_mem_posix.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_node_mem_posix.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_node_mem_posix.c' object='libgupc_pt_la-gupcr_node_mem_posix.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_node_mem_posix.lo `test -f 'portals4/gupcr_node_mem_posix.c' || echo '$(srcdir)/'`portals4/gupcr_node_mem_posix.c
+
+libgupc_pt_la-gupcr_node_mem_mmap.lo: portals4/gupcr_node_mem_mmap.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgupc_pt_la-gupcr_node_mem_mmap.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_node_mem_mmap.Tpo -c -o libgupc_pt_la-gupcr_node_mem_mmap.lo `test -f 'portals4/gupcr_node_mem_mmap.c' || echo '$(srcdir)/'`portals4/gupcr_node_mem_mmap.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_node_mem_mmap.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_node_mem_mmap.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='portals4/gupcr_node_mem_mmap.c' object='libgupc_pt_la-gupcr_node_mem_mmap.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgupc_pt_la-gupcr_node_mem_mmap.lo `test -f 'portals4/gupcr_node_mem_mmap.c' || echo '$(srcdir)/'`portals4/gupcr_node_mem_mmap.c
+
+.upc.o:
+@am__fastdepUPC_TRUE@ $(UPCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(UPCCOMPILE) -c -o $@ $<
+
+.upc.obj:
+@am__fastdepUPC_TRUE@ $(UPCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(UPCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.upc.lo:
+@am__fastdepUPC_TRUE@ $(LTUPCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LTUPCCOMPILE) -c -o $@ $<
+
+upc_allocg.lo: smp/upc_allocg.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_allocg.lo -MD -MP -MF $(DEPDIR)/upc_allocg.Tpo -c -o upc_allocg.lo `test -f 'smp/upc_allocg.upc' || echo '$(srcdir)/'`smp/upc_allocg.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_allocg.Tpo $(DEPDIR)/upc_allocg.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_allocg.upc' object='upc_allocg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_allocg.lo `test -f 'smp/upc_allocg.upc' || echo '$(srcdir)/'`smp/upc_allocg.upc
+
+upc_alloc.lo: smp/upc_alloc.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_alloc.lo -MD -MP -MF $(DEPDIR)/upc_alloc.Tpo -c -o upc_alloc.lo `test -f 'smp/upc_alloc.upc' || echo '$(srcdir)/'`smp/upc_alloc.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_alloc.Tpo $(DEPDIR)/upc_alloc.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_alloc.upc' object='upc_alloc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_alloc.lo `test -f 'smp/upc_alloc.upc' || echo '$(srcdir)/'`smp/upc_alloc.upc
+
+upc_atomic.lo: smp/upc_atomic.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_atomic.lo -MD -MP -MF $(DEPDIR)/upc_atomic.Tpo -c -o upc_atomic.lo `test -f 'smp/upc_atomic.upc' || echo '$(srcdir)/'`smp/upc_atomic.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_atomic.Tpo $(DEPDIR)/upc_atomic.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_atomic.upc' object='upc_atomic.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_atomic.lo `test -f 'smp/upc_atomic.upc' || echo '$(srcdir)/'`smp/upc_atomic.upc
+
+upc_barrier.lo: smp/upc_barrier.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_barrier.lo -MD -MP -MF $(DEPDIR)/upc_barrier.Tpo -c -o upc_barrier.lo `test -f 'smp/upc_barrier.upc' || echo '$(srcdir)/'`smp/upc_barrier.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_barrier.Tpo $(DEPDIR)/upc_barrier.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_barrier.upc' object='upc_barrier.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_barrier.lo `test -f 'smp/upc_barrier.upc' || echo '$(srcdir)/'`smp/upc_barrier.upc
+
+upc_castable.lo: smp/upc_castable.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_castable.lo -MD -MP -MF $(DEPDIR)/upc_castable.Tpo -c -o upc_castable.lo `test -f 'smp/upc_castable.upc' || echo '$(srcdir)/'`smp/upc_castable.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_castable.Tpo $(DEPDIR)/upc_castable.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_castable.upc' object='upc_castable.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_castable.lo `test -f 'smp/upc_castable.upc' || echo '$(srcdir)/'`smp/upc_castable.upc
+
+upc_lock.lo: smp/upc_lock.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_lock.lo -MD -MP -MF $(DEPDIR)/upc_lock.Tpo -c -o upc_lock.lo `test -f 'smp/upc_lock.upc' || echo '$(srcdir)/'`smp/upc_lock.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_lock.Tpo $(DEPDIR)/upc_lock.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_lock.upc' object='upc_lock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_lock.lo `test -f 'smp/upc_lock.upc' || echo '$(srcdir)/'`smp/upc_lock.upc
+
+upc_nb.lo: smp/upc_nb.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_nb.lo -MD -MP -MF $(DEPDIR)/upc_nb.Tpo -c -o upc_nb.lo `test -f 'smp/upc_nb.upc' || echo '$(srcdir)/'`smp/upc_nb.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_nb.Tpo $(DEPDIR)/upc_nb.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_nb.upc' object='upc_nb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_nb.lo `test -f 'smp/upc_nb.upc' || echo '$(srcdir)/'`smp/upc_nb.upc
+
+gupcr_alloc.lo: portals4/gupcr_alloc.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT gupcr_alloc.lo -MD -MP -MF $(DEPDIR)/gupcr_alloc.Tpo -c -o gupcr_alloc.lo `test -f 'portals4/gupcr_alloc.upc' || echo '$(srcdir)/'`portals4/gupcr_alloc.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_alloc.Tpo $(DEPDIR)/gupcr_alloc.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_alloc.upc' object='gupcr_alloc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o gupcr_alloc.lo `test -f 'portals4/gupcr_alloc.upc' || echo '$(srcdir)/'`portals4/gupcr_alloc.upc
+
+gupcr_atomic.lo: portals4/gupcr_atomic.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT gupcr_atomic.lo -MD -MP -MF $(DEPDIR)/gupcr_atomic.Tpo -c -o gupcr_atomic.lo `test -f 'portals4/gupcr_atomic.upc' || echo '$(srcdir)/'`portals4/gupcr_atomic.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_atomic.Tpo $(DEPDIR)/gupcr_atomic.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_atomic.upc' object='gupcr_atomic.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o gupcr_atomic.lo `test -f 'portals4/gupcr_atomic.upc' || echo '$(srcdir)/'`portals4/gupcr_atomic.upc
+
+gupcr_castable.lo: portals4/gupcr_castable.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT gupcr_castable.lo -MD -MP -MF $(DEPDIR)/gupcr_castable.Tpo -c -o gupcr_castable.lo `test -f 'portals4/gupcr_castable.upc' || echo '$(srcdir)/'`portals4/gupcr_castable.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_castable.Tpo $(DEPDIR)/gupcr_castable.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_castable.upc' object='gupcr_castable.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o gupcr_castable.lo `test -f 'portals4/gupcr_castable.upc' || echo '$(srcdir)/'`portals4/gupcr_castable.upc
+
+gupcr_lock.lo: portals4/gupcr_lock.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT gupcr_lock.lo -MD -MP -MF $(DEPDIR)/gupcr_lock.Tpo -c -o gupcr_lock.lo `test -f 'portals4/gupcr_lock.upc' || echo '$(srcdir)/'`portals4/gupcr_lock.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_lock.Tpo $(DEPDIR)/gupcr_lock.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_lock.upc' object='gupcr_lock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o gupcr_lock.lo `test -f 'portals4/gupcr_lock.upc' || echo '$(srcdir)/'`portals4/gupcr_lock.upc
+
+gupcr_nb.lo: portals4/gupcr_nb.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT gupcr_nb.lo -MD -MP -MF $(DEPDIR)/gupcr_nb.Tpo -c -o gupcr_nb.lo `test -f 'portals4/gupcr_nb.upc' || echo '$(srcdir)/'`portals4/gupcr_nb.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_nb.Tpo $(DEPDIR)/gupcr_nb.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_nb.upc' object='gupcr_nb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o gupcr_nb.lo `test -f 'portals4/gupcr_nb.upc' || echo '$(srcdir)/'`portals4/gupcr_nb.upc
+
+gupcr_coll_broadcast.lo: portals4/gupcr_coll_broadcast.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT gupcr_coll_broadcast.lo -MD -MP -MF $(DEPDIR)/gupcr_coll_broadcast.Tpo -c -o gupcr_coll_broadcast.lo `test -f 'portals4/gupcr_coll_broadcast.upc' || echo '$(srcdir)/'`portals4/gupcr_coll_broadcast.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_coll_broadcast.Tpo $(DEPDIR)/gupcr_coll_broadcast.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_coll_broadcast.upc' object='gupcr_coll_broadcast.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o gupcr_coll_broadcast.lo `test -f 'portals4/gupcr_coll_broadcast.upc' || echo '$(srcdir)/'`portals4/gupcr_coll_broadcast.upc
+
+gupcr_coll_init.lo: portals4/gupcr_coll_init.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT gupcr_coll_init.lo -MD -MP -MF $(DEPDIR)/gupcr_coll_init.Tpo -c -o gupcr_coll_init.lo `test -f 'portals4/gupcr_coll_init.upc' || echo '$(srcdir)/'`portals4/gupcr_coll_init.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_coll_init.Tpo $(DEPDIR)/gupcr_coll_init.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_coll_init.upc' object='gupcr_coll_init.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o gupcr_coll_init.lo `test -f 'portals4/gupcr_coll_init.upc' || echo '$(srcdir)/'`portals4/gupcr_coll_init.upc
+
+upc_coll_reduce.lo: $(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_reduce.lo -MD -MP -MF $(DEPDIR)/upc_coll_reduce.Tpo -c -o upc_coll_reduce.lo `test -f '$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_reduce.Tpo $(DEPDIR)/upc_coll_reduce.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc' object='upc_coll_reduce.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_reduce.lo `test -f '$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc
+
+gupcr_coll_reduce.lo: $(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT gupcr_coll_reduce.lo -MD -MP -MF $(DEPDIR)/gupcr_coll_reduce.Tpo -c -o gupcr_coll_reduce.lo `test -f '$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/gupcr_coll_reduce.Tpo $(DEPDIR)/gupcr_coll_reduce.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc' object='gupcr_coll_reduce.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o gupcr_coll_reduce.lo `test -f '$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc
+
+upc_coll_broadcast.lo: collectives/upc_coll_broadcast.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_broadcast.lo -MD -MP -MF $(DEPDIR)/upc_coll_broadcast.Tpo -c -o upc_coll_broadcast.lo `test -f 'collectives/upc_coll_broadcast.upc' || echo '$(srcdir)/'`collectives/upc_coll_broadcast.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_broadcast.Tpo $(DEPDIR)/upc_coll_broadcast.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_broadcast.upc' object='upc_coll_broadcast.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_broadcast.lo `test -f 'collectives/upc_coll_broadcast.upc' || echo '$(srcdir)/'`collectives/upc_coll_broadcast.upc
+
+upc_coll_err.lo: collectives/upc_coll_err.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_err.lo -MD -MP -MF $(DEPDIR)/upc_coll_err.Tpo -c -o upc_coll_err.lo `test -f 'collectives/upc_coll_err.upc' || echo '$(srcdir)/'`collectives/upc_coll_err.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_err.Tpo $(DEPDIR)/upc_coll_err.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_err.upc' object='upc_coll_err.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_err.lo `test -f 'collectives/upc_coll_err.upc' || echo '$(srcdir)/'`collectives/upc_coll_err.upc
+
+upc_coll_exchange.lo: collectives/upc_coll_exchange.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_exchange.lo -MD -MP -MF $(DEPDIR)/upc_coll_exchange.Tpo -c -o upc_coll_exchange.lo `test -f 'collectives/upc_coll_exchange.upc' || echo '$(srcdir)/'`collectives/upc_coll_exchange.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_exchange.Tpo $(DEPDIR)/upc_coll_exchange.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_exchange.upc' object='upc_coll_exchange.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_exchange.lo `test -f 'collectives/upc_coll_exchange.upc' || echo '$(srcdir)/'`collectives/upc_coll_exchange.upc
+
+upc_coll_gather_all.lo: collectives/upc_coll_gather_all.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_gather_all.lo -MD -MP -MF $(DEPDIR)/upc_coll_gather_all.Tpo -c -o upc_coll_gather_all.lo `test -f 'collectives/upc_coll_gather_all.upc' || echo '$(srcdir)/'`collectives/upc_coll_gather_all.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_gather_all.Tpo $(DEPDIR)/upc_coll_gather_all.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_gather_all.upc' object='upc_coll_gather_all.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_gather_all.lo `test -f 'collectives/upc_coll_gather_all.upc' || echo '$(srcdir)/'`collectives/upc_coll_gather_all.upc
+
+upc_coll_gather.lo: collectives/upc_coll_gather.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_gather.lo -MD -MP -MF $(DEPDIR)/upc_coll_gather.Tpo -c -o upc_coll_gather.lo `test -f 'collectives/upc_coll_gather.upc' || echo '$(srcdir)/'`collectives/upc_coll_gather.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_gather.Tpo $(DEPDIR)/upc_coll_gather.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_gather.upc' object='upc_coll_gather.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_gather.lo `test -f 'collectives/upc_coll_gather.upc' || echo '$(srcdir)/'`collectives/upc_coll_gather.upc
+
+upc_coll_init.lo: collectives/upc_coll_init.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_init.lo -MD -MP -MF $(DEPDIR)/upc_coll_init.Tpo -c -o upc_coll_init.lo `test -f 'collectives/upc_coll_init.upc' || echo '$(srcdir)/'`collectives/upc_coll_init.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_init.Tpo $(DEPDIR)/upc_coll_init.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_init.upc' object='upc_coll_init.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_init.lo `test -f 'collectives/upc_coll_init.upc' || echo '$(srcdir)/'`collectives/upc_coll_init.upc
+
+upc_coll_permute.lo: collectives/upc_coll_permute.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_permute.lo -MD -MP -MF $(DEPDIR)/upc_coll_permute.Tpo -c -o upc_coll_permute.lo `test -f 'collectives/upc_coll_permute.upc' || echo '$(srcdir)/'`collectives/upc_coll_permute.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_permute.Tpo $(DEPDIR)/upc_coll_permute.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_permute.upc' object='upc_coll_permute.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_permute.lo `test -f 'collectives/upc_coll_permute.upc' || echo '$(srcdir)/'`collectives/upc_coll_permute.upc
+
+upc_coll_prefix_reduce.lo: $(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_prefix_reduce.lo -MD -MP -MF $(DEPDIR)/upc_coll_prefix_reduce.Tpo -c -o upc_coll_prefix_reduce.lo `test -f '$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_prefix_reduce.Tpo $(DEPDIR)/upc_coll_prefix_reduce.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc' object='upc_coll_prefix_reduce.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_prefix_reduce.lo `test -f '$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+
+upc_coll_scatter.lo: collectives/upc_coll_scatter.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_scatter.lo -MD -MP -MF $(DEPDIR)/upc_coll_scatter.Tpo -c -o upc_coll_scatter.lo `test -f 'collectives/upc_coll_scatter.upc' || echo '$(srcdir)/'`collectives/upc_coll_scatter.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_scatter.Tpo $(DEPDIR)/upc_coll_scatter.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_scatter.upc' object='upc_coll_scatter.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_scatter.lo `test -f 'collectives/upc_coll_scatter.upc' || echo '$(srcdir)/'`collectives/upc_coll_scatter.upc
+
+upc_coll_sort.lo: collectives/upc_coll_sort.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -MT upc_coll_sort.lo -MD -MP -MF $(DEPDIR)/upc_coll_sort.Tpo -c -o upc_coll_sort.lo `test -f 'collectives/upc_coll_sort.upc' || echo '$(srcdir)/'`collectives/upc_coll_sort.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/upc_coll_sort.Tpo $(DEPDIR)/upc_coll_sort.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_sort.upc' object='upc_coll_sort.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS) -c -o upc_coll_sort.lo `test -f 'collectives/upc_coll_sort.upc' || echo '$(srcdir)/'`collectives/upc_coll_sort.upc
+
+libgupc_pt_la-upc_allocg.lo: smp/upc_allocg.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_allocg.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_allocg.Tpo -c -o libgupc_pt_la-upc_allocg.lo `test -f 'smp/upc_allocg.upc' || echo '$(srcdir)/'`smp/upc_allocg.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_allocg.Tpo $(DEPDIR)/libgupc_pt_la-upc_allocg.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_allocg.upc' object='libgupc_pt_la-upc_allocg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_allocg.lo `test -f 'smp/upc_allocg.upc' || echo '$(srcdir)/'`smp/upc_allocg.upc
+
+libgupc_pt_la-upc_alloc.lo: smp/upc_alloc.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_alloc.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_alloc.Tpo -c -o libgupc_pt_la-upc_alloc.lo `test -f 'smp/upc_alloc.upc' || echo '$(srcdir)/'`smp/upc_alloc.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_alloc.Tpo $(DEPDIR)/libgupc_pt_la-upc_alloc.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_alloc.upc' object='libgupc_pt_la-upc_alloc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_alloc.lo `test -f 'smp/upc_alloc.upc' || echo '$(srcdir)/'`smp/upc_alloc.upc
+
+libgupc_pt_la-upc_atomic.lo: smp/upc_atomic.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_atomic.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_atomic.Tpo -c -o libgupc_pt_la-upc_atomic.lo `test -f 'smp/upc_atomic.upc' || echo '$(srcdir)/'`smp/upc_atomic.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_atomic.Tpo $(DEPDIR)/libgupc_pt_la-upc_atomic.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_atomic.upc' object='libgupc_pt_la-upc_atomic.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_atomic.lo `test -f 'smp/upc_atomic.upc' || echo '$(srcdir)/'`smp/upc_atomic.upc
+
+libgupc_pt_la-upc_barrier.lo: smp/upc_barrier.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_barrier.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_barrier.Tpo -c -o libgupc_pt_la-upc_barrier.lo `test -f 'smp/upc_barrier.upc' || echo '$(srcdir)/'`smp/upc_barrier.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_barrier.Tpo $(DEPDIR)/libgupc_pt_la-upc_barrier.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_barrier.upc' object='libgupc_pt_la-upc_barrier.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_barrier.lo `test -f 'smp/upc_barrier.upc' || echo '$(srcdir)/'`smp/upc_barrier.upc
+
+libgupc_pt_la-upc_castable.lo: smp/upc_castable.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_castable.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_castable.Tpo -c -o libgupc_pt_la-upc_castable.lo `test -f 'smp/upc_castable.upc' || echo '$(srcdir)/'`smp/upc_castable.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_castable.Tpo $(DEPDIR)/libgupc_pt_la-upc_castable.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_castable.upc' object='libgupc_pt_la-upc_castable.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_castable.lo `test -f 'smp/upc_castable.upc' || echo '$(srcdir)/'`smp/upc_castable.upc
+
+libgupc_pt_la-upc_lock.lo: smp/upc_lock.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_lock.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_lock.Tpo -c -o libgupc_pt_la-upc_lock.lo `test -f 'smp/upc_lock.upc' || echo '$(srcdir)/'`smp/upc_lock.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_lock.Tpo $(DEPDIR)/libgupc_pt_la-upc_lock.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_lock.upc' object='libgupc_pt_la-upc_lock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_lock.lo `test -f 'smp/upc_lock.upc' || echo '$(srcdir)/'`smp/upc_lock.upc
+
+libgupc_pt_la-upc_nb.lo: smp/upc_nb.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_nb.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_nb.Tpo -c -o libgupc_pt_la-upc_nb.lo `test -f 'smp/upc_nb.upc' || echo '$(srcdir)/'`smp/upc_nb.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_nb.Tpo $(DEPDIR)/libgupc_pt_la-upc_nb.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='smp/upc_nb.upc' object='libgupc_pt_la-upc_nb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_nb.lo `test -f 'smp/upc_nb.upc' || echo '$(srcdir)/'`smp/upc_nb.upc
+
+libgupc_pt_la-gupcr_alloc.lo: portals4/gupcr_alloc.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-gupcr_alloc.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_alloc.Tpo -c -o libgupc_pt_la-gupcr_alloc.lo `test -f 'portals4/gupcr_alloc.upc' || echo '$(srcdir)/'`portals4/gupcr_alloc.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_alloc.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_alloc.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_alloc.upc' object='libgupc_pt_la-gupcr_alloc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-gupcr_alloc.lo `test -f 'portals4/gupcr_alloc.upc' || echo '$(srcdir)/'`portals4/gupcr_alloc.upc
+
+libgupc_pt_la-gupcr_atomic.lo: portals4/gupcr_atomic.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-gupcr_atomic.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_atomic.Tpo -c -o libgupc_pt_la-gupcr_atomic.lo `test -f 'portals4/gupcr_atomic.upc' || echo '$(srcdir)/'`portals4/gupcr_atomic.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_atomic.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_atomic.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_atomic.upc' object='libgupc_pt_la-gupcr_atomic.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-gupcr_atomic.lo `test -f 'portals4/gupcr_atomic.upc' || echo '$(srcdir)/'`portals4/gupcr_atomic.upc
+
+libgupc_pt_la-gupcr_castable.lo: portals4/gupcr_castable.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-gupcr_castable.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_castable.Tpo -c -o libgupc_pt_la-gupcr_castable.lo `test -f 'portals4/gupcr_castable.upc' || echo '$(srcdir)/'`portals4/gupcr_castable.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_castable.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_castable.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_castable.upc' object='libgupc_pt_la-gupcr_castable.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-gupcr_castable.lo `test -f 'portals4/gupcr_castable.upc' || echo '$(srcdir)/'`portals4/gupcr_castable.upc
+
+libgupc_pt_la-gupcr_lock.lo: portals4/gupcr_lock.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-gupcr_lock.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_lock.Tpo -c -o libgupc_pt_la-gupcr_lock.lo `test -f 'portals4/gupcr_lock.upc' || echo '$(srcdir)/'`portals4/gupcr_lock.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_lock.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_lock.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_lock.upc' object='libgupc_pt_la-gupcr_lock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-gupcr_lock.lo `test -f 'portals4/gupcr_lock.upc' || echo '$(srcdir)/'`portals4/gupcr_lock.upc
+
+libgupc_pt_la-gupcr_nb.lo: portals4/gupcr_nb.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-gupcr_nb.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_nb.Tpo -c -o libgupc_pt_la-gupcr_nb.lo `test -f 'portals4/gupcr_nb.upc' || echo '$(srcdir)/'`portals4/gupcr_nb.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_nb.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_nb.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_nb.upc' object='libgupc_pt_la-gupcr_nb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-gupcr_nb.lo `test -f 'portals4/gupcr_nb.upc' || echo '$(srcdir)/'`portals4/gupcr_nb.upc
+
+libgupc_pt_la-gupcr_coll_broadcast.lo: portals4/gupcr_coll_broadcast.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-gupcr_coll_broadcast.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_coll_broadcast.Tpo -c -o libgupc_pt_la-gupcr_coll_broadcast.lo `test -f 'portals4/gupcr_coll_broadcast.upc' || echo '$(srcdir)/'`portals4/gupcr_coll_broadcast.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_coll_broadcast.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_coll_broadcast.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_coll_broadcast.upc' object='libgupc_pt_la-gupcr_coll_broadcast.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-gupcr_coll_broadcast.lo `test -f 'portals4/gupcr_coll_broadcast.upc' || echo '$(srcdir)/'`portals4/gupcr_coll_broadcast.upc
+
+libgupc_pt_la-gupcr_coll_init.lo: portals4/gupcr_coll_init.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-gupcr_coll_init.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_coll_init.Tpo -c -o libgupc_pt_la-gupcr_coll_init.lo `test -f 'portals4/gupcr_coll_init.upc' || echo '$(srcdir)/'`portals4/gupcr_coll_init.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_coll_init.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_coll_init.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='portals4/gupcr_coll_init.upc' object='libgupc_pt_la-gupcr_coll_init.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-gupcr_coll_init.lo `test -f 'portals4/gupcr_coll_init.upc' || echo '$(srcdir)/'`portals4/gupcr_coll_init.upc
+
+libgupc_pt_la-upc_coll_reduce.lo: $(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_reduce.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_reduce.Tpo -c -o libgupc_pt_la-upc_coll_reduce.lo `test -f '$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_reduce.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_reduce.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc' object='libgupc_pt_la-upc_coll_reduce.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_reduce.lo `test -f '$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc
+
+libgupc_pt_la-gupcr_coll_reduce.lo: $(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-gupcr_coll_reduce.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-gupcr_coll_reduce.Tpo -c -o libgupc_pt_la-gupcr_coll_reduce.lo `test -f '$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-gupcr_coll_reduce.Tpo $(DEPDIR)/libgupc_pt_la-gupcr_coll_reduce.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc' object='libgupc_pt_la-gupcr_coll_reduce.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-gupcr_coll_reduce.lo `test -f '$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc
+
+libgupc_pt_la-upc_coll_broadcast.lo: collectives/upc_coll_broadcast.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_broadcast.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_broadcast.Tpo -c -o libgupc_pt_la-upc_coll_broadcast.lo `test -f 'collectives/upc_coll_broadcast.upc' || echo '$(srcdir)/'`collectives/upc_coll_broadcast.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_broadcast.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_broadcast.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_broadcast.upc' object='libgupc_pt_la-upc_coll_broadcast.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_broadcast.lo `test -f 'collectives/upc_coll_broadcast.upc' || echo '$(srcdir)/'`collectives/upc_coll_broadcast.upc
+
+libgupc_pt_la-upc_coll_err.lo: collectives/upc_coll_err.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_err.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_err.Tpo -c -o libgupc_pt_la-upc_coll_err.lo `test -f 'collectives/upc_coll_err.upc' || echo '$(srcdir)/'`collectives/upc_coll_err.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_err.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_err.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_err.upc' object='libgupc_pt_la-upc_coll_err.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_err.lo `test -f 'collectives/upc_coll_err.upc' || echo '$(srcdir)/'`collectives/upc_coll_err.upc
+
+libgupc_pt_la-upc_coll_exchange.lo: collectives/upc_coll_exchange.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_exchange.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_exchange.Tpo -c -o libgupc_pt_la-upc_coll_exchange.lo `test -f 'collectives/upc_coll_exchange.upc' || echo '$(srcdir)/'`collectives/upc_coll_exchange.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_exchange.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_exchange.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_exchange.upc' object='libgupc_pt_la-upc_coll_exchange.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_exchange.lo `test -f 'collectives/upc_coll_exchange.upc' || echo '$(srcdir)/'`collectives/upc_coll_exchange.upc
+
+libgupc_pt_la-upc_coll_gather_all.lo: collectives/upc_coll_gather_all.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_gather_all.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_gather_all.Tpo -c -o libgupc_pt_la-upc_coll_gather_all.lo `test -f 'collectives/upc_coll_gather_all.upc' || echo '$(srcdir)/'`collectives/upc_coll_gather_all.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_gather_all.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_gather_all.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_gather_all.upc' object='libgupc_pt_la-upc_coll_gather_all.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_gather_all.lo `test -f 'collectives/upc_coll_gather_all.upc' || echo '$(srcdir)/'`collectives/upc_coll_gather_all.upc
+
+libgupc_pt_la-upc_coll_gather.lo: collectives/upc_coll_gather.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_gather.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_gather.Tpo -c -o libgupc_pt_la-upc_coll_gather.lo `test -f 'collectives/upc_coll_gather.upc' || echo '$(srcdir)/'`collectives/upc_coll_gather.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_gather.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_gather.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_gather.upc' object='libgupc_pt_la-upc_coll_gather.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_gather.lo `test -f 'collectives/upc_coll_gather.upc' || echo '$(srcdir)/'`collectives/upc_coll_gather.upc
+
+libgupc_pt_la-upc_coll_init.lo: collectives/upc_coll_init.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_init.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_init.Tpo -c -o libgupc_pt_la-upc_coll_init.lo `test -f 'collectives/upc_coll_init.upc' || echo '$(srcdir)/'`collectives/upc_coll_init.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_init.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_init.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_init.upc' object='libgupc_pt_la-upc_coll_init.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_init.lo `test -f 'collectives/upc_coll_init.upc' || echo '$(srcdir)/'`collectives/upc_coll_init.upc
+
+libgupc_pt_la-upc_coll_permute.lo: collectives/upc_coll_permute.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_permute.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_permute.Tpo -c -o libgupc_pt_la-upc_coll_permute.lo `test -f 'collectives/upc_coll_permute.upc' || echo '$(srcdir)/'`collectives/upc_coll_permute.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_permute.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_permute.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_permute.upc' object='libgupc_pt_la-upc_coll_permute.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_permute.lo `test -f 'collectives/upc_coll_permute.upc' || echo '$(srcdir)/'`collectives/upc_coll_permute.upc
+
+libgupc_pt_la-upc_coll_prefix_reduce.lo: $(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_prefix_reduce.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_prefix_reduce.Tpo -c -o libgupc_pt_la-upc_coll_prefix_reduce.lo `test -f '$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_prefix_reduce.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_prefix_reduce.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc' object='libgupc_pt_la-upc_coll_prefix_reduce.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_prefix_reduce.lo `test -f '$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc' || echo '$(srcdir)/'`$(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+
+libgupc_pt_la-upc_coll_scatter.lo: collectives/upc_coll_scatter.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_scatter.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_scatter.Tpo -c -o libgupc_pt_la-upc_coll_scatter.lo `test -f 'collectives/upc_coll_scatter.upc' || echo '$(srcdir)/'`collectives/upc_coll_scatter.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_scatter.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_scatter.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_scatter.upc' object='libgupc_pt_la-upc_coll_scatter.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_scatter.lo `test -f 'collectives/upc_coll_scatter.upc' || echo '$(srcdir)/'`collectives/upc_coll_scatter.upc
+
+libgupc_pt_la-upc_coll_sort.lo: collectives/upc_coll_sort.upc
+@am__fastdepUPC_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -MT libgupc_pt_la-upc_coll_sort.lo -MD -MP -MF $(DEPDIR)/libgupc_pt_la-upc_coll_sort.Tpo -c -o libgupc_pt_la-upc_coll_sort.lo `test -f 'collectives/upc_coll_sort.upc' || echo '$(srcdir)/'`collectives/upc_coll_sort.upc
+@am__fastdepUPC_TRUE@ $(am__mv) $(DEPDIR)/libgupc_pt_la-upc_coll_sort.Tpo $(DEPDIR)/libgupc_pt_la-upc_coll_sort.Plo
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ source='collectives/upc_coll_sort.upc' object='libgupc_pt_la-upc_coll_sort.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepUPC_FALSE@ DEPDIR=$(DEPDIR) $(UPCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepUPC_FALSE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgupc_pt_la_CPPFLAGS) $(CPPFLAGS) $(libgupc_pt_la_UPCFLAGS) $(UPCFLAGS) -c -o libgupc_pt_la-upc_coll_sort.lo `test -f 'collectives/upc_coll_sort.upc' || echo '$(srcdir)/'`collectives/upc_coll_sort.upc
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool config.lt
+
+# GNU Make needs to see an explicit $(MAKE) variable in the command it
+# runs to enable its job server during parallel builds. Hence the
+# comments below.
+all-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
+
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+
+libgupc.dvi: libgupc.texi
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
+ $(TEXI2DVI) -o $@ `test -f 'libgupc.texi' || echo '$(srcdir)/'`libgupc.texi
+
+libgupc.pdf: libgupc.texi
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
+ $(TEXI2PDF) -o $@ `test -f 'libgupc.texi' || echo '$(srcdir)/'`libgupc.texi
+
+libgupc.html: libgupc.texi
+ rm -rf $(@:.html=.htp)
+ if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+ -o $(@:.html=.htp) `test -f 'libgupc.texi' || echo '$(srcdir)/'`libgupc.texi; \
+ then \
+ rm -rf $@; \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
+ else \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
+ exit 1; \
+ fi
+.dvi.ps:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ $(DVIPS) -o $@ $<
+
+uninstall-dvi-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
+ rm -f "$(DESTDIR)$(dvidir)/$$f"; \
+ done
+
+uninstall-html-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
+ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
+ done
+
+uninstall-info-am:
+ @$(PRE_UNINSTALL)
+ @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
+ list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
+ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
+ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \
+ done; \
+ else :; fi
+ @$(NORMAL_UNINSTALL)
+ @list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
+ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
+ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
+ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
+ else :; fi); \
+ done
+
+uninstall-pdf-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
+ done
+
+uninstall-ps-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(PSS)'; test -n "$(psdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(psdir)/$$f"; \
+ done
+
+dist-info: $(INFO_DEPS)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ list='$(INFO_DEPS)'; \
+ for base in $$list; do \
+ case $$base in \
+ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
+ if test -f $$base; then d=.; else d=$(srcdir); fi; \
+ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
+ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
+ if test -f $$file; then \
+ relfile=`expr "$$file" : "$$d/\(.*\)"`; \
+ test -f "$(distdir)/$$relfile" || \
+ cp -p $$file "$(distdir)/$$relfile"; \
+ else :; fi; \
+ done; \
+ done
+
+mostlyclean-aminfo:
+ -rm -rf libgupc.aux libgupc.cp libgupc.cps libgupc.fn libgupc.fns \
+ libgupc.ky libgupc.kys libgupc.log libgupc.pg libgupc.pgs \
+ libgupc.tmp libgupc.toc libgupc.tp libgupc.tps libgupc.vr \
+ libgupc.vrs
+
+clean-aminfo:
+ -test -z "libgupc.dvi libgupc.pdf libgupc.ps libgupc.html" \
+ || rm -rf libgupc.dvi libgupc.pdf libgupc.ps libgupc.html
+
+maintainer-clean-aminfo:
+ @list='$(INFO_DEPS)'; for i in $$list; do \
+ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
+ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
+ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
+ done
+install-toolexeclibDATA: $(toolexeclib_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibdir)" || exit $$?; \
+ done
+
+uninstall-toolexeclibDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(toolexeclibdir)'; $(am__uninstall_files_from_dir)
+install-libsubincludeHEADERS: $(libsubinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libsubincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libsubincludedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libsubincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(libsubincludedir)" || exit $$?; \
+ done
+
+uninstall-libsubincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(libsubincludedir)'; $(am__uninstall_files_from_dir)
+install-nodist_libsubincludeHEADERS: $(nodist_libsubinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(nodist_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libsubincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libsubincludedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libsubincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(libsubincludedir)" || exit $$?; \
+ done
+
+uninstall-nodist_libsubincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(libsubincludedir)'; $(am__uninstall_files_from_dir)
+install-nodist_toolexeclibHEADERS: $(nodist_toolexeclib_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(toolexeclibdir)" || exit $$?; \
+ done
+
+uninstall-nodist_toolexeclibHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(toolexeclibdir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-info
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzip: distdir
+ tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.lz*) \
+ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod u+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) all-multi $(DATA) \
+ $(HEADERS) config.h all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(libsubincludedir)" "$(DESTDIR)$(libsubincludedir)" "$(DESTDIR)$(toolexeclibdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-multi clean-recursive
+
+clean-am: clean-aminfo clean-generic clean-libtool \
+ clean-toolexeclibLTLIBRARIES mostlyclean-am
+
+distclean: distclean-multi distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am: $(DVIS)
+
+html: html-recursive
+
+html-am: $(HTMLS)
+
+info: info-recursive
+
+info-am: $(INFO_DEPS)
+
+install-data-am: install-info-am install-libsubincludeHEADERS \
+ install-nodist_libsubincludeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am: $(DVIS)
+ @$(NORMAL_INSTALL)
+ @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
+ done
+install-exec-am: install-multi install-nodist_toolexeclibHEADERS \
+ install-toolexeclibDATA install-toolexeclibLTLIBRARIES
+
+install-html: install-html-recursive
+
+install-html-am: $(HTMLS)
+ @$(NORMAL_INSTALL)
+ @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ $(am__strip_dir) \
+ d2=$$d$$p; \
+ if test -d "$$d2"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
+ echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
+ else \
+ list2="$$list2 $$d2"; \
+ fi; \
+ done; \
+ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
+ done; }
+install-info: install-info-recursive
+
+install-info-am: $(INFO_DEPS)
+ @$(NORMAL_INSTALL)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
+ fi; \
+ for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
+ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
+ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
+ if test -f $$ifile; then \
+ echo "$$ifile"; \
+ else : ; fi; \
+ done; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
+ @$(POST_INSTALL)
+ @if $(am__can_run_installinfo); then \
+ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
+ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
+ done; \
+ else : ; fi
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am: $(PDFS)
+ @$(NORMAL_INSTALL)
+ @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
+install-ps: install-ps-recursive
+
+install-ps-am: $(PSS)
+ @$(NORMAL_INSTALL)
+ @list='$(PSS)'; test -n "$(psdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
+installcheck-am:
+
+maintainer-clean: maintainer-clean-multi maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-aminfo \
+ maintainer-clean-generic
+
+mostlyclean: mostlyclean-multi mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am: $(PDFS)
+
+ps: ps-recursive
+
+ps-am: $(PSS)
+
+uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
+ uninstall-libsubincludeHEADERS \
+ uninstall-nodist_libsubincludeHEADERS \
+ uninstall-nodist_toolexeclibHEADERS uninstall-pdf-am \
+ uninstall-ps-am uninstall-toolexeclibDATA \
+ uninstall-toolexeclibLTLIBRARIES
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all all-multi \
+ check clean-multi ctags-recursive distclean-multi install \
+ install-am install-multi install-strip maintainer-clean-multi \
+ mostlyclean-multi tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local all-multi am--refresh check check-am \
+ clean clean-aminfo clean-generic clean-libtool clean-multi \
+ clean-toolexeclibLTLIBRARIES ctags ctags-recursive dist \
+ dist-all dist-bzip2 dist-gzip dist-info dist-lzip dist-lzma \
+ dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \
+ distclean-compile distclean-generic distclean-hdr \
+ distclean-libtool distclean-multi distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-libsubincludeHEADERS install-man \
+ install-multi install-nodist_libsubincludeHEADERS \
+ install-nodist_toolexeclibHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip install-toolexeclibDATA \
+ install-toolexeclibLTLIBRARIES installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-aminfo maintainer-clean-generic \
+ maintainer-clean-multi mostlyclean mostlyclean-aminfo \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-multi pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-dvi-am uninstall-html-am \
+ uninstall-info-am uninstall-libsubincludeHEADERS \
+ uninstall-nodist_libsubincludeHEADERS \
+ uninstall-nodist_toolexeclibHEADERS uninstall-pdf-am \
+ uninstall-ps-am uninstall-toolexeclibDATA \
+ uninstall-toolexeclibLTLIBRARIES
+
+
+vpath % $(strip $(search_path))
+
+@LIBGUPC_SMP_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@$(UPC_ATOMIC_UPC): $(UPC_ATOMIC_DEF) $(UPC_ATOMIC_TPL) \
+@LIBGUPC_SMP_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@ $(UPC_OP_DEF) $(UPC_TYPE_DEF)
+@LIBGUPC_SMP_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@ cd $(LIBGUPC_SMP_SRCDIR); \
+@LIBGUPC_SMP_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@ $(AUTOGEN) -L ../include upc_atomic.def
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ cd @DX_DOCDIR@/latex; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_LATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(MAKEINDEX_PATH) refman.idx; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_LATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ countdown=5; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ refman.log > /dev/null 2>&1 \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ && test $$countdown -gt 0; do \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_LATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ countdown=`expr $$countdown - 1`; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ done; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ TEXINPUTS="`pwd`:.:${TEXINPUTS}"; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ export TEXINPUTS; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ cd @DX_DOCDIR@/latex; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_PDFLATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_MAKEINDEX) refman.idx; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_PDFLATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ countdown=5; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ refman.log > /dev/null 2>&1 \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ && test $$countdown -gt 0; do \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_PDFLATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ countdown=`expr $$countdown - 1`; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ done; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ mv refman.pdf ../@PACKAGE@.pdf
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ rm -rf @DX_DOCDIR@
+@DX_COND_doc_TRUE@@LIBGUPC_PORTALS4_RUNTIME_TRUE@ $(DX_ENV) $(DX_DOXYGEN) $(DX_CONFIG)
+
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@$(UPC_COLL_PREFIX_REDUCE_UPC): gen-upc-coll-reduce.pl \
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@ upc_coll_prefix_reduce.in
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@ $(PERL) $+ > $@
+
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@$(UPC_COLL_REDUCE_UPC): gen-upc-coll-reduce.pl gupcr_coll_reduce.in
+@LIBGUPC_PORTALS4_RUNTIME_TRUE@@MAINTAINER_MODE_TRUE@ $(PERL) $+ > $@
+
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@@MAINTAINER_MODE_TRUE@$(UPC_COLL_PREFIX_REDUCE_UPC): gen-upc-coll-reduce.pl \
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@@MAINTAINER_MODE_TRUE@ upc_coll_prefix_reduce.in
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@@MAINTAINER_MODE_TRUE@ $(PERL) $+ > $@
+
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@@MAINTAINER_MODE_TRUE@$(UPC_COLL_REDUCE_UPC): gen-upc-coll-reduce.pl upc_coll_reduce.in
+@LIBGUPC_GENERIC_COLLECTIVES_TRUE@@MAINTAINER_MODE_TRUE@ $(PERL) $+ > $@
+
+gcc-upc-lib.h: gen-inline-libgupc.pl gcc-upc-lib.in \
+ $(UPC_RUNTIME_SRC_INLINE)
+ $(PERL) $+ > $@
+@LIBGUPC_LINK_SCRIPT_TRUE@$(UPC_LINK_SCRIPT): gen-upc-ld-script.pl
+@LIBGUPC_LINK_SCRIPT_TRUE@ -echo "int main(){}" | $(CC) $(LDFLAGS) -Xlinker --verbose \
+@LIBGUPC_LINK_SCRIPT_TRUE@ -o /dev/null -xc - | $(PERL) $+ > $@
+
+#
+# UPC related begin/end files
+# Note: at the moment, $(CRTSTUFF_T_CFLAGS*) is empty.
+# Given that upc-crtstuff.c declares only data items,
+# there is no need for options such as -fpic.
+#
+@LIBGUPC_CRTSTUFF_TRUE@upc-crtbegin.$(OBJEXT): $(upc_crtstuff_src)
+@LIBGUPC_CRTSTUFF_TRUE@ $(crt_compile) -DCRT_BEGIN $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+@LIBGUPC_CRTSTUFF_TRUE@upc-crtend.$(OBJEXT): $(upc_crtstuff_src)
+@LIBGUPC_CRTSTUFF_TRUE@ $(crt_compile) -DCRT_END $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+# upc-crtbegin and upc-crtend for shared libraries
+@LIBGUPC_CRTSTUFF_TRUE@upc-crtbeginS.$(OBJEXT): $(upc_crtstuff_src)
+@LIBGUPC_CRTSTUFF_TRUE@ $(crt_compile) -DCRT_BEGIN $(CRTSTUFF_T_CFLAGS_S) -c $< -o $@
+
+@LIBGUPC_CRTSTUFF_TRUE@upc-crtendS.$(OBJEXT): $(upc_crtstuff_src)
+@LIBGUPC_CRTSTUFF_TRUE@ $(crt_compile) -DCRT_END $(CRTSTUFF_T_CFLAGS_S) -c $< -o $@
+
+# upc-crtbegin and upc-crtend for -static links
+@LIBGUPC_CRTSTUFF_TRUE@upc-crtbeginT.$(OBJEXT): $(upc_crtstuff_src)
+@LIBGUPC_CRTSTUFF_TRUE@ $(crt_compile) -DCRT_BEGIN $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+@LIBGUPC_CRTSTUFF_TRUE@upc-crtendT.$(OBJEXT): $(upc_crtstuff_src)
+@LIBGUPC_CRTSTUFF_TRUE@ $(crt_compile) -DCRT_END $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+all-local: $(STAMP_GENINSRC)
+
+stamp-geninsrc: libgupc.info
+ cp -p $(top_builddir)/libgupc.info $(srcdir)/libgupc.info
+ @touch $@
+
+libgupc.info: $(STAMP_BUILD_INFO)
+
+stamp-build-info: libgupc.texi
+ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -o libgupc.info $(srcdir)/libgupc.texi
+ @touch $@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libgupc/acinclude.m4 b/libgupc/acinclude.m4
new file mode 100644
index 00000000000..4c29accd518
--- /dev/null
+++ b/libgupc/acinclude.m4
@@ -0,0 +1,409 @@
+dnl Copyright (C) 1994-2016 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl
+dnl LIBGUPC_GCC_TLS_SUPPORTED
+dnl
+AC_DEFUN([LIBGUPC_GCC_TLS_SUPPORTED], [
+AC_CACHE_CHECK([whether the GCC __threads extension is supported.],
+ upc_cv_gcc_tls_supported,
+[SAVE_LIBS="$LIBS"
+LIBS="$LIBS -lpthread"
+AC_TRY_RUN(
+changequote(<<,>>)dnl
+<<#include <stdio.h>
+#include <stddef.h>
+#include <malloc.h>
+#include <errno.h>
+#include <pthread.h>
+
+#define NTHREADS 5
+
+pthread_t p[NTHREADS];
+
+pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+__thread long tlocal = 0;
+
+void *
+thread_start (void *arg)
+{
+ int id = *((int *)arg);
+ int *return_val = malloc(sizeof(int));
+ if (pthread_mutex_lock (&lock))
+ { exit (2); }
+ /* if the value is truly thread-local, this assignment
+ will yield the value 1, for each thread. If tlocal
+ is instead a process global static value then tlocal
+ will be incremented by each thread, and its final
+ value will be the number of threads. */
+ tlocal += 1;
+ if (pthread_mutex_unlock (&lock))
+ { exit (2); }
+ *return_val = tlocal;
+ return return_val;
+}
+
+int
+main()
+{
+ int i;
+ for (i = 0; i < NTHREADS; ++i)
+ {
+ int *id = (int *)malloc(sizeof(int));
+ *id = i;
+ if (pthread_create(&p[i], NULL, thread_start, id))
+ { exit (2); }
+ }
+ for (i = 0; i < NTHREADS; ++i)
+ {
+ int *rc;
+ if (pthread_join (p[i], (void **)&rc))
+ { exit (2); }
+ if (*rc != 1)
+ { exit (1); }
+ }
+ return 0;
+}
+>>,
+changequote([, ])dnl
+ [upc_cv_gcc_tls_supported="yes"],
+ [upc_cv_gcc_tls_supported="no"],
+ [upc_cv_gcc_tls_supported="no"])
+ LIBS="$SAVE_LIBS"]
+)
+dnl if test "$upc_cv_gcc_tls_supported"x = "yes"x ; then
+dnl AC_DEFINE([HAVE_GCC_TLS_SUPPORT], 1)
+dnl fi
+])
+
+dnl ----------------------------------------------------------------------
+dnl The following (to the end of file) is copied from libgomp.
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libgfortran.
+
+dnl Check whether the target supports __sync_*_compare_and_swap.
+AC_DEFUN([LIBGUPC_CHECK_SYNC_BUILTINS], [
+ AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
+ libgupc_cv_have_sync_builtins, [
+ AC_TRY_LINK([], [int foo; (void) __sync_val_compare_and_swap(&foo, 0, 1);],
+ libgupc_cv_have_sync_builtins=yes,
+ libgupc_cv_have_sync_builtins=no)])
+ if test $libgupc_cv_have_sync_builtins = yes; then
+ AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
+ [Define to 1 if the target supports __sync_*_compare_and_swap.])
+ fi])
+
+dnl Check whether the target supports hidden visibility.
+AC_DEFUN([LIBGUPC_CHECK_ATTRIBUTE_VISIBILITY], [
+ AC_CACHE_CHECK([whether the target supports hidden visibility],
+ libgupc_cv_have_attribute_visibility, [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
+ [], libgupc_cv_have_attribute_visibility=yes,
+ libgupc_cv_have_attribute_visibility=no)
+ CFLAGS="$save_CFLAGS"])
+ if test $libgupc_cv_have_attribute_visibility = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
+ [Define to 1 if the target supports __attribute__((visibility(...))).])
+ fi])
+
+dnl Check whether the target supports dllexport
+AC_DEFUN([LIBGUPC_CHECK_ATTRIBUTE_DLLEXPORT], [
+ AC_CACHE_CHECK([whether the target supports dllexport],
+ libgupc_cv_have_attribute_dllexport, [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
+ [], libgupc_cv_have_attribute_dllexport=yes,
+ libgupc_cv_have_attribute_dllexport=no)
+ CFLAGS="$save_CFLAGS"])
+ if test $libgupc_cv_have_attribute_dllexport = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
+ [Define to 1 if the target supports __attribute__((dllexport)).])
+ fi])
+
+dnl Check whether the target supports symbol aliases.
+AC_DEFUN([LIBGUPC_CHECK_ATTRIBUTE_ALIAS], [
+ AC_CACHE_CHECK([whether the target supports symbol aliases],
+ libgupc_cv_have_attribute_alias, [
+ AC_TRY_LINK([
+void foo(void) { }
+extern void bar(void) __attribute__((alias("foo")));],
+ [bar();], libgupc_cv_have_attribute_alias=yes, libgupc_cv_have_attribute_alias=no)])
+ if test $libgupc_cv_have_attribute_alias = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
+ [Define to 1 if the target supports __attribute__((alias(...))).])
+ fi])
+
+sinclude(../libtool.m4)
+dnl The lines below arrange for aclocal not to bring an installed
+dnl libtool.m4 into aclocal.m4, while still arranging for automake to
+dnl add a definition of LIBTOOL to Makefile.in.
+ifelse(,,,[AC_SUBST(LIBTOOL)
+AC_DEFUN([AM_PROG_LIBTOOL])
+AC_DEFUN([AC_LIBTOOL_DLOPEN])
+AC_DEFUN([AC_PROG_LD])
+])
+
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libstdc++-v3.
+
+dnl
+dnl LIBGUPC_ENABLE
+dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
+dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
+dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
+dnl
+dnl See docs/html/17_intro/configury.html#enable for documentation.
+dnl
+m4_define([LIBGUPC_ENABLE],[dnl
+m4_define([_g_switch],[--enable-$1])dnl
+m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
+ AC_ARG_ENABLE($1,_g_help,
+ m4_bmatch([$5],
+ [^permit ],
+ [[
+ case "$enableval" in
+ m4_bpatsubst([$5],[permit ])) ;;
+ *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
+ dnl Idea for future: generate a URL pointing to
+ dnl "onlinedocs/configopts.html#whatever"
+ esac
+ ]],
+ [^$],
+ [[
+ case "$enableval" in
+ yes|no) ;;
+ *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
+ esac
+ ]],
+ [[$5]]),
+ [enable_]m4_bpatsubst([$1],-,_)[=][$2])
+m4_undefine([_g_switch])dnl
+m4_undefine([_g_help])dnl
+])
+
+
+dnl
+dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
+dnl the native linker is in use, all variables will be defined to something
+dnl safe (like an empty string).
+dnl
+dnl Defines:
+dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
+dnl OPT_LDFLAGS='-Wl,-O1' if possible
+dnl LD (as a side effect of testing)
+dnl Sets:
+dnl with_gnu_ld
+dnl libgupc_ld_is_gold (possibly)
+dnl libgupc_gnu_ld_version (possibly)
+dnl
+dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
+dnl set libgupc_gnu_ld_version to 12345. Zeros cause problems.
+dnl
+AC_DEFUN([LIBGUPC_CHECK_LINKER_FEATURES], [
+ # If we're not using GNU ld, then there's no point in even trying these
+ # tests. Check for that first. We should have already tested for gld
+ # by now (in libtool), but require it now just to be safe...
+ test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
+ test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
+ AC_REQUIRE([AC_PROG_LD])
+ AC_REQUIRE([AC_PROG_AWK])
+
+ # The name set by libtool depends on the version of libtool. Shame on us
+ # for depending on an impl detail, but c'est la vie. Older versions used
+ # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
+ # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
+ # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
+ # set (hence we're using an older libtool), then set it.
+ if test x${with_gnu_ld+set} != xset; then
+ if test x${ac_cv_prog_gnu_ld+set} != xset; then
+ # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
+ with_gnu_ld=no
+ else
+ with_gnu_ld=$ac_cv_prog_gnu_ld
+ fi
+ fi
+
+ # Start by getting the version number. I think the libtool test already
+ # does some of this, but throws away the result.
+ libgupc_ld_is_gold=no
+ if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
+ libgupc_ld_is_gold=yes
+ fi
+ changequote(,)
+ ldver=`$LD --version 2>/dev/null |
+ sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+ changequote([,])
+ libgupc_gnu_ld_version=`echo $ldver | \
+ $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
+
+ # Set --gc-sections.
+ if test "$with_gnu_ld" = "notbroken"; then
+ # GNU ld it is! Joy and bunny rabbits!
+
+ # All these tests are for C++; save the language and the compiler flags.
+ # Need to do this so that g++ won't try to link in libstdc++
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS='-x c++ -Wl,--gc-sections'
+
+ # Check for -Wl,--gc-sections
+ # XXX This test is broken at the moment, as symbols required for linking
+ # are now in libsupc++ (not built yet). In addition, this test has
+ # cored on solaris in the past. In addition, --gc-sections doesn't
+ # really work at the moment (keeps on discarding used sections, first
+ # .eh_frame and now some of the glibc sections for iconv).
+ # Bzzzzt. Thanks for playing, maybe next time.
+ AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
+ AC_TRY_RUN([
+ int main(void)
+ {
+ try { throw 1; }
+ catch (...) { };
+ return 0;
+ }
+ ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ else
+ # this is the suspicious part
+ CFLAGS=''
+ fi
+ if test "$ac_sectionLDflags" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+ AC_MSG_RESULT($ac_sectionLDflags)
+ fi
+
+ # Set linker optimization flags.
+ if test x"$with_gnu_ld" = x"yes"; then
+ OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
+ fi
+
+ AC_SUBST(SECTION_LDFLAGS)
+ AC_SUBST(OPT_LDFLAGS)
+])
+
+
+dnl
+dnl Add version tags to symbols in shared library (or not), additionally
+dnl marking other symbols as private/local (or not).
+dnl
+dnl --enable-symvers=style adds a version script to the linker call when
+dnl creating the shared library. The choice of version script is
+dnl controlled by 'style'.
+dnl --disable-symvers does not.
+dnl + Usage: LIBGUPC_ENABLE_SYMVERS[(DEFAULT)]
+dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to
+dnl choose a default style based on linker characteristics. Passing
+dnl 'no' disables versioning.
+dnl
+AC_DEFUN([LIBGUPC_ENABLE_SYMVERS], [
+
+LIBGUPC_ENABLE(symvers,yes,[=STYLE],
+ [enables symbol versioning of the shared library],
+ [permit yes|no|gnu])
+
+# If we never went through the LIBGUPC_CHECK_LINKER_FEATURES macro, then we
+# don't know enough about $LD to do tricks...
+AC_REQUIRE([LIBGUPC_CHECK_LINKER_FEATURES])
+# FIXME The following test is too strict, in theory.
+if test $enable_shared = no ||
+ test "x$LD" = x ||
+ test x$libgupc_gnu_ld_version = x; then
+ enable_symvers=no
+fi
+
+# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
+if test $enable_symvers != no; then
+ AC_MSG_CHECKING([for shared libgcc])
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=' -lgcc_s'
+ AC_TRY_LINK(, [return 0;], libgupc_shared_libgcc=yes, libgupc_shared_libgcc=no)
+ CFLAGS="$ac_save_CFLAGS"
+ if test $libgupc_shared_libgcc = no; then
+ cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+changequote(,)dnl
+ libgupc_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+ -shared -shared-libgcc -o conftest.so \
+ conftest.c -v 2>&1 >/dev/null \
+ | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
+changequote([,])dnl
+ rm -f conftest.c conftest.so
+ if test x${libgupc_libgcc_s_suffix+set} = xset; then
+ CFLAGS=" -lgcc_s$libgupc_libgcc_s_suffix"
+ AC_TRY_LINK(, [return 0;], libgupc_shared_libgcc=yes)
+ CFLAGS="$ac_save_CFLAGS"
+ fi
+ fi
+ AC_MSG_RESULT($libgupc_shared_libgcc)
+fi
+
+# For GNU ld, we need at least this version. The format is described in
+# LIBGUPC_CHECK_LINKER_FEATURES above.
+libgupc_min_gnu_ld_version=21400
+# XXXXXXXXXXX libgupc_gnu_ld_version=21390
+
+# Check to see if unspecified "yes" value can win, given results above.
+# Change "yes" into either "no" or a style name.
+if test $enable_symvers = yes; then
+ if test $with_gnu_ld = yes &&
+ test $libgupc_shared_libgcc = yes;
+ then
+ if test $libgupc_gnu_ld_version -ge $libgupc_min_gnu_ld_version ; then
+ enable_symvers=gnu
+ elif test $libgupc_ld_is_gold = yes ; then
+ enable_symvers=gnu
+ else
+ # The right tools, the right setup, but too old. Fallbacks?
+ AC_MSG_WARN(=== Linker version $libgupc_gnu_ld_version is too old for)
+ AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
+ AC_MSG_WARN(=== You would need to upgrade your binutils to version)
+ AC_MSG_WARN(=== $libgupc_min_gnu_ld_version or later and rebuild GCC.)
+ if test $libgupc_gnu_ld_version -ge 21200 ; then
+ # Globbing fix is present, proper block support is not.
+ dnl AC_MSG_WARN([=== Dude, you are soooo close. Maybe we can fake it.])
+ dnl enable_symvers=???
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ else
+ # 2.11 or older.
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ fi
+ fi
+ else
+ # just fail for now
+ AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
+ AC_MSG_WARN([=== either you are not using a supported linker, or you are])
+ AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ fi
+fi
+
+AC_CACHE_CHECK([whether the target supports .symver directive],
+ libgupc_cv_have_as_symver_directive, [
+ AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");],
+ [], libgupc_cv_have_as_symver_directive=yes,
+ libgupc_cv_have_as_symver_directive=no)])
+if test $libgupc_cv_have_as_symver_directive = yes; then
+ AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
+ [Define to 1 if the target assembler supports .symver directive.])
+fi
+
+AM_CONDITIONAL(LIBGUPC_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
+AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
+])
diff --git a/libgupc/aclocal.m4 b/libgupc/aclocal.m4
new file mode 100644
index 00000000000..cfd193be334
--- /dev/null
+++ b/libgupc/aclocal.m4
@@ -0,0 +1,1028 @@
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
+[m4_warning([this file was generated for autoconf 2.64.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.11'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.11.6], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], UPC, [depcc="$UPC" am_compiler_list=],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 5
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 16
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES(OBJC)],
+ [define([AC_PROG_OBJC],
+ defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST(install_sh)])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
+# 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well. Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+ [enable], [m4_define([am_maintainer_other], [disable])],
+ [disable], [m4_define([am_maintainer_other], [enable])],
+ [m4_define([am_maintainer_other], [enable])
+ m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+ AC_ARG_ENABLE([maintainer-mode],
+[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+ [[\\/$]]* | ?:[[\\/]]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+# Find a compiler for Unified Parallel C. -*- Autoconf -*-
+
+# Copyright (C) 2006, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+AC_DEFUN([AM_PROG_UPC],
+[dnl We need OBJEXT and EXEEXT, but Autoconf doesn't offer any public
+dnl macro to compute them. Use AC_PROG_CC instead.
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_ARG_VAR([UPC], [Unified Parallel C compiler command])dnl
+AC_ARG_VAR([UPCFLAGS], [Unified Parallel C compiler flags])dnl
+AC_CHECK_TOOLS([UPC], [m4_default([$1], [upcc upc])], [:])
+if test "$UPC" = :; then
+ AC_MSG_ERROR([no Unified Parallel C compiler was found], [77])
+fi
+_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([UPC])])dnl
+])
+
+m4_include([../config/acx.m4])
+m4_include([../config/depstand.m4])
+m4_include([../config/enable.m4])
+m4_include([../config/futex.m4])
+m4_include([../config/lead-dot.m4])
+m4_include([../config/multi.m4])
+m4_include([../config/override.m4])
+m4_include([../config/stdint.m4])
+m4_include([../config/tls.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
+m4_include([ax_prog_doxygen.m4])
+m4_include([acinclude.m4])
diff --git a/libgupc/ax_prog_doxygen.m4 b/libgupc/ax_prog_doxygen.m4
new file mode 100644
index 00000000000..36636c6fa30
--- /dev/null
+++ b/libgupc/ax_prog_doxygen.m4
@@ -0,0 +1,583 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# DX_INIT_DOXYGEN(PROJECT-NAME, DOXYFILE-PATH, [OUTPUT-DIR])
+# DX_DOXYGEN_FEATURE(ON|OFF)
+# DX_DOT_FEATURE(ON|OFF)
+# DX_HTML_FEATURE(ON|OFF)
+# DX_CHM_FEATURE(ON|OFF)
+# DX_CHI_FEATURE(ON|OFF)
+# DX_MAN_FEATURE(ON|OFF)
+# DX_RTF_FEATURE(ON|OFF)
+# DX_XML_FEATURE(ON|OFF)
+# DX_PDF_FEATURE(ON|OFF)
+# DX_PS_FEATURE(ON|OFF)
+#
+# DESCRIPTION
+#
+# The DX_*_FEATURE macros control the default setting for the given
+# Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for
+# generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML
+# help (for MS users), 'CHI' for generating a separate .chi file by the
+# .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate
+# output formats. The environment variable DOXYGEN_PAPER_SIZE may be
+# specified to override the default 'a4wide' paper size.
+#
+# By default, HTML, PDF and PS documentation is generated as this seems to
+# be the most popular and portable combination. MAN pages created by
+# Doxygen are usually problematic, though by picking an appropriate subset
+# and doing some massaging they might be better than nothing. CHM and RTF
+# are specific for MS (note that you can't generate both HTML and CHM at
+# the same time). The XML is rather useless unless you apply specialized
+# post-processing to it.
+#
+# The macros mainly control the default state of the feature. The use can
+# override the default by specifying --enable or --disable. The macros
+# ensure that contradictory flags are not given (e.g.,
+# --enable-doxygen-html and --enable-doxygen-chm,
+# --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each
+# feature will be automatically disabled (with a warning) if the required
+# programs are missing.
+#
+# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN
+# with the following parameters: a one-word name for the project for use
+# as a filename base etc., an optional configuration file name (the
+# default is 'Doxyfile', the same as Doxygen's default), and an optional
+# output directory name (the default is 'doxygen-doc').
+#
+# Automake Support
+#
+# The following is a template aminclude.am file for use with Automake.
+# Make targets and variables values are controlled by the various
+# DX_COND_* conditionals set by autoconf.
+#
+# The provided targets are:
+#
+# doxygen-doc: Generate all doxygen documentation.
+#
+# doxygen-run: Run doxygen, which will generate some of the
+# documentation (HTML, CHM, CHI, MAN, RTF, XML)
+# but will not do the post processing required
+# for the rest of it (PS, PDF, and some MAN).
+#
+# doxygen-man: Rename some doxygen generated man pages.
+#
+# doxygen-ps: Generate doxygen PostScript documentation.
+#
+# doxygen-pdf: Generate doxygen PDF documentation.
+#
+# Note that by default these are not integrated into the automake targets.
+# If doxygen is used to generate man pages, you can achieve this
+# integration by setting man3_MANS to the list of man pages generated and
+# then adding the dependency:
+#
+# $(man3_MANS): doxygen-doc
+#
+# This will cause make to run doxygen and generate all the documentation.
+#
+# The following variable is intended for use in Makefile.am:
+#
+# DX_CLEANFILES = everything to clean.
+#
+# Then add this variable to MOSTLYCLEANFILES.
+#
+# ----- begin aminclude.am -------------------------------------
+#
+# ## --------------------------------- ##
+# ## Format-independent Doxygen rules. ##
+# ## --------------------------------- ##
+#
+# if DX_COND_doc
+#
+# ## ------------------------------- ##
+# ## Rules specific for HTML output. ##
+# ## ------------------------------- ##
+#
+# if DX_COND_html
+#
+# DX_CLEAN_HTML = @DX_DOCDIR@/html
+#
+# endif DX_COND_html
+#
+# ## ------------------------------ ##
+# ## Rules specific for CHM output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_chm
+#
+# DX_CLEAN_CHM = @DX_DOCDIR@/chm
+#
+# if DX_COND_chi
+#
+# DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
+#
+# endif DX_COND_chi
+#
+# endif DX_COND_chm
+#
+# ## ------------------------------ ##
+# ## Rules specific for MAN output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_man
+#
+# DX_CLEAN_MAN = @DX_DOCDIR@/man
+#
+# endif DX_COND_man
+#
+# ## ------------------------------ ##
+# ## Rules specific for RTF output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_rtf
+#
+# DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+#
+# endif DX_COND_rtf
+#
+# ## ------------------------------ ##
+# ## Rules specific for XML output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_xml
+#
+# DX_CLEAN_XML = @DX_DOCDIR@/xml
+#
+# endif DX_COND_xml
+#
+# ## ----------------------------- ##
+# ## Rules specific for PS output. ##
+# ## ----------------------------- ##
+#
+# if DX_COND_ps
+#
+# DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
+#
+# DX_PS_GOAL = doxygen-ps
+#
+# doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
+#
+# @DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
+# cd @DX_DOCDIR@/latex; \
+# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+# $(DX_LATEX) refman.tex; \
+# $(MAKEINDEX_PATH) refman.idx; \
+# $(DX_LATEX) refman.tex; \
+# countdown=5; \
+# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+# refman.log > /dev/null 2>&1 \
+# && test $$countdown -gt 0; do \
+# $(DX_LATEX) refman.tex; \
+# countdown=`expr $$countdown - 1`; \
+# done; \
+# $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
+#
+# endif DX_COND_ps
+#
+# ## ------------------------------ ##
+# ## Rules specific for PDF output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_pdf
+#
+# DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
+#
+# DX_PDF_GOAL = doxygen-pdf
+#
+# doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
+#
+# @DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
+# cd @DX_DOCDIR@/latex; \
+# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+# $(DX_PDFLATEX) refman.tex; \
+# $(DX_MAKEINDEX) refman.idx; \
+# $(DX_PDFLATEX) refman.tex; \
+# countdown=5; \
+# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+# refman.log > /dev/null 2>&1 \
+# && test $$countdown -gt 0; do \
+# $(DX_PDFLATEX) refman.tex; \
+# countdown=`expr $$countdown - 1`; \
+# done; \
+# mv refman.pdf ../@PACKAGE@.pdf
+#
+# endif DX_COND_pdf
+#
+# ## ------------------------------------------------- ##
+# ## Rules specific for LaTeX (shared for PS and PDF). ##
+# ## ------------------------------------------------- ##
+#
+# if DX_COND_latex
+#
+# DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+#
+# endif DX_COND_latex
+#
+# .PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+# .INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+# doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
+#
+# doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+# @DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
+# rm -rf @DX_DOCDIR@
+# $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
+#
+# DX_CLEANFILES = \
+# @DX_DOCDIR@/@PACKAGE@.tag \
+# -r \
+# $(DX_CLEAN_HTML) \
+# $(DX_CLEAN_CHM) \
+# $(DX_CLEAN_CHI) \
+# $(DX_CLEAN_MAN) \
+# $(DX_CLEAN_RTF) \
+# $(DX_CLEAN_XML) \
+# $(DX_CLEAN_PS) \
+# $(DX_CLEAN_PDF) \
+# $(DX_CLEAN_LATEX)
+#
+# endif DX_COND_doc
+#
+# ----- end aminclude.am ---------------------------------------
+#
+# LICENSE
+#
+# Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 11
+
+## ----------##
+## Defaults. ##
+## ----------##
+
+DX_ENV=""
+AC_DEFUN([DX_FEATURE_doc], ON)
+AC_DEFUN([DX_FEATURE_dot], OFF)
+AC_DEFUN([DX_FEATURE_man], OFF)
+AC_DEFUN([DX_FEATURE_html], ON)
+AC_DEFUN([DX_FEATURE_chm], OFF)
+AC_DEFUN([DX_FEATURE_chi], OFF)
+AC_DEFUN([DX_FEATURE_rtf], OFF)
+AC_DEFUN([DX_FEATURE_xml], OFF)
+AC_DEFUN([DX_FEATURE_pdf], ON)
+AC_DEFUN([DX_FEATURE_ps], ON)
+
+## --------------- ##
+## Private macros. ##
+## --------------- ##
+
+# DX_ENV_APPEND(VARIABLE, VALUE)
+# ------------------------------
+# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
+AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
+
+# DX_DIRNAME_EXPR
+# ---------------
+# Expand into a shell expression prints the directory part of a path.
+AC_DEFUN([DX_DIRNAME_EXPR],
+ [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
+
+# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
+# -------------------------------------
+# Expands according to the M4 (static) status of the feature.
+AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
+
+# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
+# ----------------------------------
+# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
+AC_DEFUN([DX_REQUIRE_PROG], [
+AC_PATH_TOOL([$1], [$2])
+if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
+ AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
+ AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
+fi
+])
+
+# DX_TEST_FEATURE(FEATURE)
+# ------------------------
+# Expand to a shell expression testing whether the feature is active.
+AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
+
+# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
+# -------------------------------------------------
+# Verify that a required features has the right state before trying to turn on
+# the DX_CURRENT_FEATURE.
+AC_DEFUN([DX_CHECK_DEPEND], [
+test "$DX_FLAG_$1" = "$2" \
+|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
+ requires, contradicts) doxygen-DX_CURRENT_FEATURE])
+])
+
+# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
+# ----------------------------------------------------------
+# Turn off the DX_CURRENT_FEATURE if the required feature is off.
+AC_DEFUN([DX_CLEAR_DEPEND], [
+test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
+])
+
+# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
+# CHECK_DEPEND, CLEAR_DEPEND,
+# REQUIRE, DO-IF-ON, DO-IF-OFF)
+# --------------------------------------------
+# Parse the command-line option controlling a feature. CHECK_DEPEND is called
+# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
+# otherwise CLEAR_DEPEND is called to turn off the default state if a required
+# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
+# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
+# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
+AC_DEFUN([DX_ARG_ABLE], [
+ AC_DEFUN([DX_CURRENT_FEATURE], [$1])
+ AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
+ AC_ARG_ENABLE(doxygen-$1,
+ [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
+ [--enable-doxygen-$1]),
+ DX_IF_FEATURE([$1], [don't $2], [$2]))],
+ [
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ AC_SUBST([DX_FLAG_$1], 1)
+ $3
+;; #(
+n|N|no|No|NO)
+ AC_SUBST([DX_FLAG_$1], 0)
+;; #(
+*)
+ AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
+;;
+esac
+], [
+AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
+$4
+])
+if DX_TEST_FEATURE([$1]); then
+ $5
+ :
+fi
+if DX_TEST_FEATURE([$1]); then
+ AM_CONDITIONAL(DX_COND_$1, :)
+ $6
+ :
+else
+ AM_CONDITIONAL(DX_COND_$1, false)
+ $7
+ :
+fi
+])
+
+## -------------- ##
+## Public macros. ##
+## -------------- ##
+
+# DX_XXX_FEATURE(DEFAULT_STATE)
+# -----------------------------
+AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])])
+AC_DEFUN([DX_DOT_FEATURE], [AC_DEFUN([DX_FEATURE_dot], [$1])])
+AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
+AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
+AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
+AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
+AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
+AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
+AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
+AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
+AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
+
+# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
+# ---------------------------------------------------------
+# PROJECT also serves as the base name for the documentation files.
+# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
+AC_DEFUN([DX_INIT_DOXYGEN], [
+
+#Variables:
+AC_SUBST([DX_PROJECT], [$1])
+
+# Files:
+AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
+AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
+
+# Environment variables used inside doxygen.cfg:
+DX_ENV_APPEND(SRCDIR, $srcdir)
+DX_ENV_APPEND(PROJECT, $DX_PROJECT)
+DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
+DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
+
+# Doxygen itself:
+DX_ARG_ABLE(doc, [generate any doxygen documentation],
+ [],
+ [],
+ [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
+ DX_REQUIRE_PROG([DX_PERL], perl)
+ DX_REQUIRE_PROG([DX_FILE], file)],
+ [DX_ENV_APPEND(PERL_PATH, $DX_PERL)
+ AC_SUBST(DOXYGEN_VERSION, [`${DX_DOXYGEN} --version`])],
+ [AC_SUBST(DOXYGEN_VERSION)])
+
+# Dot for graphics:
+DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [DX_REQUIRE_PROG([DX_DOT], dot)],
+ [DX_ENV_APPEND(HAVE_DOT, YES)
+ AC_SUBST(HAVE_DOT, YES)
+ DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
+ [AC_SUBST(HAVE_DOT, NO)
+ DX_ENV_APPEND(HAVE_DOT, NO)])
+
+# Man pages generation:
+DX_ARG_ABLE(man, [generate doxygen manual pages],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [],
+ [DX_ENV_APPEND(GENERATE_MAN, YES)],
+ [DX_ENV_APPEND(GENERATE_MAN, NO)])
+
+# RTF file generation:
+DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [],
+ [DX_ENV_APPEND(GENERATE_RTF, YES)],
+ [DX_ENV_APPEND(GENERATE_RTF, NO)])
+
+# XML file generation:
+DX_ARG_ABLE(xml, [generate doxygen XML documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [],
+ [DX_ENV_APPEND(GENERATE_XML, YES)],
+ [DX_ENV_APPEND(GENERATE_XML, NO)])
+
+# (Compressed) HTML help generation:
+DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [DX_REQUIRE_PROG([DX_HHC], hhc)],
+ [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
+ DX_ENV_APPEND(GENERATE_HTML, YES)
+ DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
+ [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
+
+# Seperate CHI file generation.
+DX_ARG_ABLE(chi, [generate doxygen separate compressed HTML help index file],
+ [DX_CHECK_DEPEND(chm, 1)],
+ [DX_CLEAR_DEPEND(chm, 1)],
+ [],
+ [DX_ENV_APPEND(GENERATE_CHI, YES)],
+ [DX_ENV_APPEND(GENERATE_CHI, NO)])
+
+# Plain HTML pages generation:
+DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
+ [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
+ [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
+ [],
+ [DX_ENV_APPEND(GENERATE_HTML, YES)],
+ [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
+
+# PostScript file generation:
+DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [DX_REQUIRE_PROG([DX_LATEX], latex)
+ DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
+ DX_REQUIRE_PROG([DX_DVIPS], dvips)
+ DX_REQUIRE_PROG([DX_EGREP], egrep)])
+
+# PDF file generation:
+DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
+ DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
+ DX_REQUIRE_PROG([DX_EGREP], egrep)])
+
+# LaTeX generation for PS and/or PDF:
+if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
+ AM_CONDITIONAL(DX_COND_latex, :)
+ DX_ENV_APPEND(GENERATE_LATEX, YES)
+else
+ AM_CONDITIONAL(DX_COND_latex, false)
+ DX_ENV_APPEND(GENERATE_LATEX, NO)
+fi
+
+# Paper size for PS and/or PDF:
+AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
+ [letter (default), a4, a4wide, legal or executive])
+case "$DOXYGEN_PAPER_SIZE" in
+#(
+"")
+ DOXYGEN_PAPER_SIZE="letter"
+;; #(
+a4wide|a4|letter|legal|executive)
+ DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
+;; #(
+*)
+ AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
+ DOXYGEN_PAPER_SIZE="letter"
+;;
+esac
+DX_ENV_APPEND(PAPER_SIZE, "$DOXYGEN_PAPER_SIZE")
+
+AC_ARG_VAR(DOXYGEN_HTML_LOGO,
+ [Location of small logo graphic (for HTML)])
+if test -n "$DOXYGEN_HTML_LOGO"; then
+ if ! test -f "$DOXYGEN_HTML_LOGO"; then
+ AC_MSG_ERROR([not a file: "$DOXYGEN_HTML_LOGO"])
+ fi
+fi
+
+AC_ARG_VAR(DOXYGEN_LOGO,
+ [Location of larger logo graphic (for PDF)])
+if test -n "$DOXYGEN_LOGO"; then
+ if ! test -f "$DOXYGEN_LOGO"; then
+ AC_MSG_ERROR([not a file: "$DOXYGEN_LOGO"])
+ fi
+fi
+
+AC_ARG_VAR(DOXYGEN_TITLE,
+ [Doxygen document title])
+if test -z "$DOXYGEN_TITLE"; then
+ DOXYGEN_TITLE="${PACKAGE_NAME}"
+fi
+
+AC_ARG_VAR(DOXYGEN_AUTHOR,
+ [Doxygen document author])
+if test -z "$DOXYGEN_AUTHOR"; then
+ DOXYGEN_AUTHOR="Generated by doxygen ${DOXYGEN_VERSION}"
+fi
+
+AC_ARG_VAR(DOXYGEN_DATETIME,
+ [Doxygen date and time value])
+if test -z "$DOXYGEN_DATETIME"; then
+ DOXYGEN_DATETIME=`date +'%D %T'`
+fi
+
+AC_ARG_VAR(DOXYGEN_DATE,
+ [Doxygen date value])
+if test -z "$DOXYGEN_DATE"; then
+ DOXYGEN_DATE=`date +%D`
+fi
+
+#For debugging:
+#echo DX_FLAG_doc=$DX_FLAG_doc
+#echo DX_FLAG_dot=$DX_FLAG_dot
+#echo DX_FLAG_man=$DX_FLAG_man
+#echo DX_FLAG_html=$DX_FLAG_html
+#echo DX_FLAG_chm=$DX_FLAG_chm
+#echo DX_FLAG_chi=$DX_FLAG_chi
+#echo DX_FLAG_rtf=$DX_FLAG_rtf
+#echo DX_FLAG_xml=$DX_FLAG_xml
+#echo DX_FLAG_pdf=$DX_FLAG_pdf
+#echo DX_FLAG_ps=$DX_FLAG_ps
+#echo DX_ENV=$DX_ENV
+])
diff --git a/libgupc/collectives/gen-upc-coll-reduce.pl b/libgupc/collectives/gen-upc-coll-reduce.pl
new file mode 100644
index 00000000000..ce215022d22
--- /dev/null
+++ b/libgupc/collectives/gen-upc-coll-reduce.pl
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+#
+# usage:
+#
+# $PERL gen-upc-coll-reduce.pl upc_coll_all_reduce.in >
+# upc_coll_all_reduce.upc
+#
+# $PERL gen-upc-coll-reduce.pl upc_coll_all_prefix_reduce.in >
+# upc_coll_all_prefix_reduce.upc
+#
+# This script reads 'upc_coll_reduce.in' as a template file,
+# and generates a new source file, upc_coll_reduce.upc,
+# which customizes the "upc_all_reduce_GENERIC" for each
+# data type that the procedure operates on. The following
+# steps are performed:
+# 1. GENERIC is replaced with a one/two character type suffix
+# where the suffix encodes the type that the procedure
+# operates on.
+# 2. _UPC_RED_T is replaced with the full C type name
+# of the type that the procedure operates on.
+# 3. For floating point types, the code between
+# "#ifndef _UPC_NONINT_T" and "#endif" is removed.
+# 4. _UPC_TO_PTL_TYPECVT is replaced with a proper define
+# to convert UPC to PTL data types.
+#
+use strict;
+use warnings;
+my @type_config = (
+ ['signed char', 'C', 1, "UPC_COLL_TO_PTL_CHAR"],
+ ['unsigned char', 'UC', 1, "UPC_COLL_TO_PTL_UCHAR"],
+ ['signed short', 'S', 1, "UPC_COLL_TO_PTL_SHORT"],
+ ['unsigned short', 'US', 1, "UPC_COLL_TO_PTL_USHORT"],
+ ['signed int', 'I', 1, "UPC_COLL_TO_PTL_INT"],
+ ['unsigned int', 'UI', 1, "UPC_COLL_TO_PTL_UINT"],
+ ['signed long', 'L', 1, "UPC_COLL_TO_PTL_LONG"],
+ ['unsigned long', 'UL', 1, "UPC_COLL_TO_PTL_ULONG"],
+ ['float', 'F', 0, "UPC_COLL_TO_PTL_FLOAT"],
+ ['double', 'D', 0, "UPC_COLL_TO_PTL_DOUBLE"],
+ ['long double', 'LD', 0, "UPC_COLL_TO_PTL_LONG_DOUBLE"]
+ );
+my $src;
+{
+ local $/ = undef;
+ $src = <>;
+}
+my ($hdr,$body) =
+ ($src =~ /(.*)PREPROCESS_BEGIN(.*)/ms);
+print $hdr;
+for my $t (@type_config) {
+ my ($name, $chars, $is_int, $data_type) = @$t;
+ my $out = $body;
+ for ($out) {
+ s/_GENERIC/$chars/smg;
+ s/_UPC_RED_T/$name/smg;
+ s/_UPC_TO_PTL_TYPECVT/$data_type/smg;
+ if ($is_int)
+ {
+ s/^#ifndef\s+_UPC_NONINT_T.*?\n(.*?)^#endif.*?\n/$1/smg;
+ s/^#ifdef\s+_UPC_NONINT_T.*?\n(.*?)^#endif.*?\n//smg;
+ }
+ else
+ {
+ s/^#ifndef\s+_UPC_NONINT_T.*?\n.*?^#endif.*?\n//smg;
+ s/^#ifdef\s+_UPC_NONINT_T.*?\n(.*?)^#endif.*?\n/$1/smg;
+ }
+ }
+ print $out;
+}
diff --git a/libgupc/collectives/upc_coll.h b/libgupc/collectives/upc_coll.h
new file mode 100644
index 00000000000..387951be89b
--- /dev/null
+++ b/libgupc/collectives/upc_coll.h
@@ -0,0 +1,67 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#ifndef _UPC_COLL_H_
+#define _UPC_COLL_H_ 1
+
+extern int upc_coll_init_flag;
+extern void upc_coll_init (void);
+
+#endif /* !_UPC_COLL_H_ */
diff --git a/libgupc/collectives/upc_coll_broadcast.upc b/libgupc/collectives/upc_coll_broadcast.upc
new file mode 100644
index 00000000000..481b2612f94
--- /dev/null
+++ b/libgupc/collectives/upc_coll_broadcast.upc
@@ -0,0 +1,128 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+void
+upc_all_broadcast (shared void *dst,
+ shared const void *src,
+ size_t nbytes, upc_flag_t sync_mode)
+{
+
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+#ifdef PUSH
+ int i;
+#endif
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, nbytes, sync_mode, 0, 0, 0, UPC_BRDCST);
+#endif
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+#ifdef PULL
+
+ // Each thread "pulls" the data from the source thread.
+
+ upc_memcpy ((shared char *) dst + MYTHREAD, (shared char *) src, nbytes);
+
+#endif
+
+#ifdef PUSH
+
+ // The source thread "pushes" the data to each destination.
+
+ if (upc_threadof ((shared void *) src) == MYTHREAD)
+ {
+ for (i = 0; i < THREADS; ++i)
+ {
+ upc_memcpy ((shared char *) dst + i, (shared char *) src, nbytes);
+ }
+ }
+
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
diff --git a/libgupc/collectives/upc_coll_err.upc b/libgupc/collectives/upc_coll_err.upc
new file mode 100644
index 00000000000..c4fc1877f19
--- /dev/null
+++ b/libgupc/collectives/upc_coll_err.upc
@@ -0,0 +1,493 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+/*
+ upc_coll_err.c is included if _UPC_COLL_CHECK_ARGS is defined.
+ This code checks for the single-valuedness of collective function
+ arguments as well as checking that all threads have called the
+ same function. Range checking of size_t arguments is done, and
+ the perm array is checked to be a true permutation of 0..THREADS-1.
+ However, (prefix) reduce functions of different types cannot be
+ distinguished. Overlapping src and dst arguments are not detected.
+
+ When each thread reaches its collective call it fills in
+ corresponding entries of the coll_arg_list defined below.
+ This list has affinity to thread 0. After a barrier,
+ thread 0 does all the argument checking locally on this
+ list. If no errors are found, all threads are released to
+ continue execution after a final barrier.
+*/
+
+#include <stdio.h>
+
+typedef struct
+{
+ shared void *dst;
+ shared const void *src;
+ shared const int *perm;
+ size_t nbytes;
+ upc_flag_t sync_mode;
+ size_t blk_size;
+ size_t nelems;
+ upc_op_t op;
+ upc_flag_t upc_coll_op;
+} coll_arg_list_type;
+
+shared coll_arg_list_type *coll_arg_list;
+
+static const char *
+upc_coll_op_name (upc_flag_t upc_coll_op)
+{
+ switch (upc_coll_op)
+ {
+ case UPC_BRDCST:
+ return "upc_all_broadcast";
+ break;
+ case UPC_SCAT:
+ return "upc_all_scatter";
+ break;
+ case UPC_GATH:
+ return "upc_all_gather";
+ break;
+ case UPC_GATH_ALL:
+ return "upc_all_gather_all";
+ break;
+ case UPC_EXCH:
+ return "upc_all_exchange";
+ break;
+ case UPC_PERM:
+ return "upc_all_permute";
+ break;
+ case UPC_RED:
+ return "upc_all_reduce";
+ break;
+ case UPC_PRED:
+ return "upc_all_prefix_reduce";
+ break;
+ case UPC_SORT:
+ return "upc_all_sort";
+ break;
+ }
+ return NULL;
+}
+
+static void
+upc_coll_chk_nbytes (void)
+{
+ int i;
+
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].nbytes != coll_arg_list[i].nbytes)
+ {
+ printf ("%s: nbytes must have the same value in corresponding"
+ " calls to collective function\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+
+ if (coll_arg_list[0].nbytes < 1)
+ {
+ printf ("%s: nbytes must be greater than 0\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+}
+
+static void
+upc_coll_chk_blk_size (void)
+{
+ int i;
+
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].blk_size != coll_arg_list[i].blk_size)
+ {
+ printf ("%s: blk_size must have the same value in corresponding"
+ " calls to collective function\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+ // Note: blk_size is an unsigned int so we do not check whether
+ // it might be negative.
+}
+
+static void
+upc_coll_chk_nelems (void)
+{
+ int i;
+
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].nelems != coll_arg_list[i].nelems)
+ {
+ printf ("%s: nelems must have the same value in corresponding"
+ " calls to collective function\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+
+ if (coll_arg_list[0].nelems < 1)
+ {
+ printf ("%s: nelems must be greater than 0\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+}
+
+static void
+upc_coll_chk_elemsize (void)
+{
+ int i;
+
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].nbytes != coll_arg_list[i].nbytes)
+ {
+ printf ("%s: elem_size must have the same value in corresponding"
+ " calls to collective function\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+
+ if (coll_arg_list[0].nbytes < 1)
+ {
+ printf ("%s: elem_size must be greater than 0\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+}
+
+static void
+upc_coll_chk_dst_affinity (void)
+{
+ int i;
+
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].dst != coll_arg_list[i].dst)
+ {
+ printf ("%s: dst must have the same value in corresponding"
+ " calls to collective function\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+
+ if (upc_threadof (coll_arg_list[0].dst) != 0)
+ {
+ printf ("%s: Target of dst pointer must have affinity to thread 0\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+}
+
+static void
+upc_coll_chk_src_affinity (void)
+{
+ int i;
+
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].src != coll_arg_list[i].src)
+ {
+ printf ("%s: src must have the same value in corresponding"
+ " calls to collective function\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+
+ if (upc_threadof ((shared void *) coll_arg_list[0].src) != 0)
+ {
+ printf ("%s: Target of src pointer must have affinity to thread 0\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+}
+
+static void
+upc_coll_chk_phase (void)
+{
+ if (upc_phaseof ((shared void *) coll_arg_list[0].src)
+ != upc_phaseof ((shared void *) coll_arg_list[0].dst))
+ {
+ printf
+ ("%s: Implementation limitation - src and dst must have the same phase.\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+}
+
+static void
+upc_coll_chk_perm (void)
+{
+ int i, j;
+
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].perm != coll_arg_list[i].perm)
+ {
+ printf ("%s: perm must have the same value in corresponding"
+ " calls to collective function\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+
+ if (upc_threadof ((shared void *) coll_arg_list[0].perm) != 0)
+ {
+ printf ("%s: Target of perm pointer must have affinity to thread 0\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+
+ // Check that perm[0..THREADS-1] contains a permutation of 0..THREADS-1.
+
+ for (i = 0; i < THREADS; i++)
+ {
+ for (j = 0; j < THREADS; j++)
+ if (i == (coll_arg_list[0].perm)[j])
+ break;
+ if (j == THREADS)
+ {
+ printf ("%s: Permutation array must contain a"
+ " permutation of 0..THREADS-1. \n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+ }
+}
+
+static void
+upc_coll_chk_op (void)
+{
+ int i;
+
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].op != coll_arg_list[i].op)
+ {
+ printf ("%s: op must have the same value in corresponding"
+ " calls to collective function\n",
+ upc_coll_op_name (coll_arg_list[0].upc_coll_op));
+ upc_global_exit (1);
+ }
+
+ for (i = 0; i < THREADS; ++i)
+ if (coll_arg_list[i].op > UPC_MAX_COLL_OP)
+ {
+ printf ("%s: Illegal operation specified in thread %d.\n",
+ upc_coll_op_name (coll_arg_list[i].upc_coll_op), i);
+ upc_global_exit (1);
+ }
+}
+
+static void
+upc_coll_chk_sync_mode (void)
+{
+ int i;
+
+ // Check for nonsensical combinations of synchronization modes
+ // and for meaningless values of sync_mode.
+
+ for (i = 0; i < THREADS; ++i)
+ {
+ upc_flag_t in_mode = coll_arg_list[i].sync_mode &
+ (UPC_IN_NOSYNC | UPC_IN_MYSYNC | UPC_IN_ALLSYNC);
+ upc_flag_t out_mode = coll_arg_list[i].sync_mode &
+ (UPC_OUT_NOSYNC | UPC_OUT_MYSYNC | UPC_OUT_ALLSYNC);
+ if (((in_mode != 0) && (in_mode != UPC_IN_ALLSYNC) &&
+ (in_mode != UPC_IN_MYSYNC) && (in_mode != UPC_IN_NOSYNC)) ||
+ ((out_mode != 0) && (out_mode != UPC_OUT_ALLSYNC) &&
+ (out_mode != UPC_OUT_MYSYNC) && (out_mode != UPC_OUT_NOSYNC)) ||
+ ((in_mode | out_mode) != coll_arg_list[i].sync_mode))
+
+ {
+ printf ("%s: Conflicting or unknown collective synchronization"
+ " modes in thread %d. \n",
+ upc_coll_op_name (coll_arg_list[i].upc_coll_op), i);
+ upc_global_exit (1);
+ }
+ }
+ // Check for conflicting synchronization modes.
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].sync_mode != coll_arg_list[i].sync_mode)
+ {
+ printf ("%s: Threads 0 and %d have two different synchronization"
+ " modes\n", upc_coll_op_name (coll_arg_list[i].upc_coll_op), i);
+ upc_global_exit (1);
+ }
+}
+
+void
+upc_coll_err (shared void *dst,
+ shared const void *src,
+ shared const int *perm,
+ size_t nbytes,
+ upc_flag_t sync_mode,
+ size_t blk_size,
+ size_t nelems, upc_op_t op, upc_flag_t upc_coll_op)
+{
+ int i;
+
+ coll_arg_list = upc_all_alloc (THREADS, sizeof (coll_arg_list_type));
+
+ coll_arg_list[MYTHREAD].dst = dst;
+ coll_arg_list[MYTHREAD].src = src;
+ coll_arg_list[MYTHREAD].perm = perm;
+ coll_arg_list[MYTHREAD].nbytes = nbytes;
+ coll_arg_list[MYTHREAD].sync_mode = sync_mode;
+ coll_arg_list[MYTHREAD].blk_size = blk_size;
+ coll_arg_list[MYTHREAD].nelems = nelems;
+ coll_arg_list[MYTHREAD].op = op;
+ coll_arg_list[MYTHREAD].upc_coll_op = upc_coll_op;
+
+ upc_barrier;
+
+ // Now thread 0 has access to the arguments of all of the collective
+ // function calls. All other threads now wait until thread 0 checks
+ // the arguments to all threads' collective function.
+
+ if (MYTHREAD == 0)
+
+ {
+ // Check that all collective calls are to the same function.
+ // (At most one disagreement is detected.)
+ // However, mismatches between (prefix) reduce functions
+ // of different types is not detected.
+
+ for (i = 1; i < THREADS; ++i)
+ if (coll_arg_list[0].upc_coll_op != coll_arg_list[i].upc_coll_op)
+ {
+ printf ("Threads 0 and %d have "
+ "called two different collective "
+ "functions: %s \t %s \n",
+ i, upc_coll_op_name (coll_arg_list[0].upc_coll_op),
+ upc_coll_op_name (coll_arg_list[i].upc_coll_op));
+ upc_global_exit (1);
+ }
+
+ switch (upc_coll_op)
+ {
+ case UPC_BRDCST:
+ upc_coll_chk_sync_mode ();
+ upc_coll_chk_nbytes ();
+ upc_coll_chk_dst_affinity ();
+ break;
+ case UPC_SCAT:
+ upc_coll_chk_sync_mode ();
+ upc_coll_chk_nbytes ();
+ upc_coll_chk_dst_affinity ();
+ break;
+ case UPC_GATH:
+ upc_coll_chk_sync_mode ();
+ upc_coll_chk_nbytes ();
+ upc_coll_chk_src_affinity ();
+ break;
+ case UPC_GATH_ALL:
+ upc_coll_chk_sync_mode ();
+ upc_coll_chk_nbytes ();
+ upc_coll_chk_src_affinity ();
+ upc_coll_chk_dst_affinity ();
+ break;
+ case UPC_EXCH:
+ upc_coll_chk_sync_mode ();
+ upc_coll_chk_nbytes ();
+ upc_coll_chk_src_affinity ();
+ upc_coll_chk_dst_affinity ();
+ break;
+ case UPC_PERM:
+ upc_coll_chk_perm ();
+ upc_coll_chk_sync_mode ();
+ upc_coll_chk_nbytes ();
+ upc_coll_chk_src_affinity ();
+ upc_coll_chk_dst_affinity ();
+ break;
+ case UPC_RED:
+ upc_coll_chk_sync_mode ();
+ upc_coll_chk_op ();
+ upc_coll_chk_blk_size ();
+ upc_coll_chk_nelems ();
+ break;
+ case UPC_PRED:
+ upc_coll_chk_sync_mode ();
+ upc_coll_chk_op ();
+ upc_coll_chk_blk_size ();
+ upc_coll_chk_nelems ();
+ upc_coll_chk_phase ();
+ break;
+ case UPC_SORT:
+ upc_coll_chk_sync_mode ();
+ upc_coll_chk_blk_size ();
+ upc_coll_chk_nelems ();
+ // use nbytes instead of the id elem_size as in spec
+ upc_coll_chk_elemsize ();
+ break;
+ } // switch
+ upc_free (coll_arg_list);
+ }
+ // If thread 0 detected no errors, all threads are released to
+ // execute their collective functions.
+
+ upc_barrier;
+}
diff --git a/libgupc/collectives/upc_coll_exchange.upc b/libgupc/collectives/upc_coll_exchange.upc
new file mode 100644
index 00000000000..e87f27ffb34
--- /dev/null
+++ b/libgupc/collectives/upc_coll_exchange.upc
@@ -0,0 +1,129 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+void
+upc_all_exchange (shared void *dst,
+ shared const void *src, size_t nbytes, upc_flag_t sync_mode)
+{
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+ int i;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, nbytes, sync_mode, 0, 0, 0, UPC_EXCH);
+#endif
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+#ifdef PULL
+
+ // Thread MYTHREAD copies the MYTHREADth block of thread i to
+ // its own ith block.
+
+ for (i = 0; i < THREADS; i++)
+ {
+ upc_memcpy ((shared char *) dst + i * nbytes * THREADS + MYTHREAD,
+ (shared char *) src + MYTHREAD * nbytes * THREADS + i,
+ nbytes);
+ }
+
+#endif
+
+#ifdef PUSH
+
+ // Thread MYTHREAD copies its ith block to the MYTHREADth block
+ // of thread i
+
+ for (i = 0; i < THREADS; i++)
+ {
+ upc_memcpy ((shared char *) dst + MYTHREAD * nbytes * THREADS + i,
+ (shared char *) src + i * nbytes * THREADS + MYTHREAD,
+ nbytes);
+ }
+
+#endif
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
diff --git a/libgupc/collectives/upc_coll_gather.upc b/libgupc/collectives/upc_coll_gather.upc
new file mode 100644
index 00000000000..2c86a833e71
--- /dev/null
+++ b/libgupc/collectives/upc_coll_gather.upc
@@ -0,0 +1,127 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+void
+upc_all_gather (shared void *dst,
+ shared const void *src, size_t nbytes, upc_flag_t sync_mode)
+{
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ int i;
+#endif
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, nbytes, sync_mode, 0, 0, 0, UPC_GATH);
+#endif
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+#ifdef PULL
+
+ // The dst thread "pulls" a block of data from each src thread.
+
+ if ((int)upc_threadof ((shared void *) dst) == MYTHREAD)
+ {
+ for (i = 0; i < THREADS; ++i)
+ {
+ upc_memcpy ((shared char *) dst + nbytes * i * THREADS,
+ (shared char *) src + i, nbytes);
+ }
+ }
+#endif
+
+#ifdef PUSH
+
+ // Each src thread "pushes" the data to the dst thread.
+
+ upc_memcpy ((shared char *) dst + MYTHREAD * THREADS * nbytes,
+ (shared char *) src + MYTHREAD, nbytes);
+
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
diff --git a/libgupc/collectives/upc_coll_gather_all.upc b/libgupc/collectives/upc_coll_gather_all.upc
new file mode 100644
index 00000000000..ad37a38c259
--- /dev/null
+++ b/libgupc/collectives/upc_coll_gather_all.upc
@@ -0,0 +1,127 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+void
+upc_all_gather_all (shared void *dst,
+ shared const void *src,
+ size_t nbytes, upc_flag_t sync_mode)
+{
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+ int i;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, nbytes, sync_mode, 0, 0, 0, UPC_GATH_ALL);
+#endif
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+#ifdef PULL
+
+ // Thread MYTHREAD copies the ith block from thread i to its ith block.
+
+ for (i = 0; i < THREADS; i++)
+ {
+ upc_memcpy ((shared char *) dst + i * nbytes * THREADS + MYTHREAD,
+ (shared char *) src + i, nbytes);
+ }
+
+#endif
+
+#ifdef PUSH
+
+ // Thread MYTHREAD copies its block to all threads.
+
+ for (i = 0; i < THREADS; i++)
+ {
+ upc_memcpy ((shared char *) dst + MYTHREAD * nbytes * THREADS + i,
+ (shared char *) src + MYTHREAD, nbytes);
+ }
+
+#endif
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+}
diff --git a/libgupc/collectives/upc_coll_init.upc b/libgupc/collectives/upc_coll_init.upc
new file mode 100644
index 00000000000..bfedab91638
--- /dev/null
+++ b/libgupc/collectives/upc_coll_init.upc
@@ -0,0 +1,94 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+#include <stdio.h>
+
+int upc_coll_init_flag = 0;
+
+void
+upc_coll_init ()
+{
+ if (upc_coll_init_flag)
+ {
+ printf ("Internal error: Multiple attempts to initialize ");
+ printf ("\tthe collective library in the same thread.\n");
+ exit (1);
+ }
+
+ // Set the flag so that this thread never initializes again.
+
+ upc_coll_init_flag = 1;
+
+// Nothing to initialize yet.
+
+}
diff --git a/libgupc/collectives/upc_coll_permute.upc b/libgupc/collectives/upc_coll_permute.upc
new file mode 100644
index 00000000000..289b9174e7a
--- /dev/null
+++ b/libgupc/collectives/upc_coll_permute.upc
@@ -0,0 +1,128 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+void
+upc_all_permute (shared void *dst,
+ shared const void *src,
+ shared const int *perm, size_t nbytes, upc_flag_t sync_mode)
+{
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ int i;
+#endif
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, perm, nbytes, sync_mode, 0, 0, 0, UPC_PERM);
+#endif
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+#ifdef PULL
+
+ // Each dst thread finds its src thread and "pulls" the data from it.
+
+ for (i = 0; i < THREADS; ++i)
+ if (perm[i] == MYTHREAD)
+ break;
+
+ upc_memcpy ((shared char *) dst + MYTHREAD,
+ (shared char *) src + i, nbytes);
+
+#endif
+
+#ifdef PUSH
+
+ // The src thread "pushes" its data to its dst thread.
+
+ upc_memcpy ((shared char *) dst + perm[MYTHREAD],
+ (shared char *) src + MYTHREAD, nbytes);
+
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
diff --git a/libgupc/collectives/upc_coll_prefix_reduce.in b/libgupc/collectives/upc_coll_prefix_reduce.in
new file mode 100644
index 00000000000..82903d96f5d
--- /dev/null
+++ b/libgupc/collectives/upc_coll_prefix_reduce.in
@@ -0,0 +1,623 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+// NOTE: Contrary to the spec, this implementation assumes that the phases
+// of the src and dst arguments agree.
+
+/* The true set of function names is in upc_all_collectives.c */
+
+PREPROCESS_BEGIN
+void upc_all_prefix_reduce_GENERIC
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ _UPC_RED_T (*func) (_UPC_RED_T, _UPC_RED_T), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared _UPC_RED_T *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (_UPC_RED_T));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Determine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared _UPC_RED_T *) dst + dst_offset)
+ = *((shared const _UPC_RED_T *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) dst + i)
+ + *((shared const _UPC_RED_T *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) dst + i)
+ * *((shared const _UPC_RED_T *) src + k);
+ }
+ break;
+#ifndef _UPC_NONINT_T
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) dst + i)
+ & *((shared const _UPC_RED_T *) src + k);
+ }
+ break;
+ case UPC_OR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) dst + i)
+ | *((shared const _UPC_RED_T *) src + k);
+ }
+ break;
+ case UPC_XOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) dst + i)
+ ^ *((shared const _UPC_RED_T *) src + k);
+ }
+ break;
+#endif // _UPC_NOINT_T
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) dst + i)
+ && *((shared const _UPC_RED_T *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) dst + i)
+ || *((shared const _UPC_RED_T *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const _UPC_RED_T *) dst + i)
+ < *((shared const _UPC_RED_T *) src + k))
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) dst + i);
+ else
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const _UPC_RED_T *) dst + i)
+ > *((shared const _UPC_RED_T *) src + k))
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) dst + i);
+ else
+ *((shared _UPC_RED_T *) dst + j)
+ = *((shared const _UPC_RED_T *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + j)
+ = func (*((shared const _UPC_RED_T *) dst + i),
+ *((shared const _UPC_RED_T *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + j)
+ = func (*((shared const _UPC_RED_T *) dst + i),
+ *((shared const _UPC_RED_T *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const _UPC_RED_T *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const _UPC_RED_T *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+#ifndef _UPC_NONINT_T
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] &= pref[i - 1];
+ break;
+ case UPC_OR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] |= pref[i - 1];
+ break;
+ case UPC_XOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] ^= pref[i - 1];
+ break;
+#endif // _UPC_NOINT_T
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared _UPC_RED_T *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+#ifndef _UPC_NONINT_T
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared _UPC_RED_T *) dst + i) &= pref[MYTHREAD];
+ break;
+ case UPC_OR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared _UPC_RED_T *) dst + i) |= pref[MYTHREAD];
+ break;
+ case UPC_XOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared _UPC_RED_T *) dst + i) *= pref[MYTHREAD];
+ break;
+#endif // _UPC_NOINT_T
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared _UPC_RED_T *) dst + i) =
+ *((shared _UPC_RED_T *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared _UPC_RED_T *) dst + i) =
+ *((shared _UPC_RED_T *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared _UPC_RED_T *) dst + i))
+ *((shared _UPC_RED_T *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared _UPC_RED_T *) dst + i))
+ *((shared _UPC_RED_T *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared _UPC_RED_T *) dst + i) =
+ func (pref[MYTHREAD], *((shared _UPC_RED_T *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared _UPC_RED_T *) dst + i) =
+ func (pref[MYTHREAD], *((shared _UPC_RED_T *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
diff --git a/libgupc/collectives/upc_coll_prefix_reduce.upc b/libgupc/collectives/upc_coll_prefix_reduce.upc
new file mode 100644
index 00000000000..2ed38f4eaee
--- /dev/null
+++ b/libgupc/collectives/upc_coll_prefix_reduce.upc
@@ -0,0 +1,5818 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+// NOTE: Contrary to the spec, this implementation assumes that the phases
+// of the src and dst arguments agree.
+
+/* The true set of function names is in upc_all_collectives.c */
+
+
+void upc_all_prefix_reduceC
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed char (*func) (signed char, signed char), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared signed char *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (signed char));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared signed char *) dst + dst_offset)
+ = *((shared const signed char *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) dst + i)
+ + *((shared const signed char *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) dst + i)
+ * *((shared const signed char *) src + k);
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) dst + i)
+ & *((shared const signed char *) src + k);
+ }
+ break;
+ case UPC_OR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) dst + i)
+ | *((shared const signed char *) src + k);
+ }
+ break;
+ case UPC_XOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) dst + i)
+ ^ *((shared const signed char *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) dst + i)
+ && *((shared const signed char *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) dst + i)
+ || *((shared const signed char *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const signed char *) dst + i)
+ < *((shared const signed char *) src + k))
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) dst + i);
+ else
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const signed char *) dst + i)
+ > *((shared const signed char *) src + k))
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) dst + i);
+ else
+ *((shared signed char *) dst + j)
+ = *((shared const signed char *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed char *) dst + j)
+ = func (*((shared const signed char *) dst + i),
+ *((shared const signed char *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed char *) dst + j)
+ = func (*((shared const signed char *) dst + i),
+ *((shared const signed char *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const signed char *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const signed char *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] &= pref[i - 1];
+ break;
+ case UPC_OR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] |= pref[i - 1];
+ break;
+ case UPC_XOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] ^= pref[i - 1];
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared signed char *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared signed char *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed char *) dst + i) &= pref[MYTHREAD];
+ break;
+ case UPC_OR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed char *) dst + i) |= pref[MYTHREAD];
+ break;
+ case UPC_XOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed char *) dst + i) *= pref[MYTHREAD];
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed char *) dst + i) =
+ *((shared signed char *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed char *) dst + i) =
+ *((shared signed char *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared signed char *) dst + i))
+ *((shared signed char *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared signed char *) dst + i))
+ *((shared signed char *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed char *) dst + i) =
+ func (pref[MYTHREAD], *((shared signed char *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed char *) dst + i) =
+ func (pref[MYTHREAD], *((shared signed char *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceUC
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned char (*func) (unsigned char, unsigned char), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared unsigned char *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (unsigned char));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared unsigned char *) dst + dst_offset)
+ = *((shared const unsigned char *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) dst + i)
+ + *((shared const unsigned char *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) dst + i)
+ * *((shared const unsigned char *) src + k);
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) dst + i)
+ & *((shared const unsigned char *) src + k);
+ }
+ break;
+ case UPC_OR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) dst + i)
+ | *((shared const unsigned char *) src + k);
+ }
+ break;
+ case UPC_XOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) dst + i)
+ ^ *((shared const unsigned char *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) dst + i)
+ && *((shared const unsigned char *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) dst + i)
+ || *((shared const unsigned char *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const unsigned char *) dst + i)
+ < *((shared const unsigned char *) src + k))
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) dst + i);
+ else
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const unsigned char *) dst + i)
+ > *((shared const unsigned char *) src + k))
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) dst + i);
+ else
+ *((shared unsigned char *) dst + j)
+ = *((shared const unsigned char *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned char *) dst + j)
+ = func (*((shared const unsigned char *) dst + i),
+ *((shared const unsigned char *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned char *) dst + j)
+ = func (*((shared const unsigned char *) dst + i),
+ *((shared const unsigned char *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const unsigned char *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const unsigned char *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] &= pref[i - 1];
+ break;
+ case UPC_OR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] |= pref[i - 1];
+ break;
+ case UPC_XOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] ^= pref[i - 1];
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared unsigned char *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared unsigned char *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned char *) dst + i) &= pref[MYTHREAD];
+ break;
+ case UPC_OR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned char *) dst + i) |= pref[MYTHREAD];
+ break;
+ case UPC_XOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned char *) dst + i) *= pref[MYTHREAD];
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned char *) dst + i) =
+ *((shared unsigned char *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned char *) dst + i) =
+ *((shared unsigned char *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared unsigned char *) dst + i))
+ *((shared unsigned char *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared unsigned char *) dst + i))
+ *((shared unsigned char *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned char *) dst + i) =
+ func (pref[MYTHREAD], *((shared unsigned char *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned char *) dst + i) =
+ func (pref[MYTHREAD], *((shared unsigned char *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceS
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed short (*func) (signed short, signed short), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared signed short *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (signed short));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared signed short *) dst + dst_offset)
+ = *((shared const signed short *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) dst + i)
+ + *((shared const signed short *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) dst + i)
+ * *((shared const signed short *) src + k);
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) dst + i)
+ & *((shared const signed short *) src + k);
+ }
+ break;
+ case UPC_OR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) dst + i)
+ | *((shared const signed short *) src + k);
+ }
+ break;
+ case UPC_XOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) dst + i)
+ ^ *((shared const signed short *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) dst + i)
+ && *((shared const signed short *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) dst + i)
+ || *((shared const signed short *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const signed short *) dst + i)
+ < *((shared const signed short *) src + k))
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) dst + i);
+ else
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const signed short *) dst + i)
+ > *((shared const signed short *) src + k))
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) dst + i);
+ else
+ *((shared signed short *) dst + j)
+ = *((shared const signed short *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed short *) dst + j)
+ = func (*((shared const signed short *) dst + i),
+ *((shared const signed short *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed short *) dst + j)
+ = func (*((shared const signed short *) dst + i),
+ *((shared const signed short *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const signed short *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const signed short *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] &= pref[i - 1];
+ break;
+ case UPC_OR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] |= pref[i - 1];
+ break;
+ case UPC_XOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] ^= pref[i - 1];
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared signed short *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared signed short *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed short *) dst + i) &= pref[MYTHREAD];
+ break;
+ case UPC_OR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed short *) dst + i) |= pref[MYTHREAD];
+ break;
+ case UPC_XOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed short *) dst + i) *= pref[MYTHREAD];
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed short *) dst + i) =
+ *((shared signed short *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed short *) dst + i) =
+ *((shared signed short *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared signed short *) dst + i))
+ *((shared signed short *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared signed short *) dst + i))
+ *((shared signed short *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed short *) dst + i) =
+ func (pref[MYTHREAD], *((shared signed short *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed short *) dst + i) =
+ func (pref[MYTHREAD], *((shared signed short *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceUS
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned short (*func) (unsigned short, unsigned short), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared unsigned short *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (unsigned short));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared unsigned short *) dst + dst_offset)
+ = *((shared const unsigned short *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) dst + i)
+ + *((shared const unsigned short *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) dst + i)
+ * *((shared const unsigned short *) src + k);
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) dst + i)
+ & *((shared const unsigned short *) src + k);
+ }
+ break;
+ case UPC_OR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) dst + i)
+ | *((shared const unsigned short *) src + k);
+ }
+ break;
+ case UPC_XOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) dst + i)
+ ^ *((shared const unsigned short *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) dst + i)
+ && *((shared const unsigned short *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) dst + i)
+ || *((shared const unsigned short *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const unsigned short *) dst + i)
+ < *((shared const unsigned short *) src + k))
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) dst + i);
+ else
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const unsigned short *) dst + i)
+ > *((shared const unsigned short *) src + k))
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) dst + i);
+ else
+ *((shared unsigned short *) dst + j)
+ = *((shared const unsigned short *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned short *) dst + j)
+ = func (*((shared const unsigned short *) dst + i),
+ *((shared const unsigned short *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned short *) dst + j)
+ = func (*((shared const unsigned short *) dst + i),
+ *((shared const unsigned short *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const unsigned short *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const unsigned short *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] &= pref[i - 1];
+ break;
+ case UPC_OR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] |= pref[i - 1];
+ break;
+ case UPC_XOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] ^= pref[i - 1];
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared unsigned short *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared unsigned short *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned short *) dst + i) &= pref[MYTHREAD];
+ break;
+ case UPC_OR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned short *) dst + i) |= pref[MYTHREAD];
+ break;
+ case UPC_XOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned short *) dst + i) *= pref[MYTHREAD];
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned short *) dst + i) =
+ *((shared unsigned short *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned short *) dst + i) =
+ *((shared unsigned short *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared unsigned short *) dst + i))
+ *((shared unsigned short *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared unsigned short *) dst + i))
+ *((shared unsigned short *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned short *) dst + i) =
+ func (pref[MYTHREAD], *((shared unsigned short *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned short *) dst + i) =
+ func (pref[MYTHREAD], *((shared unsigned short *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceI
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed int (*func) (signed int, signed int), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared signed int *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (signed int));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared signed int *) dst + dst_offset)
+ = *((shared const signed int *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) dst + i)
+ + *((shared const signed int *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) dst + i)
+ * *((shared const signed int *) src + k);
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) dst + i)
+ & *((shared const signed int *) src + k);
+ }
+ break;
+ case UPC_OR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) dst + i)
+ | *((shared const signed int *) src + k);
+ }
+ break;
+ case UPC_XOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) dst + i)
+ ^ *((shared const signed int *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) dst + i)
+ && *((shared const signed int *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) dst + i)
+ || *((shared const signed int *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const signed int *) dst + i)
+ < *((shared const signed int *) src + k))
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) dst + i);
+ else
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const signed int *) dst + i)
+ > *((shared const signed int *) src + k))
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) dst + i);
+ else
+ *((shared signed int *) dst + j)
+ = *((shared const signed int *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed int *) dst + j)
+ = func (*((shared const signed int *) dst + i),
+ *((shared const signed int *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed int *) dst + j)
+ = func (*((shared const signed int *) dst + i),
+ *((shared const signed int *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const signed int *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const signed int *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] &= pref[i - 1];
+ break;
+ case UPC_OR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] |= pref[i - 1];
+ break;
+ case UPC_XOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] ^= pref[i - 1];
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared signed int *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared signed int *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed int *) dst + i) &= pref[MYTHREAD];
+ break;
+ case UPC_OR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed int *) dst + i) |= pref[MYTHREAD];
+ break;
+ case UPC_XOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed int *) dst + i) *= pref[MYTHREAD];
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed int *) dst + i) =
+ *((shared signed int *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed int *) dst + i) =
+ *((shared signed int *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared signed int *) dst + i))
+ *((shared signed int *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared signed int *) dst + i))
+ *((shared signed int *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed int *) dst + i) =
+ func (pref[MYTHREAD], *((shared signed int *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed int *) dst + i) =
+ func (pref[MYTHREAD], *((shared signed int *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceUI
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned int (*func) (unsigned int, unsigned int), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared unsigned int *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (unsigned int));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared unsigned int *) dst + dst_offset)
+ = *((shared const unsigned int *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) dst + i)
+ + *((shared const unsigned int *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) dst + i)
+ * *((shared const unsigned int *) src + k);
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) dst + i)
+ & *((shared const unsigned int *) src + k);
+ }
+ break;
+ case UPC_OR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) dst + i)
+ | *((shared const unsigned int *) src + k);
+ }
+ break;
+ case UPC_XOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) dst + i)
+ ^ *((shared const unsigned int *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) dst + i)
+ && *((shared const unsigned int *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) dst + i)
+ || *((shared const unsigned int *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const unsigned int *) dst + i)
+ < *((shared const unsigned int *) src + k))
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) dst + i);
+ else
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const unsigned int *) dst + i)
+ > *((shared const unsigned int *) src + k))
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) dst + i);
+ else
+ *((shared unsigned int *) dst + j)
+ = *((shared const unsigned int *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned int *) dst + j)
+ = func (*((shared const unsigned int *) dst + i),
+ *((shared const unsigned int *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned int *) dst + j)
+ = func (*((shared const unsigned int *) dst + i),
+ *((shared const unsigned int *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const unsigned int *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const unsigned int *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] &= pref[i - 1];
+ break;
+ case UPC_OR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] |= pref[i - 1];
+ break;
+ case UPC_XOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] ^= pref[i - 1];
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared unsigned int *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared unsigned int *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned int *) dst + i) &= pref[MYTHREAD];
+ break;
+ case UPC_OR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned int *) dst + i) |= pref[MYTHREAD];
+ break;
+ case UPC_XOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned int *) dst + i) *= pref[MYTHREAD];
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned int *) dst + i) =
+ *((shared unsigned int *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned int *) dst + i) =
+ *((shared unsigned int *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared unsigned int *) dst + i))
+ *((shared unsigned int *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared unsigned int *) dst + i))
+ *((shared unsigned int *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned int *) dst + i) =
+ func (pref[MYTHREAD], *((shared unsigned int *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned int *) dst + i) =
+ func (pref[MYTHREAD], *((shared unsigned int *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceL
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed long (*func) (signed long, signed long), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared signed long *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (signed long));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared signed long *) dst + dst_offset)
+ = *((shared const signed long *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) dst + i)
+ + *((shared const signed long *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) dst + i)
+ * *((shared const signed long *) src + k);
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) dst + i)
+ & *((shared const signed long *) src + k);
+ }
+ break;
+ case UPC_OR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) dst + i)
+ | *((shared const signed long *) src + k);
+ }
+ break;
+ case UPC_XOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) dst + i)
+ ^ *((shared const signed long *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) dst + i)
+ && *((shared const signed long *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) dst + i)
+ || *((shared const signed long *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const signed long *) dst + i)
+ < *((shared const signed long *) src + k))
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) dst + i);
+ else
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const signed long *) dst + i)
+ > *((shared const signed long *) src + k))
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) dst + i);
+ else
+ *((shared signed long *) dst + j)
+ = *((shared const signed long *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed long *) dst + j)
+ = func (*((shared const signed long *) dst + i),
+ *((shared const signed long *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared signed long *) dst + j)
+ = func (*((shared const signed long *) dst + i),
+ *((shared const signed long *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const signed long *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const signed long *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] &= pref[i - 1];
+ break;
+ case UPC_OR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] |= pref[i - 1];
+ break;
+ case UPC_XOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] ^= pref[i - 1];
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared signed long *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared signed long *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed long *) dst + i) &= pref[MYTHREAD];
+ break;
+ case UPC_OR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed long *) dst + i) |= pref[MYTHREAD];
+ break;
+ case UPC_XOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed long *) dst + i) *= pref[MYTHREAD];
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed long *) dst + i) =
+ *((shared signed long *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed long *) dst + i) =
+ *((shared signed long *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared signed long *) dst + i))
+ *((shared signed long *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared signed long *) dst + i))
+ *((shared signed long *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed long *) dst + i) =
+ func (pref[MYTHREAD], *((shared signed long *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared signed long *) dst + i) =
+ func (pref[MYTHREAD], *((shared signed long *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceUL
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned long (*func) (unsigned long, unsigned long), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared unsigned long *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (unsigned long));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared unsigned long *) dst + dst_offset)
+ = *((shared const unsigned long *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) dst + i)
+ + *((shared const unsigned long *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) dst + i)
+ * *((shared const unsigned long *) src + k);
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) dst + i)
+ & *((shared const unsigned long *) src + k);
+ }
+ break;
+ case UPC_OR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) dst + i)
+ | *((shared const unsigned long *) src + k);
+ }
+ break;
+ case UPC_XOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) dst + i)
+ ^ *((shared const unsigned long *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) dst + i)
+ && *((shared const unsigned long *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) dst + i)
+ || *((shared const unsigned long *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const unsigned long *) dst + i)
+ < *((shared const unsigned long *) src + k))
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) dst + i);
+ else
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const unsigned long *) dst + i)
+ > *((shared const unsigned long *) src + k))
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) dst + i);
+ else
+ *((shared unsigned long *) dst + j)
+ = *((shared const unsigned long *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned long *) dst + j)
+ = func (*((shared const unsigned long *) dst + i),
+ *((shared const unsigned long *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared unsigned long *) dst + j)
+ = func (*((shared const unsigned long *) dst + i),
+ *((shared const unsigned long *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const unsigned long *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const unsigned long *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] &= pref[i - 1];
+ break;
+ case UPC_OR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] |= pref[i - 1];
+ break;
+ case UPC_XOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] ^= pref[i - 1];
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared unsigned long *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared unsigned long *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned long *) dst + i) &= pref[MYTHREAD];
+ break;
+ case UPC_OR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned long *) dst + i) |= pref[MYTHREAD];
+ break;
+ case UPC_XOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned long *) dst + i) *= pref[MYTHREAD];
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned long *) dst + i) =
+ *((shared unsigned long *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned long *) dst + i) =
+ *((shared unsigned long *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared unsigned long *) dst + i))
+ *((shared unsigned long *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared unsigned long *) dst + i))
+ *((shared unsigned long *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned long *) dst + i) =
+ func (pref[MYTHREAD], *((shared unsigned long *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared unsigned long *) dst + i) =
+ func (pref[MYTHREAD], *((shared unsigned long *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceF
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ float (*func) (float, float), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared float *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (float));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared float *) dst + dst_offset)
+ = *((shared const float *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared float *) dst + j)
+ = *((shared const float *) dst + i)
+ + *((shared const float *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared float *) dst + j)
+ = *((shared const float *) dst + i)
+ * *((shared const float *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared float *) dst + j)
+ = *((shared const float *) dst + i)
+ && *((shared const float *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared float *) dst + j)
+ = *((shared const float *) dst + i)
+ || *((shared const float *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const float *) dst + i)
+ < *((shared const float *) src + k))
+ *((shared float *) dst + j)
+ = *((shared const float *) dst + i);
+ else
+ *((shared float *) dst + j)
+ = *((shared const float *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const float *) dst + i)
+ > *((shared const float *) src + k))
+ *((shared float *) dst + j)
+ = *((shared const float *) dst + i);
+ else
+ *((shared float *) dst + j)
+ = *((shared const float *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared float *) dst + j)
+ = func (*((shared const float *) dst + i),
+ *((shared const float *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared float *) dst + j)
+ = func (*((shared const float *) dst + i),
+ *((shared const float *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const float *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const float *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared float *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared float *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared float *) dst + i) =
+ *((shared float *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared float *) dst + i) =
+ *((shared float *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared float *) dst + i))
+ *((shared float *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared float *) dst + i))
+ *((shared float *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared float *) dst + i) =
+ func (pref[MYTHREAD], *((shared float *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared float *) dst + i) =
+ func (pref[MYTHREAD], *((shared float *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceD
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ double (*func) (double, double), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared double *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (double));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared double *) dst + dst_offset)
+ = *((shared const double *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared double *) dst + j)
+ = *((shared const double *) dst + i)
+ + *((shared const double *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared double *) dst + j)
+ = *((shared const double *) dst + i)
+ * *((shared const double *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared double *) dst + j)
+ = *((shared const double *) dst + i)
+ && *((shared const double *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared double *) dst + j)
+ = *((shared const double *) dst + i)
+ || *((shared const double *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const double *) dst + i)
+ < *((shared const double *) src + k))
+ *((shared double *) dst + j)
+ = *((shared const double *) dst + i);
+ else
+ *((shared double *) dst + j)
+ = *((shared const double *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const double *) dst + i)
+ > *((shared const double *) src + k))
+ *((shared double *) dst + j)
+ = *((shared const double *) dst + i);
+ else
+ *((shared double *) dst + j)
+ = *((shared const double *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared double *) dst + j)
+ = func (*((shared const double *) dst + i),
+ *((shared const double *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared double *) dst + j)
+ = func (*((shared const double *) dst + i),
+ *((shared const double *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const double *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const double *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared double *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared double *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared double *) dst + i) =
+ *((shared double *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared double *) dst + i) =
+ *((shared double *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared double *) dst + i))
+ *((shared double *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared double *) dst + i))
+ *((shared double *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared double *) dst + i) =
+ func (pref[MYTHREAD], *((shared double *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared double *) dst + i) =
+ func (pref[MYTHREAD], *((shared double *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
+
+void upc_all_prefix_reduceLD
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ long double (*func) (long double, long double), upc_flag_t sync_mode)
+{
+
+/*
+ This prefix reduce algorithm is linear in the number of array elements/THREADS.
+ The prefixes are calculated in a loop that iterates as many times+1
+ as the src array wraps from thread THREADS-1 to thread 0. The cost of
+ computing prefixes of an array with a small block size (that wraps many
+ times) is likely to be much higher than the cost of computing prefixes
+ of an array of the same size but with block size [*]. This code favors
+ the affinity of the src array. Thus, if the affinities of the src and dst
+ arrays are different, there will many off-thread references (i.e. writes,
+ that is, "pushes") to the dst array.
+
+ Each iteration contains two internal barriers and about THREADS off-thread
+ reads and writes in the best case. The pref pointer switches between the
+ first and second halves of the array so that one thread can be working
+ an iteration ahead (or behind) of another without interference. Otherwise,
+ an additional barrier would be needed.
+
+ Allocate pref[2*THREADS]
+ Determine the number of times the array "wraps".
+ Compute the offset address and number of local elements for 1st pass.
+ for (w=0; w<=wraps; ++w)
+ Initialize local prefix "sum"
+ Compute local prefixes
+ if (MYTHREAD < THREADS-1)
+ Write rightmost local prefix to pref[MYTHREAD+1]
+ barrier
+ if (MYTHREAD == THREADS-1)
+ if (w>0)
+ pref[0] = last "sum" from previous iteration
+ Compute prefixes in pref[]
+ barrier
+ "Add" pref[MYTHREAD] to each prefix computed at top of loop
+ if (wraps > w)
+ Swap pointer to first or last half of pref[]
+ Increment offset address and compute n_local for next pass
+ barrier
+ free pref[]
+
+ Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+ thread 0 more work. "push" and "pull" versions of this collective
+ function are not distinguished. As it stands, the writes to pref[]
+ are "pushes" and the reads from pref[] are "pulls". If the affinities
+ of src and dst differ, this function can be regarded as a "push"
+ because the affinity of the src array is favored.
+*/
+
+ int // constant over all iterations
+ src_thr, // source thread
+ dst_thr, // destination thread
+ phase, // phase of src and dst array must be identical
+ wraps, // number of times src array properly wraps around
+ // first iteration only
+ leaders, // number of vacant positions to left of src
+ // modified on each iteration
+ i, j, k, // addressing indices
+ w, // main loop index for "wraps"
+ src_offset, // offset from src of first local element
+ dst_offset, // offset from dst of first element
+ first_thr, // first thread that contains local src elements
+ last_thr, // last thread that contains local src elements
+ row_elems, // number of src elements in the row processed
+ n_local, // number of local src elements
+ rem_elems; // number of elements remaining to be processed
+
+ shared long double *pref; // shared array to hold local prefixes
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // This array is used to share local prefixes.
+
+ pref = upc_all_alloc (2 * THREADS, sizeof (long double));
+
+ src_thr = upc_threadof ((shared void *) src);
+ phase = upc_phaseof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+
+ // Total number of elements remaining to be processed.
+
+ rem_elems = nelems;
+
+ // Determine offsets in all threads as if there really are elements in all
+ // threads. Addresses will be src + offset. (If MYTHREAD < src_thr, MYTHREAD
+ // has no elements for this iteration but it might have elements for next
+ // iteration.) Note: offset is sometimes negative because src is addressed
+ // here as if its block size is 1. Similar comments apply to dst.
+
+ if (MYTHREAD != src_thr)
+ {
+ src_offset = MYTHREAD - src_thr - phase * THREADS;
+ dst_offset = src_offset;
+
+ // The following arithmetic is undocumentable.
+ if (MYTHREAD >= THREADS + src_thr - dst_thr)
+ dst_offset += (blk_size - 1) * THREADS;
+ if (MYTHREAD < src_thr - dst_thr)
+ dst_offset -= (blk_size - 1) * THREADS;
+ }
+ else
+ {
+ src_offset = 0;
+ dst_offset = 0;
+ }
+
+ // first_thr .. last_thr is range of threads that contains src elements of current row
+
+ first_thr = src_thr;
+
+ // Compute n_local, the number of src elements local to this thread,
+
+ if (blk_size == 0 || phase + nelems <= blk_size)
+ { // All elements are on the src_thr.
+
+ leaders = 0; // (Not needed here. Initialize for debugging output.)
+ row_elems = nelems;
+ wraps = 0;
+
+ if (MYTHREAD == src_thr)
+ n_local = nelems;
+ else
+ n_local = 0;
+ last_thr = src_thr;
+ }
+ else // At least two threads contain elements.
+ {
+ // Detemine how many elements are in the first row.
+ leaders = src_thr * blk_size + phase;
+ if ((leaders + nelems) / (blk_size * THREADS) > 0) //first row is "full"
+ row_elems = blk_size * THREADS - leaders;
+ else
+ row_elems = nelems;
+
+ // Determine how many rows wrap back around to thread 0.
+
+ wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+ // Assume most likely situation; modify if necessary
+
+ last_thr = THREADS - 1;
+ n_local = blk_size;
+
+ if (MYTHREAD == src_thr)
+ n_local = blk_size - phase;
+ if (MYTHREAD < src_thr)
+ n_local = 0;
+ if (leaders + nelems < blk_size * THREADS)
+ {
+ // There are not enough elements to fill the
+ // end of the first row. Assert: wraps = 0
+ last_thr = (leaders + nelems - 1) / blk_size;
+ if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+ n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+ }
+ }
+
+
+//////// Main loop.
+
+ for (w = 0; w <= wraps; ++w)
+ {
+
+ if (n_local > 0)
+ {
+ // Initialize first element.
+
+ *((shared long double *) dst + dst_offset)
+ = *((shared const long double *) src + src_offset);
+
+ // Compute local prefixes.
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared long double *) dst + j)
+ = *((shared const long double *) dst + i)
+ + *((shared const long double *) src + k);
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared long double *) dst + j)
+ = *((shared const long double *) dst + i)
+ * *((shared const long double *) src + k);
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared long double *) dst + j)
+ = *((shared const long double *) dst + i)
+ && *((shared const long double *) src + k);
+ }
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared long double *) dst + j)
+ = *((shared const long double *) dst + i)
+ || *((shared const long double *) src + k);
+ }
+ break;
+ case UPC_MIN:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const long double *) dst + i)
+ < *((shared const long double *) src + k))
+ *((shared long double *) dst + j)
+ = *((shared const long double *) dst + i);
+ else
+ *((shared long double *) dst + j)
+ = *((shared const long double *) src + k);
+ }
+ break;
+ case UPC_MAX:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ if (*((shared const long double *) dst + i)
+ > *((shared const long double *) src + k))
+ *((shared long double *) dst + j)
+ = *((shared const long double *) dst + i);
+ else
+ *((shared long double *) dst + j)
+ = *((shared const long double *) src + k);
+ }
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared long double *) dst + j)
+ = func (*((shared const long double *) dst + i),
+ *((shared const long double *) src + k));
+ }
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+ k < (src_offset + n_local * THREADS);
+ i = j, j += THREADS, k += THREADS)
+ {
+ *((shared long double *) dst + j)
+ = func (*((shared const long double *) dst + i),
+ *((shared const long double *) src + k));
+ }
+ break;
+ }
+
+ if (MYTHREAD < THREADS - 1)
+ // Write last prefix to shared array. (This is spurious,
+ // e.g., sometimes when n_local < blk_size.)
+
+ pref[MYTHREAD + 1] = *((shared const long double *) dst
+ + dst_offset + (n_local - 1) * THREADS);
+ }
+
+ upc_barrier;
+
+ // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+ // even if it doesn't contain any elements itself.
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w > 0) // (first_thr is always 0 in this case)
+
+ // Write the last prefix computed on the *previous* iteration.
+
+ pref[0] =
+ *((shared const long double *) dst + dst_offset - THREADS);
+
+ else // On the first iteration the source thread has no left neighbor.
+
+ ++first_thr;
+
+ // Compute prefixes in pref[first_thr..last_thr].
+
+ switch (op)
+ {
+ case UPC_ADD:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] += pref[i - 1];
+ }
+ break;
+ case UPC_MULT:
+ {
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] *= pref[i - 1];
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] && pref[i];
+ break;
+ case UPC_LOGOR:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = pref[i - 1] || pref[i];
+ break;
+ case UPC_MIN:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] < pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_MAX:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ if (pref[i - 1] > pref[i])
+ pref[i] = pref[i - 1];
+ break;
+ case UPC_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = first_thr + 1; i <= last_thr; ++i)
+ pref[i] = func (pref[i - 1], pref[i]);
+ break;
+ }
+ } // THREAD-1 is done doing it's special job.
+
+ upc_barrier;
+
+ if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+ {
+ // "Add" pref[MYTHREAD] to local prefixes. (On the first
+ // iteration, only threads beyond src_thr should do this.)
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared long double *) dst + i) += pref[MYTHREAD];
+ }
+ break;
+ case UPC_MULT:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ {
+ *((shared long double *) dst + i) *= pref[MYTHREAD];
+ }
+ break;
+ case UPC_LOGAND:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared long double *) dst + i) =
+ *((shared long double *) dst + i) && pref[MYTHREAD];
+ break;
+ case UPC_LOGOR:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared long double *) dst + i) =
+ *((shared long double *) dst + i) || pref[MYTHREAD];
+ break;
+ case UPC_MIN:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] < *((shared long double *) dst + i))
+ *((shared long double *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_MAX:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ if (pref[MYTHREAD] > *((shared long double *) dst + i))
+ *((shared long double *) dst + i) = pref[MYTHREAD];
+ break;
+ case UPC_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared long double *) dst + i) =
+ func (pref[MYTHREAD], *((shared long double *) dst + i));
+ break;
+ case UPC_NONCOMM_FUNC:
+ for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+ i += THREADS)
+ *((shared long double *) dst + i) =
+ func (pref[MYTHREAD], *((shared long double *) dst + i));
+ break;
+ }
+ }
+
+ if (wraps > w) // Set up for the next iteration.
+ {
+ // swap between two halves of pref array
+ if (w % 2 == 0)
+ pref = pref + THREADS;
+ else
+ pref = pref - THREADS;
+
+ rem_elems -= row_elems;
+
+ if (rem_elems / (blk_size * THREADS) > 0) // next row is "full"
+ row_elems = blk_size * THREADS;
+ else
+ row_elems = rem_elems;
+
+ first_thr = 0;
+ last_thr = (row_elems - 1) / blk_size;
+
+ n_local = blk_size;
+ if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+ n_local = row_elems % blk_size;
+ else if (MYTHREAD > last_thr)
+ n_local = 0;
+
+ // Handle phase > 0 on first iteration
+
+ if ((w == 0) && (MYTHREAD == src_thr))
+ {
+ src_offset -= phase * THREADS;
+ dst_offset -= phase * THREADS;
+ }
+
+ // All the preceding work makes this easy:
+
+ src_offset += blk_size * THREADS;
+ dst_offset += blk_size * THREADS;
+ }
+
+ } // End of main "wrap" loop
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+ else
+ // we have to synchronize anyway to free the pref array
+ upc_barrier;
+
+ if (MYTHREAD == THREADS - 1)
+ {
+ if (w % 2 == 0)
+ pref -= THREADS; /* DOB: be sure we free the original pointer! */
+ upc_free (pref);
+ }
+}
diff --git a/libgupc/collectives/upc_coll_readme.txt b/libgupc/collectives/upc_coll_readme.txt
new file mode 100644
index 00000000000..352e514e0c3
--- /dev/null
+++ b/libgupc/collectives/upc_coll_readme.txt
@@ -0,0 +1,162 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+ February 6, 2004
+
+This is a reference implementation of the UPC V1.0 collective functions.
+This implementation conforms to UPC V1.1. The specification documents
+can be found at http://www.upc.gwu/~upc/documentation.html.
+
+1) Installation notes
+
+The Makefile compiles the collective functions to collective.o and it
+compiles three main programs, try_*.c, that exercise the collective
+functions. The Makefile has macros that control the number of threads,
+whether argument checking is turned on, and whether certain collective
+functions "push" or "pull". Assuming it can find your upc compiler,
+typing "make" will make collective.o with the "pull" versions of the
+collective function for the dynamic threads environment and with
+argument checking turned on.
+
+2) Implementation notes
+
+This implementation is written in UPC. The 6 "relocalization"
+functions (upc_all_broadcast(), upc_all_scatter(), etc.) are
+implemented using memcpy. Each function has a "push" and a "pull"
+version. "Push" means that the source thread(s) memcpy's the data to
+the destination thread(s); "pull" means that the destination thread(s)
+memcpy's the data from the source thread(s). For example, in a "pull"
+broadcast, each thread does one memcpy. In the "push" version the src
+thread does THREADS memcpys. Since there is more explicit parallelism
+in a "pull", that is the default. For upc_all_reduceT(), "push" means
+that each thread writes its local result to the shared dst argument;
+"pull" means that the dst thread reads each thread's local result to
+compute the final result. No performance measurements have been made
+yet to compare these alternatives. upc_all_prefix_reduceT() and
+upc_all_sort() do not distinguish "push" and "pull".
+
+3) Algorithms
+
+The relocalization functions are implemented as simple copies. Tree-
+based recursive algorithms, or other more sophisticated approaches,
+are not used. Similarly, in upc_all_reduceT() the local "sums"
+are combined sequentially. upc_all_prefix_reduceT() is also uses a linear
+algorithm. Performance of this function is likely to suffer if the src
+and dst arrays "wrap" a lot, such as when their block size is small.
+The same is true if the affinities of the src and dst are different.
+The sort algorithm in upc_all_sort is the simplest possible and all
+sorting is done on thread 0. Users are advised to implement their
+own parallel sort if performance is a concern.
+
+4) Synchronization
+
+MYSYNC and ALLSYNC (IN and OUT) are all implemented as barriers.
+NOSYNC is implemented as no barrier, of course. upc_all_reduceT()
+has one internal barrier to synchronize access to the local "sums".
+upc_prefix_reduceT() has a minimum of three barriers. Two synchronize
+access to the "sums" and the third synchronizes the freeing of a
+dynamically allocated array. Two additional barriers are incurred
+for each "wrap" of the src array.
+
+5) Initialization
+
+An initialization function is provided. The first time a collective
+function is called the initialization function is called automatically.
+However, the initialization function currently does not do anything
+and it is safe to eliminate it.
+
+6) Argument checking
+
+If the _UPC_COLL_DEBUG macro is defined at compile time the
+upc_coll_err() function will be invoked before each call to a
+collective function. This function checks the single-valuedness of
+arguments to the collective function and it does a few other simple
+sanity checks. It uses two barriers to coordinate inter-thread
+checking. The results of the collective functions are not checked.
+
+7) Memory usage
+
+upc_all_reduceT(), upc_all_prefix_reduceT(), and upc_coll_err()
+dynamically allocate a block of memory proportional to the number of
+threads. That memory is freed on function exit.
+
+8) Compilation environment
+
+This set of functions can be compiled in both the dynamic and the
+static (fixed number of threads) environment.
+
+9) Limitations
+
+upc_all_prefix_reduceT() violates the collectives spec because it
+cannot handle the case of src and dst arguments that do not have
+the same phase. This condition is detected if argument checking is
+turned on.
+
+The PUSH version of upc_all_reduceT() has exhibited an instability
+on the Alphaserver platform due to Elan's handling of locks.
+
+10) Test programs
+
+Three small test programs are provided. try_all.c exercises all
+of the functions at least once, except only one instance of each
+of upc_all_reduceT() and upc_all_prefix_reduceT() is called.
+try_reduce.c and try_prefix.c exercise upc_all_reduceT() and
+upc_all_prefix_reduceT(). Compliance, correctness, and performance
+tests are not provided.
diff --git a/libgupc/collectives/upc_coll_reduce.in b/libgupc/collectives/upc_coll_reduce.in
new file mode 100644
index 00000000000..85950ed77f7
--- /dev/null
+++ b/libgupc/collectives/upc_coll_reduce.in
@@ -0,0 +1,476 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+/* The true set of function names is in upc_all_collectives.c */
+
+PREPROCESS_BEGIN
+void upc_all_reduce_GENERIC
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ _UPC_RED_T (*func) (_UPC_RED_T, _UPC_RED_T), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared _UPC_RED_T *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ _UPC_RED_T local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const _UPC_RED_T *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const _UPC_RED_T *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const _UPC_RED_T *) src + i);
+ }
+ break;
+
+#ifndef _UPC_NONINT_T
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result &= *((shared const _UPC_RED_T *) src + i);
+ break;
+
+ case UPC_OR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result |= *((shared const _UPC_RED_T *) src + i);
+ break;
+
+ case UPC_XOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result ^= *((shared const _UPC_RED_T *) src + i);
+ break;
+#endif // _UPC_NOINT_T
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const _UPC_RED_T *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const _UPC_RED_T *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const _UPC_RED_T *) src + i))
+ local_result = *((shared const _UPC_RED_T *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const _UPC_RED_T *) src + i))
+ local_result = *((shared const _UPC_RED_T *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const _UPC_RED_T *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const _UPC_RED_T *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (_UPC_RED_T));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared _UPC_RED_T *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared _UPC_RED_T *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared _UPC_RED_T *) dst) *= local_result;
+ break;
+#ifndef _UPC_NONINT_T
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared _UPC_RED_T *) dst) &= local_result;
+ break;
+ case UPC_OR:
+ *((shared _UPC_RED_T *) dst) |= local_result;
+ break;
+ case UPC_XOR:
+ *((shared _UPC_RED_T *) dst) ^= local_result;
+ break;
+#endif // _UPC_NOINT_T
+ case UPC_LOGAND:
+ *((shared _UPC_RED_T *) dst) =
+ *((shared _UPC_RED_T *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared _UPC_RED_T *) dst) =
+ *((shared _UPC_RED_T *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared _UPC_RED_T *) dst))
+ *((shared _UPC_RED_T *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared _UPC_RED_T *) dst))
+ *((shared _UPC_RED_T *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared _UPC_RED_T *) dst) =
+ func (local_result, *((shared _UPC_RED_T *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared _UPC_RED_T *) dst) =
+ func (local_result, *((shared _UPC_RED_T *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared _UPC_RED_T *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared _UPC_RED_T *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared _UPC_RED_T *) dst) *= shared_result[i];
+ break;
+#ifndef _UPC_NONINT_T
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared _UPC_RED_T *) dst) &= shared_result[i];
+ break;
+ case UPC_OR:
+ *((shared _UPC_RED_T *) dst) |= shared_result[i];
+ break;
+ case UPC_XOR:
+ *((shared _UPC_RED_T *) dst) ^= shared_result[i];
+ break;
+#endif
+ case UPC_LOGAND:
+ *((shared _UPC_RED_T *) dst) =
+ *((shared _UPC_RED_T *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared _UPC_RED_T *) dst) =
+ *((shared _UPC_RED_T *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared _UPC_RED_T *) dst))
+ *((shared _UPC_RED_T *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared _UPC_RED_T *) dst))
+ *((shared _UPC_RED_T *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared _UPC_RED_T *) dst) = func (shared_result[i],
+ *((shared _UPC_RED_T *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared _UPC_RED_T *) dst) = func (shared_result[i],
+ *((shared _UPC_RED_T *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
diff --git a/libgupc/collectives/upc_coll_reduce.upc b/libgupc/collectives/upc_coll_reduce.upc
new file mode 100644
index 00000000000..2f8bc8a495c
--- /dev/null
+++ b/libgupc/collectives/upc_coll_reduce.upc
@@ -0,0 +1,4296 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+/* The true set of function names is in upc_all_collectives.c */
+
+
+void upc_all_reduceC
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed char (*func) (signed char, signed char), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared signed char *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ signed char local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const signed char *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const signed char *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const signed char *) src + i);
+ }
+ break;
+
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result &= *((shared const signed char *) src + i);
+ break;
+
+ case UPC_OR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result |= *((shared const signed char *) src + i);
+ break;
+
+ case UPC_XOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result ^= *((shared const signed char *) src + i);
+ break;
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const signed char *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const signed char *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const signed char *) src + i))
+ local_result = *((shared const signed char *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const signed char *) src + i))
+ local_result = *((shared const signed char *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const signed char *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const signed char *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (signed char));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared signed char *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared signed char *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared signed char *) dst) *= local_result;
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared signed char *) dst) &= local_result;
+ break;
+ case UPC_OR:
+ *((shared signed char *) dst) |= local_result;
+ break;
+ case UPC_XOR:
+ *((shared signed char *) dst) ^= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared signed char *) dst) =
+ *((shared signed char *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared signed char *) dst) =
+ *((shared signed char *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared signed char *) dst))
+ *((shared signed char *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared signed char *) dst))
+ *((shared signed char *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared signed char *) dst) =
+ func (local_result, *((shared signed char *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared signed char *) dst) =
+ func (local_result, *((shared signed char *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared signed char *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared signed char *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared signed char *) dst) *= shared_result[i];
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared signed char *) dst) &= shared_result[i];
+ break;
+ case UPC_OR:
+ *((shared signed char *) dst) |= shared_result[i];
+ break;
+ case UPC_XOR:
+ *((shared signed char *) dst) ^= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared signed char *) dst) =
+ *((shared signed char *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared signed char *) dst) =
+ *((shared signed char *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared signed char *) dst))
+ *((shared signed char *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared signed char *) dst))
+ *((shared signed char *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared signed char *) dst) = func (shared_result[i],
+ *((shared signed char *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared signed char *) dst) = func (shared_result[i],
+ *((shared signed char *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceUC
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned char (*func) (unsigned char, unsigned char), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared unsigned char *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ unsigned char local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const unsigned char *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const unsigned char *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const unsigned char *) src + i);
+ }
+ break;
+
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result &= *((shared const unsigned char *) src + i);
+ break;
+
+ case UPC_OR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result |= *((shared const unsigned char *) src + i);
+ break;
+
+ case UPC_XOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result ^= *((shared const unsigned char *) src + i);
+ break;
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const unsigned char *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const unsigned char *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const unsigned char *) src + i))
+ local_result = *((shared const unsigned char *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const unsigned char *) src + i))
+ local_result = *((shared const unsigned char *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const unsigned char *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const unsigned char *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (unsigned char));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared unsigned char *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared unsigned char *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared unsigned char *) dst) *= local_result;
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared unsigned char *) dst) &= local_result;
+ break;
+ case UPC_OR:
+ *((shared unsigned char *) dst) |= local_result;
+ break;
+ case UPC_XOR:
+ *((shared unsigned char *) dst) ^= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared unsigned char *) dst) =
+ *((shared unsigned char *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared unsigned char *) dst) =
+ *((shared unsigned char *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared unsigned char *) dst))
+ *((shared unsigned char *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared unsigned char *) dst))
+ *((shared unsigned char *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared unsigned char *) dst) =
+ func (local_result, *((shared unsigned char *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared unsigned char *) dst) =
+ func (local_result, *((shared unsigned char *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared unsigned char *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared unsigned char *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared unsigned char *) dst) *= shared_result[i];
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared unsigned char *) dst) &= shared_result[i];
+ break;
+ case UPC_OR:
+ *((shared unsigned char *) dst) |= shared_result[i];
+ break;
+ case UPC_XOR:
+ *((shared unsigned char *) dst) ^= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared unsigned char *) dst) =
+ *((shared unsigned char *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared unsigned char *) dst) =
+ *((shared unsigned char *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared unsigned char *) dst))
+ *((shared unsigned char *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared unsigned char *) dst))
+ *((shared unsigned char *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared unsigned char *) dst) = func (shared_result[i],
+ *((shared unsigned char *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared unsigned char *) dst) = func (shared_result[i],
+ *((shared unsigned char *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceS
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed short (*func) (signed short, signed short), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared signed short *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ signed short local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const signed short *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const signed short *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const signed short *) src + i);
+ }
+ break;
+
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result &= *((shared const signed short *) src + i);
+ break;
+
+ case UPC_OR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result |= *((shared const signed short *) src + i);
+ break;
+
+ case UPC_XOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result ^= *((shared const signed short *) src + i);
+ break;
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const signed short *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const signed short *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const signed short *) src + i))
+ local_result = *((shared const signed short *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const signed short *) src + i))
+ local_result = *((shared const signed short *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const signed short *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const signed short *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (signed short));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared signed short *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared signed short *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared signed short *) dst) *= local_result;
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared signed short *) dst) &= local_result;
+ break;
+ case UPC_OR:
+ *((shared signed short *) dst) |= local_result;
+ break;
+ case UPC_XOR:
+ *((shared signed short *) dst) ^= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared signed short *) dst) =
+ *((shared signed short *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared signed short *) dst) =
+ *((shared signed short *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared signed short *) dst))
+ *((shared signed short *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared signed short *) dst))
+ *((shared signed short *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared signed short *) dst) =
+ func (local_result, *((shared signed short *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared signed short *) dst) =
+ func (local_result, *((shared signed short *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared signed short *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared signed short *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared signed short *) dst) *= shared_result[i];
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared signed short *) dst) &= shared_result[i];
+ break;
+ case UPC_OR:
+ *((shared signed short *) dst) |= shared_result[i];
+ break;
+ case UPC_XOR:
+ *((shared signed short *) dst) ^= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared signed short *) dst) =
+ *((shared signed short *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared signed short *) dst) =
+ *((shared signed short *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared signed short *) dst))
+ *((shared signed short *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared signed short *) dst))
+ *((shared signed short *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared signed short *) dst) = func (shared_result[i],
+ *((shared signed short *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared signed short *) dst) = func (shared_result[i],
+ *((shared signed short *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceUS
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned short (*func) (unsigned short, unsigned short), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared unsigned short *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ unsigned short local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const unsigned short *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const unsigned short *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const unsigned short *) src + i);
+ }
+ break;
+
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result &= *((shared const unsigned short *) src + i);
+ break;
+
+ case UPC_OR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result |= *((shared const unsigned short *) src + i);
+ break;
+
+ case UPC_XOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result ^= *((shared const unsigned short *) src + i);
+ break;
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const unsigned short *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const unsigned short *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const unsigned short *) src + i))
+ local_result = *((shared const unsigned short *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const unsigned short *) src + i))
+ local_result = *((shared const unsigned short *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const unsigned short *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const unsigned short *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (unsigned short));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared unsigned short *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared unsigned short *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared unsigned short *) dst) *= local_result;
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared unsigned short *) dst) &= local_result;
+ break;
+ case UPC_OR:
+ *((shared unsigned short *) dst) |= local_result;
+ break;
+ case UPC_XOR:
+ *((shared unsigned short *) dst) ^= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared unsigned short *) dst) =
+ *((shared unsigned short *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared unsigned short *) dst) =
+ *((shared unsigned short *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared unsigned short *) dst))
+ *((shared unsigned short *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared unsigned short *) dst))
+ *((shared unsigned short *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared unsigned short *) dst) =
+ func (local_result, *((shared unsigned short *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared unsigned short *) dst) =
+ func (local_result, *((shared unsigned short *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared unsigned short *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared unsigned short *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared unsigned short *) dst) *= shared_result[i];
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared unsigned short *) dst) &= shared_result[i];
+ break;
+ case UPC_OR:
+ *((shared unsigned short *) dst) |= shared_result[i];
+ break;
+ case UPC_XOR:
+ *((shared unsigned short *) dst) ^= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared unsigned short *) dst) =
+ *((shared unsigned short *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared unsigned short *) dst) =
+ *((shared unsigned short *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared unsigned short *) dst))
+ *((shared unsigned short *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared unsigned short *) dst))
+ *((shared unsigned short *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared unsigned short *) dst) = func (shared_result[i],
+ *((shared unsigned short *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared unsigned short *) dst) = func (shared_result[i],
+ *((shared unsigned short *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceI
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed int (*func) (signed int, signed int), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared signed int *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ signed int local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const signed int *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const signed int *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const signed int *) src + i);
+ }
+ break;
+
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result &= *((shared const signed int *) src + i);
+ break;
+
+ case UPC_OR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result |= *((shared const signed int *) src + i);
+ break;
+
+ case UPC_XOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result ^= *((shared const signed int *) src + i);
+ break;
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const signed int *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const signed int *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const signed int *) src + i))
+ local_result = *((shared const signed int *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const signed int *) src + i))
+ local_result = *((shared const signed int *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const signed int *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const signed int *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (signed int));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared signed int *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared signed int *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared signed int *) dst) *= local_result;
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared signed int *) dst) &= local_result;
+ break;
+ case UPC_OR:
+ *((shared signed int *) dst) |= local_result;
+ break;
+ case UPC_XOR:
+ *((shared signed int *) dst) ^= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared signed int *) dst) =
+ *((shared signed int *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared signed int *) dst) =
+ *((shared signed int *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared signed int *) dst))
+ *((shared signed int *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared signed int *) dst))
+ *((shared signed int *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared signed int *) dst) =
+ func (local_result, *((shared signed int *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared signed int *) dst) =
+ func (local_result, *((shared signed int *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared signed int *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared signed int *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared signed int *) dst) *= shared_result[i];
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared signed int *) dst) &= shared_result[i];
+ break;
+ case UPC_OR:
+ *((shared signed int *) dst) |= shared_result[i];
+ break;
+ case UPC_XOR:
+ *((shared signed int *) dst) ^= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared signed int *) dst) =
+ *((shared signed int *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared signed int *) dst) =
+ *((shared signed int *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared signed int *) dst))
+ *((shared signed int *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared signed int *) dst))
+ *((shared signed int *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared signed int *) dst) = func (shared_result[i],
+ *((shared signed int *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared signed int *) dst) = func (shared_result[i],
+ *((shared signed int *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceUI
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned int (*func) (unsigned int, unsigned int), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared unsigned int *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ unsigned int local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const unsigned int *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const unsigned int *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const unsigned int *) src + i);
+ }
+ break;
+
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result &= *((shared const unsigned int *) src + i);
+ break;
+
+ case UPC_OR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result |= *((shared const unsigned int *) src + i);
+ break;
+
+ case UPC_XOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result ^= *((shared const unsigned int *) src + i);
+ break;
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const unsigned int *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const unsigned int *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const unsigned int *) src + i))
+ local_result = *((shared const unsigned int *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const unsigned int *) src + i))
+ local_result = *((shared const unsigned int *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const unsigned int *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const unsigned int *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (unsigned int));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared unsigned int *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared unsigned int *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared unsigned int *) dst) *= local_result;
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared unsigned int *) dst) &= local_result;
+ break;
+ case UPC_OR:
+ *((shared unsigned int *) dst) |= local_result;
+ break;
+ case UPC_XOR:
+ *((shared unsigned int *) dst) ^= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared unsigned int *) dst) =
+ *((shared unsigned int *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared unsigned int *) dst) =
+ *((shared unsigned int *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared unsigned int *) dst))
+ *((shared unsigned int *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared unsigned int *) dst))
+ *((shared unsigned int *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared unsigned int *) dst) =
+ func (local_result, *((shared unsigned int *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared unsigned int *) dst) =
+ func (local_result, *((shared unsigned int *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared unsigned int *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared unsigned int *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared unsigned int *) dst) *= shared_result[i];
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared unsigned int *) dst) &= shared_result[i];
+ break;
+ case UPC_OR:
+ *((shared unsigned int *) dst) |= shared_result[i];
+ break;
+ case UPC_XOR:
+ *((shared unsigned int *) dst) ^= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared unsigned int *) dst) =
+ *((shared unsigned int *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared unsigned int *) dst) =
+ *((shared unsigned int *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared unsigned int *) dst))
+ *((shared unsigned int *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared unsigned int *) dst))
+ *((shared unsigned int *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared unsigned int *) dst) = func (shared_result[i],
+ *((shared unsigned int *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared unsigned int *) dst) = func (shared_result[i],
+ *((shared unsigned int *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceL
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed long (*func) (signed long, signed long), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared signed long *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ signed long local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const signed long *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const signed long *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const signed long *) src + i);
+ }
+ break;
+
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result &= *((shared const signed long *) src + i);
+ break;
+
+ case UPC_OR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result |= *((shared const signed long *) src + i);
+ break;
+
+ case UPC_XOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result ^= *((shared const signed long *) src + i);
+ break;
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const signed long *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const signed long *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const signed long *) src + i))
+ local_result = *((shared const signed long *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const signed long *) src + i))
+ local_result = *((shared const signed long *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const signed long *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const signed long *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (signed long));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared signed long *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared signed long *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared signed long *) dst) *= local_result;
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared signed long *) dst) &= local_result;
+ break;
+ case UPC_OR:
+ *((shared signed long *) dst) |= local_result;
+ break;
+ case UPC_XOR:
+ *((shared signed long *) dst) ^= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared signed long *) dst) =
+ *((shared signed long *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared signed long *) dst) =
+ *((shared signed long *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared signed long *) dst))
+ *((shared signed long *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared signed long *) dst))
+ *((shared signed long *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared signed long *) dst) =
+ func (local_result, *((shared signed long *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared signed long *) dst) =
+ func (local_result, *((shared signed long *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared signed long *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared signed long *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared signed long *) dst) *= shared_result[i];
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared signed long *) dst) &= shared_result[i];
+ break;
+ case UPC_OR:
+ *((shared signed long *) dst) |= shared_result[i];
+ break;
+ case UPC_XOR:
+ *((shared signed long *) dst) ^= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared signed long *) dst) =
+ *((shared signed long *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared signed long *) dst) =
+ *((shared signed long *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared signed long *) dst))
+ *((shared signed long *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared signed long *) dst))
+ *((shared signed long *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared signed long *) dst) = func (shared_result[i],
+ *((shared signed long *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared signed long *) dst) = func (shared_result[i],
+ *((shared signed long *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceUL
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned long (*func) (unsigned long, unsigned long), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared unsigned long *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ unsigned long local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const unsigned long *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const unsigned long *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const unsigned long *) src + i);
+ }
+ break;
+
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result &= *((shared const unsigned long *) src + i);
+ break;
+
+ case UPC_OR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result |= *((shared const unsigned long *) src + i);
+ break;
+
+ case UPC_XOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result ^= *((shared const unsigned long *) src + i);
+ break;
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const unsigned long *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const unsigned long *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const unsigned long *) src + i))
+ local_result = *((shared const unsigned long *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const unsigned long *) src + i))
+ local_result = *((shared const unsigned long *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const unsigned long *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const unsigned long *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (unsigned long));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared unsigned long *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared unsigned long *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared unsigned long *) dst) *= local_result;
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared unsigned long *) dst) &= local_result;
+ break;
+ case UPC_OR:
+ *((shared unsigned long *) dst) |= local_result;
+ break;
+ case UPC_XOR:
+ *((shared unsigned long *) dst) ^= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared unsigned long *) dst) =
+ *((shared unsigned long *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared unsigned long *) dst) =
+ *((shared unsigned long *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared unsigned long *) dst))
+ *((shared unsigned long *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared unsigned long *) dst))
+ *((shared unsigned long *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared unsigned long *) dst) =
+ func (local_result, *((shared unsigned long *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared unsigned long *) dst) =
+ func (local_result, *((shared unsigned long *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared unsigned long *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared unsigned long *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared unsigned long *) dst) *= shared_result[i];
+ break;
+ // Skip if not integral type, per spec 4.3.1.1
+ // (See additional comments in upc_collective.c)
+ case UPC_AND:
+ *((shared unsigned long *) dst) &= shared_result[i];
+ break;
+ case UPC_OR:
+ *((shared unsigned long *) dst) |= shared_result[i];
+ break;
+ case UPC_XOR:
+ *((shared unsigned long *) dst) ^= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared unsigned long *) dst) =
+ *((shared unsigned long *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared unsigned long *) dst) =
+ *((shared unsigned long *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared unsigned long *) dst))
+ *((shared unsigned long *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared unsigned long *) dst))
+ *((shared unsigned long *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared unsigned long *) dst) = func (shared_result[i],
+ *((shared unsigned long *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared unsigned long *) dst) = func (shared_result[i],
+ *((shared unsigned long *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceF
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ float (*func) (float, float), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared float *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ float local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const float *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const float *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const float *) src + i);
+ }
+ break;
+
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const float *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const float *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const float *) src + i))
+ local_result = *((shared const float *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const float *) src + i))
+ local_result = *((shared const float *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const float *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const float *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (float));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared float *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared float *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared float *) dst) *= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared float *) dst) =
+ *((shared float *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared float *) dst) =
+ *((shared float *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared float *) dst))
+ *((shared float *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared float *) dst))
+ *((shared float *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared float *) dst) =
+ func (local_result, *((shared float *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared float *) dst) =
+ func (local_result, *((shared float *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared float *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared float *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared float *) dst) *= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared float *) dst) =
+ *((shared float *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared float *) dst) =
+ *((shared float *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared float *) dst))
+ *((shared float *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared float *) dst))
+ *((shared float *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared float *) dst) = func (shared_result[i],
+ *((shared float *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared float *) dst) = func (shared_result[i],
+ *((shared float *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceD
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ double (*func) (double, double), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared double *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ double local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const double *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const double *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const double *) src + i);
+ }
+ break;
+
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const double *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const double *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const double *) src + i))
+ local_result = *((shared const double *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const double *) src + i))
+ local_result = *((shared const double *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const double *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const double *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (double));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared double *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared double *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared double *) dst) *= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared double *) dst) =
+ *((shared double *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared double *) dst) =
+ *((shared double *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared double *) dst))
+ *((shared double *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared double *) dst))
+ *((shared double *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared double *) dst) =
+ func (local_result, *((shared double *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared double *) dst) =
+ func (local_result, *((shared double *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared double *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared double *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared double *) dst) *= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared double *) dst) =
+ *((shared double *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared double *) dst) =
+ *((shared double *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared double *) dst))
+ *((shared double *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared double *) dst))
+ *((shared double *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared double *) dst) = func (shared_result[i],
+ *((shared double *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared double *) dst) = func (shared_result[i],
+ *((shared double *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
+
+void upc_all_reduceLD
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ long double (*func) (long double, long double), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared vector and copy the local result to that vector.
+ barrier
+ The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+ Determine how many src elements are contained on each thread.
+ Reduce the elements local to this thread.
+ Allocate a shared lock and a shared counter to control access to dst.
+ barrier
+ Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+ // pointer to shared vector of local results
+ shared long double *shared_result;
+#endif
+#ifdef PUSH
+ // lock for controlling access to dst
+ upc_lock_t *dst_lock;
+ shared int *dst_lock_cnt;
+#endif
+
+ int i,
+ n_local,
+ full_rows,
+ last_row,
+ num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+ int *elem_cnt_on_thr;
+
+ long double local_result = 0;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ // Compute n_local, the number of elements local to this thread.
+ // Also compute start, the starting index of src for each thread.
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ // We need to figure out which threads contain src elements.
+ // The most complex case to deal with is the one in which only a proper
+ // subset of threads contains src elements and the dst thread is not
+ // among them. Each thread can locally determine how many src
+ // elements are on all threads so this is computed locally to
+ // avoid an exchange of data among threads.
+
+ elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+ // The number of threads with at least one local element.
+ num_thr = 0;
+
+ // nelems plus the number of virtual elements in first row
+ velems = nelems + src_thr * blk_size + ph;
+
+ // Include virtual elements when computing num of local elems
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ for (thr = 0; thr < THREADS; ++thr)
+ {
+ if (blk_size > 0)
+ {
+ if (thr <= tail_thr)
+ if (thr == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ // Adjust the number of elements in this thread, if necessary.
+ if (thr < src_thr)
+ n_local -= blk_size;
+ else if (thr == src_thr)
+ n_local -= ph;
+ }
+ else // blk_size == 0
+ {
+ n_local = 0;
+ if (src_thr == thr) // revise the number of local elements
+ n_local = nelems;
+ }
+
+ if (n_local > 0)
+ ++num_thr;
+
+ elem_cnt_on_thr[thr] = n_local;
+ }
+
+ n_local = elem_cnt_on_thr[MYTHREAD];
+
+ // Starting index for this thread
+ // Note: start is sometimes negative because src is
+ // addressed here as if its block size is 1.
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else // This is the source thread
+ start = 0;
+ else // blk_size == 0
+ start = 0;
+
+ // Reduce the elements local to this thread.
+
+ if (n_local > 0)
+ local_result = *((shared const long double *) src + start);
+
+ switch (op)
+ {
+ case UPC_ADD:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result += *((shared const long double *) src + i);
+ }
+ break;
+
+ case UPC_MULT:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ {
+ local_result *= *((shared const long double *) src + i);
+ }
+ break;
+
+
+ case UPC_LOGAND:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result && *((shared const long double *) src + i);
+ break;
+
+ case UPC_LOGOR:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = local_result || *((shared const long double *) src + i);
+ break;
+
+ case UPC_MIN:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result > *((shared const long double *) src + i))
+ local_result = *((shared const long double *) src + i);
+ break;
+
+ case UPC_MAX:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ if (local_result < *((shared const long double *) src + i))
+ local_result = *((shared const long double *) src + i);
+ break;
+
+ case UPC_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const long double *) src + i));
+ break;
+
+ case UPC_NONCOMM_FUNC:
+ for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+ local_result = func (local_result,
+ *((shared const long double *) src + i));
+ break;
+ }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+ // Allocate shared vector to store local results;
+ shared_result = upc_all_alloc (THREADS, sizeof (long double));
+ if (n_local > 0)
+ shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+ dst_lock = upc_all_lock_alloc ();
+ dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+ if (MYTHREAD == dst_thr)
+ *dst_lock_cnt = 0;
+#endif // PUSH
+
+ // Make sure all threads are ready to combine their results.
+
+ upc_barrier;
+
+#ifdef PUSH
+
+ if (n_local > 0)
+ {
+ upc_lock (dst_lock);
+
+ if (*dst_lock_cnt == 0)
+ // initialize dst
+ *((shared long double *) dst) = local_result;
+ else
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared long double *) dst) += local_result;
+ break;
+ case UPC_MULT:
+ *((shared long double *) dst) *= local_result;
+ break;
+ case UPC_LOGAND:
+ *((shared long double *) dst) =
+ *((shared long double *) dst) && local_result;
+ break;
+ case UPC_LOGOR:
+ *((shared long double *) dst) =
+ *((shared long double *) dst) || local_result;
+ break;
+ case UPC_MIN:
+ if (local_result < *((shared long double *) dst))
+ *((shared long double *) dst) = local_result;
+ break;
+ case UPC_MAX:
+ if (local_result > *((shared long double *) dst))
+ *((shared long double *) dst) = local_result;
+ break;
+ case UPC_FUNC:
+ *((shared long double *) dst) =
+ func (local_result, *((shared long double *) dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared long double *) dst) =
+ func (local_result, *((shared long double *) dst));
+ break;
+ } // else
+
+ ++*dst_lock_cnt;
+
+ if (*dst_lock_cnt == num_thr)
+ {
+ upc_unlock (dst_lock);
+ upc_lock_free (dst_lock);
+ upc_free (dst_lock_cnt);
+ }
+ else
+ upc_unlock (dst_lock);
+ }
+
+#endif // PUSH
+
+#ifdef PULL
+ if (MYTHREAD == dst_thr)
+ {
+ // initialize dst to the first non-null result
+ i = 0;
+ while (elem_cnt_on_thr[i] == 0)
+ ++i;
+
+ *((shared long double *) dst) = shared_result[i];
+
+ ++i;
+
+ for (; i < THREADS; ++i)
+ {
+ // Pull values only from threads where n_local>0.
+ if (elem_cnt_on_thr[i] > 0)
+ {
+ switch (op)
+ {
+ case UPC_ADD:
+ *((shared long double *) dst) += shared_result[i];
+ break;
+ case UPC_MULT:
+ *((shared long double *) dst) *= shared_result[i];
+ break;
+ case UPC_LOGAND:
+ *((shared long double *) dst) =
+ *((shared long double *) dst) && shared_result[i];
+ break;
+ case UPC_LOGOR:
+ *((shared long double *) dst) =
+ *((shared long double *) dst) || shared_result[i];
+ break;
+ case UPC_MIN:
+ if (shared_result[i] < *((shared long double *) dst))
+ *((shared long double *) dst) = shared_result[i];
+ break;
+ case UPC_MAX:
+ if (shared_result[i] > *((shared long double *) dst))
+ *((shared long double *) dst) = shared_result[i];
+ break;
+ case UPC_FUNC:
+ *((shared long double *) dst) = func (shared_result[i],
+ *((shared long double *)
+ dst));
+ break;
+ case UPC_NONCOMM_FUNC:
+ *((shared long double *) dst) = func (shared_result[i],
+ *((shared long double *)
+ dst));
+ break;
+ }
+ }
+ }
+ upc_free (shared_result);
+ }
+#endif // PULL
+
+ free (elem_cnt_on_thr);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+ upc_barrier;
+}
diff --git a/libgupc/collectives/upc_coll_scatter.upc b/libgupc/collectives/upc_coll_scatter.upc
new file mode 100644
index 00000000000..72e0f5ab2f0
--- /dev/null
+++ b/libgupc/collectives/upc_coll_scatter.upc
@@ -0,0 +1,128 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+void
+upc_all_scatter (shared void *dst,
+ shared const void *src, size_t nbytes, upc_flag_t sync_mode)
+{
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PUSH
+ int i;
+#endif
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, nbytes, sync_mode, 0, 0, 0, UPC_SCAT);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+#ifdef PULL
+
+ // Each thread "pulls" the data from the src thread.
+
+ upc_memcpy ((shared char *) dst + MYTHREAD,
+ (shared char *) src + nbytes * MYTHREAD * THREADS, nbytes);
+
+#endif
+
+#ifdef PUSH
+
+ // The src thread "pushes" the data to each destination.
+
+ if (upc_threadof ((shared void *) src) == MYTHREAD)
+ {
+ for (i = 0; i < THREADS; ++i)
+ {
+ upc_memcpy ((shared char *) dst + i,
+ (shared char *) src + nbytes * i * THREADS, nbytes);
+ }
+ }
+
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+}
diff --git a/libgupc/collectives/upc_coll_sort.upc b/libgupc/collectives/upc_coll_sort.upc
new file mode 100644
index 00000000000..20ffaad6dda
--- /dev/null
+++ b/libgupc/collectives/upc_coll_sort.upc
@@ -0,0 +1,147 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+static
+shared void *
+Asub (shared void *A, int i, size_t elem_size, size_t blk_size)
+// Compute &A[i] given &A[0] and the element and block sizes of A.
+{
+ shared char *base;
+ int j, k, r, p, q;
+
+ base = (shared char *) A - upc_threadof (A); // corres. addr on thr 0
+ p = upc_phaseof (A); // phase of A
+ j = i + p + upc_threadof (A) * blk_size; // j is i relative to base
+ k = (j / blk_size) % THREADS; // element j is on thread k
+ r = j - k * blk_size; // r is corres. index on thr 0
+ q = r / (blk_size * THREADS); // number of blocks preceding r
+
+ return base + (q * blk_size + j % blk_size - p) * elem_size * THREADS + k;
+}
+
+void
+upc_all_sort (shared void *A,
+ size_t elem_size,
+ size_t nelems,
+ size_t blk_size,
+ int (*func) (shared void *, shared void *),
+ upc_flag_t sync_mode)
+{
+ const int nelems_m1 = (int)nelems - 1;
+ int i, j;
+ shared char *Aj, *Ajp1, *tmp;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (A, NULL, NULL, elem_size, sync_mode, blk_size,
+ nelems, 0, UPC_SORT);
+#endif
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+ upc_barrier;
+
+ if (MYTHREAD == 0)
+ tmp = upc_alloc (elem_size);
+
+ // Thread 0 does a bubble sort.
+ if (MYTHREAD == 0)
+ for (i = 0; i < nelems_m1; ++i)
+ for (j = 0; j < nelems_m1 - i; ++j)
+ {
+ // compute addresses of A[j] and A[j+1]
+
+ Aj = (shared char *) Asub (A, j, elem_size, blk_size);
+ Ajp1 = (shared char *) Asub (A, j + 1, elem_size, blk_size);
+
+ if (func ((shared void *) Aj, (shared void *) Ajp1) > 0)
+
+ { // swap array elements
+ upc_memcpy (tmp, (shared const void *) Aj, elem_size);
+ upc_memcpy (Aj, (shared const void *) Ajp1, elem_size);
+ upc_memcpy (Ajp1, (shared const void *) tmp, elem_size);
+ }
+ }
+
+ if (MYTHREAD == 0)
+ upc_free (tmp);
+
+ // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+}
diff --git a/libgupc/config.h.in b/libgupc/config.h.in
new file mode 100644
index 00000000000..7dde76f2672
--- /dev/null
+++ b/libgupc/config.h.in
@@ -0,0 +1,457 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+ 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 2, 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 COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+#ifndef __CONFIG_H__
+#define __CONFIG_H__ 1
+
+
+//begin gupcr_config_h
+
+/* Define path to preferred addr2line for backtrace */
+#undef GUPCR_BACKTRACE_ADDR2LINE
+
+/* Define path to preferred GDB for backtrace */
+#undef GUPCR_BACKTRACE_GDB
+
+/* Define to preferred signal for UPC backtrace. */
+#undef GUPCR_BACKTRACE_SIGNAL
+
+/* Size of get/put bounce buffer */
+#undef GUPCR_BOUNCE_BUFFER_SIZE
+
+/* upc_global_exit() timeout in seconds. */
+#undef GUPCR_GLOBAL_EXIT_TIMEOUT
+
+/* Define to 1 if UPC runtime checks are supported. */
+#undef GUPCR_HAVE_CHECKS
+
+/* Define to 1 if UPC runtime debugging mode is enabled. */
+#undef GUPCR_HAVE_DEBUG
+
+/* Define if UPC GUM debug server is supported. */
+#undef GUPCR_HAVE_GUM_DEBUG
+
+/* Define to 1 if UPC runtime statistics collection is supported. */
+#undef GUPCR_HAVE_STATS
+
+/* Define to 1 if UPC runtime tracing is supported. */
+#undef GUPCR_HAVE_TRACE
+
+/* Name of section that holds an array of addresses that points to the UPC
+ initialization routines. */
+#undef GUPCR_INIT_ARRAY_SECTION_NAME
+
+/* Use SLURM for UPC Portals4 job launcher */
+#undef GUPCR_JOB_LAUNCHER_SLURM
+
+/* Use YOD for UPC Portals4 job launcher */
+#undef GUPCR_JOB_LAUNCHER_YOD
+
+/* Maximum number of locks held per thread */
+#undef GUPCR_MAX_LOCKS
+
+/* Maximum number of outstanding remote puts */
+#undef GUPCR_MAX_OUTSTANDING_PUTS
+
+/* Target system memory page size. */
+#undef GUPCR_MEMORY_PAGE_SIZE
+
+/* Define to 1 if UPC runtime will use node local memory accesses. */
+#undef GUPCR_NODE_LOCAL_MEM
+
+/* Define to 1 if UPC node local access uses mmap-ed file. */
+#undef GUPCR_NODE_LOCAL_MEM_MMAP
+
+/* Define to 1 if UPC node local access uses Posix shared memory. */
+#undef GUPCR_NODE_LOCAL_MEM_POSIX
+
+/* Name of section used to hold information describing how a UPC source file
+ was compiled. */
+#undef GUPCR_PGM_INFO_SECTION_NAME
+
+/* Define to 1 if UPC runtime is based on Portals4. */
+#undef GUPCR_PORTALS_RUNTIME
+
+/* Portals4 PTE base index. */
+#undef GUPCR_PTE_BASE
+
+/* The required alignment for the UPC struct shared pointer representation. */
+#undef GUPCR_PTS_ALIGN
+
+/* Whether UPC pointers-to-shared use the 'packed' representation */
+#undef GUPCR_PTS_PACKED_REP
+
+/* Size of shared pointer's phase field (in bits) */
+#undef GUPCR_PTS_PHASE_SIZE
+
+/* The data type of the 'phase' field in a UPC shared pointer */
+#undef GUPCR_PTS_PHASE_TYPE
+
+/* Whether UPC shared pointers use the 'struct' representation */
+#undef GUPCR_PTS_STRUCT_REP
+
+/* Size of shared pointer's thread field (in bits) */
+#undef GUPCR_PTS_THREAD_SIZE
+
+/* The data type of the 'thread' field in a UPC shared pointer */
+#undef GUPCR_PTS_THREAD_TYPE
+
+/* Whether the 'vaddr' field comes first (ie, [[vaddr,thread,phase]]) */
+#undef GUPCR_PTS_VADDR_FIRST
+
+/* Size of shared pointer's vaddr field (in bits) */
+#undef GUPCR_PTS_VADDR_SIZE
+
+/* The data type of the 'vaddr' field in a UPC shared pointer */
+#undef GUPCR_PTS_VADDR_TYPE
+
+/* Name of section used to assign addresses to UPC shared data items. */
+#undef GUPCR_SHARED_SECTION_NAME
+
+/* Maximum number of children at each level of a collective operation tree. */
+#undef GUPCR_TREE_FANOUT
+
+/* Define to 1 if UPC runtime will use Portals4 triggered operations. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+
+//end gupcr_config_h
+
+/* Define to 1 if the target assembler supports .symver directive. */
+#undef HAVE_AS_SYMVER_DIRECTIVE
+
+/* Define to 1 if the target supports __attribute__((alias(...))). */
+#undef HAVE_ATTRIBUTE_ALIAS
+
+/* Define to 1 if the target supports __attribute__((dllexport)). */
+#undef HAVE_ATTRIBUTE_DLLEXPORT
+
+/* Define to 1 if the target supports __attribute__((visibility(...))). */
+#undef HAVE_ATTRIBUTE_VISIBILITY
+
+/* Define to 1 if you have the `backtrace' function. */
+#undef HAVE_BACKTRACE
+
+/* Define to 1 if you have the `backtrace_symbols' function. */
+#undef HAVE_BACKTRACE_SYMBOLS
+
+/* Define to 1 if you have the `backtrace_symbols_fd' function. */
+#undef HAVE_BACKTRACE_SYMBOLS_FD
+
+/* Define if the POSIX Semaphores do not work on your system. */
+#undef HAVE_BROKEN_POSIX_SEMAPHORES
+
+/* Define to 1 if the target assembler supports thread-local storage. */
+#undef HAVE_CC_TLS
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SYS_SIGLIST
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#undef HAVE_EXECINFO_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `ftruncate' function. */
+#undef HAVE_FTRUNCATE
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `gethostbyname' function. */
+#undef HAVE_GETHOSTBYNAME
+
+/* Define to 1 if you have the `gethostname' function. */
+#undef HAVE_GETHOSTNAME
+
+/* Define to 1 if you have the `getloadavg' function. */
+#undef HAVE_GETLOADAVG
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define if the compiler has a thread header that is non single. */
+#undef HAVE_GTHR_DEFAULT
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `mkdir' function. */
+#undef HAVE_MKDIR
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the `munmap' function. */
+#undef HAVE_MUNMAP
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define to 1 if pthread_{,attr_}{g,s}etaffinity_np is supported. */
+#undef HAVE_PTHREAD_AFFINITY_NP
+
+/* Define to 1 if the system has the type `ptrdiff_t'. */
+#undef HAVE_PTRDIFF_T
+
+/* Define to 1 if you have the <sched.h> header file. */
+#undef HAVE_SCHED_H
+
+/* Define to 1 if you have the <semaphore.h> header file. */
+#undef HAVE_SEMAPHORE_H
+
+/* Define to 1 if you have the 'shm_open' function. */
+#undef HAVE_SHM_OPEN
+
+/* Define to 1 if you have the `socket' function. */
+#undef HAVE_SOCKET
+
+/* Define to 1 if `stat' has the bug that it succeeds when given the
+ zero-length file name argument. */
+#undef HAVE_STAT_EMPTY_STRING_BUG
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the `strtoull' function. */
+#undef HAVE_STRTOULL
+
+/* Define to 1 if the target supports __sync_*_compare_and_swap. */
+#undef HAVE_SYNC_BUILTINS
+
+/* Define to 1 if the compiler provides the __sync_fetch_and_add function for
+ uint32 */
+#undef HAVE_SYNC_FETCH_AND_ADD_4
+
+/* Define to 1 if the compiler provides the __sync_fetch_and_add function for
+ uint64 */
+#undef HAVE_SYNC_FETCH_AND_ADD_8
+
+/* Define to 1 if you have the <sys/loadavg.h> header file. */
+#undef HAVE_SYS_LOADAVG_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if the target supports thread-local storage. */
+#undef HAVE_TLS
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if UPC backtrace is enabled. */
+#undef HAVE_UPC_BACKTRACE
+
+/* Define to 1 if UPC backtrace with ADDR2LINE is enabled. */
+#undef HAVE_UPC_BACKTRACE_ADDR2LINE
+
+/* Define to 1 if UPC backtrace with GDB is enabled. */
+#undef HAVE_UPC_BACKTRACE_GDB
+
+/* Define to 1 if UPC backtrace signal is enabled. */
+#undef HAVE_UPC_BACKTRACE_SIGNAL
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* Define to 1 if GNU symbol versioning is used for libgupc. */
+#undef LIBGUPC_GNU_SYMBOL_VERSIONING
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+ slash. */
+#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `char', as computed by sizeof. */
+#undef SIZEOF_CHAR
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
+
+/* The size of `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if you can safely include both <string.h> and <strings.h>. */
+#undef STRING_WITH_STRINGS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `long int' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to 1 if UPC link script is supported. */
+#undef use_upc_link_script
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
+
+/* Define to empty if the keyword `volatile' does not work. Warning: valid
+ code using `volatile' can become incorrect without. Disable with care. */
+#undef volatile
+
+
+#ifndef ARG_UNUSED
+# define ARG_UNUSED(NAME) NAME __attribute__ ((__unused__))
+#endif
+
+
+
+#endif /* __CONFIG_H__ */
+
diff --git a/libgupc/config/darwin/upc-crt-config.h b/libgupc/config/darwin/upc-crt-config.h
new file mode 100644
index 00000000000..2fa35d13046
--- /dev/null
+++ b/libgupc/config/darwin/upc-crt-config.h
@@ -0,0 +1,30 @@
+#define _XSTR(X) #X
+#define _STR(S) _XSTR(S)
+
+#define DARWIN_DEF_SECT_SYM(TYPE, SECT, SUFFIX) \
+ __asm__ (".globl ___" _STR(SECT) "_" _STR(SUFFIX) "\n" \
+ "\t.section __" _STR(TYPE) "," _STR(SECT) "\n" \
+ "___" _STR(SECT) "_" _STR(SUFFIX) ":\n")
+
+#define DARWIN_DEF_SECT_BEGIN(TYPE, SECT) \
+ DARWIN_DEF_SECT_SYM (TYPE, SECT, start)
+
+#define DARWIN_DEF_SECT_END(TYPE, SECT) \
+ DARWIN_DEF_SECT_SYM (TYPE, SECT, end)
+
+/* Define UPC sections via __asm__ as zero space cannot be
+ allocated on Darwin OS via the usual method. */
+
+#define UPC_SHARED_SECTION_BEGIN \
+ DARWIN_DEF_SECT_BEGIN (DATA, GUPCR_SHARED_SECTION_NAME); \
+ __asm__ (".space 256\n");
+#define UPC_SHARED_SECTION_END \
+ DARWIN_DEF_SECT_END (DATA, GUPCR_SHARED_SECTION_NAME);
+#define UPC_PGM_INFO_SECTION_BEGIN \
+ DARWIN_DEF_SECT_BEGIN (DATA, GUPCR_PGM_INFO_SECTION_NAME);
+#define UPC_PGM_INFO_SECTION_END \
+ DARWIN_DEF_SECT_END (DATA, GUPCR_PGM_INFO_SECTION_NAME);
+#define UPC_INIT_ARRAY_SECTION_BEGIN \
+ DARWIN_DEF_SECT_BEGIN (DATA, GUPCR_INIT_ARRAY_SECTION_NAME);
+#define UPC_INIT_ARRAY_SECTION_END \
+ DARWIN_DEF_SECT_END (DATA, GUPCR_INIT_ARRAY_SECTION_NAME);
diff --git a/libgupc/config/default/upc-crt-begin-end.h b/libgupc/config/default/upc-crt-begin-end.h
new file mode 100644
index 00000000000..36e2367f1fc
--- /dev/null
+++ b/libgupc/config/default/upc-crt-begin-end.h
@@ -0,0 +1,29 @@
+/* Used by upc-crtbegin to define the beginning of the shared section. */
+#ifndef GUPCR_SHARED_BEGIN_NAME
+#define GUPCR_SHARED_BEGIN_NAME __upc_shared_start
+#endif
+
+/* Used by upc-crtend to define the end of the shared section. */
+#ifndef GUPCR_SHARED_END_NAME
+#define GUPCR_SHARED_END_NAME __upc_shared_end
+#endif
+
+/* Used by upc-crtbegin to define the beginning of the shared section. */
+#ifndef GUPCR_PGM_INFO_BEGIN_NAME
+#define GUPCR_PGM_INFO_BEGIN_NAME __upc_pgm_info_start
+#endif
+
+/* Used by upc-crtend to define the end of the shared section. */
+#ifndef GUPCR_PGM_INFO_END_NAME
+#define GUPCR_PGM_INFO_END_NAME __upc_pgm_info_end
+#endif
+
+/* Used by upc-crtbegin to define the beginning of UPC init. array section. */
+#ifndef GUPCR_INIT_ARRAY_BEGIN_NAME
+#define GUPCR_INIT_ARRAY_BEGIN_NAME __upc_init_array_start
+#endif
+
+/* Used by upc-crtend to define the beginning of UPC init. array section. */
+#ifndef GUPCR_INIT_ARRAY_END_NAME
+#define GUPCR_INIT_ARRAY_END_NAME __upc_init_array_end
+#endif
diff --git a/libgupc/config/default/upc-crt-config.h b/libgupc/config/default/upc-crt-config.h
new file mode 100644
index 00000000000..619a929990b
--- /dev/null
+++ b/libgupc/config/default/upc-crt-config.h
@@ -0,0 +1,36 @@
+#define _XSTR(S) #S
+#define _STR(S) _XSTR(S)
+
+/* Establish a symbol at the beginning of the data section
+ Must take up some space, so that variables don't begin
+ at offset zero. */
+#define UPC_SHARED_SECTION_BEGIN \
+char GUPCR_SHARED_BEGIN_NAME [256] \
+ __attribute__((section(_STR(GUPCR_SHARED_SECTION_NAME))));
+
+/* Establish a symbol at the beginning of the program info data section. */
+#define UPC_PGM_INFO_SECTION_BEGIN \
+char GUPCR_PGM_INFO_BEGIN_NAME [] \
+ __attribute__((section(_STR(GUPCR_PGM_INFO_SECTION_NAME)))) = {};
+
+/* Establish a symbol at the beginning of the section that contains
+ a list of addresses pointing to UPC data initialization procedures. */
+#define UPC_INIT_ARRAY_SECTION_BEGIN \
+void (*GUPCR_INIT_ARRAY_BEGIN_NAME[]) (void) \
+ __attribute__((section(_STR(GUPCR_INIT_ARRAY_SECTION_NAME)))) = {};
+
+/* Establish a symbol at the end of the shared data section. */
+#define UPC_SHARED_SECTION_END \
+char GUPCR_SHARED_END_NAME [] \
+ __attribute__((section(_STR(GUPCR_SHARED_SECTION_NAME)))) = {'\0'};
+
+/* Establish a symbol at the end of the program info data section. */
+#define UPC_PGM_INFO_SECTION_END \
+char GUPCR_PGM_INFO_END_NAME [] \
+ __attribute__((section(_STR(GUPCR_PGM_INFO_SECTION_NAME)))) = {'\0'};
+
+/* Establish a symbol at the end of the UPC init. procedure
+ table section. */
+#define UPC_INIT_ARRAY_SECTION_END \
+void (*GUPCR_INIT_ARRAY_END_NAME[]) (void) \
+ __attribute__((section(_STR(GUPCR_INIT_ARRAY_SECTION_NAME)))) = {0};
diff --git a/libgupc/configure b/libgupc/configure
new file mode 100755
index 00000000000..736689cc079
--- /dev/null
+++ b/libgupc/configure
@@ -0,0 +1,23425 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.64 for GNU UPC Runtime Library 1.0.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+# Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ # We cannot yet assume a decent shell, so we have to provide a
+ # neutralization value for shells without unset; and this also
+ # works around shells that cannot unset nonexistent variables.
+ BASH_ENV=/dev/null
+ ENV=/dev/null
+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$?; test $as_status -eq 0 && as_status=1
+ if test "$3"; then
+ as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ fi
+ $as_echo "$as_me: error: $1" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='GNU UPC Runtime Library'
+PACKAGE_TARNAME='libgupc'
+PACKAGE_VERSION='1.0'
+PACKAGE_STRING='GNU UPC Runtime Library 1.0'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL='http://www.gnu.org/software/libgupc/'
+
+ac_unique_file="include/upc.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBGUPC_NODE_LOCAL_MEM_MMAP_FALSE
+LIBGUPC_NODE_LOCAL_MEM_MMAP_TRUE
+LIBGUPC_NODE_LOCAL_MEM_POSIX_FALSE
+LIBGUPC_NODE_LOCAL_MEM_POSIX_TRUE
+LIBGUPC_GUM_FALSE
+LIBGUPC_GUM_TRUE
+LIBGUPC_NUMA_FALSE
+LIBGUPC_NUMA_TRUE
+LIBGUPC_AFFINITY_FALSE
+LIBGUPC_AFFINITY_TRUE
+LIBGUPC_PTHREADS_FALSE
+LIBGUPC_PTHREADS_TRUE
+LIBGUPC_BACKTRACE_FALSE
+LIBGUPC_BACKTRACE_TRUE
+LIBGUPC_GENERIC_COLLECTIVES_FALSE
+LIBGUPC_GENERIC_COLLECTIVES_TRUE
+LIBGUPC_LINK_SCRIPT_FALSE
+LIBGUPC_LINK_SCRIPT_TRUE
+LIBGUPC_CRTSTUFF_FALSE
+LIBGUPC_CRTSTUFF_TRUE
+LIBGUPC_RUNTIME_DEBUG_FALSE
+LIBGUPC_RUNTIME_DEBUG_TRUE
+LIBGUPC_PORTALS4_RUNTIME_FALSE
+LIBGUPC_PORTALS4_RUNTIME_TRUE
+LIBGUPC_SMP_RUNTIME_FALSE
+LIBGUPC_SMP_RUNTIME_TRUE
+upc_crtstuff_objs
+upc_crtend_spec
+upc_crtbegin_spec
+upc_crtstuff_cflags
+link_upc_spec
+XLDFLAGS
+XCFLAGS
+bfdinc
+config_path
+portals4inc
+portals4libs
+DOXYGEN_DATE
+DOXYGEN_DATETIME
+DOXYGEN_AUTHOR
+DOXYGEN_TITLE
+DOXYGEN_LOGO
+DOXYGEN_HTML_LOGO
+DOXYGEN_PAPER_SIZE
+DX_COND_latex_FALSE
+DX_COND_latex_TRUE
+DX_COND_pdf_FALSE
+DX_COND_pdf_TRUE
+DX_PDFLATEX
+DX_FLAG_pdf
+DX_COND_ps_FALSE
+DX_COND_ps_TRUE
+DX_EGREP
+DX_DVIPS
+DX_MAKEINDEX
+DX_LATEX
+DX_FLAG_ps
+DX_COND_html_FALSE
+DX_COND_html_TRUE
+DX_FLAG_html
+DX_COND_chi_FALSE
+DX_COND_chi_TRUE
+DX_FLAG_chi
+DX_COND_chm_FALSE
+DX_COND_chm_TRUE
+DX_HHC
+DX_FLAG_chm
+DX_COND_xml_FALSE
+DX_COND_xml_TRUE
+DX_FLAG_xml
+DX_COND_rtf_FALSE
+DX_COND_rtf_TRUE
+DX_FLAG_rtf
+DX_COND_man_FALSE
+DX_COND_man_TRUE
+DX_FLAG_man
+HAVE_DOT
+DX_COND_dot_FALSE
+DX_COND_dot_TRUE
+DX_DOT
+DX_FLAG_dot
+DOXYGEN_VERSION
+DX_COND_doc_FALSE
+DX_COND_doc_TRUE
+DX_FILE
+DX_PERL
+DX_DOXYGEN
+DX_FLAG_doc
+DX_ENV
+DX_DOCDIR
+DX_CONFIG
+DX_PROJECT
+PATH_TO_GDB
+enable_upc_runtime_debug
+LIBGUPC_BUILD_VERSIONED_SHLIB_FALSE
+LIBGUPC_BUILD_VERSIONED_SHLIB_TRUE
+OPT_LDFLAGS
+SECTION_LDFLAGS
+LIBOBJS
+libtool_VERSION
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+CPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+EGREP
+GREP
+SED
+LIBTOOL
+BUILD_INFO_FALSE
+BUILD_INFO_TRUE
+ADDR2LINE
+PERL
+RANLIB
+AR
+am__fastdepUPC_FALSE
+am__fastdepUPC_TRUE
+UPCDEPMODE
+ac_ct_UPC
+UPC
+UPCFLAGS
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+toolexeclibdir
+toolexecdir
+multi_basedir
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+GENINSRC_FALSE
+GENINSRC_TRUE
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_version_specific_runtime_libs
+enable_generated_files_in_srcdir
+enable_multilib
+enable_dependency_tracking
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+enable_maintainer_mode
+enable_largefile
+enable_linux_futex
+enable_tls
+enable_symvers
+with_upc_runtime
+enable_upc_runtime_checks
+enable_upc_runtime_stats
+enable_upc_runtime_trace
+enable_upc_runtime_debug
+with_upc_runtime_tree_fanout
+enable_upc_backtrace
+with_upc_backtrace_gdb
+enable_upc_backtrace_gdb
+enable_upc_backtrace_signal
+with_upc_backtrace_signal
+enable_upc_gum_debug
+enable_doxygen_doc
+enable_doxygen_dot
+enable_doxygen_man
+enable_doxygen_rtf
+enable_doxygen_xml
+enable_doxygen_chm
+enable_doxygen_chi
+enable_doxygen_html
+enable_doxygen_ps
+enable_doxygen_pdf
+with_upc_runtime_max_locks
+with_portals4
+with_portals4_include
+with_portals4_lib
+with_upc_runtime_pte_base
+with_upc_runtime_bounce_buffer_size
+with_upc_max_outstanding_puts
+enable_upc_runtime_triggered_ops
+enable_upc_node_local_mem
+with_upc_node_local_mem
+with_upc_job_launcher
+with_upc_memory_page_size
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+UPC
+UPCFLAGS
+CPP
+CPPFLAGS
+DOXYGEN_PAPER_SIZE
+DOXYGEN_HTML_LOGO
+DOXYGEN_LOGO
+DOXYGEN_TITLE
+DOXYGEN_AUTHOR
+DOXYGEN_DATETIME
+DOXYGEN_DATE'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information."
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures GNU UPC Runtime Library 1.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/libgupc]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of GNU UPC Runtime Library 1.0:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-version-specific-runtime-libs
+ specify that runtime libraries should be installed
+ in a compiler-specific directory [default=no]
+ --enable-generated-files-in-srcdir
+ put copies of generated files in source dir intended
+ for creating source tarballs for users without
+ texinfo bison or flex [default=no]
+ --enable-multilib build many library versions (default)
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-shared[=PKGS] build shared libraries [default=no]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --disable-largefile omit support for large files
+ --enable-linux-futex use the Linux futex system call [default=default]
+ --enable-tls Use thread-local storage [default=yes]
+ --enable-symvers=STYLE enables symbol versioning of the shared library
+ [default=yes]
+ --enable-upc-runtime-checks
+ enable internal UPC runtime checks that validate
+ arguments, and check for inconsistent runtime state.
+ [default=no]
+ --enable-upc-runtime-stats
+ enable internal UPC runtime statistics collection
+ support; these statistics count the number of
+ various significant internal operations, and dump
+ those counts into a per-process statistics file.
+ [default=no]
+ --enable-upc-runtime-trace
+ enable internal UPC runtime trace collection
+ support; a runtime trace is a time stamped log that
+ records various significant internal events; this
+ trace is written to a per-process log file.
+ [default=no]
+ --enable-upc-runtime-debug
+ enable UPC runtime debugging mode, where more
+ expensive internal checks are implemented, and
+ conservative algorithms are used that reduce the
+ degree of parallelism, and that exercise less
+ complex/sophisticated operations provided by the
+ operating system and/or the network communication
+ packages called by the UPC runtime. In addition,
+ conservative compilation options will be used to
+ build the runtime, and debugging symbols will be
+ generated. [default=no]
+ --enable-upc-backtrace enable UPC backtrace; enable stack frame backtrace
+ report when UPC run-time fatal errors occur or by
+ user request (via signal)
+ --enable-upc-backtrace-gdb
+ enable the use of GDB for UPC stack backtrace
+ [default='yes']
+ --enable-upc-backtrace-signal
+ enable signal support for UPC stack backtrace
+ [default='yes']
+ --enable-upc-gum-debug enable UPC's source level debugging with GDB and GUM
+ support (requires UPC aware GDB)
+ --enable-doxygen-doc generate any doxygen documentation
+ --enable-doxygen-dot generate graphics for doxygen documentation
+ --enable-doxygen-man generate doxygen manual pages
+ --enable-doxygen-rtf generate doxygen RTF documentation
+ --enable-doxygen-xml generate doxygen XML documentation
+ --enable-doxygen-chm generate doxygen compressed HTML help documentation
+ --enable-doxygen-chi generate doxygen separate compressed HTML help index
+ file
+ --disable-doxygen-html don't generate doxygen plain HTML documentation
+ --disable-doxygen-ps don't generate doxygen PostScript documentation
+ --disable-doxygen-pdf don't generate doxygen PDF documentation
+ --enable-upc-runtime-triggered-ops
+ enable UPC runtime support for Portals4 triggered
+ operations. [default=yes]
+ --enable-upc-node-local-mem
+ enable UPC runtime support for accessing shared
+ memory of the node local threads. [default=yes]
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-upc-runtime=MODEL
+ specify the runtime implementation model for UPC,
+ where MODEL may be: 'SMP' (Symmetric
+ Multiprocessing) or 'Portals4'. [default='SMP']
+ --with-upc-runtime-tree-fanout=WIDTH
+ specify the maximum number of children in each
+ sub-tree used to implement UPC collectives
+ operations (e. g. upc_barrier) [default=4]
+ --with-upc-backtrace-gdb=GDB
+ specify which GDB to use for UPC backtrace support
+ [default='gdb']
+ --with-upc-backtrace-signal=SIGNAL
+ specify the signal to be used for UPC stack
+ backtrace [default='SIGUSR1']
+ --with-upc-runtime-max-locks=MAX_LOCKS
+ specify the maximum number of locks that can be held
+ by a single UPC thread [default=1024]
+ --with-portals4=PATH specify prefix directory for installed portals4
+ package. Equivalent to
+ --with-portals4-include=PATH/include plus
+ --with-portals4-lib=PATH/lib
+ --with-portals4-include=PATH
+ specify directory for installed portals4 include
+ files
+ --with-portals4-lib=PATH
+ specify directory for the installed portals4 library
+ --with-upc-runtime-pte-base=BASE
+ specify the base index of the first Portals4 PTE
+ used by the UPC runtime [default=16]
+ --with-upc-runtime-max-locks=MAX_LOCKS
+ specify the maximum number of locks that can be held
+ by a single UPC thread [default=1024]
+ --with-upc-runtime-bounce-buffer-size=SIZE
+ specify the size (in bytes) of the bounce buffer
+ that is used by the UPC runtime to buffer network
+ data [default=256K]
+ --with-upc-max-outstanding-puts=SIZE
+ specify the maximum number of outstanding remote put
+ requests. [default=256]
+ --with-upc-runtime-tree-fanout=WIDTH
+ specify the maximum number of children in each
+ sub-tree used to implement UPC collective operations
+ (e. g., upc_barrier and upc_global_alloc).
+ [default=4]
+ --with-upc-node-local-mem=SHMEM
+ specify type of shared memory used for node local
+ memory accesses (posix or mmap). [default=posix]
+ --with-upc-job-launcher Select UPC Portals4 job launcher. [default=slurm]
+ --with-upc-memory-page-size
+ Select target memory page size. [default=4096]
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ UPC Unified Parallel C compiler command
+ UPCFLAGS Unified Parallel C compiler flags
+ CPP C preprocessor
+ DOXYGEN_PAPER_SIZE
+ letter (default), a4, a4wide, legal or executive
+ DOXYGEN_HTML_LOGO
+ Location of small logo graphic (for HTML)
+ DOXYGEN_LOGO
+ Location of larger logo graphic (for PDF)
+ DOXYGEN_TITLE
+ Doxygen document title
+ DOXYGEN_AUTHOR
+ Doxygen document author
+ DOXYGEN_DATETIME
+ Doxygen date and time value
+ DOXYGEN_DATE
+ Doxygen date value
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+GNU UPC Runtime Library home page: <http://www.gnu.org/software/libgupc/>.
+General help using GNU software: <http://www.gnu.org/gethelp/>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+GNU UPC Runtime Library configure 1.0
+generated by GNU Autoconf 2.64
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid; break
+else
+ as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=$ac_mid; break
+else
+ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid
+else
+ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (($2) < 0)
+ {
+ long int i = longval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+ ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+ fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_compute_int
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR
+# ------------------------------------
+# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_decl
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by GNU UPC Runtime Library $as_me 1.0, which was
+generated by GNU Autoconf 2.64. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ ac_site_file1=$CONFIG_SITE
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+# -------
+# Options
+# -------
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-version-specific-runtime-libs" >&5
+$as_echo_n "checking for --enable-version-specific-runtime-libs... " >&6; }
+ # Check whether --enable-version-specific-runtime-libs was given.
+if test "${enable_version_specific_runtime_libs+set}" = set; then :
+ enableval=$enable_version_specific_runtime_libs;
+ case "$enableval" in
+ yes|no) ;;
+ *) as_fn_error "Unknown argument to enable/disable version-specific-runtime-libs" "$LINENO" 5 ;;
+ esac
+
+else
+ enable_version_specific_runtime_libs=no
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_version_specific_runtime_libs" >&5
+$as_echo "$enable_version_specific_runtime_libs" >&6; }
+
+# We would like our source tree to be readonly. However when releases or
+# pre-releases are generated, the flex/bison generated files as well as the
+# various formats of manuals need to be included along with the rest of the
+# sources. Therefore we have --enable-generated-files-in-srcdir to do
+# just that.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-generated-files-in-srcdir" >&5
+$as_echo_n "checking for --enable-generated-files-in-srcdir... " >&6; }
+ # Check whether --enable-generated-files-in-srcdir was given.
+if test "${enable_generated_files_in_srcdir+set}" = set; then :
+ enableval=$enable_generated_files_in_srcdir;
+ case "$enableval" in
+ yes|no) ;;
+ *) as_fn_error "Unknown argument to enable/disable generated-files-in-srcdir" "$LINENO" 5 ;;
+ esac
+
+else
+ enable_generated_files_in_srcdir=no
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_generated_files_in_srcdir" >&5
+$as_echo "$enable_generated_files_in_srcdir" >&6; }
+ if test "$enable_generated_files_in_srcdir" = yes; then
+ GENINSRC_TRUE=
+ GENINSRC_FALSE='#'
+else
+ GENINSRC_TRUE='#'
+ GENINSRC_FALSE=
+fi
+
+
+
+# -------
+# Get build environment
+# -------
+
+# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
+#
+# You will slowly go insane if you do not grok the following fact: when
+# building this library, the top-level /target/ becomes the library's /host/.
+#
+# configure then causes --target to default to --host, exactly like any
+# other package using autoconf. Therefore, 'target' and 'host' will
+# always be the same. This makes sense both for native and cross compilers
+# just think about it for a little while. :-)
+#
+# Also, if this library is being configured as part of a cross compiler, the
+# top-level configure script will pass the "real" host as $with_cross_host.
+#
+# Do not delete or change the following two lines. For why, see
+# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ for ac_t in install-sh install.sh shtool; do
+ if test -f "$ac_dir/$ac_t"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/$ac_t -c"
+ break 2
+ fi
+ done
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if test "${ac_cv_target+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+target_alias=${target_alias-$host_alias}
+
+# Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
+# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
+# 1.11.1: minimum required version
+# no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
+# of other PACKAGE_* variables will, however, and there's nothing
+# we can do about that; they come from AC_INIT).
+# foreign: we don't follow the normal rules for GNU packages (no COPYING
+# file in the top srcdir, etc, etc), so stop complaining.
+# -Wall: turns on all automake warnings...
+# -Wno-portability: ...except this one, since GNU make is required.
+# -Wno-override: ... and this one, since we do want this in testsuite.
+am__api_version='1.11'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error "ls -t appears to fail. Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if test "${ac_cv_path_mkdir+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ test -d ./--version && rmdir ./--version
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='libgupc'
+ VERSION='1.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+
+# UPC disables multilib for portals4 runtime
+if echo "${with_upc_runtime}" | grep -v -i '^portals4$' 2>&1 >/dev/null; then
+ # Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+ enableval=$enable_multilib; case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+ multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../.."
+ else
+ multi_basedir="$srcdir/$with_multisrctop.."
+ fi
+else
+ multi_basedir="$srcdir/.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+ && test "x${with_multisubdir}" != x ; then
+ cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+fi
+
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${enable_version_specific_runtime_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+ *)
+ as_fn_error "'$enable_version_specific_runtime_libs' is not set" "$LINENO" 5
+ ;;
+esac
+
+
+
+# If the language specific driver does not exist, we do not build anything.
+# Note, $r is set by the top-level Makefile.
+rm -f skip-this-dir
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if UPC driver 'gupc' has been built" >&5
+$as_echo_n "checking if UPC driver 'gupc' has been built... " >&6; }
+if test "${upc_cv_driver_exists+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ upc_cv_driver_exists=yes
+ if test -n "$r"; then
+ if test -d "$r"/gcc; then
+ if (test -f "$r"/gcc/gupc && test -x "$r"/gcc/gupc); then
+ true
+ else
+ upc_cv_driver_exists=no
+ fi
+ fi
+ fi
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_cv_driver_exists" >&5
+$as_echo "$upc_cv_driver_exists" >&6; }
+if test x$upc_cv_driver_exists = xno
+then
+ echo "rm -f config.cache config.log multilib.out" > skip-this-dir
+ rm -f Makefile conftest* confdefs* core
+ exit 0
+fi
+
+# Check the compiler.
+# The same as in boehm-gc and libstdc++. Have to borrow it from there.
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "no acceptable C compiler found in \$PATH
+See \`config.log' for more details." "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ rm -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then :
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "C compiler cannot create executables
+See \`config.log' for more details." "$LINENO" 5; }; }
+fi
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+
+
+
+
+#
+# If UPCFLAGS hasn't been set explicitly then default to "$CFLAGS".
+#
+if test x"$UPCFLAGS" = "x"; then
+ UPCFLAGS="$CFLAGS"
+fi
+
+
+
+# In order to override CFLAGS_FOR_TARGET, all of our special flags go
+# in XCFLAGS. But we need them in CFLAGS during configury. So put them
+# in both places for now and restore CFLAGS at the end of config.
+save_CFLAGS="$CFLAGS"
+
+# Add -Wall -Werror if we are using GCC.
+if test "x$GCC" = "xyes"; then
+ XCFLAGS="$XCFLAGS -Wall -Werror"
+fi
+
+if echo "$CC" | grep '/xgcc ' >/dev/null 2>&1; then
+ UPC=`echo "$CC" | sed -e 's=/xgcc =/gupc ='`
+else
+ as_fn_error "cannot create UPC from CC because it does not contain the
+ string '/xgcc '; the value of CC is: \"$CC\"" "$LINENO" 5
+fi
+# The just built UPC compiler is not fully functional as it is
+# unable to auto pre-include "gcc-upc.h" and "gcc-upc-lib.h".
+# Make sure that "upc-pre-include" feature is disabled for any of the
+# UPC program checks (e.g. checking for dependency options).
+saved_UPC="$UPC"
+UPC="$UPC -fno-upc-pre-include"
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in upcc upc
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_UPC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$UPC"; then
+ ac_cv_prog_UPC="$UPC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_UPC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+UPC=$ac_cv_prog_UPC
+if test -n "$UPC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UPC" >&5
+$as_echo "$UPC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$UPC" && break
+ done
+fi
+if test -z "$UPC"; then
+ ac_ct_UPC=$UPC
+ for ac_prog in upcc upc
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_UPC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_UPC"; then
+ ac_cv_prog_ac_ct_UPC="$ac_ct_UPC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_UPC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_UPC=$ac_cv_prog_ac_ct_UPC
+if test -n "$ac_ct_UPC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_UPC" >&5
+$as_echo "$ac_ct_UPC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_UPC" && break
+done
+
+ if test "x$ac_ct_UPC" = x; then
+ UPC=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ UPC=$ac_ct_UPC
+ fi
+fi
+
+if test "$UPC" = :; then
+ { as_fn_set_status 77
+as_fn_error "no Unified Parallel C compiler was found" "$LINENO" 5; }
+fi
+
+depcc="$UPC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_UPC_dependencies_compiler_type+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_UPC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_UPC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_UPC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_UPC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_UPC_dependencies_compiler_type" >&6; }
+UPCDEPMODE=depmode=$am_cv_UPC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_UPC_dependencies_compiler_type" = gcc3; then
+ am__fastdepUPC_TRUE=
+ am__fastdepUPC_FALSE='#'
+else
+ am__fastdepUPC_TRUE='#'
+ am__fastdepUPC_FALSE=
+fi
+
+
+UPC="$saved_UPC"
+
+# Find other programs we need.
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB="ranlib-not-found-in-path-error"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PERL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PERL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="perl-not-found-in-path-error"
+ ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "addr2line", so it can be a program name with args.
+set dummy addr2line; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ADDR2LINE+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ADDR2LINE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ADDR2LINE="$ADDR2LINE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ADDR2LINE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_ADDR2LINE" && ac_cv_path_ADDR2LINE="addr2line-not-found-in-path-error"
+ ;;
+esac
+fi
+ADDR2LINE=$ac_cv_path_ADDR2LINE
+if test -n "$ADDR2LINE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ADDR2LINE" >&5
+$as_echo "$ADDR2LINE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+
+# See if makeinfo has been installed and is modern enough
+# that we can use it.
+
+ # Extract the first word of "makeinfo", so it can be a program name with args.
+set dummy makeinfo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_MAKEINFO+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$MAKEINFO"; then
+ ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_MAKEINFO="makeinfo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+MAKEINFO=$ac_cv_prog_MAKEINFO
+if test -n "$MAKEINFO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKEINFO" >&5
+$as_echo "$MAKEINFO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test -n "$MAKEINFO"; then
+ # Found it, now check the version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for modern makeinfo" >&5
+$as_echo_n "checking for modern makeinfo... " >&6; }
+if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_prog_version=`eval $MAKEINFO --version 2>&1 |
+ sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
+
+ case $ac_prog_version in
+ '') gcc_cv_prog_makeinfo_modern=no;;
+ 4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*) gcc_cv_prog_makeinfo_modern=yes;;
+ *) gcc_cv_prog_makeinfo_modern=no;;
+ esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_prog_makeinfo_modern" >&5
+$as_echo "$gcc_cv_prog_makeinfo_modern" >&6; }
+ else
+ gcc_cv_prog_makeinfo_modern=no
+ fi
+ if test $gcc_cv_prog_makeinfo_modern = no; then
+ MAKEINFO="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing makeinfo"
+ fi
+
+ if test $gcc_cv_prog_makeinfo_modern = "yes"; then
+ BUILD_INFO_TRUE=
+ BUILD_INFO_FALSE='#'
+else
+ BUILD_INFO_TRUE='#'
+ BUILD_INFO_FALSE=
+fi
+
+
+
+# libgupc cannot be built as shared library
+enable_shared=no
+# Configure libtool
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=no
+fi
+
+
+
+
+
+
+
+
+
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.2.7a'
+macro_revision='1.3134'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`print -r -- -n 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if test "${ac_cv_path_FGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in dumpbin "link -dump"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if test "${lt_cv_nm_interface+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
+ ;;
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_LIPO+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_ld_exported_symbols_list=yes
+else
+ lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if test "${lt_cv_ld_force_load+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012][,.]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+ enable_win32_dll=no
+
+
+
+ # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+ withval=$with_pic; pic_mode="$withval"
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ lt_prog_compiler_pic='-Xcompiler -fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ F* | *Sun*Fortran*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+
+
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld='-rpath $libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes=yes
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ else
+ whole_archive_flag_spec=''
+ fi
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec_ld='+b $libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if test "${lt_cv_prog_compiler__b+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo(void) {}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if test "${lt_cv_archive_cmds_need_lc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+ archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[23].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+haiku*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+fi
+
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = x""yes; then :
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = x""yes; then :
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_svld_dlopen=yes
+else
+ ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_dld_link=yes
+else
+ ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 11632 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#endif
+
+void fnord () { int i=42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 11738 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#endif
+
+void fnord () { int i=42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+ # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+ enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+# For libtool versioning info, format is CURRENT:REVISION:AGE
+libtool_VERSION=1:0:0
+
+
+# Check header files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether string.h and strings.h may both be included" >&5
+$as_echo_n "checking whether string.h and strings.h may both be included... " >&6; }
+if test "${gcc_cv_header_string+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+#include <strings.h>
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gcc_cv_header_string=yes
+else
+ gcc_cv_header_string=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_header_string" >&5
+$as_echo "$gcc_cv_header_string" >&6; }
+if test $gcc_cv_header_string = yes; then
+
+$as_echo "#define STRING_WITH_STRINGS 1" >>confdefs.h
+
+fi
+
+
+
+inttype_headers=`echo inttypes.h sys/inttypes.h | sed -e 's/,/ /g'`
+
+acx_cv_header_stdint=stddef.h
+acx_cv_header_stdint_kind="(already complete)"
+for i in stdint.h $inttype_headers; do
+ unset ac_cv_type_uintptr_t
+ unset ac_cv_type_uintmax_t
+ unset ac_cv_type_int_least32_t
+ unset ac_cv_type_int_fast32_t
+ unset ac_cv_type_uint64_t
+ $as_echo_n "looking for a compliant stdint.h in $i, " >&6
+ ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uintmax_t" = x""yes; then :
+ acx_cv_header_stdint=$i
+else
+ continue
+fi
+
+ ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uintptr_t" = x""yes; then :
+
+else
+ acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+ ac_fn_c_check_type "$LINENO" "int_least32_t" "ac_cv_type_int_least32_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_int_least32_t" = x""yes; then :
+
+else
+ acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+ ac_fn_c_check_type "$LINENO" "int_fast32_t" "ac_cv_type_int_fast32_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_int_fast32_t" = x""yes; then :
+
+else
+ acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+ ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uint64_t" = x""yes; then :
+
+else
+ acx_cv_header_stdint_kind="(lacks uint64_t)"
+fi
+
+ break
+done
+if test "$acx_cv_header_stdint" = stddef.h; then
+ acx_cv_header_stdint_kind="(lacks uintmax_t)"
+ for i in stdint.h $inttype_headers; do
+ unset ac_cv_type_uintptr_t
+ unset ac_cv_type_uint32_t
+ unset ac_cv_type_uint64_t
+ $as_echo_n "looking for an incomplete stdint.h in $i, " >&6
+ ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uint32_t" = x""yes; then :
+ acx_cv_header_stdint=$i
+else
+ continue
+fi
+
+ ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uint64_t" = x""yes; then :
+
+fi
+
+ ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uintptr_t" = x""yes; then :
+
+fi
+
+ break
+ done
+fi
+if test "$acx_cv_header_stdint" = stddef.h; then
+ acx_cv_header_stdint_kind="(u_intXX_t style)"
+ for i in sys/types.h $inttype_headers; do
+ unset ac_cv_type_u_int32_t
+ unset ac_cv_type_u_int64_t
+ $as_echo_n "looking for u_intXX_t types in $i, " >&6
+ ac_fn_c_check_type "$LINENO" "u_int32_t" "ac_cv_type_u_int32_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_u_int32_t" = x""yes; then :
+ acx_cv_header_stdint=$i
+else
+ continue
+fi
+
+ ac_fn_c_check_type "$LINENO" "u_int64_t" "ac_cv_type_u_int64_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_u_int64_t" = x""yes; then :
+
+fi
+
+ break
+ done
+fi
+if test "$acx_cv_header_stdint" = stddef.h; then
+ acx_cv_header_stdint_kind="(using manual detection)"
+fi
+
+test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no
+test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no
+test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no
+test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no
+test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no
+
+# ----------------- Summarize what we found so far
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what to include in gstdint.h" >&5
+$as_echo_n "checking what to include in gstdint.h... " >&6; }
+
+case `$as_basename -- gstdint.h ||
+$as_expr X/gstdint.h : '.*/\([^/][^/]*\)/*$' \| \
+ Xgstdint.h : 'X\(//\)$' \| \
+ Xgstdint.h : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/gstdint.h |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'` in
+ stdint.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5
+$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
+ inttypes.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5
+$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
+ *) ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_header_stdint $acx_cv_header_stdint_kind" >&5
+$as_echo "$acx_cv_header_stdint $acx_cv_header_stdint_kind" >&6; }
+
+# ----------------- done included file, check C basic types --------
+
+# Lacking an uintptr_t? Test size of void *
+case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in
+ stddef.h:* | *:no) # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if test "${ac_cv_sizeof_void_p+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_void_p" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (void *)
+See \`config.log' for more details." "$LINENO" 5; }; }
+ else
+ ac_cv_sizeof_void_p=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+ ;;
+esac
+
+# Lacking an uint64_t? Test size of long
+case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in
+ stddef.h:*:* | *:no:no) # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_long" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long)
+See \`config.log' for more details." "$LINENO" 5; }; }
+ else
+ ac_cv_sizeof_long=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+ ;;
+esac
+
+if test $acx_cv_header_stdint = stddef.h; then
+ # Lacking a good header? Test size of everything and deduce all types.
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if test "${ac_cv_sizeof_int+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_int" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (int)
+See \`config.log' for more details." "$LINENO" 5; }; }
+ else
+ ac_cv_sizeof_int=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if test "${ac_cv_sizeof_short+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_short" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (short)
+See \`config.log' for more details." "$LINENO" 5; }; }
+ else
+ ac_cv_sizeof_short=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5
+$as_echo_n "checking size of char... " >&6; }
+if test "${ac_cv_sizeof_char+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_char" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (char)
+See \`config.log' for more details." "$LINENO" 5; }; }
+ else
+ ac_cv_sizeof_char=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5
+$as_echo "$ac_cv_sizeof_char" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHAR $ac_cv_sizeof_char
+_ACEOF
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int8_t" >&5
+$as_echo_n "checking for type equivalent to int8_t... " >&6; }
+ case "$ac_cv_sizeof_char" in
+ 1) acx_cv_type_int8_t=char ;;
+ *) as_fn_error "no 8-bit type, please report a bug" "$LINENO" 5
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int8_t" >&5
+$as_echo "$acx_cv_type_int8_t" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int16_t" >&5
+$as_echo_n "checking for type equivalent to int16_t... " >&6; }
+ case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in
+ 2:*) acx_cv_type_int16_t=int ;;
+ *:2) acx_cv_type_int16_t=short ;;
+ *) as_fn_error "no 16-bit type, please report a bug" "$LINENO" 5
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int16_t" >&5
+$as_echo "$acx_cv_type_int16_t" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int32_t" >&5
+$as_echo_n "checking for type equivalent to int32_t... " >&6; }
+ case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in
+ 4:*) acx_cv_type_int32_t=int ;;
+ *:4) acx_cv_type_int32_t=long ;;
+ *) as_fn_error "no 32-bit type, please report a bug" "$LINENO" 5
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int32_t" >&5
+$as_echo "$acx_cv_type_int32_t" >&6; }
+fi
+
+# These tests are here to make the output prettier
+
+if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then
+ case "$ac_cv_sizeof_long" in
+ 8) acx_cv_type_int64_t=long ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int64_t" >&5
+$as_echo_n "checking for type equivalent to int64_t... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${acx_cv_type_int64_t-'using preprocessor symbols'}" >&5
+$as_echo "${acx_cv_type_int64_t-'using preprocessor symbols'}" >&6; }
+fi
+
+# Now we can use the above types
+
+if test "$ac_cv_type_uintptr_t" != yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to intptr_t" >&5
+$as_echo_n "checking for type equivalent to intptr_t... " >&6; }
+ case $ac_cv_sizeof_void_p in
+ 2) acx_cv_type_intptr_t=int16_t ;;
+ 4) acx_cv_type_intptr_t=int32_t ;;
+ 8) acx_cv_type_intptr_t=int64_t ;;
+ *) as_fn_error "no equivalent for intptr_t, please report a bug" "$LINENO" 5
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_intptr_t" >&5
+$as_echo "$acx_cv_type_intptr_t" >&6; }
+fi
+
+# ----------------- done all checks, emit header -------------
+ac_config_commands="$ac_config_commands gstdint.h"
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+if test "${ac_cv_header_time+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_time=yes
+else
+ ac_cv_header_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
+$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
+if test "${ac_cv_header_sys_wait_h+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+int
+main ()
+{
+ int s;
+ wait (&s);
+ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_sys_wait_h=yes
+else
+ ac_cv_header_sys_wait_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
+$as_echo "$ac_cv_header_sys_wait_h" >&6; }
+if test $ac_cv_header_sys_wait_h = yes; then
+
+$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
+
+fi
+
+
+for ac_header in execinfo.h fcntl.h limits.h netdb.h netinet/in.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in sched.h semaphore.h stddef.h stdlib.h sys/loadavg.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in sys/socket.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if test "${ac_cv_c_const+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset cs;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if test "${ac_cv_c_inline+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
+if test "x$ac_cv_type_mode_t" = x""yes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
+if test "x$ac_cv_type_off_t" = x""yes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = x""yes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = x""yes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "$ac_includes_default"
+if test "x$ac_cv_have_decl_sys_siglist" = x""yes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SYS_SIGLIST $ac_have_decl
+_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
+$as_echo_n "checking for working volatile... " >&6; }
+if test "${ac_cv_c_volatile+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+volatile int x;
+int * volatile y = (int *) 0;
+return !x && !y;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_volatile=yes
+else
+ ac_cv_c_volatile=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
+$as_echo "$ac_cv_c_volatile" >&6; }
+if test $ac_cv_c_volatile = no; then
+
+$as_echo "#define volatile /**/" >>confdefs.h
+
+fi
+
+ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
+if test "x$ac_cv_type_ptrdiff_t" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PTRDIFF_T 1
+_ACEOF
+
+
+fi
+
+
+# Check to see if -pthread or -lpthread is needed. Prefer the former.
+# In case the pthread.h system header is not found, this test will fail.
+XPCFLAGS=""
+CFLAGS="$CFLAGS -pthread"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <pthread.h>
+ void *g(void *d) { return NULL; }
+int
+main ()
+{
+pthread_t t; pthread_create(&t,NULL,g,NULL);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ XPCFLAGS=" -Wc,-pthread"
+else
+ CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <pthread.h>
+ void *g(void *d) { return NULL; }
+int
+main ()
+{
+pthread_t t; pthread_create(&t,NULL,g,NULL);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Pthreads are not supported in this libgupc build" >&5
+$as_echo "$as_me: Pthreads are not supported in this libgupc build" >&6;}
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+# Check for functions needed.
+for ac_header in vfork.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_VFORK_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in fork vfork
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if test "${ac_cv_func_fork_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_fork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* By Ruediger Kuhlmann. */
+ return fork () < 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_fork_works=yes
+else
+ ac_cv_func_fork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
+
+else
+ ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+ case $host in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ *)
+ ac_cv_func_fork_works=yes
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if test "${ac_cv_func_vfork_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_vfork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Thanks to Paul Eggert for this test. */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent. The compiler
+ is told about this with #include <vfork.h>, but some compilers
+ (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
+ static variable whose address is put into a register that is
+ clobbered by the vfork. */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+
+int
+main ()
+{
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test (0);
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems. This
+ test uses lots of local variables, at least as many local
+ variables as main has allocated so far including compiler
+ temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
+ 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
+ reuse the register of parent for one of the local variables,
+ since it will think that parent can't possibly be used any more
+ in this routine. Assigning to the local variable will thus
+ munge parent in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+ from child file descriptors. If the child closes a descriptor
+ before it execs or exits, this munges the parent's descriptor
+ as well. Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ return (
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_vfork_works=yes
+else
+ ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+ ac_cv_func_vfork_works=$ac_cv_func_vfork
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
+fi
+
+for ac_header in stdlib.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STDLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
+$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_malloc_0_nonnull=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+return ! malloc (0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_malloc_0_nonnull=yes
+else
+ ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
+$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
+if test $ac_cv_func_malloc_0_nonnull = yes; then :
+
+$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
+
+else
+ $as_echo "#define HAVE_MALLOC 0" >>confdefs.h
+
+ case " $LIBOBJS " in
+ *" malloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS malloc.$ac_objext"
+ ;;
+esac
+
+
+$as_echo "#define malloc rpl_malloc" >>confdefs.h
+
+fi
+
+
+for ac_header in stdlib.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in getpagesize
+do :
+ ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
+if test "x$ac_cv_func_getpagesize" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GETPAGESIZE 1
+_ACEOF
+
+fi
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
+$as_echo_n "checking for working mmap... " >&6; }
+if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_mmap_fixed_mapped=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+ Here is a matrix of mmap possibilities:
+ mmap private not fixed
+ mmap private fixed at somewhere currently unmapped
+ mmap private fixed at somewhere already mapped
+ mmap shared not fixed
+ mmap shared fixed at somewhere currently unmapped
+ mmap shared fixed at somewhere already mapped
+ For private mappings, we should verify that changes cannot be read()
+ back from the file, nor mmap's back from the file at a different
+ address. (There have been systems where private was not correctly
+ implemented like the infamous i386 svr4.0, and systems where the
+ VM page cache was not coherent with the file system buffer cache
+ like early versions of FreeBSD and possibly contemporary NetBSD.)
+ For shared mappings, we should conversely verify that changes get
+ propagated back to all the places they're supposed to be.
+
+ Grep wants private fixed already mapped.
+ The main things grep needs to know about mmap are:
+ * does it exist and is it safe to write into the mmap'd area
+ * how to use it (BSD variants) */
+
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
+char *malloc ();
+#endif
+
+/* This mess was copied from the GNU getpagesize.h. */
+#ifndef HAVE_GETPAGESIZE
+/* Assume that all systems that can run configure have sys/param.h. */
+# ifndef HAVE_SYS_PARAM_H
+# define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+# define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* no CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define getpagesize() NBPC
+# else /* no NBPC */
+# ifdef PAGESIZE
+# define getpagesize() PAGESIZE
+# endif /* PAGESIZE */
+# endif /* no NBPC */
+# endif /* no NBPG */
+# endif /* no EXEC_PAGESIZE */
+# else /* no HAVE_SYS_PARAM_H */
+# define getpagesize() 8192 /* punt totally */
+# endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+int
+main ()
+{
+ char *data, *data2, *data3;
+ int i, pagesize;
+ int fd;
+
+ pagesize = getpagesize ();
+
+ /* First, make a file with some known garbage in it. */
+ data = (char *) malloc (pagesize);
+ if (!data)
+ return 1;
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand ();
+ umask (0);
+ fd = creat ("conftest.mmap", 0600);
+ if (fd < 0)
+ return 1;
+ if (write (fd, data, pagesize) != pagesize)
+ return 1;
+ close (fd);
+
+ /* Next, try to mmap the file at a fixed address which already has
+ something else allocated at it. If we can, also make sure that
+ we see the same garbage. */
+ fd = open ("conftest.mmap", O_RDWR);
+ if (fd < 0)
+ return 1;
+ data2 = (char *) malloc (2 * pagesize);
+ if (!data2)
+ return 1;
+ data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
+ if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ return 1;
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data2 + i))
+ return 1;
+
+ /* Finally, make sure that changes to the mapped area do not
+ percolate back to the file as seen by read(). (This is a bug on
+ some variants of i386 svr4.0.) */
+ for (i = 0; i < pagesize; ++i)
+ *(data2 + i) = *(data2 + i) + 1;
+ data3 = (char *) malloc (pagesize);
+ if (!data3)
+ return 1;
+ if (read (fd, data3, pagesize) != pagesize)
+ return 1;
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data3 + i))
+ return 1;
+ close (fd);
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_mmap_fixed_mapped=yes
+else
+ ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5
+$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+
+$as_echo "#define HAVE_MMAP 1" >>confdefs.h
+
+fi
+rm -f conftest.mmap
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
+$as_echo_n "checking whether lstat dereferences a symlink specified with a trailing slash... " >&6; }
+if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f conftest.sym conftest.file
+echo >conftest.file
+if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ /* Linux will dereference the symlink and fail.
+ That is better in the sense that it means we will not
+ have to compile and use the lstat wrapper. */
+ return lstat ("conftest.sym/", &sbuf) == 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+else
+ # If the `ln -s' command failed, then we probably don't even
+ # have an lstat function.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f conftest.sym conftest.file
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+
+test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+
+if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
+ case " $LIBOBJS " in
+ *" lstat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
+ ;;
+esac
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
+$as_echo_n "checking whether stat accepts an empty string... " >&6; }
+if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_stat_empty_string_bug=yes
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ return stat ("", &sbuf) == 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_stat_empty_string_bug=no
+else
+ ac_cv_func_stat_empty_string_bug=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5
+$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; }
+if test $ac_cv_func_stat_empty_string_bug = yes; then
+ case " $LIBOBJS " in
+ *" stat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS stat.$ac_objext"
+ ;;
+esac
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STAT_EMPTY_STRING_BUG 1
+_ACEOF
+
+fi
+
+for ac_func in clock_gettime ftruncate getcwd gethostbyname gethostname
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_func in getloadavg memset mkdir munmap socket
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_func in strcasecmp strdup strerror strtol strtoull
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_func in backtrace backtrace_symbols backtrace_symbols_fd
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+ enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ if ac_fn_c_try_compile "$LINENO"; then :
+ break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_file_offset_bits=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_large_files=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ fi
+fi
+
+
+# Check for broken semaphore implementation on darwin.
+# sem_init returns: sem_init error: Function not implemented.
+case "$host" in
+ *-darwin*)
+
+$as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h
+
+ ;;
+esac
+
+ # Check whether --enable-linux-futex was given.
+if test "${enable_linux_futex+set}" = set; then :
+ enableval=$enable_linux_futex;
+ case "$enableval" in
+ yes|no|default) ;;
+ *) as_fn_error "Unknown argument to enable/disable linux-futex" "$LINENO" 5 ;;
+ esac
+
+else
+ enable_linux_futex=default
+fi
+
+
+case "$target" in
+ *-linux*)
+ case "$enable_linux_futex" in
+ default)
+ # If headers don't have gettid/futex syscalls definition, then
+ # default to no, otherwise there will be compile time failures.
+ # Otherwise, default to yes. If we don't detect we are
+ # compiled/linked against NPTL and not cross-compiling, check
+ # if programs are run by default against NPTL and if not, issue
+ # a warning.
+ enable_linux_futex=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/syscall.h>
+ int lk;
+int
+main ()
+{
+syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ save_LIBS="$LIBS"
+ LIBS="-lpthread $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef _GNU_SOURCE
+ #define _GNU_SOURCE 1
+ #endif
+ #include <pthread.h>
+ pthread_t th; void *status;
+int
+main ()
+{
+pthread_tryjoin_np (th, &status);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ enable_linux_futex=yes
+else
+ if test x$cross_compiling = xno; then
+ if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null \
+ | LC_ALL=C grep -i NPTL > /dev/null 2>/dev/null; then :; else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The kernel might not support futex or gettid syscalls.
+If so, please configure with --disable-linux-futex" >&5
+$as_echo "$as_me: WARNING: The kernel might not support futex or gettid syscalls.
+If so, please configure with --disable-linux-futex" >&2;}
+ fi
+ fi
+ enable_linux_futex=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$save_LIBS"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ;;
+ yes)
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/syscall.h>
+ int lk;
+int
+main ()
+{
+syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+ as_fn_error "SYS_gettid and SYS_futex required for --enable-linux-futex" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ;;
+ esac
+ ;;
+ *)
+ enable_linux_futex=no
+ ;;
+esac
+if test x$enable_linux_futex = xyes; then
+ :
+fi
+
+
+# Check for pthread_{,attr_}[sg]etaffinity_np.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _GNU_SOURCE
+ #include <pthread.h>
+int
+main ()
+{
+cpu_set_t cpuset;
+ pthread_attr_t attr;
+ pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+ if (CPU_ISSET (0, &cpuset))
+ CPU_SET (1, &cpuset);
+ else
+ CPU_ZERO (&cpuset);
+ pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+ pthread_attr_init (&attr);
+ pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
+ pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+$as_echo "#define HAVE_PTHREAD_AFFINITY_NP 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+# At least for glibc, clock_gettime is in librt. But don't pull that
+# in if it still doesn't give us the function we want.
+if test $ac_cv_func_clock_gettime = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
+$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
+if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_rt_clock_gettime=yes
+else
+ ac_cv_lib_rt_clock_gettime=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
+$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
+if test "x$ac_cv_lib_rt_clock_gettime" = x""yes; then :
+ ac_cv_func_clock_gettime="yes"
+fi
+
+ if test $ac_cv_func_clock_gettime = yes; then
+ LIBS="-lrt $LIBS"
+
+$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
+
+ fi
+fi
+
+# See if we support thread-local storage.
+
+
+ # Check whether --enable-tls was given.
+if test "${enable_tls+set}" = set; then :
+ enableval=$enable_tls;
+ case "$enableval" in
+ yes|no) ;;
+ *) as_fn_error "Argument to enable/disable tls must be yes or no" "$LINENO" 5 ;;
+ esac
+
+else
+ enable_tls=yes
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports thread-local storage" >&5
+$as_echo_n "checking whether the target supports thread-local storage... " >&6; }
+if test "${gcc_cv_have_tls+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__thread int a; int b; int main() { return a = b; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ chktls_save_LDFLAGS="$LDFLAGS"
+ case $host in
+ *-*-linux*)
+ LDFLAGS="-shared -Wl,--no-undefined $LDFLAGS"
+ ;;
+ esac
+ chktls_save_CFLAGS="$CFLAGS"
+ CFLAGS="-fPIC $CFLAGS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int f() { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__thread int a; int b; int f() { return a = b; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ gcc_cv_have_tls=yes
+else
+ gcc_cv_have_tls=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+else
+ gcc_cv_have_tls=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$chktls_save_CFLAGS"
+ LDFLAGS="$chktls_save_LDFLAGS"
+else
+ gcc_cv_have_tls=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__thread int a; int b; int main() { return a = b; }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ chktls_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="-static $LDFLAGS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main() { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__thread int a; int b; int main() { return a = b; }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gcc_cv_have_tls=yes
+else
+ gcc_cv_have_tls=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+else
+ gcc_cv_have_tls=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$chktls_save_LDFLAGS"
+ if test $gcc_cv_have_tls = yes; then
+ chktls_save_CFLAGS="$CFLAGS"
+ thread_CFLAGS=failed
+ for flag in '' '-pthread' '-lpthread'; do
+ CFLAGS="$flag $chktls_save_CFLAGS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <pthread.h>
+ void *g(void *d) { return NULL; }
+int
+main ()
+{
+pthread_t t; pthread_create(&t,NULL,g,NULL);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ thread_CFLAGS="$flag"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "X$thread_CFLAGS" != Xfailed; then
+ break
+ fi
+ done
+ CFLAGS="$chktls_save_CFLAGS"
+ if test "X$thread_CFLAGS" != Xfailed; then
+ CFLAGS="$thread_CFLAGS $chktls_save_CFLAGS"
+ if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <pthread.h>
+ __thread int a;
+ static int *volatile a_in_other_thread;
+ static void *
+ thread_func (void *arg)
+ {
+ a_in_other_thread = &a;
+ return (void *)0;
+ }
+int
+main ()
+{
+pthread_t thread;
+ void *thread_retval;
+ int *volatile a_in_main_thread;
+ a_in_main_thread = &a;
+ if (pthread_create (&thread, (pthread_attr_t *)0,
+ thread_func, (void *)0))
+ return 0;
+ if (pthread_join (thread, &thread_retval))
+ return 0;
+ return (a_in_other_thread == a_in_main_thread);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gcc_cv_have_tls=yes
+else
+ gcc_cv_have_tls=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ CFLAGS="$chktls_save_CFLAGS"
+ fi
+ fi
+else
+ gcc_cv_have_tls=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_tls" >&5
+$as_echo "$gcc_cv_have_tls" >&6; }
+ if test "$enable_tls $gcc_cv_have_tls" = "yes yes"; then
+
+$as_echo "#define HAVE_TLS 1" >>confdefs.h
+
+ fi
+
+# See what sort of export controls are available.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports hidden visibility" >&5
+$as_echo_n "checking whether the target supports hidden visibility... " >&6; }
+if test "${libgupc_cv_have_attribute_visibility+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+void __attribute__((visibility("hidden"))) foo(void) { }
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libgupc_cv_have_attribute_visibility=yes
+else
+ libgupc_cv_have_attribute_visibility=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgupc_cv_have_attribute_visibility" >&5
+$as_echo "$libgupc_cv_have_attribute_visibility" >&6; }
+ if test $libgupc_cv_have_attribute_visibility = yes; then
+
+$as_echo "#define HAVE_ATTRIBUTE_VISIBILITY 1" >>confdefs.h
+
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports dllexport" >&5
+$as_echo_n "checking whether the target supports dllexport... " >&6; }
+if test "${libgupc_cv_have_attribute_dllexport+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+void __attribute__((dllexport)) foo(void) { }
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libgupc_cv_have_attribute_dllexport=yes
+else
+ libgupc_cv_have_attribute_dllexport=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgupc_cv_have_attribute_dllexport" >&5
+$as_echo "$libgupc_cv_have_attribute_dllexport" >&6; }
+ if test $libgupc_cv_have_attribute_dllexport = yes; then
+
+$as_echo "#define HAVE_ATTRIBUTE_DLLEXPORT 1" >>confdefs.h
+
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports symbol aliases" >&5
+$as_echo_n "checking whether the target supports symbol aliases... " >&6; }
+if test "${libgupc_cv_have_attribute_alias+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+void foo(void) { }
+extern void bar(void) __attribute__((alias("foo")));
+int
+main ()
+{
+bar();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ libgupc_cv_have_attribute_alias=yes
+else
+ libgupc_cv_have_attribute_alias=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgupc_cv_have_attribute_alias" >&5
+$as_echo "$libgupc_cv_have_attribute_alias" >&6; }
+ if test $libgupc_cv_have_attribute_alias = yes; then
+
+$as_echo "#define HAVE_ATTRIBUTE_ALIAS 1" >>confdefs.h
+
+ fi
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+ # If we're not using GNU ld, then there's no point in even trying these
+ # tests. Check for that first. We should have already tested for gld
+ # by now (in libtool), but require it now just to be safe...
+ test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
+ test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
+
+
+
+ # The name set by libtool depends on the version of libtool. Shame on us
+ # for depending on an impl detail, but c'est la vie. Older versions used
+ # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
+ # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
+ # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
+ # set (hence we're using an older libtool), then set it.
+ if test x${with_gnu_ld+set} != xset; then
+ if test x${ac_cv_prog_gnu_ld+set} != xset; then
+ # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
+ with_gnu_ld=no
+ else
+ with_gnu_ld=$ac_cv_prog_gnu_ld
+ fi
+ fi
+
+ # Start by getting the version number. I think the libtool test already
+ # does some of this, but throws away the result.
+ libgupc_ld_is_gold=no
+ if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
+ libgupc_ld_is_gold=yes
+ fi
+
+ ldver=`$LD --version 2>/dev/null |
+ sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+
+ libgupc_gnu_ld_version=`echo $ldver | \
+ $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
+
+ # Set --gc-sections.
+ if test "$with_gnu_ld" = "notbroken"; then
+ # GNU ld it is! Joy and bunny rabbits!
+
+ # All these tests are for C++; save the language and the compiler flags.
+ # Need to do this so that g++ won't try to link in libstdc++
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS='-x c++ -Wl,--gc-sections'
+
+ # Check for -Wl,--gc-sections
+ # XXX This test is broken at the moment, as symbols required for linking
+ # are now in libsupc++ (not built yet). In addition, this test has
+ # cored on solaris in the past. In addition, --gc-sections doesn't
+ # really work at the moment (keeps on discarding used sections, first
+ # .eh_frame and now some of the glibc sections for iconv).
+ # Bzzzzt. Thanks for playing, maybe next time.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,--gc-sections" >&5
+$as_echo_n "checking for ld that supports -Wl,--gc-sections... " >&6; }
+ if test "$cross_compiling" = yes; then :
+ ac_sectionLDflags=yes
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ int main(void)
+ {
+ try { throw 1; }
+ catch (...) { };
+ return 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_sectionLDflags=yes
+else
+ ac_sectionLDflags=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ else
+ # this is the suspicious part
+ CFLAGS=''
+ fi
+ if test "$ac_sectionLDflags" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_sectionLDflags" >&5
+$as_echo "$ac_sectionLDflags" >&6; }
+ fi
+
+ # Set linker optimization flags.
+ if test x"$with_gnu_ld" = x"yes"; then
+ OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
+ fi
+
+
+
+
+
+
+ # Check whether --enable-symvers was given.
+if test "${enable_symvers+set}" = set; then :
+ enableval=$enable_symvers;
+ case "$enableval" in
+ yes|no|gnu) ;;
+ *) as_fn_error "Unknown argument to enable/disable symvers" "$LINENO" 5 ;;
+ esac
+
+else
+ enable_symvers=yes
+fi
+
+
+
+# If we never went through the LIBGUPC_CHECK_LINKER_FEATURES macro, then we
+# don't know enough about $LD to do tricks...
+
+# FIXME The following test is too strict, in theory.
+if test $enable_shared = no ||
+ test "x$LD" = x ||
+ test x$libgupc_gnu_ld_version = x; then
+ enable_symvers=no
+fi
+
+# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
+if test $enable_symvers != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared libgcc" >&5
+$as_echo_n "checking for shared libgcc... " >&6; }
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=' -lgcc_s'
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ libgupc_shared_libgcc=yes
+else
+ libgupc_shared_libgcc=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$ac_save_CFLAGS"
+ if test $libgupc_shared_libgcc = no; then
+ cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+ libgupc_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+ -shared -shared-libgcc -o conftest.so \
+ conftest.c -v 2>&1 >/dev/null \
+ | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
+ rm -f conftest.c conftest.so
+ if test x${libgupc_libgcc_s_suffix+set} = xset; then
+ CFLAGS=" -lgcc_s$libgupc_libgcc_s_suffix"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ libgupc_shared_libgcc=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$ac_save_CFLAGS"
+ fi
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgupc_shared_libgcc" >&5
+$as_echo "$libgupc_shared_libgcc" >&6; }
+fi
+
+# For GNU ld, we need at least this version. The format is described in
+# LIBGUPC_CHECK_LINKER_FEATURES above.
+libgupc_min_gnu_ld_version=21400
+# XXXXXXXXXXX libgupc_gnu_ld_version=21390
+
+# Check to see if unspecified "yes" value can win, given results above.
+# Change "yes" into either "no" or a style name.
+if test $enable_symvers = yes; then
+ if test $with_gnu_ld = yes &&
+ test $libgupc_shared_libgcc = yes;
+ then
+ if test $libgupc_gnu_ld_version -ge $libgupc_min_gnu_ld_version ; then
+ enable_symvers=gnu
+ elif test $libgupc_ld_is_gold = yes ; then
+ enable_symvers=gnu
+ else
+ # The right tools, the right setup, but too old. Fallbacks?
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === Linker version $libgupc_gnu_ld_version is too old for" >&5
+$as_echo "$as_me: WARNING: === Linker version $libgupc_gnu_ld_version is too old for" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === full symbol versioning support in this release of GCC." >&5
+$as_echo "$as_me: WARNING: === full symbol versioning support in this release of GCC." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === You would need to upgrade your binutils to version" >&5
+$as_echo "$as_me: WARNING: === You would need to upgrade your binutils to version" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === $libgupc_min_gnu_ld_version or later and rebuild GCC." >&5
+$as_echo "$as_me: WARNING: === $libgupc_min_gnu_ld_version or later and rebuild GCC." >&2;}
+ if test $libgupc_gnu_ld_version -ge 21200 ; then
+ # Globbing fix is present, proper block support is not.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === Symbol versioning will be disabled." >&5
+$as_echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
+ enable_symvers=no
+ else
+ # 2.11 or older.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === Symbol versioning will be disabled." >&5
+$as_echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
+ enable_symvers=no
+ fi
+ fi
+ else
+ # just fail for now
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === You have requested some kind of symbol versioning, but" >&5
+$as_echo "$as_me: WARNING: === You have requested some kind of symbol versioning, but" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === either you are not using a supported linker, or you are" >&5
+$as_echo "$as_me: WARNING: === either you are not using a supported linker, or you are" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === not building a shared libgcc_s (which is required)." >&5
+$as_echo "$as_me: WARNING: === not building a shared libgcc_s (which is required)." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === Symbol versioning will be disabled." >&5
+$as_echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
+ enable_symvers=no
+ fi
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports .symver directive" >&5
+$as_echo_n "checking whether the target supports .symver directive... " >&6; }
+if test "${libgupc_cv_have_as_symver_directive+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+void foo (void); __asm (".symver foo, bar@SYMVER");
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libgupc_cv_have_as_symver_directive=yes
+else
+ libgupc_cv_have_as_symver_directive=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgupc_cv_have_as_symver_directive" >&5
+$as_echo "$libgupc_cv_have_as_symver_directive" >&6; }
+if test $libgupc_cv_have_as_symver_directive = yes; then
+
+$as_echo "#define HAVE_AS_SYMVER_DIRECTIVE 1" >>confdefs.h
+
+fi
+
+ if test $enable_symvers != no; then
+ LIBGUPC_BUILD_VERSIONED_SHLIB_TRUE=
+ LIBGUPC_BUILD_VERSIONED_SHLIB_FALSE='#'
+else
+ LIBGUPC_BUILD_VERSIONED_SHLIB_TRUE='#'
+ LIBGUPC_BUILD_VERSIONED_SHLIB_FALSE=
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: versioning on shared library symbols is $enable_symvers" >&5
+$as_echo "$as_me: versioning on shared library symbols is $enable_symvers" >&6;}
+
+
+if test $enable_symvers = gnu; then
+
+$as_echo "#define LIBGUPC_GNU_SYMBOL_VERSIONING 1" >>confdefs.h
+
+fi
+
+CFLAGS="$save_CFLAGS $XCFLAGS"
+
+# Check for __sync_val_compare_and_swap, but only after the target has
+# had a chance to set XCFLAGS.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports __sync_*_compare_and_swap" >&5
+$as_echo_n "checking whether the target supports __sync_*_compare_and_swap... " >&6; }
+if test "${libgupc_cv_have_sync_builtins+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+int foo; (void) __sync_val_compare_and_swap(&foo, 0, 1);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ libgupc_cv_have_sync_builtins=yes
+else
+ libgupc_cv_have_sync_builtins=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgupc_cv_have_sync_builtins" >&5
+$as_echo "$libgupc_cv_have_sync_builtins" >&6; }
+ if test $libgupc_cv_have_sync_builtins = yes; then
+
+$as_echo "#define HAVE_SYNC_BUILTINS 1" >>confdefs.h
+
+ fi
+
+# Check for __sync_fetch_and_add
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sync_fetch_and_add_4" >&5
+$as_echo_n "checking for __sync_fetch_and_add_4... " >&6; }
+if test "${upc_cv_sync_fetch_and_add_4+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+typedef unsigned int uint32 __attribute__ ((mode (SI)));
+uint32 i;
+int main() { return __sync_fetch_and_add (&i, 1); }
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ upc_cv_sync_fetch_and_add_4=yes
+else
+ upc_cv_sync_fetch_and_add_4=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_cv_sync_fetch_and_add_4" >&5
+$as_echo "$upc_cv_sync_fetch_and_add_4" >&6; }
+if test "$upc_cv_sync_fetch_and_add_4" = "yes"; then
+
+$as_echo "#define HAVE_SYNC_FETCH_AND_ADD_4 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sync_fetch_and_add_8" >&5
+$as_echo_n "checking for __sync_fetch_and_add_8... " >&6; }
+if test "${upc_cv_sync_fetch_and_add_8+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+typedef unsigned int uint64 __attribute__ ((mode (DI)));
+uint64 i;
+int main() { return __sync_fetch_and_add (&i, 1); }
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ upc_cv_sync_fetch_and_add_8=yes
+else
+ upc_cv_sync_fetch_and_add_8=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_cv_sync_fetch_and_add_8" >&5
+$as_echo "$upc_cv_sync_fetch_and_add_8" >&6; }
+if test "$upc_cv_sync_fetch_and_add_8" = "yes"; then
+
+$as_echo "#define HAVE_SYNC_FETCH_AND_ADD_8 1" >>confdefs.h
+
+fi
+
+XCFLAGS="$XCFLAGS"
+
+
+# Cleanup and exit.
+CFLAGS="$save_CFLAGS"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+if test "x${multilib}" = xyes; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread model used by GCC" >&5
+$as_echo_n "checking for thread model used by GCC... " >&6; }
+target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $target_thread_file" >&5
+$as_echo "$target_thread_file" >&6; }
+
+if test $target_thread_file != single; then
+
+$as_echo "#define HAVE_GTHR_DEFAULT 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking UPC shared pointer representation" >&5
+$as_echo_n "checking UPC shared pointer representation... " >&6; }
+cat > conftest.upc << _ACEOF
+#define _XSTR(X) #X
+#define _STR(S) _XSTR(S)
+#ifdef __UPC_LINK_SCRIPT__
+ GUPCR_LINK_SCRIPT=1
+#else
+ GUPCR_LINK_SCRIPT=0
+#endif
+#ifdef __UPC_VADDR_FIRST__
+ GUPCR_PTS_VADDR_FIRST=1
+#else
+ GUPCR_PTS_VADDR_FIRST=0
+#endif
+GUPCR_PTS_VADDR_SIZE=_STR(__UPC_VADDR_SIZE__)
+GUPCR_PTS_PHASE_SIZE=_STR(__UPC_PHASE_SIZE__)
+GUPCR_PTS_THREAD_SIZE=_STR(__UPC_THREAD_SIZE__)
+#if __UPC_PTS_STRUCT_REP__
+ GUPCR_PTS_REP="struct"
+ GUPCR_PTS_STRUCT_REP=1
+ GUPCR_PTS_VADDR_TYPE=_STR(__UPC_VADDR_TYPE__)
+ GUPCR_PTS_PHASE_TYPE=_STR(__UPC_PHASE_TYPE__)
+ GUPCR_PTS_THREAD_TYPE=_STR(__UPC_THREAD_TYPE__)
+ #if __UPC_PTS_ALIGN__
+ GUPCR_PTS_ALIGN=_STR(__UPC_PTS_ALIGN__)
+ #endif
+#else
+ GUPCR_PTS_REP="packed"
+ GUPCR_PTS_PACKED_REP=1
+#endif
+_ACEOF
+eval `$UPC -fno-upc-pre-include -DNO_GCC_UPC_LIB=1 -E conftest.upc | \
+ grep '^ *GUPCR_[A-Z0-9_]*='`
+rm -f conftest.upc
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUPCR_PTS_REP" >&5
+$as_echo "$GUPCR_PTS_REP" >&6; }
+if test -z "$GUPCR_PTS_REP"; then
+ as_fn_error "can't determine UPC sptr representation" "$LINENO" 5
+fi
+for cfg in \
+ GUPCR_PTS_PACKED_REP \
+ GUPCR_PTS_PHASE_SIZE \
+ GUPCR_PTS_PHASE_TYPE \
+ GUPCR_PTS_REP \
+ GUPCR_PTS_STRUCT_REP \
+ GUPCR_PTS_ALIGN \
+ GUPCR_PTS_THREAD_SIZE \
+ GUPCR_PTS_THREAD_TYPE \
+ GUPCR_PTS_VADDR_FIRST \
+ GUPCR_PTS_VADDR_SIZE \
+ GUPCR_PTS_VADDR_TYPE \
+ GUPCR_LINK_SCRIPT; do
+ eval "cval=\$$cfg"
+ if test -n "$cval"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking value of $cfg" >&5
+$as_echo_n "checking value of $cfg... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cval" >&5
+$as_echo "$cval" >&6; }
+ fi
+done
+if test -n "$with_upc_pts" \
+ && test "$with_upc_pts" != "$GUPCR_PTS_REP" ; then
+ as_fn_error "--with-upc-pts=$with_upc_pts is incompatible with the
+UPC compiler's supported pointer-to-shared representation ($GUPCR_PTS_REP)" "$LINENO" 5
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_PTS_VADDR_SIZE $GUPCR_PTS_VADDR_SIZE
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_PTS_THREAD_SIZE $GUPCR_PTS_THREAD_SIZE
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_PTS_PHASE_SIZE $GUPCR_PTS_PHASE_SIZE
+_ACEOF
+
+if test "$GUPCR_PTS_REP" = "struct"; then
+
+$as_echo "#define GUPCR_PTS_STRUCT_REP 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_PTS_VADDR_TYPE $GUPCR_PTS_VADDR_TYPE
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_PTS_THREAD_TYPE $GUPCR_PTS_THREAD_TYPE
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_PTS_PHASE_TYPE $GUPCR_PTS_PHASE_TYPE
+_ACEOF
+
+ if test -n "$GUPCR_PTS_ALIGN"; then
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_PTS_ALIGN $GUPCR_PTS_ALIGN
+_ACEOF
+
+ fi
+else
+
+$as_echo "#define GUPCR_PTS_PACKED_REP 1" >>confdefs.h
+
+fi
+if test "$GUPCR_PTS_VADDR_FIRST" -eq 1; then
+
+$as_echo "#define GUPCR_PTS_VADDR_FIRST 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: determine UPC target-dependent section names" >&5
+$as_echo "$as_me: determine UPC target-dependent section names" >&6;}
+cat > conftest.upc << _ACEOF
+#define _XSTR(X) #X
+#define _STR(S) _XSTR(S)
+
+#ifdef __UPC_INIT_ARRAY_SECTION_NAME__
+ GUPCR_INIT_ARRAY_SECTION_NAME=_STR(__UPC_INIT_ARRAY_SECTION_NAME__)
+#endif
+#ifdef __UPC_PGM_INFO_SECTION_NAME__
+ GUPCR_PGM_INFO_SECTION_NAME=_STR(__UPC_PGM_INFO_SECTION_NAME__)
+#endif
+#ifdef __UPC_SHARED_SECTION_NAME__
+ GUPCR_SHARED_SECTION_NAME=_STR(__UPC_SHARED_SECTION_NAME__)
+#endif
+_ACEOF
+eval `$UPC -fno-upc-pre-include -DNO_GCC_UPC_LIB=1 -E conftest.upc | \
+ grep '^ *GUPCR_[A-Z0-9_]*='`
+rm -f conftest.upc
+for cfg in \
+ GUPCR_INIT_ARRAY_SECTION_NAME \
+ GUPCR_PGM_INFO_SECTION_NAME \
+ GUPCR_SHARED_SECTION_NAME; do
+ eval "cval=\$$cfg"
+ if test -n "$cval"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking value of $cfg" >&5
+$as_echo_n "checking value of $cfg... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cval" >&5
+$as_echo "$cval" >&6; }
+ fi
+done
+if test -n "$GUPCR_INIT_ARRAY_SECTION_NAME"; then
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_INIT_ARRAY_SECTION_NAME $GUPCR_INIT_ARRAY_SECTION_NAME
+_ACEOF
+
+fi
+if test -n "$GUPCR_PGM_INFO_SECTION_NAME"; then
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_PGM_INFO_SECTION_NAME $GUPCR_PGM_INFO_SECTION_NAME
+_ACEOF
+
+fi
+if test -n "$GUPCR_SHARED_SECTION_NAME"; then
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_SHARED_SECTION_NAME $GUPCR_SHARED_SECTION_NAME
+_ACEOF
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime model" >&5
+$as_echo_n "checking for UPC runtime model... " >&6; }
+
+# Check whether --with-upc-runtime was given.
+if test "${with_upc_runtime+set}" = set; then :
+ withval=$with_upc_runtime;
+ case "$withval" in
+ [Ss][Mm][Pp])
+ upc_runtime_model=smp
+ ;;
+ [Pp][Oo][Rr][Tt][Aa][Ll][Ss]4)
+ upc_runtime_model=portals4
+ ;;
+ *)
+ as_fn_error "$withval is an invalid runtime model for
+ --with-upc-runtime" "$LINENO" 5
+ ;;
+ esac
+
+else
+
+ upc_runtime_model=smp
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_runtime_model" >&5
+$as_echo "$upc_runtime_model" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime checking support" >&5
+$as_echo_n "checking for UPC runtime checking support... " >&6; }
+# Check whether --enable-upc-runtime-checks was given.
+if test "${enable_upc_runtime_checks+set}" = set; then :
+ enableval=$enable_upc_runtime_checks;
+ case $enableval in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-runtime-checks accepts only yes or no." "$LINENO" 5
+ esac
+
+else
+
+ enable_upc_runtime_checks=no
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_runtime_checks" >&5
+$as_echo "$enable_upc_runtime_checks" >&6; }
+if test "$enable_upc_runtime_checks" = "yes"; then
+
+$as_echo "#define GUPCR_HAVE_CHECKS 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime statistics support" >&5
+$as_echo_n "checking for UPC runtime statistics support... " >&6; }
+# Check whether --enable-upc-runtime-stats was given.
+if test "${enable_upc_runtime_stats+set}" = set; then :
+ enableval=$enable_upc_runtime_stats;
+ case $enableval in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-runtime-stats accepts only yes or no." "$LINENO" 5
+ esac
+
+else
+
+ enable_upc_runtime_stats=no
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_runtime_stats" >&5
+$as_echo "$enable_upc_runtime_stats" >&6; }
+if test "$enable_upc_runtime_stats" = "yes"; then
+
+$as_echo "#define GUPCR_HAVE_STATS 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime trace support" >&5
+$as_echo_n "checking for UPC runtime trace support... " >&6; }
+# Check whether --enable-upc-runtime-trace was given.
+if test "${enable_upc_runtime_trace+set}" = set; then :
+ enableval=$enable_upc_runtime_trace;
+ case $enableval in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-runtime-trace accepts only yes or no." "$LINENO" 5
+ esac
+
+else
+
+ enable_upc_runtime_trace=no
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_runtime_trace" >&5
+$as_echo "$enable_upc_runtime_trace" >&6; }
+if test "$enable_upc_runtime_trace" = "yes"; then
+
+$as_echo "#define GUPCR_HAVE_TRACE 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime debug configuration" >&5
+$as_echo_n "checking for UPC runtime debug configuration... " >&6; }
+# Check whether --enable-upc-runtime-debug was given.
+if test "${enable_upc_runtime_debug+set}" = set; then :
+ enableval=$enable_upc_runtime_debug;
+ case $enableval in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-runtime-debug accepts only yes or no." "$LINENO" 5
+ esac
+
+else
+
+ enable_upc_runtime_debug=no
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_runtime_debug" >&5
+$as_echo "$enable_upc_runtime_debug" >&6; }
+if test "$enable_upc_runtime_debug" = "yes"; then
+
+$as_echo "#define GUPCR_HAVE_DEBUG 1" >>confdefs.h
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC link script support" >&5
+$as_echo_n "checking for UPC link script support... " >&6; }
+if test -n "$GUPCR_LINK_SCRIPT" \
+ && test "$GUPCR_LINK_SCRIPT" -eq 1; then
+ upc_link_script=yes
+else
+ upc_link_script=no
+fi
+if test x"$upc_link_script" = xyes; then
+ gen_ld_script=${srcdir}/gen-upc-ld-script.pl
+ if ! ${LD} --verbose | ${PERL} $gen_ld_script 1>/dev/null ; then
+ # if gen-upc-ld-script did not accept the output of the linker
+ # then disable UPC link script support.
+ as_fn_error "selected linker does not support linker scripts" "$LINENO" 5
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_link_script" >&5
+$as_echo "$upc_link_script" >&6; }
+if test x"$upc_link_script" = xyes; then
+
+$as_echo "#define use_upc_link_script 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime tree fanout" >&5
+$as_echo_n "checking for UPC runtime tree fanout... " >&6; }
+
+# Check whether --with-upc-runtime-tree-fanout was given.
+if test "${with_upc_runtime_tree_fanout+set}" = set; then :
+ withval=$with_upc_runtime_tree_fanout;
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[0-9][0-9]*$' >/dev/null 2>&1; then
+ as_fn_error "$withval is an invalid option to
+ --with-upc-runtime-tree-fanout" "$LINENO" 5
+ fi
+ upc_runtime_tree_fanout="$withval"
+
+else
+
+ upc_runtime_tree_fanout=4
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_runtime_tree_fanout" >&5
+$as_echo "$upc_runtime_tree_fanout" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_TREE_FANOUT $upc_runtime_tree_fanout
+_ACEOF
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC backtrace support" >&5
+$as_echo_n "checking for UPC backtrace support... " >&6; }
+# Check whether --enable-upc-backtrace was given.
+if test "${enable_upc_backtrace+set}" = set; then :
+ enableval=$enable_upc_backtrace;
+ case $enableval in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-backtrace accepts only yes or no" "$LINENO" 5
+ esac
+
+else
+
+ enable_upc_backtrace=yes
+
+fi
+
+# Check for execinfo library (needed on BSD systems for UPC backtracing)
+case "${target}" in
+ *-*-freebsd* | *-*-openbsd* | *-*-netbsd* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for backtrace in -lexecinfo" >&5
+$as_echo_n "checking for backtrace in -lexecinfo... " >&6; }
+if test "${ac_cv_lib_execinfo_backtrace+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lexecinfo $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char backtrace ();
+int
+main ()
+{
+return backtrace ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_execinfo_backtrace=yes
+else
+ ac_cv_lib_execinfo_backtrace=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_execinfo_backtrace" >&5
+$as_echo "$ac_cv_lib_execinfo_backtrace" >&6; }
+if test "x$ac_cv_lib_execinfo_backtrace" = x""yes; then :
+ execinfo_lib="yes"
+fi
+
+ if test "x$execinfo_lib" = xyes; then
+ enable_execinfo_lib=yes
+ else
+ enable_upc_backtrace=no
+ fi
+ ;;
+ *) ;;
+esac
+if test "$enable_upc_backtrace" = yes; then
+
+$as_echo "#define HAVE_UPC_BACKTRACE 1" >>confdefs.h
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_backtrace" >&5
+$as_echo "$enable_upc_backtrace" >&6; }
+
+# Check for user specified GDB
+
+# Check whether --with-upc-backtrace-gdb was given.
+if test "${with_upc_backtrace_gdb+set}" = set; then :
+ withval=$with_upc_backtrace_gdb;
+ upc_backtrace_gdb=$withval
+
+else
+
+ upc_backtrace_gdb=gdb
+
+fi
+
+for ac_prog in $GDB $upc_backtrace_gdb
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PATH_TO_GDB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PATH_TO_GDB in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PATH_TO_GDB="$PATH_TO_GDB" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="/usr/bin:${PATH}"
+for as_dir in $as_dummy
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PATH_TO_GDB="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PATH_TO_GDB=$ac_cv_path_PATH_TO_GDB
+if test -n "$PATH_TO_GDB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_TO_GDB" >&5
+$as_echo "$PATH_TO_GDB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PATH_TO_GDB" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC backtrace GDB to use" >&5
+$as_echo_n "checking for UPC backtrace GDB to use... " >&6; }
+if test -n "$PATH_TO_GDB"; then
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_BACKTRACE_GDB "$PATH_TO_GDB"
+_ACEOF
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_TO_GDB" >&5
+$as_echo "$PATH_TO_GDB" >&6; }
+ upc_backtrace_gdb_available=yes
+else
+ upc_backtrace_gdb_available=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC backtrace GDB support" >&5
+$as_echo_n "checking for UPC backtrace GDB support... " >&6; }
+# Check whether --enable-upc-backtrace-gdb was given.
+if test "${enable_upc_backtrace_gdb+set}" = set; then :
+ enableval=$enable_upc_backtrace_gdb;
+ case "$enableval" in
+ yes | no)
+ if test "$enableval" = yes &&
+ test "$upc_backtrace_gdb_available" = no; then
+ as_fn_error "Cannot find gdb. Set the correct gdb path with
+ --with-upc-backtrace-gdb option or disable gdb backtrace with
+ --disable-upc-backtrace-gdb option." "$LINENO" 5
+ fi
+ ;;
+ *)
+ as_fn_error "--enable-upc-backtrace-gdb accepts only yes or no" "$LINENO" 5
+ esac
+
+else
+
+ enable_upc_backtrace_gdb=$upc_backtrace_gdb_available
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_backtrace_gdb" >&5
+$as_echo "$enable_upc_backtrace_gdb" >&6; }
+if test "$enable_upc_backtrace_gdb" = yes; then
+
+$as_echo "#define HAVE_UPC_BACKTRACE_GDB 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC backtrace signal support" >&5
+$as_echo_n "checking for UPC backtrace signal support... " >&6; }
+# Check whether --enable-upc-backtrace-signal was given.
+if test "${enable_upc_backtrace_signal+set}" = set; then :
+ enableval=$enable_upc_backtrace_signal;
+ case "$enableval" in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-backtrace-signal accepts only yes or no" "$LINENO" 5
+ esac
+
+else
+
+ enable_upc_backtrace_signal=yes
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_backtrace_signal" >&5
+$as_echo "$enable_upc_backtrace_signal" >&6; }
+if test "$enable_upc_backtrace_signal" = yes; then
+
+$as_echo "#define HAVE_UPC_BACKTRACE_SIGNAL 1" >>confdefs.h
+
+
+ # Check for user specified signal name/number
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC backtrace signal name/number" >&5
+$as_echo_n "checking for UPC backtrace signal name/number... " >&6; }
+
+# Check whether --with-upc-backtrace-signal was given.
+if test "${with_upc_backtrace_signal+set}" = set; then :
+ withval=$with_upc_backtrace_signal;
+ upc_backtrace_signal=$withval
+
+else
+
+ upc_backtrace_signal=SIGUSR1
+
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_BACKTRACE_SIGNAL $upc_backtrace_signal
+_ACEOF
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_backtrace_signal" >&5
+$as_echo "$upc_backtrace_signal" >&6; }
+fi
+
+if test "$enable_upc_backtrace" = yes; then
+ # Check if backtrace can use addr2line
+ if test x"$ADDR2LINE" != x""; then
+
+$as_echo "#define HAVE_UPC_BACKTRACE_ADDR2LINE 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_BACKTRACE_ADDR2LINE "$ADDR2LINE"
+_ACEOF
+
+ fi
+fi
+
+if test "$upc_runtime_model" = "smp"; then
+
+ targ_runtime_pthreads=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the GCC __threads extension is supported." >&5
+$as_echo_n "checking whether the GCC __threads extension is supported.... " >&6; }
+if test "${upc_cv_gcc_tls_supported+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ SAVE_LIBS="$LIBS"
+LIBS="$LIBS -lpthread"
+if test "$cross_compiling" = yes; then :
+ upc_cv_gcc_tls_supported="no"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+#include <stddef.h>
+#include <malloc.h>
+#include <errno.h>
+#include <pthread.h>
+
+#define NTHREADS 5
+
+pthread_t p[NTHREADS];
+
+pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+__thread long tlocal = 0;
+
+void *
+thread_start (void *arg)
+{
+ int id = *((int *)arg);
+ int *return_val = malloc(sizeof(int));
+ if (pthread_mutex_lock (&lock))
+ { exit (2); }
+ /* if the value is truly thread-local, this assignment
+ will yield the value 1, for each thread. If tlocal
+ is instead a process global static value then tlocal
+ will be incremented by each thread, and its final
+ value will be the number of threads. */
+ tlocal += 1;
+ if (pthread_mutex_unlock (&lock))
+ { exit (2); }
+ *return_val = tlocal;
+ return return_val;
+}
+
+int
+main()
+{
+ int i;
+ for (i = 0; i < NTHREADS; ++i)
+ {
+ int *id = (int *)malloc(sizeof(int));
+ *id = i;
+ if (pthread_create(&p[i], NULL, thread_start, id))
+ { exit (2); }
+ }
+ for (i = 0; i < NTHREADS; ++i)
+ {
+ int *rc;
+ if (pthread_join (p[i], (void **)&rc))
+ { exit (2); }
+ if (*rc != 1)
+ { exit (1); }
+ }
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ upc_cv_gcc_tls_supported="yes"
+else
+ upc_cv_gcc_tls_supported="no"
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ LIBS="$SAVE_LIBS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_cv_gcc_tls_supported" >&5
+$as_echo "$upc_cv_gcc_tls_supported" >&6; }
+
+ if test "$upc_cv_gcc_tls_supported"x = "yes"x ; then
+ targ_runtime_pthreads=yes
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux scheduling affinity" >&5
+$as_echo_n "checking for Linux scheduling affinity... " >&6; }
+ if test "$cross_compiling" = yes; then :
+ upc_affinity=no
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+ #define _GNU_SOURCE
+ #include <sched.h>
+ cpu_set_t mask;
+ main ()
+ {
+ unsigned int len = sizeof(mask);
+ if (sched_getaffinity(0, len, &mask) < 0) {
+ return 1;
+ }
+ return 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ upc_affinity=yes
+else
+ upc_affinity=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ if test "x$enable_upc_affinity" = "xyes" &&
+ test "x$upc_affinity" = "xno"; then
+ as_fn_error "scheduling affinity enabled but not supported
+ - use --disable-upc-affinity" "$LINENO" 5
+ fi
+ if test "x$enable_upc_affinity" = "xno"; then
+ upc_affinity=no;
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_affinity" >&5
+$as_echo "$upc_affinity" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if NUMA available" >&5
+$as_echo_n "checking if NUMA available... " >&6; }
+ save_LIBS="$LIBS"
+ LIBS="-lnuma"
+ if test "$cross_compiling" = yes; then :
+ upc_numa=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+ #include <numa.h>
+ int
+ main ()
+ {
+ if (numa_available() < 0) return 1;
+ else return 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ upc_numa=yes
+else
+ upc_numa=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ LIBS="$save_LIBS"
+ if test "x$enable_upc_numa" = "xyes" &&
+ test "x$upc_numa" = "xno"; then
+ as_fn_error "NUMA enabled but not supported - use --disable-upc-numa" "$LINENO" 5
+ fi
+ if test "x$enable_upc_numa" = "xno" \
+ -o "x$enable_upc_affinity" = "xno"; then
+ upc_numa=no;
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_numa" >&5
+$as_echo "$upc_numa" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC GUM debugging support" >&5
+$as_echo_n "checking for UPC GUM debugging support... " >&6; }
+ # Check whether --enable-upc-gum-debug was given.
+if test "${enable_upc_gum_debug+set}" = set; then :
+ enableval=$enable_upc_gum_debug;
+ case $enableval in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-gum-debug accepts only yes or no" "$LINENO" 5
+ esac
+ upc_gum_debug=$enableval
+
+else
+
+ upc_gum_debug=no
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_gum_debug" >&5
+$as_echo "$upc_gum_debug" >&6; }
+ if test "x${upc_gum_debug}" = "xyes"; then
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_HAVE_GUM_DEBUG 1
+_ACEOF
+
+ fi
+ # Use the generic (reference implementation)
+ use_generic_collectives="yes"
+
+
+
+
+#Variables:
+DX_PROJECT=${PACKAGE}
+
+
+# Files:
+DX_CONFIG=doxygen.cfg
+
+DX_DOCDIR=doc
+
+
+# Environment variables used inside doxygen.cfg:
+DX_ENV="$DX_ENV SRCDIR='$srcdir'"
+
+DX_ENV="$DX_ENV PROJECT='$DX_PROJECT'"
+
+DX_ENV="$DX_ENV DOCDIR='$DX_DOCDIR'"
+
+DX_ENV="$DX_ENV VERSION='$PACKAGE_VERSION'"
+
+
+# Doxygen itself:
+
+
+
+ # Check whether --enable-doxygen-doc was given.
+if test "${enable_doxygen_doc+set}" = set; then :
+ enableval=$enable_doxygen_doc;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_doc=1
+
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_doc=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-doc" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_doc=0
+
+
+
+fi
+
+if test "$DX_FLAG_doc" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}doxygen", so it can be a program name with args.
+set dummy ${ac_tool_prefix}doxygen; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_DOXYGEN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_DOXYGEN in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_DOXYGEN="$DX_DOXYGEN" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_DOXYGEN="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_DOXYGEN=$ac_cv_path_DX_DOXYGEN
+if test -n "$DX_DOXYGEN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOXYGEN" >&5
+$as_echo "$DX_DOXYGEN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_DOXYGEN"; then
+ ac_pt_DX_DOXYGEN=$DX_DOXYGEN
+ # Extract the first word of "doxygen", so it can be a program name with args.
+set dummy doxygen; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_DOXYGEN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_DOXYGEN in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_DOXYGEN="$ac_pt_DX_DOXYGEN" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_DOXYGEN="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_DOXYGEN=$ac_cv_path_ac_pt_DX_DOXYGEN
+if test -n "$ac_pt_DX_DOXYGEN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOXYGEN" >&5
+$as_echo "$ac_pt_DX_DOXYGEN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_DOXYGEN" = x; then
+ DX_DOXYGEN=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_DOXYGEN=$ac_pt_DX_DOXYGEN
+ fi
+else
+ DX_DOXYGEN="$ac_cv_path_DX_DOXYGEN"
+fi
+
+if test "$DX_FLAG_doc$DX_DOXYGEN" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: doxygen not found - will not generate any doxygen documentation" >&5
+$as_echo "$as_me: WARNING: doxygen not found - will not generate any doxygen documentation" >&2;}
+ DX_FLAG_doc=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}perl", so it can be a program name with args.
+set dummy ${ac_tool_prefix}perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_PERL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_PERL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_PERL="$DX_PERL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_PERL="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_PERL=$ac_cv_path_DX_PERL
+if test -n "$DX_PERL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PERL" >&5
+$as_echo "$DX_PERL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_PERL"; then
+ ac_pt_DX_PERL=$DX_PERL
+ # Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_PERL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_PERL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_PERL="$ac_pt_DX_PERL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_PERL="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_PERL=$ac_cv_path_ac_pt_DX_PERL
+if test -n "$ac_pt_DX_PERL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PERL" >&5
+$as_echo "$ac_pt_DX_PERL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_PERL" = x; then
+ DX_PERL=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_PERL=$ac_pt_DX_PERL
+ fi
+else
+ DX_PERL="$ac_cv_path_DX_PERL"
+fi
+
+if test "$DX_FLAG_doc$DX_PERL" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: perl not found - will not generate any doxygen documentation" >&5
+$as_echo "$as_me: WARNING: perl not found - will not generate any doxygen documentation" >&2;}
+ DX_FLAG_doc=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args.
+set dummy ${ac_tool_prefix}file; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_FILE+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_FILE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_FILE="$DX_FILE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_FILE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_FILE=$ac_cv_path_DX_FILE
+if test -n "$DX_FILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_FILE" >&5
+$as_echo "$DX_FILE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_FILE"; then
+ ac_pt_DX_FILE=$DX_FILE
+ # Extract the first word of "file", so it can be a program name with args.
+set dummy file; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_FILE+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_FILE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_FILE="$ac_pt_DX_FILE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_FILE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_FILE=$ac_cv_path_ac_pt_DX_FILE
+if test -n "$ac_pt_DX_FILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_FILE" >&5
+$as_echo "$ac_pt_DX_FILE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_FILE" = x; then
+ DX_FILE=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_FILE=$ac_pt_DX_FILE
+ fi
+else
+ DX_FILE="$ac_cv_path_DX_FILE"
+fi
+
+if test "$DX_FLAG_doc$DX_FILE" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: file not found - will not generate any doxygen documentation" >&5
+$as_echo "$as_me: WARNING: file not found - will not generate any doxygen documentation" >&2;}
+ DX_FLAG_doc=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_doc" = 1; then
+ if :; then
+ DX_COND_doc_TRUE=
+ DX_COND_doc_FALSE='#'
+else
+ DX_COND_doc_TRUE='#'
+ DX_COND_doc_FALSE=
+fi
+
+ DX_ENV="$DX_ENV PERL_PATH='$DX_PERL'"
+
+ DOXYGEN_VERSION=`${DX_DOXYGEN} --version`
+
+ :
+else
+ if false; then
+ DX_COND_doc_TRUE=
+ DX_COND_doc_FALSE='#'
+else
+ DX_COND_doc_TRUE='#'
+ DX_COND_doc_FALSE=
+fi
+
+
+ :
+fi
+
+
+# Dot for graphics:
+
+
+
+ # Check whether --enable-doxygen-dot was given.
+if test "${enable_doxygen_dot+set}" = set; then :
+ enableval=$enable_doxygen_dot;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_dot=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-dot requires doxygen-dot" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_dot=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-dot" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_dot=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_dot=0
+
+
+
+fi
+
+if test "$DX_FLAG_dot" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dot", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dot; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_DOT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_DOT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_DOT="$DX_DOT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_DOT="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_DOT=$ac_cv_path_DX_DOT
+if test -n "$DX_DOT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOT" >&5
+$as_echo "$DX_DOT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_DOT"; then
+ ac_pt_DX_DOT=$DX_DOT
+ # Extract the first word of "dot", so it can be a program name with args.
+set dummy dot; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_DOT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_DOT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_DOT="$ac_pt_DX_DOT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_DOT="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_DOT=$ac_cv_path_ac_pt_DX_DOT
+if test -n "$ac_pt_DX_DOT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOT" >&5
+$as_echo "$ac_pt_DX_DOT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_DOT" = x; then
+ DX_DOT=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_DOT=$ac_pt_DX_DOT
+ fi
+else
+ DX_DOT="$ac_cv_path_DX_DOT"
+fi
+
+if test "$DX_FLAG_dot$DX_DOT" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dot not found - will not generate graphics for doxygen documentation" >&5
+$as_echo "$as_me: WARNING: dot not found - will not generate graphics for doxygen documentation" >&2;}
+ DX_FLAG_dot=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_dot" = 1; then
+ if :; then
+ DX_COND_dot_TRUE=
+ DX_COND_dot_FALSE='#'
+else
+ DX_COND_dot_TRUE='#'
+ DX_COND_dot_FALSE=
+fi
+
+ DX_ENV="$DX_ENV HAVE_DOT='YES'"
+
+ HAVE_DOT=YES
+
+ DX_ENV="$DX_ENV DOT_PATH='`expr ".$DX_DOT" : '\(\.\)[^/]*$' \| "x$DX_DOT" : 'x\(.*\)/[^/]*$'`'"
+
+ :
+else
+ if false; then
+ DX_COND_dot_TRUE=
+ DX_COND_dot_FALSE='#'
+else
+ DX_COND_dot_TRUE='#'
+ DX_COND_dot_FALSE=
+fi
+
+ HAVE_DOT=NO
+
+ DX_ENV="$DX_ENV HAVE_DOT='NO'"
+
+ :
+fi
+
+
+# Man pages generation:
+
+
+
+ # Check whether --enable-doxygen-man was given.
+if test "${enable_doxygen_man+set}" = set; then :
+ enableval=$enable_doxygen_man;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_man=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-man requires doxygen-man" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_man=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-man" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_man=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_man=0
+
+
+
+fi
+
+if test "$DX_FLAG_man" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_man" = 1; then
+ if :; then
+ DX_COND_man_TRUE=
+ DX_COND_man_FALSE='#'
+else
+ DX_COND_man_TRUE='#'
+ DX_COND_man_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_MAN='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_man_TRUE=
+ DX_COND_man_FALSE='#'
+else
+ DX_COND_man_TRUE='#'
+ DX_COND_man_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_MAN='NO'"
+
+ :
+fi
+
+
+# RTF file generation:
+
+
+
+ # Check whether --enable-doxygen-rtf was given.
+if test "${enable_doxygen_rtf+set}" = set; then :
+ enableval=$enable_doxygen_rtf;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_rtf=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-rtf requires doxygen-rtf" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_rtf=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-rtf" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_rtf=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_rtf=0
+
+
+
+fi
+
+if test "$DX_FLAG_rtf" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_rtf" = 1; then
+ if :; then
+ DX_COND_rtf_TRUE=
+ DX_COND_rtf_FALSE='#'
+else
+ DX_COND_rtf_TRUE='#'
+ DX_COND_rtf_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_RTF='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_rtf_TRUE=
+ DX_COND_rtf_FALSE='#'
+else
+ DX_COND_rtf_TRUE='#'
+ DX_COND_rtf_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_RTF='NO'"
+
+ :
+fi
+
+
+# XML file generation:
+
+
+
+ # Check whether --enable-doxygen-xml was given.
+if test "${enable_doxygen_xml+set}" = set; then :
+ enableval=$enable_doxygen_xml;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_xml=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-xml requires doxygen-xml" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_xml=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-xml" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_xml=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_xml=0
+
+
+
+fi
+
+if test "$DX_FLAG_xml" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_xml" = 1; then
+ if :; then
+ DX_COND_xml_TRUE=
+ DX_COND_xml_FALSE='#'
+else
+ DX_COND_xml_TRUE='#'
+ DX_COND_xml_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_XML='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_xml_TRUE=
+ DX_COND_xml_FALSE='#'
+else
+ DX_COND_xml_TRUE='#'
+ DX_COND_xml_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_XML='NO'"
+
+ :
+fi
+
+
+# (Compressed) HTML help generation:
+
+
+
+ # Check whether --enable-doxygen-chm was given.
+if test "${enable_doxygen_chm+set}" = set; then :
+ enableval=$enable_doxygen_chm;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_chm=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-chm requires doxygen-chm" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_chm=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-chm" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_chm=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_chm=0
+
+
+
+fi
+
+if test "$DX_FLAG_chm" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}hhc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}hhc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_HHC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_HHC in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_HHC="$DX_HHC" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_HHC="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_HHC=$ac_cv_path_DX_HHC
+if test -n "$DX_HHC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_HHC" >&5
+$as_echo "$DX_HHC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_HHC"; then
+ ac_pt_DX_HHC=$DX_HHC
+ # Extract the first word of "hhc", so it can be a program name with args.
+set dummy hhc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_HHC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_HHC in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_HHC="$ac_pt_DX_HHC" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_HHC="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_HHC=$ac_cv_path_ac_pt_DX_HHC
+if test -n "$ac_pt_DX_HHC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_HHC" >&5
+$as_echo "$ac_pt_DX_HHC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_HHC" = x; then
+ DX_HHC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_HHC=$ac_pt_DX_HHC
+ fi
+else
+ DX_HHC="$ac_cv_path_DX_HHC"
+fi
+
+if test "$DX_FLAG_chm$DX_HHC" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&5
+$as_echo "$as_me: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&2;}
+ DX_FLAG_chm=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_chm" = 1; then
+ if :; then
+ DX_COND_chm_TRUE=
+ DX_COND_chm_FALSE='#'
+else
+ DX_COND_chm_TRUE='#'
+ DX_COND_chm_FALSE=
+fi
+
+ DX_ENV="$DX_ENV HHC_PATH='$DX_HHC'"
+
+ DX_ENV="$DX_ENV GENERATE_HTML='YES'"
+
+ DX_ENV="$DX_ENV GENERATE_HTMLHELP='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_chm_TRUE=
+ DX_COND_chm_FALSE='#'
+else
+ DX_COND_chm_TRUE='#'
+ DX_COND_chm_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_HTMLHELP='NO'"
+
+ :
+fi
+
+
+# Seperate CHI file generation.
+
+
+
+ # Check whether --enable-doxygen-chi was given.
+if test "${enable_doxygen_chi+set}" = set; then :
+ enableval=$enable_doxygen_chi;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_chi=1
+
+
+test "$DX_FLAG_chm" = "1" \
+|| as_fn_error "doxygen-chi requires doxygen-chi" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_chi=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-chi" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_chi=0
+
+
+test "$DX_FLAG_chm" = "1" || DX_FLAG_chi=0
+
+
+
+fi
+
+if test "$DX_FLAG_chi" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_chi" = 1; then
+ if :; then
+ DX_COND_chi_TRUE=
+ DX_COND_chi_FALSE='#'
+else
+ DX_COND_chi_TRUE='#'
+ DX_COND_chi_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_CHI='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_chi_TRUE=
+ DX_COND_chi_FALSE='#'
+else
+ DX_COND_chi_TRUE='#'
+ DX_COND_chi_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_CHI='NO'"
+
+ :
+fi
+
+
+# Plain HTML pages generation:
+
+
+
+ # Check whether --enable-doxygen-html was given.
+if test "${enable_doxygen_html+set}" = set; then :
+ enableval=$enable_doxygen_html;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_html=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-html requires doxygen-html" "$LINENO" 5
+
+test "$DX_FLAG_chm" = "0" \
+|| as_fn_error "doxygen-html contradicts doxygen-html" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_html=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-html" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_html=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_html=0
+
+
+test "$DX_FLAG_chm" = "0" || DX_FLAG_html=0
+
+
+
+fi
+
+if test "$DX_FLAG_html" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_html" = 1; then
+ if :; then
+ DX_COND_html_TRUE=
+ DX_COND_html_FALSE='#'
+else
+ DX_COND_html_TRUE='#'
+ DX_COND_html_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_HTML='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_html_TRUE=
+ DX_COND_html_FALSE='#'
+else
+ DX_COND_html_TRUE='#'
+ DX_COND_html_FALSE=
+fi
+
+ test "$DX_FLAG_chm" = 1 || DX_ENV="$DX_ENV GENERATE_HTML='NO'"
+
+ :
+fi
+
+
+# PostScript file generation:
+
+
+
+ # Check whether --enable-doxygen-ps was given.
+if test "${enable_doxygen_ps+set}" = set; then :
+ enableval=$enable_doxygen_ps;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_ps=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-ps requires doxygen-ps" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_ps=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-ps" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_ps=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_ps=0
+
+
+
+fi
+
+if test "$DX_FLAG_ps" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}latex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}latex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_LATEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_LATEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_LATEX="$DX_LATEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_LATEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_LATEX=$ac_cv_path_DX_LATEX
+if test -n "$DX_LATEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_LATEX" >&5
+$as_echo "$DX_LATEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_LATEX"; then
+ ac_pt_DX_LATEX=$DX_LATEX
+ # Extract the first word of "latex", so it can be a program name with args.
+set dummy latex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_LATEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_LATEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_LATEX="$ac_pt_DX_LATEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_LATEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_LATEX=$ac_cv_path_ac_pt_DX_LATEX
+if test -n "$ac_pt_DX_LATEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_LATEX" >&5
+$as_echo "$ac_pt_DX_LATEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_LATEX" = x; then
+ DX_LATEX=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_LATEX=$ac_pt_DX_LATEX
+ fi
+else
+ DX_LATEX="$ac_cv_path_DX_LATEX"
+fi
+
+if test "$DX_FLAG_ps$DX_LATEX" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: latex not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: latex not found - will not generate doxygen PostScript documentation" >&2;}
+ DX_FLAG_ps=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_MAKEINDEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_MAKEINDEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX
+if test -n "$DX_MAKEINDEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5
+$as_echo "$DX_MAKEINDEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_MAKEINDEX"; then
+ ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX
+ # Extract the first word of "makeindex", so it can be a program name with args.
+set dummy makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_MAKEINDEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_MAKEINDEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX
+if test -n "$ac_pt_DX_MAKEINDEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5
+$as_echo "$ac_pt_DX_MAKEINDEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_MAKEINDEX" = x; then
+ DX_MAKEINDEX=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX
+ fi
+else
+ DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX"
+fi
+
+if test "$DX_FLAG_ps$DX_MAKEINDEX" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&2;}
+ DX_FLAG_ps=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dvips", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dvips; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_DVIPS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_DVIPS in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_DVIPS="$DX_DVIPS" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_DVIPS="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_DVIPS=$ac_cv_path_DX_DVIPS
+if test -n "$DX_DVIPS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DVIPS" >&5
+$as_echo "$DX_DVIPS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_DVIPS"; then
+ ac_pt_DX_DVIPS=$DX_DVIPS
+ # Extract the first word of "dvips", so it can be a program name with args.
+set dummy dvips; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_DVIPS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_DVIPS in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_DVIPS="$ac_pt_DX_DVIPS" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_DVIPS="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_DVIPS=$ac_cv_path_ac_pt_DX_DVIPS
+if test -n "$ac_pt_DX_DVIPS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DVIPS" >&5
+$as_echo "$ac_pt_DX_DVIPS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_DVIPS" = x; then
+ DX_DVIPS=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_DVIPS=$ac_pt_DX_DVIPS
+ fi
+else
+ DX_DVIPS="$ac_cv_path_DX_DVIPS"
+fi
+
+if test "$DX_FLAG_ps$DX_DVIPS" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&2;}
+ DX_FLAG_ps=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_EGREP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_EGREP="$DX_EGREP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_EGREP=$ac_cv_path_DX_EGREP
+if test -n "$DX_EGREP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5
+$as_echo "$DX_EGREP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_EGREP"; then
+ ac_pt_DX_EGREP=$DX_EGREP
+ # Extract the first word of "egrep", so it can be a program name with args.
+set dummy egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_EGREP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP
+if test -n "$ac_pt_DX_EGREP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5
+$as_echo "$ac_pt_DX_EGREP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_EGREP" = x; then
+ DX_EGREP=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_EGREP=$ac_pt_DX_EGREP
+ fi
+else
+ DX_EGREP="$ac_cv_path_DX_EGREP"
+fi
+
+if test "$DX_FLAG_ps$DX_EGREP" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&2;}
+ DX_FLAG_ps=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_ps" = 1; then
+ if :; then
+ DX_COND_ps_TRUE=
+ DX_COND_ps_FALSE='#'
+else
+ DX_COND_ps_TRUE='#'
+ DX_COND_ps_FALSE=
+fi
+
+
+ :
+else
+ if false; then
+ DX_COND_ps_TRUE=
+ DX_COND_ps_FALSE='#'
+else
+ DX_COND_ps_TRUE='#'
+ DX_COND_ps_FALSE=
+fi
+
+
+ :
+fi
+
+
+# PDF file generation:
+
+
+
+ # Check whether --enable-doxygen-pdf was given.
+if test "${enable_doxygen_pdf+set}" = set; then :
+ enableval=$enable_doxygen_pdf;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_pdf=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-pdf requires doxygen-pdf" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_pdf=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-pdf" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_pdf=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_pdf=0
+
+
+
+fi
+
+if test "$DX_FLAG_pdf" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pdflatex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pdflatex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_PDFLATEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_PDFLATEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_PDFLATEX="$DX_PDFLATEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_PDFLATEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_PDFLATEX=$ac_cv_path_DX_PDFLATEX
+if test -n "$DX_PDFLATEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PDFLATEX" >&5
+$as_echo "$DX_PDFLATEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_PDFLATEX"; then
+ ac_pt_DX_PDFLATEX=$DX_PDFLATEX
+ # Extract the first word of "pdflatex", so it can be a program name with args.
+set dummy pdflatex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_PDFLATEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_PDFLATEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_PDFLATEX="$ac_pt_DX_PDFLATEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_PDFLATEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_PDFLATEX=$ac_cv_path_ac_pt_DX_PDFLATEX
+if test -n "$ac_pt_DX_PDFLATEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PDFLATEX" >&5
+$as_echo "$ac_pt_DX_PDFLATEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_PDFLATEX" = x; then
+ DX_PDFLATEX=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_PDFLATEX=$ac_pt_DX_PDFLATEX
+ fi
+else
+ DX_PDFLATEX="$ac_cv_path_DX_PDFLATEX"
+fi
+
+if test "$DX_FLAG_pdf$DX_PDFLATEX" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&5
+$as_echo "$as_me: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&2;}
+ DX_FLAG_pdf=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_MAKEINDEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_MAKEINDEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX
+if test -n "$DX_MAKEINDEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5
+$as_echo "$DX_MAKEINDEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_MAKEINDEX"; then
+ ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX
+ # Extract the first word of "makeindex", so it can be a program name with args.
+set dummy makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_MAKEINDEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_MAKEINDEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX
+if test -n "$ac_pt_DX_MAKEINDEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5
+$as_echo "$ac_pt_DX_MAKEINDEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_MAKEINDEX" = x; then
+ DX_MAKEINDEX=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX
+ fi
+else
+ DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX"
+fi
+
+if test "$DX_FLAG_pdf$DX_MAKEINDEX" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&5
+$as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&2;}
+ DX_FLAG_pdf=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_EGREP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_EGREP="$DX_EGREP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_EGREP=$ac_cv_path_DX_EGREP
+if test -n "$DX_EGREP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5
+$as_echo "$DX_EGREP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_EGREP"; then
+ ac_pt_DX_EGREP=$DX_EGREP
+ # Extract the first word of "egrep", so it can be a program name with args.
+set dummy egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_EGREP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP
+if test -n "$ac_pt_DX_EGREP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5
+$as_echo "$ac_pt_DX_EGREP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_EGREP" = x; then
+ DX_EGREP=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_EGREP=$ac_pt_DX_EGREP
+ fi
+else
+ DX_EGREP="$ac_cv_path_DX_EGREP"
+fi
+
+if test "$DX_FLAG_pdf$DX_EGREP" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PDF documentation" >&5
+$as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PDF documentation" >&2;}
+ DX_FLAG_pdf=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_pdf" = 1; then
+ if :; then
+ DX_COND_pdf_TRUE=
+ DX_COND_pdf_FALSE='#'
+else
+ DX_COND_pdf_TRUE='#'
+ DX_COND_pdf_FALSE=
+fi
+
+
+ :
+else
+ if false; then
+ DX_COND_pdf_TRUE=
+ DX_COND_pdf_FALSE='#'
+else
+ DX_COND_pdf_TRUE='#'
+ DX_COND_pdf_FALSE=
+fi
+
+
+ :
+fi
+
+
+# LaTeX generation for PS and/or PDF:
+if test "$DX_FLAG_ps" = 1 || test "$DX_FLAG_pdf" = 1; then
+ if :; then
+ DX_COND_latex_TRUE=
+ DX_COND_latex_FALSE='#'
+else
+ DX_COND_latex_TRUE='#'
+ DX_COND_latex_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_LATEX='YES'"
+
+else
+ if false; then
+ DX_COND_latex_TRUE=
+ DX_COND_latex_FALSE='#'
+else
+ DX_COND_latex_TRUE='#'
+ DX_COND_latex_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_LATEX='NO'"
+
+fi
+
+# Paper size for PS and/or PDF:
+
+case "$DOXYGEN_PAPER_SIZE" in
+#(
+"")
+ DOXYGEN_PAPER_SIZE="letter"
+;; #(
+a4wide|a4|letter|legal|executive)
+ DX_ENV="$DX_ENV PAPER_SIZE='$DOXYGEN_PAPER_SIZE'"
+
+;; #(
+*)
+ as_fn_error "unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'" "$LINENO" 5
+ DOXYGEN_PAPER_SIZE="letter"
+;;
+esac
+DX_ENV="$DX_ENV PAPER_SIZE='"$DOXYGEN_PAPER_SIZE"'"
+
+
+
+if test -n "$DOXYGEN_HTML_LOGO"; then
+ if ! test -f "$DOXYGEN_HTML_LOGO"; then
+ as_fn_error "not a file: \"$DOXYGEN_HTML_LOGO\"" "$LINENO" 5
+ fi
+fi
+
+
+if test -n "$DOXYGEN_LOGO"; then
+ if ! test -f "$DOXYGEN_LOGO"; then
+ as_fn_error "not a file: \"$DOXYGEN_LOGO\"" "$LINENO" 5
+ fi
+fi
+
+
+if test -z "$DOXYGEN_TITLE"; then
+ DOXYGEN_TITLE="${PACKAGE_NAME}"
+fi
+
+
+if test -z "$DOXYGEN_AUTHOR"; then
+ DOXYGEN_AUTHOR="Generated by doxygen ${DOXYGEN_VERSION}"
+fi
+
+
+if test -z "$DOXYGEN_DATETIME"; then
+ DOXYGEN_DATETIME=`date +'%D %T'`
+fi
+
+
+if test -z "$DOXYGEN_DATE"; then
+ DOXYGEN_DATE=`date +%D`
+fi
+
+#For debugging:
+#echo DX_FLAG_doc=$DX_FLAG_doc
+#echo DX_FLAG_dot=$DX_FLAG_dot
+#echo DX_FLAG_man=$DX_FLAG_man
+#echo DX_FLAG_html=$DX_FLAG_html
+#echo DX_FLAG_chm=$DX_FLAG_chm
+#echo DX_FLAG_chi=$DX_FLAG_chi
+#echo DX_FLAG_rtf=$DX_FLAG_rtf
+#echo DX_FLAG_xml=$DX_FLAG_xml
+#echo DX_FLAG_pdf=$DX_FLAG_pdf
+#echo DX_FLAG_ps=$DX_FLAG_ps
+#echo DX_ENV=$DX_ENV
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime maximum number of locks held per thread" >&5
+$as_echo_n "checking for UPC runtime maximum number of locks held per thread... " >&6; }
+
+# Check whether --with-upc-runtime-max-locks was given.
+if test "${with_upc_runtime_max_locks+set}" = set; then :
+ withval=$with_upc_runtime_max_locks;
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[0-9][0-9]*$' >/dev/null 2>&1; then
+ as_fn_error "$withval is an invalid option to
+ --with-upc-runtime-max-locks" "$LINENO" 5
+ fi
+ upc_runtime_max_locks="$withval"
+
+else
+
+ upc_runtime_max_locks=1024
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_runtime_max_locks" >&5
+$as_echo "$upc_runtime_max_locks" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_MAX_LOCKS $upc_runtime_max_locks
+_ACEOF
+
+
+fi #### End: SMP runtime configuration
+
+if test "$upc_runtime_model" = "portals4"; then
+
+ #### Portals4 runtime library configuration ####
+
+ # Use the generic (reference implementation)
+ use_generic_collectives="no"
+
+ # Check for Portals4 libs
+ portals4libs="-lportals"
+ portals4inc=
+ have_portals4=no
+
+# Check whether --with-portals4 was given.
+if test "${with_portals4+set}" = set; then :
+ withval=$with_portals4;
+fi
+
+
+# Check whether --with-portals4-include was given.
+if test "${with_portals4_include+set}" = set; then :
+ withval=$with_portals4_include;
+fi
+
+
+# Check whether --with-portals4-lib was given.
+if test "${with_portals4_lib+set}" = set; then :
+ withval=$with_portals4_lib;
+fi
+
+
+ if test "x$with_portals4" != x; then
+ portals4libs="-L$with_portals4/lib $portals4libs"
+ portals4inc="-I$with_portals4/include $portals4inc"
+ fi
+ if test "x$with_portals4_include" != x; then
+ portals4inc="-I$with_portals4_include $portals4inc"
+ fi
+ if test "x$with_portals4_lib" != x; then
+ portals4libs="-L$with_portals4_lib $portals4libs"
+ fi
+ if test "x$with_portals4$with_portals4_include$with_portals4_lib" = x \
+ && test -d ${srcdir}/portals4; then
+ portals4libs='-L$$r/$(HOST_SUBDIR)/portals4/ '"$lt_cv_objdir $portals4libs"
+ portals4inc='-I$$r/$(HOST_SUBDIR)/portals4 -I$$s/portals4 '"$portals4inc"
+ # Do not test the portals4 version. Assume that it is sufficient, since
+ # it is in the source tree, and the library has not been built yet
+ # but it would be included on the link line in the version check below
+ # hence making the test fail.
+ have_portals4=yes
+ fi
+
+
+
+
+$as_echo "#define GUPCR_PORTALS_RUNTIME 1" >>confdefs.h
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime Portals4 PTE base index" >&5
+$as_echo_n "checking for UPC runtime Portals4 PTE base index... " >&6; }
+
+# Check whether --with-upc-runtime-pte-base was given.
+if test "${with_upc_runtime_pte_base+set}" = set; then :
+ withval=$with_upc_runtime_pte_base;
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[0-9][0-9]*$' >/dev/null 2>&1; then
+ as_fn_error "$withval is an invalid option to --with-upc-runtime-pte-base" "$LINENO" 5
+ fi
+ upc_runtime_pte_base="$withval"
+
+else
+
+ upc_runtime_pte_base=16
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_runtime_pte_base" >&5
+$as_echo "$upc_runtime_pte_base" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_PTE_BASE $upc_runtime_pte_base
+_ACEOF
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime maximum number of locks held per thread" >&5
+$as_echo_n "checking for UPC runtime maximum number of locks held per thread... " >&6; }
+
+# Check whether --with-upc-runtime-max-locks was given.
+if test "${with_upc_runtime_max_locks+set}" = set; then :
+ withval=$with_upc_runtime_max_locks;
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[0-9][0-9]*$' >/dev/null 2>&1; then
+ as_fn_error "$withval is an invalid option to
+ --with-upc-runtime-max-locks" "$LINENO" 5
+ fi
+ upc_runtime_max_locks="$withval"
+
+else
+
+ upc_runtime_max_locks=1024
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_runtime_max_locks" >&5
+$as_echo "$upc_runtime_max_locks" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_MAX_LOCKS $upc_runtime_max_locks
+_ACEOF
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime bounce buffer size" >&5
+$as_echo_n "checking for UPC runtime bounce buffer size... " >&6; }
+
+# Check whether --with-upc-runtime-bounce-buffer-size was given.
+if test "${with_upc_runtime_bounce_buffer_size+set}" = set; then :
+ withval=$with_upc_runtime_bounce_buffer_size;
+ # $withval must be a decimal integer
+ if ! echo "$withval" | egrep -i '^[0-9]+[kmg]?$' >/dev/null 2>&1; then
+ as_fn_error "$withval is an invalid option to
+ --with-upc-runtime-bounce-buffer-size" "$LINENO" 5
+ fi
+ bb_size="$withval"
+
+else
+
+ bb_size="256K"
+
+fi
+
+ bb_size_expr=`echo "$bb_size" | \
+ sed -e 's/[gG]$/*1024M/;s/[mM]$/*1024K/;s/[kK]$/*1024/;s/\\*/ \\\\* /g'`
+ upc_runtime_bounce_buffer_size=`eval expr $bb_size_expr`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_runtime_bounce_buffer_size" >&5
+$as_echo "$upc_runtime_bounce_buffer_size" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_BOUNCE_BUFFER_SIZE $upc_runtime_bounce_buffer_size
+_ACEOF
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC maximum number of outstanding remote puts" >&5
+$as_echo_n "checking for UPC maximum number of outstanding remote puts... " >&6; }
+
+# Check whether --with-upc-max-outstanding-puts was given.
+if test "${with_upc_max_outstanding_puts+set}" = set; then :
+ withval=$with_upc_max_outstanding_puts;
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[0-9]*$' >/dev/null 2>&1; then
+ as_fn_error "$withval is an invalid option to
+ --with-upc-max-outstanding-puts" "$LINENO" 5
+ fi
+ upc_max_puts_count="$withval"
+
+else
+
+ upc_max_puts_count="256"
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_max_puts_count" >&5
+$as_echo "$upc_max_puts_count" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_MAX_OUTSTANDING_PUTS $upc_max_puts_count
+_ACEOF
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime collectives tree fanout" >&5
+$as_echo_n "checking for UPC runtime collectives tree fanout... " >&6; }
+
+# Check whether --with-upc-runtime-tree-fanout was given.
+if test "${with_upc_runtime_tree_fanout+set}" = set; then :
+ withval=$with_upc_runtime_tree_fanout;
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[0-9][0-9]*$' >/dev/null 2>&1; then
+ as_fn_error "$withval is an invalid option to
+ --with-upc-runtime-tree-fanout" "$LINENO" 5
+ fi
+ upc_runtime_tree_fanout="$withval"
+
+else
+
+ upc_runtime_tree_fanout=4
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_runtime_tree_fanout" >&5
+$as_echo "$upc_runtime_tree_fanout" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_TREE_FANOUT $upc_runtime_tree_fanout
+_ACEOF
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime Portals4 triggered operation support" >&5
+$as_echo_n "checking for UPC runtime Portals4 triggered operation support... " >&6; }
+ # Check whether --enable-upc-runtime-triggered-ops was given.
+if test "${enable_upc_runtime_triggered_ops+set}" = set; then :
+ enableval=$enable_upc_runtime_triggered_ops;
+ case $enableval in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-runtime-triggered-ops accepts only yes or no." "$LINENO" 5
+ esac
+
+else
+
+ enable_upc_runtime_triggered_ops=yes
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_runtime_triggered_ops" >&5
+$as_echo "$enable_upc_runtime_triggered_ops" >&6; }
+ if test "$enable_upc_runtime_triggered_ops" = "yes"; then
+
+$as_echo "#define GUPCR_USE_PORTALS4_TRIGGERED_OPS 1" >>confdefs.h
+
+ fi
+
+# Portals4 node local memory optimization
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime node local memory access" >&5
+$as_echo_n "checking for UPC runtime node local memory access... " >&6; }
+ # Check whether --enable-upc-node-local-mem was given.
+if test "${enable_upc_node_local_mem+set}" = set; then :
+ enableval=$enable_upc_node_local_mem;
+ case $enableval in
+ yes | no) ;;
+ *)
+ as_fn_error "--enable-upc-node-local-mem accepts only yes or no." "$LINENO" 5
+ esac
+
+else
+
+ enable_upc_node_local_mem=yes
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_upc_node_local_mem" >&5
+$as_echo "$enable_upc_node_local_mem" >&6; }
+ if test "$enable_upc_node_local_mem" = "yes"; then
+
+$as_echo "#define GUPCR_NODE_LOCAL_MEM 1" >>confdefs.h
+
+ fi
+
+ if test "$enable_upc_node_local_mem" = "yes"; then
+ # START - check for shared memory type
+ # Check for Posix based shm
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC node local memory type" >&5
+$as_echo_n "checking for UPC node local memory type... " >&6; }
+
+# Check whether --with-upc-node-local-mem was given.
+if test "${with_upc_node_local_mem+set}" = set; then :
+ withval=$with_upc_node_local_mem;
+ case $withval in
+ posix | mmap)
+ upc_node_local=$withval
+ ;;
+ *)
+ as_fn_error "--with-upc-node-local-mem accepts only posix or mmap." "$LINENO" 5
+ esac
+
+else
+
+ upc_node_local=posix
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_node_local" >&5
+$as_echo "$upc_node_local" >&6; };
+
+ # Check if POSIX shm is available
+ if test "$upc_node_local" = "posix"; then
+ # Check if it is part of librt
+ have_shm_open=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shm_open in -lrt" >&5
+$as_echo_n "checking for shm_open in -lrt... " >&6; }
+if test "${ac_cv_lib_rt_shm_open+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shm_open ();
+int
+main ()
+{
+return shm_open ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_rt_shm_open=yes
+else
+ ac_cv_lib_rt_shm_open=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_shm_open" >&5
+$as_echo "$ac_cv_lib_rt_shm_open" >&6; }
+if test "x$ac_cv_lib_rt_shm_open" = x""yes; then :
+ LIBS="-lrt $LIBS"
+ have_shm_open=yes
+
+$as_echo "#define HAVE_SHM_OPEN 1" >>confdefs.h
+
+fi
+
+ if test "$have_shm_open" = "no"; then
+ # Must probe for Posix shmem
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the shm_open" >&5
+$as_echo_n "checking for the shm_open... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/mman.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
+ int size = 4096;
+ int fd;
+ void * addr;
+int
+main ()
+{
+
+
+ fd = shm_open("shm-config-test", O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
+ (void)shm_unlink("shm-config-test");
+ if (fd < 0) return 1;
+ if (ftruncate(fd, size) < 0) return 1;
+ addr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+ (void)close(fd);
+ if (!addr || (addr == MAP_FAILED)) return 1;
+ (void)munmap(addr, size);
+ return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }; have_shm_open=yes
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }; have_shm_open=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ fi
+
+ if test "$have_shm_open" = "yes"; then
+
+$as_echo "#define GUPCR_NODE_LOCAL_MEM_POSIX 1" >>confdefs.h
+
+ else
+ as_fn_error "Posix shared memory is not available" "$LINENO" 5
+ fi
+ else
+ # mmap is always available
+
+$as_echo "#define GUPCR_NODE_LOCAL_MEM_MMAP 1" >>confdefs.h
+
+ fi
+ # END - check for shared memory type
+ fi
+
+ # Check for portals job launcher
+ ac_fn_c_check_header_mongrel "$LINENO" "slurm/slurm.h" "ac_cv_header_slurm_slurm_h" "$ac_includes_default"
+if test "x$ac_cv_header_slurm_slurm_h" = x""yes; then :
+ have_slurm=yes
+else
+ have_slurm=no
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPC runtime Portals4 job launcher" >&5
+$as_echo_n "checking for UPC runtime Portals4 job launcher... " >&6; }
+
+# Check whether --with-upc-job-launcher was given.
+if test "${with_upc_job_launcher+set}" = set; then :
+ withval=$with_upc_job_launcher;
+ case $withval in
+ slurm | yod)
+ upc_job_launcher=$withval
+ ;;
+ *)
+ as_fn_error "--with-upc-job-launcher accepts only slurm or yod." "$LINENO" 5
+ esac
+
+else
+
+ if test "$have_slurm" = "yes"; then
+ upc_job_launcher=slurm
+ else
+ upc_job_launcher=yod
+ fi
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $upc_job_launcher" >&5
+$as_echo "$upc_job_launcher" >&6; }
+
+ if test "$upc_job_launcher" = "slurm"; then
+ if test "$have_slurm" = "yes"; then
+
+$as_echo "#define GUPCR_JOB_LAUNCHER_SLURM 1" >>confdefs.h
+
+ portals4libs="$portals4libs -lpmi"
+ else
+ as_fn_error "--with-upc-job-launcher specified slurm,
+ but slurm is not available." "$LINENO" 5
+ fi
+ else
+
+$as_echo "#define GUPCR_JOB_LAUNCHER_YOD 1" >>confdefs.h
+
+ portals4libs="$portals4libs -lportals_runtime"
+ fi
+
+ # Check for target memory page size
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for memory page size" >&5
+$as_echo_n "checking for memory page size... " >&6; }
+
+# Check whether --with-upc-memory-page-size was given.
+if test "${with_upc_memory_page_size+set}" = set; then :
+ withval=$with_upc_memory_page_size;
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[0-9][0-9]*$' >/dev/null 2>&1; then
+ as_fn_error "$withval is an invalid option to --with-upc-memory-page-size" "$LINENO" 5
+ fi
+ memory_page_size="$withval"
+
+else
+
+ memory_page_size="4096"
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $memory_page_size" >&5
+$as_echo "$memory_page_size" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GUPCR_MEMORY_PAGE_SIZE $memory_page_size
+_ACEOF
+
+
+
+$as_echo "#define GUPCR_GLOBAL_EXIT_TIMEOUT 2" >>confdefs.h
+
+
+
+
+
+
+
+
+
+#Variables:
+DX_PROJECT=${PACKAGE}
+
+
+# Files:
+DX_CONFIG=doxygen.cfg
+
+DX_DOCDIR=doc
+
+
+# Environment variables used inside doxygen.cfg:
+DX_ENV="$DX_ENV SRCDIR='$srcdir'"
+
+DX_ENV="$DX_ENV PROJECT='$DX_PROJECT'"
+
+DX_ENV="$DX_ENV DOCDIR='$DX_DOCDIR'"
+
+DX_ENV="$DX_ENV VERSION='$PACKAGE_VERSION'"
+
+
+# Doxygen itself:
+
+
+
+ # Check whether --enable-doxygen-doc was given.
+if test "${enable_doxygen_doc+set}" = set; then :
+ enableval=$enable_doxygen_doc;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_doc=1
+
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_doc=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-doc" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_doc=1
+
+
+
+fi
+
+if test "$DX_FLAG_doc" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}doxygen", so it can be a program name with args.
+set dummy ${ac_tool_prefix}doxygen; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_DOXYGEN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_DOXYGEN in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_DOXYGEN="$DX_DOXYGEN" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_DOXYGEN="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_DOXYGEN=$ac_cv_path_DX_DOXYGEN
+if test -n "$DX_DOXYGEN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOXYGEN" >&5
+$as_echo "$DX_DOXYGEN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_DOXYGEN"; then
+ ac_pt_DX_DOXYGEN=$DX_DOXYGEN
+ # Extract the first word of "doxygen", so it can be a program name with args.
+set dummy doxygen; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_DOXYGEN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_DOXYGEN in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_DOXYGEN="$ac_pt_DX_DOXYGEN" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_DOXYGEN="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_DOXYGEN=$ac_cv_path_ac_pt_DX_DOXYGEN
+if test -n "$ac_pt_DX_DOXYGEN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOXYGEN" >&5
+$as_echo "$ac_pt_DX_DOXYGEN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_DOXYGEN" = x; then
+ DX_DOXYGEN=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_DOXYGEN=$ac_pt_DX_DOXYGEN
+ fi
+else
+ DX_DOXYGEN="$ac_cv_path_DX_DOXYGEN"
+fi
+
+if test "$DX_FLAG_doc$DX_DOXYGEN" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: doxygen not found - will not generate any doxygen documentation" >&5
+$as_echo "$as_me: WARNING: doxygen not found - will not generate any doxygen documentation" >&2;}
+ DX_FLAG_doc=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}perl", so it can be a program name with args.
+set dummy ${ac_tool_prefix}perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_PERL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_PERL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_PERL="$DX_PERL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_PERL="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_PERL=$ac_cv_path_DX_PERL
+if test -n "$DX_PERL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PERL" >&5
+$as_echo "$DX_PERL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_PERL"; then
+ ac_pt_DX_PERL=$DX_PERL
+ # Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_PERL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_PERL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_PERL="$ac_pt_DX_PERL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_PERL="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_PERL=$ac_cv_path_ac_pt_DX_PERL
+if test -n "$ac_pt_DX_PERL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PERL" >&5
+$as_echo "$ac_pt_DX_PERL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_PERL" = x; then
+ DX_PERL=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_PERL=$ac_pt_DX_PERL
+ fi
+else
+ DX_PERL="$ac_cv_path_DX_PERL"
+fi
+
+if test "$DX_FLAG_doc$DX_PERL" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: perl not found - will not generate any doxygen documentation" >&5
+$as_echo "$as_me: WARNING: perl not found - will not generate any doxygen documentation" >&2;}
+ DX_FLAG_doc=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args.
+set dummy ${ac_tool_prefix}file; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_FILE+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_FILE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_FILE="$DX_FILE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_FILE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_FILE=$ac_cv_path_DX_FILE
+if test -n "$DX_FILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_FILE" >&5
+$as_echo "$DX_FILE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_FILE"; then
+ ac_pt_DX_FILE=$DX_FILE
+ # Extract the first word of "file", so it can be a program name with args.
+set dummy file; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_FILE+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_FILE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_FILE="$ac_pt_DX_FILE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_FILE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_FILE=$ac_cv_path_ac_pt_DX_FILE
+if test -n "$ac_pt_DX_FILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_FILE" >&5
+$as_echo "$ac_pt_DX_FILE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_FILE" = x; then
+ DX_FILE=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_FILE=$ac_pt_DX_FILE
+ fi
+else
+ DX_FILE="$ac_cv_path_DX_FILE"
+fi
+
+if test "$DX_FLAG_doc$DX_FILE" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: file not found - will not generate any doxygen documentation" >&5
+$as_echo "$as_me: WARNING: file not found - will not generate any doxygen documentation" >&2;}
+ DX_FLAG_doc=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_doc" = 1; then
+ if :; then
+ DX_COND_doc_TRUE=
+ DX_COND_doc_FALSE='#'
+else
+ DX_COND_doc_TRUE='#'
+ DX_COND_doc_FALSE=
+fi
+
+ DX_ENV="$DX_ENV PERL_PATH='$DX_PERL'"
+
+ DOXYGEN_VERSION=`${DX_DOXYGEN} --version`
+
+ :
+else
+ if false; then
+ DX_COND_doc_TRUE=
+ DX_COND_doc_FALSE='#'
+else
+ DX_COND_doc_TRUE='#'
+ DX_COND_doc_FALSE=
+fi
+
+
+ :
+fi
+
+
+# Dot for graphics:
+
+
+
+ # Check whether --enable-doxygen-dot was given.
+if test "${enable_doxygen_dot+set}" = set; then :
+ enableval=$enable_doxygen_dot;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_dot=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-dot requires doxygen-dot" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_dot=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-dot" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_dot=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_dot=0
+
+
+
+fi
+
+if test "$DX_FLAG_dot" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dot", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dot; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_DOT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_DOT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_DOT="$DX_DOT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_DOT="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_DOT=$ac_cv_path_DX_DOT
+if test -n "$DX_DOT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOT" >&5
+$as_echo "$DX_DOT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_DOT"; then
+ ac_pt_DX_DOT=$DX_DOT
+ # Extract the first word of "dot", so it can be a program name with args.
+set dummy dot; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_DOT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_DOT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_DOT="$ac_pt_DX_DOT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_DOT="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_DOT=$ac_cv_path_ac_pt_DX_DOT
+if test -n "$ac_pt_DX_DOT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOT" >&5
+$as_echo "$ac_pt_DX_DOT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_DOT" = x; then
+ DX_DOT=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_DOT=$ac_pt_DX_DOT
+ fi
+else
+ DX_DOT="$ac_cv_path_DX_DOT"
+fi
+
+if test "$DX_FLAG_dot$DX_DOT" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dot not found - will not generate graphics for doxygen documentation" >&5
+$as_echo "$as_me: WARNING: dot not found - will not generate graphics for doxygen documentation" >&2;}
+ DX_FLAG_dot=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_dot" = 1; then
+ if :; then
+ DX_COND_dot_TRUE=
+ DX_COND_dot_FALSE='#'
+else
+ DX_COND_dot_TRUE='#'
+ DX_COND_dot_FALSE=
+fi
+
+ DX_ENV="$DX_ENV HAVE_DOT='YES'"
+
+ HAVE_DOT=YES
+
+ DX_ENV="$DX_ENV DOT_PATH='`expr ".$DX_DOT" : '\(\.\)[^/]*$' \| "x$DX_DOT" : 'x\(.*\)/[^/]*$'`'"
+
+ :
+else
+ if false; then
+ DX_COND_dot_TRUE=
+ DX_COND_dot_FALSE='#'
+else
+ DX_COND_dot_TRUE='#'
+ DX_COND_dot_FALSE=
+fi
+
+ HAVE_DOT=NO
+
+ DX_ENV="$DX_ENV HAVE_DOT='NO'"
+
+ :
+fi
+
+
+# Man pages generation:
+
+
+
+ # Check whether --enable-doxygen-man was given.
+if test "${enable_doxygen_man+set}" = set; then :
+ enableval=$enable_doxygen_man;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_man=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-man requires doxygen-man" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_man=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-man" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_man=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_man=0
+
+
+
+fi
+
+if test "$DX_FLAG_man" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_man" = 1; then
+ if :; then
+ DX_COND_man_TRUE=
+ DX_COND_man_FALSE='#'
+else
+ DX_COND_man_TRUE='#'
+ DX_COND_man_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_MAN='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_man_TRUE=
+ DX_COND_man_FALSE='#'
+else
+ DX_COND_man_TRUE='#'
+ DX_COND_man_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_MAN='NO'"
+
+ :
+fi
+
+
+# RTF file generation:
+
+
+
+ # Check whether --enable-doxygen-rtf was given.
+if test "${enable_doxygen_rtf+set}" = set; then :
+ enableval=$enable_doxygen_rtf;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_rtf=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-rtf requires doxygen-rtf" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_rtf=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-rtf" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_rtf=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_rtf=0
+
+
+
+fi
+
+if test "$DX_FLAG_rtf" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_rtf" = 1; then
+ if :; then
+ DX_COND_rtf_TRUE=
+ DX_COND_rtf_FALSE='#'
+else
+ DX_COND_rtf_TRUE='#'
+ DX_COND_rtf_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_RTF='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_rtf_TRUE=
+ DX_COND_rtf_FALSE='#'
+else
+ DX_COND_rtf_TRUE='#'
+ DX_COND_rtf_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_RTF='NO'"
+
+ :
+fi
+
+
+# XML file generation:
+
+
+
+ # Check whether --enable-doxygen-xml was given.
+if test "${enable_doxygen_xml+set}" = set; then :
+ enableval=$enable_doxygen_xml;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_xml=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-xml requires doxygen-xml" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_xml=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-xml" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_xml=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_xml=0
+
+
+
+fi
+
+if test "$DX_FLAG_xml" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_xml" = 1; then
+ if :; then
+ DX_COND_xml_TRUE=
+ DX_COND_xml_FALSE='#'
+else
+ DX_COND_xml_TRUE='#'
+ DX_COND_xml_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_XML='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_xml_TRUE=
+ DX_COND_xml_FALSE='#'
+else
+ DX_COND_xml_TRUE='#'
+ DX_COND_xml_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_XML='NO'"
+
+ :
+fi
+
+
+# (Compressed) HTML help generation:
+
+
+
+ # Check whether --enable-doxygen-chm was given.
+if test "${enable_doxygen_chm+set}" = set; then :
+ enableval=$enable_doxygen_chm;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_chm=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-chm requires doxygen-chm" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_chm=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-chm" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_chm=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_chm=0
+
+
+
+fi
+
+if test "$DX_FLAG_chm" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}hhc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}hhc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_HHC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_HHC in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_HHC="$DX_HHC" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_HHC="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_HHC=$ac_cv_path_DX_HHC
+if test -n "$DX_HHC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_HHC" >&5
+$as_echo "$DX_HHC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_HHC"; then
+ ac_pt_DX_HHC=$DX_HHC
+ # Extract the first word of "hhc", so it can be a program name with args.
+set dummy hhc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_HHC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_HHC in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_HHC="$ac_pt_DX_HHC" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_HHC="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_HHC=$ac_cv_path_ac_pt_DX_HHC
+if test -n "$ac_pt_DX_HHC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_HHC" >&5
+$as_echo "$ac_pt_DX_HHC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_HHC" = x; then
+ DX_HHC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_HHC=$ac_pt_DX_HHC
+ fi
+else
+ DX_HHC="$ac_cv_path_DX_HHC"
+fi
+
+if test "$DX_FLAG_chm$DX_HHC" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&5
+$as_echo "$as_me: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&2;}
+ DX_FLAG_chm=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_chm" = 1; then
+ if :; then
+ DX_COND_chm_TRUE=
+ DX_COND_chm_FALSE='#'
+else
+ DX_COND_chm_TRUE='#'
+ DX_COND_chm_FALSE=
+fi
+
+ DX_ENV="$DX_ENV HHC_PATH='$DX_HHC'"
+
+ DX_ENV="$DX_ENV GENERATE_HTML='YES'"
+
+ DX_ENV="$DX_ENV GENERATE_HTMLHELP='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_chm_TRUE=
+ DX_COND_chm_FALSE='#'
+else
+ DX_COND_chm_TRUE='#'
+ DX_COND_chm_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_HTMLHELP='NO'"
+
+ :
+fi
+
+
+# Seperate CHI file generation.
+
+
+
+ # Check whether --enable-doxygen-chi was given.
+if test "${enable_doxygen_chi+set}" = set; then :
+ enableval=$enable_doxygen_chi;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_chi=1
+
+
+test "$DX_FLAG_chm" = "1" \
+|| as_fn_error "doxygen-chi requires doxygen-chi" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_chi=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-chi" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_chi=0
+
+
+test "$DX_FLAG_chm" = "1" || DX_FLAG_chi=0
+
+
+
+fi
+
+if test "$DX_FLAG_chi" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_chi" = 1; then
+ if :; then
+ DX_COND_chi_TRUE=
+ DX_COND_chi_FALSE='#'
+else
+ DX_COND_chi_TRUE='#'
+ DX_COND_chi_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_CHI='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_chi_TRUE=
+ DX_COND_chi_FALSE='#'
+else
+ DX_COND_chi_TRUE='#'
+ DX_COND_chi_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_CHI='NO'"
+
+ :
+fi
+
+
+# Plain HTML pages generation:
+
+
+
+ # Check whether --enable-doxygen-html was given.
+if test "${enable_doxygen_html+set}" = set; then :
+ enableval=$enable_doxygen_html;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_html=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-html requires doxygen-html" "$LINENO" 5
+
+test "$DX_FLAG_chm" = "0" \
+|| as_fn_error "doxygen-html contradicts doxygen-html" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_html=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-html" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_html=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_html=0
+
+
+test "$DX_FLAG_chm" = "0" || DX_FLAG_html=0
+
+
+
+fi
+
+if test "$DX_FLAG_html" = 1; then
+
+ :
+fi
+if test "$DX_FLAG_html" = 1; then
+ if :; then
+ DX_COND_html_TRUE=
+ DX_COND_html_FALSE='#'
+else
+ DX_COND_html_TRUE='#'
+ DX_COND_html_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_HTML='YES'"
+
+ :
+else
+ if false; then
+ DX_COND_html_TRUE=
+ DX_COND_html_FALSE='#'
+else
+ DX_COND_html_TRUE='#'
+ DX_COND_html_FALSE=
+fi
+
+ test "$DX_FLAG_chm" = 1 || DX_ENV="$DX_ENV GENERATE_HTML='NO'"
+
+ :
+fi
+
+
+# PostScript file generation:
+
+
+
+ # Check whether --enable-doxygen-ps was given.
+if test "${enable_doxygen_ps+set}" = set; then :
+ enableval=$enable_doxygen_ps;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_ps=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-ps requires doxygen-ps" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_ps=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-ps" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_ps=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_ps=0
+
+
+
+fi
+
+if test "$DX_FLAG_ps" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}latex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}latex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_LATEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_LATEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_LATEX="$DX_LATEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_LATEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_LATEX=$ac_cv_path_DX_LATEX
+if test -n "$DX_LATEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_LATEX" >&5
+$as_echo "$DX_LATEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_LATEX"; then
+ ac_pt_DX_LATEX=$DX_LATEX
+ # Extract the first word of "latex", so it can be a program name with args.
+set dummy latex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_LATEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_LATEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_LATEX="$ac_pt_DX_LATEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_LATEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_LATEX=$ac_cv_path_ac_pt_DX_LATEX
+if test -n "$ac_pt_DX_LATEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_LATEX" >&5
+$as_echo "$ac_pt_DX_LATEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_LATEX" = x; then
+ DX_LATEX=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_LATEX=$ac_pt_DX_LATEX
+ fi
+else
+ DX_LATEX="$ac_cv_path_DX_LATEX"
+fi
+
+if test "$DX_FLAG_ps$DX_LATEX" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: latex not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: latex not found - will not generate doxygen PostScript documentation" >&2;}
+ DX_FLAG_ps=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_MAKEINDEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_MAKEINDEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX
+if test -n "$DX_MAKEINDEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5
+$as_echo "$DX_MAKEINDEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_MAKEINDEX"; then
+ ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX
+ # Extract the first word of "makeindex", so it can be a program name with args.
+set dummy makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_MAKEINDEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_MAKEINDEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX
+if test -n "$ac_pt_DX_MAKEINDEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5
+$as_echo "$ac_pt_DX_MAKEINDEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_MAKEINDEX" = x; then
+ DX_MAKEINDEX=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX
+ fi
+else
+ DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX"
+fi
+
+if test "$DX_FLAG_ps$DX_MAKEINDEX" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&2;}
+ DX_FLAG_ps=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dvips", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dvips; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_DVIPS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_DVIPS in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_DVIPS="$DX_DVIPS" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_DVIPS="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_DVIPS=$ac_cv_path_DX_DVIPS
+if test -n "$DX_DVIPS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DVIPS" >&5
+$as_echo "$DX_DVIPS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_DVIPS"; then
+ ac_pt_DX_DVIPS=$DX_DVIPS
+ # Extract the first word of "dvips", so it can be a program name with args.
+set dummy dvips; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_DVIPS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_DVIPS in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_DVIPS="$ac_pt_DX_DVIPS" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_DVIPS="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_DVIPS=$ac_cv_path_ac_pt_DX_DVIPS
+if test -n "$ac_pt_DX_DVIPS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DVIPS" >&5
+$as_echo "$ac_pt_DX_DVIPS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_DVIPS" = x; then
+ DX_DVIPS=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_DVIPS=$ac_pt_DX_DVIPS
+ fi
+else
+ DX_DVIPS="$ac_cv_path_DX_DVIPS"
+fi
+
+if test "$DX_FLAG_ps$DX_DVIPS" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&2;}
+ DX_FLAG_ps=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_EGREP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_EGREP="$DX_EGREP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_EGREP=$ac_cv_path_DX_EGREP
+if test -n "$DX_EGREP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5
+$as_echo "$DX_EGREP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_EGREP"; then
+ ac_pt_DX_EGREP=$DX_EGREP
+ # Extract the first word of "egrep", so it can be a program name with args.
+set dummy egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_EGREP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP
+if test -n "$ac_pt_DX_EGREP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5
+$as_echo "$ac_pt_DX_EGREP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_EGREP" = x; then
+ DX_EGREP=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_EGREP=$ac_pt_DX_EGREP
+ fi
+else
+ DX_EGREP="$ac_cv_path_DX_EGREP"
+fi
+
+if test "$DX_FLAG_ps$DX_EGREP" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&2;}
+ DX_FLAG_ps=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_ps" = 1; then
+ if :; then
+ DX_COND_ps_TRUE=
+ DX_COND_ps_FALSE='#'
+else
+ DX_COND_ps_TRUE='#'
+ DX_COND_ps_FALSE=
+fi
+
+
+ :
+else
+ if false; then
+ DX_COND_ps_TRUE=
+ DX_COND_ps_FALSE='#'
+else
+ DX_COND_ps_TRUE='#'
+ DX_COND_ps_FALSE=
+fi
+
+
+ :
+fi
+
+
+# PDF file generation:
+
+
+
+ # Check whether --enable-doxygen-pdf was given.
+if test "${enable_doxygen_pdf+set}" = set; then :
+ enableval=$enable_doxygen_pdf;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ DX_FLAG_pdf=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error "doxygen-pdf requires doxygen-pdf" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+ DX_FLAG_pdf=0
+
+;; #(
+*)
+ as_fn_error "invalid value '$enableval' given to doxygen-pdf" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_pdf=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_pdf=0
+
+
+
+fi
+
+if test "$DX_FLAG_pdf" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pdflatex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pdflatex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_PDFLATEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_PDFLATEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_PDFLATEX="$DX_PDFLATEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_PDFLATEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_PDFLATEX=$ac_cv_path_DX_PDFLATEX
+if test -n "$DX_PDFLATEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PDFLATEX" >&5
+$as_echo "$DX_PDFLATEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_PDFLATEX"; then
+ ac_pt_DX_PDFLATEX=$DX_PDFLATEX
+ # Extract the first word of "pdflatex", so it can be a program name with args.
+set dummy pdflatex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_PDFLATEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_PDFLATEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_PDFLATEX="$ac_pt_DX_PDFLATEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_PDFLATEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_PDFLATEX=$ac_cv_path_ac_pt_DX_PDFLATEX
+if test -n "$ac_pt_DX_PDFLATEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PDFLATEX" >&5
+$as_echo "$ac_pt_DX_PDFLATEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_PDFLATEX" = x; then
+ DX_PDFLATEX=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_PDFLATEX=$ac_pt_DX_PDFLATEX
+ fi
+else
+ DX_PDFLATEX="$ac_cv_path_DX_PDFLATEX"
+fi
+
+if test "$DX_FLAG_pdf$DX_PDFLATEX" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&5
+$as_echo "$as_me: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&2;}
+ DX_FLAG_pdf=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_MAKEINDEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_MAKEINDEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX
+if test -n "$DX_MAKEINDEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5
+$as_echo "$DX_MAKEINDEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_MAKEINDEX"; then
+ ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX
+ # Extract the first word of "makeindex", so it can be a program name with args.
+set dummy makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_MAKEINDEX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_MAKEINDEX in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX
+if test -n "$ac_pt_DX_MAKEINDEX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5
+$as_echo "$ac_pt_DX_MAKEINDEX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_MAKEINDEX" = x; then
+ DX_MAKEINDEX=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX
+ fi
+else
+ DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX"
+fi
+
+if test "$DX_FLAG_pdf$DX_MAKEINDEX" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&5
+$as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&2;}
+ DX_FLAG_pdf=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DX_EGREP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DX_EGREP="$DX_EGREP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DX_EGREP=$ac_cv_path_DX_EGREP
+if test -n "$DX_EGREP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5
+$as_echo "$DX_EGREP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_EGREP"; then
+ ac_pt_DX_EGREP=$DX_EGREP
+ # Extract the first word of "egrep", so it can be a program name with args.
+set dummy egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_DX_EGREP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP
+if test -n "$ac_pt_DX_EGREP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5
+$as_echo "$ac_pt_DX_EGREP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_DX_EGREP" = x; then
+ DX_EGREP=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DX_EGREP=$ac_pt_DX_EGREP
+ fi
+else
+ DX_EGREP="$ac_cv_path_DX_EGREP"
+fi
+
+if test "$DX_FLAG_pdf$DX_EGREP" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PDF documentation" >&5
+$as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PDF documentation" >&2;}
+ DX_FLAG_pdf=0
+
+fi
+
+ :
+fi
+if test "$DX_FLAG_pdf" = 1; then
+ if :; then
+ DX_COND_pdf_TRUE=
+ DX_COND_pdf_FALSE='#'
+else
+ DX_COND_pdf_TRUE='#'
+ DX_COND_pdf_FALSE=
+fi
+
+
+ :
+else
+ if false; then
+ DX_COND_pdf_TRUE=
+ DX_COND_pdf_FALSE='#'
+else
+ DX_COND_pdf_TRUE='#'
+ DX_COND_pdf_FALSE=
+fi
+
+
+ :
+fi
+
+
+# LaTeX generation for PS and/or PDF:
+if test "$DX_FLAG_ps" = 1 || test "$DX_FLAG_pdf" = 1; then
+ if :; then
+ DX_COND_latex_TRUE=
+ DX_COND_latex_FALSE='#'
+else
+ DX_COND_latex_TRUE='#'
+ DX_COND_latex_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_LATEX='YES'"
+
+else
+ if false; then
+ DX_COND_latex_TRUE=
+ DX_COND_latex_FALSE='#'
+else
+ DX_COND_latex_TRUE='#'
+ DX_COND_latex_FALSE=
+fi
+
+ DX_ENV="$DX_ENV GENERATE_LATEX='NO'"
+
+fi
+
+# Paper size for PS and/or PDF:
+
+case "$DOXYGEN_PAPER_SIZE" in
+#(
+"")
+ DOXYGEN_PAPER_SIZE="letter"
+;; #(
+a4wide|a4|letter|legal|executive)
+ DX_ENV="$DX_ENV PAPER_SIZE='$DOXYGEN_PAPER_SIZE'"
+
+;; #(
+*)
+ as_fn_error "unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'" "$LINENO" 5
+ DOXYGEN_PAPER_SIZE="letter"
+;;
+esac
+DX_ENV="$DX_ENV PAPER_SIZE='"$DOXYGEN_PAPER_SIZE"'"
+
+
+
+if test -n "$DOXYGEN_HTML_LOGO"; then
+ if ! test -f "$DOXYGEN_HTML_LOGO"; then
+ as_fn_error "not a file: \"$DOXYGEN_HTML_LOGO\"" "$LINENO" 5
+ fi
+fi
+
+
+if test -n "$DOXYGEN_LOGO"; then
+ if ! test -f "$DOXYGEN_LOGO"; then
+ as_fn_error "not a file: \"$DOXYGEN_LOGO\"" "$LINENO" 5
+ fi
+fi
+
+
+if test -z "$DOXYGEN_TITLE"; then
+ DOXYGEN_TITLE="${PACKAGE_NAME}"
+fi
+
+
+if test -z "$DOXYGEN_AUTHOR"; then
+ DOXYGEN_AUTHOR="Generated by doxygen ${DOXYGEN_VERSION}"
+fi
+
+
+if test -z "$DOXYGEN_DATETIME"; then
+ DOXYGEN_DATETIME=`date +'%D %T'`
+fi
+
+
+if test -z "$DOXYGEN_DATE"; then
+ DOXYGEN_DATE=`date +%D`
+fi
+
+#For debugging:
+#echo DX_FLAG_doc=$DX_FLAG_doc
+#echo DX_FLAG_dot=$DX_FLAG_dot
+#echo DX_FLAG_man=$DX_FLAG_man
+#echo DX_FLAG_html=$DX_FLAG_html
+#echo DX_FLAG_chm=$DX_FLAG_chm
+#echo DX_FLAG_chi=$DX_FLAG_chi
+#echo DX_FLAG_rtf=$DX_FLAG_rtf
+#echo DX_FLAG_xml=$DX_FLAG_xml
+#echo DX_FLAG_pdf=$DX_FLAG_pdf
+#echo DX_FLAG_ps=$DX_FLAG_ps
+#echo DX_ENV=$DX_ENV
+
+ ac_config_files="$ac_config_files header.tex doxygen.sty"
+
+ ac_config_files="$ac_config_files doxygen.cfg:portals4/doxygen.cfg.in"
+
+
+fi #### End: Portals4 runtime configuration
+
+# Get target configury.
+. ${srcdir}/configure.tgt
+
+# configure.tgt sets these substitution variables.
+# It also sets 'upc_crtstuff=yes' if upc-crtstuff needs
+# to be compiled.
+
+
+
+
+
+
+
+
+
+
+
+
+ if test "$upc_runtime_model" = "smp"; then
+ LIBGUPC_SMP_RUNTIME_TRUE=
+ LIBGUPC_SMP_RUNTIME_FALSE='#'
+else
+ LIBGUPC_SMP_RUNTIME_TRUE='#'
+ LIBGUPC_SMP_RUNTIME_FALSE=
+fi
+
+ if test "$upc_runtime_model" = "portals4"; then
+ LIBGUPC_PORTALS4_RUNTIME_TRUE=
+ LIBGUPC_PORTALS4_RUNTIME_FALSE='#'
+else
+ LIBGUPC_PORTALS4_RUNTIME_TRUE='#'
+ LIBGUPC_PORTALS4_RUNTIME_FALSE=
+fi
+
+ if test "$enable_upc_runtime_debug" = "yes"; then
+ LIBGUPC_RUNTIME_DEBUG_TRUE=
+ LIBGUPC_RUNTIME_DEBUG_FALSE='#'
+else
+ LIBGUPC_RUNTIME_DEBUG_TRUE='#'
+ LIBGUPC_RUNTIME_DEBUG_FALSE=
+fi
+
+
+ if test "$upc_crtstuff" = "yes"; then
+ LIBGUPC_CRTSTUFF_TRUE=
+ LIBGUPC_CRTSTUFF_FALSE='#'
+else
+ LIBGUPC_CRTSTUFF_TRUE='#'
+ LIBGUPC_CRTSTUFF_FALSE=
+fi
+
+ if test "$use_upc_link_script" = "yes"; then
+ LIBGUPC_LINK_SCRIPT_TRUE=
+ LIBGUPC_LINK_SCRIPT_FALSE='#'
+else
+ LIBGUPC_LINK_SCRIPT_TRUE='#'
+ LIBGUPC_LINK_SCRIPT_FALSE=
+fi
+
+ if test "$use_generic_collectives" = "yes"; then
+ LIBGUPC_GENERIC_COLLECTIVES_TRUE=
+ LIBGUPC_GENERIC_COLLECTIVES_FALSE='#'
+else
+ LIBGUPC_GENERIC_COLLECTIVES_TRUE='#'
+ LIBGUPC_GENERIC_COLLECTIVES_FALSE=
+fi
+
+ if test "$enable_upc_backtrace" = "yes"; then
+ LIBGUPC_BACKTRACE_TRUE=
+ LIBGUPC_BACKTRACE_FALSE='#'
+else
+ LIBGUPC_BACKTRACE_TRUE='#'
+ LIBGUPC_BACKTRACE_FALSE=
+fi
+
+
+ if test "$targ_runtime_pthreads" = "yes"; then
+ LIBGUPC_PTHREADS_TRUE=
+ LIBGUPC_PTHREADS_FALSE='#'
+else
+ LIBGUPC_PTHREADS_TRUE='#'
+ LIBGUPC_PTHREADS_FALSE=
+fi
+
+ if test "$upc_affinity" = "yes"; then
+ LIBGUPC_AFFINITY_TRUE=
+ LIBGUPC_AFFINITY_FALSE='#'
+else
+ LIBGUPC_AFFINITY_TRUE='#'
+ LIBGUPC_AFFINITY_FALSE=
+fi
+
+ if test "$upc_numa" = "yes"; then
+ LIBGUPC_NUMA_TRUE=
+ LIBGUPC_NUMA_FALSE='#'
+else
+ LIBGUPC_NUMA_TRUE='#'
+ LIBGUPC_NUMA_FALSE=
+fi
+
+ if test "$upc_gum_debug" = "yes"; then
+ LIBGUPC_GUM_TRUE=
+ LIBGUPC_GUM_FALSE='#'
+else
+ LIBGUPC_GUM_TRUE='#'
+ LIBGUPC_GUM_FALSE=
+fi
+
+ if test "$upc_node_local" = "posix"; then
+ LIBGUPC_NODE_LOCAL_MEM_POSIX_TRUE=
+ LIBGUPC_NODE_LOCAL_MEM_POSIX_FALSE='#'
+else
+ LIBGUPC_NODE_LOCAL_MEM_POSIX_TRUE='#'
+ LIBGUPC_NODE_LOCAL_MEM_POSIX_FALSE=
+fi
+
+ if test "$upc_node_local" = "mmap"; then
+ LIBGUPC_NODE_LOCAL_MEM_MMAP_TRUE=
+ LIBGUPC_NODE_LOCAL_MEM_MMAP_FALSE='#'
+else
+ LIBGUPC_NODE_LOCAL_MEM_MMAP_TRUE='#'
+ LIBGUPC_NODE_LOCAL_MEM_MMAP_FALSE=
+fi
+
+
+
+
+
+
+
+ac_config_files="$ac_config_files Makefile testsuite/Makefile"
+
+ac_config_files="$ac_config_files upc-crtbegin.spec libgupc.spec upc-crtend.spec"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${GENINSRC_TRUE}" && test -z "${GENINSRC_FALSE}"; then
+ as_fn_error "conditional \"GENINSRC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepUPC_TRUE}" && test -z "${am__fastdepUPC_FALSE}"; then
+ as_fn_error "conditional \"am__fastdepUPC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
+ as_fn_error "conditional \"BUILD_INFO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ as_fn_error "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBGUPC_BUILD_VERSIONED_SHLIB_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_BUILD_VERSIONED_SHLIB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_doc_TRUE}" && test -z "${DX_COND_doc_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_doc\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_doc_TRUE}" && test -z "${DX_COND_doc_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_doc\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_dot_TRUE}" && test -z "${DX_COND_dot_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_dot\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_dot_TRUE}" && test -z "${DX_COND_dot_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_dot\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_man_TRUE}" && test -z "${DX_COND_man_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_man\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_man_TRUE}" && test -z "${DX_COND_man_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_man\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_rtf_TRUE}" && test -z "${DX_COND_rtf_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_rtf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_rtf_TRUE}" && test -z "${DX_COND_rtf_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_rtf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_xml_TRUE}" && test -z "${DX_COND_xml_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_xml\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_xml_TRUE}" && test -z "${DX_COND_xml_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_xml\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chm_TRUE}" && test -z "${DX_COND_chm_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_chm\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chm_TRUE}" && test -z "${DX_COND_chm_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_chm\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chi_TRUE}" && test -z "${DX_COND_chi_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_chi\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chi_TRUE}" && test -z "${DX_COND_chi_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_chi\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_html_TRUE}" && test -z "${DX_COND_html_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_html\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_html_TRUE}" && test -z "${DX_COND_html_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_html\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_ps_TRUE}" && test -z "${DX_COND_ps_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_ps\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_ps_TRUE}" && test -z "${DX_COND_ps_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_ps\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_pdf_TRUE}" && test -z "${DX_COND_pdf_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_pdf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_pdf_TRUE}" && test -z "${DX_COND_pdf_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_pdf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_latex_TRUE}" && test -z "${DX_COND_latex_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_latex\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_latex_TRUE}" && test -z "${DX_COND_latex_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_latex\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_doc_TRUE}" && test -z "${DX_COND_doc_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_doc\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_doc_TRUE}" && test -z "${DX_COND_doc_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_doc\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_dot_TRUE}" && test -z "${DX_COND_dot_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_dot\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_dot_TRUE}" && test -z "${DX_COND_dot_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_dot\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_man_TRUE}" && test -z "${DX_COND_man_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_man\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_man_TRUE}" && test -z "${DX_COND_man_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_man\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_rtf_TRUE}" && test -z "${DX_COND_rtf_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_rtf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_rtf_TRUE}" && test -z "${DX_COND_rtf_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_rtf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_xml_TRUE}" && test -z "${DX_COND_xml_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_xml\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_xml_TRUE}" && test -z "${DX_COND_xml_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_xml\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chm_TRUE}" && test -z "${DX_COND_chm_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_chm\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chm_TRUE}" && test -z "${DX_COND_chm_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_chm\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chi_TRUE}" && test -z "${DX_COND_chi_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_chi\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chi_TRUE}" && test -z "${DX_COND_chi_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_chi\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_html_TRUE}" && test -z "${DX_COND_html_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_html\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_html_TRUE}" && test -z "${DX_COND_html_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_html\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_ps_TRUE}" && test -z "${DX_COND_ps_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_ps\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_ps_TRUE}" && test -z "${DX_COND_ps_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_ps\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_pdf_TRUE}" && test -z "${DX_COND_pdf_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_pdf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_pdf_TRUE}" && test -z "${DX_COND_pdf_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_pdf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_latex_TRUE}" && test -z "${DX_COND_latex_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_latex\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_latex_TRUE}" && test -z "${DX_COND_latex_FALSE}"; then
+ as_fn_error "conditional \"DX_COND_latex\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_SMP_RUNTIME_TRUE}" && test -z "${LIBGUPC_SMP_RUNTIME_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_SMP_RUNTIME\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_PORTALS4_RUNTIME_TRUE}" && test -z "${LIBGUPC_PORTALS4_RUNTIME_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_PORTALS4_RUNTIME\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_RUNTIME_DEBUG_TRUE}" && test -z "${LIBGUPC_RUNTIME_DEBUG_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_RUNTIME_DEBUG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_CRTSTUFF_TRUE}" && test -z "${LIBGUPC_CRTSTUFF_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_CRTSTUFF\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_LINK_SCRIPT_TRUE}" && test -z "${LIBGUPC_LINK_SCRIPT_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_LINK_SCRIPT\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_GENERIC_COLLECTIVES_TRUE}" && test -z "${LIBGUPC_GENERIC_COLLECTIVES_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_GENERIC_COLLECTIVES\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_BACKTRACE_TRUE}" && test -z "${LIBGUPC_BACKTRACE_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_BACKTRACE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_PTHREADS_TRUE}" && test -z "${LIBGUPC_PTHREADS_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_PTHREADS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_AFFINITY_TRUE}" && test -z "${LIBGUPC_AFFINITY_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_AFFINITY\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_NUMA_TRUE}" && test -z "${LIBGUPC_NUMA_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_NUMA\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_GUM_TRUE}" && test -z "${LIBGUPC_GUM_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_GUM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_NODE_LOCAL_MEM_POSIX_TRUE}" && test -z "${LIBGUPC_NODE_LOCAL_MEM_POSIX_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_NODE_LOCAL_MEM_POSIX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGUPC_NODE_LOCAL_MEM_MMAP_TRUE}" && test -z "${LIBGUPC_NODE_LOCAL_MEM_MMAP_FALSE}"; then
+ as_fn_error "conditional \"LIBGUPC_NODE_LOCAL_MEM_MMAP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$?; test $as_status -eq 0 && as_status=1
+ if test "$3"; then
+ as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ fi
+ $as_echo "$as_me: error: $1" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by GNU UPC Runtime Library $as_me 1.0, which was
+generated by GNU Autoconf 2.64. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to the package provider.
+GNU UPC Runtime Library home page: <http://www.gnu.org/software/libgupc/>.
+General help using GNU software: <http://www.gnu.org/gethelp/>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+GNU UPC Runtime Library config.status 1.0
+configured by $0, generated by GNU Autoconf 2.64,
+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
+GCC="$GCC"
+CC="$CC"
+acx_cv_header_stdint="$acx_cv_header_stdint"
+acx_cv_type_int8_t="$acx_cv_type_int8_t"
+acx_cv_type_int16_t="$acx_cv_type_int16_t"
+acx_cv_type_int32_t="$acx_cv_type_int32_t"
+acx_cv_type_int64_t="$acx_cv_type_int64_t"
+acx_cv_type_intptr_t="$acx_cv_type_intptr_t"
+ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t"
+ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t"
+ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
+ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
+ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t"
+ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
+ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
+ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p"
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS gstdint.h" ;;
+ "header.tex") CONFIG_FILES="$CONFIG_FILES header.tex" ;;
+ "doxygen.sty") CONFIG_FILES="$CONFIG_FILES doxygen.sty" ;;
+ "doxygen.cfg") CONFIG_FILES="$CONFIG_FILES doxygen.cfg:portals4/doxygen.cfg.in" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
+ "upc-crtbegin.spec") CONFIG_FILES="$CONFIG_FILES upc-crtbegin.spec" ;;
+ "libgupc.spec") CONFIG_FILES="$CONFIG_FILES libgupc.spec" ;;
+ "upc-crtend.spec") CONFIG_FILES="$CONFIG_FILES upc-crtend.spec" ;;
+
+ *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+ || as_fn_error "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_t"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin" \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out" && rm -f "$tmp/out";;
+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+ } >"$tmp/config.h" \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$tmp/config.h" "$ac_file" \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+ "libtool":C)
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking. This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=${#1}
+}
+
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+}
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "$@"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1+=\$2"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1=\$$1\$2"
+}
+
+_LT_EOF
+ ;;
+ esac
+
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+ "gstdint.h":C)
+if test "$GCC" = yes; then
+ echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h
+else
+ echo "/* generated for $CC */" > tmp-stdint.h
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ #ifndef GCC_GENERATED_STDINT_H
+ #define GCC_GENERATED_STDINT_H 1
+
+ #include <sys/types.h>
+EOF
+
+if test "$acx_cv_header_stdint" != stdint.h; then
+ echo "#include <stddef.h>" >> tmp-stdint.h
+fi
+if test "$acx_cv_header_stdint" != stddef.h; then
+ echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+ /* glibc uses these symbols as guards to prevent redefinitions. */
+ #ifdef __int8_t_defined
+ #define _INT8_T
+ #define _INT16_T
+ #define _INT32_T
+ #endif
+ #ifdef __uint32_t_defined
+ #define _UINT32_T
+ #endif
+
+EOF
+
+# ----------------- done header, emit basic int types -------------
+if test "$acx_cv_header_stdint" = stddef.h; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ #ifndef _UINT8_T
+ #define _UINT8_T
+ #ifndef __uint8_t_defined
+ #define __uint8_t_defined
+ #ifndef uint8_t
+ typedef unsigned $acx_cv_type_int8_t uint8_t;
+ #endif
+ #endif
+ #endif
+
+ #ifndef _UINT16_T
+ #define _UINT16_T
+ #ifndef __uint16_t_defined
+ #define __uint16_t_defined
+ #ifndef uint16_t
+ typedef unsigned $acx_cv_type_int16_t uint16_t;
+ #endif
+ #endif
+ #endif
+
+ #ifndef _UINT32_T
+ #define _UINT32_T
+ #ifndef __uint32_t_defined
+ #define __uint32_t_defined
+ #ifndef uint32_t
+ typedef unsigned $acx_cv_type_int32_t uint32_t;
+ #endif
+ #endif
+ #endif
+
+ #ifndef _INT8_T
+ #define _INT8_T
+ #ifndef __int8_t_defined
+ #define __int8_t_defined
+ #ifndef int8_t
+ typedef $acx_cv_type_int8_t int8_t;
+ #endif
+ #endif
+ #endif
+
+ #ifndef _INT16_T
+ #define _INT16_T
+ #ifndef __int16_t_defined
+ #define __int16_t_defined
+ #ifndef int16_t
+ typedef $acx_cv_type_int16_t int16_t;
+ #endif
+ #endif
+ #endif
+
+ #ifndef _INT32_T
+ #define _INT32_T
+ #ifndef __int32_t_defined
+ #define __int32_t_defined
+ #ifndef int32_t
+ typedef $acx_cv_type_int32_t int32_t;
+ #endif
+ #endif
+ #endif
+EOF
+elif test "$ac_cv_type_u_int32_t" = yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */
+ #ifndef _INT8_T
+ #define _INT8_T
+ #endif
+ #ifndef _INT16_T
+ #define _INT16_T
+ #endif
+ #ifndef _INT32_T
+ #define _INT32_T
+ #endif
+
+ #ifndef _UINT8_T
+ #define _UINT8_T
+ #ifndef __uint8_t_defined
+ #define __uint8_t_defined
+ #ifndef uint8_t
+ typedef u_int8_t uint8_t;
+ #endif
+ #endif
+ #endif
+
+ #ifndef _UINT16_T
+ #define _UINT16_T
+ #ifndef __uint16_t_defined
+ #define __uint16_t_defined
+ #ifndef uint16_t
+ typedef u_int16_t uint16_t;
+ #endif
+ #endif
+ #endif
+
+ #ifndef _UINT32_T
+ #define _UINT32_T
+ #ifndef __uint32_t_defined
+ #define __uint32_t_defined
+ #ifndef uint32_t
+ typedef u_int32_t uint32_t;
+ #endif
+ #endif
+ #endif
+EOF
+else
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Some systems have guard macros to prevent redefinitions, define them. */
+ #ifndef _INT8_T
+ #define _INT8_T
+ #endif
+ #ifndef _INT16_T
+ #define _INT16_T
+ #endif
+ #ifndef _INT32_T
+ #define _INT32_T
+ #endif
+ #ifndef _UINT8_T
+ #define _UINT8_T
+ #endif
+ #ifndef _UINT16_T
+ #define _UINT16_T
+ #endif
+ #ifndef _UINT32_T
+ #define _UINT32_T
+ #endif
+EOF
+fi
+
+# ------------- done basic int types, emit int64_t types ------------
+if test "$ac_cv_type_uint64_t" = yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* system headers have good uint64_t and int64_t */
+ #ifndef _INT64_T
+ #define _INT64_T
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #endif
+EOF
+elif test "$ac_cv_type_u_int64_t" = yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* system headers have an u_int64_t (and int64_t) */
+ #ifndef _INT64_T
+ #define _INT64_T
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #ifndef __uint64_t_defined
+ #define __uint64_t_defined
+ #ifndef uint64_t
+ typedef u_int64_t uint64_t;
+ #endif
+ #endif
+ #endif
+EOF
+elif test -n "$acx_cv_type_int64_t"; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* architecture has a 64-bit type, $acx_cv_type_int64_t */
+ #ifndef _INT64_T
+ #define _INT64_T
+ #ifndef int64_t
+ typedef $acx_cv_type_int64_t int64_t;
+ #endif
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #ifndef __uint64_t_defined
+ #define __uint64_t_defined
+ #ifndef uint64_t
+ typedef unsigned $acx_cv_type_int64_t uint64_t;
+ #endif
+ #endif
+ #endif
+EOF
+else
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* some common heuristics for int64_t, using compiler-specific tests */
+ #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L
+ #ifndef _INT64_T
+ #define _INT64_T
+ #ifndef __int64_t_defined
+ #ifndef int64_t
+ typedef long long int64_t;
+ #endif
+ #endif
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #ifndef uint64_t
+ typedef unsigned long long uint64_t;
+ #endif
+ #endif
+
+ #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0
+ /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
+ does not implement __extension__. But that compiler doesn't define
+ __GNUC_MINOR__. */
+ # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
+ # define __extension__
+ # endif
+
+ # ifndef _INT64_T
+ # define _INT64_T
+ # ifndef int64_t
+ __extension__ typedef long long int64_t;
+ # endif
+ # endif
+ # ifndef _UINT64_T
+ # define _UINT64_T
+ # ifndef uint64_t
+ __extension__ typedef unsigned long long uint64_t;
+ # endif
+ # endif
+
+ #elif !defined __STRICT_ANSI__
+ # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
+
+ # ifndef _INT64_T
+ # define _INT64_T
+ # ifndef int64_t
+ typedef __int64 int64_t;
+ # endif
+ # endif
+ # ifndef _UINT64_T
+ # define _UINT64_T
+ # ifndef uint64_t
+ typedef unsigned __int64 uint64_t;
+ # endif
+ # endif
+ # endif /* compiler */
+
+ #endif /* ANSI version */
+EOF
+fi
+
+# ------------- done int64_t types, emit intptr types ------------
+if test "$ac_cv_type_uintptr_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */
+ #ifndef __uintptr_t_defined
+ #ifndef uintptr_t
+ typedef u$acx_cv_type_intptr_t uintptr_t;
+ #endif
+ #endif
+ #ifndef __intptr_t_defined
+ #ifndef intptr_t
+ typedef $acx_cv_type_intptr_t intptr_t;
+ #endif
+ #endif
+EOF
+fi
+
+# ------------- done intptr types, emit int_least types ------------
+if test "$ac_cv_type_int_least32_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define int_least types */
+ typedef int8_t int_least8_t;
+ typedef int16_t int_least16_t;
+ typedef int32_t int_least32_t;
+ #ifdef _INT64_T
+ typedef int64_t int_least64_t;
+ #endif
+
+ typedef uint8_t uint_least8_t;
+ typedef uint16_t uint_least16_t;
+ typedef uint32_t uint_least32_t;
+ #ifdef _UINT64_T
+ typedef uint64_t uint_least64_t;
+ #endif
+EOF
+fi
+
+# ------------- done intptr types, emit int_fast types ------------
+if test "$ac_cv_type_int_fast32_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define int_fast types. short is often slow */
+ typedef int8_t int_fast8_t;
+ typedef int int_fast16_t;
+ typedef int32_t int_fast32_t;
+ #ifdef _INT64_T
+ typedef int64_t int_fast64_t;
+ #endif
+
+ typedef uint8_t uint_fast8_t;
+ typedef unsigned int uint_fast16_t;
+ typedef uint32_t uint_fast32_t;
+ #ifdef _UINT64_T
+ typedef uint64_t uint_fast64_t;
+ #endif
+EOF
+fi
+
+if test "$ac_cv_type_uintmax_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define intmax based on what we found */
+ #ifndef intmax_t
+ #ifdef _INT64_T
+ typedef int64_t intmax_t;
+ #else
+ typedef long intmax_t;
+ #endif
+ #endif
+ #ifndef uintmax_t
+ #ifdef _UINT64_T
+ typedef uint64_t uintmax_t;
+ #else
+ typedef unsigned long uintmax_t;
+ #endif
+ #endif
+EOF
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ #endif /* GCC_GENERATED_STDINT_H */
+EOF
+
+if test -r gstdint.h && cmp -s tmp-stdint.h gstdint.h; then
+ rm -f tmp-stdint.h
+else
+ mv -f tmp-stdint.h gstdint.h
+fi
+
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit $?
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/libgupc/configure.ac b/libgupc/configure.ac
new file mode 100644
index 00000000000..9c6e44d3a6f
--- /dev/null
+++ b/libgupc/configure.ac
@@ -0,0 +1,1382 @@
+# Process this file with autoconf to produce a configure script, like so:
+# aclocal -I . -I .. -I ../config && autoconf && autoheader && automake
+#
+# Copyright (C) 2001-2016 Free Software Foundation, Inc.
+# Contributed by Gary Funck <gary@intrepid.com>
+# Derived from libgomp/configure.ac
+#
+#This file is part of GNU UPC.
+#
+#GNU UPC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 2, or (at your option)
+#any later version.
+#
+#GNU UPC 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 GNU UPC; see the file COPYING. If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+#02111-1307, USA.
+
+AC_PREREQ(2.64)
+AC_INIT([GNU UPC Runtime Library], 1.0,,[libgupc])
+AC_CONFIG_SRCDIR([include/upc.h])
+AC_CONFIG_HEADERS([config.h])
+
+# -------
+# Options
+# -------
+
+AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+LIBGUPC_ENABLE(version-specific-runtime-libs, no, ,
+ [specify that runtime libraries should be installed
+ in a compiler-specific directory],
+ permit yes|no)
+AC_MSG_RESULT($enable_version_specific_runtime_libs)
+
+# We would like our source tree to be readonly. However when releases or
+# pre-releases are generated, the flex/bison generated files as well as the
+# various formats of manuals need to be included along with the rest of the
+# sources. Therefore we have --enable-generated-files-in-srcdir to do
+# just that.
+AC_MSG_CHECKING([for --enable-generated-files-in-srcdir])
+LIBGUPC_ENABLE(generated-files-in-srcdir, no, ,
+ [put copies of generated files in source dir intended for creating source
+ tarballs for users without texinfo bison or flex],
+ permit yes|no)
+AC_MSG_RESULT($enable_generated_files_in_srcdir)
+AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
+
+
+# -------
+# Get build environment
+# -------
+
+# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
+#
+# You will slowly go insane if you do not grok the following fact: when
+# building this library, the top-level /target/ becomes the library's /host/.
+#
+# configure then causes --target to default to --host, exactly like any
+# other package using autoconf. Therefore, 'target' and 'host' will
+# always be the same. This makes sense both for native and cross compilers
+# just think about it for a little while. :-)
+#
+# Also, if this library is being configured as part of a cross compiler, the
+# top-level configure script will pass the "real" host as $with_cross_host.
+#
+# Do not delete or change the following two lines. For why, see
+# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+
+# Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
+# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
+# 1.11.1: minimum required version
+# no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
+# of other PACKAGE_* variables will, however, and there's nothing
+# we can do about that; they come from AC_INIT).
+# foreign: we don't follow the normal rules for GNU packages (no COPYING
+# file in the top srcdir, etc, etc), so stop complaining.
+# -Wall: turns on all automake warnings...
+# -Wno-portability: ...except this one, since GNU make is required.
+# -Wno-override: ... and this one, since we do want this in testsuite.
+AM_INIT_AUTOMAKE([1.11.6 foreign -Wall -Wno-portability -Wno-override])
+
+# UPC disables multilib for portals4 runtime
+if echo "${with_upc_runtime}" | grep -v -i '^portals4$' 2>&1 >/dev/null; then
+ AM_ENABLE_MULTILIB(, ..)
+fi
+
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${enable_version_specific_runtime_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+ *)
+ AC_MSG_ERROR(['$enable_version_specific_runtime_libs' is not set])
+ ;;
+esac
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexeclibdir)
+
+# If the language specific driver does not exist, we do not build anything.
+# Note, $r is set by the top-level Makefile.
+rm -f skip-this-dir
+AC_MSG_CHECKING([if UPC driver 'gupc' has been built])
+AC_CACHE_VAL(upc_cv_driver_exists,
+[
+ upc_cv_driver_exists=yes
+ if test -n "$r"; then
+ if test -d "$r"/gcc; then
+ if (test -f "$r"/gcc/gupc && test -x "$r"/gcc/gupc); then
+ true
+ else
+ upc_cv_driver_exists=no
+ fi
+ fi
+ fi
+])
+AC_MSG_RESULT($upc_cv_driver_exists)
+if test x$upc_cv_driver_exists = xno
+then
+ echo "rm -f config.cache config.log multilib.out" > skip-this-dir
+ rm -f Makefile conftest* confdefs* core
+ exit 0
+fi
+
+# Check the compiler.
+# The same as in boehm-gc and libstdc++. Have to borrow it from there.
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+
+m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
+m4_define([_AC_ARG_VAR_PRECIOUS],[])
+AC_PROG_CC
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+
+AC_SUBST(CFLAGS)
+
+#
+# If UPCFLAGS hasn't been set explicitly then default to "$CFLAGS".
+#
+if test x"$UPCFLAGS" = "x"; then
+ UPCFLAGS="$CFLAGS"
+fi
+
+AC_SUBST(UPCFLAGS)
+
+# In order to override CFLAGS_FOR_TARGET, all of our special flags go
+# in XCFLAGS. But we need them in CFLAGS during configury. So put them
+# in both places for now and restore CFLAGS at the end of config.
+save_CFLAGS="$CFLAGS"
+
+# Add -Wall -Werror if we are using GCC.
+if test "x$GCC" = "xyes"; then
+ XCFLAGS="$XCFLAGS -Wall -Werror"
+fi
+
+dnl The UPC compiler is used to compile some parts of the runtime
+dnl This hack makes sure that we pick up the multiflags that
+dnl may have been tacked onto the $CC command.
+if echo "$CC" | grep '/xgcc ' >/dev/null 2>&1; then
+ UPC=`echo "$CC" | sed -e 's=/xgcc =/gupc ='`
+else
+ AC_MSG_ERROR([cannot create UPC from CC because it does not contain the
+ string '/xgcc '; the value of CC is: "$CC"])
+fi
+# The just built UPC compiler is not fully functional as it is
+# unable to auto pre-include "gcc-upc.h" and "gcc-upc-lib.h".
+# Make sure that "upc-pre-include" feature is disabled for any of the
+# UPC program checks (e.g. checking for dependency options).
+saved_UPC="$UPC"
+UPC="$UPC -fno-upc-pre-include"
+AM_PROG_UPC()
+UPC="$saved_UPC"
+
+# Find other programs we need.
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
+AC_PATH_PROG(PERL, perl, perl-not-found-in-path-error)
+AC_PATH_PROG(ADDR2LINE, addr2line, addr2line-not-found-in-path-error)
+AC_PROG_MAKE_SET
+AC_PROG_INSTALL
+
+# See if makeinfo has been installed and is modern enough
+# that we can use it.
+ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+ [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
+AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
+
+
+# libgupc cannot be built as shared library
+enable_shared=no
+# Configure libtool
+AC_DISABLE_SHARED
+AM_PROG_LIBTOOL
+
+AM_MAINTAINER_MODE
+
+# For libtool versioning info, format is CURRENT:REVISION:AGE
+libtool_VERSION=1:0:0
+AC_SUBST(libtool_VERSION)
+
+# Check header files.
+AC_STDC_HEADERS
+ACX_HEADER_STRING
+GCC_HEADER_STDINT(gstdint.h)
+AC_HEADER_TIME
+AC_HEADER_SYS_WAIT
+
+AC_CHECK_HEADERS([execinfo.h fcntl.h limits.h netdb.h netinet/in.h])
+AC_CHECK_HEADERS([sched.h semaphore.h stddef.h stdlib.h sys/loadavg.h])
+AC_CHECK_HEADERS([sys/socket.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_MODE_T
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_CHECK_DECLS([sys_siglist])
+AC_C_VOLATILE
+AC_CHECK_TYPES([ptrdiff_t])
+
+# Check to see if -pthread or -lpthread is needed. Prefer the former.
+# In case the pthread.h system header is not found, this test will fail.
+XPCFLAGS=""
+CFLAGS="$CFLAGS -pthread"
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <pthread.h>
+ void *g(void *d) { return NULL; }],
+ [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+ [XPCFLAGS=" -Wc,-pthread"],
+ [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <pthread.h>
+ void *g(void *d) { return NULL; }],
+ [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+ [],
+ [AC_MSG_NOTICE([Pthreads are not supported in this libgupc build])])])
+
+# Check for functions needed.
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_MMAP
+AC_FUNC_STAT
+AC_CHECK_FUNCS([clock_gettime ftruncate getcwd gethostbyname gethostname])
+AC_CHECK_FUNCS([getloadavg memset mkdir munmap socket])
+AC_CHECK_FUNCS([strcasecmp strdup strerror strtol strtoull])
+AC_CHECK_FUNCS([backtrace backtrace_symbols backtrace_symbols_fd])
+AC_SYS_LARGEFILE
+
+# Check for broken semaphore implementation on darwin.
+# sem_init returns: sem_init error: Function not implemented.
+case "$host" in
+ *-darwin*)
+ AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
+ Define if the POSIX Semaphores do not work on your system.)
+ ;;
+esac
+
+GCC_LINUX_FUTEX(:)
+
+# Check for pthread_{,attr_}[sg]etaffinity_np.
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#define _GNU_SOURCE
+ #include <pthread.h>],
+ [cpu_set_t cpuset;
+ pthread_attr_t attr;
+ pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+ if (CPU_ISSET (0, &cpuset))
+ CPU_SET (1, &cpuset);
+ else
+ CPU_ZERO (&cpuset);
+ pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+ pthread_attr_init (&attr);
+ pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
+ pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);])],
+ AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1,
+ [Define to 1 if pthread_{,attr_}{g,s}etaffinity_np is supported.]))
+
+# At least for glibc, clock_gettime is in librt. But don't pull that
+# in if it still doesn't give us the function we want.
+if test $ac_cv_func_clock_gettime = no; then
+ AC_CHECK_LIB(rt, clock_gettime,[ac_cv_func_clock_gettime="yes"])
+ if test $ac_cv_func_clock_gettime = yes; then
+ LIBS="-lrt $LIBS"
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
+ [Define to 1 if you have the `clock_gettime' function.])
+ fi
+fi
+
+# See if we support thread-local storage.
+GCC_CHECK_TLS
+
+# See what sort of export controls are available.
+LIBGUPC_CHECK_ATTRIBUTE_VISIBILITY
+LIBGUPC_CHECK_ATTRIBUTE_DLLEXPORT
+LIBGUPC_CHECK_ATTRIBUTE_ALIAS
+LIBGUPC_ENABLE_SYMVERS
+
+if test $enable_symvers = gnu; then
+ AC_DEFINE(LIBGUPC_GNU_SYMBOL_VERSIONING, 1,
+ [Define to 1 if GNU symbol versioning is used for libgupc.])
+fi
+
+CFLAGS="$save_CFLAGS $XCFLAGS"
+
+# Check for __sync_val_compare_and_swap, but only after the target has
+# had a chance to set XCFLAGS.
+LIBGUPC_CHECK_SYNC_BUILTINS
+
+# Check for __sync_fetch_and_add
+AC_CACHE_CHECK([for __sync_fetch_and_add_4],
+[upc_cv_sync_fetch_and_add_4],
+[AC_LINK_IFELSE([
+typedef unsigned int uint32 __attribute__ ((mode (SI)));
+uint32 i;
+int main() { return __sync_fetch_and_add (&i, 1); }
+],
+[upc_cv_sync_fetch_and_add_4=yes],
+[upc_cv_sync_fetch_and_add_4=no])])
+if test "$upc_cv_sync_fetch_and_add_4" = "yes"; then
+ AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD_4, 1,
+ [Define to 1 if the compiler provides the
+ __sync_fetch_and_add function for uint32])
+fi
+
+AC_CACHE_CHECK([for __sync_fetch_and_add_8],
+[upc_cv_sync_fetch_and_add_8],
+[AC_LINK_IFELSE([
+typedef unsigned int uint64 __attribute__ ((mode (DI)));
+uint64 i;
+int main() { return __sync_fetch_and_add (&i, 1); }
+],
+[upc_cv_sync_fetch_and_add_8=yes],
+[upc_cv_sync_fetch_and_add_8=no])])
+if test "$upc_cv_sync_fetch_and_add_8" = "yes"; then
+ AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD_8, 1,
+ [Define to 1 if the compiler provides the
+ __sync_fetch_and_add function for uint64])
+fi
+
+XCFLAGS="$XCFLAGS"
+
+
+# Cleanup and exit.
+CFLAGS="$save_CFLAGS"
+AC_CACHE_SAVE
+
+if test "x${multilib}" = xyes; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+AC_MSG_CHECKING([for thread model used by GCC])
+target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+AC_MSG_RESULT([$target_thread_file])
+
+if test $target_thread_file != single; then
+ AC_DEFINE(HAVE_GTHR_DEFAULT, 1,
+ [Define if the compiler has a thread header that is non single.])
+fi
+
+AC_MSG_CHECKING([UPC shared pointer representation])
+cat > conftest.upc << _ACEOF
+#define _XSTR(X) #X
+#define _STR(S) _XSTR(S)
+#ifdef __UPC_LINK_SCRIPT__
+ GUPCR_LINK_SCRIPT=1
+#else
+ GUPCR_LINK_SCRIPT=0
+#endif
+#ifdef __UPC_VADDR_FIRST__
+ GUPCR_PTS_VADDR_FIRST=1
+#else
+ GUPCR_PTS_VADDR_FIRST=0
+#endif
+GUPCR_PTS_VADDR_SIZE=_STR(__UPC_VADDR_SIZE__)
+GUPCR_PTS_PHASE_SIZE=_STR(__UPC_PHASE_SIZE__)
+GUPCR_PTS_THREAD_SIZE=_STR(__UPC_THREAD_SIZE__)
+#if __UPC_PTS_STRUCT_REP__
+ GUPCR_PTS_REP="struct"
+ GUPCR_PTS_STRUCT_REP=1
+ GUPCR_PTS_VADDR_TYPE=_STR(__UPC_VADDR_TYPE__)
+ GUPCR_PTS_PHASE_TYPE=_STR(__UPC_PHASE_TYPE__)
+ GUPCR_PTS_THREAD_TYPE=_STR(__UPC_THREAD_TYPE__)
+ #if __UPC_PTS_ALIGN__
+ GUPCR_PTS_ALIGN=_STR(__UPC_PTS_ALIGN__)
+ #endif
+#else
+ GUPCR_PTS_REP="packed"
+ GUPCR_PTS_PACKED_REP=1
+#endif
+_ACEOF
+eval `$UPC -fno-upc-pre-include -DNO_GCC_UPC_LIB=1 -E conftest.upc | \
+ grep '^ *GUPCR_[[A-Z0-9_]]*='`
+rm -f conftest.upc
+AC_MSG_RESULT($GUPCR_PTS_REP)
+if test -z "$GUPCR_PTS_REP"; then
+ AC_MSG_ERROR([can't determine UPC sptr representation])
+fi
+for cfg in \
+ GUPCR_PTS_PACKED_REP \
+ GUPCR_PTS_PHASE_SIZE \
+ GUPCR_PTS_PHASE_TYPE \
+ GUPCR_PTS_REP \
+ GUPCR_PTS_STRUCT_REP \
+ GUPCR_PTS_ALIGN \
+ GUPCR_PTS_THREAD_SIZE \
+ GUPCR_PTS_THREAD_TYPE \
+ GUPCR_PTS_VADDR_FIRST \
+ GUPCR_PTS_VADDR_SIZE \
+ GUPCR_PTS_VADDR_TYPE \
+ GUPCR_LINK_SCRIPT; do
+ eval "cval=\$$cfg"
+ if test -n "$cval"; then
+ AC_MSG_CHECKING([value of $cfg])
+ AC_MSG_RESULT($cval)
+ fi
+done
+if test -n "$with_upc_pts" \
+ && test "$with_upc_pts" != "$GUPCR_PTS_REP" ; then
+ AC_MSG_ERROR([--with-upc-pts=$with_upc_pts is incompatible with the
+UPC compiler's supported pointer-to-shared representation ($GUPCR_PTS_REP)])
+fi
+AC_DEFINE_UNQUOTED(GUPCR_PTS_VADDR_SIZE,[$GUPCR_PTS_VADDR_SIZE],
+ [Size of shared pointer's vaddr field (in bits)])
+AC_DEFINE_UNQUOTED(GUPCR_PTS_THREAD_SIZE,[$GUPCR_PTS_THREAD_SIZE],
+ [Size of shared pointer's thread field (in bits)])
+AC_DEFINE_UNQUOTED(GUPCR_PTS_PHASE_SIZE,[$GUPCR_PTS_PHASE_SIZE],
+ [Size of shared pointer's phase field (in bits)])
+if test "$GUPCR_PTS_REP" = "struct"; then
+ AC_DEFINE(GUPCR_PTS_STRUCT_REP,[1],
+ [Whether UPC shared pointers use the 'struct' representation])
+ AC_DEFINE_UNQUOTED(GUPCR_PTS_VADDR_TYPE,[$GUPCR_PTS_VADDR_TYPE],
+ [The data type of the 'vaddr' field in a UPC shared pointer])
+ AC_DEFINE_UNQUOTED(GUPCR_PTS_THREAD_TYPE,[$GUPCR_PTS_THREAD_TYPE],
+ [The data type of the 'thread' field in a UPC shared pointer])
+ AC_DEFINE_UNQUOTED(GUPCR_PTS_PHASE_TYPE,[$GUPCR_PTS_PHASE_TYPE],
+ [The data type of the 'phase' field in a UPC shared pointer])
+ if test -n "$GUPCR_PTS_ALIGN"; then
+ AC_DEFINE_UNQUOTED(GUPCR_PTS_ALIGN,[$GUPCR_PTS_ALIGN],
+ [The required alignment for the UPC struct shared pointer
+ representation.])
+ fi
+else
+ AC_DEFINE(GUPCR_PTS_PACKED_REP,[1],
+ [Whether UPC pointers-to-shared use the 'packed' representation])
+fi
+if test "$GUPCR_PTS_VADDR_FIRST" -eq 1; then
+ AC_DEFINE(GUPCR_PTS_VADDR_FIRST,[1],
+ [Whether the 'vaddr' field comes first (ie, [[vaddr,thread,phase]])])
+fi
+
+AC_MSG_NOTICE([determine UPC target-dependent section names])
+cat > conftest.upc << _ACEOF
+#define _XSTR(X) #X
+#define _STR(S) _XSTR(S)
+
+#ifdef __UPC_INIT_ARRAY_SECTION_NAME__
+ GUPCR_INIT_ARRAY_SECTION_NAME=_STR(__UPC_INIT_ARRAY_SECTION_NAME__)
+#endif
+#ifdef __UPC_PGM_INFO_SECTION_NAME__
+ GUPCR_PGM_INFO_SECTION_NAME=_STR(__UPC_PGM_INFO_SECTION_NAME__)
+#endif
+#ifdef __UPC_SHARED_SECTION_NAME__
+ GUPCR_SHARED_SECTION_NAME=_STR(__UPC_SHARED_SECTION_NAME__)
+#endif
+_ACEOF
+eval `$UPC -fno-upc-pre-include -DNO_GCC_UPC_LIB=1 -E conftest.upc | \
+ grep '^ *GUPCR_[[A-Z0-9_]]*='`
+rm -f conftest.upc
+for cfg in \
+ GUPCR_INIT_ARRAY_SECTION_NAME \
+ GUPCR_PGM_INFO_SECTION_NAME \
+ GUPCR_SHARED_SECTION_NAME; do
+ eval "cval=\$$cfg"
+ if test -n "$cval"; then
+ AC_MSG_CHECKING([value of $cfg])
+ AC_MSG_RESULT($cval)
+ fi
+done
+if test -n "$GUPCR_INIT_ARRAY_SECTION_NAME"; then
+ AC_DEFINE_UNQUOTED(GUPCR_INIT_ARRAY_SECTION_NAME,
+ [$GUPCR_INIT_ARRAY_SECTION_NAME],
+ [Name of section that holds an array of addresses that points to
+ the UPC initialization routines.])
+fi
+if test -n "$GUPCR_PGM_INFO_SECTION_NAME"; then
+ AC_DEFINE_UNQUOTED(GUPCR_PGM_INFO_SECTION_NAME,
+ [$GUPCR_PGM_INFO_SECTION_NAME],
+ [Name of section used to hold information describing how
+ a UPC source file was compiled.])
+fi
+if test -n "$GUPCR_SHARED_SECTION_NAME"; then
+ AC_DEFINE_UNQUOTED(GUPCR_SHARED_SECTION_NAME,
+ [$GUPCR_SHARED_SECTION_NAME],
+ [Name of section used to assign addresses to UPC shared data items.])
+fi
+
+dnl Select target specific runtime implementation.
+
+AC_MSG_CHECKING([for UPC runtime model])
+AC_ARG_WITH(upc-runtime,
+[AS_HELP_STRING([--with-upc-runtime=MODEL],
+ [specify the runtime implementation model for UPC,
+ where MODEL may be: 'SMP' (Symmetric Multiprocessing)
+ or 'Portals4'. [default='SMP']])],
+[
+ case "$withval" in
+changequote(,)dnl
+ [Ss][Mm][Pp])
+ upc_runtime_model=smp
+ ;;
+ [Pp][Oo][Rr][Tt][Aa][Ll][Ss]4)
+ upc_runtime_model=portals4
+ ;;
+changequote([,])dnl
+ *)
+ AC_MSG_ERROR([$withval is an invalid runtime model for
+ --with-upc-runtime])
+ ;;
+ esac
+],
+[
+ upc_runtime_model=smp
+])
+AC_MSG_RESULT([$upc_runtime_model])
+
+AC_MSG_CHECKING([for UPC runtime checking support])
+AC_ARG_ENABLE(upc-runtime-checks,
+[AS_HELP_STRING([--enable-upc-runtime-checks],
+ [enable internal UPC runtime checks that validate
+ arguments, and check for inconsistent runtime state.
+ [default=no]])],
+[
+ case $enableval in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-runtime-checks accepts only yes or no.])
+ esac
+],
+[
+ enable_upc_runtime_checks=no
+])
+AC_MSG_RESULT($enable_upc_runtime_checks)
+if test "$enable_upc_runtime_checks" = "yes"; then
+ AC_DEFINE(GUPCR_HAVE_CHECKS, 1,
+ [Define to 1 if UPC runtime checks are supported.])
+fi
+
+AC_MSG_CHECKING([for UPC runtime statistics support])
+AC_ARG_ENABLE(upc-runtime-stats,
+[AS_HELP_STRING([--enable-upc-runtime-stats],
+ [enable internal UPC runtime statistics collection support;
+ these statistics count the number of various significant
+ internal operations, and dump those counts into a
+ per-process statistics file.
+ [default=no]])],
+[
+ case $enableval in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-runtime-stats accepts only yes or no.])
+ esac
+],
+[
+ enable_upc_runtime_stats=no
+])
+AC_MSG_RESULT($enable_upc_runtime_stats)
+if test "$enable_upc_runtime_stats" = "yes"; then
+ AC_DEFINE(GUPCR_HAVE_STATS, 1,
+ [Define to 1 if UPC runtime statistics collection is supported.])
+fi
+
+AC_MSG_CHECKING([for UPC runtime trace support])
+AC_ARG_ENABLE(upc-runtime-trace,
+[AS_HELP_STRING([--enable-upc-runtime-trace],
+ [enable internal UPC runtime trace collection support;
+ a runtime trace is a time stamped log that records
+ various significant internal events; this trace
+ is written to a per-process log file.
+ [default=no]])],
+[
+ case $enableval in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-runtime-trace accepts only yes or no.])
+ esac
+],
+[
+ enable_upc_runtime_trace=no
+])
+AC_MSG_RESULT($enable_upc_runtime_trace)
+if test "$enable_upc_runtime_trace" = "yes"; then
+ AC_DEFINE(GUPCR_HAVE_TRACE, 1,
+ [Define to 1 if UPC runtime tracing is supported.])
+fi
+
+AC_MSG_CHECKING([for UPC runtime debug configuration])
+AC_ARG_ENABLE(upc-runtime-debug,
+[AS_HELP_STRING([--enable-upc-runtime-debug],
+ [enable UPC runtime debugging mode,
+ where more expensive internal checks are implemented,
+ and conservative algorithms are used that
+ reduce the degree of parallelism, and that
+ exercise less complex/sophisticated operations
+ provided by the operating system and/or the
+ network communication packages called by the UPC runtime.
+ In addition, conservative compilation options will
+ be used to build the runtime, and debugging symbols
+ will be generated.
+ [default=no]])],
+[
+ case $enableval in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-runtime-debug accepts only yes or no.])
+ esac
+],
+[
+ enable_upc_runtime_debug=no
+])
+AC_MSG_RESULT($enable_upc_runtime_debug)
+if test "$enable_upc_runtime_debug" = "yes"; then
+ AC_DEFINE(GUPCR_HAVE_DEBUG, 1,
+ [Define to 1 if UPC runtime debugging mode is enabled.])
+fi
+AC_SUBST(enable_upc_runtime_debug)
+
+
+AC_MSG_CHECKING([for UPC link script support])
+if test -n "$GUPCR_LINK_SCRIPT" \
+ && test "$GUPCR_LINK_SCRIPT" -eq 1; then
+ upc_link_script=yes
+else
+ upc_link_script=no
+fi
+if test x"$upc_link_script" = xyes; then
+ gen_ld_script=${srcdir}/gen-upc-ld-script.pl
+ if ! ${LD} --verbose | ${PERL} $gen_ld_script 1>/dev/null ; then
+ # if gen-upc-ld-script did not accept the output of the linker
+ # then disable UPC link script support.
+ AC_MSG_ERROR([selected linker does not support linker scripts])
+ fi
+fi
+AC_MSG_RESULT($upc_link_script)
+if test x"$upc_link_script" = xyes; then
+ AC_DEFINE(use_upc_link_script, 1,
+ [Define to 1 if UPC link script is supported.])
+fi
+
+AC_MSG_CHECKING([for UPC runtime tree fanout])
+AC_ARG_WITH(upc-runtime-tree-fanout,
+[AS_HELP_STRING([--with-upc-runtime-tree-fanout=WIDTH],
+ [specify the maximum number of children in each
+ sub-tree used to implement UPC collectives operations
+ (e. g. upc_barrier)
+ [default=4]])],
+[
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+ AC_MSG_ERROR([$withval is an invalid option to
+ --with-upc-runtime-tree-fanout])
+ fi
+ upc_runtime_tree_fanout="$withval"
+],
+[
+ upc_runtime_tree_fanout=4
+])
+AC_MSG_RESULT([$upc_runtime_tree_fanout])
+AC_DEFINE_UNQUOTED(GUPCR_TREE_FANOUT, [$upc_runtime_tree_fanout],
+ [Maximum number of children at each level of a collective operation tree.])
+
+AC_MSG_CHECKING([for UPC backtrace support])
+AC_ARG_ENABLE(upc-backtrace,
+[AS_HELP_STRING([--enable-upc-backtrace],
+ [enable UPC backtrace;
+ enable stack frame backtrace report
+ when UPC run-time fatal errors occur
+ or by user request (via signal)])],
+[
+ case $enableval in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-backtrace accepts only yes or no])
+ esac
+],
+[
+ enable_upc_backtrace=yes
+])
+# Check for execinfo library (needed on BSD systems for UPC backtracing)
+case "${target}" in
+ *-*-freebsd* | *-*-openbsd* | *-*-netbsd* )
+ AC_CHECK_LIB(execinfo,backtrace,[execinfo_lib="yes"])
+ if test "x$execinfo_lib" = xyes; then
+ enable_execinfo_lib=yes
+ else
+ enable_upc_backtrace=no
+ fi
+ ;;
+ *) ;;
+esac
+if test "$enable_upc_backtrace" = yes; then
+ AC_DEFINE(HAVE_UPC_BACKTRACE, 1,
+ [Define to 1 if UPC backtrace is enabled.])
+fi
+AC_MSG_RESULT($enable_upc_backtrace)
+
+# Check for user specified GDB
+AC_ARG_WITH(upc-backtrace-gdb,
+ [AS_HELP_STRING([--with-upc-backtrace-gdb=GDB],
+ [specify which GDB to use for UPC backtrace support
+ [default='gdb']])],
+[
+ upc_backtrace_gdb=$withval
+],
+[
+ upc_backtrace_gdb=gdb
+])
+AC_PATH_PROGS(PATH_TO_GDB, $GDB $upc_backtrace_gdb, , /usr/bin:${PATH})
+AC_MSG_CHECKING([for UPC backtrace GDB to use])
+if test -n "$PATH_TO_GDB"; then
+ AC_DEFINE_UNQUOTED(GUPCR_BACKTRACE_GDB, "$PATH_TO_GDB",
+ [Define path to preferred GDB for backtrace])
+ AC_MSG_RESULT([$PATH_TO_GDB])
+ upc_backtrace_gdb_available=yes
+else
+ upc_backtrace_gdb_available=no
+ AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING([for UPC backtrace GDB support])
+AC_ARG_ENABLE(upc-backtrace-gdb,
+[AS_HELP_STRING([--enable-upc-backtrace-gdb],
+ [enable the use of GDB for UPC stack backtrace
+ [default='yes']])],
+[
+ case "$enableval" in
+ yes | no)
+ if test "$enableval" = yes &&
+ test "$upc_backtrace_gdb_available" = no; then
+ AC_MSG_ERROR(
+ [Cannot find gdb. Set the correct gdb path with
+ --with-upc-backtrace-gdb option or disable gdb backtrace with
+ --disable-upc-backtrace-gdb option.])
+ fi
+ ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-backtrace-gdb accepts only yes or no])
+ esac
+],
+[
+ enable_upc_backtrace_gdb=$upc_backtrace_gdb_available
+])
+AC_MSG_RESULT([$enable_upc_backtrace_gdb])
+if test "$enable_upc_backtrace_gdb" = yes; then
+ AC_DEFINE(HAVE_UPC_BACKTRACE_GDB, 1,
+ [Define to 1 if UPC backtrace with GDB is enabled.])
+fi
+
+AC_MSG_CHECKING([for UPC backtrace signal support])
+AC_ARG_ENABLE(upc-backtrace-signal,
+[AS_HELP_STRING([--enable-upc-backtrace-signal],
+ [enable signal support for UPC stack backtrace
+ [default='yes']])],
+[
+ case "$enableval" in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-backtrace-signal accepts only yes or no])
+ esac
+ ],
+[
+ enable_upc_backtrace_signal=yes
+])
+AC_MSG_RESULT([$enable_upc_backtrace_signal])
+if test "$enable_upc_backtrace_signal" = yes; then
+ AC_DEFINE(HAVE_UPC_BACKTRACE_SIGNAL, 1,
+ [Define to 1 if UPC backtrace signal is enabled.])
+
+ # Check for user specified signal name/number
+ AC_MSG_CHECKING([for UPC backtrace signal name/number])
+ AC_ARG_WITH(upc-backtrace-signal,
+ [AS_HELP_STRING([--with-upc-backtrace-signal=SIGNAL],
+ [specify the signal to be used for UPC stack backtrace
+ [default='SIGUSR1']])],
+ [
+ upc_backtrace_signal=$withval
+ ],
+ [
+ upc_backtrace_signal=SIGUSR1
+ ])
+ AC_DEFINE_UNQUOTED(GUPCR_BACKTRACE_SIGNAL, $upc_backtrace_signal,
+ [Define to preferred signal for UPC backtrace.])
+ AC_MSG_RESULT([$upc_backtrace_signal])
+fi
+
+if test "$enable_upc_backtrace" = yes; then
+ # Check if backtrace can use addr2line
+ if test x"$ADDR2LINE" != x""; then
+ AC_DEFINE(HAVE_UPC_BACKTRACE_ADDR2LINE, 1,
+ [Define to 1 if UPC backtrace with ADDR2LINE is enabled.])
+ AC_DEFINE_UNQUOTED(GUPCR_BACKTRACE_ADDR2LINE, "$ADDR2LINE",
+ [Define path to preferred addr2line for backtrace])
+ fi
+fi
+
+if test "$upc_runtime_model" = "smp"; then
+
+ targ_runtime_pthreads=
+ LIBGUPC_GCC_TLS_SUPPORTED
+ if test "$upc_cv_gcc_tls_supported"x = "yes"x ; then
+ targ_runtime_pthreads=yes
+ fi
+ AC_MSG_CHECKING(for Linux scheduling affinity)
+ AC_TRY_RUN(
+ changequote(<<,>>)dnl
+ <<#define _GNU_SOURCE
+ #include <sched.h>
+ cpu_set_t mask;
+ main ()
+ {
+ unsigned int len = sizeof(mask);
+ if (sched_getaffinity(0, len, &mask) < 0) {
+ return 1;
+ }
+ return 0;
+ }
+ >>,
+ changequote([, ])dnl
+ [upc_affinity=yes],
+ [upc_affinity=no],
+ [upc_affinity=no]
+ )
+ if test "x$enable_upc_affinity" = "xyes" &&
+ test "x$upc_affinity" = "xno"; then
+ AC_MSG_ERROR([scheduling affinity enabled but not supported
+ - use --disable-upc-affinity])
+ fi
+ if test "x$enable_upc_affinity" = "xno"; then
+ upc_affinity=no;
+ fi
+ AC_MSG_RESULT([$upc_affinity])
+ dnl Check if NUMA available
+ AC_MSG_CHECKING(if NUMA available)
+ save_LIBS="$LIBS"
+ LIBS="-lnuma"
+ AC_TRY_RUN(
+ changequote(<<,>>)dnl
+ <<#include <numa.h>
+ int
+ main ()
+ {
+ if (numa_available() < 0) return 1;
+ else return 0;
+ }
+ >>,
+ changequote([, ])dnl
+ [upc_numa=yes],
+ [upc_numa=no],
+ [upc_numa=no],
+ )
+ LIBS="$save_LIBS"
+ if test "x$enable_upc_numa" = "xyes" &&
+ test "x$upc_numa" = "xno"; then
+ AC_MSG_ERROR([NUMA enabled but not supported - use --disable-upc-numa])
+ fi
+ if test "x$enable_upc_numa" = "xno" \
+ -o "x$enable_upc_affinity" = "xno"; then
+ upc_numa=no;
+ fi
+ AC_MSG_RESULT([$upc_numa])
+ AC_MSG_CHECKING([for UPC GUM debugging support])
+ AC_ARG_ENABLE(upc-gum-debug,
+ [AS_HELP_STRING([--enable-upc-gum-debug],
+ [enable UPC's source level debugging with GDB and GUM
+ support (requires UPC aware GDB)])],
+ [
+ case $enableval in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-gum-debug accepts only yes or no])
+ esac
+ upc_gum_debug=$enableval
+ ],
+ [
+ upc_gum_debug=no
+ ])
+ AC_MSG_RESULT([$upc_gum_debug])
+ if test "x${upc_gum_debug}" = "xyes"; then
+ AC_DEFINE_UNQUOTED(GUPCR_HAVE_GUM_DEBUG,[1],
+ [Define if UPC GUM debug server is supported.])
+ fi
+ # Use the generic (reference implementation)
+ use_generic_collectives="yes"
+
+ DX_DOXYGEN_FEATURE(OFF)
+ DX_INIT_DOXYGEN(${PACKAGE}, doxygen.cfg, doc)
+
+ AC_MSG_CHECKING([for UPC runtime maximum number of locks held per thread])
+ AC_ARG_WITH(upc-runtime-max-locks,
+ [AS_HELP_STRING([--with-upc-runtime-max-locks=MAX_LOCKS],
+ [specify the maximum number of locks that can be held by
+ a single UPC thread [default=1024]])],
+ [
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+ AC_MSG_ERROR([$withval is an invalid option to
+ --with-upc-runtime-max-locks])
+ fi
+ upc_runtime_max_locks="$withval"
+ ],
+ [
+ upc_runtime_max_locks=1024
+ ])
+ AC_MSG_RESULT([$upc_runtime_max_locks])
+ AC_DEFINE_UNQUOTED(GUPCR_MAX_LOCKS,[$upc_runtime_max_locks],
+ [Maximum number of locks held per thread])
+
+fi #### End: SMP runtime configuration
+
+if test "$upc_runtime_model" = "portals4"; then
+
+ #### Portals4 runtime library configuration ####
+
+ # Use the generic (reference implementation)
+ use_generic_collectives="no"
+
+ # Check for Portals4 libs
+ portals4libs="-lportals"
+ portals4inc=
+ have_portals4=no
+ AC_ARG_WITH(portals4,
+ [AS_HELP_STRING([--with-portals4=PATH],
+ [specify prefix directory for installed portals4 package.
+ Equivalent to --with-portals4-include=PATH/include
+ plus --with-portals4-lib=PATH/lib])])
+ AC_ARG_WITH(portals4-include,
+ [AS_HELP_STRING([--with-portals4-include=PATH],
+ [specify directory for installed portals4 include files])])
+ AC_ARG_WITH(portals4-lib,
+ [AS_HELP_STRING([--with-portals4-lib=PATH],
+ [specify directory for the installed portals4 library])])
+
+ if test "x$with_portals4" != x; then
+ portals4libs="-L$with_portals4/lib $portals4libs"
+ portals4inc="-I$with_portals4/include $portals4inc"
+ fi
+ if test "x$with_portals4_include" != x; then
+ portals4inc="-I$with_portals4_include $portals4inc"
+ fi
+ if test "x$with_portals4_lib" != x; then
+ portals4libs="-L$with_portals4_lib $portals4libs"
+ fi
+ if test "x$with_portals4$with_portals4_include$with_portals4_lib" = x \
+ && test -d ${srcdir}/portals4; then
+ portals4libs='-L$$r/$(HOST_SUBDIR)/portals4/ '"$lt_cv_objdir $portals4libs"
+ portals4inc='-I$$r/$(HOST_SUBDIR)/portals4 -I$$s/portals4 '"$portals4inc"
+ # Do not test the portals4 version. Assume that it is sufficient, since
+ # it is in the source tree, and the library has not been built yet
+ # but it would be included on the link line in the version check below
+ # hence making the test fail.
+ have_portals4=yes
+ fi
+ AC_SUBST(portals4libs)
+ AC_SUBST(portals4inc)
+
+ AC_DEFINE(GUPCR_PORTALS_RUNTIME, 1,
+ [Define to 1 if UPC runtime is based on Portals4.])
+
+ AC_MSG_CHECKING([for UPC runtime Portals4 PTE base index])
+ AC_ARG_WITH(upc-runtime-pte-base,
+ [AS_HELP_STRING([--with-upc-runtime-pte-base=BASE],
+ [specify the base index of the first Portals4 PTE used
+ by the UPC runtime [default=16]])],
+ [
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+ AC_MSG_ERROR([$withval is an invalid option to --with-upc-runtime-pte-base])
+ fi
+ upc_runtime_pte_base="$withval"
+ ],
+ [
+ upc_runtime_pte_base=16
+ ])
+ AC_MSG_RESULT([$upc_runtime_pte_base])
+ AC_DEFINE_UNQUOTED(GUPCR_PTE_BASE,[$upc_runtime_pte_base],
+ [Portals4 PTE base index.])
+
+ AC_MSG_CHECKING([for UPC runtime maximum number of locks held per thread])
+ AC_ARG_WITH(upc-runtime-max-locks,
+ [AS_HELP_STRING([--with-upc-runtime-max-locks=MAX_LOCKS],
+ [specify the maximum number of locks that can be held by
+ a single UPC thread [default=1024]])],
+ [
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+ AC_MSG_ERROR([$withval is an invalid option to
+ --with-upc-runtime-max-locks])
+ fi
+ upc_runtime_max_locks="$withval"
+ ],
+ [
+ upc_runtime_max_locks=1024
+ ])
+ AC_MSG_RESULT([$upc_runtime_max_locks])
+ AC_DEFINE_UNQUOTED(GUPCR_MAX_LOCKS,[$upc_runtime_max_locks],
+ [Maximum number of locks held per thread])
+
+ AC_MSG_CHECKING([for UPC runtime bounce buffer size])
+ AC_ARG_WITH(upc-runtime-bounce-buffer-size,
+ [AS_HELP_STRING([--with-upc-runtime-bounce-buffer-size=SIZE],
+ [specify the size (in bytes) of the bounce buffer
+ that is used by the UPC runtime to buffer
+ network data [default=256K]])],
+ [
+ # $withval must be a decimal integer
+ if ! echo "$withval" | egrep -i '^[[0-9]]+[[kmg]]?$' >/dev/null 2>&1; then
+ AC_MSG_ERROR([$withval is an invalid option to
+ --with-upc-runtime-bounce-buffer-size])
+ fi
+ bb_size="$withval"
+ ],
+ [
+ bb_size="256K"
+ ])
+ bb_size_expr=`echo "$bb_size" | \
+ sed -e 's/[[gG]]$/*1024M/;s/[[mM]]$/*1024K/;s/[[kK]]$/*1024/;s/\\*/ \\\\* /g'`
+ upc_runtime_bounce_buffer_size=`eval expr $bb_size_expr`
+ AC_MSG_RESULT([$upc_runtime_bounce_buffer_size])
+ AC_DEFINE_UNQUOTED(GUPCR_BOUNCE_BUFFER_SIZE,[$upc_runtime_bounce_buffer_size],
+ [Size of get/put bounce buffer])
+
+ AC_MSG_CHECKING([for UPC maximum number of outstanding remote puts])
+ AC_ARG_WITH(upc-max-outstanding-puts,
+ [AS_HELP_STRING([--with-upc-max-outstanding-puts=SIZE],
+ [specify the maximum number of outstanding
+ remote put requests. [default=256]])],
+ [
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[[0-9]]*$' >/dev/null 2>&1; then
+ AC_MSG_ERROR([$withval is an invalid option to
+ --with-upc-max-outstanding-puts])
+ fi
+ upc_max_puts_count="$withval"
+ ],
+ [
+ upc_max_puts_count="256"
+ ])
+ AC_MSG_RESULT([$upc_max_puts_count])
+ AC_DEFINE_UNQUOTED(GUPCR_MAX_OUTSTANDING_PUTS,[$upc_max_puts_count],
+ [Maximum number of outstanding remote puts])
+
+ AC_MSG_CHECKING([for UPC runtime collectives tree fanout])
+ AC_ARG_WITH(upc-runtime-tree-fanout,
+ [AS_HELP_STRING([--with-upc-runtime-tree-fanout=WIDTH],
+ [specify the maximum number of children in each
+ sub-tree used to implement UPC collective operations
+ (e. g., upc_barrier and upc_global_alloc).
+ [default=4]])],
+ [
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+ AC_MSG_ERROR([$withval is an invalid option to
+ --with-upc-runtime-tree-fanout])
+ fi
+ upc_runtime_tree_fanout="$withval"
+ ],
+ [
+ upc_runtime_tree_fanout=4
+ ])
+ AC_MSG_RESULT([$upc_runtime_tree_fanout])
+ AC_DEFINE_UNQUOTED(GUPCR_TREE_FANOUT, [$upc_runtime_tree_fanout],
+ [Maximum number of children at each level of a collective operation tree.])
+
+ AC_MSG_CHECKING([for UPC runtime Portals4 triggered operation support])
+ AC_ARG_ENABLE(upc-runtime-triggered-ops,
+ [AS_HELP_STRING([--enable-upc-runtime-triggered-ops],
+ [enable UPC runtime support for Portals4 triggered
+ operations. [default=yes]])],
+ [
+ case $enableval in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-runtime-triggered-ops accepts only yes or no.])
+ esac
+ ],
+ [
+ enable_upc_runtime_triggered_ops=yes
+ ])
+ AC_MSG_RESULT($enable_upc_runtime_triggered_ops)
+ if test "$enable_upc_runtime_triggered_ops" = "yes"; then
+ AC_DEFINE(GUPCR_USE_PORTALS4_TRIGGERED_OPS, 1,
+ [Define to 1 if UPC runtime will use Portals4 triggered operations.])
+ fi
+
+# Portals4 node local memory optimization
+
+ AC_MSG_CHECKING([for UPC runtime node local memory access])
+ AC_ARG_ENABLE(upc-node-local-mem,
+ [AS_HELP_STRING([--enable-upc-node-local-mem],
+ [enable UPC runtime support for accessing shared
+ memory of the node local threads. [default=yes]])],
+ [
+ case $enableval in
+ yes | no) ;;
+ *)
+ AC_MSG_ERROR([--enable-upc-node-local-mem accepts only yes or no.])
+ esac
+ ],
+ [
+ enable_upc_node_local_mem=yes
+ ])
+ AC_MSG_RESULT($enable_upc_node_local_mem)
+ if test "$enable_upc_node_local_mem" = "yes"; then
+ AC_DEFINE(GUPCR_NODE_LOCAL_MEM, 1,
+ [Define to 1 if UPC runtime will use node local memory accesses.])
+ fi
+
+ if test "$enable_upc_node_local_mem" = "yes"; then
+ # START - check for shared memory type
+ # Check for Posix based shm
+ AC_MSG_CHECKING([for UPC node local memory type])
+ AC_ARG_WITH(upc-node-local-mem,
+ [AS_HELP_STRING([--with-upc-node-local-mem=SHMEM],
+ [specify type of shared memory used for node local
+ memory accesses (posix or mmap).
+ [default=posix]])],
+ [
+ case $withval in
+ posix | mmap)
+ upc_node_local=$withval
+ ;;
+ *)
+ AC_MSG_ERROR([--with-upc-node-local-mem accepts only posix or mmap.])
+ esac
+ ],
+ [
+ upc_node_local=posix
+ ])
+ AC_MSG_RESULT($upc_node_local);
+
+ # Check if POSIX shm is available
+ if test "$upc_node_local" = "posix"; then
+ # Check if it is part of librt
+ have_shm_open=no
+ AC_CHECK_LIB(rt, shm_open,
+ [LIBS="-lrt $LIBS"
+ have_shm_open=yes
+ AC_DEFINE(HAVE_SHM_OPEN, 1,
+ [Define to 1 if you have the 'shm_open' function.])])
+ if test "$have_shm_open" = "no"; then
+ # Must probe for Posix shmem
+ AC_MSG_CHECKING([for the shm_open])
+ AC_TRY_LINK([
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/mman.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
+ int size = 4096;
+ int fd;
+ void * addr;],[
+
+ fd = shm_open("shm-config-test", O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
+ (void)shm_unlink("shm-config-test");
+ if (fd < 0) return 1;
+ if (ftruncate(fd, size) < 0) return 1;
+ addr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+ (void)close(fd);
+ if (!addr || (addr == MAP_FAILED)) return 1;
+ (void)munmap(addr, size);
+ return 0;
+ ],[AC_MSG_RESULT(yes); have_shm_open=yes ],
+ [AC_MSG_RESULT(no); have_shm_open=no ])
+ fi
+
+ if test "$have_shm_open" = "yes"; then
+ AC_DEFINE(GUPCR_NODE_LOCAL_MEM_POSIX, 1,
+ [Define to 1 if UPC node local access uses Posix shared memory.])
+ else
+ AC_MSG_ERROR([Posix shared memory is not available])
+ fi
+ else
+ # mmap is always available
+ AC_DEFINE(GUPCR_NODE_LOCAL_MEM_MMAP, 1,
+ [Define to 1 if UPC node local access uses mmap-ed file.])
+ fi
+ # END - check for shared memory type
+ fi
+
+ # Check for portals job launcher
+ AC_CHECK_HEADER([slurm/slurm.h],[have_slurm=yes],[have_slurm=no])
+ AC_MSG_CHECKING([for UPC runtime Portals4 job launcher])
+ AC_ARG_WITH(upc-job-launcher,
+ [AS_HELP_STRING([--with-upc-job-launcher],
+ [Select UPC Portals4 job launcher.
+ [default=slurm]])],
+ [
+ case $withval in
+ slurm | yod)
+ upc_job_launcher=$withval
+ ;;
+ *)
+ AC_MSG_ERROR([--with-upc-job-launcher accepts only slurm or yod.])
+ esac
+ ],
+ [
+ if test "$have_slurm" = "yes"; then
+ upc_job_launcher=slurm
+ else
+ upc_job_launcher=yod
+ fi
+ ])
+ AC_MSG_RESULT($upc_job_launcher)
+
+ if test "$upc_job_launcher" = "slurm"; then
+ if test "$have_slurm" = "yes"; then
+ AC_DEFINE(GUPCR_JOB_LAUNCHER_SLURM, 1,
+ [Use SLURM for UPC Portals4 job launcher])
+ portals4libs="$portals4libs -lpmi"
+ else
+ AC_MSG_ERROR([--with-upc-job-launcher specified slurm,
+ but slurm is not available.])
+ fi
+ else
+ AC_DEFINE(GUPCR_JOB_LAUNCHER_YOD, 1,
+ [Use YOD for UPC Portals4 job launcher])
+ portals4libs="$portals4libs -lportals_runtime"
+ fi
+
+ # Check for target memory page size
+ AC_MSG_CHECKING([for memory page size])
+ AC_ARG_WITH(upc-memory-page-size,
+ [AS_HELP_STRING([--with-upc-memory-page-size],
+ [Select target memory page size.
+ [default=4096]])],
+ [
+ # $withval must be a decimal integer
+ if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+ AC_MSG_ERROR([$withval is an invalid option to --with-upc-memory-page-size])
+ fi
+ memory_page_size="$withval"
+ ],
+ [
+ memory_page_size="4096"
+ ])
+ AC_MSG_RESULT($memory_page_size)
+ AC_DEFINE_UNQUOTED(GUPCR_MEMORY_PAGE_SIZE, [$memory_page_size],
+ [Target system memory page size.])
+
+ AC_DEFINE(GUPCR_GLOBAL_EXIT_TIMEOUT, [2],
+ [upc_global_exit() timeout in seconds.])
+
+ DX_DOXYGEN_FEATURE(ON)
+ DX_HTML_FEATURE(ON)
+ DX_PDF_FEATURE(ON)
+ DX_DOT_FEATURE(ON)
+ DX_PS_FEATURE(OFF)
+ DX_INIT_DOXYGEN(${PACKAGE}, doxygen.cfg, doc)
+ AC_CONFIG_FILES([header.tex doxygen.sty])
+ AC_CONFIG_FILES([doxygen.cfg:portals4/doxygen.cfg.in])
+
+fi #### End: Portals4 runtime configuration
+
+# Get target configury.
+. ${srcdir}/configure.tgt
+
+# configure.tgt sets these substitution variables.
+# It also sets 'upc_crtstuff=yes' if upc-crtstuff needs
+# to be compiled.
+AC_SUBST(config_path)
+AC_SUBST(bfdinc)
+AC_SUBST(XCFLAGS)
+AC_SUBST(XLDFLAGS)
+AC_SUBST(link_upc_spec)
+AC_SUBST(upc_crtstuff_cflags)
+AC_SUBST(upc_crtbegin_spec)
+AC_SUBST(upc_crtend_spec)
+AC_SUBST(upc_crtstuff_objs)
+
+dnl Define ARG_UNUSED macro
+AH_BOTTOM([
+#ifndef ARG_UNUSED
+# define ARG_UNUSED(NAME) NAME __attribute__ ((__unused__))
+#endif
+])
+
+dnl Build the runtime, based upon the --with-upc-runtime setting.
+AM_CONDITIONAL(LIBGUPC_SMP_RUNTIME, [test "$upc_runtime_model" = "smp"])
+AM_CONDITIONAL(LIBGUPC_PORTALS4_RUNTIME, [test "$upc_runtime_model" = "portals4"])
+AM_CONDITIONAL(LIBGUPC_RUNTIME_DEBUG, [test "$enable_upc_runtime_debug" = "yes"])
+
+AM_CONDITIONAL(LIBGUPC_CRTSTUFF, [test "$upc_crtstuff" = "yes"])
+AM_CONDITIONAL(LIBGUPC_LINK_SCRIPT, [test "$use_upc_link_script" = "yes"])
+AM_CONDITIONAL(LIBGUPC_GENERIC_COLLECTIVES,
+ [test "$use_generic_collectives" = "yes"])
+AM_CONDITIONAL(LIBGUPC_BACKTRACE, [test "$enable_upc_backtrace" = "yes"])
+
+dnl 'smp' runtime specific settings
+AM_CONDITIONAL(LIBGUPC_PTHREADS, [test "$targ_runtime_pthreads" = "yes"])
+AM_CONDITIONAL(LIBGUPC_AFFINITY, [test "$upc_affinity" = "yes"])
+AM_CONDITIONAL(LIBGUPC_NUMA, [test "$upc_numa" = "yes"])
+AM_CONDITIONAL(LIBGUPC_GUM, [test "$upc_gum_debug" = "yes"])
+AM_CONDITIONAL(LIBGUPC_NODE_LOCAL_MEM_POSIX, [test "$upc_node_local" = "posix"])
+AM_CONDITIONAL(LIBGUPC_NODE_LOCAL_MEM_MMAP, [test "$upc_node_local" = "mmap"])
+
+AH_TOP(
+[/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+ 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 2, 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 COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+#ifndef __CONFIG_H__
+#define __CONFIG_H__ 1
+])
+AH_VERBATIM(GUPCR_AAA_BEGIN_CFG,[//begin gupcr_config_h])
+AH_VERBATIM(GUPCR_ZZZ_END_CFG,[//end gupcr_config_h])
+AH_BOTTOM(
+[
+#endif /* __CONFIG_H__ */
+])
+
+AC_CONFIG_FILES([Makefile testsuite/Makefile])
+AC_CONFIG_FILES([upc-crtbegin.spec libgupc.spec upc-crtend.spec])
+AC_OUTPUT
diff --git a/libgupc/configure.tgt b/libgupc/configure.tgt
new file mode 100644
index 00000000000..6643513e850
--- /dev/null
+++ b/libgupc/configure.tgt
@@ -0,0 +1,125 @@
+# This is the target specific configuration file. This is invoked by the
+# autoconf generated configure script. Putting it in a separate shell file
+# lets us skip running autoconf when modifying target specific information.
+#
+# This file is adapted from the libgomp implementation.
+
+# This file switches on the shell variable ${target}, and sets the
+# following shell variables:
+# config_path An ordered list of directories to search for
+# sources and headers. This is relative to the
+# config subdirectory of the source tree.
+# XCFLAGS Add extra compile flags to use.
+# XLDFLAGS Add extra link flags to use.
+
+
+# Set defaults
+config_path="posix default"
+
+case "${target}" in
+
+ *-*-hpux*)
+ case "${target}" in
+ *-*-hpux11*)
+ # HPUX v11.x requires -lrt to resolve sem_init in libgupc.la
+ XLDFLAGS="${XLDFLAGS} -lrt"
+ ;;
+ esac
+ case "${target}" in
+ hppa[12]*-*-hpux*)
+ # PA 32 HP-UX needs -frandom-seed for bootstrap compare.
+ XCFLAGS="${XCFLAGS} -frandom-seed=fixed-seed"
+ ;;
+ esac
+ ;;
+
+ *-*-mingw32*)
+ config_path="mingw32 ${config_path}"
+ ;;
+
+ *-*-darwin*)
+ config_path="darwin bsd ${config_path}"
+ ;;
+
+ mips-sgi-irix6*)
+ # Need to link with -lpthread so libgupc.so is self-contained.
+ XLDFLAGS="${XLDFLAGS} -lpthread"
+ ;;
+
+ *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
+ ;;
+
+ *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
+ ;;
+
+ *-*-solaris2* | *-*-hpux11*)
+ ;;
+
+ *-*-aix*)
+ ;;
+
+ *)
+ UNSUPPORTED=1
+ ;;
+
+esac
+
+#
+# The logic above sets configuration directories that may
+# be currently unsupported. Remove non-existent directories
+# from the 'config_path' variable. It is assumed that higher
+# level logic will check for valid libgupc targets.
+#
+_config_path=
+for cfg_dir in ${config_path}; do
+ if test -d ${srcdir}/config/$cfg_dir; then
+ _config_path="${_config_path} $cfg_dir"
+ fi
+done
+config_path="${_config_path}"
+
+upc_crtstuff=yes
+upc_crtbegin_spec=\
+"%{static:upc-crtbeginT%O%s; shared|pie:upc-crtbeginS%O%s; :upc-crtbegin%O%s}"
+upc_crtend_spec=\
+"%{static:upc-crtendT%O%s; shared|pie:upc-crtendS%O%s; :upc-crtend%O%s}"
+upc_crtstuff_objs=\
+"upc-crtbeginT.o upc-crtbeginS.o upc-crtbegin.o upc-crtendT.o upc-crtendS.o upc-crtend.o"
+
+# The following empty alternatives are kept as place holders
+# that will be filled in with target-specific settings as needed.
+case "${target}" in
+ *-*-darwin*)
+ ;;
+ mips-sgi-irix6*)
+ ;;
+ *)
+ ;;
+esac
+
+# For UPC, always add the math library
+LIBS="-lm $LIBS"
+if test "${upc_numa}" = "yes"; then
+ LIBS="-lnuma $LIBS"
+fi
+if test "$upc_runtime_model" = "portals4"; then
+ LIBS="-lpthread $LIBS"
+ if test x"$portals4libs" != "x"; then
+ LIBS="$portals4libs $LIBS"
+ fi
+fi
+if test "x$enable_execinfo_lib" = "xyes"; then
+ LIBS="-lexecinfo $LIBS"
+fi
+libgupc_spec="%{!fupc-pthreads*:-lgupc;:-lgupc_pt -lpthread}"
+if test "$enable_upc_backtrace" = yes &&
+ test -n "$export_dynamic_flag_spec"; then
+ dynamic_spec=`echo "$export_dynamic_flag_spec" | sed -e 's/${wl}//'`
+ libgupc_spec="$dynamic_spec ${libgupc_spec}"
+fi
+if test "$enable_upc_link_script" = yes; then
+ libgupc_spec="-T gupc.ld%s ${libgupc_spec}"
+fi
+# Set up the set of libraries that we need to link against for libgupc.
+#
+link_upc_spec="${libgupc_spec} $LIBS"
diff --git a/libgupc/dox-filter-config-h b/libgupc/dox-filter-config-h
new file mode 100644
index 00000000000..61d7fb69b78
--- /dev/null
+++ b/libgupc/dox-filter-config-h
@@ -0,0 +1,29 @@
+#!/bin/env perl
+use strict;
+use warnings;
+use File::Slurp qw(slurp);
+
+die "usage: $0 <input_file>" unless @ARGV;
+my $file = $ARGV[0];
+die "file not found: $file\n" unless -f $file;
+die "open failed: $file\n" unless open IN, "<$file";
+
+my $input = slurp(\*IN);
+
+my ($before, $gupcr_cfg, $after) =
+ ($input =~ m{(.*//begin\ gupcr_config_h\n)(.*)
+ (//end\ gupcr_config_h.*)}xs);
+
+die "could not match the gupcr_config_h file markers\n"
+ unless defined($before)
+ && defined($gupcr_cfg)
+ && defined($after);
+
+$gupcr_cfg =~ s{^/\*\s*((?:(?!/\*).)*?)\s*?\*/\n
+ \#(?:define|undef)\s+(\w+)(.*?)$}
+ {/**\ \@brief\ ${1}\ */\n\#define\ ${2}${3}}xgms;
+
+my $result = $before . $gupcr_cfg . $after;
+print $result;
+
+exit 0;
diff --git a/libgupc/doxygen-include.am b/libgupc/doxygen-include.am
new file mode 100644
index 00000000000..c86cdbfba7c
--- /dev/null
+++ b/libgupc/doxygen-include.am
@@ -0,0 +1,123 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
+# ===========================================================================
+#
+# LICENSE
+#
+# Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+#
+## --------------------------------- ##
+## Format-independent Doxygen rules. ##
+## --------------------------------- ##
+#
+if DX_COND_doc
+## ------------------------------- ##
+## Rules specific for HTML output. ##
+## ------------------------------- ##
+if DX_COND_html
+DX_CLEAN_HTML = @DX_DOCDIR@/html
+endif DX_COND_html
+## ------------------------------ ##
+## Rules specific for CHM output. ##
+## ------------------------------ ##
+if DX_COND_chm
+DX_CLEAN_CHM = @DX_DOCDIR@/chm
+if DX_COND_chi
+DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
+endif DX_COND_chi
+endif DX_COND_chm
+## ------------------------------ ##
+## Rules specific for MAN output. ##
+## ------------------------------ ##
+if DX_COND_man
+DX_CLEAN_MAN = @DX_DOCDIR@/man
+endif DX_COND_man
+## ------------------------------ ##
+## Rules specific for RTF output. ##
+## ------------------------------ ##
+if DX_COND_rtf
+DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+endif DX_COND_rtf
+## ------------------------------ ##
+## Rules specific for XML output. ##
+## ------------------------------ ##
+if DX_COND_xml
+DX_CLEAN_XML = @DX_DOCDIR@/xml
+endif DX_COND_xml
+## ----------------------------- ##
+## Rules specific for PS output. ##
+## ----------------------------- ##
+if DX_COND_ps
+DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
+DX_PS_GOAL = doxygen-ps
+doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
+@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
+ cd @DX_DOCDIR@/latex; \
+ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+ $(DX_LATEX) refman.tex; \
+ $(MAKEINDEX_PATH) refman.idx; \
+ $(DX_LATEX) refman.tex; \
+ countdown=5; \
+ while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+ refman.log > /dev/null 2>&1 \
+ && test $$countdown -gt 0; do \
+ $(DX_LATEX) refman.tex; \
+ countdown=`expr $$countdown - 1`; \
+ done; \
+ $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
+endif DX_COND_ps
+## ------------------------------ ##
+## Rules specific for PDF output. ##
+## ------------------------------ ##
+if DX_COND_pdf
+DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
+DX_PDF_GOAL = doxygen-pdf
+doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
+@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
+ TEXINPUTS="`pwd`:.:${TEXINPUTS}"; \
+ export TEXINPUTS; \
+ cd @DX_DOCDIR@/latex; \
+ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+ $(DX_PDFLATEX) refman.tex; \
+ $(DX_MAKEINDEX) refman.idx; \
+ $(DX_PDFLATEX) refman.tex; \
+ countdown=5; \
+ while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+ refman.log > /dev/null 2>&1 \
+ && test $$countdown -gt 0; do \
+ $(DX_PDFLATEX) refman.tex; \
+ countdown=`expr $$countdown - 1`; \
+ done; \
+ mv refman.pdf ../@PACKAGE@.pdf
+endif DX_COND_pdf
+## ------------------------------------------------- ##
+## Rules specific for LaTeX (shared for PS and PDF). ##
+## ------------------------------------------------- ##
+if DX_COND_latex
+DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+endif DX_COND_latex
+.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
+doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
+ rm -rf @DX_DOCDIR@
+ $(DX_ENV) $(DX_DOXYGEN) $(DX_CONFIG)
+DX_CLEANFILES = \
+ @DX_DOCDIR@/@PACKAGE@.tag \
+ -r \
+ $(DX_CLEAN_HTML) \
+ $(DX_CLEAN_CHM) \
+ $(DX_CLEAN_CHI) \
+ $(DX_CLEAN_MAN) \
+ $(DX_CLEAN_RTF) \
+ $(DX_CLEAN_XML) \
+ $(DX_CLEAN_PS) \
+ $(DX_CLEAN_PDF) \
+ $(DX_CLEAN_LATEX)
+endif DX_COND_doc
diff --git a/libgupc/doxygen.sty.in b/libgupc/doxygen.sty.in
new file mode 100644
index 00000000000..4f15de1a7db
--- /dev/null
+++ b/libgupc/doxygen.sty.in
@@ -0,0 +1,441 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{doxygen}
+
+% Packages used by this style file
+% See: http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Standard_page_styles
+\RequirePackage{alltt}
+\RequirePackage{array}
+\RequirePackage{calc}
+\RequirePackage{color}
+\RequirePackage{fancyhdr}
+\RequirePackage{longtable}
+\RequirePackage{verbatim}
+\RequirePackage{ifthen}
+\RequirePackage[table]{xcolor}
+
+% Use helvetica font instead of times roman
+\RequirePackage{helvet}
+\RequirePackage{sectsty}
+\RequirePackage{tocloft}
+\providecommand{\rmdefault}{phv}
+\providecommand{\bfdefault}{bc}
+
+
+% Setup fancy headings
+\pagestyle{fancyplain}
+\newcommand{\clearemptydoublepage}{%
+ \newpage{\pagestyle{empty}\cleardoublepage}%
+}
+\renewcommand{\chaptermark}[1]{%
+ \markboth{#1}{}%
+}
+\renewcommand{\sectionmark}[1]{%
+ \markright{\thesection\ #1}%
+}
+
+\fancyhead[RE]{\fancyplain{}{\bfseries\leftmark}}
+\fancyhead[CE]{\fancyplain{}{}}
+\fancyhead[LE]{\fancyplain{}{\bfseries\thepage}}
+\fancyhead[RO]{\fancyplain{}{\bfseries\rightmark}}
+\fancyhead[CO]{\fancyplain{}{}}
+\fancyhead[LO]{\fancyplain{}{\bfseries\thepage}}
+\fancyfoot[RE]{\fancyplain{}{\bfseries\scriptsize @DOXYGEN_DATE@}}
+\fancyfoot[LE]{\fancyplain{}
+{\ifthenelse{\equal{@DOXYGEN_LOGO@}{}}{}
+{\includegraphics[height=20pt]{@DOXYGEN_LOGO@}}}}
+\fancyfoot[CE]{\fancyplain{}{\bfseries\scriptsize @DOXYGEN_AUTHOR@}}
+\fancyfoot[RO]{\fancyplain{}{\bfseries\scriptsize @DOXYGEN_DATE@}}
+\fancyfoot[LO]{\fancyplain{}
+{\ifthenelse{\equal{@DOXYGEN_LOGO@}{}}{}
+{\includegraphics[height=20pt]{@DOXYGEN_LOGO@}}}}
+\fancyfoot[CO]{\fancyplain{}{\bfseries\scriptsize @DOXYGEN_AUTHOR@}}
+
+\fancypagestyle{plain}{
+\fancyhead[RE]{\fancyplain{}{\bfseries\leftmark}}
+\fancyhead[CE]{\fancyplain{}{}}
+\fancyhead[LE]{\fancyplain{}{\bfseries\thepage}}
+\fancyhead[RO]{\fancyplain{}{\bfseries\rightmark}}
+\fancyhead[CO]{\fancyplain{}{}}
+\fancyhead[LO]{\fancyplain{}{\bfseries\thepage}}
+\fancyfoot[RE]{\fancyplain{}{\bfseries\scriptsize @DOXYGEN_DATE@}}
+\fancyfoot[LE]{\fancyplain{}
+{\ifthenelse{\equal{@DOXYGEN_LOGO@}{}}{}
+{\includegraphics[height=20pt]{@DOXYGEN_LOGO@}}}}
+\fancyfoot[CE]{\fancyplain{}{\bfseries\scriptsize @DOXYGEN_AUTHOR@}}
+\fancyfoot[RO]{\fancyplain{}{\bfseries\scriptsize @DOXYGEN_DATE@}}
+\fancyfoot[LO]{\fancyplain{}
+{\ifthenelse{\equal{@DOXYGEN_LOGO@}{}}{}
+{\includegraphics[height=20pt]{@DOXYGEN_LOGO@}}}}
+\fancyfoot[CO]{\fancyplain{}{\bfseries\scriptsize @DOXYGEN_AUTHOR@}}}
+
+%---------- Internal commands used in this style file ----------------
+
+% Generic environment used by all paragraph-based environments defined
+% below. Note that the command \title{...} needs to be defined inside
+% those environments!
+\newenvironment{DoxyDesc}[1]{%
+ \begin{list}{}%
+ {%
+ \settowidth{\labelwidth}{40pt}%
+ \setlength{\leftmargin}{\labelwidth}%
+ \setlength{\parsep}{0pt}%
+ \setlength{\itemsep}{-4pt}%
+ \renewcommand{\makelabel}{\entrylabel}%
+ }%
+ \item[#1]%
+}{%
+ \end{list}%
+}
+
+%---------- Commands used by doxygen LaTeX output generator ----------
+
+% Used by <pre> ... </pre>
+\newenvironment{DoxyPre}{%
+ \small%
+ \begin{alltt}%
+}{%
+ \end{alltt}%
+ \normalsize%
+}
+
+% Used by @code ... @endcode
+\newenvironment{DoxyCode}{%
+ \footnotesize%
+ \verbatim%
+}{%
+ \endverbatim%
+ \normalsize%
+}
+
+% Used by @example, @include, @includelineno and @dontinclude
+\newenvironment{DoxyCodeInclude}{%
+ \DoxyCode%
+}{%
+ \endDoxyCode%
+}
+
+% Used by @verbatim ... @endverbatim
+\newenvironment{DoxyVerb}{%
+ \footnotesize%
+ \verbatim%
+}{%
+ \endverbatim%
+ \normalsize%
+}
+
+% Used by @verbinclude
+\newenvironment{DoxyVerbInclude}{%
+ \DoxyVerb%
+}{%
+ \endDoxyVerb%
+}
+
+% Used by numbered lists (using '-#' or <ol> ... </ol>)
+\newenvironment{DoxyEnumerate}{%
+ \enumerate%
+}{%
+ \endenumerate%
+}
+
+% Used by bullet lists (using '-', @li, @arg, or <ul> ... </ul>)
+\newenvironment{DoxyItemize}{%
+ \itemize%
+}{%
+ \enditemize%
+}
+
+% Used by description lists (using <dl> ... </dl>)
+\newenvironment{DoxyDescription}{%
+ \description%
+}{%
+ \enddescription%
+}
+
+% Used by @image, @dotfile, and @dot ... @enddot
+% (only if caption is specified)
+\newenvironment{DoxyImage}{%
+ \begin{figure}[H]%
+ \begin{center}%
+}{%
+ \end{center}%
+ \end{figure}%
+}
+
+% Used by @image, @dotfile, @dot ... @enddot, and @msc ... @endmsc
+% (only if no caption is specified)
+\newenvironment{DoxyImageNoCaption}{%
+}{%
+}
+
+% Used by @attention
+\newenvironment{DoxyAttention}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @author and @authors
+\newenvironment{DoxyAuthor}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @date
+\newenvironment{DoxyDate}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @invariant
+\newenvironment{DoxyInvariant}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @note
+\newenvironment{DoxyNote}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @post
+\newenvironment{DoxyPostcond}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @pre
+\newenvironment{DoxyPrecond}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @remark
+\newenvironment{DoxyRemark}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @return
+\newenvironment{DoxyReturn}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @since
+\newenvironment{DoxySince}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @see
+\newenvironment{DoxySeeAlso}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @version
+\newenvironment{DoxyVersion}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @warning
+\newenvironment{DoxyWarning}[1]{%
+ \begin{DoxyDesc}{#1}%
+}{%
+ \end{DoxyDesc}%
+}
+
+% Used by @internal
+\newenvironment{DoxyInternal}[1]{%
+ \paragraph*{#1}%
+}{%
+}
+
+% Used by @par and @paragraph
+\newenvironment{DoxyParagraph}[1]{%
+ \begin{list}{}%
+ {%
+ \settowidth{\labelwidth}{40pt}%
+ \setlength{\leftmargin}{\labelwidth}%
+ \setlength{\parsep}{0pt}%
+ \setlength{\itemsep}{-4pt}%
+ \renewcommand{\makelabel}{\entrylabel}%
+ }%
+ \item[#1]%
+}{%
+ \end{list}%
+}
+
+% Used by parameter lists
+\newenvironment{DoxyParams}[2][]{%
+ \begin{DoxyDesc}{#2}%
+ \begin{description}%
+ \item[] \hspace{\fill} \vspace{-25pt}%
+ \definecolor{tableShade}{HTML}{F8F8F8}%
+ \rowcolors{1}{white}{tableShade}%
+ \arrayrulecolor{gray}%
+ \setlength{\tabcolsep}{0.01\textwidth}%
+ \ifthenelse{\equal{#1}{}}
+ {\begin{longtable}{|>{\raggedleft\hspace{0pt}}p{0.15\textwidth}|%
+ p{0.79\textwidth}|}}%
+ {\ifthenelse{\equal{#1}{1}}%
+ {\begin{longtable}{|>{\centering}p{0.10\textwidth}|%
+ >{\raggedleft\hspace{0pt}}p{0.15\textwidth}|%
+ p{0.68\textwidth}|}}%
+ {\begin{longtable}{|>{\centering}p{0.10\textwidth}|%
+ >{\centering\hspace{0pt}}p{0.15\textwidth}|%
+ >{\raggedleft\hspace{0pt}}p{0.15\textwidth}|%
+ p{0.50\textwidth}|}}%
+ }\hline%
+}{%
+ \end{longtable}%
+ \end{description}%
+ \end{DoxyDesc}%
+}
+
+% is used for parameters within a detailed function description
+\newenvironment{DoxyParamCaption}{%
+ \renewcommand{\item}[2][]{##1 {\em ##2}}%
+ }{%
+}
+
+% Used by return value lists
+\newenvironment{DoxyRetVals}[1]{%
+ \begin{DoxyDesc}{#1}%
+ \begin{description}%
+ \item[] \hspace{\fill} \vspace{-25pt}%
+ \definecolor{tableShade}{HTML}{F8F8F8}%
+ \rowcolors{1}{white}{tableShade}%
+ \arrayrulecolor{gray}%
+ \setlength{\tabcolsep}{0.01\textwidth}%
+ \begin{longtable}{|>{\raggedleft\hspace{0pt}}p{0.25\textwidth}|%
+ p{0.70\textwidth}|}%
+ \hline%
+}{%
+ \end{longtable}%
+ \end{description}%
+ \end{DoxyDesc}%
+}
+
+% Used by exception lists
+\newenvironment{DoxyExceptions}[1]{%
+ \begin{DoxyDesc}{#1}%
+ \begin{description}%
+ \item[] \hspace{\fill} \vspace{-25pt}%
+ \definecolor{tableShade}{HTML}{F8F8F8}%
+ \rowcolors{1}{white}{tableShade}%
+ \arrayrulecolor{gray}%
+ \setlength{\tabcolsep}{0.01\textwidth}%
+ \begin{longtable}{|>{\raggedleft\hspace{0pt}}p{0.25\textwidth}|%
+ p{0.70\textwidth}|}%
+ \hline%
+}{%
+ \end{longtable}%
+ \end{description}%
+ \end{DoxyDesc}%
+}
+
+% Used by template parameter lists
+\newenvironment{DoxyTemplParams}[1]{%
+ \begin{DoxyDesc}{#1}%
+ \begin{description}%
+ \item[] \hspace{\fill} \vspace{-25pt}%
+ \definecolor{tableShade}{HTML}{F8F8F8}%
+ \rowcolors{1}{white}{tableShade}%
+ \arrayrulecolor{gray}%
+ \setlength{\tabcolsep}{0.01\textwidth}%
+ \begin{longtable}{|>{\raggedleft\hspace{0pt}}p{0.25\textwidth}|%
+ p{0.70\textwidth}|}%
+ \hline%
+}{%
+ \end{longtable}%
+ \end{description}%
+ \end{DoxyDesc}%
+}
+
+\newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})}
+\newenvironment{DoxyCompactList}
+{\begin{list}{}{
+ \setlength{\leftmargin}{0.5cm}
+ \setlength{\itemsep}{0pt}
+ \setlength{\parsep}{0pt}
+ \setlength{\topsep}{0pt}
+ \renewcommand{\makelabel}{\hfill}}}
+{\end{list}}
+\newenvironment{DoxyCompactItemize}
+{
+ \begin{itemize}
+ \setlength{\itemsep}{-3pt}
+ \setlength{\parsep}{0pt}
+ \setlength{\topsep}{0pt}
+ \setlength{\partopsep}{0pt}
+}
+{\end{itemize}}
+\newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp}
+\newlength{\tmplength}
+\newenvironment{TabularC}[1]
+{
+\setlength{\tmplength}
+ {\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)}
+ \par\begin{tabular*}{\linewidth}
+ {*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|}
+}
+{\end{tabular*}\par}
+\newcommand{\entrylabel}[1]{
+ {\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\vspace{1.5\baselineskip}}}}
+\newenvironment{Desc}
+{\begin{list}{}
+ {
+ \settowidth{\labelwidth}{40pt}
+ \setlength{\leftmargin}{\labelwidth}
+ \setlength{\parsep}{0pt}
+ \setlength{\itemsep}{-4pt}
+ \renewcommand{\makelabel}{\entrylabel}
+ }
+}
+{\end{list}}
+\newenvironment{Indent}
+ {\begin{list}{}{\setlength{\leftmargin}{0.5cm}}
+ \item[]\ignorespaces}
+ {\unskip\end{list}}
+\setlength{\parindent}{0cm}
+\setlength{\parskip}{0.2cm}
+\addtocounter{secnumdepth}{2}
+\usepackage[T1]{fontenc}
+\makeatletter
+\renewcommand{\paragraph}{\@startsection{paragraph}{4}{0ex}%
+ {-1.0ex}%
+ {1.0ex}%
+ {\usefont{OT1}{phv}{bc}{n}\color{darkgray}}}
+\renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{0ex}%
+ {-1.0ex}%
+ {1.0ex}%
+ {\usefont{OT1}{phv}{bc}{n}\color{darkgray}}}
+\makeatother
+\allsectionsfont{\usefont{OT1}{phv}{bc}{n}\selectfont\color{darkgray}}
+\stepcounter{secnumdepth}
+\stepcounter{tocdepth}
+\definecolor{comment}{rgb}{0.5,0.0,0.0}
+\definecolor{keyword}{rgb}{0.0,0.5,0.0}
+\definecolor{keywordtype}{rgb}{0.38,0.25,0.125}
+\definecolor{keywordflow}{rgb}{0.88,0.5,0.0}
+\definecolor{preprocessor}{rgb}{0.5,0.38,0.125}
+\definecolor{stringliteral}{rgb}{0.0,0.125,0.25}
+\definecolor{charliteral}{rgb}{0.0,0.5,0.5}
+\definecolor{vhdldigit}{rgb}{1.0,0.0,1.0}
+\definecolor{vhdlkeyword}{rgb}{0.43,0.0,0.43}
+\definecolor{vhdllogic}{rgb}{1.0,0.0,0.0}
+\definecolor{vhdlchar}{rgb}{0.0,0.0,0.0}
diff --git a/libgupc/gen-inline-libgupc.pl b/libgupc/gen-inline-libgupc.pl
new file mode 100644
index 00000000000..32665d42959
--- /dev/null
+++ b/libgupc/gen-inline-libgupc.pl
@@ -0,0 +1,99 @@
+#!/usr/bin/perl -w
+use strict;
+#
+#
+# usage: gen-gupc-inline-lib template.in [input-file ...]
+#
+# Create a file from template.in that implements selectively inline'd
+# GUPC runtime routines.
+#
+# The files are read first. This processes lines with the
+# following syntax. Note, the '//' sequence must begin in column one.
+#
+# The following lines are processed in the input files.
+#
+# //begin <name> Collect the following lines up to the matching 'end'
+# and append them to an internal buffer named <name>
+# Nested Begin ... end brackets are _not_ supported.
+#
+# //end <name> End the collection of items into the buffer named <name>.
+#
+# The following lines are processed in the template file.
+#
+# //include <name> Expands into the contents of the buffer named <name>.
+#
+# //inline Expands into:
+# "__attribute__((__always_inline__)) static inline".
+# May appear inside a begin ... end bracket.
+#
+# The expanded text is written to stdout.
+#
+my $nargs = scalar @ARGV;
+die "missing first (template file) arg" if $nargs < 1;
+for (@ARGV)
+{
+ die "file not found: $_" if ! -f;
+}
+my $tfile = shift @ARGV;
+open TEMPLATE, "<$tfile" or die "can't open template file: $tfile";
+my %bufs = ();
+my $buf;
+my $input_file = '';
+# Read the input files listed in @ARGV
+while (<>)
+{
+ if ($input_file ne $ARGV)
+ {
+ !defined ($buf)
+ or die "missing '//end ${buf}': $input_file\n";
+ $input_file = $ARGV;
+ }
+ chomp;
+ if (m{^//begin\s+(\w+)\s*$})
+ {
+ die "nested buffers not supported,"
+ . " last buffer is '$buf': $input_file\n"
+ if defined ($buf);
+ $buf = $1;
+ next;
+ }
+ elsif (m{^//end\s+(\w+)\s*$})
+ {
+ my $endbuf = $1;
+ die "no matching begin for buffer '$endbuf': $input_file\n"
+ if !defined($buf);
+ die "buffer mismatch, '$buf' != '$endbuf': $input_file\n"
+ if $buf ne $endbuf;
+ $buf = undef;
+ next;
+ }
+ if (defined ($buf))
+ {
+ $bufs{$buf} .= "$_\n";
+ }
+}
+!defined ($buf)
+ or die "missing '//end ${buf}': $input_file\n";
+my $inline_attr = "__attribute__((__always_inline__))\nstatic inline";
+for $buf (keys %bufs)
+{
+ $bufs{$buf} =~ s{^//inline\s*$}{$inline_attr}mg;
+}
+while (<TEMPLATE>)
+{
+ chomp;
+ if (m{^//include\s+(\w+)\s*$})
+ {
+ $buf = $1;
+ die "unknown buffer: $buf" if !exists ($bufs{$buf});
+ print $bufs{$buf};
+ next;
+ }
+ elsif (m{^//inline\s*$})
+ {
+ print "$inline_attr\n";
+ next;
+ }
+ print "$_\n";
+}
+close TEMPLATE;
diff --git a/libgupc/gen-upc-ld-script.pl b/libgupc/gen-upc-ld-script.pl
new file mode 100644
index 00000000000..26bbd92662c
--- /dev/null
+++ b/libgupc/gen-upc-ld-script.pl
@@ -0,0 +1,65 @@
+#!/usr/bin/perl -w
+#
+# Define linkage sections required by GUPC by editing
+# the default GNU ld script.
+#
+use strict;
+my $before_ctors = <<EOD;
+ .upc_alloc_array :
+ {
+ PROVIDE (__upc_alloc_array_start = .);
+ KEEP (*(SORT(upc_alloc_array.*)))
+ KEEP (*(upc_alloc_array))
+ PROVIDE (__upc_alloc_array_end = .);
+ }
+ .upc_alloc : { KEEP(*(upc_alloc)) }
+ .upc_init_array :
+ {
+ PROVIDE (__upc_init_array_start = .);
+ KEEP (*(SORT(upc_init_array.*)))
+ KEEP (*(upc_init_array))
+ PROVIDE (__upc_init_array_end = .);
+ }
+ .upc_init : { KEEP(*(upc_init)) }
+ /* UPC Program Info - compilation-related data */
+ .upc_pgm_info :
+ {
+ PROVIDE (__upc_pgm_info_start = .);
+ KEEP (*(upc_pgm_info));
+ PROVIDE (__upc_pgm_info_end = .);
+ }
+EOD
+my $after_end_dot = <<EOD;
+ /* UPC shared section - used to layout shared data only */
+ .upc_shared 0x4000 (NOLOAD):
+ {
+ PROVIDE (__upc_shared_start = .);
+ *(upc_shared);
+ PROVIDE (__upc_shared_end = .);
+ }
+EOD
+my $ld_script = do {local $/ = undef; <>};
+for ($ld_script)
+ {
+ m{^GNU ld} or die "Not a GNU ld script?";
+ my $is_ia64 = /OUTPUT_ARCH\s*\(\s*ia64\s*\)/s;
+ if ($is_ia64)
+ {
+ # The linker on the IA64 (SuSE) can't handle the
+ # additional "nolaod" attribute. Drop it.
+ $after_end_dot =~ s/\s*\(NOLOAD\)//s;
+ }
+ s/^.*?\n=+\n//s;
+ s/\n(?:\s*\n)*=+\n.*$/\n/s;
+ s/^(.*\n)(\s*\.ctors.*?\n)/$1$before_ctors$2/s
+ or die "No match on .ctors line";
+ m{(\n\s*\.\s*\=\s*ALIGN\s*\(\s*\d+\s*/\s*8\s*\)\s*;[^\n]*\n)}s;
+ my $align = defined($1) ? "$1" : '';
+ s{\n((?:\s*\.\s*\=\s*ALIGN\s*\(\s*\d+\s*/\s*\d+\s*\)\s*;[^\n]*\n)*?
+ \s*_end\s*=\s*\.\s*;
+ \s*PROVIDE\s*\(\s*end\s*=\s*\.\s*\)\s*;[^\n]*\n
+ (?:\s*\.\s*\=\s*DATA_SEGMENT_END\s*\(\s*\.\s*\)\s*;[^\n]*\n)?)}
+ {$1$after_end_dot}sx
+ or die "No match on '_end = .;' line";
+ }
+print $ld_script;
diff --git a/libgupc/header.tex.in b/libgupc/header.tex.in
new file mode 100644
index 00000000000..c6cf5b5dba5
--- /dev/null
+++ b/libgupc/header.tex.in
@@ -0,0 +1,66 @@
+\documentclass[@DOXYGEN_PAPER_SIZE@]{report}
+\usepackage[top=1in, bottom=1in,
+ left=1in, right=1in,
+ textwidth=6.5in]{geometry}
+\usepackage{makeidx}
+\usepackage{graphicx}
+\usepackage{multicol}
+\usepackage{float}
+\usepackage{listings}
+\usepackage{color}
+\usepackage{ifthen}
+\usepackage[table]{xcolor}
+\usepackage{textcomp}
+\usepackage{alltt}
+\usepackage{ifpdf}
+\ifpdf
+\usepackage[pdftex,
+ pagebackref=true,
+ colorlinks=true,
+ linkcolor=blue,
+ unicode
+ ]{hyperref}
+\else
+\usepackage[ps2pdf,
+ pagebackref=true,
+ colorlinks=true,
+ linkcolor=blue,
+ unicode
+ ]{hyperref}
+\usepackage{pspicture}
+\fi
+\usepackage[utf8]{inputenc}
+\usepackage{mathptmx}
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+\usepackage{sectsty}
+\usepackage[titles]{tocloft}
+\usepackage{doxygen}
+\lstset{language=C,inputencoding=utf8,
+ basicstyle=\footnotesize,breaklines=true,breakatwhitespace=true,
+ tabsize=8,numbers=left}
+\makeindex
+\setcounter{tocdepth}{3}
+\renewcommand{\footrulewidth}{0.4pt}
+\renewcommand{\familydefault}{\sfdefault}
+\begin{document}
+\hypersetup{pageanchor=false}
+\begin{titlepage}
+\vspace*{7cm}
+\begin{center}
+\ifthenelse{\equal{@DOXYGEN_LOGO@}{}}{}
+{\includegraphics{@DOXYGEN_LOGO@}\\
+\vspace*{1cm}}
+{\large @DOXYGEN_TITLE@}\\
+\vspace*{1cm}
+{\large @DOXYGEN_AUTHOR@}\\
+\vspace*{0.5cm}
+{\small @DOXYGEN_DATETIME@}\\
+\end{center}
+\end{titlepage}
+\clearemptydoublepage
+\pagenumbering{roman}
+\tableofcontents
+\clearemptydoublepage
+\pagenumbering{arabic}
+\hypersetup{pageanchor=true}
diff --git a/libgupc/include/gasp.h b/libgupc/include/gasp.h
new file mode 100644
index 00000000000..909eaf89e96
--- /dev/null
+++ b/libgupc/include/gasp.h
@@ -0,0 +1,72 @@
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _GASP_H_
+#define _GASP_H_
+
+#include <stdarg.h>
+
+/* See GASP Specification (version 1.5)
+ http://gasp.hcs.ufl.edu/gasp-1.5-61606.pdf */
+
+#define GASP_VERSION 20060914
+
+typedef enum
+{
+ GASP_MODEL_UPC,
+ GASP_MODEL_TITANIUM,
+ GASP_MODEL_CAF,
+ GASP_MODEL_MPI,
+ GASP_MODEL_SHMEM
+} gasp_model_t;
+
+typedef enum
+{
+ GASP_START,
+ GASP_END,
+ GASP_ATOMIC,
+} gasp_evttype_t;
+
+struct _gasp_context_S;
+typedef struct _gasp_context_S *gasp_context_t;
+
+gasp_context_t gasp_init (gasp_model_t srcmodel, int *argc, char ***argv);
+
+void gasp_event_notify (gasp_context_t context, unsigned int evttag,
+ gasp_evttype_t evttype, const char *filename,
+ int linenum, int colnum, ...);
+
+void gasp_event_notifyVA (gasp_context_t context, unsigned int evttag,
+ gasp_evttype_t evttype, const char *filename,
+ int linenum, int colnum, va_list varargs);
+
+int gasp_control (gasp_context_t context, int on);
+
+unsigned int gasp_create_event (gasp_context_t context,
+ const char *name, const char *desc);
+
+#endif /* _GASP_H_ */
diff --git a/libgupc/include/gasp_upc.h b/libgupc/include/gasp_upc.h
new file mode 100644
index 00000000000..dcbff38e14e
--- /dev/null
+++ b/libgupc/include/gasp_upc.h
@@ -0,0 +1,224 @@
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _GASP_UPC_H_
+#define _GASP_UPC_H_
+
+/* See GASP Specification (version 1.5)
+ http://gasp.hcs.ufl.edu/gasp-1.5-61606.pdf. */
+
+#define GASP_UPC_VERSION 40302
+
+/* Opaque types. */
+typedef void gasp_upc_PTS_t;
+typedef void gasp_upc_lock_t;
+typedef void *gasp_upc_nb_handle_t;
+
+/* Indicate that a non-blocking get/put shouldn't be tracked. */
+#define GASP_NB_TRIVIAL ((gasp_upc_nb_handle_t) 0)
+
+/* Reduction operation data types. */
+typedef enum
+{
+ GASP_UPC_REDUCTION_C,
+ GASP_UPC_REDUCTION_UC,
+ GASP_UPC_REDUCTION_S,
+ GASP_UPC_REDUCTION_US,
+ GASP_UPC_REDUCTION_I,
+ GASP_UPC_REDUCTION_UI,
+ GASP_UPC_REDUCTION_L,
+ GASP_UPC_REDUCTION_UL,
+ GASP_UPC_REDUCTION_F,
+ GASP_UPC_REDUCTION_D,
+ GASP_UPC_REDUCTION_LD
+} gasp_upc_reduction_t;
+
+/*
+
+ GASP events defined in the specification document.
+
+ Symbolic name Event type vararg arguments
+ =================================================
+ GASP_C_FUNC Start,End const char *funcsig
+ GASP_C_MALLOC Start,End size_t nbytes
+ GASP_C_REALLOC Start,End void *ptr, size_t size
+ GASP_C_FREE Start,End void *ptr
+ GASP_UPC_COLLECTIVE_EXIT Start,End int status
+ GASP_UPC_NONCOLLECTIVE_EXIT Atomic int status
+ GASP_UPC_NOTIFY Start,End int named, int expr
+ GASP_UPC_WAIT Start,End int named, int expr
+ GASP_UPC_BARRIER Start,End int named, int expr
+ GASP_UPC_FENCE Start,End (none)
+ GASP_UPC_FORALL Start,End (none)
+ GASP_UPC_GLOBAL_ALLOC Start size_t nblocks, size_t nbytes
+ GASP_UPC_GLOBAL_ALLOC End size_t nblocks, size_t nbytes,
+ gasp_upc_PTS_t *newshrd_ptr
+ GASP_UPC_ALL_ALLOC Start size_t nblocks, size_t nbytes
+ GASP_UPC_ALL_ALLOC End size_t nblocks, size_t nbytes,
+ gasp_upc_PTS_t *newshrd_ptr
+ GASP_UPC_ALLOC Start size_t nbytes
+ GASP_UPC_ALLOC End size_t nbytes,
+ gasp_upc_PTS_t *newshrd_ptr
+ GASP_UPC_FREE Start,End gasp_upc_PTS_t *shrd_ptr
+ GASP_UPC_GLOBAL_LOCK_ALLOC Start (none)
+ GASP_UPC_GLOBAL_LOCK_ALLOC End gasp_upc_lock_t *lck
+ GASP_UPC_ALL_LOCK_ALLOC Start (none)
+ GASP_UPC_ALL_LOCK_ALLOC End gasp_upc_lock_t *lck
+ GASP_UPC_LOCK_FREE Start,End gasp_upc_lock_t *lck
+ GASP_UPC_LOCK Start,End gasp_upc_lock_t *lck
+ GASP_UPC_LOCK_ATTEMPT Start gasp_upc_lock_t *lck
+ GASP_UPC_LOCK_ATTEMPT End gasp_upc_lock_t *lck, int result
+ GASP_UPC_UNLOCK Start,End gasp_upc_lock_t *lck
+ GASP_UPC_MEMCPY Start,End gasp_upc_PTS_t *dst,
+ gasp_upc_PTS_t *src, size_t n
+ GASP_UPC_MEMGET Start,End void *dst, gasp_upc_PTS_t *src,
+ size_t n
+ GASP_UPC_MEMPUT Start,End gasp_upc_PTS_t *dst, void *src,
+ size_t n
+ GASP_UPC_MEMSET Start,End gasp_upc_PTS_t *dst, int c,
+ size_t n
+ GASP_UPC_GET Start,End int is_relaxed, void *dst,
+ gasp_upc_PTS_t *src, size_t n
+ GASP_UPC_PUT Start,End int is_relaxed,
+ gasp_upc_PTS_t *dst,
+ void *src, size_t n
+ GASP_UPC_NB_GET_INIT Start int is_relaxed, void *dst,
+ gasp_upc_PTS_t *src, size_t n
+ GASP_UPC_NB_GET_INIT End int is_relaxed, void *dst,
+ gasp_upc_PTS_t *src,
+ size_t n,
+ gasp_upc_nb_handle_t handle
+ GASP_UPC_NB_GET_DATA Start,End gasp_upc_nb_handle_t handle
+ GASP_UPC_NB_PUT_INIT Start int is_relaxed, gasp_upc_PTS_t *dst,
+ void *src, size_t n
+ GASP_UPC_NB_PUT_INIT End int is_relaxed, gasp_upc_PTS_t *dst,
+ void *src, size_t n,
+ gasp_upc_nb_handle_t handle
+ GASP_UPC_NB_PUT_DATA Start,End gasp_upc_nb_handle_t handle
+ GASP_UPC_NB_SYNC Start,End gasp_upc_nb_handle_t handle
+ GASP_UPC_CACHE_MISS Atomic size_t n, size_t n_lines
+ GASP_UPC_CACHE_HIT Atomic size_t n
+ GASP_UPC_CACHE_INVALIDATE Atomic size_t n_dirty
+ GASP_UPC_ALL_BROADCAST Start,End gasp_upc_PTS_t *dst,
+ gasp_upc_PTS_t *src,
+ size_t nbytes, int upc_flags
+ GASP_UPC_ALL_SCATTER Start,End gasp_upc_PTS_t *dst,
+ gasp_upc_PTS_t *src,
+ size_t nbytes, int upc_flags
+ GASP_UPC_ALL_GATHER Start,End gasp_upc_PTS_t *dst,
+ gasp_upc_PTS_t *src,
+ size_t nbytes, int upc_flags
+ GASP_UPC_ALL_GATHER_ALL Start,End gasp_upc_PTS_t *dst,
+ gasp_upc_PTS_t *src,
+ size_t nbytes, int upc_flags
+ GASP_UPC_ALL_EXCHANGE Start,End gasp_upc_PTS_t *dst,
+ gasp_upc_PTS_t *src,
+ size_t nbytes, int upc_flags
+ GASP_UPC_ALL_PERMUTE Start,End gasp_upc_PTS_t *dst,
+ gasp_upc_PTS_t *src,
+ gasp_upc_PTS_t *perm, size_t nbytes,
+ int upc_flags
+ GASP_UPC_ALL_REDUCE Start,End gasp_upc_PTS_t *dst,
+ gasp_upc_PTS_t *src,
+ int upc_op, size_t nelems,
+ size_t blk_size,
+ void *func, int upc_flags,
+ gasp_upc_reduction_t type
+ GASP_UPC_ALL_PREFIX_REDUCE Start,End gasp_upc_PTS_t *dst,
+ gasp_upc_PTS_t *src, int upc_op,
+ size_t nelems, size_t blk_size,
+ void *func, int upc_flags,
+ gasp_upc_reduction_t type
+ GASP_UPC_USEREVT_START First User-defined event
+ GASP_UPC_USEREVT_END Last User-defined event
+*/
+
+/* These might some day be set as configured items. */
+#undef GASP_C_MALLOC_SUPPORTED
+#undef GASP_UPC_FENCE_SUPPORTED
+#undef GASP_UPC_NB_SUPPORTED
+#undef GASP_UPC_CACHE_SUPPORTED
+#undef GASP_UPC_ALL_SUPPORTED
+
+#define GASP_UPC_EVT_NONE 0
+#define GASP_C_FUNC 1
+#ifdef GASP_C_MALLOC_SUPPORTED
+#define GASP_C_MALLOC 2
+#define GASP_C_REALLOC 3
+#define GASP_C_FREE 4
+#endif /* GASP_C_MALLOC_SUPPORTED */
+#define GASP_UPC_COLLECTIVE_EXIT 5
+#define GASP_UPC_NONCOLLECTIVE_EXIT 6
+#define GASP_UPC_NOTIFY 7
+#define GASP_UPC_WAIT 8
+#define GASP_UPC_BARRIER 9
+#ifdef GASP_UPC_FENCE_SUPPORTED
+#define GASP_UPC_FENCE 10
+#endif /* GASP_UPC_FENCE_SUPPORTED */
+#define GASP_UPC_FORALL 11
+#define GASP_UPC_GLOBAL_ALLOC 12
+#define GASP_UPC_ALL_ALLOC 13
+#define GASP_UPC_ALLOC 14
+#define GASP_UPC_FREE 15
+#define GASP_UPC_GLOBAL_LOCK_ALLOC 16
+#define GASP_UPC_ALL_LOCK_ALLOC 17
+#define GASP_UPC_LOCK_FREE 18
+#define GASP_UPC_LOCK 19
+#define GASP_UPC_LOCK_ATTEMPT 20
+#define GASP_UPC_UNLOCK 21
+#define GASP_UPC_MEMCPY 22
+#define GASP_UPC_MEMGET 23
+#define GASP_UPC_MEMPUT 24
+#define GASP_UPC_MEMSET 25
+#define GASP_UPC_GET 26
+#define GASP_UPC_PUT 27
+#ifdef GASP_UPC_NB_SUPPORTED
+#define GASP_UPC_NB_GET_INIT 28
+#define GASP_UPC_NB_GET_DATA 29
+#define GASP_UPC_NB_PUT_INIT 30
+#define GASP_UPC_NB_PUT_DATA 31
+#define GASP_UPC_NB_SYNC 32
+#endif /* GASP_UPC_NB_SUPPORTED */
+#if GASP_UPC_CACHE_SUPPORTED
+#define GASP_UPC_CACHE_MISS 33
+#define GASP_UPC_CACHE_HIT 34
+#define GASP_UPC_CACHE_INVALIDATE 35
+#endif /* GASP_UPC_CACHE_SUPPORTED */
+#ifdef GASP_UPC_ALL_SUPPORTED
+#define GASP_UPC_ALL_BROADCAST 36
+#define GASP_UPC_ALL_SCATTER 37
+#define GASP_UPC_ALL_GATHER 38
+#define GASP_UPC_ALL_GATHER_ALL 39
+#define GASP_UPC_ALL_EXCHANGE 40
+#define GASP_UPC_ALL_PERMUTE 41
+#define GASP_UPC_ALL_REDUCE 42
+#define GASP_UPC_ALL_PREFIX_REDUCE 43
+#endif /* GASP_UPC_ALL_SUPPORTED */
+#define GASP_UPC_USEREVT_START 1000
+#define GASP_UPC_USEREVT_END 1999
+
+#endif /* _GASP_UPC_H_ */
diff --git a/libgupc/include/gcc-upc.h b/libgupc/include/gcc-upc.h
new file mode 100644
index 00000000000..587a18f5b0d
--- /dev/null
+++ b/libgupc/include/gcc-upc.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 2005-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _GCC_UPC_H_
+#define _GCC_UPC_H_
+
+#ifndef NO_GCC_UPC_LIB
+/* Include the runtime API. */
+#include <gcc-upc-lib.h>
+#endif
+
+#pragma upc upc_code
+
+/* upc_lock_t is an opaque shared type. */
+typedef shared struct upc_lock_struct upc_lock_t;
+
+#ifndef upc_poll
+/* For now upc_poll is a no-op. */
+#define upc_poll()
+#endif
+
+#ifdef __UPC_USES_PTHREADS__
+/* Pthreads implementation uses per thread random seed. */
+#define rand __upc_rand
+#define srand __upc_srand
+extern int __upc_rand (void);
+extern void __upc_srand (unsigned int seed);
+#endif
+
+#endif /* !_GCC_UPC_H_ */
diff --git a/libgupc/include/pupc.h b/libgupc/include/pupc.h
new file mode 100644
index 00000000000..2f4f96c3c1b
--- /dev/null
+++ b/libgupc/include/pupc.h
@@ -0,0 +1,70 @@
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _PUPC_H_
+#define _PUPC_H_
+
+/* See GASP Specification (version 1.5)
+ http://gasp.hcs.ufl.edu/gasp-1.5-61606.pdf. */
+
+#if __UPC_PUPC__
+extern int pupc_control (int on);
+extern unsigned int pupc_create_event (const char *name, const char *desc);
+#else
+#define pupc_control(on) 0
+#define pupc_create_event(name, desc) 0
+#endif
+
+#if __UPC_PUPC__ && __UPC_PUPC_INST__
+extern void pupc_event_startg
+ (unsigned int evttag, const char *file, int line, ...);
+extern void pupc_event_endg
+ (unsigned int evttag, const char *file, int line, ...);
+extern void pupc_event_atomicg
+ (unsigned int evttag, const char *file, int line, ...);
+#define pupc_event_start(evttag, args...) \
+ pupc_event_startg (evttag, __FILE__, __LINE__, args)
+#define pupc_event_end(evttag, args...) \
+ pupc_event_endg (evttag, __FILE__, __LINE__, args)
+#define pupc_event_atomic(evttag, args...) \
+ pupc_event_atomicg (evttag, __FILE__, __LINE__, args)
+#else
+#define pupc_event_start(evttag, args...)
+#define pupc_event_end(evttag, args...)
+#define pupc_event_atomic(evttag, args...)
+#endif
+
+#ifndef pupc_event_start
+/* These prototypes won't be compiled, because the
+ macro definitions above will over-ride them.
+ The prototypes are here for documentation purposes only. */
+extern void pupc_event_start (unsigned int evttag, ...);
+extern void pupc_event_end (unsigned int evttag, ...);
+extern void pupc_event_atomic (unsigned int evttag, ...);
+#endif
+
+#endif /* _PUPC_H_ */
diff --git a/libgupc/include/upc.h b/libgupc/include/upc.h
new file mode 100644
index 00000000000..5fe01466793
--- /dev/null
+++ b/libgupc/include/upc.h
@@ -0,0 +1,131 @@
+/* Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_H_
+#define _UPC_H_
+
+/* Required, to define size_t. */
+#include <sys/types.h>
+
+extern size_t upc_threadof (shared void *);
+extern size_t upc_phaseof (shared void *);
+extern shared void *upc_resetphase (shared void *);
+extern size_t upc_addrfield (shared void *);
+extern size_t upc_affinitysize (size_t, size_t, size_t);
+
+#if IN_TARGET_LIBS || __UPC_PUPC_INST__
+/* Profiled memory allocation routines. */
+extern shared void *upc_global_allocg (size_t, size_t, const char *, int);
+extern shared void *upc_all_allocg (size_t, size_t, const char *, int);
+extern shared void *upc_allocg (size_t, const char *, int);
+extern void upc_freeg (shared void *, const char *, int);
+extern void upc_all_freeg (shared void *, const char *, int);
+#endif /* IN_TARGET_LIBS || __UPC_PUPC_INST__ */
+
+#ifdef __UPC_PUPC_INST__
+
+/* Profiled UPC library functions. */
+
+extern void upc_global_exitg (int, const char *, int);
+extern upc_lock_t *upc_global_lock_allocg (const char *, int);
+extern upc_lock_t *upc_all_lock_allocg (const char *, int);
+extern void upc_lockg (upc_lock_t *, const char *, int);
+extern int upc_lock_attemptg (upc_lock_t *, const char *, int);
+extern void upc_unlockg (upc_lock_t *, const char *, int);
+extern void upc_lock_freeg (upc_lock_t *, const char *, int);
+extern void upc_all_lock_freeg (upc_lock_t *, const char *, int);
+extern void upc_memcpyg (shared void *, shared const void *,
+ size_t, const char *, int);
+extern void upc_memgetg (void *, shared const void *,
+ size_t, const char *, int);
+extern void upc_memputg (shared void *, const void *,
+ size_t, const char *, int);
+extern void upc_memsetg (shared void *, int, size_t, const char *, int);
+
+/* The following functions are not profiled, but when -fupc-debug
+ is asserted will be called with the additional file and line
+ arguments. */
+extern size_t upc_threadofg (shared void *, const char *, int);
+extern size_t upc_phaseofg (shared void *, const char *, int);
+extern shared void *upc_resetphaseg (shared void *, const char *, int);
+extern size_t upc_addrfieldg (shared void *, const char *, int);
+extern size_t upc_affinitysizeg (size_t, size_t, size_t, const char *, int);
+
+#define upc_all_alloc(n, b) upc_all_allocg(n, b, __FILE__, __LINE__)
+#define upc_all_lock_alloc() upc_all_lock_allocg(__FILE__, __LINE__)
+#define upc_alloc(n) upc_allocg(n, __FILE__, __LINE__)
+#define upc_free(ptr) upc_freeg(ptr, __FILE__, __LINE__)
+#define upc_all_free(ptr) upc_all_freeg(ptr, __FILE__, __LINE__)
+#define upc_global_exit(n) upc_global_exitg(n, __FILE__, __LINE__)
+#define upc_global_alloc(n, b) upc_global_allocg(n, b, __FILE__, __LINE__)
+#define upc_global_lock_alloc() upc_global_lock_allocg(__FILE__, __LINE__)
+#define upc_lock_attempt(lck) upc_lock_attemptg(lck, __FILE__, __LINE__)
+#define upc_lock_free(lck) upc_lock_freeg(lck, __FILE__, __LINE__)
+#define upc_all_lock_free(lck) upc_all_lock_freeg(lck, __FILE__, __LINE__)
+#define upc_lock(lck) upc_lockg(lck, __FILE__, __LINE__)
+#define upc_memcpy(p1, p2, n) upc_memcpyg(p1, p2, n, __FILE__, __LINE__)
+#define upc_memget(p1, p2, n) upc_memgetg(p1, p2, n, __FILE__, __LINE__)
+#define upc_memput(p1, p2, n) upc_memputg(p1, p2, n, __FILE__, __LINE__)
+#define upc_memset(p1, c, n) upc_memsetg(p1, c, n, __FILE__, __LINE__)
+#define upc_unlock(lck) upc_unlockg(lck, __FILE__, __LINE__)
+#define upc_threadof(p) upc_threadofg(p, __FILE__, __LINE__)
+#define upc_phaseof(p) upc_phaseofg(p, __FILE__, __LINE__)
+#define upc_resetphase(p) upc_resetphaseg(p, __FILE__, __LINE__)
+#define upc_addrfield(p) upc_addrfieldg(p, __FILE__, __LINE__)
+#define upc_affinity(totalsize, nbytes, threadid) \
+ upc_affinitysizeg(totalsize, nbytes, threadid, __FILE__, __LINE__)
+
+#else
+
+/* Standard UPC library functions. */
+
+extern void upc_global_exit (int);
+extern shared void *upc_global_alloc (size_t, size_t);
+extern shared void *upc_all_alloc (size_t, size_t);
+extern shared void *upc_alloc (size_t);
+extern void upc_free (shared void *);
+extern void upc_all_free (shared void *);
+extern upc_lock_t *upc_global_lock_alloc (void);
+extern upc_lock_t *upc_all_lock_alloc (void);
+extern void upc_lock (upc_lock_t *);
+extern int upc_lock_attempt (upc_lock_t *);
+extern void upc_unlock (upc_lock_t *);
+extern void upc_lock_free (upc_lock_t *);
+extern void upc_all_lock_free (upc_lock_t *);
+extern void upc_memcpy (shared void *, shared const void *, size_t);
+extern void upc_memget (void *, shared const void *, size_t);
+extern void upc_memput (shared void *, const void *, size_t);
+extern void upc_memset (shared void *, int, size_t);
+
+#endif /* __UPC_PUPC_INST__ */
+
+#ifndef __BERKELEY_UPC_RUNTIME__
+/* upc_flag_t, required by version 1.2 of the UPC specification
+ (section 7.2.6). */
+typedef int upc_flag_t;
+#endif
+
+#endif /* !_UPC_H_ */
diff --git a/libgupc/include/upc_atomic.h b/libgupc/include/upc_atomic.h
new file mode 100644
index 00000000000..de120bec4f2
--- /dev/null
+++ b/libgupc/include/upc_atomic.h
@@ -0,0 +1,84 @@
+/* Copyright (C) 2013-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* UPC Atomic Memory Operations */
+
+#ifndef _UPC_ATOMIC_H_
+#define _UPC_ATOMIC_H_
+
+#include "upc_types.h"
+
+/* Atomic operations not defined in <upc_types.h>. */
+#define UPC_GET (1UL<<9)
+#define UPC_SET (1UL<<10)
+#define UPC_CSWAP (1UL<<11)
+#define UPC_SUB (1UL<<12)
+#define UPC_INC (1UL<<13)
+#define UPC_DEC (1UL<<14)
+
+#define UPC_GET_OP 9
+#define UPC_SET_OP 10
+#define UPC_CSWAP_OP 11
+#define UPC_SUB_OP 12
+#define UPC_INC_OP 13
+#define UPC_DEC_OP 14
+
+/* Preferred mode of optimization of a domain. */
+typedef int upc_atomichint_t;
+/* Preferred mode of optimization values. */
+#define UPC_ATOMIC_HINT_DEFAULT 0
+#define UPC_ATOMIC_HINT_LATENCY 1
+#define UPC_ATOMIC_HINT_THROUGHPUT 2
+
+/* Atomics domain allocator (collective function). */
+upc_atomicdomain_t *upc_all_atomicdomain_alloc (upc_type_t type,
+ upc_op_t ops,
+ upc_atomichint_t hints);
+
+/* Atomics domain release (collective function). */
+void upc_all_atomicdomain_free (upc_atomicdomain_t * ptr);
+
+/* Atomics strict operation. */
+void upc_atomic_strict (upc_atomicdomain_t * domain,
+ void *restrict fetch_ptr, upc_op_t op,
+ shared void *restrict target,
+ const void *restrict operand1,
+ const void *restrict operand2);
+
+/* Atomics relaxed operation. */
+void upc_atomic_relaxed (upc_atomicdomain_t * domain,
+ void *restrict fetch_ptr, upc_op_t op,
+ shared void *restrict target,
+ const void *restrict operand1,
+ const void *restrict operand2);
+
+/* Atomics query function for expected performance. */
+int upc_atomic_isfast (upc_type_t type, upc_op_t ops, shared void *addr);
+/* Expected performance return value. */
+#define UPC_ATOMIC_PERFORMANCE_NOT_FAST 0
+#define UPC_ATOMIC_PERFORMANCE_FAST 1
+
+#endif /* !_UPC_ATOMIC_H_ */
diff --git a/libgupc/include/upc_castable.h b/libgupc/include/upc_castable.h
new file mode 100644
index 00000000000..fa038345126
--- /dev/null
+++ b/libgupc/include/upc_castable.h
@@ -0,0 +1,60 @@
+/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Derived from public domain reference implementation
+ written by Dan Bonachea <danbonachea@gmail.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_CASTABLE_H_
+#define _UPC_CASTABLE_H_
+
+#if __UPC_CASTABLE__ != 1
+#error Bad feature macro predefinition
+#endif
+
+#include <stddef.h> /* size_t */
+
+#define UPC_CASTABLE_ALL_ALLOC (1<<0)
+#define UPC_CASTABLE_GLOBAL_ALLOC (1<<1)
+#define UPC_CASTABLE_ALLOC (1<<2)
+#define UPC_CASTABLE_STATIC (1<<3)
+
+#define UPC_CASTABLE_ALL ( \
+ UPC_CASTABLE_ALL_ALLOC | \
+ UPC_CASTABLE_GLOBAL_ALLOC | \
+ UPC_CASTABLE_ALLOC | \
+ UPC_CASTABLE_STATIC \
+ )
+
+typedef struct _S_upc_thread_info
+{
+ int guaranteedCastable;
+ int probablyCastable;
+} upc_thread_info_t;
+
+
+void *upc_cast (const shared void *);
+
+upc_thread_info_t upc_thread_info (size_t);
+
+#endif /* _UPC_CASTABLE_H_ */
diff --git a/libgupc/include/upc_collective.h b/libgupc/include/upc_collective.h
new file mode 100644
index 00000000000..d58b6941701
--- /dev/null
+++ b/libgupc/include/upc_collective.h
@@ -0,0 +1,222 @@
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_COLLECTIVE_H_
+#define _UPC_COLLECTIVE_H_
+
+#include <upc_types.h>
+
+/* Per the UPC collectives library specification, the following
+ operations are defined in addition to those defined in upc_types.h.
+ Values below 2^16 are reserved. */
+#define UPC_FUNC (1UL<<16)
+#define UPC_NONCOMM_FUNC (1UL<<17)
+#define UPC_MAX_COLL_OP UPC_NONCOMM_FUNC
+
+/* Function codes for error checking */
+
+#define UPC_BRDCST 0
+#define UPC_SCAT 1
+#define UPC_GATH 2
+#define UPC_GATH_ALL 3
+#define UPC_EXCH 4
+#define UPC_PERM 5
+#define UPC_RED 6
+#define UPC_PRED 7
+#define UPC_SORT 8
+
+extern void upc_all_broadcast (shared void *dst,
+ shared const void *src,
+ size_t nbytes, upc_flag_t sync_mode);
+
+extern void upc_coll_err (shared void *dst, shared const void *src,
+ shared const int *perm,
+ size_t nbytes,
+ upc_flag_t sync_mode,
+ size_t blk_size,
+ size_t nelems, upc_op_t op, upc_flag_t upc_coll_op);
+
+extern void upc_all_exchange (shared void *dst, shared const void *src,
+ size_t nbytes, upc_flag_t sync_mode);
+
+extern void upc_all_gather_all (shared void *dst,
+ shared const void *src,
+ size_t nbytes, upc_flag_t sync_mode);
+
+extern void upc_all_gather (shared void *dst, shared const void *src,
+ size_t nbytes, upc_flag_t sync_mode);
+
+extern void upc_coll_init (void);
+
+extern void upc_all_permute (shared void *dst, shared const void *src,
+ shared const int *perm, size_t nbytes,
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceC (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems,
+ size_t blk_size,
+ signed char (*func) (signed char,
+ signed char),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceUC (shared void *dst,
+ shared const void *src, upc_op_t op,
+ size_t nelems, size_t blk_size,
+ unsigned char (*func) (unsigned char,
+ unsigned char),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceS (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems,
+ size_t blk_size,
+ signed short (*func) (signed short,
+ signed short),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceUS (shared void *dst,
+ shared const void *src, upc_op_t op,
+ size_t nelems, size_t blk_size,
+ unsigned short (*func) (unsigned short,
+ unsigned short),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceI (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems,
+ size_t blk_size,
+ signed int (*func) (signed int,
+ signed int),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceUI (shared void *dst,
+ shared const void *src, upc_op_t op,
+ size_t nelems, size_t blk_size,
+ unsigned int (*func) (unsigned int,
+ unsigned int),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceL (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems,
+ size_t blk_size,
+ signed long (*func) (signed long,
+ signed long),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceUL (shared void *dst,
+ shared const void *src, upc_op_t op,
+ size_t nelems, size_t blk_size,
+ unsigned long (*func) (unsigned long,
+ unsigned long),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceF (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems,
+ size_t blk_size, float (*func) (float,
+ float),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceD (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems,
+ size_t blk_size, double (*func) (double,
+ double),
+ upc_flag_t sync_mode);
+
+extern void upc_all_prefix_reduceLD (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems,
+ size_t blk_size,
+ long double (*func) (long double,
+ long double),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceC (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ signed char (*func) (signed char, signed char),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceUC (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ unsigned char (*func) (unsigned char,
+ unsigned char),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceS (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ signed short (*func) (signed short,
+ signed short),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceUS (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ unsigned short (*func) (unsigned short,
+ unsigned short),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceI (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ signed int (*func) (signed int, signed int),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceUI (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ unsigned int (*func) (unsigned int,
+ unsigned int),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceL (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ signed long (*func) (signed long, signed long),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceUL (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ unsigned long (*func) (unsigned long,
+ unsigned long),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceF (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ float (*func) (float, float),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceD (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ double (*func) (double, double),
+ upc_flag_t sync_mode);
+
+extern void upc_all_reduceLD (shared void *dst, shared const void *src,
+ upc_op_t op, size_t nelems, size_t blk_size,
+ long double (*func) (long double, long double),
+ upc_flag_t sync_mode);
+
+extern void upc_all_scatter (shared void *dst, shared const void *src,
+ size_t nbytes, upc_flag_t sync_mode);
+
+extern void upc_all_sort (shared void *A, size_t elem_size,
+ size_t nelems, size_t blk_size,
+ int (*func) (shared void *, shared void *),
+ upc_flag_t sync_mode);
+
+#endif /* !_UPC_COLLECTIVE_H_ */
diff --git a/libgupc/include/upc_nb.h b/libgupc/include/upc_nb.h
new file mode 100644
index 00000000000..39f4a6e27f5
--- /dev/null
+++ b/libgupc/include/upc_nb.h
@@ -0,0 +1,65 @@
+/* Copyright (C) 2013-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* UPC Non-Blocking Transfer Operations */
+
+#ifndef _UPC_NB_H_
+#define _UPC_NB_H_
+
+/* Sync attempt return values. */
+#define UPC_NB_NOT_COMPLETED 0
+#define UPC_NB_COMPLETED 1
+
+/* UPC non-blocking handle. */
+typedef unsigned long upc_handle_t;
+#define UPC_COMPLETE_HANDLE (unsigned long) 0
+
+/* Non-blocking memory transfers with explicit handle. */
+extern upc_handle_t upc_memcpy_nb (
+ shared void *restrict dst, shared const void *restrict src, size_t n);
+extern upc_handle_t upc_memget_nb (
+ void *restrict dst, shared const void *restrict src, size_t n);
+extern upc_handle_t upc_memput_nb (
+ shared void *restrict dst, const void *restrict src, size_t n);
+extern upc_handle_t upc_memset_nb (shared void *dst, int c, size_t n);
+extern int upc_sync_attempt (upc_handle_t handle);
+extern void upc_sync (upc_handle_t handle);
+
+/* Non-blocking memory transfers with implicit handle. */
+extern void
+upc_memcpy_nbi (shared void *restrict dst,
+ shared const void *restrict src, size_t n);
+extern void
+upc_memget_nbi (void *restrict dst,
+ shared const void *restrict src, size_t n);
+extern void
+upc_memput_nbi (shared void *restrict dst,
+ const void *restrict src, size_t n);
+extern void upc_memset_nbi (shared void *dst, int c, size_t n);
+extern int upc_synci_attempt (void);
+extern void upc_synci (void);
+
+#endif /* !_UPC_NB_H_ */
diff --git a/libgupc/include/upc_ops.def b/libgupc/include/upc_ops.def
new file mode 100644
index 00000000000..c7d8b6bdb12
--- /dev/null
+++ b/libgupc/include/upc_ops.def
@@ -0,0 +1,164 @@
+/* UPc Operation (used in collectives and atomic ops). */
+
+/*
+- Supported AMO integer types are UPC_INT, UPC_UINT, UPC_LONG, UPC_ULONG,
+UPC_INT32, UPC_UINT32, UPC_INT64, and UPC_UINT64.
+- Supported AMO floating-point types are UPC_FLOAT and UPC_DOUBLE.
+- Supported AMO accessors are UPC_GET, UPC_SET, and UPC_CSWAP.
+- Supported AMO bit-wise operations are UPC_AND, UPC_OR, and UPC_XOR.
+- Supported AMO numeric operations are UPC_ADD, UPC_SUB, UPC_MULT, UPC_INC,
+UPC_DEC, UPC_MAX, and UPC_MIN. */
+
+upc_op = {
+ op_upc_name = "UPC_ADD";
+ op_name = "add";
+ op_op = "+";
+ op_bit = 0;
+ op_c_value = "(1LL << 0)";
+ op_mode = "numeric";
+ op_atomic_ok;
+ op_require_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_MULT";
+ op_name = "mult";
+ op_op = "*";
+ op_bit = 1;
+ op_c_value = "(1LL << 1)";
+ op_mode = "numeric";
+ op_atomic_ok;
+ op_require_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_AND";
+ op_name = "and";
+ op_op = "&";
+ op_bit = 2;
+ op_c_value = "(1LL << 2)";
+ op_mode = "logical";
+ op_atomic_ok;
+ op_require_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_OR";
+ op_name = "or";
+ op_op = "|";
+ op_bit = 3;
+ op_c_value = "(1LL << 3)";
+ op_mode = "logical";
+ op_atomic_ok;
+ op_require_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_XOR";
+ op_name = "xor";
+ op_op = "^";
+ op_bit = 4;
+ op_c_value = "(1LL << 4)";
+ op_mode = "logical";
+ op_atomic_ok;
+ op_require_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_LOGAND";
+ op_name = "logand";
+ op_bit = 5;
+ op_c_value = "(1LL << 5)";
+ op_mode = "logical";
+ };
+upc_op = {
+ op_upc_name = "UPC_LOGOR";
+ op_name = "logor";
+ op_bit = 6;
+ op_c_value = "(1LL << 6)";
+ op_mode = "logical";
+ };
+upc_op = {
+ op_upc_name = "UPC_MIN";
+ op_name = "min";
+ op_bit = 7;
+ op_c_value = "(1LL << 7)";
+ op_mode = "numeric";
+ op_atomic_ok;
+ op_require_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_MAX";
+ op_name = "max";
+ op_bit = 8;
+ op_c_value = "(1LL << 8)";
+ op_mode = "numeric";
+ op_atomic_ok;
+ op_require_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_GET";
+ op_name = "get";
+ op_bit = 9;
+ op_c_value = "(1LL << 9)";
+ op_mode = "access";
+ op_atomic_ok;
+ op_require_fetch_ptr;
+ op_null_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_SET";
+ op_name = "set";
+ op_bit = 10;
+ op_c_value = "(1LL << 10)";
+ op_mode = "access";
+ op_atomic_ok;
+ op_require_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_CSWAP";
+ op_name = "compare_exchange";
+ op_bit = 11;
+ op_c_value = "(1LL << 11)";
+ op_mode = "access";
+ op_atomic_ok;
+ op_require_operand1;
+ op_require_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_SUB";
+ op_name = "sub";
+ op_op = "-";
+ op_bit = 12;
+ op_c_value = "(1LL << 12)";
+ op_mode = "numeric";
+ op_atomic_ok;
+ op_require_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_INC";
+ op_name = "inc";
+ op_op = "+";
+ op_bit = 13;
+ op_c_value = "(1LL << 13)";
+ op_mode = "numeric";
+ op_atomic_ok;
+ op_null_operand1;
+ op_null_operand2;
+ };
+upc_op = {
+ op_upc_name = "UPC_DEC";
+ op_name = "dec";
+ op_op = "-";
+ op_bit = 14;
+ op_c_value = "(1LL << 14)";
+ op_mode = "numeric";
+ op_atomic_ok;
+ op_null_operand1;
+ op_null_operand2;
+ };
diff --git a/libgupc/include/upc_relaxed.h b/libgupc/include/upc_relaxed.h
new file mode 100644
index 00000000000..ec5dfd584cb
--- /dev/null
+++ b/libgupc/include/upc_relaxed.h
@@ -0,0 +1,31 @@
+/* Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_RELAXED_H_
+#define _UPC_RELAXED_H_
+#pragma upc relaxed
+#include <upc.h>
+#endif /* not _UPC_RELAXED_H_ */
diff --git a/libgupc/include/upc_strict.h b/libgupc/include/upc_strict.h
new file mode 100644
index 00000000000..c5116b5104d
--- /dev/null
+++ b/libgupc/include/upc_strict.h
@@ -0,0 +1,31 @@
+/* Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_STRICT_H_
+#define _UPC_STRICT_H_
+#pragma upc strict
+#include <upc.h>
+#endif /* not _UPC_STRICT_H_ */
diff --git a/libgupc/include/upc_tick.h b/libgupc/include/upc_tick.h
new file mode 100644
index 00000000000..42958c96555
--- /dev/null
+++ b/libgupc/include/upc_tick.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_TICK_H_
+#define _UPC_TICK_H_ 1
+
+/* Required, for uint64_t. */
+#include <stdint.h>
+
+typedef uint64_t upc_tick_t;
+
+#define UPC_TICK_MIN 0ULL
+#define UPC_TICK_MAX 0xffffffffffffffffULL
+
+extern upc_tick_t upc_ticks_now (void);
+extern uint64_t upc_ticks_to_ns (upc_tick_t ticks);
+
+#endif /* _UPC_TICK_H_ */
diff --git a/libgupc/include/upc_types.def b/libgupc/include/upc_types.def
new file mode 100644
index 00000000000..4cb308418e6
--- /dev/null
+++ b/libgupc/include/upc_types.def
@@ -0,0 +1,196 @@
+/*
+- Supported AMO integer types are UPC_INT, UPC_UINT, UPC_LONG, UPC_ULONG,
+UPC_INT32, UPC_UINT32, UPC_INT64, and UPC_UINT64.
+- Supported AMO floating-point types are UPC_FLOAT and UPC_DOUBLE.
+- Supported AMO accessors are UPC_GET, UPC_SET, and UPC_CSWAP.
+- Supported AMO bit-wise operations are UPC_AND, UPC_OR, and UPC_XOR.
+- Supported AMO numeric operations are UPC_ADD, UPC_SUB, UPC_MULT, UPC_INC,
+UPC_DEC, UPC_MAX, and UPC_MIN. */
+
+upc_type = {
+ type_upc_name = "UPC_CHAR";
+ type_abbrev = "C";
+ type_c_name = "char";
+ type_value = 1;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_UCHAR";
+ type_abbrev = "UC";
+ type_c_name = "unsigned char";
+ type_value = 2;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_SHORT";
+ type_abbrev = "S";
+ type_c_name = "short";
+ type_value = 3;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_USHORT";
+ type_abbrev = "US";
+ type_c_name = "unsigned short";
+ type_value = 4;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_INT";
+ type_abbrev = "I";
+ type_c_name = "int";
+ type_value = 5;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_UINT";
+ type_abbrev = "UI";
+ type_c_name = "unsigned int";
+ type_value = 6;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_LONG";
+ type_abbrev = "L";
+ type_c_name = "long";
+ type_value = 7;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_ULONG";
+ type_abbrev = "UL";
+ type_c_name = "unsigned long";
+ type_value = 8;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_LLONG";
+ type_abbrev = "LL";
+ type_c_name = "long long";
+ type_value = 9;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_ULLONG";
+ type_abbrev = "ULL";
+ type_c_name = "unsigned long long";
+ type_value = 10;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_INT8";
+ type_abbrev = "I8";
+ type_c_name = "int8_t";
+ type_value = 11;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_UINT8";
+ type_abbrev = "UI8";
+ type_c_name = "uint8_t";
+ type_value = 12;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_INT16";
+ type_abbrev = "I16";
+ type_c_name = "int16_t";
+ type_value = 13;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_UINT16";
+ type_abbrev = "UI16";
+ type_c_name = "uint16_t";
+ type_value = 14;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_INT32";
+ type_abbrev = "I32";
+ type_c_name = "int32_t";
+ type_value = 15;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_UINT32";
+ type_abbrev = "UI32";
+ type_c_name = "uint32_t";
+ type_value = 16;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_INT64";
+ type_abbrev = "I64";
+ type_c_name = "int64_t";
+ type_value = 17;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_UINT64";
+ type_abbrev = "UI64";
+ type_c_name = "uint64_t";
+ type_value = 18;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ type_bit_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_FLOAT";
+ type_abbrev = "F";
+ type_c_name = "float";
+ type_value = 19;
+ type_floating_point;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_DOUBLE";
+ type_abbrev = "D";
+ type_c_name = "double";
+ type_value = 20;
+ type_floating_point;
+ type_atomic_ok;
+ type_numeric_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_LDOUBLE";
+ type_abbrev = "LD";
+ type_c_name = "long double";
+ type_value = 21;
+ type_floating_point;
+ type_numeric_op_ok;
+ };
+upc_type = {
+ type_upc_name = "UPC_PTS";
+ type_abbrev = "PTS";
+ type_c_name = "shared void *";
+ type_value = 22;
+ type_atomic_ok;
+ };
diff --git a/libgupc/include/upc_types.h b/libgupc/include/upc_types.h
new file mode 100644
index 00000000000..dcfc1eaab8e
--- /dev/null
+++ b/libgupc/include/upc_types.h
@@ -0,0 +1,97 @@
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_TYPES_H_
+#define _UPC_TYPES_H_
+
+
+typedef int upc_type_t;
+
+#define UPC_CHAR 1
+#define UPC_UCHAR 2
+#define UPC_SHORT 3
+#define UPC_USHORT 4
+#define UPC_INT 5
+#define UPC_UINT 6
+#define UPC_LONG 7
+#define UPC_ULONG 8
+#define UPC_LLONG 9
+#define UPC_ULLONG 10
+#define UPC_INT8 11
+#define UPC_UINT8 12
+#define UPC_INT16 13
+#define UPC_UINT16 14
+#define UPC_INT32 15
+#define UPC_UINT32 16
+#define UPC_INT64 17
+#define UPC_UINT64 18
+#define UPC_FLOAT 19
+#define UPC_DOUBLE 20
+#define UPC_LDOUBLE 21
+#define UPC_PTS 22
+
+/* Flag type for synchronization semantics
+ (and potentially other uses). */
+
+typedef int upc_flag_t;
+
+/* Synchronization flags. */
+
+#define UPC_IN_ALLSYNC (1<<0)
+#define UPC_IN_MYSYNC (1<<1)
+#define UPC_IN_NOSYNC (1<<2)
+#define UPC_OUT_ALLSYNC (1<<3)
+#define UPC_OUT_MYSYNC (1<<4)
+#define UPC_OUT_NOSYNC (1<<5)
+
+/* Operation type for upc_all_reduceT() and upc_all_prefix_reduceT(). */
+
+typedef unsigned long upc_op_t;
+
+#define UPC_ADD (1UL<<0)
+#define UPC_MULT (1UL<<1)
+#define UPC_AND (1UL<<2)
+#define UPC_OR (1UL<<3)
+#define UPC_XOR (1UL<<4)
+#define UPC_LOGAND (1UL<<5)
+#define UPC_LOGOR (1UL<<6)
+#define UPC_MIN (1UL<<7)
+#define UPC_MAX (1UL<<8)
+
+#define UPC_ADD_OP 0
+#define UPC_MULT_OP 1
+#define UPC_AND_OP 2
+#define UPC_OR_OP 3
+#define UPC_XOR_OP 4
+#define UPC_LOGAND_OP 5
+#define UPC_LOGOR_OP 6
+#define UPC_MIN_OP 7
+#define UPC_MAX_OP 8
+
+#define UPC_FIRST_OP UPC_ADD_OP
+#define UPC_LAST_OP UPC_MAX_OP
+
+#endif /* _UPC_TYPES_H_ */
diff --git a/libgupc/libgupc.spec.in b/libgupc/libgupc.spec.in
new file mode 100644
index 00000000000..35ce8e7cd56
--- /dev/null
+++ b/libgupc/libgupc.spec.in
@@ -0,0 +1,3 @@
+# This spec file is read by gcc when linking. It is used to specify the
+# standard libraries we need in order to link with -fupc.
+*link_upc: @link_upc_spec@
diff --git a/libgupc/libgupc.texi b/libgupc/libgupc.texi
new file mode 100644
index 00000000000..eb13093abb3
--- /dev/null
+++ b/libgupc/libgupc.texi
@@ -0,0 +1,215 @@
+\input texinfo @c -*-texinfo-*-
+
+@c %**start of header
+@setfilename libgupc.info
+@settitle GNU libgupc
+@c %**end of header
+
+
+@copying
+Copyright @copyright{} 2006-2016 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being ``Funding Free Software'', the Front-Cover
+texts being (a) (see below), and with the Back-Cover Texts being (b)
+(see below). A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
+
+(a) The FSF's Front-Cover Text is:
+
+ A GNU Manual
+
+(b) The FSF's Back-Cover Text is:
+
+ You have freedom to copy and modify this GNU Manual, like GNU
+ software. Copies published by the Free Software Foundation raise
+ funds for GNU development.
+@end copying
+
+@ifinfo
+@dircategory GNU Libraries
+@direntry
+* libgupc: (libgupc). GNU UPC runtime library
+@end direntry
+
+This manual documents the GNU implementation of the UPC runtime.
+multi-platform shared-memory parallel programming in C/C++ and Fortran.
+
+Published by the Free Software Foundation
+51 Franklin Street, Fifth Floor
+Boston, MA 02110-1301 USA
+
+@insertcopying
+@end ifinfo
+
+
+@setchapternewpage odd
+
+@titlepage
+@title The GNU UPC Implementation
+@page
+@vskip 0pt plus 1filll
+@comment For the @value{version-GCC} Version*
+@sp 1
+Published by the Free Software Foundation @*
+51 Franklin Street, Fifth Floor@*
+Boston, MA 02110-1301, USA@*
+@sp 1
+@insertcopying
+@end titlepage
+
+@summarycontents
+@contents
+@page
+
+
+@node Top
+@top Introduction
+@cindex Introduction
+
+This manual documents the usage of libgupc, the GNU runtime library
+implementation of the
+@w{@uref{http://upc.lbl.gov/publications/upc-spec-1.3.pdf, UPC}}
+language extensions for shared-memory parallel programming in C.
+
+@comment
+@comment When you add a new menu item, please keep the right hand
+@comment aligned to the same column. Do not use tabs. This provides
+@comment better formatting.
+@comment
+@menu
+* Enabling UPC:: How to enable UPC for your applications.
+* Configuring Libgupc:: How to configure the UPC runtime library.
+* Runtime Library Routines:: The UPC runtime application programming
+ interface.
+* The libgupc ABI:: Notes on the external ABI presented by libgupc.
+* Environment Variables:: Influencing runtime behavior with environment
+ variables.
+* Reporting Bugs:: How to report bugs in GNU UPC.
+* Copying:: GNU general public license says
+ how you can copy and share libgupc.
+* GNU Free Documentation License::
+ How you can copy and share this manual.
+* Funding:: How to help assure continued work for free
+ software.
+* Library Index:: Index of this documentation.
+@end menu
+
+@c ---------------------------------------------------------------------
+@c Enabling UPC
+@c ---------------------------------------------------------------------
+
+@node Enabling UPC
+@chapter Enabling UPC
+
+To activate the UPC extensions for C, the compile-time
+flag @command{-fupc} must be specified. This enables the UPC language
+extensions which include the @code{shared} type qualifier
+and various synchronization statements such as @code{upc_barrier}.
+The flag also arranges for automatic linking of the UPC runtime library
+(@ref{Runtime Library Routines}).
+
+Alternatively, two command line drivers can be invoked: @command{upc}
+and @command{gupc}. These drivers are wrappers around the @command{gcc}
+and will automatically supply the @option{-fupc} option and
+will default the compilation of @file{*.c} files as UPC language source.
+
+The @samp{libgomp} runtime library supports both a single-node
+Symmetric Memory Processor (@samp{smp}) and a multi-node distributed
+(@samp{portals4}) target configurations. The target configuration
+is selected via the @command{configure} command when the library is
+built. See @ref{Configuring Libgupc} for details.
+
+@c ---------------------------------------------------------------------
+@c Configuring Libgupc
+@c ---------------------------------------------------------------------
+
+@node Configuring Libgupc
+@chapter Configuring Libgupc
+
+@menu
+* SMP Configuration:: How to configure libgupc for SMP single-node
+ operation.
+* Portals4 Configuration:: How to configure libgupc for multi-node
+ operation using the Portals4 communication
+ library.
+@end menu
+
+@node SMP Configuration
+@section SMP Configuration
+@cindex Configuration
+@cindex SMP Configuration
+
+@node Portals4 Configuration
+@section Portals4 Configuration
+@cindex Configuration
+@cindex Portals4 Configuration
+
+@c ---------------------------------------------------------------------
+@c Runtime Library Routines
+@c ---------------------------------------------------------------------
+
+@node Runtime Library Routines
+@chapter Runtime Library Routines
+
+@c ---------------------------------------------------------------------
+@c The libgupc ABI
+@c ---------------------------------------------------------------------
+
+@node The libgupc ABI
+@chapter The libgupc ABI
+
+@c ---------------------------------------------------------------------
+@c Environment Variables
+@c ---------------------------------------------------------------------
+
+@node Environment Variables
+@chapter Environment Variables
+
+@c ---------------------------------------------------------------------
+@c
+@c ---------------------------------------------------------------------
+
+@node Reporting Bugs
+@chapter Reporting Bugs
+
+Bugs in the GNU UPC implementation should be reported via
+@uref{http://gcc.gnu.org/bugzilla/, Bugzilla}. For all cases, please add
+"UPC" to the keywords field in the bug report.
+
+
+
+@c ---------------------------------------------------------------------
+@c GNU General Public License
+@c ---------------------------------------------------------------------
+
+@include gpl_v3.texi
+
+
+
+@c ---------------------------------------------------------------------
+@c GNU Free Documentation License
+@c ---------------------------------------------------------------------
+
+@include fdl.texi
+
+
+
+@c ---------------------------------------------------------------------
+@c Funding Free Software
+@c ---------------------------------------------------------------------
+
+@include funding.texi
+
+@c ---------------------------------------------------------------------
+@c Index
+@c ---------------------------------------------------------------------
+
+@node Library Index
+@unnumbered Library Index
+
+@printindex cp
+
+@bye
diff --git a/libgupc/portals4/doxygen.cfg.in b/libgupc/portals4/doxygen.cfg.in
new file mode 100644
index 00000000000..4b50f6fcf1f
--- /dev/null
+++ b/libgupc/portals4/doxygen.cfg.in
@@ -0,0 +1,1722 @@
+# Doxyfile 1.7.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = @PACKAGE@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = @PACKAGE_VERSION@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF = @PACKAGE_NAME@
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO = @DOXYGEN_HTML_LOGO@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = @DX_DOCDIR@
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH = @top_srcdir@/portals4
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = YES
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING = upc=C
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penalty.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will roughly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = @top_srcdir@/config.h.in \
+ gcc-upc-lib.h @top_srcdir@/portals4
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS = *.c *.h *.upc
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS = */config.h.in=@top_srcdir@/dox-filter-config-h
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header. Note that when using a custom header you are responsible
+# for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# If the HTML_TIMESTAMP tag is set to YES then the generated HTML
+# documentation will contain the timesstamp.
+
+HTML_TIMESTAMP = NO
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the
+# mathjax.org site, so you can quickly see the result without installing
+# MathJax, but it is strongly recommended to install a local copy of MathJax
+# before deployment.
+
+MATHJAX_RELPATH = http://www.mathjax.org/mathjax
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvantages are that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = @DX_LATEX@
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = letter
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER = header.tex
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = YES
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = YES
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = @HAVE_DOT@
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS = 0
+
+# By default doxygen will write a font called Helvetica to the output
+# directory and reference it in all dot files that doxygen generates.
+# When you want a differently looking font you can specify the font name
+# using DOT_FONTNAME. You need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = YES
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH = @DX_DOT@
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/libgupc/portals4/gcc-upc-lib.in b/libgupc/portals4/gcc-upc-lib.in
new file mode 100644
index 00000000000..c9477434599
--- /dev/null
+++ b/libgupc/portals4/gcc-upc-lib.in
@@ -0,0 +1,171 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _GCC_UPC_LIB_H_
+#define _GCC_UPC_LIB_H_ 1
+
+#ifdef IN_TARGET_LIBS
+#include "config.h"
+#include <unistd.h>
+#endif /* IN_TARGET_LIBS */
+
+/* Required for size_t definition. */
+#include <stddef.h>
+
+#pragma upc c_code
+
+/* Helper macros for expanding the value of a macro as a string. */
+#define __UPC_STR__(S) #S
+#define __UPC_XSTR__(S) __UPC_STR__(S)
+
+#ifdef __UPC_STATIC_THREADS__
+/* Defined at compile time by the -fupc-threads=N switch. */
+#define __UPC_N_THREADS__ THREADS
+#define __UPC_STR__(S) #S
+#define __UPC_XSTR__(S) __UPC_STR__(S)
+#define __UPC_THREADS_CONFIG__ " staticthreads=" __UPC_XSTR__(THREADS)
+#else
+/* Defined at run time. */
+extern const int THREADS;
+#define __UPC_N_THREADS__ -1
+#define __UPC_THREADS_CONFIG__ "dynamicthreads"
+#endif
+
+#define __UPC_THREADS_MODEL__ "process"
+
+/* Support for atomics - UPC Specification 1.3. */
+#define __UPC_ATOMIC__ 1
+
+/* Support for castability - UPC Specification 1.3. */
+#define __UPC_CASTABLE__ 1
+
+/* Support for UPC collectives. */
+#define __UPC_COLLECTIVE__ 1
+
+/* Support for non-blocking transfer operations - UPC Specification 1.3. */
+#define __UPC_NB__ 1
+
+/* Support for GASP - http://gasp.hcs.ufl.edu/. */
+#define __UPC_PUPC__ 1
+
+/* Support for high-performance wall-clock timer - UPC Specification 1.3. */
+#define __UPC_TICK__ 1
+
+#pragma upc upc_code
+/* Opaque data type for referencing UPC atomic domains. */
+typedef shared struct upc_atomicdomain_struct upc_atomicdomain_t;
+#pragma upc c_code
+
+/* Place configuration information required by the Berkeley
+ UPC compilation system into the object file. */
+static const char GCCUPCConfig[]
+#if __MACH__
+ __attribute__ ((section ("__DATA,upc_pgm_info"))) __attribute__ ((used)) =
+#else
+ __attribute__ ((section ("upc_pgm_info"))) __attribute__ ((used)) =
+#endif
+ "$GCCUPCConfig: (" __BASE_FILE__ ") "
+ __UPC_THREADS_CONFIG__ " " __UPC_THREADS_MODEL__ "$";
+
+#undef __UPC_XSTR__
+#undef __UPC_STR__
+
+extern const int MYTHREAD;
+
+/* Depth count used to implement the semantics of
+ nested upc_forall statements. */
+extern int __upc_forall_depth;
+
+/* The UPC runtime's main program must run first,
+ we rename the user's main to upc_main(). */
+#if __MACH__
+extern int
+main ()
+__asm__ ("_upc_main");
+#else
+extern int
+main ()
+__asm__ ("upc_main");
+#endif
+
+/* Remap calls to exit so that they invoke the UPC runtime's
+ implementation of exit instead. */
+#define exit __upc_exit
+
+/* Implementation of upc_fence. */
+#define upc_fence __upc_fence()
+
+/* upc_shared_ptr_t is predefined as the representation of
+ a shared pointer type. */
+
+/* Runtime variables used by optimized code generation
+ on some targets. */
+/* The base address of the UPC shared section. */
+extern char __upc_shared_start[1];
+
+/* Runtime procedures. */
+//include lib_runtime_api
+
+//include detect_target64
+
+/* Runtime shared access procedures. */
+//include mode_types
+
+#if defined (__UPC_INLINE_LIB__) || defined (IN_TARGET_LIBS)
+
+/* Library routines have access to runtime internals. */
+
+//include gupcr_config_h
+//include lib_min_max
+//include lib_config_heap
+//include lib_config_shared_section
+//include lib_pts_defs
+
+#endif /* __UPC_INLINE_LIB__ || IN_TARGET_LIBS */
+
+#ifdef __UPC_INLINE_LIB__
+
+//include lib_mem_barrier
+//include lib_gmem
+//include lib_node_local
+//include lib_max_threads_def
+/* Must include stdio.h because of FILE def. */
+#include <stdio.h>
+//include lib_utils_api
+//include lib_portals
+//include lib_inline_gmem
+/* We need to include <string.h> to define memcpy() */
+#include <string.h>
+//include lib_inline_access
+
+#else
+
+//include lib_access_prototypes
+
+#endif /* __UPC_INLINE_LIB__ */
+
+#endif /* !_GCC_UPC_LIB_H_ */
diff --git a/libgupc/portals4/gupcr_access.c b/libgupc/portals4/gupcr_access.c
new file mode 100644
index 00000000000..f7efb57c1f1
--- /dev/null
+++ b/libgupc/portals4/gupcr_access.c
@@ -0,0 +1,1851 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_access.h"
+#include "gupcr_sync.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_node.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+
+/**
+ * @file gupcr_access.c
+ * GUPC compiler access functions.
+ */
+
+/**
+ * @addtogroup IFACE GUPC Interface Routines
+ * @{
+ */
+
+//begin lib_inline_access
+
+/**
+ * Relaxed shared "char (8 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Char (8 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intQI_t
+__getqi2 (upc_shared_ptr_t p)
+{
+ u_intQI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R QI LOCAL");
+ result = *(u_intQI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R QI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%x",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Relaxed shared "short (16 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Short (16 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intHI_t
+__gethi2 (upc_shared_ptr_t p)
+{
+ u_intHI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R HI LOCAL");
+ result = *(u_intHI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R HI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%x",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Relaxed shared "int (32 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Int (32 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intSI_t
+__getsi2 (upc_shared_ptr_t p)
+{
+ u_intSI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R SI LOCAL");
+ result = *(u_intSI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R SI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%x",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Relaxed shared "long (64 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Long (64 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intDI_t
+__getdi2 (upc_shared_ptr_t p)
+{
+ u_intDI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R DI LOCAL");
+ result = *(u_intDI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R DI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%llx",
+ thread, (long unsigned) offset, (long long unsigned) result);
+ return result;
+}
+
+#if GUPCR_TARGET64
+/**
+ * Relaxed shared "long long (128 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Long long (128 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intTI_t
+__getti2 (upc_shared_ptr_t p)
+{
+ u_intTI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R TI LOCAL");
+ result = *(u_intTI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R TI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%llx",
+ thread, (long unsigned) offset, (long long unsigned) result);
+ return result;
+}
+#endif /* GUPCR_TARGET64 */
+/**
+ * Relaxed shared "float" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Float value at the shared address given by 'p'.
+ */
+//inline
+float
+__getsf2 (upc_shared_ptr_t p)
+{
+ float result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R SF LOCAL");
+ result = *(float *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R SF REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx %6g",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Relaxed shared "double" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Double value at the shared address given by 'p'.
+ */
+//inline
+double
+__getdf2 (upc_shared_ptr_t p)
+{
+ double result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R DF LOCAL");
+ result = *(double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R DF REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx %6g",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Relaxed shared "long double" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Long double value at the shared address given by 'p'.
+ */
+//inline
+long double
+__gettf2 (upc_shared_ptr_t p)
+{
+ long double result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R TF LOCAL");
+ result = *(long double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R TF REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx %6Lg",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Relaxed shared "long double" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Long double value at the shared address given by 'p'.
+ */
+//inline
+long double
+__getxf2 (upc_shared_ptr_t p)
+{
+ long double result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R XF LOCAL");
+ result = *(long double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER R XF REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx %6Lg",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Relaxed shared memory block get operation.
+ * Copy the data at the shared address 'src' into the local memory
+ * destination at the address 'dest'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] dest Local address of the destination memory block.
+ * @param [in] src Shared address of the source memory block.
+ * @param [in] n Number of bytes to transfer.
+ */
+//inline
+void
+__getblk3 (void *dest, upc_shared_ptr_t src, size_t n)
+{
+ int thread = GUPCR_PTS_THREAD (src);
+ size_t offset = GUPCR_PTS_OFFSET (src);
+ gupcr_trace (FC_MEM, "GETBLK ENTER R");
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ GUPCR_MEM_BARRIER ();
+ memcpy (dest, GUPCR_GMEM_OFF_TO_LOCAL (thread, offset), n);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_gmem_get (dest, thread, offset, n);
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GETBLK EXIT R %d:0x%lx 0x%lx %lu",
+ thread, (long unsigned) offset,
+ (long unsigned) dest, (long unsigned) n);
+}
+
+/**
+ * Relaxed shared "char (8 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putqi2 (upc_shared_ptr_t p, u_intQI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R QI LOCAL "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ *(u_intQI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R QI REMOTE "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ /* There can be only one outstanding unordered put. */
+ gupcr_pending_strict_put = 1;
+ }
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT R QI");
+}
+
+/**
+ * Relaxed shared "short (16 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__puthi2 (upc_shared_ptr_t p, u_intHI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R HI LOCAL "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ *(u_intHI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R HI REMOTE "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ /* There can be only one outstanding unordered put. */
+ gupcr_pending_strict_put = 1;
+ }
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT R HI");
+}
+
+/**
+ * Relaxed shared "int (32 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putsi2 (upc_shared_ptr_t p, u_intSI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R SI LOCAL "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ *(u_intSI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R SI REMOTE "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ /* There can be only one outstanding unordered put. */
+ gupcr_pending_strict_put = 1;
+ }
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT R SI");
+}
+
+/**
+ * Relaxed shared "long (64 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putdi2 (upc_shared_ptr_t p, u_intDI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R DI LOCAL "
+ "0x%llx %d:0x%lx",
+ (long long unsigned) v, thread, (long unsigned) offset);
+ *(u_intDI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R DI REMOTE "
+ "0x%llx %d:0x%lx",
+ (long long unsigned) v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ /* There can be only one outstanding unordered put. */
+ gupcr_pending_strict_put = 1;
+ }
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT R DI");
+}
+
+#if GUPCR_TARGET64
+/**
+ * Relaxed shared "long long (128 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putti2 (upc_shared_ptr_t p, u_intTI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R TI LOCAL "
+ "0x%llx %d:0x%lx",
+ (long long unsigned) v, thread, (long unsigned) offset);
+ *(u_intTI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R TI REMOTE "
+ "0x%llx %d:0x%lx",
+ (long long unsigned) v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ /* There can be only one outstanding unordered put. */
+ gupcr_pending_strict_put = 1;
+ }
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT R TI");
+}
+#endif /* GUPCR_TARGET64 */
+/**
+ * Relaxed shared "float" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putsf2 (upc_shared_ptr_t p, float v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R SF LOCAL "
+ "%6g %d:0x%lx", v, thread, (long unsigned) offset);
+ *(float *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R SF REMOTE "
+ "%6g %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ /* There can be only one outstanding unordered put. */
+ gupcr_pending_strict_put = 1;
+ }
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT R SF");
+}
+
+/**
+ * Relaxed shared "double" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putdf2 (upc_shared_ptr_t p, double v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R DF LOCAL "
+ "%6g %d:0x%lx", v, thread, (long unsigned) offset);
+ *(double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R DF REMOTE "
+ "%6g %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ /* There can be only one outstanding unordered put. */
+ gupcr_pending_strict_put = 1;
+ }
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT R DF");
+}
+
+/**
+ * Relaxed shared "long double" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__puttf2 (upc_shared_ptr_t p, long double v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R TF LOCAL "
+ "%6Lg %d:0x%lx", v, thread, (long unsigned) offset);
+ *(long double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R TF REMOTE "
+ "%6Lg %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ /* There can be only one outstanding unordered put. */
+ gupcr_pending_strict_put = 1;
+ }
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT R TF");
+}
+
+/**
+ * Relaxed shared "long double" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putxf2 (upc_shared_ptr_t p, long double v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R XF LOCAL "
+ "%6Lg %d:0x%lx", v, thread, (long unsigned) offset);
+ *(long double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER R XF REMOTE "
+ "%6Lg %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ /* There can be only one outstanding unordered put. */
+ gupcr_pending_strict_put = 1;
+ }
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT R XF");
+}
+
+/**
+ * Relaxed shared memory block put operation.
+ * Copy the data at the local address 'src' into the shared memory
+ * destination at the address 'dest'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] dest Shared address of the destination memory block.
+ * @param [in] src Local address of the source memory block.
+ * @param [in] n Number of bytes to transfer.
+ */
+//inline
+void
+__putblk3 (upc_shared_ptr_t dest, void *src, size_t n)
+{
+ int thread = GUPCR_PTS_THREAD (dest);
+ size_t offset = GUPCR_PTS_OFFSET (dest);
+ gupcr_trace (FC_MEM, "PUTBLK ENTER R 0x%lx %d:0x%lx %lu",
+ (long unsigned) src, thread,
+ (long unsigned) offset, (long unsigned) n);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ memcpy (GUPCR_GMEM_OFF_TO_LOCAL (thread, offset), src, n);
+ }
+ else
+ {
+ gupcr_gmem_put (thread, offset, src, n);
+ }
+ gupcr_trace (FC_MEM, "PUT_BLK EXIT R");
+}
+
+/**
+ * Relaxed shared memory block copy operation.
+ * Copy the data at the shared address 'src' into the shared memory
+ * destination at the address 'dest'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] dest Shared address of destination memory block.
+ * @param [in] src Shared address of source memory block.
+ * @param [in] n Number of bytes to transfer.
+ */
+//inline
+void
+__copyblk3 (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t n)
+{
+ int dthread = GUPCR_PTS_THREAD (dest);
+ size_t doffset = GUPCR_PTS_OFFSET (dest);
+ int sthread = GUPCR_PTS_THREAD (src);
+ size_t soffset = GUPCR_PTS_OFFSET (src);
+ gupcr_trace (FC_MEM, "COPYBLK ENTER R %d:0x%lx %d:0x%lx %lu",
+ sthread, (long unsigned) soffset,
+ dthread, (long unsigned) doffset, (long unsigned) n);
+ gupcr_assert (dthread < THREADS);
+ gupcr_assert (doffset != 0);
+ gupcr_assert (sthread < THREADS);
+ gupcr_assert (soffset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (dthread) && GUPCR_GMEM_IS_LOCAL (sthread))
+ {
+ memcpy (GUPCR_GMEM_OFF_TO_LOCAL (dthread, doffset),
+ GUPCR_GMEM_OFF_TO_LOCAL (sthread, soffset), n);
+ }
+ else if (GUPCR_GMEM_IS_LOCAL (dthread))
+ {
+ gupcr_gmem_get (GUPCR_GMEM_OFF_TO_LOCAL (dthread, doffset),
+ sthread, soffset, n);
+ gupcr_gmem_sync_gets ();
+ }
+ else if (GUPCR_GMEM_IS_LOCAL (sthread))
+ {
+ gupcr_gmem_put (dthread, doffset,
+ GUPCR_GMEM_OFF_TO_LOCAL (sthread, soffset), n);
+ }
+ else
+ {
+ gupcr_gmem_copy (dthread, doffset, sthread, soffset, n);
+ }
+ gupcr_trace (FC_MEM, "COPY_BLK EXIT R");
+}
+
+/**
+ * Strict shared "char (8 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Char (8 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intQI_t
+__getsqi2 (upc_shared_ptr_t p)
+{
+ u_intQI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S QI LOCAL");
+ GUPCR_MEM_BARRIER ();
+ result = *(u_intQI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S QI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%x",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Strict shared "short (16 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Short (16 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intHI_t
+__getshi2 (upc_shared_ptr_t p)
+{
+ u_intHI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S HI LOCAL");
+ GUPCR_MEM_BARRIER ();
+ result = *(u_intHI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S HI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%x",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Strict shared "int (32 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Int (32 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intSI_t
+__getssi2 (upc_shared_ptr_t p)
+{
+ u_intSI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S SI LOCAL");
+ GUPCR_MEM_BARRIER ();
+ result = *(u_intSI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S SI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%x",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Strict shared "long (64 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Long (64 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intDI_t
+__getsdi2 (upc_shared_ptr_t p)
+{
+ u_intDI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S DI LOCAL");
+ GUPCR_MEM_BARRIER ();
+ result = *(u_intDI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S DI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%llx",
+ thread, (long unsigned) offset, (long long unsigned) result);
+ return result;
+}
+
+#if GUPCR_TARGET64
+/**
+ * Strict shared "long long (128 bits)" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Long long (128 bits) value at the shared address given by 'p'.
+ */
+//inline
+u_intTI_t
+__getsti2 (upc_shared_ptr_t p)
+{
+ u_intTI_t result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S TI LOCAL");
+ GUPCR_MEM_BARRIER ();
+ result = *(u_intTI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S TI REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx 0x%llx",
+ thread, (long unsigned) offset, (long long unsigned) result);
+ return result;
+}
+#endif /* GUPCR_TARGET64 */
+/**
+ * Strict shared "float" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Float value at the shared address given by 'p'.
+ */
+//inline
+float
+__getssf2 (upc_shared_ptr_t p)
+{
+ float result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S SF LOCAL");
+ GUPCR_MEM_BARRIER ();
+ result = *(float *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S SF REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx %6g",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Strict shared "double" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Double value at the shared address given by 'p'.
+ */
+//inline
+double
+__getsdf2 (upc_shared_ptr_t p)
+{
+ double result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S DF LOCAL");
+ GUPCR_MEM_BARRIER ();
+ result = *(double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S DF REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx %6g",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Strict shared "long double" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Long double value at the shared address given by 'p'.
+ */
+//inline
+long double
+__getstf2 (upc_shared_ptr_t p)
+{
+ long double result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S TF LOCAL");
+ GUPCR_MEM_BARRIER ();
+ result = *(long double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S TF REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx %6Lg",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Strict shared "long double" get operation.
+ * Return the value at the shared address 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the source operand.
+ * @return Long double value at the shared address given by 'p'.
+ */
+//inline
+long double
+__getsxf2 (upc_shared_ptr_t p)
+{
+ long double result;
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S XF LOCAL");
+ GUPCR_MEM_BARRIER ();
+ result = *(long double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "GET ENTER S XF REMOTE");
+ gupcr_gmem_get (&result, thread, offset, sizeof (result));
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GET EXIT %d:0x%lx %6Lg",
+ thread, (long unsigned) offset, result);
+ return result;
+}
+
+/**
+ * Strict shared memory block get operation.
+ * Copy the data at the shared address 'src' into the local memory
+ * destination at the address 'dest'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] dest Local address of the destination memory block.
+ * @param [in] src Shared address of the source memory block.
+ * @param [in] n Number of bytes to transfer.
+ */
+//inline
+void
+__getsblk3 (void *dest, upc_shared_ptr_t src, size_t n)
+{
+ int thread = GUPCR_PTS_THREAD (src);
+ size_t offset = GUPCR_PTS_OFFSET (src);
+ gupcr_trace (FC_MEM, "GETBLK ENTER S");
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ GUPCR_MEM_BARRIER ();
+ memcpy (dest, GUPCR_GMEM_OFF_TO_LOCAL (thread, offset), n);
+ GUPCR_READ_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_gmem_get (dest, thread, offset, n);
+ /* All 'get' operations are synchronous. */
+ gupcr_gmem_sync_gets ();
+ }
+ gupcr_trace (FC_MEM, "GETBLK EXIT S %d:0x%lx 0x%lx %lu",
+ thread, (long unsigned) offset,
+ (long unsigned) dest, (long unsigned) n);
+}
+
+/**
+ * Strict shared "char (8 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putsqi2 (upc_shared_ptr_t p, u_intQI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S QI LOCAL "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ GUPCR_WRITE_MEM_BARRIER ();
+ *(u_intQI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S QI REMOTE "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT S QI");
+}
+
+/**
+ * Strict shared "short (16 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putshi2 (upc_shared_ptr_t p, u_intHI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S HI LOCAL "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ GUPCR_WRITE_MEM_BARRIER ();
+ *(u_intHI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S HI REMOTE "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT S HI");
+}
+
+/**
+ * Strict shared "int (32 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putssi2 (upc_shared_ptr_t p, u_intSI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S SI LOCAL "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ GUPCR_WRITE_MEM_BARRIER ();
+ *(u_intSI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S SI REMOTE "
+ "0x%x %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT S SI");
+}
+
+/**
+ * Strict shared "long (64 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putsdi2 (upc_shared_ptr_t p, u_intDI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S DI LOCAL "
+ "0x%llx %d:0x%lx",
+ (long long unsigned) v, thread, (long unsigned) offset);
+ GUPCR_WRITE_MEM_BARRIER ();
+ *(u_intDI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S DI REMOTE "
+ "0x%llx %d:0x%lx",
+ (long long unsigned) v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT S DI");
+}
+
+#if GUPCR_TARGET64
+/**
+ * Strict shared "long long (128 bits)" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putsti2 (upc_shared_ptr_t p, u_intTI_t v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S TI LOCAL "
+ "0x%llx %d:0x%lx",
+ (long long unsigned) v, thread, (long unsigned) offset);
+ GUPCR_WRITE_MEM_BARRIER ();
+ *(u_intTI_t *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S TI REMOTE "
+ "0x%llx %d:0x%lx",
+ (long long unsigned) v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT S TI");
+}
+#endif /* GUPCR_TARGET64 */
+/**
+ * Strict shared "float" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putssf2 (upc_shared_ptr_t p, float v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S SF LOCAL "
+ "%6g %d:0x%lx", v, thread, (long unsigned) offset);
+ GUPCR_WRITE_MEM_BARRIER ();
+ *(float *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S SF REMOTE "
+ "%6g %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT S SF");
+}
+
+/**
+ * Strict shared "double" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putsdf2 (upc_shared_ptr_t p, double v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S DF LOCAL "
+ "%6g %d:0x%lx", v, thread, (long unsigned) offset);
+ GUPCR_WRITE_MEM_BARRIER ();
+ *(double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S DF REMOTE "
+ "%6g %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT S DF");
+}
+
+/**
+ * Strict shared "long double" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putstf2 (upc_shared_ptr_t p, long double v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S TF LOCAL "
+ "%6Lg %d:0x%lx", v, thread, (long unsigned) offset);
+ GUPCR_WRITE_MEM_BARRIER ();
+ *(long double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S TF REMOTE "
+ "%6Lg %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT S TF");
+}
+
+/**
+ * Strict shared "long double" put operation.
+ * Store the value given by 'v' into the shared memory destination at 'p'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] p Shared address of the destination address.
+ * @param [in] v Source value.
+ */
+//inline
+void
+__putsxf2 (upc_shared_ptr_t p, long double v)
+{
+ int thread = GUPCR_PTS_THREAD (p);
+ size_t offset = GUPCR_PTS_OFFSET (p);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S XF LOCAL "
+ "%6Lg %d:0x%lx", v, thread, (long unsigned) offset);
+ GUPCR_WRITE_MEM_BARRIER ();
+ *(long double *) GUPCR_GMEM_OFF_TO_LOCAL (thread, offset) = v;
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_trace (FC_MEM, "PUT ENTER S XF REMOTE "
+ "%6Lg %d:0x%lx", v, thread, (long unsigned) offset);
+ if (sizeof (v) <= (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ /* Ordered puts can proceed in parallel. */
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ else
+ {
+ /* Wait for any outstanding 'put' operation. */
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (thread, offset, &v, sizeof (v));
+ }
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT EXIT S XF");
+}
+
+/**
+ * Strict shared memory block put operation.
+ * Copy the data at the local address 'src' into the shared memory
+ * destination at the address 'dest'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] dest Shared address of the destination memory block.
+ * @param [in] src Local address of the source memory block.
+ * @param [in] n Number of bytes to transfer.
+ */
+//inline
+void
+__putsblk3 (upc_shared_ptr_t dest, void *src, size_t n)
+{
+ int thread = GUPCR_PTS_THREAD (dest);
+ size_t offset = GUPCR_PTS_OFFSET (dest);
+ gupcr_trace (FC_MEM, "PUTBLK ENTER S 0x%lx %d:0x%lx %lu",
+ (long unsigned) src, thread,
+ (long unsigned) offset, (long unsigned) n);
+ gupcr_assert (thread < THREADS);
+ gupcr_assert (offset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ GUPCR_WRITE_MEM_BARRIER ();
+ memcpy (GUPCR_GMEM_OFF_TO_LOCAL (thread, offset), src, n);
+ GUPCR_MEM_BARRIER ();
+ }
+ else
+ {
+ gupcr_gmem_put (thread, offset, src, n);
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "PUT_BLK EXIT S");
+}
+
+/**
+ * Strict shared memory block copy operation.
+ * Copy the data at the shared address 'src' into the shared memory
+ * destination at the address 'dest'.
+ *
+ * The interface to this procedure is defined by the UPC compiler API.
+ *
+ * @param [in] dest Shared address of destination memory block.
+ * @param [in] src Shared address of source memory block.
+ * @param [in] n Number of bytes to transfer.
+ */
+//inline
+void
+__copysblk3 (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t n)
+{
+ int dthread = GUPCR_PTS_THREAD (dest);
+ size_t doffset = GUPCR_PTS_OFFSET (dest);
+ int sthread = GUPCR_PTS_THREAD (src);
+ size_t soffset = GUPCR_PTS_OFFSET (src);
+ gupcr_trace (FC_MEM, "COPYBLK ENTER S %d:0x%lx %d:0x%lx %lu",
+ sthread, (long unsigned) soffset,
+ dthread, (long unsigned) doffset, (long unsigned) n);
+ gupcr_assert (dthread < THREADS);
+ gupcr_assert (doffset != 0);
+ gupcr_assert (sthread < THREADS);
+ gupcr_assert (soffset != 0);
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ if (GUPCR_GMEM_IS_LOCAL (dthread) && GUPCR_GMEM_IS_LOCAL (sthread))
+ {
+ GUPCR_WRITE_MEM_BARRIER ();
+ memcpy (GUPCR_GMEM_OFF_TO_LOCAL (dthread, doffset),
+ GUPCR_GMEM_OFF_TO_LOCAL (sthread, soffset), n);
+ GUPCR_MEM_BARRIER ();
+ }
+ else if (GUPCR_GMEM_IS_LOCAL (dthread))
+ {
+ gupcr_gmem_get (GUPCR_GMEM_OFF_TO_LOCAL (dthread, doffset),
+ sthread, soffset, n);
+ gupcr_gmem_sync_gets ();
+ }
+ else if (GUPCR_GMEM_IS_LOCAL (sthread))
+ {
+ gupcr_gmem_put (dthread, doffset,
+ GUPCR_GMEM_OFF_TO_LOCAL (sthread, soffset), n);
+ gupcr_pending_strict_put = 1;
+ }
+ else
+ {
+ gupcr_gmem_copy (dthread, doffset, sthread, soffset, n);
+ gupcr_pending_strict_put = 1;
+ }
+ gupcr_trace (FC_MEM, "COPY_BLK EXIT S");
+}
+
+/**
+ * upc_fence implementation.
+ */
+//inline
+void
+__upc_fence (void)
+{
+ GUPCR_MEM_BARRIER ();
+ gupcr_gmem_sync ();
+}
+
+//end lib_inline_access
+/** @} */
diff --git a/libgupc/portals4/gupcr_access.h b/libgupc/portals4/gupcr_access.h
new file mode 100644
index 00000000000..06647845048
--- /dev/null
+++ b/libgupc/portals4/gupcr_access.h
@@ -0,0 +1,179 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _GUPCR_ACCESS_H_
+#define _GUPCR_ACCESS_H_
+
+/**
+ * @file gupcr_access.h
+ * GUPC compiler access functions prototypes.
+ */
+
+//begin lib_access_prototypes
+/* Relaxed accesses. */
+
+extern u_intQI_t __getqi2 (upc_shared_ptr_t);
+extern u_intHI_t __gethi2 (upc_shared_ptr_t);
+extern u_intSI_t __getsi2 (upc_shared_ptr_t);
+extern u_intDI_t __getdi2 (upc_shared_ptr_t);
+#if GUPCR_TARGET64
+extern u_intTI_t __getti2 (upc_shared_ptr_t);
+#endif
+extern float __getsf2 (upc_shared_ptr_t);
+extern double __getdf2 (upc_shared_ptr_t);
+extern long double __gettf2 (upc_shared_ptr_t);
+extern long double __getxf2 (upc_shared_ptr_t);
+extern void __getblk3 (void *, upc_shared_ptr_t, size_t);
+
+extern void __putqi2 (upc_shared_ptr_t, u_intQI_t);
+extern void __puthi2 (upc_shared_ptr_t, u_intHI_t);
+extern void __putsi2 (upc_shared_ptr_t, u_intSI_t);
+extern void __putdi2 (upc_shared_ptr_t, u_intDI_t);
+#if GUPCR_TARGET64
+extern void __putti2 (upc_shared_ptr_t, u_intTI_t);
+#endif
+extern void __putsf2 (upc_shared_ptr_t, float);
+extern void __putdf2 (upc_shared_ptr_t, double);
+extern void __puttf2 (upc_shared_ptr_t, long double);
+extern void __putxf2 (upc_shared_ptr_t, long double);
+extern void __putblk3 (upc_shared_ptr_t, void *, size_t);
+extern void __copyblk3 (upc_shared_ptr_t, upc_shared_ptr_t, size_t);
+
+/* Strict accesses. */
+
+extern u_intQI_t __getsqi2 (upc_shared_ptr_t);
+extern u_intHI_t __getshi2 (upc_shared_ptr_t);
+extern u_intSI_t __getssi2 (upc_shared_ptr_t);
+extern u_intDI_t __getsdi2 (upc_shared_ptr_t);
+#if GUPCR_TARGET64
+extern u_intTI_t __getsti2 (upc_shared_ptr_t);
+#endif
+extern float __getssf2 (upc_shared_ptr_t);
+extern double __getsdf2 (upc_shared_ptr_t);
+extern long double __getstf2 (upc_shared_ptr_t);
+extern long double __getsxf2 (upc_shared_ptr_t);
+extern void __getsblk3 (void *, upc_shared_ptr_t, size_t);
+
+extern void __putsqi2 (upc_shared_ptr_t, u_intQI_t);
+extern void __putshi2 (upc_shared_ptr_t, u_intHI_t);
+extern void __putssi2 (upc_shared_ptr_t, u_intSI_t);
+extern void __putsdi2 (upc_shared_ptr_t, u_intDI_t);
+#if GUPCR_TARGET64
+extern void __putsti2 (upc_shared_ptr_t, u_intTI_t);
+#endif
+extern void __putssf2 (upc_shared_ptr_t, float);
+extern void __putsdf2 (upc_shared_ptr_t, double);
+extern void __putstf2 (upc_shared_ptr_t, long double);
+extern void __putsxf2 (upc_shared_ptr_t, long double);
+extern void __putsblk3 (upc_shared_ptr_t, void *, size_t);
+extern void __copysblk3 (upc_shared_ptr_t, upc_shared_ptr_t, size_t);
+
+/* Relaxed accesses (profiled). */
+
+extern u_intQI_t __getgqi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intHI_t __getghi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intSI_t __getgsi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intDI_t __getgdi3 (upc_shared_ptr_t, const char *file, int line);
+#if GUPCR_TARGET64
+extern u_intTI_t __getgti3 (upc_shared_ptr_t, const char *file, int line);
+#endif
+extern float __getgsf3 (upc_shared_ptr_t, const char *file, int line);
+extern double __getgdf3 (upc_shared_ptr_t, const char *file, int line);
+extern long double __getgtf3 (upc_shared_ptr_t, const char *file, int line);
+extern long double __getgxf3 (upc_shared_ptr_t, const char *file, int line);
+extern void __getgblk5 (void *, upc_shared_ptr_t, size_t, const char *file,
+ int line);
+
+extern void __putgqi4 (upc_shared_ptr_t, u_intQI_t, const char *file,
+ int line);
+extern void __putghi4 (upc_shared_ptr_t, u_intHI_t, const char *file,
+ int line);
+extern void __putgsi4 (upc_shared_ptr_t, u_intSI_t, const char *file,
+ int line);
+extern void __putgdi4 (upc_shared_ptr_t, u_intDI_t, const char *file,
+ int line);
+#if GUPCR_TARGET64
+extern void __putgti4 (upc_shared_ptr_t, u_intTI_t, const char *file,
+ int line);
+#endif
+extern void __putgsf4 (upc_shared_ptr_t, float, const char *file, int line);
+extern void __putgdf4 (upc_shared_ptr_t, double, const char *file, int line);
+extern void __putgtf4 (upc_shared_ptr_t, long double, const char *file,
+ int line);
+extern void __putgxf4 (upc_shared_ptr_t, long double, const char *file,
+ int line);
+extern void __putgblk5 (upc_shared_ptr_t, void *, size_t, const char *file,
+ int line);
+extern void __copygblk5 (upc_shared_ptr_t, upc_shared_ptr_t, size_t,
+ const char *file, int line);
+
+/* Strict accesses (profiled). */
+
+extern u_intQI_t __getsgqi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intHI_t __getsghi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intSI_t __getsgsi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intDI_t __getsgdi3 (upc_shared_ptr_t, const char *file, int line);
+#if GUPCR_TARGET64
+extern u_intTI_t __getsgti3 (upc_shared_ptr_t, const char *file, int line);
+#endif
+extern float __getsgsf3 (upc_shared_ptr_t, const char *file, int line);
+extern double __getsgdf3 (upc_shared_ptr_t, const char *file, int line);
+extern long double __getsgtf3 (upc_shared_ptr_t, const char *file, int line);
+extern long double __getsgxf3 (upc_shared_ptr_t, const char *file, int line);
+extern void __getsgblk5 (void *, upc_shared_ptr_t, size_t, const char *file,
+ int line);
+
+extern void __putsgqi4 (upc_shared_ptr_t, u_intQI_t, const char *file,
+ int line);
+extern void __putsghi4 (upc_shared_ptr_t, u_intHI_t, const char *file,
+ int line);
+extern void __putsgsi4 (upc_shared_ptr_t, u_intSI_t, const char *file,
+ int line);
+extern void __putsgdi4 (upc_shared_ptr_t, u_intDI_t, const char *file,
+ int line);
+#if GUPCR_TARGET64
+extern void __putsgti4 (upc_shared_ptr_t, u_intTI_t, const char *file,
+ int line);
+#endif
+extern void __putsgsf4 (upc_shared_ptr_t, float, const char *file, int line);
+extern void __putsgdf4 (upc_shared_ptr_t, double, const char *file, int line);
+extern void __putsgtf4 (upc_shared_ptr_t, long double, const char *file,
+ int line);
+extern void __putsgxf4 (upc_shared_ptr_t, long double, const char *file,
+ int line);
+extern void __putsgblk5 (upc_shared_ptr_t, void *, size_t, const char *file,
+ int line);
+extern void __copysgblk5 (upc_shared_ptr_t, upc_shared_ptr_t, size_t,
+ const char *file, int line);
+
+/* Miscellaneous access related prototypes. */
+extern void __upc_fence (void);
+
+//end lib_access_prototypes
+
+
+#endif /* gupcr_access.h */
diff --git a/libgupc/portals4/gupcr_addr.c b/libgupc/portals4/gupcr_addr.c
new file mode 100644
index 00000000000..cc333a0ce05
--- /dev/null
+++ b/libgupc/portals4/gupcr_addr.c
@@ -0,0 +1,195 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_node.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+
+/**
+ * @file gupcr_addr.c
+ * GUPC Portals4 shared address utility routines
+ */
+
+/**
+ * @addtogroup IFACE GUPC Interface Routines
+ * @{
+ */
+
+//begin lib_inline_access
+/**
+ * Find local pointer from pointer-to-shared.
+ *
+ * @param [in] p Pointer-to-shared
+ * @return Local address associated with "p"
+ */
+//inline
+void *
+__cvtaddr (upc_shared_ptr_t p)
+{
+ void *addr;
+ if (GUPCR_PTS_IS_NULL (p))
+ return (void *) 0;
+ addr = GUPCR_GMEM_OFF_TO_LOCAL (GUPCR_PTS_THREAD (p), GUPCR_PTS_OFFSET (p));
+ return addr;
+}
+
+//end lib_inline_access
+
+/**
+ * Find local pointer from pointer-to-shared.
+ *
+ * The pointer-to-shared value must have affinity to the current thread.
+ * @param [in] p Pointer-to-shared
+ * @return Local address associated with "p"
+ */
+void *
+__getaddr (upc_shared_ptr_t p)
+{
+ void *addr;
+ if (GUPCR_PTS_IS_NULL (p))
+ return (void *) 0;
+ if ((int) GUPCR_PTS_THREAD (p) != MYTHREAD)
+ gupcr_fatal_error
+ ("invalid conversion of shared address to local pointer;\n"
+ "thread does not have affinity to shared address");
+ addr = GUPCR_GMEM_OFF_TO_LOCAL (MYTHREAD, GUPCR_PTS_OFFSET (p));
+ return addr;
+}
+
+/** @} */
+
+/**
+ * @addtogroup PTSMANIP UPC Pointer-to-shared Manipulation Functions
+ * @{
+ */
+
+/**
+ * Return the thread of a pointer-to-shared value.
+ *
+ * The upc_threadof function returns the index of the thread
+ * that has affinity to the shared object pointed to by the argument.
+ * @param [in] p Pointer-to-shared argument
+ * @retval Thread ID of the argument
+ */
+size_t
+upc_threadof (upc_shared_ptr_t p)
+{
+ if ((int) GUPCR_PTS_THREAD (p) >= THREADS)
+ gupcr_fatal_error ("thread number %d in shared address is out of range",
+ (int) GUPCR_PTS_THREAD (p));
+ return (size_t) GUPCR_PTS_THREAD (p);
+}
+
+/**
+ * Return the phase of a pointer-to-shared value.
+ *
+ * The upc_phaseof function returns the phase component of the
+ * pointer-to-shared argument.
+ * @param [in] p Pointer-to-shared argument
+ * @retval Phase of the argument
+ */
+size_t
+upc_phaseof (upc_shared_ptr_t p)
+{
+ if ((int) GUPCR_PTS_THREAD (p) >= THREADS)
+ gupcr_fatal_error ("thread number %d in shared address is out of range",
+ (int) GUPCR_PTS_THREAD (p));
+ return (size_t) GUPCR_PTS_PHASE (p);
+}
+
+/**
+ * Reset the phase field of a pointer-to-shared value.
+ *
+ * The upc_resetphase function returns a pointer-to-shared value which
+ * is identical to its input except that it has zero phase.
+ * @param [in] p Pointer-to-shared argument
+ * @retval Pointer-to-shared with zero phase
+ */
+upc_shared_ptr_t
+upc_resetphase (upc_shared_ptr_t p)
+{
+ upc_shared_ptr_t result;
+ result = p;
+ GUPCR_PTS_SET_PHASE (result, 0);
+ return result;
+}
+
+/**
+ * Return the address field of a pointer-to-shared value.
+ *
+ * The upc_addrfield function returns an implementation-defined
+ * value reflecting the 'local address' of the object pointed to
+ * by the pointer-to-shared argument.
+ * @param [in] p Pointer-to-shared argument
+ * @retval Address field of the argument
+ */
+size_t
+upc_addrfield (upc_shared_ptr_t p)
+{
+ if ((int) GUPCR_PTS_THREAD (p) >= THREADS)
+ gupcr_fatal_error ("thread number %d in shared address is out of range",
+ (int) GUPCR_PTS_THREAD (p));
+ return (size_t) GUPCR_PTS_VADDR (p);
+}
+
+/**
+ * Return the size of the local portion of the shared data
+ * with a layout described by the input parameters.
+ *
+ * A convenience function which calculates the exact size
+ * of the local portion of the data in a shared object with affinity to
+ * the thread identified by the 'threadid' parameter.
+ * @param [in] totalsize Size of the shared data
+ * @param [in] nbytes Size of the block
+ * @param [in] threadid Requested thread number
+ * @retval Size of the shared space described by the function arguments
+ */
+size_t
+upc_affinitysize (size_t totalsize, size_t nbytes, size_t threadid)
+{
+ size_t result;
+ if (nbytes == 0 || totalsize == 0 || nbytes >= totalsize)
+ result = (size_t) (threadid == 0 ? totalsize : 0);
+ else
+ {
+ size_t const nblocks = (totalsize / nbytes);
+ size_t const cutoff = (nblocks % THREADS);
+ if (threadid < cutoff)
+ result = (size_t) ((nblocks + THREADS - 1) / THREADS) * nbytes;
+ else if (threadid > cutoff)
+ result = (size_t) (nblocks / THREADS) * nbytes;
+ else
+ result = (size_t) ((nblocks / THREADS) * nbytes)
+ + totalsize - nblocks * nbytes;
+ }
+ return result;
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_alloc.h b/libgupc/portals4/gupcr_alloc.h
new file mode 100644
index 00000000000..9cc8f26a410
--- /dev/null
+++ b/libgupc/portals4/gupcr_alloc.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_alloc.h
+ * GUPC Portals4 UPC dynamic shared memory allocation.
+ */
+
+#ifndef _GUPCR_ALLOC_H_
+#define _GUPCR_ALLOC_H_ 1
+
+extern void gupcr_alloc_init (upc_shared_ptr_t, size_t);
+
+#ifndef __UPC__
+
+extern upc_shared_ptr_t upc_global_alloc (size_t, size_t);
+extern upc_shared_ptr_t upc_all_alloc (size_t, size_t);
+extern upc_shared_ptr_t upc_local_alloc (size_t, size_t);
+extern upc_shared_ptr_t upc_alloc (size_t);
+extern void upc_free (upc_shared_ptr_t);
+
+#endif /* !__UPC__ */
+
+#endif /* gupcr_alloc.h */
diff --git a/libgupc/portals4/gupcr_alloc.upc b/libgupc/portals4/gupcr_alloc.upc
new file mode 100644
index 00000000000..2eaa5e58162
--- /dev/null
+++ b/libgupc/portals4/gupcr_alloc.upc
@@ -0,0 +1,641 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+/**
+ * @file gupcr_alloc.upc
+ * GUPC Portals4 UPC dynamic shared memory allocation.
+ *
+ * Implement UPC's dynamic memory allocation routines.
+ * The implementation is written in UPC, because
+ * it needs to run above the runtime library's memory mapping
+ * facility. Internal runtime spin locks are used rather than
+ * the UPC language-defined locks, because those locks
+ * depend upon dynamic memory management, and we need to
+ * break the circular dependency.
+ *
+ * @addtogroup ALLOC GUPCR Shared Memory Allocator Functions
+ * @{
+ */
+
+#include <upc.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <assert.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+#include "gupcr_barrier.h"
+#include "gupcr_lock.h"
+
+struct upc_heap_list_struct;
+typedef shared struct upc_heap_list_struct *upc_heap_list_p;
+typedef struct upc_heap_list_struct
+{
+ upc_heap_list_p next;
+ upc_heap_list_p prev;
+} upc_heap_list_t;
+typedef upc_heap_list_t upc_heap_pool_t[GUPCR_HEAP_NUM_POOLS];
+typedef struct upc_heap_struct
+{
+ shared void *base;
+ upc_lock_t *lock;
+ size_t size;
+ int is_global;
+ size_t pool_avail;
+ upc_heap_pool_t pool;
+} upc_heap_t;
+typedef shared upc_heap_t *upc_heap_p;
+
+typedef struct upc_heap_node_struct
+{
+ upc_heap_list_t link; /* Must be first. */
+ size_t size;
+ int alloc_tag;
+ int is_global;
+} upc_heap_node_t;
+typedef shared upc_heap_node_t *upc_heap_node_p;
+
+static shared void *gupcr_heap_region_base;
+static shared void *gupcr_heap_region_top;
+static size_t gupcr_heap_region_size;
+
+static shared upc_heap_t gupcr_global_heap_info;
+static shared upc_heap_t gupcr_local_heap_info[THREADS];
+static strict shared size_t gupcr_heap_global_hi_water_mark;
+static strict shared size_t gupcr_heap_local_low_water_mark;
+static upc_heap_p gupcr_global_heap;
+static upc_heap_p gupcr_local_heap;
+
+/** Increment a shared pointer, by 'nbytes'. */
+static inline shared void *
+gupcr_pts_add_offset (shared void *ptr, ptrdiff_t nbytes)
+{
+ return (shared void *) (((shared [] char *) ptr) + nbytes);
+}
+
+/** Return the difference between 'ptr1' and 'ptr2'. Both
+ pointers must be non-NULL and have affinity to the same thread. */
+static inline ptrdiff_t
+gupcr_pts_diff (shared void *ptr1, shared void *ptr2)
+{
+ return (ptrdiff_t) (((shared [] char *) ptr1) - ((shared [] char *) ptr2));
+}
+
+/** Return the smallest power of 2 that is >= 'v',
+ scaled so that gupcr_log2 of the minimum allocation size is 0. */
+static inline unsigned int
+gupcr_plog2 (unsigned long long v)
+{
+ return gupcr_log2 (GUPCR_MAX (v, GUPCR_HEAP_ALLOC_MIN)) -
+ GUPCR_HEAP_ALLOC_MIN_BITS;
+}
+
+/** Return TRUE if 'list' is empty. */
+static inline int
+gupcr_heap_is_empty_list (upc_heap_list_p list)
+{
+ gupcr_assert (list != NULL);
+ return list->next == list;
+}
+
+/** Insert 'node' after 'here' in the double linked free list. */
+static inline void
+gupcr_heap_list_insert (upc_heap_list_p here, upc_heap_list_p node)
+{
+ upc_heap_list_p next;
+ gupcr_assert (here != NULL);
+ gupcr_assert (node != NULL);
+ next = here->next;
+ gupcr_assert (next != NULL);
+ node->next = next;
+ node->prev = here;
+ next->prev = node;
+ here->next = node;
+}
+
+/** Remove 'node' from its position in doubly-linked free list. */
+static inline void
+gupcr_heap_list_remove (upc_heap_list_p node)
+{
+ upc_heap_list_p next, prev;
+ gupcr_assert (node != NULL);
+ prev = node->prev;
+ gupcr_assert (prev != NULL);
+ next = node->next;
+ gupcr_assert (next != NULL);
+ prev->next = next;
+ next->prev = prev;
+ node->next = NULL;
+ node->prev = NULL;
+}
+
+/** Pop a node from the front of the free list
+ rooted at the 'p'-th pool in 'heap'. */
+static inline upc_heap_node_p
+gupcr_heap_list_pop (upc_heap_p heap, unsigned int p)
+{
+ upc_heap_node_p node = NULL;
+ upc_heap_list_p list;
+ gupcr_assert (heap != NULL);
+ gupcr_assert (p < GUPCR_HEAP_NUM_POOLS);
+ list = (upc_heap_list_p) &heap->pool[p];
+ if (!gupcr_heap_is_empty_list (list))
+ {
+ upc_heap_list_p first;
+ first = list->next;
+ gupcr_assert (first != NULL);
+ gupcr_heap_list_remove (first);
+ node = (upc_heap_node_p) first;
+ if (gupcr_heap_is_empty_list (list))
+ heap->pool_avail = gupcr_clear_bit (heap->pool_avail, p);
+ }
+ return node;
+}
+
+/** Push 'node' onto the front of the free list
+ rooted at the 'p'-th pool in 'heap'. */
+static inline void
+gupcr_heap_list_push (upc_heap_p heap, unsigned int p, upc_heap_node_p node)
+{
+ upc_heap_list_p list;
+ gupcr_assert (heap != NULL);
+ gupcr_assert (node != NULL);
+ gupcr_assert (p < GUPCR_HEAP_NUM_POOLS);
+ list = (upc_heap_list_p) &heap->pool[p];
+ if (gupcr_heap_is_empty_list (list))
+ heap->pool_avail = gupcr_set_bit (heap->pool_avail, p);
+ gupcr_heap_list_insert (list, (upc_heap_list_p) node);
+}
+
+/**
+ * Split 'node' into two nodes each of half the size.
+ *
+ * Push one of the half-sized nodes back onto an appropriate free list.
+ * Return the other half-size node. Before calling this routine,
+ * 'node' must not be on any free list.
+ */
+static inline upc_heap_node_p
+gupcr_heap_list_split (upc_heap_p heap, upc_heap_node_p node)
+{
+ size_t node_size;
+ size_t half_size;
+ unsigned int is_global;
+ upc_heap_node_p free_half;
+ unsigned int p;
+ gupcr_assert (heap != NULL);
+ gupcr_assert (node != NULL);
+ is_global = heap->is_global;
+ node_size = node->size;
+ half_size = ((size_t) 1 << (gupcr_log2 (node_size) - 1));
+ p = gupcr_plog2 (half_size);
+ if (is_global)
+ free_half = gupcr_pts_add_offset (node, half_size);
+ else
+ {
+ free_half = node;
+ node = gupcr_pts_add_offset (free_half, half_size);
+ }
+ upc_memset (free_half, '\0', GUPCR_HEAP_ALLOC_OVERHEAD);
+ free_half->size = half_size;
+ free_half->is_global = is_global;
+ gupcr_heap_list_push (heap, p, free_half);
+ upc_memset (node, '\0', GUPCR_HEAP_ALLOC_OVERHEAD);
+ node->size = half_size;
+ node->is_global = is_global;
+ return node;
+}
+
+/**
+ * Return the buddy of 'node'.
+ *
+ * The buddy is calculated at binary level 'p' by exclusive or-ing
+ * the p'th bit of the offset of 'node' within the heap.
+ * If there is no buddy for this block, return NULL.
+ */
+static inline upc_heap_node_p
+gupcr_heap_get_buddy (upc_heap_p heap, upc_heap_node_p node)
+{
+ shared void *heap_base;
+ size_t heap_size;
+ ptrdiff_t heap_offset, buddy_offset, max_buddy_offset;
+ unsigned int p;
+ upc_heap_node_p buddy = NULL;
+ gupcr_assert (heap != NULL);
+ gupcr_assert (node != NULL);
+ heap_base = heap->base;
+ heap_size = heap->size;
+ heap_offset = gupcr_pts_diff (node, heap_base);
+ gupcr_assert (heap_offset >= 0);
+ p = gupcr_log2 (node->size);
+ buddy_offset = heap_offset ^ ((ptrdiff_t) 1 << p);
+ max_buddy_offset = (ptrdiff_t) heap_size - GUPCR_HEAP_ALLOC_MIN;
+ if (buddy_offset <= max_buddy_offset)
+ buddy = gupcr_pts_add_offset (heap_base, buddy_offset);
+ return buddy;
+}
+
+/**
+ * Attempt to join the node pointed to by 'node_ref'
+ * to its buddy in 'heap' of log2 size 'p'.
+ *
+ * Return TRUE if successful. If the buddy node
+ * is the 'left' buddy, update the node pointed
+ * to by 'node_ref' to point to the buddy.
+ */
+static inline unsigned int
+gupcr_heap_list_join (upc_heap_p heap,
+ unsigned int p, upc_heap_node_p *node_ref)
+{
+ unsigned int joined = 0;
+ upc_heap_node_p buddy, node;
+ gupcr_assert (heap != NULL);
+ gupcr_assert (node_ref);
+ gupcr_assert (p < GUPCR_HEAP_NUM_POOLS);
+ node = *node_ref;
+ gupcr_assert (node != NULL);
+ buddy = gupcr_heap_get_buddy (heap, node);
+ /* The node can be joined with its buddy if:
+ 1. The buddy is free.
+ 2. The buddy has the same power-of-2 size. */
+ if (buddy && !buddy->alloc_tag)
+ {
+ unsigned int p_buddy;
+ gupcr_assert (buddy->size > 0);
+ p_buddy = gupcr_plog2 (buddy->size);
+ if (p == p_buddy)
+ {
+ unsigned int p_above = p + 1;
+ upc_heap_list_p list;
+ joined = 1;
+ gupcr_heap_list_remove ((upc_heap_list_p) buddy);
+ list = (upc_heap_list_p) &heap->pool[p];
+ if (gupcr_heap_is_empty_list (list))
+ heap->pool_avail = gupcr_clear_bit (heap->pool_avail, p);
+ if (gupcr_pts_diff (buddy, node) < 0)
+ {
+ node = buddy;
+ *node_ref = node;
+ }
+ node->alloc_tag = 0;
+ node->size = ((size_t) 1 << (p_above + GUPCR_HEAP_ALLOC_MIN_BITS));
+ }
+ }
+ return joined;
+}
+
+/**
+ * Initialize the data structure used to manage
+ * operations on 'heap'.
+ *
+ * 'is_global' is TRUE if the heap is a global heap.
+ *
+ * For global heaps, 'base' points to the bottom of the heap
+ * storage area. For local heaps, 'base' initially points
+ * to the top of the heap storage area and then grows downward.
+ */
+static inline void
+gupcr_heap_init_info (upc_heap_p heap,
+ unsigned int is_global, shared void *base)
+{
+ unsigned int p;
+ shared [] upc_heap_list_t *pool;
+ gupcr_assert (heap != NULL);
+ upc_memset (heap, '\0', sizeof (upc_heap_t));
+ gupcr_assert (base != NULL);
+ heap->base = base;
+ heap->is_global = is_global;
+ if (is_global)
+ heap->lock = gupcr_global_heap_lock;
+ else
+ heap->lock = gupcr_local_heap_lock;
+ for (p = 0, pool = &heap->pool[0]; p < GUPCR_HEAP_NUM_POOLS; ++p, ++pool)
+ {
+ pool->next = (upc_heap_list_p) pool;
+ pool->prev = (upc_heap_list_p) pool;
+ }
+ heap->pool_avail = 0;
+}
+
+/**
+ * Initialize the global and local heap data structures.
+ *
+ * 'heap_region_base' is the shared address where the heap should begin,
+ * and 'heap_region_size' is the maximum number of bytes available
+ * for dynamic shared memory allocation.
+ */
+void
+gupcr_alloc_init (shared void *heap_region_base, size_t heap_region_size)
+{
+ shared void *local_heap_base;
+ gupcr_assert (upc_threadof (heap_region_base) == (size_t) MYTHREAD);
+ gupcr_assert (gupcr_is_pow_2 (GUPCR_HEAP_ALLOC_MIN));
+ gupcr_assert ((GUPCR_HEAP_ALLOC_OVERHEAD % 16) == 0);
+ gupcr_assert (GUPCR_HEAP_ALLOC_OVERHEAD >= sizeof (upc_heap_node_t));
+ gupcr_heap_region_base = heap_region_base;
+ gupcr_heap_region_size = heap_region_size;
+ gupcr_heap_region_top =
+ gupcr_pts_add_offset (heap_region_base, heap_region_size);
+ gupcr_global_heap = &gupcr_global_heap_info;
+ gupcr_local_heap = &gupcr_local_heap_info[MYTHREAD];
+ if (!MYTHREAD)
+ {
+ gupcr_heap_global_hi_water_mark = 0;
+ gupcr_heap_local_low_water_mark = heap_region_size;
+ gupcr_heap_init_info (&gupcr_global_heap_info, 1, heap_region_base);
+ }
+ /* The local heap base is initially the top of the UPC heap region, */
+ local_heap_base = gupcr_heap_region_top;
+ gupcr_heap_init_info (gupcr_local_heap, 0, local_heap_base);
+}
+
+/**
+ * Allocate 'size' bytes from the heap memory region.
+ *
+ * Global allocations raise the high water mark.
+ * Local allocations potentially decrease the low water mark.
+ * Space is available as long as the high water mark
+ * does not cross above the low water mark.
+ *
+ * If successful, return a pointer to the newly allocated space.
+ * Return NULL if there is not enough space.
+ *
+ * The 'size' argument is constrained to be an exact power of 2.
+ *
+ */
+static shared void *
+gupcr_heap_region_alloc (upc_heap_p heap, size_t size)
+{
+ shared void *mem = NULL;
+ unsigned int is_global;
+ size_t heap_size, new_heap_size;
+ shared void *heap_base;
+ unsigned int have_enough_space;
+ gupcr_assert (heap != NULL);
+ gupcr_assert (size > 0);
+ gupcr_assert (gupcr_is_pow_2 (size));
+ is_global = heap->is_global;
+ heap_size = heap->size;
+ heap_base = heap->base;
+ new_heap_size = heap_size + size;
+ have_enough_space = 0;
+ upc_lock (gupcr_heap_region_lock);
+ if (is_global)
+ {
+ size_t new_hi_water_mark;
+ new_hi_water_mark = new_heap_size;
+ if (new_hi_water_mark <= gupcr_heap_local_low_water_mark)
+ {
+ gupcr_heap_global_hi_water_mark = new_hi_water_mark;
+ have_enough_space = 1;
+ }
+ }
+ else
+ {
+ if (new_heap_size <= gupcr_heap_region_size)
+ {
+ size_t new_low_water_mark;
+ new_low_water_mark = gupcr_heap_region_size - new_heap_size;
+ if (new_low_water_mark >= gupcr_heap_global_hi_water_mark)
+ {
+ if (new_low_water_mark < gupcr_heap_local_low_water_mark)
+ gupcr_heap_local_low_water_mark = new_low_water_mark;
+ have_enough_space = 1;
+ }
+ }
+ }
+ upc_unlock (gupcr_heap_region_lock);
+ if (have_enough_space)
+ {
+ ptrdiff_t heap_size_offset;
+ if (is_global)
+ {
+ heap_size_offset = (ptrdiff_t) heap_size;
+ mem = gupcr_pts_add_offset (heap_base, heap_size_offset);
+ }
+ else
+ {
+ heap_size_offset = -((ptrdiff_t) size);
+ heap_base = gupcr_pts_add_offset (heap_base, heap_size_offset);
+ heap->base = heap_base;
+ mem = heap_base;
+ }
+ heap->size = new_heap_size;
+ }
+ return mem;
+}
+
+/**
+ * Repetitively double the size of 'heap' until a free block
+ * of at least 'size' bytes (rounded up to the next power of 2)
+ * is created.
+ */
+static void
+gupcr_heap_extend (upc_heap_p heap, size_t size)
+{
+ size_t heap_size;
+ size_t extend_size;
+ unsigned int is_global;
+ unsigned int p;
+ size_t free_block_size;
+ gupcr_assert (heap != NULL);
+ gupcr_assert (size > 0);
+ heap_size = heap->size;
+ is_global = heap->is_global;
+ extend_size = ((size_t) 1 << gupcr_log2 (size));
+ do
+ {
+ upc_heap_node_p free_block;
+ free_block_size = heap_size ? heap_size : extend_size;
+ free_block = gupcr_heap_region_alloc (heap, free_block_size);
+ if (free_block == NULL)
+ return;
+ upc_memset (free_block, '\0', GUPCR_HEAP_ALLOC_OVERHEAD);
+ free_block->size = free_block_size;
+ free_block->is_global = is_global;
+ p = gupcr_plog2 (free_block_size);
+ gupcr_heap_list_push (heap, p, free_block);
+ heap_size += free_block_size;
+ heap->size = heap_size;
+ }
+ while (free_block_size < extend_size);
+}
+
+/**
+ * Allocate a block of 'size' bytes from 'heap'.
+ */
+static shared void *
+gupcr_heap_alloc (upc_heap_p heap, size_t size)
+{
+ shared void *mem = NULL;
+ const size_t alloc_size = GUPCR_MAX (size + GUPCR_HEAP_ALLOC_OVERHEAD,
+ GUPCR_HEAP_ALLOC_MIN);
+ const unsigned int pool_fit = gupcr_plog2 (alloc_size);
+ unsigned long long int pool_avail;
+ unsigned int p;
+ upc_heap_node_p alloc = NULL;
+ gupcr_assert (heap != NULL);
+ gupcr_assert (size > 0);
+ upc_lock (heap->lock);
+ pool_avail = heap->pool_avail << pool_fit;
+ if (!pool_avail)
+ {
+ gupcr_heap_extend (heap, alloc_size);
+ pool_avail = heap->pool_avail << pool_fit;
+ }
+ if (pool_avail)
+ {
+ p = pool_fit + gupcr_find_first_one (pool_avail);
+ for (alloc = gupcr_heap_list_pop (heap, p); p > pool_fit; --p)
+ alloc = gupcr_heap_list_split (heap, alloc);
+ alloc->alloc_tag = GUPCR_HEAP_ALLOC_TAG;
+ }
+ if (alloc)
+ mem = gupcr_pts_add_offset (alloc, GUPCR_HEAP_ALLOC_OVERHEAD);
+ upc_unlock (heap->lock);
+ return mem;
+}
+
+/**
+ * Return the block given by 'node' into 'heap'.
+ */
+static void
+gupcr_heap_free (upc_heap_p heap, upc_heap_node_p node)
+{
+ unsigned int p;
+ upc_heap_node_p free_node;
+ gupcr_assert (heap != NULL);
+ gupcr_assert (node != NULL);
+ upc_lock (heap->lock);
+ for (p = gupcr_plog2 (node->size), free_node = node;
+ gupcr_heap_list_join (heap, p, &free_node); ++p) /* loop */ ;
+ free_node->alloc_tag = 0;
+ gupcr_heap_list_push (heap, p, free_node);
+ upc_unlock (heap->lock);
+}
+
+shared void *
+upc_global_alloc (size_t nblocks, size_t nbytes)
+{
+ size_t request_size = GUPCR_ROUND (nblocks, THREADS) * nbytes;
+ size_t alloc_size = request_size / THREADS;
+ shared void *mem = NULL;
+ gupcr_trace (FC_ALLOC, "ALLOC GLOBAL_ALLOC ENTER");
+ if (alloc_size > 0)
+ mem = gupcr_heap_alloc (gupcr_global_heap, alloc_size);
+ gupcr_trace (FC_ALLOC, "ALLOC GLOBAL_ALLOC EXIT %u:0x%lx %lu",
+ (unsigned) upc_threadof (mem),
+ (long unsigned) upc_addrfield (mem),
+ (long unsigned) nbytes);
+ return mem;
+}
+
+shared void *
+upc_all_alloc (size_t nblocks, size_t nbytes)
+{
+ size_t request_size = GUPCR_ROUND (nblocks, THREADS) * nbytes;
+ size_t alloc_size = request_size / THREADS;
+ shared void *mem = NULL;
+ gupcr_trace (FC_ALLOC, "ALLOC ALL_ALLOC ENTER");
+ if (alloc_size > 0)
+ {
+ if (MYTHREAD == 0)
+ {
+ mem = gupcr_heap_alloc (gupcr_global_heap, alloc_size);
+ gupcr_bcast_send (&mem, sizeof (mem));
+ }
+ else
+ gupcr_bcast_recv (&mem, sizeof (mem));
+ }
+ gupcr_trace (FC_ALLOC, "ALLOC ALL_ALLOC EXIT %u:0x%lx %lu",
+ (unsigned) upc_threadof (mem),
+ (long unsigned) upc_addrfield (mem),
+ (long unsigned) nbytes);
+ return mem;
+}
+
+shared void *
+upc_alloc (size_t nbytes)
+{
+ shared void *mem = NULL;
+ gupcr_trace (FC_ALLOC, "ALLOC ALLOC ENTER");
+ if (nbytes)
+ mem = gupcr_heap_alloc (gupcr_local_heap, nbytes);
+ gupcr_trace (FC_ALLOC, "ALLOC ALLOC EXIT %u:0x%lx %lu",
+ (unsigned) upc_threadof (mem),
+ (long unsigned) upc_addrfield (mem),
+ (long unsigned) nbytes);
+ return mem;
+}
+
+void
+upc_all_free (shared void *ptr)
+{
+ if (ptr)
+ {
+ const int thread = (int) upc_threadof (ptr);
+ upc_barrier - 1;
+ /* Check for errors only on thread 0. */
+ if ((MYTHREAD == 0) && (thread >= THREADS))
+ gupcr_error ("upc_all_free() called with invalid shared pointer");
+ if (thread == MYTHREAD)
+ upc_free (ptr);
+ }
+}
+
+void
+upc_free (shared void *ptr)
+{
+ gupcr_trace (FC_ALLOC, "ALLOC FREE ENTER %u:0x%lx",
+ (unsigned) upc_threadof (ptr),
+ (long unsigned) upc_addrfield (ptr));
+ if (ptr)
+ {
+ const size_t offset __attribute__ ((unused)) = upc_addrfield (ptr);
+ const int thread = (int) upc_threadof (ptr);
+ const size_t phase = upc_phaseof (ptr);
+ upc_heap_p heap;
+ upc_heap_node_p node;
+ unsigned int is_global;
+ if (phase || thread >= THREADS)
+ gupcr_error ("upc_free() called with invalid shared pointer");
+ node = gupcr_pts_add_offset (ptr, -GUPCR_HEAP_ALLOC_OVERHEAD);
+ is_global = node->is_global;
+ if (is_global && thread)
+ gupcr_error ("upc_free() called with invalid shared pointer");
+ if (node->alloc_tag != GUPCR_HEAP_ALLOC_TAG)
+ gupcr_error ("upc_free() called with pointer to unallocated space");
+ if (is_global)
+ heap = gupcr_global_heap;
+ else
+ heap = &gupcr_local_heap_info[thread];
+ gupcr_heap_free (heap, node);
+ }
+ gupcr_trace (FC_ALLOC, "ALLOC FREE EXIT");
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_atomic.upc b/libgupc/portals4/gupcr_atomic.upc
new file mode 100644
index 00000000000..bb8cd2c473d
--- /dev/null
+++ b/libgupc/portals4/gupcr_atomic.upc
@@ -0,0 +1,600 @@
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <upc_atomic.h>
+#include <portals4.h>
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_atomic_sup.h"
+
+/**
+ * @file gupcr_atomic.upc
+ * GUPC Portals4 UPC atomics implementation.
+ *
+ * All UPC atomic operations and data types, with exception of UPC_PTS,
+ * are almost completely matched to the corresponding Portals4 atomics.
+ * The following exceptions are made:
+ *
+ * UPC_SUB Converted into Portals4 atomic add of a negative number.
+ * UPC_INC Converted into Portals4 atomic add of one.
+ * UPC_DEC Converted into Portals4 atomic add of negative one.
+ *
+ * UPC_PTS data type does not use Portals4 atomic operations (even though
+ * 64 bit pointer-to-shared can fit into the int64 container). This is
+ * mainly due to the fact that pointer-to-shared comparison has to
+ * disregard the phase part of the pointer and Portals4 does not have
+ * support for CSWAP with a mask.
+ */
+
+/**
+ * @addtogroup ATOMIC GUPCR Atomics Support Functions
+ * @{
+ */
+
+/** Atomic domain representation */
+struct upc_atomicdomain_struct
+{
+ upc_lock_t *lock;
+ upc_op_t ops;
+ upc_type_t type;
+};
+
+/**
+ * Convert UPC to Portals4 atomic data type.
+ *
+ * @param [in] upc_type UPC atomic data type
+ * @retval Portals4 atomic data type
+ */
+static inline ptl_datatype_t
+gupcr_atomic_to_ptl_type (upc_type_t upc_type)
+{
+ switch (upc_type)
+ {
+ case UPC_INT:
+ return UPC_ATOMIC_TO_PTL_INT;
+ case UPC_UINT:
+ return UPC_ATOMIC_TO_PTL_UINT;
+ case UPC_LONG:
+ return UPC_ATOMIC_TO_PTL_LONG;
+ case UPC_ULONG:
+ return UPC_ATOMIC_TO_PTL_ULONG;
+ case UPC_INT32:
+ return UPC_ATOMIC_TO_PTL_INT32;
+ case UPC_UINT32:
+ return UPC_ATOMIC_TO_PTL_UINT32;
+ case UPC_INT64:
+ return UPC_ATOMIC_TO_PTL_INT64;
+ case UPC_UINT64:
+ return UPC_ATOMIC_TO_PTL_UINT64;
+ case UPC_FLOAT:
+ return UPC_ATOMIC_TO_PTL_FLOAT;
+ case UPC_DOUBLE:
+ return UPC_ATOMIC_TO_PTL_DOUBLE;
+ default:
+ gupcr_error ("invalid UPC atomic type %d", (int) upc_type);
+ }
+ return -1;
+}
+
+/**
+ * Convert UPC to Portals4 atomic operation.
+ *
+ * @param [in] upc_op UPC atomic operation
+ * @retval Portals4 atomic operation
+ */
+static inline ptl_op_t
+gupcr_atomic_to_ptl_op (upc_op_t upc_op)
+{
+ switch (upc_op)
+ {
+ case UPC_ADD:
+ return PTL_SUM;
+ case UPC_MULT:
+ return PTL_PROD;
+ case UPC_MAX:
+ return PTL_MAX;
+ case UPC_MIN:
+ return PTL_MIN;
+ case UPC_AND:
+ return PTL_BAND;
+ case UPC_OR:
+ return PTL_BOR;
+ case UPC_XOR:
+ return PTL_BXOR;
+ default:
+ gupcr_error ("invalid UPC atomic op %d", (int) upc_op);
+ }
+ return -1;
+}
+
+/**
+ * Convert UPC atomic operation into a string.
+ *
+ * @param [in] upc_op UPC atomic operation
+ * @retval Character string
+ */
+static const char *
+gupcr_get_atomic_op_as_string (upc_op_t upc_op)
+{
+ switch (upc_op)
+ {
+ case UPC_ADD:
+ return "UPC_ADD";
+ case UPC_AND:
+ return "UPC_AND";
+ case UPC_CSWAP:
+ return "UPC_CSWAP";
+ case UPC_DEC:
+ return "UPC_DEC";
+ case UPC_INC:
+ return "UPC_INC";
+ case UPC_GET:
+ return "UPC_GET";
+ case UPC_MAX:
+ return "UPC_MAX";
+ case UPC_MIN:
+ return "UPC_MIN";
+ case UPC_MULT:
+ return "UPC_MULT";
+ case UPC_OR:
+ return "UPC_OR";
+ case UPC_SET:
+ return "UPC_SET";
+ case UPC_SUB:
+ return "UPC_SUB";
+ case UPC_XOR:
+ return "UPC_XOR";
+ }
+ return "UNKNOWN ATOMIC OP";
+}
+
+/**
+ * Convert UPC atomic type into a string.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval Character string
+ */
+static const char *
+gupcr_get_atomic_type_as_string (upc_type_t upc_type)
+{
+ switch (upc_type)
+ {
+ case UPC_INT:
+ return "UPC_INT";
+ case UPC_UINT:
+ return "UPC_UINT";
+ case UPC_LONG:
+ return "UPC_LONG";
+ case UPC_ULONG:
+ return "UPC_ULONG";
+ case UPC_INT32:
+ return "UPC_INT32";
+ case UPC_UINT32:
+ return "UPC_UINT32";
+ case UPC_INT64:
+ return "UPC_INT64";
+ case UPC_UINT64:
+ return "UPC_UINT64";
+ case UPC_FLOAT:
+ return "UPC_FLOAT";
+ case UPC_DOUBLE:
+ return "UPC_DOUBLE";
+ case UPC_PTS:
+ return "UPC_PTS";
+ }
+ return "UNKNOWN ATOMIC TYPE";
+}
+
+/** Set value by UPC atomic type macro */
+#define FUNC_TYPE_SET(__name__,__type__) \
+ *(__type__ *) buf = (__type__) value
+
+/**
+ * Set buffer to the value of the particular UPC atomic type.
+ *
+ * @param [in] buf Pointer to the buffer to set
+ * @param [in] type UPC atomic type
+ * @param [in] value Value to be set
+ */
+static void
+gupcr_set_optype_val (void *buf, upc_type_t type, int value)
+{
+ switch (type)
+ {
+ case UPC_INT:
+ FUNC_TYPE_SET (UPC_INT, int);
+ break;
+ case UPC_UINT:
+ FUNC_TYPE_SET (UPC_UINT, unsigned int);
+ break;
+ case UPC_LONG:
+ FUNC_TYPE_SET (UPC_LONG, long);
+ break;
+ case UPC_ULONG:
+ FUNC_TYPE_SET (UPC_ULONG, unsigned long);
+ break;
+ case UPC_INT32:
+ FUNC_TYPE_SET (UPC_INT32, int32_t);
+ break;
+ case UPC_UINT32:
+ FUNC_TYPE_SET (UPC_UINT32, uint32_t);
+ break;
+ case UPC_INT64:
+ FUNC_TYPE_SET (UPC_INT64, int64_t);
+ break;
+ case UPC_UINT64:
+ FUNC_TYPE_SET (UPC_UINT64, uint64_t);
+ break;
+ case UPC_FLOAT:
+ FUNC_TYPE_SET (UPC_FLOAT, float);
+ break;
+ case UPC_DOUBLE:
+ FUNC_TYPE_SET (UPC_DOUBLE, double);
+ break;
+ default:
+ gupcr_error ("wrong UPC type (%d)", type);
+ }
+}
+
+/** Negate value by UPC atomic type macro */
+#define FUNC_TYPE_NEGATE(__name__,__type__) \
+ *(__type__ *) dbuf = - *(__type__*) sbuf
+
+/**
+ * Negate value of the particular UPC atomic type.
+ *
+ * @param [in] dbuf Pointer to negated value
+ * @param [in] sbuf Pointer to original value
+ * @param [in] type UPC atomic type
+ */
+static void
+gupcr_negate_atomic_type (void *dbuf, const void *sbuf, upc_type_t type)
+{
+ switch (type)
+ {
+ case UPC_INT:
+ FUNC_TYPE_NEGATE (UPC_INT, int);
+ break;
+ case UPC_UINT:
+ FUNC_TYPE_NEGATE (UPC_UINT, unsigned int);
+ break;
+ case UPC_LONG:
+ FUNC_TYPE_NEGATE (UPC_LONG, long);
+ break;
+ case UPC_ULONG:
+ FUNC_TYPE_NEGATE (UPC_ULONG, unsigned long);
+ break;
+ case UPC_INT32:
+ FUNC_TYPE_NEGATE (UPC_INT32, int32_t);
+ break;
+ case UPC_UINT32:
+ FUNC_TYPE_NEGATE (UPC_UINT32, uint32_t);
+ break;
+ case UPC_INT64:
+ FUNC_TYPE_NEGATE (UPC_INT64, int64_t);
+ break;
+ case UPC_UINT64:
+ FUNC_TYPE_NEGATE (UPC_UINT64, uint64_t);
+ break;
+ case UPC_FLOAT:
+ FUNC_TYPE_NEGATE (UPC_FLOAT, float);
+ break;
+ case UPC_DOUBLE:
+ FUNC_TYPE_NEGATE (UPC_DOUBLE, double);
+ break;
+ default:
+ gupcr_error ("wrong UPC type (%d)", type);
+ }
+}
+
+/** @} */
+
+/**
+ * @addtogroup UPCATOMIC UPC Atomics Functions
+ * @{
+ */
+
+/**
+ * UPC atomic relaxed operation.
+ *
+ * @param [in] domain Atomic domain
+ * @param [in] fetch_ptr Target of the update
+ * @param [in] op Atomic operation
+ * @param [in] target Target address of the operation
+ * @param [in] operand1 Operation required argument
+ * @param [in] operand2 Operation required argument
+ */
+void
+upc_atomic_relaxed (upc_atomicdomain_t * domain,
+ void *restrict fetch_ptr, upc_op_t op,
+ shared void *restrict target,
+ const void *restrict operand1,
+ const void *restrict operand2)
+{
+ struct upc_atomicdomain_struct *ldomain;
+ char cvt_buf[GUPC_MAX_ATOMIC_SIZE];
+
+ /* Complete all strict operations. Portals4 runtime allows only
+ outstanding put operations. */
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+
+ if (domain == NULL)
+ gupcr_fatal_error ("NULL atomic domain pointer specified");
+
+ ldomain = (struct upc_atomicdomain_struct *) &domain[MYTHREAD];
+
+ gupcr_trace (FC_ATOMIC, "ATOMIC ENTER %s %s",
+ gupcr_get_atomic_op_as_string (op),
+ gupcr_get_atomic_type_as_string (ldomain->type));
+
+ if (target == NULL)
+ gupcr_fatal_error ("NULL atomic target pointer specified");
+
+ if (!(op && ldomain->ops))
+ {
+ gupcr_fatal_error ("invalid operation (%s) for specified domain",
+ gupcr_get_atomic_op_as_string (op));
+ }
+
+ /* Check arguments. */
+ switch (op)
+ {
+ case UPC_GET:
+ if (fetch_ptr == NULL)
+ gupcr_fatal_error (
+ "atomic operation (UPC_GET) requires a non-NULL fetch pointer");
+ case UPC_INC:
+ case UPC_DEC:
+ if (operand1 != NULL)
+ gupcr_error ("atomic operation (%s) requires a NULL operand1",
+ gupcr_get_atomic_op_as_string (op));
+ if (operand2 != NULL)
+ gupcr_error ("atomic operation (%s) requires a NULL operand2",
+ gupcr_get_atomic_op_as_string (op));
+ break;
+ case UPC_CSWAP:
+ if (operand1 == NULL)
+ gupcr_fatal_error (
+ "atomic operation (UPC_CSWAP) requires a non-NULL operand1");
+ if (operand2 == NULL)
+ gupcr_fatal_error (
+ "atomic operation (UPC_CSWAP) requires a non-NULL operand2");
+ break;
+ default:
+ if (operand1 == NULL)
+ gupcr_fatal_error (
+ "atomic operation (%s) requires a non-NULL operand1",
+ gupcr_get_atomic_op_as_string (op));
+ if (operand2 != NULL)
+ gupcr_error ("atomic operation (%s) requires a NULL operand2",
+ gupcr_get_atomic_op_as_string (op));
+ }
+
+ /* UPC_PTS data type does not use Portals4 atomic operations,
+ even though 64 bit pointer-to-shared fits in the int64
+ container. UPC_PTS supports only access operations (get, set, cswap)
+ and as pointer compare needs to disregards the phase during
+ comparison we are unable to place the pointer in some integral
+ container (e.g. int64) and use Portals4 atomic ops. */
+ if (ldomain->type == UPC_PTS)
+ {
+ upc_lock (ldomain->lock);
+ switch (op)
+ {
+ case UPC_GET:
+ *(shared void **) fetch_ptr = *(shared void *shared *) target;
+ break;
+ case UPC_SET:
+ if (fetch_ptr)
+ *(shared void **) fetch_ptr = *(shared void *shared *) target;
+ *(shared void *shared *) target = *(shared void **) operand1;
+ break;
+ case UPC_CSWAP:
+ {
+ shared void *tmp = *(shared void *shared *) target;
+ if (*(shared void **) operand1 == tmp)
+ *(shared void *shared *) target = *(shared void **) operand2;
+ if (fetch_ptr)
+ *(shared void **) fetch_ptr = tmp;
+ }
+ break;
+ default:
+ upc_unlock (ldomain->lock);
+ gupcr_fatal_error ("invalid atomic operation (%s) for UPC_PTS",
+ gupcr_get_atomic_op_as_string (op));
+ }
+ upc_unlock (ldomain->lock);
+ }
+ else
+ {
+ size_t dthread = upc_threadof (target);
+ size_t doffset = upc_addrfield (target);
+
+ switch (op)
+ {
+ case UPC_GET:
+ gupcr_atomic_get (dthread, doffset, fetch_ptr,
+ gupcr_atomic_to_ptl_type (ldomain->type));
+ break;
+ case UPC_SET:
+ gupcr_atomic_set (dthread, doffset, fetch_ptr, operand1,
+ gupcr_atomic_to_ptl_type (ldomain->type));
+ break;
+ case UPC_CSWAP:
+ gupcr_atomic_cswap (dthread, doffset, fetch_ptr, operand1, operand2,
+ gupcr_atomic_to_ptl_type (ldomain->type));
+ break;
+ case UPC_AND:
+ case UPC_OR:
+ case UPC_XOR:
+ if (ldomain->type == UPC_PTS ||
+ ldomain->type == UPC_FLOAT || ldomain->type == UPC_DOUBLE)
+ {
+ gupcr_fatal_error (
+ "invalid atomic operation (%s) for %s type",
+ gupcr_get_atomic_op_as_string (op),
+ gupcr_get_atomic_type_as_string (ldomain->type));
+ }
+ gupcr_atomic_op (dthread, doffset, fetch_ptr, operand1,
+ gupcr_atomic_to_ptl_op (op),
+ gupcr_atomic_to_ptl_type (ldomain->type));
+ break;
+ case UPC_ADD:
+ case UPC_MULT:
+ case UPC_MIN:
+ case UPC_MAX:
+ gupcr_atomic_op (dthread, doffset, fetch_ptr,
+ operand1, gupcr_atomic_to_ptl_op (op),
+ gupcr_atomic_to_ptl_type (ldomain->type));
+ break;
+ case UPC_SUB:
+ /* As Portals4 does not have atomic subtract, UPC_SUB must be
+ converted into atomic add, UPC_ADD. */
+ gupcr_negate_atomic_type (cvt_buf, operand1, ldomain->type);
+ gupcr_atomic_op (dthread, doffset, fetch_ptr,
+ cvt_buf, gupcr_atomic_to_ptl_op (UPC_ADD),
+ gupcr_atomic_to_ptl_type (ldomain->type));
+ break;
+ case UPC_INC:
+ case UPC_DEC:
+ if (op == UPC_INC)
+ gupcr_set_optype_val (cvt_buf, ldomain->type, 1);
+ else
+ gupcr_set_optype_val (cvt_buf, ldomain->type, -1);
+ gupcr_atomic_op (dthread, doffset, fetch_ptr, cvt_buf, PTL_SUM,
+ gupcr_atomic_to_ptl_type (ldomain->type));
+ break;
+ default:
+ gupcr_fatal_error ("invalid atomic operation: %s",
+ gupcr_get_atomic_op_as_string (op));
+ }
+ }
+ gupcr_trace (FC_ATOMIC, "ATOMIC EXIT");
+}
+
+/**
+ * UPC atomic strict operation.
+ *
+ * @param [in] domain Atomic domain
+ * @param [in] fetch_ptr Target of the update
+ * @param [in] op Atomic operation
+ * @param [in] target Target address of the operation
+ * @param [in] operand1 Operation required argument
+ * @param [in] operand2 Operation required argument
+ */
+void
+upc_atomic_strict (upc_atomicdomain_t * domain,
+ void *restrict fetch_ptr,
+ upc_op_t op,
+ shared void *restrict target,
+ const void *restrict operand1,
+ const void *restrict operand2)
+{
+ upc_fence;
+ upc_atomic_relaxed (domain, fetch_ptr, op, target, operand1, operand2);
+ upc_fence;
+}
+
+/**
+ * Collective allocation of atomic domain.
+ *
+ * Implementation uses native Portals4 atomic functions and the
+ * hint field is ignored.
+ *
+ * @parm [in] type Atomic operation type
+ * @parm [in] ops Atomic domain operations
+ * @parm [in] hints Atomic operation hint
+ * @retval Allocated atomic domain pointer
+ */
+upc_atomicdomain_t *
+upc_all_atomicdomain_alloc (upc_type_t type,
+ upc_op_t ops,
+ upc_atomichint_t hints __attribute__ ((unused)))
+{
+ struct upc_atomicdomain_struct *ldomain;
+ shared upc_atomicdomain_t *domain;
+
+ gupcr_trace (FC_ATOMIC, "ATOMIC DOMAIN_ALLOC ENTER %s ops(%X)",
+ gupcr_get_atomic_type_as_string (type), (unsigned) ops);
+ domain = (upc_atomicdomain_t *)
+ upc_all_alloc (THREADS, sizeof (struct upc_atomicdomain_struct));
+ gupcr_assert (domain != NULL);
+
+ ldomain = (struct upc_atomicdomain_struct *) &domain[MYTHREAD];
+ ldomain->lock = NULL;
+ if (type == UPC_PTS)
+ ldomain->lock = upc_all_lock_alloc ();
+ ldomain->ops = ops;
+ ldomain->type = type;
+ gupcr_trace (FC_ATOMIC, "ATOMIC DOMAIN_ALLOC EXIT");
+ return domain;
+}
+
+/**
+ * Collective free of the atomic domain.
+ *
+ * @param [in] domain Pointer to atomic domain
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_all_atomicdomain_free (upc_atomicdomain_t * domain)
+{
+ if (domain == NULL)
+ gupcr_fatal_error ("NULL atomic domain pointer specified");
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ upc_lock_free (domain->lock);
+ upc_free (domain);
+ }
+ upc_barrier;
+}
+
+/**
+ * Query implementation for expected performance.
+ *
+ * @parm [in] ops Atomic domain operations
+ * @parm [in] type Atomic operation type
+ * @parm [in] addr Atomic address
+ * @retval Expected performance
+ */
+int
+upc_atomic_isfast (upc_type_t type __attribute__ ((unused)),
+ upc_op_t ops __attribute__ ((unused)),
+ shared void *addr __attribute__ ((unused)))
+{
+ if (type == UPC_PTS)
+ return UPC_ATOMIC_PERFORMANCE_NOT_FAST;
+ return UPC_ATOMIC_PERFORMANCE_FAST;
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_atomic_sup.c b/libgupc/portals4/gupcr_atomic_sup.c
new file mode 100644
index 00000000000..5d35c2fd637
--- /dev/null
+++ b/libgupc/portals4/gupcr_atomic_sup.c
@@ -0,0 +1,292 @@
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_lib.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_coll_sup.h"
+#include "gupcr_atomic_sup.h"
+
+/**
+ * @file gupcr_atomic_sup.c
+ * GUPC Portals4 atomic support routines.
+ *
+ * @addtogroup ATOMIC GUPCR Atomics Support Functions
+ * @{
+ */
+
+/** Atomic local access MD handle */
+static ptl_handle_md_t gupcr_atomic_md;
+/** Atomic local access MD counting events handle */
+static ptl_handle_ct_t gupcr_atomic_md_ct;
+/** Atomic local access MD event queue handle */
+static ptl_handle_eq_t gupcr_atomic_md_eq;
+/** Atomic number of received ACKs on local md */
+static ptl_size_t gupcr_atomic_md_count;
+
+/** Atomic operations use remote gmem PTE */
+#define GUPCR_PTL_PTE_ATOMIC GUPCR_PTL_PTE_GMEM
+
+/**
+ * Atomic GET operation.
+ *
+ * A simple Portals4 get operation is sufficient for data
+ * types supported by UPC.
+ *
+ * @param[in] thread Destination thread
+ * @param[in] doffset Destination offset
+ * @param[in] fetch_ptr Fetch value pointer
+ * @param[in] type Atomic data type
+ */
+void
+gupcr_atomic_get (size_t dthread, size_t doffset, void *fetch_ptr,
+ ptl_datatype_t type)
+{
+ ptl_ct_event_t ct;
+ ptl_process_t rpid;
+ char tmpbuf[128] __attribute__ ((unused));
+ size_t size;
+
+ gupcr_debug (FC_ATOMIC, "%lu:0x%lx", dthread, doffset);
+ if (fetch_ptr == NULL)
+ gupcr_error ("UPC_GET fetch pointer is NULL");
+
+ size = gupcr_get_atomic_size (type);
+ rpid.rank = dthread;
+ gupcr_portals_call (PtlGet, (gupcr_atomic_md, (ptl_size_t) fetch_ptr,
+ size, rpid, GUPCR_PTL_PTE_ATOMIC,
+ PTL_NO_MATCH_BITS, doffset,
+ PTL_NULL_USER_PTR));
+ gupcr_atomic_md_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_atomic_md_ct, gupcr_atomic_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_atomic_md_eq);
+ gupcr_fatal_error ("received an error on atomic MD");
+ }
+ gupcr_debug (FC_ATOMIC, "ov(%s)",
+ gupcr_get_buf_as_hex (tmpbuf, fetch_ptr, size));
+}
+
+/**
+ * Portals4 atomic set operation.
+ *
+ * Execute Portals4 PtlSwap with PTL_SWAP operation.
+ *
+ * @param[in] thread Destination thread
+ * @param[in] doffset Destination offset
+ * @param[in] fetch_ptr Fetch value pointer (optional)
+ * @param[in] value New value of atomic variable
+ * @param[in] type Atomic data type
+ */
+void
+gupcr_atomic_set (size_t dthread, size_t doffset, void *fetch_ptr,
+ const void *value, ptl_datatype_t type)
+{
+ ptl_process_t rpid;
+ ptl_ct_event_t ct;
+ char tmpbuf[128] __attribute__ ((unused));
+ char atomic_tmp_buf[GUPC_MAX_ATOMIC_SIZE];
+ size_t size = gupcr_get_atomic_size (type);
+ gupcr_debug (FC_ATOMIC, "%lu:0x%lx v(%s)", dthread, doffset,
+ gupcr_get_buf_as_hex (tmpbuf, value, size));
+ rpid.rank = dthread;
+ gupcr_portals_call (PtlSwap, (gupcr_atomic_md,
+ (ptl_size_t) atomic_tmp_buf,
+ gupcr_atomic_md, (ptl_size_t) value,
+ size, rpid, GUPCR_PTL_PTE_ATOMIC,
+ PTL_NO_MATCH_BITS, doffset, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA, NULL, PTL_SWAP, type));
+ gupcr_atomic_md_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_atomic_md_ct, gupcr_atomic_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_atomic_md_eq);
+ gupcr_fatal_error ("received an error on atomic MD");
+ }
+ if (fetch_ptr)
+ {
+ gupcr_debug (FC_ATOMIC, "ov(%s)",
+ gupcr_get_buf_as_hex (tmpbuf, atomic_tmp_buf, size));
+ memcpy (fetch_ptr, atomic_tmp_buf, size);
+ }
+}
+
+/**
+ * Portals4 atomic CSWAP operation.
+ *
+ * Execute Portals4 PtlSwap with PTL_CSWAP operation.
+ *
+ * @param[in] thread Destination thread
+ * @param[in] doffset Destination offset
+ * @param[in] fetch_ptr Fetch value pointer (optional)
+ * @param[in] expected Expected value of atomic variable
+ * @param[in] value New value of atomic variable
+ * @param[in] type Atomic data type
+ */
+void
+gupcr_atomic_cswap (size_t dthread, size_t doffset, void *fetch_ptr,
+ const void *expected, const void *value,
+ ptl_datatype_t type)
+{
+ ptl_process_t rpid;
+ ptl_ct_event_t ct;
+ char tmpbuf[128] __attribute__ ((unused));
+ char atomic_tmp_buf[GUPC_MAX_ATOMIC_SIZE];
+ size_t size = gupcr_get_atomic_size (type);
+ gupcr_debug (FC_ATOMIC, "%lu:0x%lx v(%s) e(%s)", dthread, doffset,
+ gupcr_get_buf_as_hex (tmpbuf, value, size),
+ gupcr_get_buf_as_hex (tmpbuf, expected, size));
+ rpid.rank = dthread;
+ gupcr_portals_call (PtlSwap, (gupcr_atomic_md,
+ (ptl_size_t) atomic_tmp_buf,
+ gupcr_atomic_md, (ptl_size_t) value,
+ size, rpid,
+ GUPCR_PTL_PTE_ATOMIC, PTL_NO_MATCH_BITS,
+ doffset, PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA,
+ expected, PTL_CSWAP, type));
+ gupcr_atomic_md_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_atomic_md_ct, gupcr_atomic_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_atomic_md_eq);
+ gupcr_fatal_error ("received an error on atomic MD");
+ }
+ if (fetch_ptr)
+ {
+ gupcr_debug (FC_ATOMIC, "ov(%s)",
+ gupcr_get_buf_as_hex (tmpbuf, atomic_tmp_buf, size));
+ memcpy (fetch_ptr, atomic_tmp_buf, size);
+ }
+}
+
+/**
+ * Portals4 atomic operation.
+ *
+ * Execute Portals4 atomic function and return the old value
+ * if requested.
+ * @param[in] thread Destination thread
+ * @param[in] doffset Destination offset
+ * @param[in] fetch_ptr Fetch value pointer (optional)
+ * @param[in] value Atomic value for the operation
+ * @param[in] op Atomic operation
+ * @param[in] type Atomic data type
+ */
+void
+gupcr_atomic_op (size_t dthread, size_t doffset, void *fetch_ptr,
+ const void *value, ptl_op_t op, ptl_datatype_t type)
+{
+ ptl_process_t rpid;
+ ptl_ct_event_t ct;
+ char tmpbuf[128] __attribute__ ((unused));
+ char atomic_tmp_buf[GUPC_MAX_ATOMIC_SIZE];
+ size_t size = gupcr_get_atomic_size (type);
+ gupcr_debug (FC_ATOMIC, "%lu:0x%lx %s:%s v(%s)", dthread, doffset,
+ gupcr_strptlop (op), gupcr_strptldatatype (type),
+ gupcr_get_buf_as_hex (tmpbuf, value, size));
+ rpid.rank = dthread;
+ if (fetch_ptr)
+ {
+ gupcr_portals_call (PtlFetchAtomic,
+ (gupcr_atomic_md, (ptl_size_t) atomic_tmp_buf,
+ gupcr_atomic_md, (ptl_size_t) value,
+ size, rpid, GUPCR_PTL_PTE_ATOMIC,
+ PTL_NO_MATCH_BITS, doffset,
+ PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA, op, type));
+ }
+ else
+ {
+ gupcr_portals_call (PtlAtomic,
+ (gupcr_atomic_md, (ptl_size_t) value,
+ size, PTL_ACK_REQ, rpid, GUPCR_PTL_PTE_ATOMIC,
+ PTL_NO_MATCH_BITS, doffset,
+ PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA, op, type));
+ }
+ gupcr_atomic_md_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_atomic_md_ct, gupcr_atomic_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_atomic_md_eq);
+ gupcr_fatal_error ("received an error on atomic MD");
+ }
+ if (fetch_ptr)
+ {
+ gupcr_debug (FC_ATOMIC, "ov(%s)",
+ gupcr_get_buf_as_hex (tmpbuf, atomic_tmp_buf, size));
+ memcpy (fetch_ptr, atomic_tmp_buf, size);
+ }
+}
+
+/**
+ * Initialize atomics resources.
+ * @ingroup INIT
+ */
+void
+gupcr_atomic_init (void)
+{
+ ptl_md_t md;
+
+ gupcr_log (FC_ATOMIC, "atomic init called");
+
+ /* Setup the Portals MD for local source/destination copying.
+ We need to map the whole user's space (same as gmem). */
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_atomic_md_ct));
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_atomic_md_eq));
+ md.length = (ptl_size_t) USER_PROG_MEM_SIZE;
+ md.start = (void *) USER_PROG_MEM_START;
+ md.options = PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_CT_REPLY |
+ PTL_MD_EVENT_SUCCESS_DISABLE;
+ md.eq_handle = gupcr_atomic_md_eq;
+ md.ct_handle = gupcr_atomic_md_ct;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_atomic_md));
+
+ /* Reset number of acknowledgments. */
+ gupcr_atomic_md_count = 0;
+}
+
+/**
+ * Release atomics resources.
+ * @ingroup INIT
+ */
+void
+gupcr_atomic_fini (void)
+{
+ gupcr_log (FC_ATOMIC, "atomic fini called");
+ /* Release atomic MD and its resources. */
+ gupcr_portals_call (PtlMDRelease, (gupcr_atomic_md));
+ gupcr_portals_call (PtlCTFree, (gupcr_atomic_md_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_atomic_md_eq));
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_atomic_sup.h b/libgupc/portals4/gupcr_atomic_sup.h
new file mode 100644
index 00000000000..54aee5cdd7e
--- /dev/null
+++ b/libgupc/portals4/gupcr_atomic_sup.h
@@ -0,0 +1,84 @@
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_ATOMIC_SUP_H_
+#define _GUPCR_ATOMIC_SUP_H_ 1
+
+/**
+ * @file gupcr_atomic_sup.h
+ * GUPC Portals4 atomics implementation support routines.
+ *
+ * @addtogroup ATOMIC GUPCR Atomics Support Functions
+ * @{
+ */
+
+/** Maximum size of atomic types */
+#define GUPC_MAX_ATOMIC_SIZE 16
+
+/** Convert from UPC atomics int to Portals atomic type */
+#if __SIZEOF_INT__ == 4
+#define UPC_ATOMIC_TO_PTL_INT PTL_INT32_T
+#define UPC_ATOMIC_TO_PTL_UINT PTL_UINT32_T
+#elif __SIZEOF_INT__ == 8
+#define UPC_ATOMIC_TO_PTL_INT PTL_INT64_T
+#define UPC_ATOMIC_TO_PTL_UINT PTL_UINT64_T
+#else
+#error "Size of int not supported"
+#endif
+/** Convert from UPC atomics long to Portals atomic type */
+#if __SIZEOF_LONG__ == 4
+#define UPC_ATOMIC_TO_PTL_LONG PTL_INT32_T
+#define UPC_ATOMIC_TO_PTL_ULONG PTL_UINT32_T
+#elif __SIZEOF_LONG__ == 8
+#define UPC_ATOMIC_TO_PTL_LONG PTL_INT64_T
+#define UPC_ATOMIC_TO_PTL_ULONG PTL_UINT64_T
+#else
+#error "Size of long not supported"
+#endif
+/** Convert from UPC atomic int32 to Portals atomic type */
+#define UPC_ATOMIC_TO_PTL_INT32 PTL_INT32_T
+#define UPC_ATOMIC_TO_PTL_UINT32 PTL_UINT32_T
+/** Convert from UPC atomic int64 to Portals atomic type */
+#define UPC_ATOMIC_TO_PTL_INT64 PTL_INT64_T
+#define UPC_ATOMIC_TO_PTL_UINT64 PTL_UINT64_T
+/** Convert from UPC atomic float to Portals atomic type */
+#define UPC_ATOMIC_TO_PTL_FLOAT PTL_FLOAT
+/** Convert from UPC atomic double to Portals atomic type */
+#define UPC_ATOMIC_TO_PTL_DOUBLE PTL_DOUBLE
+
+/** @} */
+
+void gupcr_atomic_put (size_t, size_t, size_t, ptl_op_t op, ptl_datatype_t);
+void gupcr_atomic_get (size_t, size_t, void *, ptl_datatype_t);
+void gupcr_atomic_set (size_t, size_t, void *, const void *, ptl_datatype_t);
+void gupcr_atomic_cswap (size_t, size_t, void *, const void *,
+ const void *, ptl_datatype_t);
+void gupcr_atomic_op (size_t, size_t, void *, const void *,
+ ptl_op_t, ptl_datatype_t);
+void gupcr_atomic_init (void);
+void gupcr_atomic_fini (void);
+
+#endif /* gupcr_atomic_sup.h */
diff --git a/libgupc/portals4/gupcr_backtrace.c b/libgupc/portals4/gupcr_backtrace.c
new file mode 100644
index 00000000000..8d482adc2e8
--- /dev/null
+++ b/libgupc/portals4/gupcr_backtrace.c
@@ -0,0 +1,400 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_utils.h"
+#include "gupcr_backtrace.h"
+#include "gupcr_barrier.h"
+#include <signal.h>
+#include <string.h>
+#if HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+/** Skip over frames belonging to the backtrace code itself. */
+#define GUPCR_BT_SKIP_FRAME_CNT 3
+/** Maximum number of stack frames to display. */
+#define GUPCR_BT_DEPTH_CNT 128
+
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+/** Default backtrace file name prefix. */
+#define UPC_BACKTRACE_PREFIX "backtrace"
+
+/** Full path of the executable program. */
+static char *gupcr_abs_execname;
+
+/** Backtrace on faults enabled flag. */
+static int bt_enabled = 0;
+
+/**
+ * GLIBC backtrace.
+ *
+ * Show backtrace by using the GLIBC backtrace functionality.
+ * Backtrace is improved with the source file/line numbers if
+ * addr2line is available.
+ *
+ * By default backtrace lines are sent to the 'stderr' file
+ * descriptor. However, an environment variable
+ * UPC_BACKTRACEFILE can be used to redirect the backtrace
+ * to an actual file and it is used as a simple prefix for
+ * the backtrace file. For example, if it is set to "/tmp/trace-upc",
+ * the actual trace file is going to be "/tmp/trace-upc-PID.MYTHREAD".
+ * If empty environment variable is provided, a simple "trace" prefix
+ * is used.
+ *
+ */
+void
+gupcr_backtrace (void)
+{
+ void *strace[GUPCR_BT_DEPTH_CNT];
+ size_t size,i;
+ char **strace_str;
+ char *file_env;
+ int under_upc_main = 1;
+ FILE *traceout = stderr;
+
+ file_env = getenv (GUPCR_BACKTRACE_FILE_ENV);
+ if (file_env)
+ {
+ #define MAX_INT_STRING ".2147483647"
+ char *tracefile;
+ int len, lenw;
+ /* Use default trace file name if one not specified by the user. */
+ if (!strlen (file_env))
+ file_env = (char *) UPC_BACKTRACE_PREFIX;
+ len = strlen (file_env) + strlen (MAX_INT_STRING) + 1;
+ tracefile = malloc (len);
+ if (!tracefile)
+ gupcr_fatal_error ("cannot allocate (%d) memory for backtrace file %s",
+ len, file_env);
+ lenw = snprintf (tracefile, len, "%s.%d", file_env, MYTHREAD);
+ if ((lenw >= len) || (lenw < 0))
+ gupcr_fatal_error ("cannot create backtrace file name: %s", file_env);
+ traceout = fopen (tracefile, "w");
+ if (!traceout)
+ gupcr_fatal_error ("cannot open backtrace file: %s", tracefile);
+ free (tracefile);
+ }
+ else
+ fprintf (traceout, "Thread %d backtrace:\n", MYTHREAD);
+
+ /* Use "backtrace" functionality of glibc to receive
+ backtrace addresses. */
+ size = backtrace (strace, GUPCR_BT_DEPTH_CNT);
+ /* Add symbolic information to each address
+ and print the stack trace. */
+ for (i = GUPCR_BT_SKIP_FRAME_CNT; i < size; i++)
+ {
+ if (under_upc_main)
+ {
+# if HAVE_UPC_BACKTRACE_ADDR2LINE
+ /* Call addr2line to generate source files, line numbers,
+ and functions. In case of any error (malloc, snprintf)
+ do not abort the program. */
+ FILE *a2l;
+ #define CMD_TMPL "%s -f -e %s %p"
+ /* Allow space for addr2line, filename, command line options,
+ and address argument for addr2line. */
+ int cmd_size = strlen (GUPCR_BACKTRACE_ADDR2LINE) +
+ strlen (gupcr_abs_execname) +
+ strlen (CMD_TMPL) +
+ strlen ("0x1234567812345678");
+ int sz;
+ char *cmd = malloc (cmd_size);
+ /* Create an actual addr2line command. */
+ sz = snprintf (cmd, cmd_size, CMD_TMPL, GUPCR_BACKTRACE_ADDR2LINE,
+ gupcr_abs_execname, strace[i]);
+ if ((sz >= cmd_size) || (sz < 0))
+ {
+ fprintf (traceout, "unable to create addr2line "
+ "command line\n");
+ return;
+ }
+ /* Execute addr2line. */
+ a2l = popen (cmd, "r");
+ free (cmd);
+ if (a2l)
+ {
+ /* addr2line responds with two lines: procedure name and
+ the file name with line number. */
+ int max_rep = 2 * FILENAME_MAX;
+ /* Build a data structure that is identical to the
+ structure returned by the glibc backtrace_symbol(). */
+ struct back_trace {
+ char *addr;
+ char data[1];
+ };
+ struct back_trace *rep = malloc (max_rep);
+ int index = 0;
+ if (!rep)
+ {
+ fprintf (traceout, "unable to acquire memory "
+ "for backtracing\n");
+ return;
+ }
+ rep->data[0] = '\0';
+ /* Read addr2line response. */
+ while (fgets(&rep->data[index], max_rep-index, a2l))
+ {
+ /* Remove all the new lines, as addr2line returns
+ info in multiple lines. */
+ index = strlen (&rep->data[0]);
+ if (rep->data[index - 1] == '\n')
+ rep->data[index - 1] = ' ';
+ }
+ pclose (a2l);
+ rep->addr = &rep->data[0];
+ strace_str = &rep->addr;
+ }
+ else
+ {
+ /* Somehow we failed to invoke addr2line, fall back
+ to glibc. */
+ strace_str = backtrace_symbols (&strace[i], 1);
+ }
+# else
+ strace_str = backtrace_symbols (&strace[i], 1);
+# endif
+ fprintf (traceout, "[%4d][%lld] %s\n", MYTHREAD,
+ (long long int) (i - GUPCR_BT_SKIP_FRAME_CNT), *strace_str);
+ /* Extra info for the barrier. */
+ if (strstr( *strace_str, "__upc_wait"))
+ {
+ fprintf (traceout, "[%4d] BARRIER ID: %d\n", MYTHREAD,
+ gupcr_barrier_id);
+ }
+ if (strstr (*strace_str, "upc_main"))
+ under_upc_main = 0;
+ /* Symbol trace buffer must be released. */
+ free (strace_str);
+ }
+ }
+ fflush (traceout);
+ if (file_env)
+ fclose (traceout);
+}
+
+#define GUPCR_BACKTRACE_PID_BUFLEN 16
+
+/**
+ * Backtrace on fatal errors.
+ *
+ * Print backtrace (stack frames) on fatal errors: run-time
+ * fatal error or segmentation fault.
+ *
+ * Only print backtrace if environment variable UPC_BACKTRACE
+ * is set to 1. The following order of backtrace capabilities
+ * is searched and executed:
+ *
+ * (1) Use GDB for backtrace (if enabled)
+ * (2) Use GLIBC backtrace with source file/line display (if
+ * addr2line is available)
+ * (3) Use GLIBC backtrace with raw addresses (display is
+ * improved if -rdynamic option is supported by the linker)
+ *
+ */
+void
+gupcr_fatal_error_backtrace (void)
+{
+ if (bt_enabled)
+ {
+#ifdef HAVE_UPC_BACKTRACE_GDB
+ {
+ char *env;
+ const char *gdb;
+ char pid_buf[GUPCR_BACKTRACE_PID_BUFLEN];
+ int child_pid;
+ /* Which gdb to use? */
+ env = getenv (GUPCR_BACKTRACE_GDB_ENV);
+ if (!env || (strlen (env) == 0))
+ gdb = GUPCR_BACKTRACE_GDB;
+ else
+ gdb = (const char *) env;
+ if (strcmp (gdb, "none"))
+ {
+ const char *err_msg = 0;
+ char tmpf[PATH_MAX];
+ int fbt;
+ const char *btcmd = "backtrace 30\n";
+ fprintf (stderr, "Thread %d GDB backtrace:\n", MYTHREAD);
+ /* Get pid and name of the running program. */
+ sprintf(pid_buf, "%d", getpid());
+ /* Create temp file for GDB commands. */
+ if ((fbt = gupcr_create_temp_file
+ ("upc_bt_gdb.XXXXXX", tmpf, &err_msg)) == -1)
+ {
+ fprintf (stderr, "cannot open gdb command - %s\n", err_msg);
+ return;
+ }
+ if (write (fbt, btcmd, sizeof (btcmd)) == -1)
+ {
+ perror ("cannot write gdb command file for backtrace");
+ return;
+ }
+ if (close (fbt))
+ {
+ perror ("cannot close gdb command file for backtrace");
+ return;
+ }
+ child_pid = fork();
+ if (!child_pid)
+ {
+ dup2(2,1);
+ execlp(gdb, gdb, "-nx", "-batch", "-x", tmpf,
+ gupcr_abs_execname, pid_buf, NULL);
+ fprintf (stderr, "cannot start GDB - %s\n", gdb);
+ abort(); /* If gdb failed to start */
+ }
+ else
+ waitpid(child_pid,NULL,0);
+ unlink (tmpf);
+ return;
+ }
+ }
+#endif /* GUPCR_BACKTRACE_GDB */
+
+ /* Simple backtrace only. */
+ gupcr_backtrace ();
+ }
+}
+
+/**
+ * Backtrace signal handler.
+ *
+ * Display stack frames on a request. In case of the
+ * monitor thread only print the mappings between the
+ * UPC threads and processes.
+ */
+static void
+gupcr_backtrace_handler (int sig __attribute__ ((unused)),
+ siginfo_t *siginfo __attribute__ ((unused)),
+ void *context __attribute__ ((unused)))
+{
+ gupcr_backtrace ();
+}
+
+/**
+ * Backtrace fault handler.
+ *
+ * A fault happened and backtrace is enabled. Allow for only
+ * one thread to print the backtrace. The restore signal
+ * handlers to their default and return ensures that
+ * signal terminates the thread and allows for the monitor
+ * thread to terminate all the other threads..
+ */
+static void
+gupcr_fault_handler (int sig __attribute__ ((unused)),
+ siginfo_t *siginfo __attribute__ ((unused)),
+ void *context __attribute__ ((unused)))
+{
+ gupcr_backtrace_restore_handlers ();
+ gupcr_fatal_error_backtrace ();
+}
+
+/**
+ * Initialize UPC backtrace.
+ */
+void
+gupcr_backtrace_init (const char *execname)
+{
+ /* Find the full path for the executable. On linux systems we
+ might be able to read "/proc/self/exe" to the get the full
+ executable path. But, it is not portable. */
+ int slen = sizeof (gupcr_abs_execname) - strlen (execname) - 2;
+ gupcr_abs_execname = malloc (PATH_MAX + 1);
+ if (!gupcr_abs_execname)
+ gupcr_fatal_error ("cannot allocate space for executable file name");
+ *gupcr_abs_execname = '\0';
+ if (execname[0] != '/')
+ {
+ if (!getcwd (gupcr_abs_execname, slen))
+ strcpy (gupcr_abs_execname, "/BT_CANNOT_CREATE_ABS_PATH");
+ strcat (gupcr_abs_execname, "/");
+ }
+ strcat (gupcr_abs_execname, execname);
+
+#ifdef HAVE_UPC_BACKTRACE_SIGNAL
+ {
+ /* Install backtrace signal handler (backtrace on request). */
+ struct sigaction act;
+ memset (&act, '\0', sizeof(act));
+ act.sa_sigaction = &gupcr_backtrace_handler;
+ act.sa_flags = SA_SIGINFO;
+ if (sigaction(GUPCR_BACKTRACE_SIGNAL, &act, NULL) < 0) {
+ perror ("was not able to install backtrace handler");
+ }
+ }
+#endif
+
+ /* Install signal handlers only if backtrace is enabled. */
+ bt_enabled = gupcr_is_backtrace_enabled ();
+
+ if (bt_enabled)
+ {
+ struct sigaction act;
+ memset (&act, '\0', sizeof(act));
+ act.sa_sigaction = &gupcr_fault_handler;
+ act.sa_flags = SA_SIGINFO;
+ if (sigaction(SIGABRT, &act, NULL) < 0)
+ perror ("unable to install SIGABRT handler");
+ if (sigaction(SIGILL, &act, NULL) < 0)
+ perror ("unable to install SIGILL handler");
+ if (sigaction(SIGSEGV, &act, NULL) < 0)
+ perror ("unable to install SIGSEGV handler");
+ if (sigaction(SIGBUS, &act, NULL) < 0)
+ perror ("unable to install SIGBUS handler");
+ if (sigaction(SIGFPE, &act, NULL) < 0)
+ perror ("unable to install SIGFPE handler");
+ }
+}
+
+/**
+ * Restore default handlers.
+ *
+ * Has to be called once the run-time discovered
+ * a fatal error.
+ */
+void
+gupcr_backtrace_restore_handlers (void)
+{
+ /* Don't handle any signals with backtrace code. Install
+ default handlers. */
+ signal (SIGABRT, SIG_DFL);
+ signal (SIGILL, SIG_DFL);
+ signal (SIGSEGV, SIG_DFL);
+ signal (SIGBUS, SIG_DFL);
+ signal (SIGFPE, SIG_DFL);
+}
diff --git a/libgupc/portals4/gupcr_backtrace.h b/libgupc/portals4/gupcr_backtrace.h
new file mode 100644
index 00000000000..63a1aef3cbb
--- /dev/null
+++ b/libgupc/portals4/gupcr_backtrace.h
@@ -0,0 +1,45 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef GUPCR_BACKTRACE_H_
+#define GUPCR_BACKTRACE_H_
+
+/* Environment variables. */
+/** Enable/Disable backtrace env variable. */
+#define GUPCR_BACKTRACE_ENV "UPC_BACKTRACE"
+/** Enable/Disable STAT backtrace env variable. */
+#define GUPCR_BACKTRACE_FILE_ENV "UPC_BACKTRACEFILE"
+/** GDB command for backtrace env variable. */
+#define GUPCR_BACKTRACE_GDB_ENV "UPC_BACKTRACE_GDB"
+
+/* Interfaces. */
+extern void gupcr_backtrace (void);
+extern void gupcr_fatal_backtrace (void);
+extern void gupcr_backtrace_init (const char *execname);
+extern void gupcr_backtrace_restore_handlers (void);
+
+#endif /* gupc_backtrace.h */
diff --git a/libgupc/portals4/gupcr_barrier.c b/libgupc/portals4/gupcr_barrier.c
new file mode 100644
index 00000000000..f558f09dda7
--- /dev/null
+++ b/libgupc/portals4/gupcr_barrier.c
@@ -0,0 +1,1003 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_barrier.c
+ * GUPC Portals4 barrier implementation.
+ *
+ * The UPC barrier synchronization statements are:
+ * - upc_notify <i>expression</i>
+ * - upc_wait <i>expression</i>
+ * - upc_barrier <i>expression</i>
+ *
+ * The upc barrier statement is equivalent to the compound statement:
+ * <i>{ upc_notify barrier_value; upc_wait barrier_value; }</i>
+ *
+ * Important rules:
+ * - Each thread executes an alternating sequence of upc_notify and upc_wait
+ * statements.
+ * - A thread completes a <i>upc_wait</i> statement when all threads
+ * have executed a matching <i>upc_notify</i> statement.
+ * - <i>upc_notify</i> and <i>upc_wait</i> are collective operations and
+ * <i>expression</i> (if available) must match across all threads.
+ * - An empty <i>expression</i> matches any barrier ID.
+ *
+ * The GUPC runtime barrier implementation uses an "all reduce"
+ * algorithm as outlined in the paper <i>Enabling Flexible Collective
+ * Communication Offload with Triggered Operations</i> by Keith Underwood
+ * et al. January, 2007. Portals atomic operations and triggered
+ * atomic operations are used to propagate and verify
+ * that all UPC threads have entered the same synchronization phase
+ * with matching barrier IDs.
+ *
+ * For the purposes of implementing GUPC barriers, all UPC threads
+ * in a given job are organized as a tree. Thread 0 is the
+ * root thread (at the top of the tree). Other threads can be
+ * either an inner thread (has at least one child), or a leaf
+ * thread (has no children).
+ *
+ * A UPC barrier is implemented in two distinctive steps: notify and wait.
+ *
+ * A notify step uses the GUPCR_PTL_PTE_BARRIER_UP PTE to pass
+ * its barrier ID to the parent. The result of an atomic PTL_MIN
+ * operation among children and their parent is passed to the
+ * parent's parent until thread 0 is reached.
+ *
+ * A wait step uses the GUPCR_PTL_PTE_BARRIER_DOWN PTE to pass
+ * the derived consensus barrier ID to all threads. An error
+ * is raised if the derived ID does not match the thread's barrier ID.
+ *
+ * This implementation supports a split phase barrier where a given
+ * thread completes its wait statement once all other threads
+ * have reached their matching notify statement.
+ *
+ * Each thread uses the following resources:
+ *
+ * - PTEs (and LEs) for passing barrier IDs UP and DOWN the tree
+ * - MDs for sending a thread's barrier ID to parents and children
+ * - Counting events for LEs and MDs
+ * - Event queues for failure events on LEs and MDs
+ *
+ * Extensive use of Portals triggered functions allow for the efficient
+ * implementation of a split phase barrier.
+ *
+ * @addtogroup BARRIER GUPCR Barrier Functions
+ * @{
+ */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_sync.h"
+#include "gupcr_broadcast.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+
+/** Per-thread flag set by upc_notify() and cleared by upc_wait() */
+static int gupcr_barrier_active = 0;
+
+/** Max barrier ID used by the barrier implementation.
+ * The Portals PTL_MIN atomic function is used by
+ * each thread to report its barrier ID to its parents.
+ * The MAX barrier ID value is used to initialize the memory
+ * location targeted by PTL_MIN function.
+ */
+#define BARRIER_ID_MAX INT_MAX
+/** Anonymous barrier ID used by the barrier implementation.
+ * This barrier ID is used for barrier statements that do not
+ * specify a barrier ID and it matches any other barrier ID.
+ */
+#define BARRIER_ANONYMOUS INT_MIN
+/** Size of the barrier ID */
+#define BARRIER_ID_SIZE (sizeof (gupcr_barrier_value))
+
+/** Leaf thread check */
+#define LEAF_THREAD ((THREADS != 1) && (gupcr_child_cnt == 0))
+/** Root thread check */
+#define ROOT_THREAD (gupcr_parent_thread == -1)
+/** Inner thread check */
+#define INNER_THREAD ((gupcr_child_cnt != 0) && (gupcr_parent_thread != -1))
+
+/** Thread's current barrier ID */
+int gupcr_barrier_id;
+
+/** Memory storage for notify barrier ID. Mapped by
+ LE for external access, and MD for internal access. */
+
+static int gupcr_notify_value;
+/** Barrier notify LE handle (appended to GUPCR_PTL_PTE_BARRIER_UP) */
+static ptl_handle_le_t gupcr_notify_le;
+/** Barrier notify LE EQ handle */
+static ptl_handle_eq_t gupcr_notify_le_eq;
+/** Barrier notify LE CT handle */
+static ptl_handle_ct_t gupcr_notify_le_ct;
+/** Barrier notify LE CT wait counter */
+static ptl_size_t gupcr_notify_le_count;
+/** Barrier notify MD handle */
+static ptl_handle_md_t gupcr_notify_md;
+/** Barrier notify MD EQ handle */
+static ptl_handle_eq_t gupcr_notify_md_eq;
+/** Barrier notify MD CT handle */
+static ptl_handle_ct_t gupcr_notify_md_ct;
+/** Barrier notify MD CT wait counter */
+static ptl_size_t gupcr_notify_md_count;
+
+/** Barrier wait memory buffer pointer. The buffer is
+ mapped by a Portals LE for external access, and a Portals
+ MD for internal access. A pointer to the buffer is needed
+ because the broadcast implementation used internally by the
+ UPC runtime can broadcast arbitrarily sized values (that may
+ be larger than an 'int'. */
+static int *gupcr_wait_ptr;
+/** Barrier wait LE handle (appended to GUPCR_PTL_PTE_BARRIER_DOWN) */
+static ptl_handle_le_t gupcr_wait_le;
+/** Barrier wait LE CT handle */
+static ptl_handle_ct_t gupcr_wait_le_ct;
+/** Barrier wait LE CT wait counter */
+static ptl_size_t gupcr_wait_le_count;
+/** Barrier wait LE EQ handle */
+static ptl_handle_eq_t gupcr_wait_le_eq;
+/** Barrier wait MD handle */
+static ptl_handle_md_t gupcr_wait_md;
+/** Barrier wait MD CT handle */
+static ptl_handle_ct_t gupcr_wait_md_ct;
+/** Barrier wait MD CT wait counter */
+static ptl_size_t gupcr_wait_md_count;
+/** Barrier wait MD EQ handle */
+static ptl_handle_eq_t gupcr_wait_md_eq;
+
+/** Memory storage (notify source) that holds the barrier ID for the PTL_MIN
+ atomic function used in the notify phase of the barrier. */
+static int gupcr_barrier_value;
+/** Barrier MD handle for the notify source */
+static ptl_handle_md_t gupcr_barrier_md;
+/** Barrier CT handle for the notify source */
+static ptl_handle_ct_t gupcr_barrier_md_ct;
+/** Barrier CT handle for the notify source wait counter */
+static ptl_size_t gupcr_barrier_md_count;
+/** Barrier EQ handle for the notify source */
+static ptl_handle_eq_t gupcr_barrier_md_eq;
+
+/** Memory storage that holds the maximum barrier ID value used to
+ re-initialize the memory storage for the notify barrier ID. */
+static int gupcr_barrier_max_value = BARRIER_ID_MAX;
+/** Barrier MD for MAX re-init */
+static ptl_handle_md_t gupcr_barrier_max_md;
+/** Barrier CT handle for MAX re-init */
+static ptl_handle_ct_t gupcr_barrier_max_md_ct;
+/** Barrier CT handle for MAX re-init wait counter */
+static ptl_size_t gupcr_barrier_max_md_count;
+/** Barrier EQ handle for MAX re-init */
+static ptl_handle_eq_t gupcr_barrier_max_md_eq;
+
+/**
+ * @fn __upc_notify (int barrier_id)
+ * UPC <i>upc_notify<i> statement implementation
+ *
+ * This procedure sets the necessary Portals triggers to implement
+ * the pass that derives a consensus barrier ID value across all
+ * UPC threads. The inner threads use Portals triggered operations
+ * to pass the barrier ID negotiated among itself and its children
+ * up the tree its parent.
+ * @param [in] barrier_id Barrier ID
+ */
+void
+__upc_notify (int barrier_id)
+{
+ ptl_process_t rpid __attribute ((unused));
+
+ gupcr_trace (FC_BARRIER, "BARRIER NOTIFY ENTER %d", barrier_id);
+
+ if (gupcr_barrier_active)
+ gupcr_error ("two successive upc_notify statements executed "
+ "without an intervening upc_wait");
+ gupcr_barrier_active = 1;
+ gupcr_barrier_id = barrier_id;
+
+ /* The UPC shared memory consistency model requires all outstanding
+ read/write operations to complete on the thread's
+ current synchronization phase. */
+ gupcr_gmem_sync ();
+
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ if (THREADS == 1)
+ return;
+
+ /* Use barrier MAX number if barrier ID is "match all"
+ This effectively excludes the thread from setting the min ID
+ among the threads. */
+ gupcr_barrier_value = (barrier_id == BARRIER_ANONYMOUS) ?
+ BARRIER_ID_MAX : barrier_id;
+
+ if (gupcr_debug_enabled (FC_BARRIER))
+ {
+ ptl_ct_event_t ct;
+ gupcr_portals_call (PtlCTGet, (gupcr_wait_le_ct, &ct));
+ gupcr_debug (FC_BARRIER, "Wait LE counter: %lu (%lu)",
+ (long unsigned) ct.success,
+ (long unsigned) gupcr_wait_le_count);
+ gupcr_portals_call (PtlCTGet, (gupcr_wait_md_ct, &ct));
+ gupcr_debug (FC_BARRIER, "Wait MD counter: %lu (%lu)",
+ (long unsigned) ct.success,
+ (long unsigned) gupcr_wait_md_count);
+ gupcr_portals_call (PtlCTGet, (gupcr_notify_le_ct, &ct));
+ gupcr_debug (FC_BARRIER, "Notify LE counter: %lu (%lu)",
+ (long unsigned) ct.success,
+ (long unsigned) gupcr_notify_le_count);
+ gupcr_portals_call (PtlCTGet, (gupcr_notify_md_ct, &ct));
+ gupcr_debug (FC_BARRIER, "Notify MD counter: %lu (%lu)",
+ (long unsigned) ct.success,
+ (long unsigned) gupcr_notify_md_count);
+ gupcr_portals_call (PtlCTGet, (gupcr_barrier_md_ct, &ct));
+ gupcr_debug (FC_BARRIER, "Barrier MD counter: %lu (%lu)",
+ (long unsigned) ct.success,
+ (long unsigned) gupcr_barrier_md_count);
+ gupcr_portals_call (PtlCTGet, (gupcr_barrier_max_md_ct, &ct));
+ gupcr_debug (FC_BARRIER, "Barrier max MD counter: %lu (%lu)",
+ (long unsigned) ct.success,
+ (long unsigned) gupcr_barrier_max_md_count);
+ }
+
+ if (LEAF_THREAD)
+ {
+ /* Send the barrier ID to the parent - use atomic PTL_MIN to allow
+ parent to find the minimum barrier ID among itself and its
+ children. */
+ gupcr_debug (FC_BARRIER, "Send atomic PTL_MIN %d to (%d)",
+ gupcr_barrier_value, gupcr_parent_thread);
+ rpid.rank = gupcr_parent_thread;
+ gupcr_portals_call (PtlAtomic, (gupcr_barrier_md, 0,
+ BARRIER_ID_SIZE, PTL_NO_ACK_REQ,
+ rpid, GUPCR_PTL_PTE_BARRIER_UP,
+ PTL_NO_MATCH_BITS, 0, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA, PTL_MIN,
+ PTL_INT32_T));
+ }
+ else
+ {
+ int i;
+ if (ROOT_THREAD)
+ {
+ /* The consensus MIN barrier ID derived in the notify (UP) phase
+ must be transferred to the wait LE for delivery to all children.
+ Trigger: Barrier ID received in the notify phase.
+ Action: Send the barrier ID to the wait buffer of the
+ barrier DOWN LE. */
+ rpid.rank = MYTHREAD;
+ gupcr_notify_le_count += gupcr_child_cnt + 1;
+ gupcr_portals_call (PtlTriggeredPut, (gupcr_notify_md, 0,
+ BARRIER_ID_SIZE,
+ PTL_NO_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_DOWN,
+ PTL_NO_MATCH_BITS, 0,
+ PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA,
+ gupcr_notify_le_ct,
+ gupcr_notify_le_count));
+
+ }
+ else
+ {
+ /* The consensus MIN barrier ID of the inner thread and its children
+ is sent to the parent UPC thread.
+ Trigger: All children and this thread execute an atomic PTL_MIN
+ using each thread's UP LE.
+ Action: Transfer the consensus minimum barrier ID to the
+ this thread's parent. */
+ rpid.rank = gupcr_parent_thread;
+ gupcr_notify_le_count += gupcr_child_cnt + 1;
+ gupcr_portals_call (PtlTriggeredAtomic, (gupcr_notify_md, 0,
+ BARRIER_ID_SIZE,
+ PTL_NO_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_UP,
+ PTL_NO_MATCH_BITS, 0,
+ PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA,
+ PTL_MIN, PTL_INT32_T,
+ gupcr_notify_le_ct,
+ gupcr_notify_le_count));
+ }
+
+ /* Trigger: Barrier ID received in the wait buffer.
+ Action: Reinitialize the barrier UP ID to barrier MAX value
+ for the next call to upc_notify. */
+ rpid.rank = MYTHREAD;
+ gupcr_wait_le_count += 1;
+ gupcr_portals_call (PtlTriggeredPut, (gupcr_barrier_max_md, 0,
+ BARRIER_ID_SIZE,
+ PTL_NO_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_UP,
+ PTL_NO_MATCH_BITS, 0,
+ PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA,
+ gupcr_wait_le_ct,
+ gupcr_wait_le_count));
+
+ /* Trigger: The barrier ID is reinitialized to MAX.
+ Action: Send the consensus barrier ID to all children. */
+ gupcr_notify_le_count += 1;
+ for (i = 0; i < gupcr_child_cnt; i++)
+ {
+ rpid.rank = gupcr_child[i];
+ gupcr_portals_call (PtlTriggeredPut, (gupcr_wait_md, 0,
+ BARRIER_ID_SIZE,
+ PTL_OC_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_DOWN,
+ PTL_NO_MATCH_BITS, 0,
+ PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA,
+ gupcr_notify_le_ct,
+ gupcr_notify_le_count));
+ }
+
+ /* Allow notify to proceed and to possibly complete the wait
+ phase on other threads. */
+
+ /* Find the minimum barrier ID among children and the root. */
+ gupcr_debug (FC_BARRIER, "Send atomic PTL_MIN %d to (%d)",
+ gupcr_barrier_value, MYTHREAD);
+ rpid.rank = MYTHREAD;
+ gupcr_portals_call (PtlAtomic, (gupcr_barrier_md, 0,
+ BARRIER_ID_SIZE, PTL_NO_ACK_REQ,
+ rpid, GUPCR_PTL_PTE_BARRIER_UP,
+ PTL_NO_MATCH_BITS, 0, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA, PTL_MIN,
+ PTL_INT32_T));
+ }
+#else
+ /* The UPC runtime barrier implementation that does not use
+ Portals triggered operations does not support split phase barriers.
+ In this case, all Portals actions related to the barrier
+ are performed in the __upc_wait() function. */
+#endif
+ gupcr_trace (FC_BARRIER, "BARRIER NOTIFY EXIT %d", barrier_id);
+}
+
+/**
+ * @fn __upc_wait (int barrier_id)
+ * UPC <i>upc_wait</i> statement implementation
+ *
+ * This procedure waits to receive the derived consensus
+ * barrier ID from the parent (leaf thread) or acknowledges that
+ * all children received the consensus barrier ID (inner
+ * and root threads). The consensus barrier ID is checked
+ * against the barrier ID passed in as an argument.
+ * @param [in] barrier_id Barrier ID
+ */
+void
+__upc_wait (int barrier_id)
+{
+ ptl_ct_event_t ct;
+ ptl_process_t rpid __attribute ((unused));
+ int received_barrier_id;
+ gupcr_trace (FC_BARRIER, "BARRIER WAIT ENTER %d", barrier_id);
+
+ if (!gupcr_barrier_active)
+ gupcr_error ("upc_wait statement executed without a "
+ "preceding upc_notify");
+
+ /* Check if notify/wait barrier IDs match.
+ BARRIER_ANONYMOUS matches any other barrier ID. */
+ if ((barrier_id != BARRIER_ANONYMOUS &&
+ gupcr_barrier_id != BARRIER_ANONYMOUS) &&
+ (gupcr_barrier_id != barrier_id))
+ {
+ gupcr_error ("UPC barrier identifier mismatch - notify %d, wait %d",
+ gupcr_barrier_id, barrier_id);
+ }
+
+ if (THREADS == 1)
+ {
+ gupcr_barrier_active = 0;
+ return;
+ }
+
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Wait for the barrier ID to propagate down the tree. */
+ if (gupcr_child_cnt)
+ {
+ /* Wait for the barrier ID to flow down to the children. */
+ gupcr_wait_md_count += gupcr_child_cnt;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_wait_md_ct, gupcr_wait_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_wait_md_eq);
+ gupcr_fatal_error ("received an error on wait MD");
+ }
+ }
+ else
+ {
+ gupcr_wait_le_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_wait_le_ct, gupcr_wait_le_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_wait_le_eq);
+ gupcr_fatal_error ("received an error on wait LE");
+ }
+ }
+ received_barrier_id = *gupcr_wait_ptr;
+#else
+ /* UPC Barrier implementation without Portals Triggered Functions. */
+
+ /* NOTIFY - Propagate minimal barrier ID to the root thread. */
+
+ /* Use the barrier maximum ID number if the barrier ID is "match all".
+ This effectively excludes the thread from setting the minimum ID
+ among the threads. */
+ gupcr_barrier_value = (barrier_id == BARRIER_ANONYMOUS) ?
+ BARRIER_ID_MAX : barrier_id;
+
+ if (!LEAF_THREAD)
+ {
+ /* This step is performed by the root thread and inner threads. */
+ /* Find the minimal barrier ID among the thread and children.
+ Use the Portals PTL_MIN atomic operation on the value
+ in the notify LE. */
+ gupcr_debug (FC_BARRIER, "Send atomic PTL_MIN %d to (%d)",
+ gupcr_barrier_value, MYTHREAD);
+ rpid.rank = MYTHREAD;
+ gupcr_portals_call (PtlAtomic, (gupcr_barrier_md, 0,
+ BARRIER_ID_SIZE, PTL_NO_ACK_REQ,
+ rpid, GUPCR_PTL_PTE_BARRIER_UP,
+ PTL_NO_MATCH_BITS, 0, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA, PTL_MIN,
+ PTL_INT32_T));
+ /* Wait for all children threads to report their barrier IDs.
+ Account for this thread's atomic PTL_MIN. */
+ gupcr_notify_le_count += gupcr_child_cnt + 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_notify_le_ct, gupcr_notify_le_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_notify_le_eq);
+ gupcr_fatal_error ("received an error on notify LE");
+ }
+ }
+
+ if (!ROOT_THREAD)
+ {
+ ptl_handle_md_t source_md;
+
+ /* This step is performed by leaf threads and inner threads. */
+ /* Send the barrier ID to the parent - use atomic PTL_MIN on the value
+ in the parents notify LE (derived minimal ID for the parent and its
+ children. */
+ gupcr_debug (FC_BARRIER, "Send atomic PTL_MIN %d to (%d)",
+ gupcr_barrier_value, gupcr_parent_thread);
+ if (LEAF_THREAD)
+ source_md = gupcr_barrier_md;
+ else
+ /* An inner thread uses the minimal barrier ID
+ derived from the parent thread and all its children. */
+ source_md = gupcr_notify_md;
+ rpid.rank = gupcr_parent_thread;
+ gupcr_portals_call (PtlAtomic,
+ (source_md, 0, BARRIER_ID_SIZE, PTL_NO_ACK_REQ,
+ rpid, GUPCR_PTL_PTE_BARRIER_UP,
+ PTL_NO_MATCH_BITS, 0, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA, PTL_MIN, PTL_INT32_T));
+ }
+
+ /* At this point, the derived minimal barrier ID among all threads
+ has arrived at the root thread. */
+ if (ROOT_THREAD)
+ {
+ *(int *) gupcr_wait_ptr = gupcr_notify_value;
+ }
+ else
+ {
+ /* Wait for the parent to send the derived agreed on barrier ID. */
+ gupcr_wait_le_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_wait_le_ct, gupcr_wait_le_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_wait_le_eq);
+ gupcr_fatal_error ("received an error on wait LE");
+ }
+ }
+
+ received_barrier_id = gupcr_notify_value;
+
+ /* An inner thread sends the derived consensus
+ minimum barrier ID to its children. */
+ if (!LEAF_THREAD)
+ {
+ int i;
+
+ /* Re-initialize the barrier ID maximum range value. */
+ gupcr_notify_value = BARRIER_ID_MAX;
+
+ /* Send the derived consensus minimum barrier ID to
+ this thread's children. */
+ for (i = 0; i < gupcr_child_cnt; i++)
+ {
+ rpid.rank = gupcr_child[i];
+ gupcr_portals_call (PtlPut,
+ (gupcr_wait_md, 0, BARRIER_ID_SIZE,
+ PTL_OC_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_DOWN, PTL_NO_MATCH_BITS,
+ 0, PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA));
+ }
+
+ /* Wait until all children receive the consensus minimum
+ barrier ID that is propagated down the tree. */
+ gupcr_wait_md_count += gupcr_child_cnt;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_wait_md_ct, gupcr_wait_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_wait_md_eq);
+ gupcr_fatal_error ("received an error on wait MD");
+ }
+ }
+
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Verify that the barrier ID matches. */
+ if (barrier_id != INT_MIN &&
+ barrier_id != received_barrier_id &&
+ received_barrier_id != BARRIER_ID_MAX)
+ gupcr_error ("thread %d: UPC barrier identifier mismatch among threads - "
+ "expected %d, received %d",
+ MYTHREAD, barrier_id, received_barrier_id);
+
+ /* UPC Shared Memory Consistency Model requires all outstanding
+ read/write operations to complete on the thread's enter
+ into the next synchronization phase. */
+ gupcr_gmem_sync ();
+
+ gupcr_barrier_active = 0;
+
+ gupcr_trace (FC_BARRIER, "BARRIER WAIT EXIT %d", barrier_id);
+}
+
+/**
+ * @fn __upc_barrier (int barrier_id)
+ * UPC language upc_barrier implementation.
+ *
+ * @param [in] barrier_id Barrier ID
+ */
+void
+__upc_barrier (int barrier_id)
+{
+ __upc_notify (barrier_id);
+ __upc_wait (barrier_id);
+}
+
+/* This Portals4 based broadcast implementation uses barrier resources
+ * to pass the broadcast message from thread 0 to all other threads. */
+
+/**
+ * @fn gupcr_bcast_send (void *value, size_t nbytes)
+ * Send broadcast message to all thread's children.
+ *
+ * The broadcast is a collective operation where thread 0 (root thread)
+ * sends a message to all other threads. This function must be
+ * called by the thread 0 only from a public function
+ * "gupcr_broadcast_put".
+ *
+ * @param [in] value Pointer to send value
+ * @param [in] nbytes Number of bytes to send
+ * @ingroup BROADCAST
+ */
+void
+gupcr_bcast_send (void *value, size_t nbytes)
+{
+ int i;
+ ptl_process_t rpid;
+ ptl_ct_event_t ct;
+
+ gupcr_trace (FC_BROADCAST, "BROADCAST SEND ENTER 0x%lx %lu",
+ (long unsigned) value, (long unsigned) nbytes);
+
+ /* This broadcast operation is implemented a collective operation.
+ Before proceeding, complete all outstanding shared memory
+ read/write operations. */
+ gupcr_gmem_sync ();
+
+ /* Copy the message into the buffer used for delivery
+ to the children threads. */
+ memcpy (gupcr_wait_ptr, value, nbytes);
+
+ gupcr_notify_le_count += gupcr_child_cnt;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_notify_le_ct, gupcr_notify_le_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_notify_le_eq);
+ gupcr_fatal_error ("received an error on notify LE");
+ }
+
+ /* Send broadcast to this thread's children. */
+ for (i = 0; i < gupcr_child_cnt; i++)
+ {
+ rpid.rank = gupcr_child[i];
+ gupcr_debug (FC_BROADCAST, "Send broadcast message to child (%d)",
+ gupcr_child[i]);
+ gupcr_portals_call (PtlPut, (gupcr_wait_md, 0,
+ nbytes, PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_DOWN,
+ PTL_NO_MATCH_BITS, 0, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA));
+ }
+
+ /* Wait for message delivery to all children. This ensures that
+ the source buffer is not overwritten by back-to-back
+ broadcast operations. */
+ gupcr_wait_md_count += gupcr_child_cnt;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_wait_md_ct, gupcr_wait_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_wait_md_eq);
+ gupcr_fatal_error ("received an error on wait MD");
+ }
+ gupcr_trace (FC_BROADCAST, "BROADCAST SEND EXIT");
+}
+
+/**
+ * @fn gupcr_bcast_recv (void *value, size_t nbytes)
+ * Wait to receive the broadcast message and return its value.
+ *
+ * Broadcast is a collective operation where thread 0 (the root thread)
+ * sends a message to all other threads. This function must be
+ * called by every thread other then thread 0.
+ *
+ * @param [in] value Pointer to received value
+ * @param [in] nbytes Number of bytes to receive
+ * @ingroup BROADCAST
+ */
+void
+gupcr_bcast_recv (void *value, size_t nbytes)
+{
+ int i;
+ ptl_process_t rpid;
+ ptl_ct_event_t ct;
+
+ gupcr_trace (FC_BROADCAST, "BROADCAST RECV ENTER 0x%lx %lu",
+ (long unsigned) value, (long unsigned) nbytes);
+
+ gupcr_gmem_sync ();
+
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ if (INNER_THREAD)
+ {
+ /* Prepare triggers for message push to all children. */
+ gupcr_wait_le_count += 1;
+ for (i = 0; i < gupcr_child_cnt; i++)
+ {
+ rpid.rank = gupcr_child[i];
+ gupcr_debug (FC_BROADCAST,
+ "Set broadcast trigger to the child (%d)",
+ gupcr_child[i]);
+ /* Trigger: message received from the parent.
+ Action: send the message to the child. */
+ gupcr_portals_call (PtlTriggeredPut, (gupcr_wait_md, 0,
+ nbytes, PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_DOWN,
+ PTL_NO_MATCH_BITS, 0,
+ PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA,
+ gupcr_wait_le_ct,
+ gupcr_wait_le_count));
+ }
+
+ /* Prepare a trigger to send notification to the parent. */
+ gupcr_debug (FC_BROADCAST,
+ "Set notification trigger to the parent (%d)",
+ gupcr_parent_thread);
+ rpid.rank = gupcr_parent_thread;
+ gupcr_barrier_value = BARRIER_ID_MAX;
+ /* Trigger: notification received from all children.
+ Action: send notification to the parent. */
+ gupcr_notify_le_count += gupcr_child_cnt;
+ gupcr_portals_call (PtlTriggeredPut, (gupcr_barrier_md, 0,
+ BARRIER_ID_SIZE,
+ PTL_NO_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_UP,
+ PTL_NO_MATCH_BITS, 0,
+ PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA,
+ gupcr_notify_le_ct,
+ gupcr_notify_le_count));
+
+ /* Wait for delivery to all children. */
+ gupcr_wait_md_count += gupcr_child_cnt;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_wait_md_ct, gupcr_wait_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_wait_md_eq);
+ gupcr_fatal_error ("received an error on wait MD");
+ }
+ gupcr_debug (FC_BROADCAST, "Received PtlPut acks: %lu",
+ (long unsigned) ct.success);
+ }
+ else
+ {
+ /* A leaf thread sends notification to its parent that
+ it is ready to receive the broadcast value. */
+ gupcr_debug (FC_BROADCAST, "Send notification to the parent (%d)",
+ gupcr_parent_thread);
+ rpid.rank = gupcr_parent_thread;
+ gupcr_barrier_value = BARRIER_ID_MAX;
+ gupcr_portals_call (PtlPut, (gupcr_barrier_md, 0,
+ BARRIER_ID_SIZE, PTL_NO_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_UP,
+ PTL_NO_MATCH_BITS, 0, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA));
+
+ /* Wait to receive a message from the parent. */
+ gupcr_wait_le_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_wait_le_ct, gupcr_wait_le_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_wait_le_eq);
+ gupcr_fatal_error ("received an error on wait LE");
+ }
+ }
+ memcpy (value, gupcr_wait_ptr, nbytes);
+#else
+ /* Inner threads must wait for its children threads to arrive. */
+ if (INNER_THREAD)
+ {
+ gupcr_debug (FC_BROADCAST, "Waiting for %d notifications",
+ gupcr_child_cnt);
+ gupcr_notify_le_count += gupcr_child_cnt;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_notify_le_ct, gupcr_child_cnt, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_notify_le_eq);
+ gupcr_fatal_error ("received an error on notify LE");
+ }
+ gupcr_debug (FC_BROADCAST, "Received %lu broadcast notifications",
+ (long unsigned) ct.success);
+ }
+
+ /* Inform the parent that this thread and all its children arrived.
+ Send barrier MAX value as we share PTEs with the barrier
+ implementation. */
+ gupcr_debug (FC_BROADCAST, "Send notification to the parent %d",
+ gupcr_parent_thread);
+ rpid.rank = gupcr_parent_thread;
+ gupcr_barrier_value = BARRIER_ID_MAX;
+ gupcr_portals_call (PtlPut, (gupcr_barrier_md, 0,
+ BARRIER_ID_SIZE, PTL_NO_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_UP, PTL_NO_MATCH_BITS, 0,
+ PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA));
+
+ /* Receive the broadcast message from the parent. */
+ gupcr_wait_le_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_wait_le_ct, gupcr_wait_le_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_wait_le_eq);
+ gupcr_fatal_error ("received an error on wait LE");
+ }
+
+ /* Copy the received message. */
+ memcpy (value, gupcr_wait_ptr, nbytes);
+
+ if (INNER_THREAD)
+ {
+ /* An inner thread must pass the message to its children. */
+ for (i = 0; i < gupcr_child_cnt; i++)
+ {
+ gupcr_debug (FC_BROADCAST, "Sending a message to %d",
+ gupcr_child[i]);
+ rpid.rank = gupcr_child[i];
+ gupcr_portals_call (PtlPut, (gupcr_wait_md, 0,
+ nbytes, PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_BARRIER_DOWN,
+ PTL_NO_MATCH_BITS, 0,
+ PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA));
+ }
+ /* Wait for delivery to all children. */
+ gupcr_wait_md_count += gupcr_child_cnt;
+ gupcr_portals_call (PtlCTWait, (gupcr_wait_md_ct, gupcr_wait_md_count,
+ &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_wait_md_eq);
+ gupcr_fatal_error ("received an error on wait MD");
+ }
+ }
+#endif
+ gupcr_trace (FC_BROADCAST, "BROADCAST RECV EXIT");
+}
+
+/**
+ * @fn gupcr_barrier_init (void)
+ * Initialize barrier resources.
+ * @ingroup INIT
+ */
+void
+gupcr_barrier_init (void)
+{
+ ptl_pt_index_t pte;
+ ptl_le_t le;
+ ptl_md_t md;
+
+ gupcr_log (FC_BARRIER, "barrier init called");
+
+ /* Create necessary CT handles. */
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_notify_le_ct));
+ gupcr_notify_le_count = 0;
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_notify_md_ct));
+ gupcr_notify_md_count = 0;
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_wait_le_ct));
+ gupcr_wait_le_count = 0;
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_wait_md_ct));
+ gupcr_wait_md_count = 0;
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_barrier_md_ct));
+ gupcr_barrier_md_count = 0;
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_barrier_max_md_ct));
+ gupcr_barrier_max_md_count = 0;
+
+ /* Create necessary EQ handles. Allocate only one event queue entry
+ as we abort on any error. */
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_notify_le_eq));
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_notify_md_eq));
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_wait_le_eq));
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_wait_md_eq));
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_barrier_md_eq));
+ gupcr_portals_call (PtlEQAlloc,
+ (gupcr_ptl_ni, 1, &gupcr_barrier_max_md_eq));
+
+ /* Allocate PTEs. */
+ gupcr_portals_call (PtlPTAlloc, (gupcr_ptl_ni, 0,
+ gupcr_notify_le_eq,
+ GUPCR_PTL_PTE_BARRIER_UP, &pte));
+ if (pte != GUPCR_PTL_PTE_BARRIER_UP)
+ gupcr_fatal_error ("cannot allocate GUPCR_PTL_PTE_BARRIER_UP PTE");
+ gupcr_debug (FC_BARRIER, "Barrier UP PTE allocated: %d",
+ GUPCR_PTL_PTE_BARRIER_UP);
+ gupcr_portals_call (PtlPTAlloc, (gupcr_ptl_ni, 0,
+ gupcr_wait_le_eq,
+ GUPCR_PTL_PTE_BARRIER_DOWN, &pte));
+ if (pte != GUPCR_PTL_PTE_BARRIER_DOWN)
+ gupcr_fatal_error ("cannot allocate GUPCR_PTL_PTE_BARRIER_DOWN PTE");
+ gupcr_debug (FC_BARRIER, "Barrier DOWN PTE allocated: %d",
+ GUPCR_PTL_PTE_BARRIER_DOWN);
+
+ /* Children perform atomic MIN on up_value,
+ make sure we start with the maximum possible value. */
+ gupcr_notify_value = BARRIER_ID_MAX;
+
+ /* Create LE for barrier ID value traveling up the tree. */
+ le.start = &gupcr_notify_value;
+ le.length = sizeof (gupcr_notify_value);
+ le.ct_handle = gupcr_notify_le_ct;
+ le.uid = PTL_UID_ANY;
+ le.options = PTL_LE_OP_PUT | PTL_LE_OP_GET |
+ PTL_LE_EVENT_CT_COMM | PTL_LE_EVENT_SUCCESS_DISABLE |
+ PTL_LE_EVENT_LINK_DISABLE;
+ gupcr_portals_call (PtlLEAppend,
+ (gupcr_ptl_ni, GUPCR_PTL_PTE_BARRIER_UP, &le,
+ PTL_PRIORITY_LIST, NULL, &gupcr_notify_le));
+
+ /* Create LE for barrier ID value traveling down the tree.
+ Allocate enough space as barrier resources are
+ used to also broadcast arbitrary values. */
+ gupcr_malloc (gupcr_wait_ptr, GUPCR_MAX_BROADCAST_SIZE);
+ le.start = gupcr_wait_ptr;
+ le.length = GUPCR_MAX_BROADCAST_SIZE;
+ le.ct_handle = gupcr_wait_le_ct;
+ le.uid = PTL_UID_ANY;
+ le.options = PTL_LE_OP_PUT | PTL_LE_OP_GET |
+ PTL_LE_EVENT_CT_COMM | PTL_LE_EVENT_SUCCESS_DISABLE |
+ PTL_LE_EVENT_LINK_DISABLE;
+ gupcr_portals_call (PtlLEAppend,
+ (gupcr_ptl_ni, GUPCR_PTL_PTE_BARRIER_DOWN, &le,
+ PTL_PRIORITY_LIST, NULL, &gupcr_wait_le));
+
+ /* Create source MD for barrier ID values sent up the tree. */
+ md.start = &gupcr_notify_value;
+ md.length = sizeof (gupcr_notify_value);
+ md.options = PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_SUCCESS_DISABLE;
+ md.eq_handle = gupcr_notify_md_eq;
+ md.ct_handle = gupcr_notify_md_ct;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_notify_md));
+
+ /* Create source MD for barrier ID values sent down the tree. */
+ md.start = gupcr_wait_ptr;
+ md.length = GUPCR_MAX_BROADCAST_SIZE;
+ md.options = PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_SUCCESS_DISABLE;
+ md.eq_handle = gupcr_wait_md_eq;
+ md.ct_handle = gupcr_wait_md_ct;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_wait_md));
+
+ /* Create source MD for barrier ID values sent up the tree. */
+ md.start = &gupcr_barrier_value;
+ md.length = sizeof (gupcr_barrier_value);
+ md.options = PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_SUCCESS_DISABLE;
+ md.eq_handle = gupcr_barrier_md_eq;
+ md.ct_handle = gupcr_barrier_md_ct;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_barrier_md));
+
+ /* Create source MD that is used re-initialize the
+ the consensus minimum barrier ID value to a maximum
+ possible value. */
+ md.start = &gupcr_barrier_max_value;
+ md.length = sizeof (gupcr_barrier_max_value);
+ md.options = PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_SUCCESS_DISABLE;
+ md.eq_handle = gupcr_barrier_max_md_eq;
+ md.ct_handle = gupcr_barrier_max_md_ct;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_barrier_max_md));
+}
+
+/**
+ * @fn gupcr_barrier_fini (void)
+ * Release barrier resources.
+ * @ingroup INIT
+ */
+void
+gupcr_barrier_fini (void)
+{
+ gupcr_log (FC_BARRIER, "barrier fini called");
+
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Cancel any outstanding triggered operations. */
+ gupcr_portals_call (PtlCTCancelTriggered, (gupcr_wait_le_ct));
+ gupcr_portals_call (PtlCTCancelTriggered, (gupcr_barrier_max_md_ct));
+ gupcr_portals_call (PtlCTCancelTriggered, (gupcr_notify_le_ct));
+ gupcr_portals_call (PtlCTCancelTriggered, (gupcr_wait_md_ct));
+#endif
+
+ /* Release MDs and their CTs. */
+ gupcr_portals_call (PtlMDRelease, (gupcr_barrier_md));
+ gupcr_portals_call (PtlCTFree, (gupcr_barrier_md_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_barrier_md_eq));
+ gupcr_portals_call (PtlMDRelease, (gupcr_barrier_max_md));
+ gupcr_portals_call (PtlCTFree, (gupcr_barrier_max_md_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_barrier_max_md_eq));
+ gupcr_portals_call (PtlMDRelease, (gupcr_notify_md));
+ gupcr_portals_call (PtlCTFree, (gupcr_notify_md_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_notify_md_eq));
+ gupcr_portals_call (PtlMDRelease, (gupcr_wait_md));
+ gupcr_portals_call (PtlCTFree, (gupcr_wait_md_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_wait_md_eq));
+
+ /* Release LEs, their CTs, and PTEs. */
+ gupcr_portals_call (PtlLEUnlink, (gupcr_notify_le));
+ gupcr_portals_call (PtlCTFree, (gupcr_notify_le_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_notify_le_eq));
+ gupcr_portals_call (PtlPTFree, (gupcr_ptl_ni, GUPCR_PTL_PTE_BARRIER_UP));
+
+ gupcr_portals_call (PtlLEUnlink, (gupcr_wait_le));
+ gupcr_portals_call (PtlCTFree, (gupcr_wait_le_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_wait_le_eq));
+ gupcr_portals_call (PtlPTFree, (gupcr_ptl_ni, GUPCR_PTL_PTE_BARRIER_DOWN));
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_barrier.h b/libgupc/portals4/gupcr_barrier.h
new file mode 100644
index 00000000000..23074e1eb74
--- /dev/null
+++ b/libgupc/portals4/gupcr_barrier.h
@@ -0,0 +1,49 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_BARRIER_H_
+#define _GUPCR_BARRIER_H_
+
+/**
+ * @file gupcr_barrier.h
+ * GUPC Portals4 barrier implementation.
+ *
+ * @addtogroup BARRIER GUPCR Barrier Functions
+ * @{
+ */
+
+extern void gupcr_barrier_init (void);
+extern void gupcr_barrier_fini (void);
+
+/* Broadcast support functions. */
+extern void gupcr_bcast_send (void *, size_t);
+extern void gupcr_bcast_recv (void *, size_t);
+
+/* Current barrier ID. */
+extern int gupcr_barrier_id;
+
+/** @} */
+#endif /* gupcr_barrier.h */
diff --git a/libgupc/portals4/gupcr_broadcast.c b/libgupc/portals4/gupcr_broadcast.c
new file mode 100644
index 00000000000..801558f8ae1
--- /dev/null
+++ b/libgupc/portals4/gupcr_broadcast.c
@@ -0,0 +1,122 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_lib.h"
+#include "gupcr_sup.h"
+#include "gupcr_utils.h"
+#include "gupcr_barrier.h"
+#include "gupcr_broadcast.h"
+
+/**
+ * @file gupcr_broadcast.c
+ * GUPC Portals4 broadcast implementation.
+ *
+ * The broadcast utility functions are internal functions used by
+ * the UPC runtime when it is necessary to propagate (broadcast)
+ * a value from thread 0 to all other threads.
+ * For example, upc_all_alloc and upc_all_lock_alloc will
+ * call the broadcast functions to propagate their result to all threads.
+ *
+ * The broadcast functions use an algorithm that is a variant of
+ * the one used to implement a barrier. The "up phase" signals
+ * that each thread is ready to receive the broadcast value, while the
+ * "down phase" is used to receive the actual value.
+ */
+
+/**
+ * @addtogroup BROADCAST GUPCR Broadcast Functions
+ * @{
+ */
+
+/**
+ * Receive the broadcast value.
+ *
+ * A thread signals to its parent (by writing to its parent's UP PTE)
+ * that it is ready to receive a broadcast value, and then waits on
+ * its down LE counting event until the message arrives.
+ * @param [in] value Pointer to received value
+ * @param [in] nbytes Number of bytes to receive
+ */
+void
+gupcr_broadcast_get (void *value, size_t nbytes)
+{
+ if (!MYTHREAD)
+ gupcr_fatal_error ("called from thread 0");
+ if (nbytes > GUPCR_MAX_BROADCAST_SIZE)
+ gupcr_fatal_error ("size of broadcast message (%ld) is greater then "
+ "the maximum allowed (%d)",
+ (long int) nbytes, GUPCR_MAX_BROADCAST_SIZE);
+ /* Wait to receive the broadcast message. */
+ gupcr_bcast_recv (value, nbytes);
+}
+
+/**
+ * Send the broadcast value. This function must be called
+ * only by thread 0 (the root thread). The broadcast value
+ * is pushed down the tree by first sending the value
+ * to the children of the root thread.
+ *
+ * @param [in] value Pointer to send value
+ * @param [in] nbytes Number of bytes to send
+ */
+void
+gupcr_broadcast_put (void *value, size_t nbytes)
+{
+ if (THREADS == 1)
+ return;
+ if (MYTHREAD)
+ gupcr_fatal_error ("called from thread other then 0");
+ if (nbytes > GUPCR_MAX_BROADCAST_SIZE)
+ gupcr_fatal_error ("size of broadcast message (%ld) is greater then "
+ "maximum allowed (%d)",
+ (long int) nbytes, GUPCR_MAX_BROADCAST_SIZE);
+ /* Send the broadcast message to the children of the root thread. */
+ gupcr_bcast_send (value, nbytes);
+}
+
+/**
+ * Initialize broadcast resources.
+ * @ingroup INIT
+ */
+void
+gupcr_broadcast_init (void)
+{
+ gupcr_log (FC_BROADCAST, "broadcast init called");
+}
+
+/**
+ * Release broadcast resources.
+ * @ingroup INIT
+ */
+void
+gupcr_broadcast_fini (void)
+{
+ gupcr_log (FC_BROADCAST, "broadcast fini called");
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_broadcast.h b/libgupc/portals4/gupcr_broadcast.h
new file mode 100644
index 00000000000..0d5356d3283
--- /dev/null
+++ b/libgupc/portals4/gupcr_broadcast.h
@@ -0,0 +1,50 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_BROADCAST_H_
+#define _GUPCR_BROADCAST_H_
+
+/**
+ * @file gupcr_broadcast.h
+ * GUPC Portals4 broadcast implementation.
+ */
+
+/**
+ * @addtogroup BROADCAST GUPCR Broadcast Functions
+ * @{
+ */
+
+/** Maximum message size that can be sent via broadcast. */
+#define GUPCR_MAX_BROADCAST_SIZE 32
+
+/** @} */
+
+extern void gupcr_broadcast_get (void *value, size_t nbytes);
+extern void gupcr_broadcast_put (void *value, size_t nbytes);
+extern void gupcr_broadcast_init (void);
+extern void gupcr_broadcast_fini (void);
+
+#endif /* gupcr_broadcast.h */
diff --git a/libgupc/portals4/gupcr_castable.upc b/libgupc/portals4/gupcr_castable.upc
new file mode 100644
index 00000000000..eeb50cc6866
--- /dev/null
+++ b/libgupc/portals4/gupcr_castable.upc
@@ -0,0 +1,69 @@
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <upc_castable.h>
+#include "gupcr_portals.h"
+#include "gupcr_pts.h"
+#include "gupcr_gmem.h"
+#include "gupcr_node.h"
+
+void *
+upc_cast (const shared void *ptr)
+{
+ const upc_shared_ptr_t sptr = GUPCR_PTS_TO_REP (ptr);
+ void *local_ptr = NULL;
+ if (!GUPCR_PTS_IS_NULL (sptr))
+ {
+ const size_t thread = GUPCR_PTS_THREAD (sptr);
+ const int thread_as_int = (int) thread;
+ if (thread_as_int >= THREADS)
+ gupcr_fatal_error ("thread number %d in shared address "
+ "is out of range", thread_as_int);
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ size_t offset = GUPCR_PTS_OFFSET (sptr);
+ local_ptr = GUPCR_GMEM_OFF_TO_LOCAL (thread, offset);
+ }
+ }
+ return local_ptr;
+}
+
+upc_thread_info_t
+upc_thread_info (size_t thread)
+{
+ const int thread_as_int = (int) thread;
+ upc_thread_info_t cast_info = { 0, 0 };
+ if (thread_as_int >= THREADS)
+ gupcr_fatal_error ("thread number %d in shared address "
+ "is out of range", thread_as_int);
+ if (GUPCR_GMEM_IS_LOCAL (thread))
+ {
+ cast_info.guaranteedCastable = UPC_CASTABLE_ALL;
+ cast_info.probablyCastable = UPC_CASTABLE_ALL;
+ }
+ return cast_info;
+}
diff --git a/libgupc/portals4/gupcr_clock.c b/libgupc/portals4/gupcr_clock.c
new file mode 100644
index 00000000000..74c7136dd17
--- /dev/null
+++ b/libgupc/portals4/gupcr_clock.c
@@ -0,0 +1,138 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_clock.c
+ * GUPC Clock routines.
+ */
+
+/**
+ * @addtogroup UPCCLOCK UPC Clock Functions
+ * @{
+ */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+
+static double gupcr_clock_rez;
+static double gupcr_clock_base;
+
+#if HAVE_CLOCK_GETTIME
+
+#if defined (CLOCK_MONOTONIC_RAW) && defined (CLOCK_MONOTONIC)
+#define GUPCR_CLOCK_ID CLOCK_MONOTONIC_RAW
+/* On some RHEL/CentOS systems, the timer resolution returned for
+ CLOCK_MONOTONIC_RAW is incorrect. Use CLOCK_MONOTONIC instead. */
+#define GUPCR_CLOCK_REZ_ID CLOCK_MONOTONIC
+#elif defined (CLOCK_MONOTONIC)
+#define GUPCR_CLOCK_ID CLOCK_MONOTONIC
+#define GUPCR_CLOCK_REZ_ID CLOCK_MONOTONIC
+#else
+#error missing system clock name definition.
+#endif
+
+double
+gupcr_clock (void)
+{
+ struct timespec ts;
+ double t;
+ gupcr_syscall (clock_gettime, (GUPCR_CLOCK_ID, &ts));
+ t = (double) ts.tv_sec + (double) ts.tv_nsec * 1.0e-9;
+ t -= gupcr_clock_base;
+ return t;
+}
+
+double
+gupcr_clock_resolution (void)
+{
+ return gupcr_clock_rez;
+}
+
+void
+gupcr_clock_init (void)
+{
+ struct timespec clock_rez;
+ gupcr_syscall (clock_getres, (GUPCR_CLOCK_REZ_ID, &clock_rez));
+ gupcr_assert (clock_rez.tv_sec == 0);
+ gupcr_clock_rez = clock_rez.tv_nsec * 1.0e-9;
+ gupcr_clock_base = gupcr_clock ();
+}
+
+#else /* Use gettimeofday(). */
+
+double
+gupcr_clock (void)
+{
+ struct timeval tv;
+ double t;
+ gupcr_syscall (gettimeofday, (&tv, NULL));
+ t = (double) tv.tv_sec + (double) tv.tv_usec * 1.0e-6;
+ t -= gupcr_clock_base;
+ return t;
+}
+
+double
+gupcr_clock_resolution (void)
+{
+ return gupcr_clock_rez;
+}
+
+void
+gupcr_clock_init (void)
+{
+ int i;
+ gupcr_clock_base = gupcr_clock ();
+ gupcr_clock_rez = 1.0;
+ for (i = 1; i <= 10; ++i)
+ {
+ double t1, t2, diff;
+ t1 = gupcr_clock ();
+ do
+ {
+ t2 = gupcr_clock ();
+ }
+ while (t1 == t2);
+ diff = t2 - t1;
+ if (diff < gupcr_clock_rez)
+ gupcr_clock_rez = diff;
+ }
+ /* Round the clock resolution to some common values
+ if it is within range of one of them. */
+ if (gupcr_clock_rez > 0.9e-6 && gupcr_clock_rez < 1.1e-6)
+ gupcr_clock_rez = 1.0e-6;
+ else if (gupcr_clock_rez > 0.9e-3 && gupcr_clock_rez < 1.1e-3)
+ gupcr_clock_rez = 1.0e-3;
+ else if (gupcr_clock_rez > 0.9e-2 && gupcr_clock_rez < 1.1e-2)
+ gupcr_clock_rez = 1.0e-2;
+ else if (gupcr_clock_rez > 1.63e-2 && gupcr_clock_rez < 1.69e-2)
+ gupcr_clock_rez = 1.0 / 60.0;
+ else if (gupcr_clock_rez > 1.95e-2 && gupcr_clock_rez < 2.05e-2)
+ gupcr_clock_rez = 1.0 / 50.0;
+}
+
+#endif
+/** @} */
diff --git a/libgupc/portals4/gupcr_coll_broadcast.upc b/libgupc/portals4/gupcr_coll_broadcast.upc
new file mode 100644
index 00000000000..69ab1b4dd13
--- /dev/null
+++ b/libgupc/portals4/gupcr_coll_broadcast.upc
@@ -0,0 +1,129 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <upc_collective.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_coll_sup.h"
+
+/**
+ * @file gupcr_coll_broadcast.upc
+ * GUPC Portals4 collectives broadcast implementation.
+ *
+ * @addtogroup COLLECTIVES GUPCR Collectives Functions
+ * @{
+ */
+
+/**
+ * @fn upc_all_broadcast (shared void *dst,
+ * shared const void *src,
+ * size_t nbytes, upc_flag_t sync_mode)
+ * Broadcast data referenced by the src pointer.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] nbytes Number of bytes to broadcast
+ * @param [in] sync_mode Synchronization mode
+ * @ingroup COLLECTIVES
+ */
+
+void
+upc_all_broadcast (shared void *dst, shared const void *src,
+ size_t nbytes, upc_flag_t sync_mode)
+{
+ size_t src_thread = upc_threadof ((shared void *) src);
+ size_t send_cnt = nbytes;
+ int i, blk_cnt;
+
+ gupcr_trace (FC_COLL, "COLL ALL_BROADCAST ENTER %lu %lu",
+ (long unsigned) src_thread, (long unsigned) nbytes);
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, nbytes, sync_mode, 0, 0, 0, UPC_BRDCST);
+#endif
+
+ /* Initialize the collectives broadcast tree. */
+ gupcr_coll_tree_setup (src_thread, 0, THREADS);
+
+ /* Optional IN synchronization mode. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ blk_cnt = 0;
+ while (send_cnt)
+ {
+ size_t blk_size = (send_cnt > GUPCR_PORTALS_MAX_MSG_SIZE) ?
+ GUPCR_PORTALS_MAX_MSG_SIZE : send_cnt;
+ send_cnt -= blk_size;
+
+ if (MYTHREAD != (int) src_thread)
+ {
+ /* Wait for parent to deliver data. */
+ gupcr_coll_signal_wait (1);
+ }
+ else
+ {
+ /* Copy data into the thread's own memory. */
+ size_t doffset = upc_addrfield ((shared char *) dst + MYTHREAD);
+ size_t soffset = upc_addrfield ((shared void *) src);
+ doffset += blk_cnt * GUPCR_PORTALS_MAX_MSG_SIZE;
+ soffset += blk_cnt * GUPCR_PORTALS_MAX_MSG_SIZE;
+ gupcr_debug (FC_COLL,
+ "Local copy - doffset: %lld soffset: %lld nbytes: %lld",
+ (long long int) doffset, (long long int) soffset,
+ (long long int) nbytes);
+ memcpy ((char *) gupcr_gmem_base + doffset,
+ (char *) gupcr_gmem_base + soffset, blk_size);
+ }
+
+ /* Send data to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ int dthread = gupcr_coll_child[i];
+ size_t doffset = upc_addrfield ((shared char *) dst + dthread);
+ size_t soffset = upc_addrfield ((shared char *) dst + MYTHREAD);
+ doffset += blk_cnt * GUPCR_PORTALS_MAX_MSG_SIZE;
+ soffset += blk_cnt * GUPCR_PORTALS_MAX_MSG_SIZE;
+ gupcr_coll_put (dthread, doffset, soffset, blk_size);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+ }
+ ++blk_cnt;
+ }
+
+ /* Optional OUT synchronization mode. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+ gupcr_trace (FC_COLL, "COLL ALL_BROADCAST EXIT");
+}
+
+/* @} */
diff --git a/libgupc/portals4/gupcr_coll_init.upc b/libgupc/portals4/gupcr_coll_init.upc
new file mode 100644
index 00000000000..de7ff6d139b
--- /dev/null
+++ b/libgupc/portals4/gupcr_coll_init.upc
@@ -0,0 +1,67 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_coll_sup.h"
+
+/**
+ * @file gupcr_coll_init.upc
+ * GUPC Portals4 collectives initialization.
+ *
+ * @addtogroup COLLECTIVES GUPCR Collectives Functions
+ * @{
+ */
+int upc_coll_init_flag = 0;
+
+/**
+ * Collectives initialization function.
+ *
+ * Initialize necessary storage area for the broadcast/reduce
+ * thread trees.
+ */
+void
+upc_coll_init ()
+{
+ if (upc_coll_init_flag)
+ gupcr_fatal_error ("multiple attempts to initialize collectives");
+ upc_coll_init_flag = 1;
+
+ /* Allocate the "all reduce" storage area. */
+ gupcr_reduce_storage = (gupcr_reduce_str_t)
+ upc_all_alloc (THREADS, sizeof (struct gupcr_reduce_str));
+ if (gupcr_reduce_storage == NULL)
+ gupcr_fatal_error ("cannot allocate collectives reduce shared storage");
+}
+
+/* @} */
diff --git a/libgupc/portals4/gupcr_coll_reduce.in b/libgupc/portals4/gupcr_coll_reduce.in
new file mode 100644
index 00000000000..e1459b87f19
--- /dev/null
+++ b/libgupc/portals4/gupcr_coll_reduce.in
@@ -0,0 +1,606 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_coll_sup.h"
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+/**
+ * @file gupcr_coll_reduce.upc
+ * GUPC Portals4 reduce collectives implementation.
+ *
+ * @addtogroup COLLECTIVES GUPCR Collectives Functions
+ * @{
+ */
+
+/** Collectives reduce storage pointer */
+gupcr_reduce_str_t gupcr_reduce_storage;
+
+/**
+ * Convert from UPC reduce to Portals atomic operation.
+ *
+ * @parm [in] op UPC reduce operation
+ * @retval Portals atomic operation
+*/
+ptl_op_t
+gupcr_portals_reduce_op (upc_op_t op)
+{
+ switch (op)
+ {
+ case UPC_ADD:
+ return PTL_SUM;
+ case UPC_MULT:
+ return PTL_PROD;
+ case UPC_AND:
+ return PTL_BAND;
+ case UPC_OR:
+ return PTL_BOR;
+ case UPC_XOR:
+ return PTL_BXOR;
+ case UPC_LOGAND:
+ return PTL_LAND;
+ case UPC_LOGOR:
+ return PTL_LOR;
+ case UPC_MIN:
+ return PTL_MIN;
+ case UPC_MAX:
+ return PTL_MAX;
+ default:
+ gupcr_fatal_error ("cannot convert UPC reduce operation 0x%lx.", op);
+ }
+}
+
+PREPROCESS_BEGIN
+#ifdef _UPC_NONINT_T
+/**
+ * Collectives UPC_LOGAND function for float types
+ *
+ * Portals4 does not define logical AND atomic operations
+ * and they will be executed as functions.
+ */
+ _UPC_RED_T
+gupcr_coll_logand_GENERIC (_UPC_RED_T a, _UPC_RED_T b)
+{
+ return a && b;
+}
+
+/**
+ * Collectives UPC_LOGOR function for float types
+ *
+ * Portals4 does not define logical OR atomic operations
+ * and they will be executed as functions.
+ */
+
+_UPC_RED_T
+gupcr_coll_logor_GENERIC (_UPC_RED_T a, _UPC_RED_T b)
+{
+ return a || b;
+}
+#endif /* _UPC_NONINT_T */
+
+/**
+ * Collectives reduce (_GENERIC) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduce_GENERIC
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ _UPC_RED_T (*func) (_UPC_RED_T, _UPC_RED_T), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ _UPC_RED_T local_result = 0;
+ _UPC_RED_T *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER _UPC_RED_T %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+#ifdef _UPC_NONINT_T
+ /* Logical operations on floating point types must execute as
+ functions as Portals4 does not have support for them. */
+ switch (op)
+ {
+ case UPC_LOGAND:
+ func = &gupcr_coll_logand_GENERIC;
+ op = UPC_FUNC;
+ break;
+ case UPC_LOGOR:
+ func = &gupcr_coll_logor_GENERIC;
+ op = UPC_FUNC;
+ break;
+ }
+#endif /* _UPC_NOINT_T */
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (_UPC_RED_T *) ((shared const _UPC_RED_T *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+#ifndef _UPC_NONINT_T
+ /* Skip if not integral type, per spec 4.3.1.1
+ (See additional comments in upc_collective.c) */
+ case UPC_AND:
+ while (loop_cnt--)
+ local_result &= *l_src++;
+ break;
+ case UPC_OR:
+ while (loop_cnt--)
+ local_result |= *l_src++;
+ break;
+ case UPC_XOR:
+ while (loop_cnt--)
+ local_result ^= *l_src++;
+ break;
+ case UPC_LOGAND:
+ while (loop_cnt--)
+ local_result = local_result && *l_src++;
+ break;
+ case UPC_LOGOR:
+ while (loop_cnt--)
+ local_result = local_result || *l_src++;
+ break;
+#endif /* !_UPC_NOINT_T */
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ _UPC_RED_T *t_result =
+ (_UPC_RED_T *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(_UPC_RED_T *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (_UPC_RED_T),
+ gupcr_portals_reduce_op (op),
+ _UPC_TO_PTL_TYPECVT,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(_UPC_RED_T *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (_UPC_RED_T));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (_UPC_RED_T), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (_UPC_RED_T),
+ gupcr_portals_reduce_op (op),
+ _UPC_TO_PTL_TYPECVT, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(_UPC_RED_T *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (_UPC_RED_T));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (_UPC_RED_T),
+ gupcr_portals_reduce_op (op),
+ _UPC_TO_PTL_TYPECVT);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared _UPC_RED_T *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
diff --git a/libgupc/portals4/gupcr_coll_reduce.upc b/libgupc/portals4/gupcr_coll_reduce.upc
new file mode 100644
index 00000000000..d9ee7ff8c23
--- /dev/null
+++ b/libgupc/portals4/gupcr_coll_reduce.upc
@@ -0,0 +1,4978 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_coll_sup.h"
+
+/*****************************************************************************/
+/* */
+/* UPC collective function library, reference implementation */
+/* */
+/* Steve Seidel, Dept. of Computer Science, Michigan Technological Univ. */
+/* steve@mtu.edu March 1, 2004 */
+/* */
+/*****************************************************************************/
+
+/**
+ * @file gupcr_coll_reduce.upc
+ * GUPC Portals4 reduce collectives implementation.
+ *
+ * @addtogroup COLLECTIVES GUPCR Collectives Functions
+ * @{
+ */
+
+/** Collectives reduce storage pointer */
+gupcr_reduce_str_t gupcr_reduce_storage;
+
+/**
+ * Convert from UPC reduce to Portals atomic operation.
+ *
+ * @parm [in] op UPC reduce operation
+ * @retval Portals atomic operation
+*/
+ptl_op_t
+gupcr_portals_reduce_op (upc_op_t op)
+{
+ switch (op)
+ {
+ case UPC_ADD:
+ return PTL_SUM;
+ case UPC_MULT:
+ return PTL_PROD;
+ case UPC_AND:
+ return PTL_BAND;
+ case UPC_OR:
+ return PTL_BOR;
+ case UPC_XOR:
+ return PTL_BXOR;
+ case UPC_LOGAND:
+ return PTL_LAND;
+ case UPC_LOGOR:
+ return PTL_LOR;
+ case UPC_MIN:
+ return PTL_MIN;
+ case UPC_MAX:
+ return PTL_MAX;
+ default:
+ gupcr_fatal_error ("cannot convert UPC reduce operation 0x%lx.", op);
+ }
+}
+
+
+
+/**
+ * Collectives reduce (C) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceC
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed char (*func) (signed char, signed char), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ signed char local_result = 0;
+ signed char *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER signed char %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (signed char *) ((shared const signed char *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ /* Skip if not integral type, per spec 4.3.1.1
+ (See additional comments in upc_collective.c) */
+ case UPC_AND:
+ while (loop_cnt--)
+ local_result &= *l_src++;
+ break;
+ case UPC_OR:
+ while (loop_cnt--)
+ local_result |= *l_src++;
+ break;
+ case UPC_XOR:
+ while (loop_cnt--)
+ local_result ^= *l_src++;
+ break;
+ case UPC_LOGAND:
+ while (loop_cnt--)
+ local_result = local_result && *l_src++;
+ break;
+ case UPC_LOGOR:
+ while (loop_cnt--)
+ local_result = local_result || *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ signed char *t_result =
+ (signed char *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(signed char *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (signed char),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_CHAR,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(signed char *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (signed char));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (signed char), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (signed char),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_CHAR, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(signed char *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (signed char));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (signed char),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_CHAR);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared signed char *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+
+/**
+ * Collectives reduce (UC) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceUC
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned char (*func) (unsigned char, unsigned char), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ unsigned char local_result = 0;
+ unsigned char *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER unsigned char %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (unsigned char *) ((shared const unsigned char *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ /* Skip if not integral type, per spec 4.3.1.1
+ (See additional comments in upc_collective.c) */
+ case UPC_AND:
+ while (loop_cnt--)
+ local_result &= *l_src++;
+ break;
+ case UPC_OR:
+ while (loop_cnt--)
+ local_result |= *l_src++;
+ break;
+ case UPC_XOR:
+ while (loop_cnt--)
+ local_result ^= *l_src++;
+ break;
+ case UPC_LOGAND:
+ while (loop_cnt--)
+ local_result = local_result && *l_src++;
+ break;
+ case UPC_LOGOR:
+ while (loop_cnt--)
+ local_result = local_result || *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ unsigned char *t_result =
+ (unsigned char *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(unsigned char *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (unsigned char),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_UCHAR,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(unsigned char *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (unsigned char));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (unsigned char), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (unsigned char),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_UCHAR, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(unsigned char *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (unsigned char));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (unsigned char),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_UCHAR);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared unsigned char *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+
+/**
+ * Collectives reduce (S) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceS
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed short (*func) (signed short, signed short), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ signed short local_result = 0;
+ signed short *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER signed short %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (signed short *) ((shared const signed short *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ /* Skip if not integral type, per spec 4.3.1.1
+ (See additional comments in upc_collective.c) */
+ case UPC_AND:
+ while (loop_cnt--)
+ local_result &= *l_src++;
+ break;
+ case UPC_OR:
+ while (loop_cnt--)
+ local_result |= *l_src++;
+ break;
+ case UPC_XOR:
+ while (loop_cnt--)
+ local_result ^= *l_src++;
+ break;
+ case UPC_LOGAND:
+ while (loop_cnt--)
+ local_result = local_result && *l_src++;
+ break;
+ case UPC_LOGOR:
+ while (loop_cnt--)
+ local_result = local_result || *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ signed short *t_result =
+ (signed short *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(signed short *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (signed short),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_SHORT,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(signed short *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (signed short));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (signed short), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (signed short),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_SHORT, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(signed short *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (signed short));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (signed short),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_SHORT);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared signed short *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+
+/**
+ * Collectives reduce (US) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceUS
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned short (*func) (unsigned short, unsigned short), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ unsigned short local_result = 0;
+ unsigned short *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER unsigned short %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (unsigned short *) ((shared const unsigned short *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ /* Skip if not integral type, per spec 4.3.1.1
+ (See additional comments in upc_collective.c) */
+ case UPC_AND:
+ while (loop_cnt--)
+ local_result &= *l_src++;
+ break;
+ case UPC_OR:
+ while (loop_cnt--)
+ local_result |= *l_src++;
+ break;
+ case UPC_XOR:
+ while (loop_cnt--)
+ local_result ^= *l_src++;
+ break;
+ case UPC_LOGAND:
+ while (loop_cnt--)
+ local_result = local_result && *l_src++;
+ break;
+ case UPC_LOGOR:
+ while (loop_cnt--)
+ local_result = local_result || *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ unsigned short *t_result =
+ (unsigned short *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(unsigned short *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (unsigned short),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_USHORT,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(unsigned short *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (unsigned short));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (unsigned short), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (unsigned short),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_USHORT, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(unsigned short *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (unsigned short));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (unsigned short),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_USHORT);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared unsigned short *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+
+/**
+ * Collectives reduce (I) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceI
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed int (*func) (signed int, signed int), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ signed int local_result = 0;
+ signed int *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER signed int %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (signed int *) ((shared const signed int *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ /* Skip if not integral type, per spec 4.3.1.1
+ (See additional comments in upc_collective.c) */
+ case UPC_AND:
+ while (loop_cnt--)
+ local_result &= *l_src++;
+ break;
+ case UPC_OR:
+ while (loop_cnt--)
+ local_result |= *l_src++;
+ break;
+ case UPC_XOR:
+ while (loop_cnt--)
+ local_result ^= *l_src++;
+ break;
+ case UPC_LOGAND:
+ while (loop_cnt--)
+ local_result = local_result && *l_src++;
+ break;
+ case UPC_LOGOR:
+ while (loop_cnt--)
+ local_result = local_result || *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ signed int *t_result =
+ (signed int *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(signed int *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (signed int),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_INT,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(signed int *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (signed int));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (signed int), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (signed int),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_INT, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(signed int *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (signed int));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (signed int),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_INT);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared signed int *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+
+/**
+ * Collectives reduce (UI) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceUI
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned int (*func) (unsigned int, unsigned int), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ unsigned int local_result = 0;
+ unsigned int *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER unsigned int %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (unsigned int *) ((shared const unsigned int *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ /* Skip if not integral type, per spec 4.3.1.1
+ (See additional comments in upc_collective.c) */
+ case UPC_AND:
+ while (loop_cnt--)
+ local_result &= *l_src++;
+ break;
+ case UPC_OR:
+ while (loop_cnt--)
+ local_result |= *l_src++;
+ break;
+ case UPC_XOR:
+ while (loop_cnt--)
+ local_result ^= *l_src++;
+ break;
+ case UPC_LOGAND:
+ while (loop_cnt--)
+ local_result = local_result && *l_src++;
+ break;
+ case UPC_LOGOR:
+ while (loop_cnt--)
+ local_result = local_result || *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ unsigned int *t_result =
+ (unsigned int *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(unsigned int *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (unsigned int),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_UINT,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(unsigned int *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (unsigned int));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (unsigned int), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (unsigned int),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_UINT, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(unsigned int *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (unsigned int));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (unsigned int),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_UINT);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared unsigned int *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+
+/**
+ * Collectives reduce (L) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceL
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ signed long (*func) (signed long, signed long), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ signed long local_result = 0;
+ signed long *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER signed long %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (signed long *) ((shared const signed long *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ /* Skip if not integral type, per spec 4.3.1.1
+ (See additional comments in upc_collective.c) */
+ case UPC_AND:
+ while (loop_cnt--)
+ local_result &= *l_src++;
+ break;
+ case UPC_OR:
+ while (loop_cnt--)
+ local_result |= *l_src++;
+ break;
+ case UPC_XOR:
+ while (loop_cnt--)
+ local_result ^= *l_src++;
+ break;
+ case UPC_LOGAND:
+ while (loop_cnt--)
+ local_result = local_result && *l_src++;
+ break;
+ case UPC_LOGOR:
+ while (loop_cnt--)
+ local_result = local_result || *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ signed long *t_result =
+ (signed long *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(signed long *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (signed long),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_LONG,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(signed long *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (signed long));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (signed long), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (signed long),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_LONG, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(signed long *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (signed long));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (signed long),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_LONG);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared signed long *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+
+/**
+ * Collectives reduce (UL) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceUL
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ unsigned long (*func) (unsigned long, unsigned long), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ unsigned long local_result = 0;
+ unsigned long *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER unsigned long %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (unsigned long *) ((shared const unsigned long *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ /* Skip if not integral type, per spec 4.3.1.1
+ (See additional comments in upc_collective.c) */
+ case UPC_AND:
+ while (loop_cnt--)
+ local_result &= *l_src++;
+ break;
+ case UPC_OR:
+ while (loop_cnt--)
+ local_result |= *l_src++;
+ break;
+ case UPC_XOR:
+ while (loop_cnt--)
+ local_result ^= *l_src++;
+ break;
+ case UPC_LOGAND:
+ while (loop_cnt--)
+ local_result = local_result && *l_src++;
+ break;
+ case UPC_LOGOR:
+ while (loop_cnt--)
+ local_result = local_result || *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ unsigned long *t_result =
+ (unsigned long *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(unsigned long *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (unsigned long),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_ULONG,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(unsigned long *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (unsigned long));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (unsigned long), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (unsigned long),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_ULONG, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(unsigned long *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (unsigned long));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (unsigned long),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_ULONG);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared unsigned long *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+/**
+ * Collectives UPC_LOGAND function for float types
+ *
+ * Portals4 does not define logical AND atomic operations
+ * and they will be executed as functions.
+ */
+ float
+gupcr_coll_logandF (float a, float b)
+{
+ return a && b;
+}
+
+/**
+ * Collectives UPC_LOGOR function for float types
+ *
+ * Portals4 does not define logical OR atomic operations
+ * and they will be executed as functions.
+ */
+
+float
+gupcr_coll_logorF (float a, float b)
+{
+ return a || b;
+}
+
+/**
+ * Collectives reduce (F) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceF
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ float (*func) (float, float), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ float local_result = 0;
+ float *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER float %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+ /* Logical operations on floating point types must execute as
+ functions as Portals4 does not have support for them. */
+ switch (op)
+ {
+ case UPC_LOGAND:
+ func = &gupcr_coll_logandF;
+ op = UPC_FUNC;
+ break;
+ case UPC_LOGOR:
+ func = &gupcr_coll_logorF;
+ op = UPC_FUNC;
+ break;
+ }
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (float *) ((shared const float *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ float *t_result =
+ (float *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(float *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (float),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_FLOAT,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(float *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (float));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (float), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (float),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_FLOAT, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(float *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (float));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (float),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_FLOAT);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared float *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+/**
+ * Collectives UPC_LOGAND function for float types
+ *
+ * Portals4 does not define logical AND atomic operations
+ * and they will be executed as functions.
+ */
+ double
+gupcr_coll_logandD (double a, double b)
+{
+ return a && b;
+}
+
+/**
+ * Collectives UPC_LOGOR function for float types
+ *
+ * Portals4 does not define logical OR atomic operations
+ * and they will be executed as functions.
+ */
+
+double
+gupcr_coll_logorD (double a, double b)
+{
+ return a || b;
+}
+
+/**
+ * Collectives reduce (D) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceD
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ double (*func) (double, double), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ double local_result = 0;
+ double *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER double %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+ /* Logical operations on floating point types must execute as
+ functions as Portals4 does not have support for them. */
+ switch (op)
+ {
+ case UPC_LOGAND:
+ func = &gupcr_coll_logandD;
+ op = UPC_FUNC;
+ break;
+ case UPC_LOGOR:
+ func = &gupcr_coll_logorD;
+ op = UPC_FUNC;
+ break;
+ }
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (double *) ((shared const double *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ double *t_result =
+ (double *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(double *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (double),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_DOUBLE,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(double *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (double));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (double), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (double),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_DOUBLE, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(double *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (double));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (double),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_DOUBLE);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared double *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
+
+/**
+ * Collectives UPC_LOGAND function for float types
+ *
+ * Portals4 does not define logical AND atomic operations
+ * and they will be executed as functions.
+ */
+ long double
+gupcr_coll_logandLD (long double a, long double b)
+{
+ return a && b;
+}
+
+/**
+ * Collectives UPC_LOGOR function for float types
+ *
+ * Portals4 does not define logical OR atomic operations
+ * and they will be executed as functions.
+ */
+
+long double
+gupcr_coll_logorLD (long double a, long double b)
+{
+ return a || b;
+}
+
+/**
+ * Collectives reduce (LD) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ * some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ * for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ * parent shared space. The reduced values are propagated to the
+ * top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduceLD
+ (shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ long double (*func) (long double, long double), upc_flag_t sync_mode)
+{
+ int i, n_local, full_rows, last_row;
+ int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+ long double local_result = 0;
+ long double *l_src;
+
+ if (!upc_coll_init_flag)
+ upc_coll_init ();
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER long double %lu %lu",
+ (long unsigned) nelems, (long unsigned) blk_size);
+
+ if (blk_size == 0)
+ blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+ upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+ upc_barrier;
+
+ /* Compute n_local, the number of elements local to this thread. */
+ n_local = 0;
+
+ /* Also compute start, the starting index of src for each thread. */
+
+ src_thr = upc_threadof ((shared void *) src);
+ dst_thr = upc_threadof ((shared void *) dst);
+ ph = upc_phaseof ((shared void *) src);
+
+ /* nelems plus the number of virtual elements in first row. */
+ velems = nelems + src_thr * blk_size + ph;
+
+ /* Include virtual elements when computing number of local elements. */
+ full_rows = velems / (blk_size * THREADS);
+ last_row = velems % (blk_size * THREADS);
+ tail_thr = last_row / blk_size;
+
+ /* Calculate number of participating threads. */
+ num_thr = (nelems + ph + blk_size - 1) / blk_size;
+ if (num_thr > THREADS)
+ num_thr = THREADS;
+
+ gupcr_debug (FC_COLL,
+ "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+ src_thr, tail_thr, ph, num_thr, full_rows);
+
+ /* Calculate number of local elements. */
+ if (blk_size > 0)
+ {
+ if (MYTHREAD <= tail_thr)
+ if (MYTHREAD == tail_thr)
+ extras = last_row % blk_size;
+ else
+ extras = blk_size;
+ else
+ extras = 0;
+
+ n_local = blk_size * full_rows + extras;
+
+ /* Adjust the number of elements in this thread, if necessary. */
+ if (MYTHREAD < src_thr)
+ n_local -= blk_size;
+ else if (MYTHREAD == src_thr)
+ n_local -= ph;
+ }
+ else
+ {
+ n_local = 0;
+ if (src_thr == MYTHREAD) /* Revise the number of local elements. */
+ n_local = nelems;
+ }
+
+ /* Starting index for this thread
+ Note: start is sometimes negative because src is
+ addressed here as if its block size is 1. */
+
+ if (blk_size > 0)
+ if (MYTHREAD > src_thr)
+ start = MYTHREAD - src_thr - ph * THREADS;
+ else if (MYTHREAD < src_thr)
+ start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+ else /* This is the source thread. */
+ start = 0;
+ else
+ start = 0;
+
+ /* Logical operations on floating point types must execute as
+ functions as Portals4 does not have support for them. */
+ switch (op)
+ {
+ case UPC_LOGAND:
+ func = &gupcr_coll_logandLD;
+ op = UPC_FUNC;
+ break;
+ case UPC_LOGOR:
+ func = &gupcr_coll_logorLD;
+ op = UPC_FUNC;
+ break;
+ }
+
+ /* Reduce the elements local to this thread. */
+
+ if (n_local > 0)
+ {
+ int loop_cnt = n_local - 1;
+
+ l_src = (long double *) ((shared const long double *) src + start);
+ local_result = *l_src++;
+
+ switch (op)
+ {
+ case UPC_ADD:
+ while (loop_cnt--)
+ local_result += *l_src++;
+ break;
+ case UPC_MULT:
+ while (loop_cnt--)
+ local_result *= *l_src++;
+ break;
+ case UPC_MIN:
+ while (loop_cnt--)
+ {
+ if (local_result > *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_MAX:
+ while (loop_cnt--)
+ {
+ if (local_result < *l_src)
+ local_result = *l_src;
+ ++l_src;
+ }
+ break;
+ case UPC_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ case UPC_NONCOMM_FUNC:
+ while (loop_cnt--)
+ local_result = func (local_result, *l_src++);
+ break;
+ default:
+ gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+ }
+ }
+
+ /* Note: local_result is undefined if n_local == 0.
+ Note: Only a proper subset of threads have a meaningful local_result.
+ Note: dst might be a thread that does not have a local result. */
+
+ /* Global reduce on only participating threads. */
+ if (n_local)
+ {
+ /* Local pointer where reduced values are written too. */
+ long double *t_result =
+ (long double *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+ /* Initialize collectives reduce tree. */
+ gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+ /* Copy in local results into the area for reduce operation.
+ NOTE: Not needed for the case of collective functions. However,
+ this covers the case of only one thread. */
+ *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+ /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+ to use triggered operations on inner nodes. In that case, inner
+ nodes must calculate reduced value by calling the specified
+ function. */
+ if (gupcr_coll_child_cnt)
+ {
+ if (IS_ROOT_THREAD)
+ {
+ /* ROOT THREAD */
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for children to report their values. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+ /* Reduce local values with those of children if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result =
+ func (local_result, *(long double *)
+ & gupcr_reduce_storage[MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ }
+ }
+ else
+ {
+ /* INNER THREAD */
+ /* Prepare triggered atomic function. */
+ if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+ {
+ /* Use triggered atomic operations once children sent
+ their results and parent is ready to receive it. */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (long double),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_LONG_DOUBLE,
+ gupcr_coll_child_cnt + 1);
+ }
+ /* Let children know that parent is ready. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+ /* Wait for completion, children and parent are ready. */
+ gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+ /* Execute reduce functions if necessary. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ size_t doffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value
+ [gupcr_coll_child_index]));
+ /* Reduce local result with those of children. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result, *(long double *)
+ &
+ gupcr_reduce_storage
+ [MYTHREAD].value[i]);
+ }
+ *t_result = local_result;
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+ sizeof (long double));
+ }
+ /* Wait for our value to go up the tree. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+ else
+ {
+ /* Avoid the case where only one thread is available. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ switch (op)
+ {
+ case UPC_FUNC:
+ case UPC_NONCOMM_FUNC:
+ {
+ /* Schedule a triggered put once signal is received. */
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].
+ value
+ [gupcr_coll_child_index]));
+ gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+ offset, sizeof (long double), 1);
+ }
+ break;
+ default:
+ /* Schedule a triggered atomic put once parent is ready. */
+ gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+ offset, sizeof (long double),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_LONG_DOUBLE, 1);
+ break;
+ }
+ /* Wait for parent to be ready. */
+ gupcr_coll_signal_wait (1);
+ /* Wait for our value to leave. */
+ gupcr_coll_ack_wait (1);
+ }
+ }
+#else /* NO TRIGGERED OPS */
+ /* Send signal to all children. */
+ if (gupcr_coll_child_cnt)
+ {
+ /* ROOT OR INNER THREAD */
+ int wait_cnt = gupcr_coll_child_cnt;
+
+ /* Signal that parent is ready to receive the locally reduced
+ values from its children. Value that we send does not matter. */
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].signal));
+ gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+ }
+ gupcr_coll_ack_wait (wait_cnt);
+
+ /* Wait for children to report their local reduced values and
+ parent to report it is ready to receive the reduced value. */
+ if (!IS_ROOT_THREAD)
+ ++wait_cnt;
+ gupcr_coll_signal_wait (wait_cnt);
+
+ /* Compute result if reduce functions are used. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ for (i = 0; i < gupcr_coll_child_cnt; i++)
+ {
+ local_result = func (local_result,
+ *(long double *) &
+ gupcr_reduce_storage[MYTHREAD].value
+ [i]);
+ }
+ /* Prepare reduced value for going up the tree. */
+ *t_result = local_result;
+ }
+ }
+ else if (!IS_ROOT_THREAD)
+ {
+ /* LEAF THREAD */
+ gupcr_coll_signal_wait (1);
+ }
+
+ /* Send reduced value to the parent. */
+ if (!IS_ROOT_THREAD)
+ {
+ /* LEAF OR INNER THREAD */
+ /* Each child places its result into the parent memory slot
+ dedicated for the child. The parent is responsible
+ for creating the reduced result for itself and its
+ children. */
+ if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+ {
+ size_t doffset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value
+ [gupcr_coll_child_index]));
+ size_t soffset =
+ upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage[MYTHREAD].value[0]));
+ gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+ sizeof (long double));
+ }
+ else
+ {
+ size_t offset = upc_addrfield ((shared void *)
+ &(gupcr_reduce_storage
+ [MYTHREAD].value[0]));
+ gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+ sizeof (long double),
+ gupcr_portals_reduce_op (op),
+ UPC_COLL_TO_PTL_LONG_DOUBLE);
+ }
+ gupcr_coll_ack_wait (1);
+ }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+ /* Copy result into the caller's specified destination. */
+ if (IS_ROOT_THREAD)
+ {
+ *(shared long double *) dst = *t_result;
+ }
+ }
+
+ /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC. */
+ if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+ upc_barrier;
+
+ gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
diff --git a/libgupc/portals4/gupcr_coll_sup.c b/libgupc/portals4/gupcr_coll_sup.c
new file mode 100644
index 00000000000..1eb495ca5de
--- /dev/null
+++ b/libgupc/portals4/gupcr_coll_sup.c
@@ -0,0 +1,393 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_lib.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_coll_sup.h"
+
+/**
+ * @file gupcr_coll_sup.c
+ * GUPC Portals4 collectives implementation support routines.
+ *
+ * @addtogroup COLLECTIVES GUPCR Collectives Functions
+ * @{
+ */
+
+/** Collectives shared access LE handle */
+static ptl_handle_le_t gupcr_coll_le;
+/** Collectives shared access LE counting events handle */
+static ptl_handle_ct_t gupcr_coll_le_ct;
+/** Collectives shared access LE events queue handle */
+static ptl_handle_eq_t gupcr_coll_le_eq;
+/** Collectives number of received signals (PUT/ATOMIC) through LE */
+static ptl_size_t gupcr_coll_signal_cnt;
+
+/** Collectives local access MD handle */
+static ptl_handle_md_t gupcr_coll_md;
+/** Collectives local access MD counting events handle */
+static ptl_handle_ct_t gupcr_coll_md_ct;
+/** Collectives local access MD event queue handle */
+static ptl_handle_eq_t gupcr_coll_md_eq;
+/** Collectives number of received ACKs on local md */
+static ptl_size_t gupcr_coll_ack_cnt;
+
+/* Collectives thread tree. */
+/** Collectives tree parent thread */
+int gupcr_coll_parent_thread;
+/** Collectives tree number of children */
+int gupcr_coll_child_cnt;
+/** Collectives tree child's index */
+int gupcr_coll_child_index;
+/** Collectives tree children threads */
+int gupcr_coll_child[GUPCR_TREE_FANOUT];
+
+/**
+ * Initialize collectives thread tree.
+ *
+ * A collectives tree starts from the "start" thread number and
+ * includes only "nthreads" (e.g. threads involved in
+ * the reduce process). The simplest case is when all the
+ * threads are involved in which case start=0 and
+ * nthreads=THREADS (e.g. used for broadcast).
+ *
+ * The collectives thread tree can be organized in a
+ * form where the "newroot" value identifies
+ * the root thread (only if the "newroot" thread
+ * is participating in the operation).
+ * @param [in] newroot A hint for the tree root thread.
+ * @param [in] start Start thread for reduce
+ * @param [in] nthreads Number of threads participating
+ *
+ */
+void
+gupcr_coll_tree_setup (size_t newroot, size_t start, int nthreads)
+{
+/* Convert from/to 0-(THREADS-1) to start-(nthreads-1) range. */
+#define NEWID(id,first) ((id - first + THREADS) % THREADS)
+#define OLDID(nid,first) ((nid + first) % THREADS)
+
+/* Remap into the new root (from root 0 to "root"). */
+#define NEWIDROOT(id,top,cnt) ((cnt + id - top) % cnt)
+#define OLDIDROOT(nid,top,cnt) ((nid + top) % cnt)
+ int i;
+ int ok_to_root = 0;
+ int myid;
+ int root = NEWID (newroot, start);
+
+ gupcr_debug (FC_COLL, "newroot: %lu, start: %lu nthreads: %d",
+ (long unsigned) newroot, (long unsigned) start, nthreads);
+
+ /* Check if root node is participating. If yes, use that for the
+ root, otherwise 0. */
+ if (root < nthreads)
+ ok_to_root = 1;
+
+ /* Get myid - first convert into the new range (0-nthreads),
+ then, if needed and possible, into the range where newroot becomes 0. */
+ myid = NEWID (MYTHREAD, start);
+ if (ok_to_root)
+ myid = NEWIDROOT (myid, root, nthreads);
+
+ /* Calculate the thread id's of the children and parent. */
+ gupcr_coll_child_cnt = 0;
+ for (i = 0; i < GUPCR_TREE_FANOUT; i++)
+ {
+ int child = (GUPCR_TREE_FANOUT * myid + i + 1);
+ if (child < nthreads)
+ {
+ ++gupcr_coll_child_cnt;
+ if (ok_to_root)
+ child = OLDIDROOT (child, root, nthreads);
+ gupcr_coll_child[i] = OLDID (child, start);
+ }
+ }
+ if (myid)
+ {
+ gupcr_coll_parent_thread = (myid - 1) / GUPCR_TREE_FANOUT;
+ gupcr_coll_child_index =
+ myid - gupcr_coll_parent_thread * GUPCR_TREE_FANOUT - 1;
+ if (ok_to_root)
+ gupcr_coll_parent_thread =
+ OLDIDROOT (gupcr_coll_parent_thread, root, nthreads);
+ gupcr_coll_parent_thread = OLDID (gupcr_coll_parent_thread, start);
+ }
+ else
+ gupcr_coll_parent_thread = ROOT_PARENT;
+}
+
+/**
+ * Collective PUT operation
+ *
+ * @param [in] dthread Destination thread
+ * @param [in] doffset Destination offset in the shared space
+ * @param [in] soffset Source offset in the shared space
+ * @param [in] nbytes Number of bytes to copy
+ */
+
+void
+gupcr_coll_put (size_t dthread, size_t doffset, size_t soffset, size_t nbytes)
+{
+ ptl_process_t rpid;
+
+ gupcr_debug (FC_COLL, "%d:0x%lx %lu:0x%lx %lu",
+ MYTHREAD, (long unsigned) soffset,
+ (long unsigned) dthread, (long unsigned) doffset,
+ (long unsigned) nbytes);
+ rpid.rank = dthread;
+ gupcr_portals_call (PtlPut,
+ (gupcr_coll_md, soffset, nbytes, PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_COLL, PTL_NO_MATCH_BITS, doffset,
+ PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA));
+}
+
+/**
+ * Collective triggered PUT operation
+ *
+ * Schedule put operation once number of signals reaches
+ * the specified value.
+ *
+ * @param [in] dthread Destination thread
+ * @param [in] doffset Destination offset in the shared space
+ * @param [in] soffset Source offset in the shared space
+ * @param [in] nbytes Number of bytes to copy
+ * @param [in] cnt Trigger count
+ */
+void
+gupcr_coll_trigput (size_t dthread, size_t doffset, size_t soffset,
+ size_t nbytes, size_t cnt)
+{
+ ptl_process_t rpid;
+
+ gupcr_debug (FC_COLL, "%d:0x%lx -> %lu:0x%lx %lu trig %lu",
+ MYTHREAD, (long unsigned) soffset,
+ (long unsigned) dthread, (long unsigned) doffset,
+ (long unsigned) nbytes, (long unsigned) cnt);
+ rpid.rank = dthread;
+ gupcr_portals_call (PtlTriggeredPut,
+ (gupcr_coll_md, soffset, nbytes, PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_COLL, PTL_NO_MATCH_BITS, doffset,
+ PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA, gupcr_coll_le_ct,
+ gupcr_coll_signal_cnt + cnt));
+}
+
+/**
+ * Collective atomic PUT operation.
+ *
+ * @param [in] dthread Destination thread
+ * @param [in] doffset Destination offset in the shared space
+ * @param [in] soffset Source offset in the shared space
+ * @param [in] nbytes Number of bytes to copy
+ * @param [in] op Portals atomic operation
+ * @param [in] datatype Portals atomic data type
+ */
+
+void
+gupcr_coll_put_atomic (size_t dthread, size_t doffset, size_t soffset,
+ size_t nbytes, ptl_op_t op, ptl_datatype_t datatype)
+{
+ ptl_process_t rpid;
+
+ gupcr_debug (FC_COLL, "%d:0x%lx %lu:0x%lx %lu %s %s",
+ MYTHREAD, (long unsigned) soffset,
+ (long unsigned) dthread, (long unsigned) doffset,
+ (long unsigned) nbytes,
+ gupcr_strptlop (op), gupcr_strptldatatype (datatype));
+ rpid.rank = dthread;
+ gupcr_portals_call (PtlAtomic,
+ (gupcr_coll_md, soffset, nbytes, PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_COLL, PTL_NO_MATCH_BITS, doffset,
+ PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA, op, datatype));
+}
+
+/**
+ * Collective triggered atomic PUT operation.
+ *
+ * Schedule atomic put operation once number of signals reaches
+ * the specified value.
+ *
+ * @param [in] dthread Destination thread
+ * @param [in] doffset Destination offset in the shared space
+ * @param [in] soffset Source offset in the shared space
+ * @param [in] nbytes Number of bytes to copy
+ * @param [in] op Portals atomic operation
+ * @param [in] datatype Portals atomic data type
+ * @param [in] cnt Number of signals that triggers
+ */
+void
+gupcr_coll_trigput_atomic (size_t dthread, size_t doffset, size_t soffset,
+ size_t nbytes, ptl_op_t op,
+ ptl_datatype_t datatype, size_t cnt)
+{
+ ptl_process_t rpid;
+
+ gupcr_debug (FC_COLL, "%d:0x%lx %lu:0x%lx %lu %s %s trig %lu",
+ MYTHREAD, (long unsigned) soffset,
+ (long unsigned) dthread, (long unsigned) doffset,
+ (long unsigned) nbytes,
+ gupcr_strptlop (op), gupcr_strptldatatype (datatype),
+ (long unsigned) cnt);
+ rpid.rank = dthread;
+ gupcr_portals_call (PtlTriggeredAtomic,
+ (gupcr_coll_md, soffset,
+ nbytes, PTL_ACK_REQ, rpid, GUPCR_PTL_PTE_COLL,
+ PTL_NO_MATCH_BITS, doffset, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA, op, datatype, gupcr_coll_le_ct,
+ cnt));
+}
+
+/**
+ * Collectives wait for operation completion
+ * This function is used in cases where threads needs to wait
+ * for the completion of remote operations.
+ *
+ * @param [in] cnt Wait count
+ */
+void
+gupcr_coll_ack_wait (size_t cnt)
+{
+ ptl_ct_event_t ct;
+ gupcr_debug (FC_COLL, "wait for %lu (%lu)",
+ (long unsigned) cnt,
+ (long unsigned) (gupcr_coll_ack_cnt + cnt));
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_coll_md_ct, gupcr_coll_ack_cnt + cnt, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_coll_md_eq);
+ gupcr_fatal_error ("received an error on collective MD");
+ }
+ gupcr_coll_ack_cnt += cnt;
+}
+
+/**
+ * Collectives wait for signaling events
+ * This function is used to wait for other threads to complete
+ * operations in the thread's shared space (e.g. children performing
+ * atomic ops in the parent's shared space).
+ *
+ * @param [in] cnt Wait count
+ */
+void
+gupcr_coll_signal_wait (size_t cnt)
+{
+ ptl_ct_event_t ct;
+
+ gupcr_debug (FC_COLL, "wait for %lu (%lu)",
+ (long unsigned) cnt,
+ (long unsigned) (gupcr_coll_signal_cnt + cnt));
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_coll_le_ct, gupcr_coll_signal_cnt + cnt, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_coll_le_eq);
+ gupcr_fatal_error ("received an error on collective LE");
+ }
+ gupcr_coll_signal_cnt += cnt;
+}
+
+/**
+ * Initialize collectives resources.
+ * @ingroup INIT
+ *
+ * A thread's shared space is mapped via a Portals LE for other
+ * threads to write to, and an MD as a source for remote
+ * operations. In this way, the address filed of the shared pointer
+ * can be used as an offset into LE/MD.
+ */
+void
+gupcr_coll_init (void)
+{
+ ptl_md_t md;
+ ptl_pt_index_t pte;
+ ptl_le_t le;
+
+ gupcr_log (FC_COLL, "coll init called");
+
+ /* Allocate the Portals PTE that is used for collectives. */
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_coll_le_eq));
+ gupcr_portals_call (PtlPTAlloc, (gupcr_ptl_ni, 0,
+ gupcr_coll_le_eq, GUPCR_PTL_PTE_COLL,
+ &pte));
+ if (pte != GUPCR_PTL_PTE_COLL)
+ gupcr_fatal_error ("cannot allocate PTE GUPCR_PTL_PTE_COLL.");
+ gupcr_debug (FC_COLL, "Collectives PTE allocated: %d", GUPCR_PTL_PTE_COLL);
+
+ /* Allocate the Portals LE that is used for collectives. */
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_coll_le_ct));
+ le.start = gupcr_gmem_base;
+ le.length = gupcr_gmem_size;
+ le.ct_handle = gupcr_coll_le_ct;
+ le.uid = PTL_UID_ANY;
+ le.options = PTL_LE_OP_PUT | PTL_LE_OP_GET | PTL_LE_EVENT_CT_COMM |
+ PTL_LE_EVENT_SUCCESS_DISABLE | PTL_LE_EVENT_LINK_DISABLE;
+ gupcr_portals_call (PtlLEAppend, (gupcr_ptl_ni, GUPCR_PTL_PTE_COLL, &le,
+ PTL_PRIORITY_LIST, NULL, &gupcr_coll_le));
+ gupcr_debug (FC_COLL, "Collectives LE created at 0x%lx size 0x%lx",
+ (long unsigned) gupcr_gmem_base,
+ (long unsigned) gupcr_gmem_size);
+
+ /* Setup the Portals MD for local source/destination copying.
+ We need to map only the shared memory space. */
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_coll_md_ct));
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_coll_md_eq));
+ md.start = gupcr_gmem_base;
+ md.length = gupcr_gmem_size;
+ md.options = PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_CT_REPLY |
+ PTL_MD_EVENT_SUCCESS_DISABLE;
+ md.eq_handle = gupcr_coll_md_eq;
+ md.ct_handle = gupcr_coll_md_ct;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_coll_md));
+
+ /* Reset the number of signals/acks. */
+ gupcr_coll_signal_cnt = 0;
+ gupcr_coll_ack_cnt = 0;
+}
+
+/**
+ * Release collectives resources.
+ * @ingroup INIT
+ */
+void
+gupcr_coll_fini (void)
+{
+ gupcr_log (FC_COLL, "coll fini called");
+ /* Release the collectives MD. */
+ gupcr_portals_call (PtlMDRelease, (gupcr_coll_md));
+ gupcr_portals_call (PtlCTFree, (gupcr_coll_md_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_coll_md_eq));
+ /* Release the collectives LE and PTE. */
+ gupcr_portals_call (PtlLEUnlink, (gupcr_coll_le));
+ gupcr_portals_call (PtlCTFree, (gupcr_coll_le_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_coll_le_eq));
+ gupcr_portals_call (PtlPTFree, (gupcr_ptl_ni, GUPCR_PTL_PTE_COLL));
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_coll_sup.h b/libgupc/portals4/gupcr_coll_sup.h
new file mode 100644
index 00000000000..410f62a6edb
--- /dev/null
+++ b/libgupc/portals4/gupcr_coll_sup.h
@@ -0,0 +1,106 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_COLL_SUP_H_
+#define _GUPCR_COLL_SUP_H_ 1
+
+/**
+ * @file gupcr_coll_sup.h
+ * GUPC Portals4 collectives implementation support routines.
+ *
+ * @addtogroup COLLECTIVES GUPCR Collectives Functions
+ * @{
+ */
+
+/** Convert from UPC collectives char to Portals atomic type. */
+#define UPC_COLL_TO_PTL_CHAR PTL_INT8_T
+#define UPC_COLL_TO_PTL_UCHAR PTL_UINT8_T
+/** Convert from UPC collectives short to Portals atomic type. */
+#if __SIZEOF_SHORT__ == 2
+#define UPC_COLL_TO_PTL_SHORT PTL_INT16_T
+#define UPC_COLL_TO_PTL_USHORT PTL_UINT16_T
+#elif __SIZEOF_SHORT__ == 4
+#define UPC_COLL_TO_PTL_SHORT PTL_INT32_T
+#define UPC_COLL_TO_PTL_USHORT PTL_UINT32_T
+#else
+#error "Size of short not supported"
+#endif
+/** Convert from UPC collectives int to Portals atomic type. */
+#if __SIZEOF_INT__ == 4
+#define UPC_COLL_TO_PTL_INT PTL_INT32_T
+#define UPC_COLL_TO_PTL_UINT PTL_UINT32_T
+#elif __SIZEOF_INT__ == 8
+#define UPC_COLL_TO_PTL_INT PTL_INT64_T
+#define UPC_COLL_TO_PTL_UINT PTL_UINT64_T
+#else
+#error "Size of int not supported"
+#endif
+/** Convert from UPC collectives long to Portals atomic type. */
+#if __SIZEOF_LONG__ == 4
+#define UPC_COLL_TO_PTL_LONG PTL_INT32_T
+#define UPC_COLL_TO_PTL_ULONG PTL_UINT32_T
+#elif __SIZEOF_LONG__ == 8
+#define UPC_COLL_TO_PTL_LONG PTL_INT64_T
+#define UPC_COLL_TO_PTL_ULONG PTL_UINT64_T
+#else
+#error "Size of long not supported"
+#endif
+/** Convert from UPC collectives float to Portals atomic type. */
+#define UPC_COLL_TO_PTL_FLOAT PTL_FLOAT
+/** Convert from UPC collectives double to Portals atomic type. */
+#define UPC_COLL_TO_PTL_DOUBLE PTL_DOUBLE
+/** Convert from UPC collectives long double to Portals atomic type. */
+#define UPC_COLL_TO_PTL_LONG_DOUBLE PTL_LONG_DOUBLE
+
+extern int gupcr_coll_parent_thread;
+extern int gupcr_coll_child_cnt;
+extern int gupcr_coll_child_index;
+extern int gupcr_coll_child[GUPCR_TREE_FANOUT];
+
+/** Check if thread is the root thread by checking its parent. */
+#define IS_ROOT_THREAD (gupcr_coll_parent_thread == ROOT_PARENT)
+
+void gupcr_coll_tree_setup (size_t newroot, size_t start, int nthreads);
+void gupcr_coll_put (size_t dthread,
+ size_t doffset, size_t soffset, size_t nbytes);
+void gupcr_coll_trigput (size_t dthread,
+ size_t doffset, size_t soffset, size_t nbytes,
+ size_t cnt);
+void gupcr_coll_put_atomic (size_t dthread, size_t doffset, size_t soffset,
+ size_t nbytes, ptl_op_t op,
+ ptl_datatype_t datatype);
+void gupcr_coll_trigput_atomic (size_t dthread, size_t doffset,
+ size_t soffset, size_t nbytes, ptl_op_t op,
+ ptl_datatype_t datatype, size_t cnt);
+void gupcr_coll_ack_wait (size_t cnt);
+void gupcr_coll_signal_wait (size_t cnt);
+
+void gupcr_coll_init (void);
+void gupcr_coll_fini (void);
+
+/** @} */
+
+#endif /* gupcr_coll_sup.h */
diff --git a/libgupc/portals4/gupcr_config.h b/libgupc/portals4/gupcr_config.h
new file mode 100644
index 00000000000..e4f664194bb
--- /dev/null
+++ b/libgupc/portals4/gupcr_config.h
@@ -0,0 +1,180 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_config.h
+ * GUPC Runtime configuration
+ */
+
+#ifndef _GUPCR_CONFIG_H_
+#define _GUPCR_CONFIG_H_
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libgen.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <time.h>
+#if TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#endif
+#include <sys/time.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#define __USE_GNU
+#include <sched.h>
+#endif
+
+#include "config.h"
+
+#define DEV_ZERO "/dev/zero"
+#define OFFSET_ZERO ((off_t) 0)
+/* Darwin has MAP_ANON defined for anonymous memory map. */
+#if !MAP_ANONYMOUS && MAP_ANON
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+#define MAP_ERROR ((void *) -1)
+
+#define GUPCR_SPIN_THREAD_SLOTS 4
+#define GUPCR_SPIN_SLOT_COUNT 64
+#define GUPCR_SPIN_MAX_MULT 1024
+
+#define KILOBYTE 1024
+#define C64K (64*KILOBYTE)
+#define MEGABYTE (KILOBYTE*KILOBYTE)
+#ifndef INT_MIN
+/** __INT_MAX__ is predefined by the gcc compiler. */
+#define INT_MIN (-__INT_MAX__ - 1)
+#endif
+
+//begin detect_target64
+#if (defined (_LP64) && _LP64)
+#define GUPCR_TARGET64 1
+#else
+#define GUPCR_TARGET64 0
+#endif
+//end detect_target64
+
+//begin mode_types
+typedef unsigned int u_intQI_t __attribute__ ((__mode__ (__QI__)));
+typedef unsigned int u_intHI_t __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int u_intSI_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int u_intDI_t __attribute__ ((__mode__ (__DI__)));
+#if GUPCR_TARGET64
+typedef unsigned int u_intTI_t __attribute__ ((__mode__ (__TI__)));
+#endif /* GUPCR_TARGET64 */
+//end mode_types
+
+//begin lib_min_max
+
+/* Helper functions. */
+#define GUPCR_MIN(x,y) (((x) < (y)) ? (x): (y))
+#define GUPCR_MAX(x,y) (((x) > (y)) ? (x): (y))
+#define GUPCR_ABS(x) (((x) > 0) ? (x): -(x))
+#define GUPCR_ROUND(x, r) (((x) + (r) - 1)/(r)*(r))
+//end lib_min_max
+
+//begin lib_config_heap
+
+/** Maximum heap size
+ Set here as 64 gigabytes on a 64-bit implementation
+ and 1 gigabyte on other (eg, 32 bit) implementations. */
+#define GUPCR_MAX_HEAP_SIZE (((sizeof (void *)*8) == 64) \
+ ? (64L * KILOBYTE * MEGABYTE) \
+ : ( 1L * KILOBYTE * MEGABYTE))
+
+/** Default per thread UPC shared heap size. */
+#define GUPCR_DEFAULT_PER_THREAD_HEAP_SIZE (256*MEGABYTE)
+
+/** The minimum number of bytes to allocate (128 bytes).
+
+ This allows for 64 bytes of heap management overhead and 64
+ bytes of allocation. The allocation will be aligned to a 64
+ byte boundary. This is not space efficient, but is intended to
+ provide a minimal alignment that agrees with most CPU cache line
+ size requirements. */
+#define GUPCR_HEAP_ALLOC_MIN 128
+
+/** The minimum number of bytes to allocate (in bits). */
+#define GUPCR_HEAP_ALLOC_MIN_BITS 7
+
+/** The size of the heap management header block. */
+#define GUPCR_HEAP_ALLOC_OVERHEAD 64
+
+/** The number of allocation pools per heap. */
+#define GUPCR_HEAP_NUM_POOLS (SIZE_T_BITS - GUPCR_HEAP_ALLOC_MIN_BITS)
+
+/** An unlikely barrier id to be used for runtime synchronization */
+#define GUPCR_RUNTIME_BARRIER_ID 0xBADF00D
+
+/** A value used to tag each heap allocated item, checked by upc_free */
+#define GUPCR_HEAP_ALLOC_TAG 0x0DDF00D
+
+//end lib_config_heap
+
+/*
+ * Main entry for UPC programs.
+ * The runtime will execute before calling the user's main
+ * program. Thus, the user's main program will renamed
+ * inside of the <upc.h> file to 'upc_main'
+ */
+#define GUPCR_START main
+#define GUPCR_MAIN upc_main
+
+//begin lib_config_shared_section
+
+/** The base address of the UPC shared section */
+#define GUPCR_SHARED_SECTION_START __upc_shared_start
+/** The ending address (plus one) of the UPC shared section */
+#define GUPCR_SHARED_SECTION_END __upc_shared_end
+
+/** The base address of the UPC compiled program info section */
+#define GUPCR_PGM_INFO_SECTION_START __upc_pgm_info_start
+/** The ending address (plus one) of the UPC compiled program info section */
+#define GUPCR_PGM_INFO_SECTION_END __upc_pgm_info_end
+
+/** The base address of an array of pointers to UPC initialization routines */
+#define GUPCR_INIT_ARRAY_START __upc_init_array_start
+/** The ending address (plus one) of pointers to UPC initialization routines */
+#define GUPCR_INIT_ARRAY_END __upc_init_array_end
+
+//end lib_config_shared_section
+
+#endif /* gupcr_config.h */
diff --git a/libgupc/portals4/gupcr_defs.h b/libgupc/portals4/gupcr_defs.h
new file mode 100644
index 00000000000..535780a2316
--- /dev/null
+++ b/libgupc/portals4/gupcr_defs.h
@@ -0,0 +1,98 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_defs.h
+ * GUPC Runtime definitions
+ */
+
+#ifndef _GUPCR_DEFS_H_
+#define _GUPCR_DEFS_H_
+
+#include "gupcr_pts.h"
+
+//begin lib_max_threads_def
+
+/* Maximum number of THREADS supported in this implementation */
+#define GUPCR_THREAD_SIZE 12
+#define GUPCR_THREADS_MAX (1 << GUPCR_THREAD_SIZE)
+//end lib_max_threads_def
+
+#if GUPCR_PTS_PACKED_REP && (GUPCR_THREADS_SIZE > GUPCR_PTS_THREAD_SIZE)
+#error GUPCR_THREADS_MAX exceeds the size of the packed sptr threads field.
+#endif
+
+/* The filename of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+extern const char *gupcr_err_filename;
+
+/* The line number of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+extern unsigned int gupcr_err_linenum;
+
+#define GUPCR_SET_ERR_LOC() \
+ do \
+ { \
+ gupcr_err_filename = filename; \
+ gupcr_err_linenum = linenum; \
+ } while (0)
+
+#define GUPCR_CLEAR_ERR_LOC() \
+ do \
+ { \
+ gupcr_err_filename = NULL; \
+ gupcr_err_linenum = 0; \
+ } while (0)
+
+/* The base address of the UPC shared section. */
+extern char GUPCR_SHARED_SECTION_START[1];
+
+/* The ending address (plus one) of the UPC shared section. */
+extern char GUPCR_SHARED_SECTION_END[1];
+
+/* The base address of the UPC program information section. */
+extern char GUPCR_PGM_INFO_SECTION_START[1];
+
+/* The ending address (plus one) of the UPC program information section. */
+extern char GUPCR_PGM_INFO_SECTION_END[1];
+
+#ifndef __UPC__
+/* The value of THREADS when defined at run time. */
+extern int THREADS;
+
+/* Current thread id. */
+extern int MYTHREAD;
+#endif /* !__UPC__ */
+
+/* OK to call finalize routines. */
+extern int gupcr_finalize_ok;
+
+/* Prototype for the main finalize routine. */
+extern void gupcr_fini (void);
+
+#endif /* gupcr_defs.h */
diff --git a/libgupc/portals4/gupcr_env.c b/libgupc/portals4/gupcr_env.c
new file mode 100644
index 00000000000..47837e39050
--- /dev/null
+++ b/libgupc/portals4/gupcr_env.c
@@ -0,0 +1,515 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_env.c
+ * GUPC Runtime environment variables handling
+ */
+
+/**
+ * @addtogroup GUPCUTILS GUPCR Utility Functions
+ * @{
+ */
+
+/**
+
+ UPC_BACKTRACE
+
+ If set, enable enable backtrace for runtime fatal events. By
+ default backtrace logging on fatal events is disabled (even though
+ it may be configured).
+
+ UPC_DEBUG
+
+ If set, specifies a list of "facilities" that
+ will have debugging output logged.
+
+ UPC_DEBUGFILE
+
+ Path of log file where UPC runtime debug logs are written.
+
+ UPC_FIRSTTOUCH
+
+ Not used. Reserved for future use.
+
+ UPC_FORCETOUCH
+
+ Force the thread to touch every memory page in its own shared
+ memory space on startup. This ensures the correct NUMA memory
+ allocation. By default it is "YES".
+
+ UPC_LOG
+
+ If set, specifies a list of "facilities" that
+ will be logged.
+
+ UPC_LOGFILE
+
+ Path of log file where UPC runtime logs are written.
+
+ UPC_NO_WARN
+
+ If set, the UPC_NO_WARN variable causes startup warnings (such as
+ those displayed when debugging or tracing is enabled) to be omitted.
+
+ UPC_NODE_LOCAL_MEM
+
+ If set to "NO", then disable node local memory optimization.
+
+ UPC_NODES
+
+ Not used. Reserved for future use.
+
+ UPC_QUIET
+
+ UPC_QUIET causes all non-application-generated output to be omitted
+ (including both warnings and the initial display of UPC thread
+ layout).
+
+ UPC_POLITE
+
+ Yield the processor frequently while spin-locking.
+
+ UPC_SHARED_HEAP_SIZE
+
+ UPC_SHARED_HEAP_SIZE sets the amount of shared heap (per UPC thread)
+ for your program.
+
+ UPC_STATS
+
+ If set, specifies a list of "facilities" for
+ which UPC runtime statistics will be collected.
+
+ UPC_STATSFILE
+
+ Path of log file where UPC runtime statistics are written.
+
+ UPC_TRACE
+
+ If set, specifies a list of "facilities" that
+ will be traced.
+
+ UPC_TRACEFILE
+
+ Path of log file where UPC trace logs are written.
+
+ The set of facilities are:
+
+ ADDR UPC casts to local and access to PTS's.
+ ALL All the facilities
+ ALLOC UPC dynamic memory allocation
+ ATOMIC UPC atomic operations
+ BARRIER UPC barrier/notify/wait operations
+ BROADCAST UPC runtime internal broadcast operations
+ COLL UPC collectives
+ INFO General information, program info.
+ LOCKS UPC lock operations
+ MEM UPC shared memory accesses
+ MISC Miscellaneous functions
+ PORTALS Portals operations
+ SYSTEM System calls
+
+ For all environment variables above that set a filename path,
+ each appearance of a single '%' will be substituted with the process
+ pid. Two '%'s together escape a single %. Non-existent intermediate
+ directories will be created. As a special case, if the filename
+ is "stdout" or "stderr", then output will be directed to the
+ specified file descriptor. A filename with no '%' indicates
+ that the file will be shared across all processes.
+
+*/
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+
+static const struct gupcr_fc_tbl_struct
+{
+ const char *name;
+ gupcr_facility_t mask;
+}
+gupcr_facility_table[] =
+{
+ {"addr", FC_ADDR},
+ {"all", FC_ALL},
+ {"alloc", FC_ALLOC},
+ {"atomic", FC_ATOMIC},
+ {"barrier", FC_BARRIER},
+ {"broadcast", FC_BROADCAST},
+ {"coll", FC_COLL},
+ {"info", FC_INFO},
+ {"locks", FC_LOCK},
+ {"mem", FC_MEM},
+ {"misc", FC_MISC},
+ {"nb", FC_NB},
+ {"portals", FC_PORTALS},
+ {"system", FC_SYSTEM}
+};
+
+#define GUPCR_FC_TBL_SIZE (sizeof (gupcr_facility_table) \
+ / sizeof (struct gupcr_fc_tbl_struct))
+typedef enum
+{
+ ENV_NONE = 0,
+ ENV_UPC_BACKTRACE,
+ ENV_UPC_DEBUG,
+ ENV_UPC_DEBUGFILE,
+ ENV_UPC_FIRSTTOUCH,
+ ENV_UPC_FORCETOUCH,
+ ENV_UPC_LOG,
+ ENV_UPC_LOGFILE,
+ ENV_UPC_NO_WARN,
+ ENV_UPC_NODE_LOCAL_MEM,
+ ENV_UPC_NODES,
+ ENV_UPC_POLITE,
+ ENV_UPC_REQUIRE_SHARED_SIZE,
+ ENV_UPC_QUIET,
+ ENV_UPC_SHARED_HEAP_SIZE,
+ ENV_UPC_STATS,
+ ENV_UPC_STATSFILE,
+ ENV_UPC_TRACE,
+ ENV_UPC_TRACEFILE
+} gupcr_env_kind;
+
+static const struct gupcr_env_var_struct
+{
+ const char *name;
+ gupcr_env_kind kind;
+}
+gupcr_env_var_table[] =
+{
+ {"UPC_BACKTRACE", ENV_UPC_BACKTRACE},
+ {"UPC_DEBUG", ENV_UPC_DEBUG},
+ {"UPC_DEBUGFILE", ENV_UPC_DEBUGFILE},
+ {"UPC_FIRSTTOUCH", ENV_UPC_FIRSTTOUCH},
+ {"UPC_FORCETOUCH", ENV_UPC_FORCETOUCH},
+ {"UPC_LOG", ENV_UPC_LOG},
+ {"UPC_LOGFILE", ENV_UPC_LOGFILE},
+ {"UPC_NO_WARN", ENV_UPC_NO_WARN},
+ {"UPC_NODE_LOCAL_MEM", ENV_UPC_NODE_LOCAL_MEM},
+ {"UPC_NODES", ENV_UPC_NODES},
+ {"UPC_POLITE", ENV_UPC_POLITE},
+ {"UPC_REQUIRE_SHARED_SIZE", ENV_UPC_REQUIRE_SHARED_SIZE},
+ {"UPC_QUIET", ENV_UPC_QUIET},
+ {"UPC_SHARED_HEAP_SIZE", ENV_UPC_SHARED_HEAP_SIZE},
+ {"UPC_STATS", ENV_UPC_STATS},
+ {"UPC_STATSFILE", ENV_UPC_STATSFILE},
+ {"UPC_TRACE", ENV_UPC_TRACE},
+ {"UPC_TRACEFILE", ENV_UPC_TRACEFILE}
+};
+
+#define GUPCR_ENV_VAR_TBL_SIZE (sizeof (gupcr_env_var_table) \
+ / sizeof (struct gupcr_env_var_struct))
+
+/* Look up the name given by FACILITY and return the facility mask value
+ associated with that name. */
+
+static gupcr_facility_t
+gupcr_facility_mask_for_name (const char *const facility)
+{
+ unsigned i;
+ for (i = 0; i < GUPCR_FC_TBL_SIZE; ++i)
+ {
+ if (!strcasecmp (gupcr_facility_table[i].name, facility))
+ return gupcr_facility_table[i].mask;
+ }
+ return FC_NONE;
+}
+
+/* Extract the environment variable name appearing before the
+ first '=' sign in ENV_VAR_ARG; look it up in the list of
+ known "UPC_" environment variables and return an
+ integer value that is used to identify this particular
+ environment variable name. */
+
+static gupcr_env_kind
+gupcr_env_kind_for_var (const char *const env_var_arg)
+{
+ gupcr_env_kind env_kind = ENV_NONE;
+ unsigned i;
+ char *env_var_dup, *env_var;
+ gupcr_strdup (env_var_dup, env_var_arg);
+ env_var = strtok (env_var_dup, "=");
+ gupcr_assert (env_var != NULL);
+ for (i = 0; i < GUPCR_ENV_VAR_TBL_SIZE; ++i)
+ {
+ if (!strcmp (gupcr_env_var_table[i].name, env_var))
+ return gupcr_env_var_table[i].kind;
+ }
+ gupcr_free (env_var_dup);
+ return env_kind;
+}
+
+/* Process the comma separated list of facility names that
+ appear after the '=' sign. Return a mask value indicating
+ which facility names were specified. */
+
+gupcr_facility_t
+gupcr_env_facility_list (const char *const env_var_arg)
+{
+ gupcr_facility_t facility_mask = FC_NONE;
+ char *env_var_dup, *env_var, *facility_name;
+ gupcr_strdup (env_var_dup, env_var_arg);
+ if ((env_var = strtok (env_var_dup, "=")))
+ {
+ while ((facility_name = strtok (NULL, ",")))
+ {
+ gupcr_facility_t facility;
+ facility = gupcr_facility_mask_for_name (facility_name);
+ if (!facility)
+ gupcr_error ("invalid facility name `%s' found in "
+ "environment variable: `%s'",
+ facility_name, env_var_arg);
+ facility_mask |= facility;
+ }
+ }
+ else
+ gupcr_error ("invalid UPC environment variable syntax: `%s'", env_var);
+ gupcr_free (env_var_dup);
+ return facility_mask;
+}
+
+/* Return a malloc'd copy of ENV_VAR_STR_ARG with
+ the current pid substituted for each occurrence of a '%'.
+ Two '%'s next to each other are equivalent to a single '%'. */
+
+const char *
+gupcr_env_filename (const char *const env_var_arg)
+{
+ char *env_var_dup, *env_var, *filename_arg;
+ char *filename = NULL;
+ gupcr_strdup (env_var_dup, env_var_arg);
+ if ((env_var = strtok (env_var_dup, "=")))
+ {
+ if ((filename_arg = strtok (NULL, "")))
+ {
+ const char *const pid = gupcr_get_pid_as_string ();
+ const char *cp;
+ char *fp;
+ size_t filename_len;
+ size_t pid_len = strlen (pid);
+ /* Calculate the required string size. */
+ for (cp = filename_arg, filename_len = 0; *cp; ++cp)
+ {
+ if (cp[0] == '%' && cp[1] == '%')
+ cp += 1, ++filename_len;
+ else if (cp[0] == '%')
+ filename_len += pid_len;
+ else
+ ++filename_len;
+ }
+ /* Allocate the string; copy ENV_VAR_STR_ARG and
+ make '%' substitutions. */
+ gupcr_malloc (filename, filename_len + 1);
+ for (fp = filename, cp = filename_arg; *cp; ++cp)
+ {
+ if (cp[0] == '%' && cp[1] == '%')
+ cp += 1, *fp++ = '%';
+ else if (cp[0] == '%')
+ strcpy (fp, pid), fp += pid_len;
+ else
+ *fp++ = *cp;
+ }
+ *fp = '\0';
+ }
+ else
+ gupcr_error ("missing file name in UPC environment "
+ "variable: `%s'", env_var_arg);
+ }
+ else
+ gupcr_error ("invalid UPC environment variable syntax: `%s'",
+ env_var_arg);
+ gupcr_free (env_var_dup);
+ return filename;
+}
+
+static long long
+gupcr_env_size (const char *const env_var_arg, long long int val_max)
+{
+ long long size = 0;
+ char *env_var, *env_var_name, *size_str;
+ gupcr_strdup (env_var, env_var_arg);
+ if ((env_var_name = strtok (env_var, "=")))
+ {
+ if ((size_str = strtok (NULL, "")))
+ {
+ int status;
+ size = gupcr_strtoll (size_str, 0, val_max, &status);
+ if (status)
+ {
+ gupcr_error ("invalid size specifier in UPC environment "
+ "variable: `%s'", env_var_arg);
+ gupcr_strtoll_error (size_str, 0, val_max, status);
+ }
+ }
+ else
+ gupcr_error ("missing size specifier in UPC environment "
+ "variable: `%s'", env_var_arg);
+ }
+ else
+ gupcr_error ("invalid UPC environment variable syntax: `%s'",
+ env_var_arg);
+ gupcr_free (env_var);
+ return size;
+}
+
+static int
+gupcr_env_boolean (const char *const env_var_arg)
+{
+ int value = 0;
+ char *env_var, *env_var_name, *switch_str;
+ gupcr_strdup (env_var, env_var_arg);
+ if ((env_var_name = strtok (env_var, "=")))
+ {
+ if ((switch_str = strtok (NULL, "")))
+ {
+ if (!strcmp (switch_str, "NO") || \
+ !strcmp (switch_str, "no") || \
+ !strcmp (switch_str, "0"))
+ value = 0;
+ else if (!strcmp (switch_str, "YES") || \
+ !strcmp (switch_str, "yes") || \
+ !strcmp (switch_str, "1"))
+ value = 1;
+ else
+ {
+ gupcr_error ("invalid value specifier in UPC environment "
+ "variable: `%s'", env_var_arg);
+ }
+ }
+ else
+ gupcr_error ("missing value specifier in UPC environment "
+ "variable: `%s'", env_var_arg);
+ }
+ else
+ gupcr_error ("invalid UPC environment variable syntax: `%s'",
+ env_var_arg);
+ gupcr_free (env_var);
+ return value;
+}
+
+/* Process all variables in the environment that begin with "UPC_".
+ Make various calls back into "gupcr_utils.c" to implement
+ the actions associated with each given environment variable. */
+
+void
+gupcr_env_init (void)
+{
+ /* System environment, see: environ (7). */
+ extern char **environ;
+ const char *env_var;
+ unsigned i;
+ for (i = 0; (env_var = environ[i]); ++i)
+ {
+ if (!strncmp (env_var, "UPC_", 4))
+ {
+ const int env_kind = gupcr_env_kind_for_var (env_var);
+ gupcr_facility_t facility_mask;
+ const char *filename;
+ size_t heap_size;
+ switch (env_kind)
+ {
+ case ENV_UPC_BACKTRACE:
+ gupcr_set_backtrace (gupcr_env_boolean (env_var));
+ break;
+ case ENV_UPC_DEBUG:
+ facility_mask = gupcr_env_facility_list (env_var);
+ if (facility_mask)
+ gupcr_set_debug_facility (facility_mask);
+ break;
+ case ENV_UPC_DEBUGFILE:
+ filename = gupcr_env_filename (env_var);
+ if (filename)
+ gupcr_set_debug_filename (filename);
+ break;
+ case ENV_UPC_FIRSTTOUCH:
+ /* no-op */
+ break;
+ case ENV_UPC_FORCETOUCH:
+ gupcr_set_forcetouch (gupcr_env_boolean (env_var));
+ break;
+ case ENV_UPC_LOG:
+ facility_mask = gupcr_env_facility_list (env_var);
+ if (facility_mask)
+ gupcr_set_log_facility (facility_mask);
+ break;
+ case ENV_UPC_LOGFILE:
+ filename = gupcr_env_filename (env_var);
+ if (filename)
+ gupcr_set_log_filename (filename);
+ break;
+ case ENV_UPC_NO_WARN:
+ gupcr_no_warn ();
+ break;
+ case ENV_UPC_NODE_LOCAL_MEM:
+ gupcr_set_node_local_memory (gupcr_env_boolean (env_var));
+ break;
+ case ENV_UPC_NODES:
+ /* no-op */
+ break;
+ case ENV_UPC_POLITE:
+ /* no-op */
+ break;
+ case ENV_UPC_QUIET:
+ gupcr_be_quiet ();
+ break;
+ case ENV_UPC_SHARED_HEAP_SIZE:
+ heap_size = (size_t) gupcr_env_size (env_var,
+ GUPCR_MAX_HEAP_SIZE);
+ gupcr_set_shared_heap_size (heap_size);
+ break;
+ case ENV_UPC_STATS:
+ facility_mask = gupcr_env_facility_list (env_var);
+ gupcr_set_stats_facility (facility_mask);
+ break;
+ case ENV_UPC_STATSFILE:
+ filename = gupcr_env_filename (env_var);
+ if (filename)
+ gupcr_set_stats_filename (filename);
+ break;
+ case ENV_UPC_TRACE:
+ facility_mask = gupcr_env_facility_list (env_var);
+ gupcr_set_trace_facility (facility_mask);
+ break;
+ case ENV_UPC_TRACEFILE:
+ filename = gupcr_env_filename (env_var);
+ if (filename)
+ gupcr_set_trace_filename (filename);
+ break;
+ case ENV_UPC_REQUIRE_SHARED_SIZE:
+ /* no-op */
+ break;
+ case ENV_NONE:
+ gupcr_warn ("unknown UPC environment variable: %s", env_var);
+ break;
+ default:
+ gupcr_fatal_error ("env variable case value out of range");
+ }
+ }
+ }
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_gmem.c b/libgupc/portals4/gupcr_gmem.c
new file mode 100644
index 00000000000..cb2a60ad1d1
--- /dev/null
+++ b/libgupc/portals4/gupcr_gmem.c
@@ -0,0 +1,521 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_gmem.c
+ * GUPC Portals4 shared memory interface.
+ */
+
+/**
+ * @addtogroup GMEM GUPCR Shared Memory Access
+ * @{
+ */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_node.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_sync.h"
+
+/** GMEM LE handle */
+static ptl_handle_le_t gupcr_gmem_le;
+
+/** Thread's default shared heap size */
+#define GUPCR_GMEM_DEFAULT_HEAP_SIZE 256*1024*1024
+
+/** Shared memory base and size */
+void *gupcr_gmem_base;
+size_t gupcr_gmem_size;
+
+/** GET event tracking */
+gupcr_gmem_xfer_info_t gupcr_gmem_gets;
+/** PUT event tracking */
+gupcr_gmem_xfer_info_t gupcr_gmem_puts;
+
+/** PUT "bounce buffer" type */
+typedef char gupcr_gmem_put_bb_t[GUPCR_BOUNCE_BUFFER_SIZE];
+/** PUT "bounce buffer" space */
+static gupcr_gmem_put_bb_t gupcr_gmem_put_bb;
+/** PUT "bounce buffer" memory descriptor handle */
+static ptl_handle_md_t gupcr_gmem_put_bb_md;
+/** PUT "bounce buffer" used counter */
+size_t gupcr_gmem_put_bb_used;
+
+/** Previous operation was a strict put */
+int gupcr_pending_strict_put;
+
+/** Heap base offset relative to start of UPC shared region */
+size_t gupcr_gmem_heap_base_offset;
+
+/** Size of UPC shared region reserved for the heap */
+size_t gupcr_gmem_heap_size;
+
+/** Remote puts flow control */
+static const size_t gupcr_gmem_high_mark_puts = GUPCR_MAX_OUTSTANDING_PUTS;
+static const size_t gupcr_gmem_low_mark_puts = GUPCR_MAX_OUTSTANDING_PUTS / 2;
+
+/**
+ * Allocate memory for this thread's shared space contribution.
+ *
+ * Calculate needed memory size and let the node allocate
+ * shared memory and map other thread's shared memory into
+ * the current thread memory space.
+ */
+static void
+gupcr_gmem_alloc_shared (void)
+{
+ size_t heap_size = GUPCR_ROUND (gupcr_get_shared_heap_size (), C64K);
+ size_t data_size = GUPCR_ROUND (GUPCR_SHARED_SECTION_END -
+ GUPCR_SHARED_SECTION_START, C64K);
+ gupcr_gmem_heap_base_offset = data_size;
+ gupcr_gmem_heap_size = heap_size;
+ gupcr_gmem_size = heap_size + data_size;
+
+ /* Allocate this thread's shared space. */
+ gupcr_gmem_base = gupcr_node_local_alloc (gupcr_gmem_size);
+}
+
+/**
+ * Complete all outstanding remote GET operations.
+ *
+ * This procedure waits for all outstanding GET operations
+ * to complete. If the wait on the Portals GET counting event returns
+ * a failure, a full event queue is checked for failure specifics
+ * and the program aborts.
+ */
+void
+gupcr_gmem_sync_gets (void)
+{
+ /* Sync all outstanding local accesses. */
+ GUPCR_MEM_BARRIER ();
+ /* Sync all outstanding remote get accesses. */
+ if (gupcr_gmem_gets.num_pending > 0)
+ {
+ ptl_size_t num_initiated =
+ gupcr_gmem_gets.num_completed + gupcr_gmem_gets.num_pending;
+ ptl_ct_event_t ct;
+ gupcr_debug (FC_MEM, "outstanding gets: %lu",
+ (long unsigned) gupcr_gmem_gets.num_pending);
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_gmem_gets.ct_handle, num_initiated, &ct));
+ gupcr_gmem_gets.num_pending = 0;
+ gupcr_gmem_gets.num_completed = num_initiated;
+ if (ct.failure > 0)
+ {
+ gupcr_process_fail_events (gupcr_gmem_gets.eq_handle);
+ gupcr_abort ();
+ }
+ }
+}
+
+/**
+ * Complete outstanding remote PUT operations.
+ *
+ * This procedure waits for all outstanding PUT operations
+ * to complete. If the wait on the Portals PUT counting event returns
+ * a failure, a full event queue is checked for failure specifics
+ * and the program aborts.
+ */
+void
+gupcr_gmem_sync_puts (void)
+{
+ /* Sync all outstanding local accesses. */
+ GUPCR_MEM_BARRIER ();
+ /* Sync all outstanding remote put accesses. */
+ if (gupcr_gmem_puts.num_pending > 0)
+ {
+ ptl_size_t num_initiated =
+ gupcr_gmem_puts.num_completed + gupcr_gmem_puts.num_pending;
+ ptl_ct_event_t ct;
+ gupcr_debug (FC_MEM, "outstanding puts: %lu",
+ (long unsigned) gupcr_gmem_puts.num_pending);
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_gmem_puts.ct_handle, num_initiated, &ct));
+ gupcr_gmem_puts.num_pending = 0;
+ gupcr_gmem_puts.num_completed = num_initiated;
+ gupcr_pending_strict_put = 0;
+ gupcr_gmem_put_bb_used = 0;
+ if (ct.failure > 0)
+ {
+ gupcr_process_fail_events (gupcr_gmem_puts.eq_handle);
+ gupcr_abort ();
+ }
+ }
+}
+
+/**
+ * Complete all outstanding remote operations.
+ *
+ * Check and wait for completion of all PUT/GET operations.
+ */
+void
+gupcr_gmem_sync (void)
+{
+ gupcr_gmem_sync_gets ();
+ gupcr_gmem_sync_puts ();
+}
+
+/**
+ * Read data from remote shared memory.
+ *
+ * A GET request is broken into multiple PtlGet() requests
+ * if the number of requested bytes is greater then
+ * the configuration limited maximum message size.
+ *
+ * @param [in] dest Local memory to receive remote data
+ * @param [in] thread Remote thread to request data from
+ * @param [in] offset Remote address
+ * @param [in] n Number of bytes to transfer
+ */
+void
+gupcr_gmem_get (void *dest, int thread, size_t offset, size_t n)
+{
+ ptl_process_t rpid;
+ char *dest_addr = (char *) (dest - USER_PROG_MEM_START);
+ size_t rem_offset = offset;
+ size_t n_rem = n;
+
+ gupcr_debug (FC_MEM, "%d:0x%lx 0x%lx",
+ thread, (long unsigned) offset, (long unsigned) dest);
+ rpid.rank = thread;
+ while (n_rem > 0)
+ {
+ size_t n_xfer;
+ n_xfer = GUPCR_MIN (n_rem, (size_t) GUPCR_PORTALS_MAX_MSG_SIZE);
+ ++gupcr_gmem_gets.num_pending;
+ gupcr_portals_call (PtlGet, (gupcr_gmem_gets.md,
+ (ptl_size_t) dest_addr, n_xfer, rpid,
+ GUPCR_PTL_PTE_GMEM, PTL_NO_MATCH_BITS,
+ rem_offset, PTL_NULL_USER_PTR));
+ n_rem -= n_xfer;
+ dest_addr += n_xfer;
+ rem_offset += n_xfer;
+ }
+}
+
+/**
+ * Write data to remote shared memory.
+ *
+ * For data requests smaller then maximum safe size, the data is first
+ * copied into a bounce buffer. In this way, the put operation
+ * can be non-blocking and there are no restrictions placed upon
+ * the caller's use of the source data buffer.
+ * Otherwise, a synchronous operation is performed
+ * and this function returns to the caller after the operation completes.
+ *
+ * @param [in] thread Destination thread
+ * @param [in] offset Destination offset
+ * @param [in] src Local source pointer to data
+ * @param [in] n Number of bytes to transfer
+ */
+void
+gupcr_gmem_put (int thread, size_t offset, const void *src, size_t n)
+{
+ int must_sync = (n > GUPCR_GMEM_MAX_SAFE_PUT_SIZE);
+ char *src_addr = (char *) src;
+ size_t n_rem = n;
+ ptl_process_t rpid;
+ gupcr_debug (FC_MEM, "0x%lx %d:0x%lx",
+ (long unsigned) src, thread, (long unsigned) offset);
+ rpid.rank = thread;
+ /* Large puts must be synchronous, to ensure that it is
+ safe to re-use the source buffer upon return. */
+ while (n_rem > 0)
+ {
+ size_t n_xfer;
+ ptl_handle_md_t md_handle;
+ ptl_size_t local_offset;
+ n_xfer = GUPCR_MIN (n_rem, (size_t) GUPCR_PORTALS_MAX_MSG_SIZE);
+ if (must_sync)
+ {
+ local_offset = src_addr - (char *) USER_PROG_MEM_START;
+ md_handle = gupcr_gmem_puts.md;
+ }
+ else if (n_rem <= GUPCR_PORTALS_MAX_VOLATILE_SIZE)
+ {
+ local_offset = src_addr - (char *) USER_PROG_MEM_START;
+ md_handle = gupcr_gmem_puts.md_volatile;
+ }
+ else
+ {
+ char *bounce_buf;
+ /* If this transfer will overflow the bounce buffer,
+ then first wait for all outstanding puts to complete. */
+ if ((gupcr_gmem_put_bb_used + n_xfer) > GUPCR_BOUNCE_BUFFER_SIZE)
+ gupcr_gmem_sync_puts ();
+ bounce_buf = &gupcr_gmem_put_bb[gupcr_gmem_put_bb_used];
+ memcpy (bounce_buf, src_addr, n_xfer);
+ local_offset = bounce_buf - gupcr_gmem_put_bb;
+ gupcr_gmem_put_bb_used += n_xfer;
+ md_handle = gupcr_gmem_put_bb_md;
+ }
+ ++gupcr_gmem_puts.num_pending;
+ gupcr_portals_call (PtlPut, (md_handle, local_offset, n_xfer,
+ PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_GMEM, PTL_NO_MATCH_BITS,
+ offset, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA));
+ n_rem -= n_xfer;
+ src_addr += n_xfer;
+
+ if (gupcr_gmem_puts.num_pending == gupcr_gmem_high_mark_puts)
+ {
+ ptl_ct_event_t ct;
+ size_t complete_cnt;
+ size_t wait_cnt = gupcr_gmem_puts.num_completed
+ + gupcr_gmem_puts.num_pending
+ - gupcr_gmem_low_mark_puts;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_gmem_puts.ct_handle, wait_cnt, &ct));
+ if (ct.failure > 0)
+ {
+ gupcr_process_fail_events (gupcr_gmem_puts.eq_handle);
+ gupcr_abort ();
+ }
+ complete_cnt = ct.success - gupcr_gmem_puts.num_completed;
+ gupcr_gmem_puts.num_pending -= complete_cnt;
+ gupcr_gmem_puts.num_completed = ct.success;
+ }
+ }
+ if (must_sync)
+ gupcr_gmem_sync_puts ();
+}
+
+/**
+ * Copy remote shared memory from the source thread
+ * to the destination thread.
+ *
+ * Bulk copy from one thread to another.
+ * The put bounce buffer is used as an intermediate buffer.
+ * Caller assumes responsibility for checking the validity
+ * of the remote thread id's and/or shared memory offsets.
+ *
+ * @param [in] dthread Destination thread
+ * @param [in] doffset Destination offset
+ * @param [in] sthread Source thread
+ * @param [in] soffset Source offset
+ * @param [in] n Number of bytes to transfer
+ */
+void
+gupcr_gmem_copy (int dthread, size_t doffset,
+ int sthread, size_t soffset, size_t n)
+{
+ size_t n_rem = n;
+ ptl_size_t dest_addr = doffset;
+ ptl_size_t src_addr = soffset;
+ ptl_process_t dpid;
+ gupcr_debug (FC_MEM, "%d:0x%lx %d:0x%lx %lu",
+ sthread, (long unsigned) soffset,
+ dthread, (long unsigned) doffset,
+ (long unsigned) n);
+ dpid.rank = dthread;
+ while (n_rem > 0)
+ {
+ size_t n_xfer;
+ char *bounce_buf;
+ ptl_size_t local_offset;
+ /* Use the entire put "bounce buffer" if the transfer
+ count is sufficiently large. */
+ n_xfer = GUPCR_MIN (n_rem, GUPCR_BOUNCE_BUFFER_SIZE);
+ if ((gupcr_gmem_put_bb_used + n_xfer) > GUPCR_BOUNCE_BUFFER_SIZE)
+ gupcr_gmem_sync_puts ();
+ bounce_buf = &gupcr_gmem_put_bb[gupcr_gmem_put_bb_used];
+ gupcr_gmem_put_bb_used += n_xfer;
+ /* Read the source data into the bounce buffer. */
+ gupcr_gmem_get (bounce_buf, sthread, src_addr, n_xfer);
+ gupcr_gmem_sync_gets ();
+ local_offset = bounce_buf - gupcr_gmem_put_bb;
+ ++gupcr_gmem_puts.num_pending;
+ gupcr_portals_call (PtlPut, (gupcr_gmem_put_bb_md, local_offset, n_xfer,
+ PTL_ACK_REQ, dpid,
+ GUPCR_PTL_PTE_GMEM, PTL_NO_MATCH_BITS,
+ dest_addr, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA));
+ n_rem -= n_xfer;
+ src_addr += n_xfer;
+ dest_addr += n_xfer;
+ }
+}
+
+/**
+ * Write the same byte value into the bytes of the
+ * destination thread's memory at the specified offset.
+ *
+ * The put bounce buffer is used as an intermediate buffer.
+ * The last write of a chunk of data is non-blocking.
+ * Caller assumes responsibility for checking the validity
+ * of the remote thread id's and/or shared memory offsets.
+ *
+ * @param [in] thread Destination thread
+ * @param [in] offset Destination offset
+ * @param [in] c Set value
+ * @param [in] n Number of bytes to transfer
+ */
+void
+gupcr_gmem_set (int thread, size_t offset, int c, size_t n)
+{
+ size_t n_rem = n;
+ int already_filled = 0;
+ ptl_size_t dest_addr = offset;
+ ptl_process_t rpid;
+ gupcr_debug (FC_MEM, "0x%x %d:0x%lx %lu", c, thread,
+ (long unsigned) offset, (long unsigned) n);
+ rpid.rank = thread;
+ while (n_rem > 0)
+ {
+ size_t n_xfer;
+ char *bounce_buf;
+ ptl_size_t local_offset;
+ /* Use the entire put "bounce buffer" if the transfer
+ count is sufficiently large. */
+ n_xfer = GUPCR_MIN (n_rem, (size_t) GUPCR_BOUNCE_BUFFER_SIZE);
+ if ((gupcr_gmem_put_bb_used + n_xfer) > GUPCR_BOUNCE_BUFFER_SIZE)
+ gupcr_gmem_sync_puts ();
+ bounce_buf = &gupcr_gmem_put_bb[gupcr_gmem_put_bb_used];
+ gupcr_gmem_put_bb_used += n_xfer;
+ /* Fill the bounce buffer, if we haven't already. */
+ if (!already_filled)
+ {
+ memset (bounce_buf, c, n_xfer);
+ already_filled = (bounce_buf == gupcr_gmem_put_bb
+ && n_xfer == GUPCR_BOUNCE_BUFFER_SIZE);
+ }
+ local_offset = bounce_buf - gupcr_gmem_put_bb;
+ ++gupcr_gmem_puts.num_pending;
+ gupcr_portals_call (PtlPut, (gupcr_gmem_put_bb_md, local_offset, n_xfer,
+ PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_GMEM, PTL_NO_MATCH_BITS,
+ dest_addr, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA));
+ n_rem -= n_xfer;
+ dest_addr += n_xfer;
+ }
+}
+
+/**
+ * Initialize gmem resources.
+ * @ingroup INIT
+ */
+void
+gupcr_gmem_init (void)
+{
+ ptl_md_t md, md_volatile;
+ ptl_le_t le;
+ ptl_pt_index_t pte;
+ gupcr_log (FC_MEM, "gmem init called");
+ /* Allocate memory for this thread's contribution to shared memory. */
+ gupcr_gmem_alloc_shared ();
+ gupcr_portals_call (PtlPTAlloc,
+ (gupcr_ptl_ni, 0,
+ PTL_EQ_NONE, GUPCR_PTL_PTE_GMEM, &pte));
+ if (pte != GUPCR_PTL_PTE_GMEM)
+ gupcr_fatal_error ("cannot allocate PTE GUPCR_PTL_PTE_GMEM");
+ gupcr_log (FC_MEM, "Gmem PTE allocated: %d", GUPCR_PTL_PTE_GMEM);
+ /* Setup Gmem LE. */
+ le.start = gupcr_gmem_base;
+ le.length = gupcr_gmem_size;
+ le.ct_handle = PTL_CT_NONE;
+ le.uid = PTL_UID_ANY;
+ le.options = PTL_LE_OP_PUT | PTL_LE_OP_GET;
+ gupcr_portals_call (PtlLEAppend,
+ (gupcr_ptl_ni,
+ GUPCR_PTL_PTE_GMEM, &le,
+ PTL_PRIORITY_LIST, NULL, &gupcr_gmem_le));
+ gupcr_debug (FC_MEM, "Gmem LE created at 0x%lx with size 0x%lx)",
+ (long unsigned) gupcr_gmem_base,
+ (long unsigned) gupcr_gmem_size);
+ /* Initialize GMEM get lists */
+ gupcr_gmem_gets.num_pending = 0;
+ gupcr_gmem_gets.num_completed = 0;
+ gupcr_gmem_gets.md_options =
+ PTL_MD_EVENT_CT_REPLY | PTL_MD_EVENT_SUCCESS_DISABLE;
+ /* Allocate at least THREADS number of EQ entries. */
+ gupcr_portals_call (PtlEQAlloc,
+ (gupcr_ptl_ni, THREADS, &gupcr_gmem_gets.eq_handle));
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_gmem_gets.ct_handle));
+ /* Map user's address space for GET operations. */
+ md.length = (ptl_size_t) USER_PROG_MEM_SIZE;
+ md.start = (void *) USER_PROG_MEM_START;
+ md.options = gupcr_gmem_gets.md_options;
+ md.eq_handle = gupcr_gmem_gets.eq_handle;
+ md.ct_handle = gupcr_gmem_gets.ct_handle;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_gmem_gets.md));
+ /* Initialize GMEM put lists. */
+ gupcr_gmem_puts.num_pending = 0;
+ gupcr_gmem_puts.num_completed = 0;
+ gupcr_gmem_puts.md_options =
+ PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_SUCCESS_DISABLE;
+ /* Allocate at least THREADS number of EQ entries. */
+ gupcr_portals_call (PtlEQAlloc,
+ (gupcr_ptl_ni, THREADS, &gupcr_gmem_puts.eq_handle));
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_gmem_puts.ct_handle));
+ /* Map user's address space for PUT operations. */
+ md.length = (ptl_size_t) USER_PROG_MEM_SIZE;
+ md.start = (void *) USER_PROG_MEM_START;
+ md.options = gupcr_gmem_puts.md_options;
+ md.eq_handle = gupcr_gmem_puts.eq_handle;
+ md.ct_handle = gupcr_gmem_puts.ct_handle;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_gmem_puts.md));
+ /* And map the same but with a volatile option. */
+ md_volatile = md;
+ md_volatile.options |= PTL_MD_VOLATILE;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md_volatile,
+ &gupcr_gmem_puts.md_volatile));
+ /* Initialize GMEM put bounce buffer. */
+ md.length = GUPCR_BOUNCE_BUFFER_SIZE;
+ md.start = gupcr_gmem_put_bb;
+ md.options = gupcr_gmem_puts.md_options;
+ md.eq_handle = gupcr_gmem_puts.eq_handle;
+ md.ct_handle = gupcr_gmem_puts.ct_handle;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_gmem_put_bb_md));
+}
+
+/**
+ * Release gmem resources.
+ * @ingroup INIT
+ */
+void
+gupcr_gmem_fini (void)
+{
+ gupcr_log (FC_MEM, "gmem fini called");
+ /* Release GET MD. */
+ gupcr_portals_call (PtlMDRelease, (gupcr_gmem_gets.md));
+ gupcr_portals_call (PtlCTFree, (gupcr_gmem_gets.ct_handle));
+ gupcr_portals_call (PtlEQFree, (gupcr_gmem_gets.eq_handle));
+ /* Release PUT MDs. */
+ gupcr_portals_call (PtlMDRelease, (gupcr_gmem_puts.md));
+ gupcr_portals_call (PtlMDRelease, (gupcr_gmem_put_bb_md));
+ gupcr_portals_call (PtlCTFree, (gupcr_gmem_puts.ct_handle));
+ gupcr_portals_call (PtlEQFree, (gupcr_gmem_puts.eq_handle));
+ /* Release LEs and PTEs. */
+ gupcr_portals_call (PtlLEUnlink, (gupcr_gmem_le));
+ gupcr_portals_call (PtlPTFree, (gupcr_ptl_ni, GUPCR_PTL_PTE_GMEM));
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_gmem.h b/libgupc/portals4/gupcr_gmem.h
new file mode 100644
index 00000000000..bd3e848c1ba
--- /dev/null
+++ b/libgupc/portals4/gupcr_gmem.h
@@ -0,0 +1,132 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_GMEM_H_
+#define _GUPCR_GMEM_H_
+
+/**
+ * @file gupcr_gmem.h
+ * GUPC Portals4 shared memory interface.
+ */
+
+/**
+ * @addtogroup GMEM GUPCR Shared Memory Access
+ * @{
+ */
+
+/* Configuration-defined limits. */
+/** Maximum size of the message that uses put bounce buffer. */
+#define GUPCR_GMEM_MAX_SAFE_PUT_SIZE 1*KILOBYTE
+
+/** Max size of the user program.
+ *
+ * To simplify management of memory descriptors the entire user
+ * program address space is mapped into one memory descriptor per
+ * direction of the transfer.
+ * Per linux kernel document: Documentation/x86/x86_64/mm.txt
+ * the maximum size is 0x8000_0000_0000
+ */
+#define USER_PROG_MEM_SIZE 0x00008000000000000
+/** Beginning of the user program */
+#define USER_PROG_MEM_START NULL
+
+//begin lib_inline_gmem
+/** Check if shared memory of the specified thread can be accessed
+ as node local reference. */
+#define GUPCR_GMEM_IS_LOCAL(thr) (gupcr_node_map[thr] != NULL)
+/** Convert pointer-to-shared address filed into local address. */
+#define GUPCR_GMEM_OFF_TO_LOCAL(thr,off) (gupcr_node_map[thr] + off)
+
+/** GMEM shared memory base */
+extern void *gupcr_gmem_base;
+//end lib_inline_gmem
+
+/** GMEM shared memory size */
+extern ptl_size_t gupcr_gmem_size;
+
+/** GMEM get/put information tracking.
+ *
+ * Track the information required to access global
+ * memory in a given direction (get/put) using non-blocking
+ * 'get' and 'put' functions.
+ */
+typedef struct gupcr_gmem_xfer_info_struct
+{
+ /** Number of pending operations */
+ ptl_size_t num_pending;
+ /** Number of completed operations */
+ ptl_size_t num_completed;
+ /** Memory descriptor options */
+ unsigned int md_options;
+ /** Memory descriptor event handle */
+ ptl_handle_eq_t eq_handle;
+ /** Memory descriptor counting events handle */
+ ptl_handle_ct_t ct_handle;
+ /** Memory descriptor handle */
+ ptl_handle_md_t md;
+ /** Volatile memory descriptor handle */
+ ptl_handle_md_t md_volatile;
+} gupcr_gmem_xfer_info_t;
+/** GET/PUT information tracking pointer type */
+typedef gupcr_gmem_xfer_info_t *gupcr_gmem_xfer_info_p;
+
+/** GET transfer tracking */
+extern gupcr_gmem_xfer_info_t gupcr_gmem_gets;
+/** PUT transfer tracking */
+extern gupcr_gmem_xfer_info_t gupcr_gmem_puts;
+
+/** PUT "bounce buffer" bytes in use */
+extern size_t gupcr_gmem_put_bb_used;
+
+//begin lib_gmem
+extern void gupcr_gmem_sync (void);
+//end lib_gmem
+
+//begin lib_inline_gmem
+
+/** If TRUE, a strict PUT operation is pending */
+extern int gupcr_pending_strict_put;
+
+extern void gupcr_gmem_sync_gets (void);
+extern void gupcr_gmem_sync_puts (void);
+extern void gupcr_gmem_get (void *dest, int rthread, size_t roffset,
+ size_t n);
+extern void gupcr_gmem_put (int rthread, size_t roffset, const void *src,
+ size_t n);
+extern void gupcr_gmem_copy (int dthread, size_t doffset, int sthread,
+ size_t soffset, size_t n);
+extern void gupcr_gmem_set (int dthread, size_t doffset, int c, size_t n);
+
+//end lib_inline_gmem
+
+extern size_t gupcr_gmem_heap_base_offset;
+extern size_t gupcr_gmem_heap_size;
+
+extern void gupcr_gmem_init (void);
+extern void gupcr_gmem_fini (void);
+
+/** @} */
+#endif /* gupcr_gmem.h */
diff --git a/libgupc/portals4/gupcr_lib.h b/libgupc/portals4/gupcr_lib.h
new file mode 100644
index 00000000000..09f6b42ea38
--- /dev/null
+++ b/libgupc/portals4/gupcr_lib.h
@@ -0,0 +1,72 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_lib.h
+ * GUPC Runtime definitions of user-visible UPC routines.
+ */
+
+#ifndef _GUPCR_LIB_H_
+#define _GUPCR_LIB_H_
+
+/* Definition of user-visible UPC library routines,
+ in a form that they can be called from the
+ "C"-based runtime. */
+
+extern size_t upc_threadof (upc_shared_ptr_t);
+extern size_t upc_phaseof (upc_shared_ptr_t);
+extern upc_shared_ptr_t upc_resetphase (upc_shared_ptr_t);
+extern size_t upc_addrfield (upc_shared_ptr_t);
+extern size_t upc_affinitysize (size_t, size_t, size_t);
+
+extern void upc_global_exit (int);
+
+extern void upc_memcpy (upc_shared_ptr_t dest, upc_shared_ptr_t src,
+ size_t n);
+extern void upc_memget (void *dest, upc_shared_ptr_t src, size_t n);
+extern void upc_memput (upc_shared_ptr_t dest, const void *src, size_t n);
+extern void upc_memset (upc_shared_ptr_t dest, int c, size_t n);
+
+extern upc_shared_ptr_t upc_global_alloc (size_t, size_t);
+extern upc_shared_ptr_t upc_all_alloc (size_t, size_t);
+extern upc_shared_ptr_t upc_alloc (size_t);
+extern void upc_free (upc_shared_ptr_t);
+extern void upc_all_free (upc_shared_ptr_t);
+
+extern upc_shared_ptr_t upc_lock_alloc (void);
+extern void upc_lock_free (upc_shared_ptr_t);
+extern void upc_all_lock_free (upc_shared_ptr_t);
+extern upc_shared_ptr_t upc_all_lock_alloc (void);
+extern upc_shared_ptr_t upc_global_lock_alloc (void);
+extern void upc_lock (upc_shared_ptr_t);
+extern int upc_lock_attempt (upc_shared_ptr_t);
+extern void upc_unlock (upc_shared_ptr_t);
+
+typedef uint64_t upc_tick_t;
+extern upc_tick_t upc_ticks_now (void);
+extern uint64_t upc_ticks_to_ns (upc_tick_t ticks);
+
+#endif /* gupcr_lib.h */
diff --git a/libgupc/portals4/gupcr_lock.h b/libgupc/portals4/gupcr_lock.h
new file mode 100644
index 00000000000..bc42f0c3b75
--- /dev/null
+++ b/libgupc/portals4/gupcr_lock.h
@@ -0,0 +1,40 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_LOCK_H_
+#define _GUPCR_LOCK_H_
+
+/**
+ * @file gupcr_lock.h
+ * GUPC Portals4 lock external definitions.
+ */
+
+/* Heap allocation locks. */
+extern upc_lock_t *gupcr_heap_region_lock;
+extern upc_lock_t *gupcr_global_heap_lock;
+extern upc_lock_t *gupcr_local_heap_lock;
+
+#endif /* gupcr_lock.h */
diff --git a/libgupc/portals4/gupcr_lock.upc b/libgupc/portals4/gupcr_lock.upc
new file mode 100644
index 00000000000..fc20fb5ef8c
--- /dev/null
+++ b/libgupc/portals4/gupcr_lock.upc
@@ -0,0 +1,539 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdio.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+#include "gupcr_lock_sup.h"
+#include "gupcr_lock.h"
+#include "gupcr_barrier.h"
+
+/**
+ * @file gupcr_lock.upc
+ * GUPC Portals4 UPC lock implementation.
+ *
+ * The GUPC lock functions use MCS locks as described in the
+ * Mellor-Crummey and Scott paper: Algorithms for Scalable Synchronization
+ * on Shared-Memory Multiprocessors, ACM Transaction on Computer Systems,
+ * February 1991.
+ *
+ * A lock is a simple data structure that lives in the shared memory space.
+ * A pointer is used to point to the last thread on the waiting list.
+ * A lock is available if this pointer is NULL. The following Portals
+ * atomic operations are used:
+ * - SWAP - determine if the lock is available
+ * - CSWAP - determine if the lock can be released
+ *
+ * The GUPC Portals implementation of UPC locks has the following
+ * characteristics:
+ * - The lock object has affinity to the thread that creates the lock.
+ * If the collective function, upc_all_lock_alloc, is called, then
+ * the lock object will have affinity to thread 0.
+ * - A thread's lock waiting queue link object has affinity to the
+ * waiting thread.
+ * - Portals atomic functions (SWAP and CSWAP) are used to
+ * guarantee fair access and FIFO ordering for all waiting threads.
+ * - A special Portals Table Entry (GUPCR_PTL_PTE_LOCK) is used to provide
+ * for signaling threads taken off the waiting list.
+ *
+ * @addtogroup LOCK GUPCR Lock Functions
+ * @{
+ */
+
+typedef struct gupcr_lock_link_struct gupcr_lock_link_t;
+typedef shared [] gupcr_lock_link_t *gupcr_lock_link_ref;
+
+/** upc_lock_t is an opaque shared type. The 'upc_lock_struct'
+ structure describes the internal representation of the
+ UPC lock type. */
+struct upc_lock_struct
+{
+ gupcr_lock_link_ref last; /* Must be first. */
+ gupcr_lock_link_ref owner_link;
+ upc_lock_t *free_link;
+};
+
+struct gupcr_lock_link_struct
+{
+ gupcr_lock_link_ref next; /* Must be first. */
+ int signal; /* Signal the lock ownership. */
+ int free; /* Lock has been freed. */
+};
+
+struct gupcr_lock_link_cache_struct
+{
+ gupcr_lock_link_t lock_links[GUPCR_MAX_LOCKS];
+};
+typedef struct gupcr_lock_link_cache_struct gupcr_lock_link_cache_t;
+typedef shared gupcr_lock_link_cache_t *gupcr_lock_link_cache_ref;
+
+/** Array of lock links managed as a per-thread free list. */
+static shared gupcr_lock_link_cache_t gupcr_lock_link_cache[THREADS];
+/** Per thread lock link free list. */
+static gupcr_lock_link_ref gupcr_lock_links;
+
+/** UPC lock free list. */
+static upc_lock_t *lock_free;
+
+/* Heap allocator locks. */
+/** Heap region allocation lock. */
+shared upc_lock_t gupcr_heap_region_lock_data;
+upc_lock_t *gupcr_heap_region_lock;
+/** Global heap lock. */
+shared upc_lock_t gupcr_global_heap_lock_data;
+upc_lock_t *gupcr_global_heap_lock;
+/** Local heap locks. */
+shared upc_lock_t gupcr_local_heap_lock_data[THREADS];
+upc_lock_t *gupcr_local_heap_lock;
+
+/**
+ * Initialize the heap allocator locks.
+ *
+ * All shared references must be local due to the fact
+ * this is called before Portals has been initialized.
+ */
+void
+gupcr_lock_heap_sup_init (void)
+{
+ if (!MYTHREAD)
+ {
+ upc_memset (&gupcr_heap_region_lock_data, '\0', sizeof (upc_lock_t));
+ upc_memset (&gupcr_global_heap_lock_data, '\0', sizeof (upc_lock_t));
+ }
+ gupcr_heap_region_lock = &gupcr_heap_region_lock_data;
+ gupcr_global_heap_lock = &gupcr_global_heap_lock_data;
+
+ upc_memset (&gupcr_local_heap_lock_data[MYTHREAD],
+ '\0', sizeof (upc_lock_t));
+ gupcr_local_heap_lock = &gupcr_local_heap_lock_data[MYTHREAD];
+}
+
+/**
+ * Initialize the local lock free list.
+ */
+void
+gupcr_lock_free_init (void)
+{
+ lock_free = NULL;
+}
+
+/**
+ * Initialize the local lock link free list.
+ *
+ * gupcr_lock_link_init() is called before the UPC runtime
+ * is fully initialized. Care is taken to make no UPC shared
+ * memory accesses.
+ */
+void
+gupcr_lock_link_init (void)
+{
+ gupcr_lock_link_ref link;
+ gupcr_lock_link_t *local_link;
+ gupcr_lock_links = gupcr_lock_link_cache[MYTHREAD].lock_links;
+ link = gupcr_lock_links;
+ local_link = (gupcr_lock_link_t *) link;
+ memset (local_link, '\0', sizeof (gupcr_lock_link_cache_t));
+ for (int i = 0; i < (GUPCR_MAX_LOCKS - 1); ++i)
+ (local_link++)->next = ++link;
+}
+
+/**
+ * Release the lock link record.
+ */
+static inline void
+gupcr_lock_link_free (gupcr_lock_link_ref link)
+{
+ link->next = gupcr_lock_links;
+ gupcr_lock_links = link;
+}
+
+/**
+ * Allocate a lock link record.
+ *
+ * A lock link is a data structure used to link together
+ * all threads waiting on a particular lock.
+ * Lock links are located in the shared space of the thread
+ * acquiring the lock.
+ *
+ * Lock links are kept in a locally managed list
+ * (used as a cache) rooted at 'gupcr_lock_links'.
+ * This locally managed free list avoids the need
+ * to call upc_alloc().
+ */
+static inline gupcr_lock_link_ref
+gupcr_lock_link_alloc (void)
+{
+ gupcr_lock_link_ref link;
+ link = gupcr_lock_links;
+ if (!link)
+ {
+ /* Try to find a link block that has been freed by
+ other threads and thus not returned to the free list. */
+ gupcr_lock_link_ref mlink = (gupcr_lock_link_ref)
+ &gupcr_lock_link_cache[MYTHREAD].lock_links;
+ for (int i = 0; i < (GUPCR_MAX_LOCKS - 1); ++i)
+ {
+ if (mlink->free)
+ {
+ mlink->free = 0;
+ gupcr_lock_link_free (mlink);
+ }
+ mlink++;
+ }
+ link = gupcr_lock_links;
+ if (!link)
+ gupcr_fatal_error ("cannot allocate a UPC lock link. "
+ "The number of allocated per thread lock links "
+ "exceeds the configuration defined "
+ "maximum of %d entries.",
+ GUPCR_MAX_LOCKS);
+ }
+ gupcr_lock_links = link->next;
+ return link;
+}
+
+/**
+ * Allocate a lock and return a pointer to it.
+ *
+ * The 'upc_global_lock_alloc' function dynamically allocates a lock and
+ * returns a pointer to it. The lock is created in an unlocked state.
+ * The 'upc_global_lock_alloc' function is not a collective function.
+ * If called by multiple threads, each thread will receive a pointer
+ * to a unique lock.
+ *
+ * @retval Pointer to a newly allocated lock
+ */
+upc_lock_t *
+upc_global_lock_alloc (void)
+{
+ upc_lock_t *lock;
+ gupcr_trace (FC_LOCK, "LOCK GLOBAL_ALLOC ENTER");
+ /* Check if there is a lock cached on the free list. */
+ if (lock_free)
+ {
+ lock = lock_free;
+ lock_free = lock->free_link;
+ }
+ else
+ {
+ /* Allocate space for the lock from shared memory with
+ affinity to the calling thread. */
+ lock = upc_alloc (sizeof (upc_lock_t));
+ if (lock == NULL)
+ gupcr_fatal_error ("cannot allocate memory for the lock");
+ }
+ lock->last = NULL;
+ lock->owner_link = NULL;
+ gupcr_trace (FC_LOCK, "LOCK GLOBAL_ALLOC EXIT %lu:0x%lx",
+ (long unsigned) upc_threadof (lock),
+ (long unsigned) upc_addrfield (lock));
+ return lock;
+}
+
+void
+upc_all_lock_free (upc_lock_t *ptr)
+{
+ upc_all_free (ptr);
+}
+
+/**
+ * Free all lock resources.
+ *
+ * The 'upc_lock_free' function frees all resources associated with the
+ * dynamically allocated 'upc_lock_t' pointed to by 'lock'. If 'lock' is a
+ * null pointer, no action occurs. Otherwise, if the argument does not
+ * match a pointer earlier returned by the 'upc_global_lock_alloc' or
+ * 'upc_all_lock_alloc' function, or if the lock has been de-allocated by
+ * a previous call to 'upc_lock_free' the behavior is undefined.
+ *
+ * @param [in] lock Pointer to a lock
+ */
+void
+upc_lock_free (upc_lock_t *lock)
+{
+ gupcr_lock_link_ref link;
+
+ gupcr_trace (FC_LOCK, "LOCK FREE ENTER %lu:0x%lx",
+ (long unsigned) upc_threadof (lock),
+ (long unsigned) upc_addrfield (lock));
+ if (lock == NULL)
+ return;
+
+ link = lock->owner_link;
+ /* Release the link block if this thread owns the lock. */
+ if (link)
+ {
+ if (MYTHREAD == (int) upc_threadof (link))
+ {
+ gupcr_lock_link_free (link);
+ }
+ else
+ link->free = 1;
+ }
+ if (MYTHREAD == (int) upc_threadof (lock))
+ {
+ /* Release it on the local free list. */
+ lock->free_link = lock_free;
+ lock_free = lock;
+ }
+ else
+ upc_free (lock);
+
+ gupcr_trace (FC_LOCK, "LOCK FREE EXIT");
+}
+
+/**
+ * Allocate a lock and return a pointer to it on all threads.
+ *
+ * The 'upc_all_lock_alloc' function dynamically allocates a lock
+ * and returns a pointer to it. The lock is created in an unlocked state.
+ * 'upc_all_lock_alloc' is a collective function.
+ * The return value on every thread points to the same lock object.
+ *
+ * @retval Pointer to a newly allocated lock
+ */
+upc_lock_t *
+upc_all_lock_alloc (void)
+{
+ upc_lock_t *lock;
+ gupcr_trace (FC_LOCK, "LOCK ALL_ALLOC ENTER");
+ /* Allocate space for the lock from the shared memory of
+ thread 0 and broadcast its address. */
+ if (MYTHREAD == 0)
+ {
+ if (lock_free)
+ {
+ lock = lock_free;
+ lock_free = lock->free_link;
+ }
+ else
+ {
+ lock = upc_alloc (sizeof (upc_lock_t));
+ if (lock == NULL)
+ gupcr_fatal_error ("cannot allocate memory for the lock");
+ }
+ lock->last = NULL;
+ lock->owner_link = NULL;
+ gupcr_bcast_send (&lock, sizeof (lock));
+ }
+ else
+ gupcr_bcast_recv (&lock, sizeof (lock));
+ gupcr_trace (FC_LOCK, "LOCK ALL_ALLOC EXIT %lu:0x%lx",
+ (long unsigned) upc_threadof (lock),
+ (long unsigned) upc_addrfield (lock));
+ return lock;
+}
+
+/**
+ * Set the state of the lock to locked.
+ *
+ * If the lock is already in a 'locked' state due to the calling thread
+ * setting it to the 'locked' state, the result is undefined.
+ * If the lock is already in a 'locked' state, then the calling thread
+ * waits for some other thread to set the state to 'unlocked'.
+ * Once the lock is in the state 'unlocked', a single calling thread
+ * sets the state to 'locked' and the function returns.
+ * A null strict access is implied after a call to 'upc_lock'.
+ *
+ * @param [in] lock Pointer to a lock
+ */
+void
+upc_lock (upc_lock_t *lock)
+{
+ gupcr_lock_link_ref link, old_link;
+ shared [] gupcr_lock_link_ref *lock_last_addr;
+ size_t lock_last_thread, lock_last_offset;
+ gupcr_trace (FC_LOCK, "LOCK LOCK ENTER %lu:0x%lx",
+ (long unsigned) upc_threadof (lock),
+ (long unsigned) upc_addrfield (lock));
+ if (lock == NULL)
+ gupcr_fatal_error ("NULL lock pointer");
+ /* Allocate space for the lock waiting queue link.
+ It will have affinity to the calling thread. */
+ link = gupcr_lock_link_alloc ();
+ if (link == NULL)
+ gupcr_fatal_error ("cannot allocate memory for the lock link");
+ link->next = NULL;
+ link->signal = 0;
+ /* Atomically set the lock value to point to the
+ calling thread's link queue object and
+ return the previous value of the lock link. */
+ lock_last_addr = &lock->last;
+ lock_last_thread = upc_threadof (lock_last_addr);
+ lock_last_offset = upc_addrfield (lock_last_addr);
+ gupcr_lock_swap (lock_last_thread, lock_last_offset,
+ &link, &old_link, sizeof (link));
+ if (old_link != NULL)
+ {
+ shared [] gupcr_lock_link_ref *old_link_next_addr;
+ size_t old_link_next_thread, old_link_next_offset;
+ /* We have to wait. Clear the ownership signal field
+ and insert our pointer into the predecessor's link. */
+ link->signal = 0;
+ upc_fence;
+ old_link_next_addr = &old_link->next;
+ old_link_next_thread = upc_threadof (old_link_next_addr);
+ old_link_next_offset = upc_addrfield (old_link_next_addr);
+ gupcr_lock_put (old_link_next_thread, old_link_next_offset,
+ &link, sizeof (link));
+ /* At this point the thread has to wait until the lock is
+ is released. Process counting events one by one until
+ the value of the signal word changes. */
+ do
+ {
+ gupcr_lock_wait ();
+ upc_fence;
+ }
+ while (!link->signal);
+ }
+ lock->owner_link = link;
+ gupcr_trace (FC_LOCK, "LOCK LOCK EXIT");
+ upc_fence;
+}
+
+/**
+ * Attempt to set the state of the lock to locked.
+ *
+ * The 'upc_lock_attempt' function attempts to set the state of the lock
+ * pointed to by 'lock' to 'locked'. If the lock is already in the 'locked'
+ * state due to the calling thread setting it to the 'locked' state, the
+ * result is undefined. If the lock is already in the 'locked' state, the
+ * function returns 0. If the lock is in the state 'unlocked',
+ * a single calling thread sets the state to 'locked' and the function
+ * returns 1. A null strict access is implied after a call to
+ * 'upc_lock_attempt' that returns 1.
+ *
+ * @param [in] lock Pointer to a lock
+ * @retval Lock attempt result
+ * - 1, lock was acquired successfully
+ * - 0, lock was not acquired
+ */
+int
+upc_lock_attempt (upc_lock_t *lock)
+{
+ gupcr_lock_link_ref link;
+ gupcr_lock_link_ref null_link = NULL;
+ shared [] gupcr_lock_link_ref *lock_last_addr;
+ size_t lock_last_thread, lock_last_offset;
+ int compare_ok;
+ gupcr_trace (FC_LOCK, "LOCK ATTEMPT ENTER %lu:0x%lx",
+ (long unsigned) upc_threadof (lock),
+ (long unsigned) upc_addrfield (lock));
+ if (lock == NULL)
+ gupcr_fatal_error ("NULL lock pointer");
+ /* Allocate space for the lock waiting queue with affinity
+ to the calling thread. */
+ link = gupcr_lock_link_alloc ();
+ if (link == NULL)
+ gupcr_fatal_error ("cannot allocate memory for the lock link");
+ link->next = NULL;
+ link->signal = 0;
+ /* Atomically set the lock value to the link entry and
+ return the previous value of the lock ONLY if the value
+ of the lock is already NULL. */
+ lock_last_addr = &lock->last;
+ lock_last_thread = upc_threadof (lock_last_addr);
+ lock_last_offset = upc_addrfield (lock_last_addr);
+ compare_ok = gupcr_lock_cswap (lock_last_thread, lock_last_offset,
+ &null_link, &link, sizeof (link));
+ if (compare_ok)
+ {
+ lock->owner_link = link;
+ upc_fence;
+ gupcr_trace (FC_LOCK, "LOCK ATTEMPT EXIT 1");
+ }
+ else
+ {
+ gupcr_lock_link_free (link);
+ gupcr_trace (FC_LOCK, "LOCK ATTEMPT EXIT 0");
+ }
+ return compare_ok;
+}
+
+/**
+ * Set the state of the lock to unlocked.
+ *
+ * The 'upc_unlock' function sets the state of the lock pointed
+ * to by 'lock' to 'unlocked'. Unless the lock is in 'locked' state
+ * and the calling thread is the locking thread, the result is undefined.
+ * A null strict access is implied before a call to 'upc_unlock'.
+ *
+ * @param [in] lock Pointer to a lock
+ */
+void
+upc_unlock (upc_lock_t *lock)
+{
+ gupcr_lock_link_ref link = lock->owner_link;
+ gupcr_lock_link_ref null_link = NULL;
+ shared [] gupcr_lock_link_ref *lock_last_addr = &lock->last;
+ size_t lock_last_thread = upc_threadof (lock_last_addr);
+ size_t lock_last_offset = upc_addrfield (lock_last_addr);
+ int compare_ok;
+ gupcr_trace (FC_LOCK, "LOCK UNLOCK ENTER %lu:0x%lx",
+ (long unsigned) upc_threadof (lock),
+ (long unsigned) upc_addrfield (lock));
+ if (lock == NULL)
+ gupcr_fatal_error ("NULL lock pointer");
+ upc_fence;
+ /* Try to release the lock: write NULL into lock->last
+ if it contains a pointer to our own link block. If it fails then
+ some other thread is on the waiting list. */
+ lock->owner_link = NULL;
+ compare_ok = gupcr_lock_cswap (lock_last_thread, lock_last_offset,
+ &link, &null_link, sizeof (link));
+ if (!compare_ok)
+ {
+ shared void *link_next_signal_addr;
+ size_t signal_addr_thread, signal_addr_offset;
+ int signal = 1;
+ /* Pass ownership to the next waiting thread. Wait until
+ the link->next pointer is being set. Use Portals call to
+ avoid possibility of data tearing on pointer to shared. */
+ for (;;)
+ {
+ size_t addr_offset;
+ gupcr_lock_link_ref val;
+ addr_offset = upc_addrfield (&link->next);
+ gupcr_lock_get (MYTHREAD, addr_offset, &val, sizeof (val));
+ if (val) break;
+ gupcr_lock_wait ();
+ }
+ /* Signal the waiting thread that it now owns the lock. */
+ link_next_signal_addr = &link->next->signal;
+ signal_addr_thread = upc_threadof (link_next_signal_addr);
+ signal_addr_offset = upc_addrfield (link_next_signal_addr);
+ gupcr_lock_put (signal_addr_thread, signal_addr_offset,
+ &signal, sizeof (signal));
+ }
+ gupcr_lock_link_free (link);
+ gupcr_trace (FC_LOCK, "LOCK UNLOCK EXIT");
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_lock_sup.c b/libgupc/portals4/gupcr_lock_sup.c
new file mode 100644
index 00000000000..3cb850234a3
--- /dev/null
+++ b/libgupc/portals4/gupcr_lock_sup.c
@@ -0,0 +1,315 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_lib.h"
+#include "gupcr_lock_sup.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_lock_sup.h"
+
+/**
+ * @file gupcr_lock_sup.c
+ * GUPC Portals4 locks implementation support routines.
+ *
+ * @addtogroup LOCK GUPCR Lock Functions
+ * @{
+ */
+
+/** Lock shared access LE handle */
+static ptl_handle_le_t gupcr_lock_le;
+/** Lock shared access LE counting events handle */
+static ptl_handle_ct_t gupcr_lock_le_ct;
+/** Lock shared access LE counting events counter */
+static ptl_size_t gupcr_lock_le_count;
+/** Lock shared access LE events queue handle */
+static ptl_handle_eq_t gupcr_lock_le_eq;
+
+/** Lock buffer for CSWAP operation */
+static char gupcr_lock_buf[16];
+/** Lock shared access MD handle */
+static ptl_handle_md_t gupcr_lock_md;
+/** Lock shared access MD counting events handle */
+static ptl_handle_ct_t gupcr_lock_md_ct;
+/** Lock shared access MD counting events counter */
+static ptl_size_t gupcr_lock_md_count;
+/** Lock shared access MD event queue handle */
+static ptl_handle_eq_t gupcr_lock_md_eq;
+
+/**
+ * Execute lock-related atomic fetch and store remote operation.
+ *
+ * Value "val" is written into the specified remote location and the
+ * old value is returned.
+ *
+ * A Portals 'swap atomic' operation is used when the acquiring thread must
+ * atomically determine if the lock is available. A pointer to the thread's
+ * local lock waiting list link is atomically written into the lock's 'last'
+ * field, and the current value of the 'last' field is returned. If NULL,
+ * the acquiring thread is the new owner, otherwise it must insert itself
+ * onto the waiting list.
+ */
+void
+gupcr_lock_swap (size_t dest_thread,
+ size_t dest_offset, void *val, void *old, size_t size)
+{
+ ptl_process_t rpid;
+ ptl_ct_event_t ct;
+ gupcr_debug (FC_LOCK, "%lu:0x%lx",
+ (long unsigned) dest_thread,
+ (long unsigned) dest_offset);
+ rpid.rank = dest_thread;
+ gupcr_portals_call (PtlSwap, (gupcr_lock_md, (ptl_size_t) old,
+ gupcr_lock_md, (ptl_size_t) val, size, rpid,
+ GUPCR_PTL_PTE_GMEM, PTL_NO_MATCH_BITS,
+ dest_offset, PTL_NULL_USER_PTR, 0, NULL,
+ PTL_SWAP, gupcr_get_atomic_datatype (size)));
+ gupcr_lock_md_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_lock_md_ct, gupcr_lock_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_lock_md_eq);
+ gupcr_fatal_error ("received an error on lock MD");
+ }
+}
+
+/**
+ * Execute a lock-related atomic compare and swap operation.
+ *
+ * The value pointed to by 'val' is written into the remote location
+ * given by ('dest_thread', 'dest_addr) only if value in the destination
+ * is identical to 'cmp'.
+ *
+ * A Portals compare and swap atomic operation is used during the lock
+ * release phase when the owner of the lock must atomically determine if
+ * there are threads waiting on the lock. This is accomplished by using
+ * the Portals CSWAP atomic operation, where a NULL pointer is written
+ * into the lock's 'last' field only if this field contains the pointer
+ * to the owner's local lock link structure.
+ *
+ * @retval Return TRUE if the operation was successful.
+ */
+int
+gupcr_lock_cswap (size_t dest_thread,
+ size_t dest_offset, void *cmp, void *val, size_t size)
+{
+ ptl_process_t rpid;
+ ptl_ct_event_t ct;
+ gupcr_debug (FC_LOCK, "%lu:0x%lx",
+ (long unsigned) dest_thread,
+ (long unsigned) dest_offset);
+ rpid.rank = dest_thread;
+ gupcr_portals_call (PtlSwap, (gupcr_lock_md, (ptl_size_t) gupcr_lock_buf,
+ gupcr_lock_md, (ptl_size_t) val, size, rpid,
+ GUPCR_PTL_PTE_GMEM, PTL_NO_MATCH_BITS,
+ dest_offset, PTL_NULL_USER_PTR, 0, cmp,
+ PTL_CSWAP, gupcr_get_atomic_datatype (size)));
+ gupcr_lock_md_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_lock_md_ct, gupcr_lock_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_lock_md_eq);
+ gupcr_fatal_error ("received an error on lock MD");
+ }
+ return !memcmp (cmp, gupcr_lock_buf, size);
+}
+
+/*
+ * Execute a Portals put operation on the lock-related PTE.
+ *
+ * Execute a put operation on the PTE that is reserved for
+ * lock-related operations (PTL_PTE_UPC_LOCK). This separate PTE is used
+ * to make it possible to count only Portals put operations on the
+ * 'signal' or 'next' words of a UPC lock wait list entry.
+ *
+ * gupcr_lock_put() is used to 'signal' the remote thread that:
+ * - ownership of the lock is passed to a remote thread if the remote
+ * thread is the next thread on the waiting list
+ * - a pointer to the calling thread's local control block has
+ * been appended to the lock's waiting list
+ */
+void
+gupcr_lock_put (size_t dest_thread, size_t dest_addr, void *val, size_t size)
+{
+ ptl_process_t rpid;
+ ptl_ct_event_t ct;
+ gupcr_debug (FC_LOCK, "%lu:0x%lx",
+ (long unsigned) dest_thread,
+ (long unsigned) dest_addr);
+ rpid.rank = dest_thread;
+ gupcr_portals_call (PtlPut, (gupcr_lock_md, (ptl_size_t) val,
+ size, PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_LOCK, PTL_NO_MATCH_BITS,
+ (ptl_size_t) dest_addr,
+ PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA));
+ gupcr_lock_md_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_lock_md_ct, gupcr_lock_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_lock_md_eq);
+ gupcr_fatal_error ("received an error on lock MD");
+ }
+}
+
+/*
+ * Execute a Portals get operation on the lock-related PTE.
+ *
+ * All operations on lock/link data structures must be performed
+ * through the Portals interface to prevent data tearing.
+ */
+void
+gupcr_lock_get (size_t dest_thread, size_t dest_addr, void *val, size_t size)
+{
+ ptl_process_t rpid;
+ ptl_ct_event_t ct;
+ gupcr_debug (FC_LOCK, "%lu:0x%lx",
+ (long unsigned) dest_thread,
+ (long unsigned) dest_addr);
+ rpid.rank = dest_thread;
+ gupcr_portals_call (PtlGet, (gupcr_lock_md, (ptl_size_t) val,
+ size, rpid,
+ GUPCR_PTL_PTE_LOCK, PTL_NO_MATCH_BITS,
+ (ptl_size_t) dest_addr,
+ PTL_NULL_USER_PTR));
+ gupcr_lock_md_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_lock_md_ct, gupcr_lock_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_lock_md_eq);
+ gupcr_fatal_error ("received an error on lock MD");
+ }
+}
+
+/**
+ * Wait for the next counting event to be posted to lock LE.
+ *
+ * This function is called when it has been determined that
+ * the current thread needs to wait until the lock is is released.
+ *
+ * Wait until the next Portals counting event is posted
+ * to the LE reserved for this purpose and then return.
+ * The caller will check whether the lock was in fact released,
+ * and if not, will call this function again to wait for the
+ * next lock-related event to come in.
+ */
+void
+gupcr_lock_wait (void)
+{
+ ptl_ct_event_t ct;
+ gupcr_debug (FC_LOCK, "");
+ gupcr_lock_le_count += 1;
+ gupcr_portals_call (PtlCTWait,
+ (gupcr_lock_le_ct, gupcr_lock_le_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_lock_le_eq);
+ gupcr_fatal_error ("received an error on lock LE");
+ }
+}
+
+/**
+ * Initialize lock resources.
+ * @ingroup INIT
+ */
+void
+gupcr_lock_init (void)
+{
+ ptl_md_t md;
+ ptl_pt_index_t pte;
+ ptl_le_t le;
+ gupcr_log (FC_LOCK, "lock init called");
+ /* Allocate Portals PTE for locks. */
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_lock_le_eq));
+ gupcr_portals_call (PtlPTAlloc, (gupcr_ptl_ni, 0,
+ gupcr_lock_le_eq, GUPCR_PTL_PTE_LOCK,
+ &pte));
+ if (pte != GUPCR_PTL_PTE_LOCK)
+ gupcr_fatal_error ("cannot allocate PTE GUPCR_PTL_PTE_LOCK.");
+ gupcr_debug (FC_LOCK, "Lock PTE allocated: %d", GUPCR_PTL_PTE_LOCK);
+ /* Allocate LE for locks. */
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_lock_le_ct));
+ gupcr_lock_le_count = 0;
+ le.start = gupcr_gmem_base;
+ le.length = gupcr_gmem_size;
+ le.ct_handle = gupcr_lock_le_ct;
+ le.uid = PTL_UID_ANY;
+ le.options = PTL_LE_OP_PUT | PTL_LE_OP_GET | PTL_LE_EVENT_CT_COMM |
+ PTL_LE_EVENT_SUCCESS_DISABLE | PTL_LE_EVENT_LINK_DISABLE;
+ gupcr_portals_call (PtlLEAppend, (gupcr_ptl_ni, GUPCR_PTL_PTE_LOCK, &le,
+ PTL_PRIORITY_LIST, NULL, &gupcr_lock_le));
+ gupcr_debug (FC_LOCK, "Lock LE created at 0x%lx with size 0x%lx)",
+ (long unsigned) gupcr_gmem_base,
+ (long unsigned) gupcr_gmem_size);
+ /* Setup MD for writes into lock data structures located on
+ other threads. Map the entire user address space,
+ though the MD probably could be constrained to the area where
+ lock data structures are managed. */
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_lock_md_ct));
+ gupcr_lock_md_count = 0;
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_lock_md_eq));
+ md.length = (ptl_size_t) USER_PROG_MEM_SIZE;
+ md.start = (void *) USER_PROG_MEM_START;
+ md.options =
+ PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_CT_REPLY |
+ PTL_MD_EVENT_SUCCESS_DISABLE;
+ md.eq_handle = gupcr_lock_md_eq;
+ md.ct_handle = gupcr_lock_md_ct;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_lock_md));
+ /* Initialize the lock link allocator. */
+ gupcr_lock_link_init ();
+ /* Initialize the lock free list. */
+ gupcr_lock_free_init ();
+ /* Initialize the heap allocator locks. */
+ gupcr_lock_heap_sup_init ();
+}
+
+/**
+ * Release lock resources.
+ * @ingroup INIT
+ */
+void
+gupcr_lock_fini (void)
+{
+ gupcr_log (FC_LOCK, "lock fini called");
+ /* Release lock MD. */
+ gupcr_portals_call (PtlMDRelease, (gupcr_lock_md));
+ gupcr_portals_call (PtlCTFree, (gupcr_lock_md_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_lock_md_eq));
+ /* Release lock LE and PTE. */
+ gupcr_portals_call (PtlLEUnlink, (gupcr_lock_le));
+ gupcr_portals_call (PtlCTFree, (gupcr_lock_le_ct));
+ gupcr_portals_call (PtlEQFree, (gupcr_lock_le_eq));
+ gupcr_portals_call (PtlPTFree, (gupcr_ptl_ni, GUPCR_PTL_PTE_LOCK));
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_lock_sup.h b/libgupc/portals4/gupcr_lock_sup.h
new file mode 100644
index 00000000000..44d65524f6c
--- /dev/null
+++ b/libgupc/portals4/gupcr_lock_sup.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_LOCK_SUP_H_
+#define _GUPCR_LOCK_SUP_H_
+
+/**
+ * @file gupcr_lock_sup.h
+ * GUPC Portals4 lock implementation support routines.
+ */
+
+extern void gupcr_lock_init (void);
+extern void gupcr_lock_fini (void);
+extern int gupcr_lock_cswap (size_t, size_t, void *, void *, size_t);
+extern void gupcr_lock_swap (size_t, size_t, void *, void *, size_t);
+extern void gupcr_lock_put (size_t, size_t, void *, size_t);
+extern void gupcr_lock_get (size_t, size_t, void *, size_t);
+extern void gupcr_lock_wait (void);
+
+/* See: gupcr_alloc.upc. */
+extern void gupcr_lock_link_init (void);
+extern void gupcr_lock_free_init (void);
+extern void gupcr_lock_heap_sup_init (void);
+
+#endif /* gupcr_lock_sup.h */
diff --git a/libgupc/portals4/gupcr_main.c b/libgupc/portals4/gupcr_main.c
new file mode 100644
index 00000000000..8fa25a034a4
--- /dev/null
+++ b/libgupc/portals4/gupcr_main.c
@@ -0,0 +1,298 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_main.c
+ * GUPC Portals4 runtime main program.
+ */
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_lock_sup.h"
+#include "gupcr_alloc.h"
+#include "gupcr_broadcast.h"
+#include "gupcr_barrier.h"
+#include "gupcr_shutdown.h"
+#include "gupcr_utils.h"
+#include "gupcr_portals.h"
+#include "gupcr_runtime.h"
+#include "gupcr_gmem.h"
+#include "gupcr_node.h"
+#include "gupcr_coll_sup.h"
+#include "gupcr_atomic_sup.h"
+#include "gupcr_nb_sup.h"
+#include "gupcr_backtrace.h"
+
+/** User's main program */
+extern int GUPCR_MAIN (int argc, char *argv[]);
+
+/** The number of THREADS, as specified on the command line */
+int THREADS = -1;
+
+/** The current thread number (range: 0..THREADS-1) */
+int MYTHREAD = -1;
+
+/** OK to call finalize routines */
+int gupcr_finalize_ok = 0;
+
+/** Depth count used to implement the semantics of
+ nested upc_forall statements. */
+int __upc_forall_depth;
+
+/** The filename of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+const char *gupcr_err_filename;
+
+/** The line number of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+unsigned int gupcr_err_linenum;
+
+/**
+ * @addtogroup INIT GUPCR Initialization
+ * @{
+ */
+
+/**
+ * Initialize UPC runtime.
+ *
+ * All hardware/software components of the Portals4 interface
+ * are initialized in this routine.
+ */
+static void
+gupcr_init (void)
+{
+ int run_threads_count;
+ upc_shared_ptr_t heap_region_base;
+ size_t heap_region_size;
+
+ /* Initialize Runtime. */
+ if (gupcr_runtime_init ())
+ {
+ /* Report an error to stderr as the GUPC error reporting
+ is not initialized yet. Note: all threads report
+ this error. */
+ fprintf (stderr, "Unable to initialize runtime.\n");
+ abort ();
+ }
+
+ /* Get the thread number. */
+ MYTHREAD = gupcr_runtime_get_rank ();
+
+ /* Set up debugging, tracing, statistics, and timing support. */
+ gupcr_utils_init ();
+
+ /* Initialize Portals. */
+ gupcr_portals_init ();
+
+ /* Validate program info. */
+ gupcr_validate_pgm_info ();
+
+ run_threads_count = gupcr_get_threads_count ();
+
+ /* THREADS == -1, dynamic number of threads
+ THREADS != -1, static number of threads and
+ number of running and compiled threads must match. */
+ if (THREADS == -1)
+ THREADS = run_threads_count;
+ else if (THREADS != run_threads_count)
+ gupcr_abort_with_msg ("number of running threads (%d) is "
+ "not equal to compiled threads (%d)",
+ run_threads_count, THREADS);
+ gupcr_assert (THREADS >= 1);
+
+#if HAVE_UPC_BACKTRACE
+ /* Initialize backtrace support. */
+ gupcr_backtrace_init (gupcr_get_pgm_name () );
+#endif
+
+ /* Initialize the Portals Network Interface. */
+ gupcr_portals_ni_init ();
+
+ /* Initialize this thread's multi-node tree position. */
+ gupcr_nodetree_setup ();
+
+ /* Initialize various runtime components. */
+ gupcr_node_init ();
+ gupcr_gmem_init ();
+ gupcr_lock_init ();
+ gupcr_barrier_init ();
+ gupcr_broadcast_init ();
+ gupcr_coll_init ();
+ gupcr_atomic_init ();
+ gupcr_nb_init ();
+ gupcr_shutdown_init ();
+
+ GUPCR_PTS_SET_NULL_SHARED (heap_region_base);
+ GUPCR_PTS_SET_THREAD (heap_region_base, MYTHREAD);
+ GUPCR_PTS_SET_VADDR (heap_region_base, gupcr_gmem_heap_base_offset);
+ heap_region_size = gupcr_gmem_heap_size;
+ gupcr_alloc_init (heap_region_base, heap_region_size);
+
+ /* Indicate that runtime initialization is complete. */
+ gupcr_init_complete ();
+
+ /* It is ok to call the finalization routines. */
+ gupcr_finalize_ok = 1;
+}
+
+/**
+ * UPC runtime finalization.
+ *
+ * All previously allocated Portals4 resources are released.
+ */
+void
+gupcr_fini (void)
+{
+ gupcr_shutdown_fini ();
+ gupcr_nb_fini ();
+ gupcr_atomic_fini ();
+ gupcr_broadcast_fini ();
+ gupcr_barrier_fini ();
+ gupcr_lock_fini ();
+ gupcr_gmem_fini ();
+ gupcr_node_fini ();
+ gupcr_coll_fini ();
+ gupcr_portals_ni_fini ();
+ gupcr_portals_fini ();
+ gupcr_runtime_fini ();
+ gupcr_utils_fini ();
+}
+
+/**
+ * Per thread initialization.
+ *
+ * The following pre-requisites must be met, before calling this routine:
+ * - the runtime system has been initialized.
+ * - the UPC heap manager has been initialized.
+ *
+ * The barrier that is executed subsequent to calling this
+ * per thread initialization procedure and prior to
+ * calling the main program ensures that the initialization
+ * completes before the main program runs.
+ */
+
+static void
+gupcr_per_thread_init (void)
+{
+ typedef void (*func_ptr_t) (void);
+ extern func_ptr_t GUPCR_INIT_ARRAY_START[];
+ extern func_ptr_t GUPCR_INIT_ARRAY_END[];
+ const int n_init = (int) (GUPCR_INIT_ARRAY_END - GUPCR_INIT_ARRAY_START);
+ int i;
+ for (i = 0; i < n_init; ++i)
+ {
+ func_ptr_t init_func = GUPCR_INIT_ARRAY_START[i];
+ /* Skip zero words, possibly introduced by a section marker,
+ or by the linker. */
+ if (init_func)
+ (*init_func) ();
+ }
+}
+
+/** @} */
+
+/**
+ * UPC program exit.
+ *
+ * Calls to exit() are rewritten into calls to __upc_exit()
+ * by a "#define" in <gcc-upc.h>. Simply perform a upc_barrier and
+ * then exit the process.
+ * @param [in] status Status code of exit
+ * @ingroup GUPC-API GUPC Program Interface
+ */
+void
+__upc_exit (int status)
+{
+ /* Mask off the top bit; it is used to indicate a global exit. */
+ const int exit_status = status & 0x7f;
+ __upc_barrier (GUPCR_RUNTIME_BARRIER_ID);
+ exit (exit_status);
+}
+
+/**
+ * Exit program with given status and terminate all other threads.
+ *
+ * A special "shutdown" PTE is used to send a signal to
+ * other threads that they should exit.
+ * @param [in] status Status code for return
+ * @ingroup UPC-LIBRARY UPC Library Interface
+ */
+void
+upc_global_exit (int status)
+{
+ /* Send exit signal to all other threads. */
+ gupcr_signal_exit (status);
+ /* It is NOT ok to call the finalization routines as there might
+ be outstanding Portals transactions. */
+ gupcr_finalize_ok = 0;
+ exit (status);
+}
+
+/**
+ * GUPC runtime start up.
+ *
+ * @param [in] argc Number of command line arguments
+ * @param [in] argv Command line arguments
+ * @retval Return (exit) value from the user's main program
+ * @ingroup INIT GUPCR Initialization
+ */
+/** @}*/
+int
+GUPCR_START (int argc, char *argv[])
+{
+ int status;
+
+ /* Install exit handler. */
+ atexit (gupcr_exit);
+
+ /* Set program name for debug/trace diagnostics. */
+ gupcr_set_pgm_name (argv[0]);
+
+ /* Initialize all runtime components. */
+ gupcr_init ();
+
+ /* Initialize language specific variables. */
+ __upc_forall_depth = 0;
+
+ /* Wait for all threads to finish initialization. */
+ gupcr_startup_barrier ();
+
+ /* Perform per thread initialization. */
+ gupcr_per_thread_init ();
+
+ /* Wait for all threads to complete per thread initialization. */
+ __upc_barrier (GUPCR_RUNTIME_BARRIER_ID);
+
+ /* Call user main program. */
+ status = GUPCR_MAIN (argc, argv);
+
+ /* Wait for all threads to complete. */
+ __upc_barrier (GUPCR_RUNTIME_BARRIER_ID);
+
+ return status;
+}
diff --git a/libgupc/portals4/gupcr_mem.c b/libgupc/portals4/gupcr_mem.c
new file mode 100644
index 00000000000..3c46799788e
--- /dev/null
+++ b/libgupc/portals4/gupcr_mem.c
@@ -0,0 +1,211 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_access.h"
+#include "gupcr_portals.h"
+#include "gupcr_node.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+
+/**
+ * @file gupcr_mem.c
+ * GUPC Shared string handling functions.
+ */
+
+/**
+ * @addtogroup UPCSTR UPC Shared string handling functions
+ * @{
+ */
+
+/**
+ * Copy shared memory block.
+ *
+ * The upc_memcpy function copies n characters from a shared object having
+ * affinity with one thread to a shared object having affinity with the same or
+ * another thread.
+ *
+ * @param [in] dest Pointer-to-shared of the destination
+ * @param [in] src Pointer-to-shared of the source
+ * @param [in] n Number of bytes to transfer
+ */
+void
+upc_memcpy (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t n)
+{
+ int sthread = GUPCR_PTS_THREAD (src);
+ size_t soffset = GUPCR_PTS_OFFSET (src);
+ int dthread = GUPCR_PTS_THREAD (dest);
+ size_t doffset = GUPCR_PTS_OFFSET (dest);
+ int dthread_local, sthread_local;
+ gupcr_trace (FC_MEM, "MEM MEMCPY ENTER %d:0x%lx %d:0x%lx %lu",
+ sthread, (long unsigned) soffset,
+ dthread, (long unsigned) doffset, (long unsigned) n);
+ gupcr_assert (dthread < THREADS);
+ gupcr_assert (doffset != 0);
+ gupcr_assert (sthread < THREADS);
+ gupcr_assert (soffset != 0);
+ dthread_local = GUPCR_GMEM_IS_LOCAL (dthread);
+ sthread_local = GUPCR_GMEM_IS_LOCAL (sthread);
+ if (dthread_local && sthread_local)
+ memcpy (GUPCR_GMEM_OFF_TO_LOCAL (dthread, doffset),
+ GUPCR_GMEM_OFF_TO_LOCAL (sthread, soffset), n);
+ else if (dthread_local)
+ {
+ if (gupcr_pending_strict_put)
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_get (GUPCR_GMEM_OFF_TO_LOCAL (dthread, doffset),
+ sthread, soffset, n);
+ gupcr_gmem_sync_gets ();
+ }
+ else if (sthread_local)
+ {
+ if (n > (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (dthread, doffset,
+ GUPCR_GMEM_OFF_TO_LOCAL (sthread, soffset), n);
+ gupcr_pending_strict_put = 1;
+ }
+ else
+ gupcr_gmem_put (dthread, doffset,
+ GUPCR_GMEM_OFF_TO_LOCAL (sthread, soffset), n);
+ }
+ else
+ {
+ if (n > (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_copy (dthread, doffset, sthread, soffset, n);
+ gupcr_pending_strict_put = 1;
+ }
+ else
+ gupcr_gmem_copy (dthread, doffset, sthread, soffset, n);
+ }
+ gupcr_trace (FC_MEM, "MEM MEMCPY EXIT");
+}
+
+/**
+ * Get shared memory block.
+ *
+ * The upc_memget function copies n characters from a shared object with
+ * affinity to any single thread to an object on the calling thread.
+ *
+ * @param [in] dest Local destination address
+ * @param [in] src Pointer-to-shared of the source
+ * @param [in] n Number of bytes to transfer
+ */
+void
+upc_memget (void *dest, upc_shared_ptr_t src, size_t n)
+{
+ int sthread = GUPCR_PTS_THREAD (src);
+ size_t soffset = GUPCR_PTS_OFFSET (src);
+ gupcr_trace (FC_MEM, "MEM MEMGET ENTER %d:0x%lx 0x%lx %lu",
+ sthread, (long unsigned) soffset,
+ (long unsigned) dest, (long unsigned) n);
+ gupcr_assert (sthread < THREADS);
+ gupcr_assert (soffset != 0);
+ if (GUPCR_GMEM_IS_LOCAL (sthread))
+ memcpy (dest, GUPCR_GMEM_OFF_TO_LOCAL (sthread, soffset), n);
+ else
+ gupcr_gmem_get (dest, sthread, soffset, n);
+ gupcr_gmem_sync_gets ();
+ gupcr_trace (FC_MEM, "MEM MEMGET EXIT");
+}
+
+/**
+ * Put shared memory block.
+ *
+ * The upc_memput function copies n characters from an object on the calling
+ * thread to a shared object with affinity to any single thread.
+ *
+ * @param [in] dest Pointer-to-shared of the destination
+ * @param [in] src Local source address
+ * @param [in] n Number of bytes to transfer
+ */
+void
+upc_memput (upc_shared_ptr_t dest, const void *src, size_t n)
+{
+ int dthread = GUPCR_PTS_THREAD (dest);
+ size_t doffset = GUPCR_PTS_OFFSET (dest);
+ gupcr_trace (FC_MEM, "MEM MEMPUT ENTER 0x%lx %d:0x%lx %lu",
+ (long unsigned) src, dthread, (long unsigned) doffset,
+ (long unsigned) n);
+ gupcr_assert (dthread < THREADS);
+ gupcr_assert (doffset != 0);
+ if (GUPCR_GMEM_IS_LOCAL (dthread))
+ memcpy (GUPCR_GMEM_OFF_TO_LOCAL (dthread, doffset), src, n);
+ else
+ {
+ if (n > (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_put (dthread, doffset, src, n);
+ gupcr_pending_strict_put = 1;
+ }
+ else
+ gupcr_gmem_put (dthread, doffset, src, n);
+ }
+ gupcr_trace (FC_MEM, "MEM MEMPUT EXIT");
+}
+
+/**
+ * Set shared memory block.
+ *
+ * The upc_memset function copies the value of c, converted to an unsigned
+ * char, to a shared object with affinity to any single thread.
+ *
+ * @param [in] dest Pointer-to-shared of the destination
+ * @param [in] c Value to set the remote memory
+ * @param [in] n Number of bytes to set
+ */
+void
+upc_memset (upc_shared_ptr_t dest, int c, size_t n)
+{
+ int dthread = GUPCR_PTS_THREAD (dest);
+ size_t doffset = GUPCR_PTS_OFFSET (dest);
+ gupcr_trace (FC_MEM, "MEM MEMSET ENTER 0x%x %d:0x%lx %lu",
+ c, dthread, (long unsigned) doffset, (long unsigned) n);
+ gupcr_assert (dthread < THREADS);
+ gupcr_assert (doffset != 0);
+ if (GUPCR_GMEM_IS_LOCAL (dthread))
+ memset (GUPCR_GMEM_OFF_TO_LOCAL (dthread, doffset), c, n);
+ else
+ {
+ if (n > (size_t) GUPCR_PORTALS_MAX_ORDERED_SIZE)
+ {
+ gupcr_gmem_sync_puts ();
+ gupcr_gmem_set (dthread, doffset, c, n);
+ gupcr_pending_strict_put = 1;
+ }
+ else
+ gupcr_gmem_set (dthread, doffset, c, n);
+ }
+ gupcr_trace (FC_MEM, "MEM MEMSET EXIT");
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_nb.upc b/libgupc/portals4/gupcr_nb.upc
new file mode 100644
index 00000000000..6e23d17e680
--- /dev/null
+++ b/libgupc/portals4/gupcr_nb.upc
@@ -0,0 +1,320 @@
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_nb.upc
+ * GUPC Portals4 Non-Blocking Transfers Operations.
+ *
+ * @addtogroup UPC-NON-BLOCKING UPC Non-Blocking Transfer Operations
+ * @{
+ */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <upc_nb.h>
+#include <portals4.h>
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_portals.h"
+#include "gupcr_nb_sup.h"
+
+/**
+ * Copy memory with non-blocking explicit handle transfer
+ *
+ * @param[in] dst Destination shared memory pointer
+ * @param[in] src Source shared memory pointer
+ * @param[in] n Number of bytes to transfer
+ * @retval UPC non-blocking transfer handle
+ */
+upc_handle_t
+upc_memcpy_nb (shared void *restrict dst,
+ shared const void *restrict src, size_t n)
+{
+ size_t sthread, soffset;
+ size_t dthread, doffset;
+ upc_handle_t handle;
+ gupcr_trace (FC_NB, "NB MEMCOPY_NB ENTER");
+ sthread = upc_threadof ((shared void *) src);
+ dthread = upc_threadof ((shared void *) dst);
+ if ((int) sthread == MYTHREAD)
+ {
+ doffset = upc_addrfield (dst);
+ gupcr_nb_put (dthread, doffset, (char *) src, n, &handle);
+ }
+ else if ((int) dthread == MYTHREAD)
+ {
+ soffset = upc_addrfield ((shared void *) src);
+ gupcr_nb_get (sthread, soffset, (char *) dst, n, &handle);
+ }
+ else
+ {
+ /* Third party copying. Just use upc_memcpy(). */
+ upc_memcpy (dst, src, n);
+ handle = UPC_COMPLETE_HANDLE;
+ }
+ gupcr_trace (FC_NB, "NB MEMCOPY_NB EXIT");
+ return handle;
+}
+
+/**
+ * Get memory with non-blocking explicit handle transfer
+ *
+ * @param[in] dst Destination local memory pointer
+ * @param[in] src Source remote memory pointer
+ * @param[in] n Number of bytes to transfer
+ * @retval UPC non-blocking transfer handle
+ */
+upc_handle_t
+upc_memget_nb (void *restrict dst,
+ shared const void *restrict src, size_t n)
+{
+ gupcr_trace (FC_NB, "NB MEMGET_NB ENTER");
+ upc_handle_t handle = UPC_COMPLETE_HANDLE;
+ if (n)
+ {
+ size_t sthread, soffset;
+ sthread = upc_threadof ((shared void *) src);
+ soffset = upc_addrfield ((shared void *) src);
+ gupcr_nb_get (sthread, soffset, dst, n, &handle);
+ }
+ gupcr_trace (FC_NB, "NB MEMGET_NB EXIT");
+ return handle;
+}
+
+/**
+ * Put memory with non-blocking explicit handle transfer
+ *
+ * @param[in] dst Destination remote memory pointer
+ * @param[in] src Source local memory pointer
+ * @param[in] n Number of bytes to transfer
+ * @retval UPC non-blocking transfer handle
+ */
+upc_handle_t
+upc_memput_nb (shared void *restrict dst,
+ const void *restrict src, size_t n)
+{
+ gupcr_trace (FC_NB, "NB MEMPUT_NB ENTER");
+ upc_handle_t handle = UPC_COMPLETE_HANDLE;
+ if (n)
+ {
+ size_t dthread, doffset;
+ dthread = upc_threadof ((shared void *) dst);
+ doffset = upc_addrfield ((shared void *) dst);
+ gupcr_nb_put (dthread, doffset, src, n, &handle);
+ }
+ gupcr_trace (FC_NB, "NB MEMPUT_NB EXIT");
+ return handle;
+}
+
+/**
+ * Set memory with non-blocking implicit handle transfer
+ *
+ * @param[in] dst Shared remote pointer
+ * @param[in] c Value for set operation
+ * @param[in] n Number of bytes to set
+ * @retval UPC non-blocking transfer handle
+ *
+ * This call completes the transfer before returning.
+ */
+upc_handle_t
+upc_memset_nb (shared void *dst, int c, size_t n)
+{
+ gupcr_trace (FC_NB, "NB MEMSET_NB ENTER");
+ if (n)
+ {
+ upc_memset (dst, c, n);
+ upc_fence;
+ }
+ gupcr_trace (FC_NB, "NB MEMSET_NB EXIT");
+ return UPC_COMPLETE_HANDLE;
+}
+
+/**
+ * Explicit handle non-blocking transfer sync attempt
+ *
+ * @param[in] handle Transfer explicit handle
+ * @retval UPC_NB_COMPLETED returned if transfer completed,
+ * otherwise UPC_NB_NOT_COMPLETED
+ */
+int
+upc_sync_attempt (upc_handle_t handle)
+{
+ int comp;
+ gupcr_trace (FC_NB, "NB SYNC_ATTEMPT ENTER");
+ if (handle == UPC_COMPLETE_HANDLE
+ || gupcr_nb_completed (handle))
+ comp = UPC_NB_COMPLETED;
+ else
+ comp = UPC_NB_NOT_COMPLETED;
+ gupcr_trace (FC_NB, "NB SYNC_ATTEMPT EXIT");
+ return comp;
+}
+
+/**
+ * Explicit handle non-blocking transfer sync
+ *
+ * @param[in] handle Non-blocking transfer explicit handle
+ */
+void
+upc_sync (upc_handle_t handle)
+{
+ gupcr_trace (FC_NB, "NB SYNC ENTER");
+ if (handle != UPC_COMPLETE_HANDLE)
+ gupcr_sync (handle);
+ gupcr_trace (FC_NB, "NB SYNC EXIT");
+}
+
+/**
+ * Copy memory with non-blocking implicit handle transfer
+ *
+ * @param[in] dst Shared remote memory pointer
+ * @param[in] src Shared remote memory pointer
+ * @param[in] n Number of bytes to transfer
+ */
+void
+upc_memcpy_nbi (shared void *restrict dst,
+ shared const void *restrict src, size_t n)
+{
+ size_t sthread, soffset;
+ size_t dthread, doffset;
+ gupcr_trace (FC_NB, "NB MEMCOPY_NBI ENTER");
+ sthread = upc_threadof ((shared void *) src);
+ dthread = upc_threadof ((shared void *) dst);
+ if ((int) sthread == MYTHREAD)
+ {
+ doffset = upc_addrfield (dst);
+ gupcr_nb_put (dthread, doffset, (char *) src, n, NULL);
+ }
+ else if ((int) dthread == MYTHREAD)
+ {
+ soffset = upc_addrfield ((shared void *) src);
+ gupcr_nb_get (sthread, soffset, (char *) dst, n, NULL);
+ }
+ else
+ {
+ /* Third party copying. Just use upc_memcpy(). */
+ upc_memcpy (dst, src, n);
+ }
+ gupcr_trace (FC_NB, "NB MEMCOPY_NBI EXIT");
+}
+
+/**
+ * Get memory with non-blocking implicit handle transfer
+ *
+ * @param[in] dst Local memory pointer
+ * @param[in] src Shared remote memory pointer
+ * @param[in] n Number of bytes to transfer
+ */
+void
+upc_memget_nbi (void *restrict dst,
+ shared const void *restrict src, size_t n)
+{
+ gupcr_trace (FC_NB, "NB MEMGET_NBI ENTER");
+ if (n)
+ {
+ size_t sthread, soffset;
+ sthread = upc_threadof ((shared void *) src);
+ soffset = upc_addrfield ((shared void *) src);
+ gupcr_nb_get (sthread, soffset, dst, n, NULL);
+ }
+ gupcr_trace (FC_NB, "NB MEMGET_NBI EXIT");
+}
+
+/**
+ * Put memory with non-blocking implicit handle transfer
+ *
+ * @param[in] dst Shared remote memory pointer
+ * @param[in] src Local memory pointer
+ * @param[in] n Number of bytes to transfer
+ */
+void
+upc_memput_nbi (shared void *restrict dst,
+ const void *restrict src, size_t n)
+{
+ gupcr_trace (FC_NB, "NB MEMPUT_NBI ENTER");
+ if (n)
+ {
+ size_t dthread, doffset;
+ dthread = upc_threadof ((shared void *) dst);
+ doffset = upc_addrfield ((shared void *) dst);
+ gupcr_nb_put (dthread, doffset, src, n, NULL);
+ }
+ gupcr_trace (FC_NB, "NB MEMPUT_NBI EXIT");
+}
+
+/**
+ * Set memory with non-blocking implicit handle transfer
+ *
+ * @param[in] dst Shared remote pointer
+ * @param[in] c Value for set operation
+ * @param[in] n Number of bytes to set
+ */
+void
+upc_memset_nbi (shared void *dst, int c, size_t n)
+{
+ gupcr_trace (FC_NB, "NB MEMSET_NBI ENTER");
+ if (n)
+ {
+ upc_memset (dst, c, n);
+ upc_fence;
+ }
+ gupcr_trace (FC_NB, "NB MEMSET_NBI EXIT");
+}
+
+/**
+ * Check on implicit handle non-blocking transfers
+ *
+ * @retval UPC_NB_COMPLETED if no transfers pending, otherwise
+ * UPC_NB_NOT_COMPLETED is returned
+ */
+int
+upc_synci_attempt (void)
+{
+ int result;
+ gupcr_trace (FC_NB, "NB SYNCI ATTEMPT ENTER");
+ if (gupcr_nbi_outstanding ())
+ result = UPC_NB_NOT_COMPLETED;
+ else
+ result = UPC_NB_COMPLETED;
+ gupcr_trace (FC_NB, "NB SYNCI ATTEMPT EXIT");
+ return result;
+}
+
+/**
+ * Complete implicit handle non-blocking transfers
+ */
+void
+upc_synci (void)
+{
+ gupcr_trace (FC_NB, "NB SYNCI ENTER");
+ gupcr_synci ();
+ gupcr_trace (FC_NB, "NB SYNCI EXIT");
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_nb_sup.c b/libgupc/portals4/gupcr_nb_sup.c
new file mode 100644
index 00000000000..2ad904c82c4
--- /dev/null
+++ b/libgupc/portals4/gupcr_nb_sup.c
@@ -0,0 +1,597 @@
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "malloc.h"
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_lib.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_nb_sup.h"
+
+/**
+ * @file gupcr_nb_sup.c
+ * GUPC Portals4 non-blocking transfers support routines.
+ *
+ * @addtogroup NON-BLOCKING GUPCR Non-Blocking Transfer Support Functions
+ * @{
+ */
+
+/** Non-blocking shared access LE handle */
+static ptl_handle_le_t gupcr_nb_le;
+/** Explicit non-blocking MD handle */
+static ptl_handle_md_t gupcr_nb_md;
+/** Explicit non-blocking MD event queue handle */
+static ptl_handle_eq_t gupcr_nb_md_eq;
+/** Start of the explicit non-blocking MD */
+static char *gupcr_nb_md_start;
+
+/** Implicit non-blocking MD handle */
+static ptl_handle_md_t gupcr_nbi_md;
+/** Implicit non-blocking MD EQ handle */
+static ptl_handle_eq_t gupcr_nbi_md_eq;
+/** Implicit non-blocking MD CT handle */
+static ptl_handle_ct_t gupcr_nbi_md_ct;
+/** Implicit non-blocking number of received ACKs on local md */
+static ptl_size_t gupcr_nbi_md_count;
+/** Start of the implicit non-blocking MD */
+static char *gupcr_nbi_md_start;
+
+/* All non-blocking transfers with explicit handle
+ are managed through the 'gupcr_nbcb' structure
+ (control block). Free control blocks are on
+ the free list, while those with active transfers
+ are on the 'active' list. A single linked list
+ is used to link CBs on the free or active list.
+
+ Non-blocking transfer handle is an unsigned long
+ number that we increment every time a new transfer is
+ requested. */
+
+/** Non-blocking transfers control block */
+struct gupcr_nbcb
+{
+ struct gupcr_nbcb *next; /** forward link on the free or used list */
+ unsigned long id; /** UPC handle for non-blocking transfer */
+ int status; /** non-blocking transfer status */
+};
+typedef struct gupcr_nbcb gupcr_nbcb_t;
+typedef struct gupcr_nbcb *gupcr_nbcb_p;
+
+/** nb transfer status value */
+#define NB_STATUS_COMPLETED 1
+#define NB_STATUS_NOT_COMPLETED 0
+
+/** NB handle values */
+unsigned long gupcr_nb_handle_next;
+
+/** NB cb free list */
+gupcr_nbcb_p gupcr_nbcb_cb_free = NULL;
+/** List of NB active transfers */
+gupcr_nbcb_p gupcr_nbcb_active = NULL;
+
+/** Number of outstanding transfers with explicit handle */
+int gupcr_nb_outstanding;
+void gupcr_nb_check_outstanding (void);
+
+/**
+ * Allocate free NB control block
+ */
+static gupcr_nbcb_p
+gupcr_nbcb_alloc (void)
+{
+ gupcr_nbcb_p cb;
+ if (gupcr_nbcb_cb_free)
+ {
+ cb = gupcr_nbcb_cb_free;
+ gupcr_nbcb_cb_free = cb->next;
+ }
+ else
+ {
+ /* Allocate memory for the new block. */
+ cb = calloc (sizeof (struct gupcr_nbcb), 1);
+ if (cb == NULL)
+ gupcr_fatal_error ("cannot allocate local memory");
+ }
+ return cb;
+}
+
+/**
+ * Place NB control block on the free list
+ */
+static void
+gupcr_nbcb_free (gupcr_nbcb_p cb)
+{
+ cb->next = gupcr_nbcb_cb_free;
+ gupcr_nbcb_cb_free = cb;
+}
+
+/**
+ * Place NB control block on the active list
+ */
+static void
+gupcr_nbcb_active_insert (gupcr_nbcb_p cb)
+{
+ cb->next = gupcr_nbcb_active;
+ gupcr_nbcb_active = cb;
+}
+
+/**
+ * Remove NB control block from the active list
+ */
+static void
+gupcr_nbcb_active_remove (gupcr_nbcb_p cb)
+{
+ gupcr_nbcb_p acb = gupcr_nbcb_active;
+ gupcr_nbcb_p prev_acb = acb;
+ while (acb)
+ {
+ if (acb == cb)
+ {
+ if (acb == gupcr_nbcb_active)
+ gupcr_nbcb_active = acb->next;
+ else
+ prev_acb->next = acb->next;
+ return;
+ }
+ prev_acb = acb;
+ acb = acb->next;
+ }
+}
+
+/**
+ * Find NB control block on the active list
+ */
+static gupcr_nbcb_p
+gupcr_nbcb_find (unsigned long id)
+{
+ gupcr_nbcb_p cb = gupcr_nbcb_active;
+ while (cb)
+ {
+ if (cb->id == id)
+ return cb;
+ cb = cb->next;
+ }
+ return NULL;
+}
+
+/**
+ * Non-blocking GET operation
+ *
+ * @param[in] sthread Source thread
+ * @param[in] soffset Source offset
+ * @param[in] dst_ptr Destination local pointer
+ * @param[in] size Number of bytes to transfer
+ * @param[in] handle Transfer handle (NULL for implicit)
+ */
+void
+gupcr_nb_get (size_t sthread, size_t soffset, char *dst_ptr,
+ size_t size, unsigned long *handle)
+{
+ ptl_process_t rpid;
+ size_t n_rem = size;
+ ptl_size_t local_offset = dst_ptr - gupcr_nbi_md_start;
+
+ if (handle)
+ {
+ gupcr_nbcb_p cb = gupcr_nbcb_alloc ();
+ cb->id = gupcr_nb_handle_next++;
+ cb->status = NB_STATUS_NOT_COMPLETED;
+ gupcr_nbcb_active_insert (cb);
+ *handle = cb->id;
+ gupcr_nb_check_outstanding ();
+ }
+ gupcr_debug (FC_NB, "%s %lu:0x%lx(%ld) -> 0x%lx (%lu)",
+ handle ? "NB" : "NBI", sthread, soffset,
+ size, (long unsigned int) dst_ptr, handle ? *handle : 0);
+
+ /* Large transfers must be done in chunks. Only the last chunk
+ behaves as a non-blocking transfer. */
+ while (n_rem > 0)
+ {
+ size_t n_xfer;
+ n_xfer = GUPCR_MIN (n_rem, GUPCR_PORTALS_MAX_MSG_SIZE);
+ rpid.rank = sthread;
+ gupcr_portals_call (PtlGet, (handle ? gupcr_nb_md : gupcr_nbi_md,
+ local_offset,
+ n_xfer, rpid, GUPCR_PTL_PTE_NB,
+ PTL_NO_MATCH_BITS, soffset,
+ handle ? (void *) *handle : NULL));
+ if (handle)
+ gupcr_nb_outstanding += 1;
+ else
+ gupcr_nbi_md_count += 1;
+ n_rem -= n_xfer;
+ local_offset += n_xfer;
+ if (n_rem)
+ {
+ /* Unfortunately, there are more data to transfer, we have to
+ wait for all non-blocking transfers to complete. */
+ if (handle)
+ gupcr_sync (*handle);
+ else
+ gupcr_synci ();
+ }
+ }
+}
+
+/**
+ * Non-blocking transfer PUT operation
+ *
+ * @param[in] dthread Destination thread
+ * @param[in] doffset Destination offset
+ * @param[in] src_ptr Source local pointer
+ * @param[in] size Number of bytes to transfer
+ * @param[in] handle Transfer handle (NULL for implicit)
+ */
+void
+gupcr_nb_put (size_t dthread, size_t doffset, const void *src_ptr,
+ size_t size, unsigned long *handle)
+{
+ ptl_process_t rpid;
+ size_t n_rem = size;
+ ptl_size_t local_offset = (char *) src_ptr - gupcr_nbi_md_start;
+
+ if (handle)
+ {
+ gupcr_nbcb_p cb = gupcr_nbcb_alloc ();
+ cb->id = gupcr_nb_handle_next++;
+ cb->status = NB_STATUS_NOT_COMPLETED;
+ gupcr_nbcb_active_insert (cb);
+ *handle = cb->id;
+ gupcr_nb_check_outstanding ();
+ }
+
+ gupcr_debug (FC_NB, "%s 0x%lx(%ld) -> %lu:0x%lx (%lu)",
+ handle ? "NB" : "NBI", (long unsigned int) src_ptr, size,
+ dthread, doffset, handle ? *handle : 0);
+
+ /* Large transfers must be done in chunks. Only the last chunk
+ behaves as a non-blocking transfer. */
+ while (n_rem > 0)
+ {
+ size_t n_xfer;
+ n_xfer = GUPCR_MIN (n_rem, GUPCR_PORTALS_MAX_MSG_SIZE);
+ rpid.rank = dthread;
+ gupcr_portals_call (PtlPut, (handle ? gupcr_nb_md : gupcr_nbi_md,
+ local_offset, n_xfer, PTL_ACK_REQ, rpid,
+ GUPCR_PTL_PTE_NB, PTL_NO_MATCH_BITS,
+ doffset, handle ? (void *) *handle : NULL,
+ PTL_NULL_HDR_DATA));
+ if (handle)
+ gupcr_nb_outstanding += 1;
+ else
+ gupcr_nbi_md_count += 1;
+ n_rem -= n_xfer;
+ local_offset += n_xfer;
+ if (n_rem)
+ {
+ /* Unfortunately, there are more data to transfer, we have to
+ wait for all non-blocking transfers to complete. */
+ if (handle)
+ gupcr_sync (*handle);
+ else
+ gupcr_synci ();
+ }
+ }
+}
+
+/**
+ * Check for the max number of outstanding non-blocking
+ * transfers with explicit handle
+ *
+ * We cannot allow for number of outstanding transfers
+ * to go over the event queue size. Otherwise, some ACK/REPLY
+ * can be dropped.
+ */
+void
+gupcr_nb_check_outstanding (void)
+{
+ if (gupcr_nb_outstanding == GUPCR_NB_MAX_OUTSTANDING)
+ {
+ /* We have to wait for at least one to complete. */
+ ptl_event_t event;
+ gupcr_portals_call (PtlEQWait, (gupcr_nb_md_eq, &event));
+
+ /* Process only ACKs and REPLYs, */
+ if (event.type == PTL_EVENT_ACK || event.type == PTL_EVENT_REPLY)
+ {
+ gupcr_nbcb_p cb;
+ unsigned long id = (unsigned long) event.user_ptr;
+ gupcr_debug (FC_NB, "received event for handle %lu", id);
+ cb = gupcr_nbcb_find (id);
+ if (!cb || cb->status == NB_STATUS_COMPLETED)
+ {
+ gupcr_fatal_error
+ ("received event for non-existent or "
+ "already completed NB handle");
+ }
+ cb->status = NB_STATUS_COMPLETED;
+ gupcr_nb_outstanding--;
+ }
+ else
+ {
+ gupcr_fatal_error ("received event of invalid type: %s",
+ gupcr_streqtype (event.type));
+ }
+ }
+}
+
+/**
+ * Check for non-blocking transfer complete
+ *
+ * @param[in] handle Transfer handle
+ * @retval "1" if transfer completed
+ */
+int
+gupcr_nb_completed (unsigned long handle)
+{
+ ptl_event_t event;
+ int done = 0;
+ gupcr_nbcb_p cb;
+
+ /* Handle Portals completion events. */
+ while (!done)
+ {
+ int pstatus;
+ gupcr_portals_call_with_status (PtlEQGet, pstatus,
+ (gupcr_nb_md_eq, &event));
+ if (pstatus == PTL_OK)
+ {
+ /* There is something to process. */
+ if (event.type == PTL_EVENT_ACK || event.type == PTL_EVENT_REPLY)
+ {
+ unsigned long id = (unsigned long) event.user_ptr;
+ gupcr_debug (FC_NB, "received event for handle %lu", id);
+ cb = gupcr_nbcb_find (id);
+ if (!cb)
+ gupcr_fatal_error ("received event for invalid NB handle");
+ cb->status = NB_STATUS_COMPLETED;
+ gupcr_nb_outstanding--;
+ }
+ else
+ {
+ gupcr_fatal_error ("received event of invalid type: %s",
+ gupcr_streqtype (event.type));
+ }
+ }
+ else
+ done = 1;
+ }
+
+ /* Check if transfer is completed. */
+ cb = gupcr_nbcb_find (handle);
+ if (cb && cb->status == NB_STATUS_COMPLETED)
+ {
+ gupcr_nbcb_active_remove (cb);
+ gupcr_nbcb_free (cb);
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+ * Complete non-blocking transfers with explicit handle
+ *
+ * Wait for outstanding request to complete.
+ *
+ * @param[in] handle Transfer handle
+ */
+void
+gupcr_sync (unsigned long handle)
+{
+ gupcr_nbcb_p cb;
+
+ gupcr_debug (FC_NB, "waiting for handle %lu", handle);
+ /* Check if transfer already completed. */
+ cb = gupcr_nbcb_find (handle);
+ if (!cb)
+ {
+ /* Handle does not exist. Assume it is a duplicate
+ sync request. */
+ return;
+ }
+ if (cb->status == NB_STATUS_COMPLETED)
+ {
+ /* Already completed. */
+ gupcr_nbcb_active_remove (cb);
+ gupcr_nbcb_free (cb);
+ }
+ else
+ {
+ int done = 0;
+ /* Must wait for portals to complete the transfer. */
+ while (!done)
+ {
+ ptl_event_t event;
+ int pstatus;
+ gupcr_portals_call_with_status (PtlEQGet, pstatus,
+ (gupcr_nb_md_eq, &event));
+ if (pstatus == PTL_OK)
+ {
+ /* Process only ACKs and REPLYs, */
+ gupcr_debug (FC_NB, "received event of type %s",
+ gupcr_streqtype (event.type));
+ if (event.type == PTL_EVENT_ACK
+ || event.type == PTL_EVENT_REPLY)
+ {
+ unsigned long id = (unsigned long) event.user_ptr;
+ gupcr_debug (FC_NB, "received event for handle %lu", id);
+ cb = gupcr_nbcb_find (id);
+ if (!cb || cb->status == NB_STATUS_COMPLETED)
+ {
+ gupcr_fatal_error
+ ("received event for non-existent or already "
+ "completed NB handle");
+ }
+ cb->status = NB_STATUS_COMPLETED;
+ gupcr_nb_outstanding--;
+ if (id == handle)
+ {
+ gupcr_nbcb_active_remove (cb);
+ gupcr_nbcb_free (cb);
+ done = 1;
+ }
+ }
+ else
+ {
+ gupcr_fatal_error ("received event of invalid type: %s",
+ gupcr_streqtype (event.type));
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Check for any outstanding implicit handle non-blocking transfer
+ *
+ * @retval Number of outstanding transfers
+ */
+int
+gupcr_nbi_outstanding (void)
+{
+ ptl_ct_event_t ct;
+
+ /* Check the number of completed transfers. */
+ gupcr_portals_call (PtlCTGet, (gupcr_nbi_md_ct, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_nbi_md_eq);
+ gupcr_fatal_error ("received an error on NBI MD");
+ }
+ return (int) (gupcr_nbi_md_count - ct.success);
+}
+
+/**
+ * Complete non-blocking transfers with implicit handle
+ *
+ * Wait for all outstanding requests to complete.
+ */
+void
+gupcr_synci (void)
+{
+ ptl_ct_event_t ct;
+ gupcr_portals_call (PtlCTWait, (gupcr_nbi_md_ct, gupcr_nbi_md_count, &ct));
+ if (ct.failure)
+ {
+ gupcr_process_fail_events (gupcr_nbi_md_eq);
+ gupcr_fatal_error ("received an error on NBI MD");
+ }
+}
+
+/**
+ * Initialize non-blocking transfer resources
+ * @ingroup INIT
+ */
+void
+gupcr_nb_init (void)
+{
+ ptl_md_t md;
+ ptl_pt_index_t pte;
+ ptl_le_t le;
+
+ gupcr_log (FC_NB, "non-blocking transfer init called");
+
+ /* Non-blocking transfers use their own PTE. */
+ gupcr_portals_call (PtlPTAlloc, (gupcr_ptl_ni, 0,
+ PTL_EQ_NONE, GUPCR_PTL_PTE_NB, &pte));
+ if (pte != GUPCR_PTL_PTE_NB)
+ gupcr_fatal_error ("cannot allocate PTE GUPCR_PTL_PTE_NB.");
+ gupcr_debug (FC_NB, "Non-blocking PTE allocated: %d", GUPCR_PTL_PTE_NB);
+ /* Allocate LE for non-blocking transfers. */
+ le.start = gupcr_gmem_base;
+ le.length = gupcr_gmem_size;
+ le.ct_handle = PTL_CT_NONE;
+ le.uid = PTL_UID_ANY;
+ le.options = PTL_LE_OP_PUT | PTL_LE_OP_GET;
+ gupcr_portals_call (PtlLEAppend,
+ (gupcr_ptl_ni, GUPCR_PTL_PTE_NB, &le,
+ PTL_PRIORITY_LIST, NULL, &gupcr_nb_le));
+ gupcr_debug (FC_NB,
+ "Non-blocking LE created at 0x%lx with size 0x%lx)",
+ (long unsigned) gupcr_gmem_base,
+ (long unsigned) gupcr_gmem_size);
+
+ /* Setup the Portals MD for local source/destination copying.
+ We need to map the whole user's space (same as gmem). */
+ /* Non-blocking transfers with explicit handles must use full events
+ there is no need for counting events. */
+ gupcr_portals_call (PtlEQAlloc,
+ (gupcr_ptl_ni, GUPCR_NB_MAX_OUTSTANDING,
+ &gupcr_nb_md_eq));
+ md.length = (ptl_size_t) USER_PROG_MEM_SIZE;
+ md.start = (void *) USER_PROG_MEM_START;
+ md.options = PTL_MD_EVENT_SEND_DISABLE;
+ md.eq_handle = gupcr_nb_md_eq;
+ md.ct_handle = PTL_CT_NONE;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_nb_md));
+ gupcr_nb_md_start = md.start;
+ /* Non-blocking transfers with implicit handles use counting events. */
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_nbi_md_eq));
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_nbi_md_ct));
+ md.length = (ptl_size_t) USER_PROG_MEM_SIZE;
+ md.start = (void *) USER_PROG_MEM_START;
+ md.options = PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_CT_REPLY |
+ PTL_MD_EVENT_SUCCESS_DISABLE;
+ md.eq_handle = gupcr_nbi_md_eq;
+ md.ct_handle = gupcr_nbi_md_ct;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_nbi_md));
+ gupcr_nbi_md_start = md.start;
+
+ /* Reset number of acknowledgments. */
+ gupcr_nbi_md_count = 0;
+
+ /* Initialize NB handle values. */
+ gupcr_nb_handle_next = 1;
+ /* Initialize number of outstanding transfers. */
+ gupcr_nb_outstanding = 0;
+}
+
+/**
+ * Release non-blocking transfer resources
+ * @ingroup INIT
+ */
+void
+gupcr_nb_fini (void)
+{
+ gupcr_log (FC_NB, "non-blocking transfer fini called");
+ /* Release explicit handle NB MD and its resources. */
+ gupcr_portals_call (PtlMDRelease, (gupcr_nb_md));
+ gupcr_portals_call (PtlEQFree, (gupcr_nb_md_eq));
+ /* Release implicit handle NB MD and its resources. */
+ gupcr_portals_call (PtlMDRelease, (gupcr_nbi_md));
+ gupcr_portals_call (PtlEQFree, (gupcr_nbi_md_eq));
+ gupcr_portals_call (PtlCTFree, (gupcr_nbi_md_ct));
+ /* Release LE and PTE. */
+ gupcr_portals_call (PtlLEUnlink, (gupcr_nb_le));
+ gupcr_portals_call (PtlPTFree, (gupcr_ptl_ni, GUPCR_PTL_PTE_NB));
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_nb_sup.h b/libgupc/portals4/gupcr_nb_sup.h
new file mode 100644
index 00000000000..3dafc8769e8
--- /dev/null
+++ b/libgupc/portals4/gupcr_nb_sup.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_nb_sup.h
+ * GUPC Portals4 non-blocking transfer implementation support routines.
+ *
+ * @addtogroup NON-BLOCKING GUPCR Non-Blocking Transfer Support Functions
+ * @{
+ */
+
+#ifndef _GUPCR_NB_SUP_H_
+#define _GUPCR_NB_SUP_H_ 1
+
+/** Maximum number of outstanding non-blocking transfers */
+#define GUPCR_NB_MAX_OUTSTANDING 128
+
+extern void gupcr_nb_put (size_t, size_t, const void *,
+ size_t, unsigned long *);
+extern void gupcr_nb_get (size_t, size_t, char *, size_t,
+ unsigned long *);
+extern int gupcr_nb_completed (unsigned long);
+extern void gupcr_sync (unsigned long);
+extern int gupcr_nbi_outstanding (void);
+extern void gupcr_synci (void);
+extern void gupcr_nb_init (void);
+extern void gupcr_nb_fini (void);
+
+#endif /* gupcr_nb_sup.h */
+
+/** }@ */
diff --git a/libgupc/portals4/gupcr_node.c b/libgupc/portals4/gupcr_node.c
new file mode 100644
index 00000000000..36159321247
--- /dev/null
+++ b/libgupc/portals4/gupcr_node.c
@@ -0,0 +1,268 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_node.c
+ * GUPC Node Local Memory.
+ */
+
+/**
+ * @addtogroup NODE GUPCR Node Local Memory
+ * @{
+ */
+
+#include <stdio.h>
+#include <sys/time.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+#include "gupcr_portals.h"
+#include "gupcr_runtime.h"
+#include "gupcr_gmem.h"
+#include "gupcr_node.h"
+
+/**
+ * GUPC Node Local Memory Support
+ *
+ * Multiple UPC threads can run on a single node and access
+ * each other's data via shared memory instead of
+ * the Portals library API. This is true for all
+ * ordinary shared accesses (get/put), but not for atomic or
+ * some specialized Portals operations (e.g. triggered
+ * operations). Future runtime improvements might remove
+ * this restriction in some cases.
+ *
+ * DISABLED
+ * Each thread allocates its own shared memory with
+ * a private mapping (MAP_ANONYMOUS).
+ *
+ * This functionality is useful for testing purposes.
+ *
+ * ENABLED
+ * Shared memory can be configured to use
+ * an mmap backed file or POSIX shared memory.
+ *
+ * Shared memory allocation and mapping:
+ *
+ * (1) Each thread creates a shared object or file name in the
+ * form of "upc-mem-MYTHREAD-MYPID" where MYTHREAD and MYPID
+ * are 6 digit numbers with leading zeros.
+ * This name refers to either a file name (mapped via mmap())
+ * or a POSIX shared memory object.
+ * (2) Each thread maps its own shared space and verifies that
+ * it can be accessed (by writing to the first and last page).
+ * (3) A runtime barrier is used to allow for every thread in
+ * the system to complete its own setup.
+ * (4) By using Portals pid-to-nid mappings, each thread searches for
+ * other threads that reside on the same node (same nid).
+ * (5) For each found thread, a POSIX shared object or a file
+ * is opened (in the same manner as under the step 1), mapped,
+ * and verified.
+ *
+ * UPC ACCESS
+ * Each thread keeps a private array of addresses to other
+ * threads' shared spaces. A of NULL value indicates that
+ * specified thread is NOT on the same node and Portals
+ * functions should be used. Otherwise, the mapped address
+ * is the base address of the target thread's shared address space.
+ */
+
+/** Node local memory map (indexed by thread id). */
+char **gupcr_node_map;
+/** Current thread for mapping verification. */
+int gupcr_check_thread;
+
+/**
+ * SIGBUS handler for shared memory check.
+ *
+ * SIGBUS happens if the current thread is unable to
+ * access shared memory of some other thread.
+ */
+static void
+gupcr_mem_sigbus (int sig __attribute__ ((unused)))
+{
+#if GUPCR_NODE_LOCAL_MEM
+ gupcr_mem_local_unlink ();
+#endif
+ gupcr_fatal_error ("cannot access shared memory of thread %d",
+ gupcr_check_thread);
+}
+
+/**
+ * Shared memory check.
+ *
+ * Check that memory at the specified address and with the
+ * specified size can be accessed. As memory might not
+ * accessible, this procedure installs its own SIGBUS handler
+ * in order to provide the user with better diagnostic.
+ */
+static void
+gupcr_mem_check (char *mem, size_t size, int thread)
+{
+ char temp;
+ struct sigaction action;
+ struct sigaction old_action;
+
+ /* Set file name for better diagnostic. */
+ gupcr_check_thread = thread;
+
+ /* Install new SIGBUS handler to catch memory faults. */
+ action.sa_handler = gupcr_mem_sigbus;
+ sigemptyset (&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction (SIGBUS, &action, &old_action);
+
+ if (gupcr_is_forcetouch_enabled ())
+ {
+ volatile char *memp = (volatile char *) mem;
+ while (memp < mem + size)
+ {
+ temp = *memp;
+ *memp = temp;
+ memp += GUPCR_MEMORY_PAGE_SIZE;
+ }
+ }
+ else
+ {
+ /* Only check the first and the last page. */
+ temp = *(volatile char *) mem;
+ *(volatile char *) mem = temp;
+ temp = *(volatile char *) (mem + size - 16);
+ *(volatile char *) (mem + size - 16) = temp;
+ }
+
+ /* Restore SIGBUS handler. */
+ sigaction (SIGBUS, &old_action, NULL);
+}
+
+/**
+ * Allocate memory for a thread's shared space.
+ *
+ * This memory is never shared with other threads
+ * on the same node and is visible through Portals
+ * functions only.
+ *
+ * @retval Memory address of mapping
+ */
+char *
+gupcr_mem_private (size_t size)
+{
+ char *memaddr;
+ memaddr = mmap (NULL, size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, OFFSET_ZERO);
+ if (!memaddr || memaddr == MAP_ERROR)
+ gupcr_fatal_error
+ ("cannot mmap 0x%lx bytes of node's private shared memory (%s)",
+ (long unsigned) size, strerror (errno));
+ gupcr_log (FC_MEM, "using private mapping for shared space");
+ gupcr_mem_check (memaddr, size, MYTHREAD);
+ return memaddr;
+}
+
+/**
+ * Shared space allocation and mapping.
+ *
+ * Allocate and map each thread's node local shared space.
+ * Learn and map the shared space of other threads that reside on
+ * the same node.
+ *
+ * @in size Size of the shared space.
+ * @retval Address of the shared space.
+ */
+char *
+gupcr_node_local_alloc (size_t size)
+{
+ /* Allocate zero initialized space for node local memory map. */
+ gupcr_node_map = calloc (THREADS, sizeof (char *));
+ if (!gupcr_node_map)
+ gupcr_fatal_error ("cannot allocate space for node local memory map");
+
+#if GUPCR_NODE_LOCAL_MEM
+ /* Node Local Memory can be disabled by env variable. */
+ if (gupcr_is_node_local_memory_enabled ())
+ {
+ int i;
+ /* Create mapping for this thread. */
+ gupcr_node_map[MYTHREAD] = gupcr_mem_local_map (MYTHREAD, size);
+ /* Verify that we can access memory. */
+ gupcr_mem_check (gupcr_node_map[MYTHREAD], size, MYTHREAD);
+
+ /* Wait for all other threads to complete the same. */
+ gupcr_runtime_barrier ();
+
+ /* Map shared memory of other threads on the same node. */
+ {
+ int nid = gupcr_get_rank_nid (MYTHREAD);
+ for (i = 0; i < THREADS; i++)
+ {
+ if (i != MYTHREAD && nid == gupcr_get_rank_nid (i))
+ {
+ gupcr_node_map[i] = gupcr_mem_local_map (i, size);
+ }
+ }
+ }
+ /* Make sure everybody completed their mappings. */
+ gupcr_runtime_barrier ();
+ /* At this point it is safe to cleanup. */
+ gupcr_mem_local_unlink ();
+ }
+ else
+ {
+ /* The node local shared memory optimization has been
+ disabled (via an environment variable).
+ Create and map only the shared memory contribution of this node. */
+ gupcr_node_map[MYTHREAD] = gupcr_mem_private (size);
+ }
+#else
+ /* The node local shared memory optimization has been
+ disabled (via a configuration option).
+ Create and map only the shared memory contribution of this node. */
+ gupcr_node_map[MYTHREAD] = gupcr_mem_private (size);
+#endif /* GUPCR_NODE_LOCAL_MEM */
+ return gupcr_node_map[MYTHREAD];
+}
+
+/**
+ * Initialize node specific data.
+ */
+void
+gupcr_node_init (void)
+{
+#if GUPCR_NODE_LOCAL_MEM
+ if (gupcr_is_node_local_memory_enabled ())
+ gupcr_mem_local_init ();
+#endif
+}
+
+/**
+ * Finalize node specific data.
+ */
+void
+gupcr_node_fini (void)
+{
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_node.h b/libgupc/portals4/gupcr_node.h
new file mode 100644
index 00000000000..ddf1616246e
--- /dev/null
+++ b/libgupc/portals4/gupcr_node.h
@@ -0,0 +1,61 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_NODE_H_
+#define _GUPCR_NODE_H_ 1
+
+/**
+ * @file gupcr_node.h
+ * GUPC Node Local Memory.
+ */
+
+/**
+ * @addtogroup NODE GUPCR Node Local Memory
+ * @{
+ */
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+#include "gupcr_portals.h"
+#include "gupcr_runtime.h"
+
+//begin lib_node_local
+/** Memory map for threads that share node local memory. */
+extern char **gupcr_node_map;
+//end lib_node_local
+
+/** Node local memory file/object prefix. */
+#define GUPCR_LOCAL_NAME_PREFIX "upc-mem"
+
+char *gupcr_node_local_alloc (size_t);
+void gupcr_node_init (void);
+void gupcr_node_fini (void);
+char *gupcr_mem_local_map (int, size_t);
+void gupcr_mem_local_unlink (void);
+void gupcr_mem_local_init (void);
+/** @} */
+
+#endif /* gupcr_node.h */
diff --git a/libgupc/portals4/gupcr_node_mem_mmap.c b/libgupc/portals4/gupcr_node_mem_mmap.c
new file mode 100644
index 00000000000..0a1b7040ced
--- /dev/null
+++ b/libgupc/portals4/gupcr_node_mem_mmap.c
@@ -0,0 +1,102 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_node_mem_mmap.c
+ * GUPC Node Local Memory - Mmap Support.
+ */
+
+/**
+ * @addtogroup NODE GUPCR Node Local Memory
+ * @{
+ */
+
+#include <stdio.h>
+#include <sys/time.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+#include "gupcr_portals.h"
+#include "gupcr_node.h"
+
+/** Thread's node local memory shared space. */
+static char gupcr_thread_local_name[FILENAME_MAX];
+
+/**
+ * Map specified thread's shared memory into the current
+ * thread's memory.
+ *
+ * @param [in] thread Thread ID
+ * @param [in] size Shared memory size
+ * @retval Memory address of the map.
+ */
+char *
+gupcr_mem_local_map (int thread, size_t size)
+{
+ int fd;
+ char fname[FILENAME_MAX];
+ char *maddr;
+ /* Create file name for mmap. */
+ gupcr_unique_local_name (fname, GUPCR_LOCAL_NAME_PREFIX, thread, 1);
+ if (thread == MYTHREAD)
+ {
+ strcpy (gupcr_thread_local_name, fname);
+ gupcr_log (FC_MEM, "shared memory file: %s", fname);
+ }
+ fd = open (fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ if (fd < 0)
+ gupcr_fatal_error ("cannot create file for mmap %s", fname);
+ if (ftruncate (fd, size))
+ gupcr_fatal_error ("cannot resize file %s 0x%lx", fname, size);
+ maddr = mmap (NULL, size, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd, OFFSET_ZERO);
+ if (!maddr || maddr == MAP_ERROR)
+ gupcr_fatal_error ("cannot map 0x%lx bytes of %s", size, fname);
+ return maddr;
+}
+
+/**
+ * Remove the file used for mmap.
+ * On Unix systems, this removes the file name, but since
+ * the file is open, the underlying file storage will remain
+ * until the program terminates.
+ */
+void
+gupcr_mem_local_unlink (void)
+{
+ unlink (gupcr_thread_local_name);
+}
+
+/*
+ * Initialize mmap support.
+ */
+void
+gupcr_mem_local_init (void)
+{
+ gupcr_log (FC_MEM, "using node local mmap shared memory file");
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_node_mem_posix.c b/libgupc/portals4/gupcr_node_mem_posix.c
new file mode 100644
index 00000000000..704107d980c
--- /dev/null
+++ b/libgupc/portals4/gupcr_node_mem_posix.c
@@ -0,0 +1,106 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_node_mem_posix.c
+ * GUPC Node Local Memory - POSIX Shared Memory.
+ */
+
+/**
+ * @addtogroup NODE GUPCR Node Local Memory
+ * @{
+ */
+
+#include <stdio.h>
+#include <sys/time.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+#include "gupcr_portals.h"
+#include "gupcr_runtime.h"
+#include "gupcr_node.h"
+
+/** Thread's node local memory shared space. */
+static char gupcr_thread_local_name[FILENAME_MAX];
+
+/**
+ * Map specified thread's shared memory into the current
+ * thread's memory.
+ *
+ * @param [in] thread Thread ID
+ * @param [in] size Shared object size
+ * @retval Memory address.
+ */
+char *
+gupcr_mem_local_map (int thread, size_t size)
+{
+ int fd;
+ char fname[FILENAME_MAX];
+ char *maddr;
+ /* Create shared object name. */
+ gupcr_unique_local_name (fname, GUPCR_LOCAL_NAME_PREFIX, thread, 0);
+ if (thread == MYTHREAD)
+ {
+ strcpy (gupcr_thread_local_name, fname);
+ gupcr_log (FC_MEM, "node local memory shared object: %s", fname);
+ }
+ fd = shm_open (fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ if (fd < 0)
+ gupcr_fatal_error ("cannot create POSIX shared object %s", fname);
+ if (ftruncate (fd, size))
+ gupcr_fatal_error ("cannot resize POSIX shared object %s 0x%lx",
+ fname, (long unsigned) size);
+ maddr = mmap (NULL, size, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd, OFFSET_ZERO);
+ if (!maddr || maddr == MAP_ERROR)
+ gupcr_fatal_error ("cannot map POSIX shared object: 0x%lx bytes of %s",
+ (long unsigned) size, fname);
+ return maddr;
+}
+
+/**
+ * Remove the file used for the shared object.
+ *
+ * On Unix systems, this removes the file name, but since
+ * the file is open, the underlying file storage will remain
+ * until the program terminates.
+ */
+void
+gupcr_mem_local_unlink (void)
+{
+ shm_unlink (gupcr_thread_local_name);
+}
+
+/**
+ * Initialize the POSIX shared node local memory support.
+ */
+void
+gupcr_mem_local_init (void)
+{
+ gupcr_log (FC_MEM, "Using node local POSIX shared memory");
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_pgm_info.c b/libgupc/portals4/gupcr_pgm_info.c
new file mode 100644
index 00000000000..961a6bc70bc
--- /dev/null
+++ b/libgupc/portals4/gupcr_pgm_info.c
@@ -0,0 +1,243 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_pgm_info.c
+ * GUPC Runtime program information routines
+ */
+
+/**
+ * @addtogroup GUPCUTILS GUPCR Utility Functions
+ * @{
+ */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_utils.h"
+
+
+typedef enum
+{
+ upc_threads_model_none = 0,
+ upc_threads_model_process = 1,
+} upc_threads_model_t;
+
+typedef struct upc_compiled_thread_info_struct
+{
+ /** Next on the list of files */
+ struct upc_compiled_thread_info_struct *next;
+ /** File name */
+ char *filename;
+ /** Number of compiled threads for the file */
+ int nthreads;
+ /** Thread's model (process/pthreads) */
+ upc_threads_model_t threads_model;
+} upc_compiled_thread_info_t;
+typedef upc_compiled_thread_info_t *upc_compiled_thread_info_p;
+
+/* List of compiled UPC files, and the value of THREADS
+ specified at compile-time (-1 means no value given
+ at compile-time). */
+static upc_compiled_thread_info_p gupcr_compiled_thread_info = 0;
+
+static void
+gupcr_print_upc_compiled_thread_info (void)
+{
+ upc_compiled_thread_info_p p;
+ gupcr_error (" THREADS Threads Model Filename\n");
+ for (p = gupcr_compiled_thread_info; p; p = p->next)
+ {
+ if (p->nthreads > 0)
+ gupcr_error ("%10d", p->nthreads);
+ else
+ gupcr_error (" <dynamic>");
+ if (p->threads_model == upc_threads_model_process)
+ gupcr_error (" process");
+ gupcr_error (" %s\n", p->filename);
+ }
+}
+
+static void
+gupcr_register_pgm_info (char *filename, int nthreads,
+ upc_threads_model_t threads_model)
+{
+ upc_compiled_thread_info_p info, *p;
+ gupcr_malloc (info, (sizeof (upc_compiled_thread_info_t)));
+ /* Insertion into list is ordered by file name. */
+ for (p = &gupcr_compiled_thread_info;
+ *p && strcmp (filename, (*p)->filename) >= 0;
+ p = &(*p)->next) /* loop */ ;
+ info->filename = filename;
+ info->nthreads = nthreads;
+ info->threads_model = threads_model;
+ info->next = *p;
+ *p = info;
+}
+
+static void
+gupcr_skip_spaces (const char **s)
+{
+ while (**s == ' ')
+ ++(*s);
+}
+
+static int
+gupcr_match_string (const char **s, const char *string)
+{
+ int slen = strlen (string);
+ if (strncmp (*s, string, slen) != 0)
+ return 0;
+ *s += slen;
+ return 1;
+}
+
+static int
+gupcr_match_until (const char **s, const char *string)
+{
+ int slen = strlen (string);
+ while (**s && (strncmp (*s, string, slen) != 0))
+ ++(*s);
+ if (!**s)
+ return 0;
+ *s += slen;
+ return 1;
+}
+
+static int
+gupcr_match_num (const char **s, int *num)
+{
+ *num = 0;
+ while (**s >= '0' && **s <= '9')
+ {
+ *num = *num * 10 + (**s - '0');
+ ++(*s);
+ }
+ if (*num == 0)
+ return 0;
+ return 1;
+}
+
+/* Examples:
+ $GCCUPCConfig: (t.upc) dynamicthreads process$
+ $GCCUPCConfig: (t.upc) staticcthreads=4 pthreads-tls staticpthreads=4$ */
+static void
+gupcr_parse_program_info (char *info)
+{
+ char *filename;
+ int nthreads = -1;
+ upc_threads_model_t threads_model = upc_threads_model_none;
+ const char *fname;
+ int fname_len;
+ const char *s = info;
+ if (!gupcr_match_string (&s, "$GCCUPCConfig:"))
+ return;
+ gupcr_skip_spaces (&s);
+ if (!gupcr_match_string (&s, "("))
+ return;
+ fname = s;
+ if (!gupcr_match_until (&s, ")"))
+ return;
+ fname_len = (s - fname - 1);
+ gupcr_malloc (filename, (fname_len + 1));
+ strncpy (filename, fname, fname_len);
+ filename[fname_len] = '\0';
+ while (*s)
+ {
+ gupcr_skip_spaces (&s);
+ if (gupcr_match_string (&s, "$"))
+ {
+ break;
+ }
+ else if (gupcr_match_string (&s, "dynamicthreads"))
+ {
+ nthreads = -1;
+ }
+ else if (gupcr_match_string (&s, "staticthreads="))
+ {
+ if (!gupcr_match_num (&s, &nthreads))
+ return;
+ }
+ else if (gupcr_match_string (&s, "process"))
+ {
+ threads_model = upc_threads_model_process;
+ }
+ else
+ return;
+ }
+ gupcr_register_pgm_info (filename, nthreads, threads_model);
+}
+
+void
+gupcr_validate_pgm_info (void)
+{
+ upc_compiled_thread_info_p p;
+ char *info;
+ int nthreads = -1;
+ /* Process all the strings within the program information section.
+ (Ignore intervening null bytes.) */
+ for (info = GUPCR_PGM_INFO_SECTION_START;
+ info < GUPCR_PGM_INFO_SECTION_END; ++info)
+ {
+ if (*info)
+ {
+ gupcr_parse_program_info (info);
+ info += strlen (info);
+ }
+ }
+ if (!gupcr_compiled_thread_info)
+ gupcr_abort_with_msg ("there are no UPC source files "
+ "compiled into this program, "
+ "or perhaps <upc.h> was not included");
+ for (p = gupcr_compiled_thread_info; p; p = p->next)
+ {
+ if (p->nthreads > 0 && nthreads <= 0)
+ nthreads = p->nthreads;
+ /* Static threads compilations can be intermixed
+ with dynamic threads compilations, but the static values
+ must agree. */
+ if (((p->nthreads != nthreads)
+ && (p->nthreads > 0)
+ && (nthreads > 0))
+ || (p->threads_model != gupcr_compiled_thread_info->threads_model))
+ {
+ gupcr_assert (MYTHREAD >= 0);
+ if (!MYTHREAD)
+ {
+ gupcr_error ("the UPC source files in this "
+ "program were not compiled with the same value "
+ "of UPC settings;\n"
+ "a list of each UPC source file and "
+ "its compiled UPC settings follows");
+ gupcr_print_upc_compiled_thread_info ();
+ }
+ exit (2);
+ }
+ }
+ THREADS = nthreads;
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_portals.c b/libgupc/portals4/gupcr_portals.c
new file mode 100644
index 00000000000..399fc177b7a
--- /dev/null
+++ b/libgupc/portals4/gupcr_portals.c
@@ -0,0 +1,521 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_portals.c
+ * GUPC Portals4 Initialization.
+ */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+#include "gupcr_portals.h"
+#include "gupcr_runtime.h"
+
+/* Portals network interface handle/limits/rank. */
+ptl_handle_ni_t gupcr_ptl_ni;
+ptl_ni_limits_t gupcr_ptl_ni_limits;
+ptl_rank_t gupcr_ptl_rank;
+ptl_nid_t gupcr_ptl_nid;
+ptl_pid_t gupcr_ptl_pid;
+int gupcr_ptl_size;
+
+int gupcr_child[GUPCR_TREE_FANOUT];
+int gupcr_child_cnt;
+int gupcr_parent_thread;
+
+size_t gupcr_max_ordered_size;
+size_t gupcr_max_msg_size;
+size_t gupcr_max_volatile_size;
+
+/** Mapping to nid/pid for each rank */
+static ptl_process_t *gupcr_ptl_proc_map;
+
+/**
+ * @addtogroup PORTALS_RUNTIME GUPCR Portals runtime interface
+ * @{
+ */
+
+/**
+ * Return Portals error description string.
+ *
+ * @param [in] errnum Portals error number
+ * @retval Error description string
+ */
+const char *
+gupcr_strptlerror (int errnum)
+{
+ static char gupcr_strptlerror_buf[64];
+ switch (errnum)
+ {
+ case PTL_OK:
+ return "portals operation successful";
+ case PTL_ARG_INVALID:
+ return "invalid portals argument";
+ case PTL_CT_NONE_REACHED:
+ return "timeout reached";
+ case PTL_EQ_DROPPED:
+ return "portals event dropped";
+ case PTL_EQ_EMPTY:
+ return "portals event queue empty";
+ case PTL_FAIL:
+ return "portals operation failed";
+ case PTL_IGNORED:
+ return "logical map set failed";
+ case PTL_IN_USE:
+ return "portals resource already in use";
+ case PTL_INTERRUPTED:
+ return "portals operation interrupted";
+ case PTL_LIST_TOO_LONG:
+ return "portals list too long";
+ case PTL_NO_INIT:
+ return "portals not initialized";
+ case PTL_NO_SPACE:
+ return "portals out of memory";
+ case PTL_PID_IN_USE:
+ return "portals portal ID already in use";
+ case PTL_PT_FULL:
+ return "portals portal table is full";
+ case PTL_PT_EQ_NEEDED:
+ return "portals event queue needed for flow control";
+ case PTL_PT_IN_USE:
+ return "portals PTE already in use";
+ default:
+ break;
+ }
+ sprintf (gupcr_strptlerror_buf, "unknown portals status code: %d", errnum);
+ return gupcr_strptlerror_buf;
+}
+
+/**
+ * Return Event Queue type description string.
+ *
+ * @param [in] eqtype Event queue type
+ * @retval Event queue type description string
+ */
+const char *
+gupcr_streqtype (ptl_event_kind_t eqtype)
+{
+ switch (eqtype)
+ {
+ case PTL_EVENT_GET:
+ return "PTL_EVENT_GET";
+ case PTL_EVENT_GET_OVERFLOW:
+ return "PTL_EVENT_GET_OVERFLOW";
+ case PTL_EVENT_PUT:
+ return "PTL_EVENT_PUT";
+ case PTL_EVENT_PUT_OVERFLOW:
+ return "PTL_EVENT_PUT_OVERFLOW";
+ case PTL_EVENT_ATOMIC:
+ return "PTL_EVENT_ATOMIC";
+ case PTL_EVENT_ATOMIC_OVERFLOW:
+ return "PTL_EVENT_ATOMIC_OVERFLOW";
+ case PTL_EVENT_FETCH_ATOMIC:
+ return "PTL_EVENT_ATOMIC";
+ case PTL_EVENT_FETCH_ATOMIC_OVERFLOW:
+ return "PTL_EVENT_ATOMIC_OVERFLOW";
+ case PTL_EVENT_REPLY:
+ return "PTL_EVENT_REPLY";
+ case PTL_EVENT_SEND:
+ return "PTL_EVENT_SEND";
+ case PTL_EVENT_ACK:
+ return "PTL_EVENT_ACK";
+ case PTL_EVENT_PT_DISABLED:
+ return "PTL_EVENT_PT_DISABLED";
+ case PTL_EVENT_LINK:
+ return "PTL_EVENT_LINK";
+ case PTL_EVENT_AUTO_UNLINK:
+ return "PTL_EVENT_AUTO_UNLINK";
+ case PTL_EVENT_AUTO_FREE:
+ return "PTL_EVENT_AUTO_FREE";
+ case PTL_EVENT_SEARCH:
+ return "PTL_EVENT_SEARCH";
+ }
+ return "UNKNOWN EVENT TYPE";
+}
+
+/**
+ * Return Data type description string.
+ *
+ * @param [in] datatype Data type
+ * @retval Data type description string
+ */
+const char *
+gupcr_strptldatatype (ptl_datatype_t datatype)
+{
+ switch (datatype)
+ {
+ case PTL_INT8_T:
+ return "PTL_INT8_T";
+ case PTL_UINT8_T:
+ return "PTL_UINT8_T";
+ case PTL_INT16_T:
+ return "PTL_INT16_T";
+ case PTL_UINT16_T:
+ return "PTL_UINT16_T";
+ case PTL_INT32_T:
+ return "PTL_INT32_T";
+ case PTL_UINT32_T:
+ return "PTL_UINT32_T";
+ case PTL_FLOAT:
+ return "PTL_FLOAT";
+ case PTL_INT64_T:
+ return "PTL_INT64_T";
+ case PTL_UINT64_T:
+ return "PTL_UINT64_T";
+ case PTL_DOUBLE:
+ return "PTL_DOUBLE";
+ case PTL_FLOAT_COMPLEX:
+ return "PTL_FLOAT_COMPLEX";
+ case PTL_DOUBLE_COMPLEX:
+ return "PTL_DOUBLE_COMPLEX";
+ case PTL_LONG_DOUBLE:
+ return "PTL_LONG_DOUBLE";
+ case PTL_LONG_DOUBLE_COMPLEX:
+ return "PTL_LONG_DOUBLE_COMPLEX";
+ }
+ return "UNKNOWN DATA TYPE";
+}
+
+/**
+ * Return Atomic operation description string.
+ *
+ * @param [in] op Atomic operation type
+ * @retval Atomic operation description string
+ */
+const char *
+gupcr_strptlop (ptl_op_t op)
+{
+ switch (op)
+ {
+ case PTL_MIN:
+ return "PTL_MIN";
+ case PTL_MAX:
+ return "PTL_MAX";
+ case PTL_SUM:
+ return "PTL_SUM";
+ case PTL_PROD:
+ return "PTL_PROD";
+ case PTL_LOR:
+ return "PTL_LOR";
+ case PTL_LAND:
+ return "PTL_LAND";
+ case PTL_BOR:
+ return "PTL_BOR";
+ case PTL_BAND:
+ return "PTL_BAND";
+ case PTL_LXOR:
+ return "PTL_LXOR";
+ case PTL_BXOR:
+ return "PTL_BXOR";
+ case PTL_SWAP:
+ return "PTL_SWAP";
+ case PTL_CSWAP:
+ return "PTL_CSWAP";
+ case PTL_CSWAP_NE:
+ return "PTL_CSWAP_NE";
+ case PTL_CSWAP_LE:
+ return "PTL_CSWAP_LE";
+ case PTL_CSWAP_LT:
+ return "PTL_CSWAP_LT";
+ case PTL_CSWAP_GE:
+ return "PTL_CSWAP_GE";
+ case PTL_CSWAP_GT:
+ return "PTL_CSWAP_GT";
+ case PTL_MSWAP:
+ return "PTL_MSWAP";
+ }
+ return "UNKNOWN ATOMIC OPERATION TYPE";
+}
+
+/**
+ * Return Network Interface error description string.
+ *
+ * @param [in] nitype NI failure type
+ * @retval NI failure description string.
+ */
+const char *
+gupcr_nifailtype (ptl_ni_fail_t nitype)
+{
+ switch (nitype)
+ {
+ case PTL_NI_OK:
+ return "PTL_NI_OK";
+ case PTL_NI_UNDELIVERABLE:
+ return "PTL_NI_UNDELIVERABLE";
+ case PTL_NI_DROPPED:
+ return "PTL_NI_DROPPED";
+ case PTL_NI_PT_DISABLED:
+ return "PTL_NI_PT_DISABLED";
+ case PTL_NI_PERM_VIOLATION:
+ return "PTL_NI_PERM_VIOLATION";
+ case PTL_NI_OP_VIOLATION:
+ return "PTL_NI_OP_VIOLATION";
+ case PTL_NI_NO_MATCH:
+ return "PTL_NI_NO_MATCH";
+ case PTL_NI_SEGV:
+ return "PTL_NI_SEGV";
+ }
+ return "NI_FAILURE_UNKNOWN";
+}
+
+/**
+ * Return Portals atomic data type from the specified size.
+ */
+ptl_datatype_t
+gupcr_get_atomic_datatype (int size)
+{
+ switch (size)
+ {
+ case 1:
+ return PTL_UINT8_T;
+ case 2:
+ return PTL_UINT16_T;
+ case 4:
+ return PTL_UINT32_T;
+ case 8:
+ return PTL_UINT64_T;
+ case 16:
+ return PTL_DOUBLE_COMPLEX;
+ default:
+ gupcr_fatal_error
+ ("Unable to convert size of %d into Portals atomic data type.", size);
+ }
+ return -1;
+}
+
+/**
+ * Return Portals data size from the specified atomic type.
+ *
+ * @param [in] type Portals atomic data type
+ * @retval Portals atomic data type size
+ */
+size_t
+gupcr_get_atomic_size (ptl_datatype_t type)
+{
+ switch (type)
+ {
+ case PTL_INT8_T:
+ case PTL_UINT8_T:
+ return 1;
+ case PTL_INT16_T:
+ case PTL_UINT16_T:
+ return 2;
+ case PTL_INT32_T:
+ case PTL_UINT32_T:
+ return 4;
+ case PTL_INT64_T:
+ case PTL_UINT64_T:
+ return 8;
+ case PTL_FLOAT:
+ return __SIZEOF_FLOAT__;
+ case PTL_FLOAT_COMPLEX:
+ return 2 * __SIZEOF_FLOAT__;
+ case PTL_DOUBLE:
+ return __SIZEOF_DOUBLE__;
+ case PTL_DOUBLE_COMPLEX:
+ return 2 * __SIZEOF_DOUBLE__;
+#ifdef __SIZEOF_LONG_DOUBLE__
+ case PTL_LONG_DOUBLE:
+ return __SIZEOF_LONG_DOUBLE__;
+ case PTL_LONG_DOUBLE_COMPLEX:
+ return 2 * __SIZEOF_LONG_DOUBLE__;
+#endif
+ default:
+ gupcr_fatal_error ("unknown atomic type %d", (int) type);
+ }
+ return -1;
+}
+
+/**
+ * @fn gupcr_process_fail_events (ptl_handle_eq_t eq)
+ * Show information on failed events.
+ *
+ * This procedure prints the contents of the event queue. As barrier
+ * implementation does not use full events, the event queue contains
+ * only failure events. This procedure is called only if any of the
+ * counting events reported a failure.
+ *
+ * @param [in] eq Event Queue ID
+ */
+void
+gupcr_process_fail_events (ptl_handle_eq_t eq)
+{
+ ptl_event_t ev;
+ int status;
+
+ while ((status = PtlEQGet (eq, &ev)) != PTL_EQ_EMPTY)
+ {
+ const char *eqerr = gupcr_streqtype (ev.type);
+ const char *nierr = gupcr_nifailtype (ev.ni_fail_type);
+ gupcr_error_print ("event failure %s (%s (%x))", eqerr, nierr,
+ ev.ni_fail_type);
+ }
+}
+
+/**
+ * Get current thread rank.
+ * @retval Rank of the current thread
+ */
+int
+gupcr_get_rank (void)
+{
+ return gupcr_ptl_rank;
+}
+
+/**
+ * Get number of running threads.
+ * @retval Number of running threads
+ */
+int
+gupcr_get_threads_count (void)
+{
+ return gupcr_ptl_size;
+}
+
+/**
+ * Get process PID for specified rank.
+ * @param [in] rank Rank of the thread
+ * @retval PID of the thread
+ */
+int
+gupcr_get_rank_pid (int rank)
+{
+ return gupcr_ptl_proc_map[rank].phys.pid;
+}
+
+/**
+ * Get process NID for specified rank.
+ * @param [in] rank Rank of the thread
+ * @retval NID of the thread
+ */
+int
+gupcr_get_rank_nid (int rank)
+{
+ return gupcr_ptl_proc_map[rank].phys.nid;
+}
+
+/**
+ * Wait for all threads to complete initialization.
+ */
+void
+gupcr_startup_barrier (void)
+{
+ gupcr_runtime_barrier ();
+}
+
+/** @} */
+
+/**
+ * @addtogroup INIT GUPCR Initialization
+ * @{
+ */
+
+/**
+ * Initialize Portals Interface.
+ *
+ * Calls to get rank/number of threads can
+ * be made only after Portals is initialized.
+ * Also, initialize the necessary runtime.
+ */
+void
+gupcr_portals_init (void)
+{
+ gupcr_portals_call (PtlInit, ());
+ /* Set rank for this thread. */
+ gupcr_ptl_rank = gupcr_runtime_get_rank ();
+ gupcr_ptl_size = gupcr_runtime_get_size ();
+}
+
+/**
+ * Close Portals.
+ */
+void
+gupcr_portals_fini (void)
+{
+ PtlFini ();
+}
+
+/**
+ * Initialize Portals Networking Interface.
+ */
+void
+gupcr_portals_ni_init (void)
+{
+ /* Initialize network interface. */
+ gupcr_portals_call (PtlNIInit,
+ (PTL_IFACE_DEFAULT, PTL_NI_NO_MATCHING | PTL_NI_LOGICAL,
+ PTL_PID_ANY, NULL, &gupcr_ptl_ni_limits,
+ &gupcr_ptl_ni));
+ /* Initialize limits used by GMEM. */
+ gupcr_max_ordered_size = gupcr_ptl_ni_limits.max_waw_ordered_size;
+ gupcr_max_msg_size = gupcr_ptl_ni_limits.max_msg_size;
+ gupcr_max_volatile_size = gupcr_ptl_ni_limits.max_volatile_size;
+
+ /* Initialize the mapping from rank -> nid/pid. */
+ gupcr_ptl_proc_map = gupcr_runtime_get_mapping (gupcr_ptl_ni);
+ gupcr_portals_call (PtlSetMap, (gupcr_ptl_ni, (ptl_size_t) gupcr_ptl_size,
+ gupcr_ptl_proc_map));
+
+ /* Get this thread physical IDs. */
+ gupcr_ptl_pid = gupcr_get_rank_pid (gupcr_ptl_rank);
+ gupcr_ptl_nid = gupcr_get_rank_nid (gupcr_ptl_rank);
+}
+
+/**
+ * Close Portals Networking Interface.
+ */
+void
+gupcr_portals_ni_fini (void)
+{
+ gupcr_portals_call (PtlNIFini, (gupcr_ptl_ni));
+}
+
+/**
+ * Find the node's parent and all its children.
+ */
+void
+gupcr_nodetree_setup (void)
+{
+ int i;
+ gupcr_log ((FC_BARRIER | FC_BROADCAST),
+ "node tree initialized with fanout of %d", GUPCR_TREE_FANOUT);
+ for (i = 0; i < GUPCR_TREE_FANOUT; i++)
+ {
+ int child = GUPCR_TREE_FANOUT * MYTHREAD + i + 1;
+ if (child < THREADS)
+ {
+ gupcr_child_cnt++;
+ gupcr_child[i] = child;
+ }
+ }
+ if (MYTHREAD == 0)
+ gupcr_parent_thread = ROOT_PARENT;
+ else
+ gupcr_parent_thread = (MYTHREAD - 1) / GUPCR_TREE_FANOUT;
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_portals.h b/libgupc/portals4/gupcr_portals.h
new file mode 100644
index 00000000000..e64924d320d
--- /dev/null
+++ b/libgupc/portals4/gupcr_portals.h
@@ -0,0 +1,167 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_PORTALS_H_
+#define _GUPCR_PORTALS_H_
+
+#include <portals4.h>
+
+/**
+ * @file gupcr_portals.h
+ * GUPC Portals4 Global Definitions.
+ */
+
+/**
+ * @addtogroup CONFIG GUPCR Configuration
+ * @{
+ */
+
+/* GUPCR Portals Table Entries */
+/** Memory put/get functions PTE */
+#define GUPCR_PTL_PTE_GMEM GUPCR_PTE_BASE
+/** Barrier messages to parent node PTE */
+#define GUPCR_PTL_PTE_BARRIER_UP GUPCR_PTE_BASE+1
+/** Barrier messages from parent node PTE */
+#define GUPCR_PTL_PTE_BARRIER_DOWN GUPCR_PTE_BASE+2
+/** Lock signaling PTE */
+#define GUPCR_PTL_PTE_LOCK GUPCR_PTE_BASE+3
+/** Shutdown service signaling PTE */
+#define GUPCR_PTL_PTE_SHUTDOWN GUPCR_PTE_BASE+4
+/** Collectives service signaling PTE */
+#define GUPCR_PTL_PTE_COLL GUPCR_PTE_BASE+5
+/** Non-blocking transfers PTE */
+#define GUPCR_PTL_PTE_NB GUPCR_PTE_BASE+6
+/** @} */
+
+//begin lib_portals
+
+/** Max ordered size - per network interface */
+extern size_t gupcr_max_ordered_size;
+#define GUPCR_PORTALS_MAX_ORDERED_SIZE gupcr_max_ordered_size
+/** Max size of a message (put, get, or reply) */
+extern size_t gupcr_max_msg_size;
+#define GUPCR_PORTALS_MAX_MSG_SIZE gupcr_max_msg_size
+/** Max size of a message that can use volatile memory descriptor */
+extern size_t gupcr_max_volatile_size;
+#define GUPCR_PORTALS_MAX_VOLATILE_SIZE gupcr_max_volatile_size
+
+//end lib_portals
+
+/** NULL value for matching bits */
+#define PTL_NO_MATCH_BITS ((ptl_match_bits_t) 0)
+/** NULL value for user pointer */
+#define PTL_NULL_USER_PTR ((void *) 0)
+/** NULL value for header data */
+#define PTL_NULL_HDR_DATA ((ptl_hdr_data_t) 0)
+/** Execute portals call and abort if error */
+#define gupcr_portals_call(portals_func, args) \
+ do \
+ { \
+ int pstatus; \
+ pstatus = portals_func args; \
+ if (pstatus != PTL_OK) \
+ gupcr_fatal_error ("UPC runtime Portals call " \
+ "`%s' on thread %d failed: %s\n", \
+ __STRING(portals_func), gupcr_get_rank (), \
+ gupcr_strptlerror (pstatus)); \
+ } \
+ while (0)
+
+/** Execute portals call and return status if there is no fatal error */
+#define gupcr_portals_call_with_status(portals_func, pstatus, args) \
+ do \
+ { \
+ pstatus = portals_func args; \
+ if ((pstatus != PTL_OK) && \
+ (pstatus != PTL_EQ_EMPTY) && \
+ (pstatus != PTL_CT_NONE_REACHED) && \
+ (pstatus != PTL_IN_USE) && \
+ (pstatus != PTL_INTERRUPTED)) \
+ gupcr_fatal_error ("UPC runtime Portals call " \
+ "`%s' on thread %d failed: %s\n", \
+ __STRING(portals_func), gupcr_get_rank (), \
+ gupcr_strptlerror (pstatus)); \
+ } \
+ while (0)
+
+/**
+ * @addtogroup GLOBAL GUPCR Global Variables
+ * @{
+ */
+
+/** Network Interface Handle */
+extern ptl_handle_ni_t gupcr_ptl_ni;
+/** Network Interface Limits */
+extern ptl_ni_limits_t gupcr_ptl_ni_limits;
+/** Thread's process info */
+extern ptl_process_t gupcr_ptl_myproc;
+/** Thread's rank */
+extern ptl_rank_t gupcr_ptl_rank;
+/** Thread's NID */
+extern ptl_nid_t gupcr_ptl_nid;
+/** Thread's PID */
+extern ptl_pid_t gupcr_ptl_pid;
+
+/* For the purposes of implementing GUPC barriers, all UPC threads
+ in a given job are organized as a tree. Thread 0 is the
+ root node (at the top of the tree). Other threads can represent
+ either an inner node (has at least one child), or a leaf
+ node (has no children). */
+
+/** Parent of the root thread */
+#define ROOT_PARENT -1
+
+/** Thread IDs of all children of the current thread. */
+extern int gupcr_child[GUPCR_TREE_FANOUT];
+/** Number of children of the current thread. */
+extern int gupcr_child_cnt;
+/** Parent thread ID of the current thread.
+ The tree root thread has a parent ID of -1. */
+extern int gupcr_parent_thread;
+
+/** @} */
+
+extern const char *gupcr_strptlerror (int);
+extern const char *gupcr_streqtype (ptl_event_kind_t);
+extern const char *gupcr_strptlop (ptl_op_t);
+extern const char *gupcr_strptldatatype (ptl_datatype_t);
+extern const char *gupcr_nifailtype (ptl_ni_fail_t);
+extern void gupcr_process_fail_events (ptl_handle_eq_t);
+extern ptl_datatype_t gupcr_get_atomic_datatype (int);
+extern size_t gupcr_get_atomic_size (ptl_datatype_t);
+extern int gupcr_get_rank (void);
+extern int gupcr_get_threads_count (void);
+extern int gupcr_get_rank_pid (int rank);
+extern int gupcr_get_rank_nid (int rank);
+extern void gupcr_startup_barrier (void);
+
+extern void gupcr_portals_init (void);
+extern void gupcr_portals_fini (void);
+extern void gupcr_portals_ni_init (void);
+extern void gupcr_portals_ni_fini (void);
+extern void gupcr_nodetree_setup (void);
+
+#endif /* gupcr_portals.h */
diff --git a/libgupc/portals4/gupcr_pts.h b/libgupc/portals4/gupcr_pts.h
new file mode 100644
index 00000000000..426091206d4
--- /dev/null
+++ b/libgupc/portals4/gupcr_pts.h
@@ -0,0 +1,193 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_pts.h
+ * GUPC Runtime pointer to shared definitions.
+ */
+
+#ifndef _GUPCR_PTS_H_
+#define _GUPCR_PTS_H_ 1
+
+//begin lib_pts_defs
+
+/* UPC pointer representation. */
+
+#if (defined (GUPCR_PTS_STRUCT_REP) + defined (GUPCR_PTS_WORD_PAIR_REP) \
+ + defined (GUPCR_PTS_PACKED_REP)) == 0
+#error Unknown PTS representation.
+#elif (defined (GUPCR_PTS_STRUCT_REP) + defined (GUPCR_PTS_WORD_PAIR_REP) \
+ + defined (GUPCR_PTS_PACKED_REP)) != 1
+#error Only one UPC shared pointer representation setting is permitted.
+#endif
+
+#ifdef GUPCR_PTS_STRUCT_REP
+
+#ifndef GUPCR_PTS_THREAD_FIELD
+#define GUPCR_PTS_THREAD_FIELD
+#endif
+#ifndef GUPCR_PTS_PHASE_FIELD
+#define GUPCR_PTS_PHASE_FIELD
+#endif
+#if GUPCR_PTS_THREAD_SIZE == 32
+#undef GUPCR_PTS_THREAD_TYPE
+#define GUPCR_PTS_THREAD_TYPE u_intSI_t
+#elif GUPCR_PTS_THREAD_SIZE == 16
+#undef GUPCR_PTS_THREAD_TYPE
+#define GUPCR_PTS_THREAD_TYPE u_intHI_t
+#endif
+#if GUPCR_PTS_PHASE_SIZE == 32
+#undef GUPCR_PTS_PHASE_TYPE
+#define GUPCR_PTS_PHASE_TYPE u_intSI_t
+#elif GUPCR_PTS_PHASE_SIZE == 16
+#undef GUPCR_PTS_PHASE_TYPE
+#define GUPCR_PTS_PHASE_TYPE u_intHI_t
+#endif
+
+#if !__GCC_UPC__
+/* The UPC compiler pre-defines upc_shared_ptr_t to be the
+ representation of a shared pointer. Since most of the
+ runtime is written in regular "C", we need to define
+ the pointer representation here. */
+typedef struct shared_ptr_struct
+{
+#if GUPCR_PTS_VADDR_FIRST
+ GUPCR_PTS_VADDR_TYPE vaddr;
+ GUPCR_PTS_THREAD_TYPE thread GUPCR_PTS_THREAD_FIELD;
+ GUPCR_PTS_PHASE_TYPE phase GUPCR_PTS_PHASE_FIELD;
+#else
+ GUPCR_PTS_PHASE_TYPE phase GUPCR_PTS_PHASE_FIELD;
+ GUPCR_PTS_THREAD_TYPE thread GUPCR_PTS_THREAD_FIELD;
+ GUPCR_PTS_VADDR_TYPE vaddr;
+#endif
+} upc_shared_ptr_t __attribute__ ((aligned (GUPCR_PTS_ALIGN)));
+typedef upc_shared_ptr_t *upc_shared_ptr_p;
+/* upc_dbg_shared_ptr_t is used by the debugger to figure out
+ shared pointer layout. */
+typedef upc_shared_ptr_t upc_dbg_shared_ptr_t;
+#endif
+
+#define GUPCR_PTS_TO_REP(V) *((upc_shared_ptr_t *)&(V))
+#define GUPCR_PTS_IS_NULL(P) (!(P).vaddr && !(P).thread && !(P).phase)
+#define GUPCR_PTS_SET_NULL_SHARED(P) \
+ {(P).vaddr = 0; (P).thread = 0; (P).phase = 0;}
+
+#define GUPCR_PTS_VADDR(P) ((size_t)(P).vaddr \
+ - (size_t)GUPCR_SHARED_SECTION_START)
+#define GUPCR_PTS_OFFSET(P) ((size_t)(P).vaddr \
+ - (size_t)GUPCR_SHARED_SECTION_START)
+#define GUPCR_PTS_THREAD(P) (P).thread
+#define GUPCR_PTS_PHASE(P) (P).phase
+
+#define GUPCR_PTS_SET_VADDR(P,V) (P).vaddr = (void *)((size_t)(V) \
+ + (size_t)GUPCR_SHARED_SECTION_START)
+#define GUPCR_PTS_INCR_VADDR(P,V) (P).vaddr += ((size_t)(V))
+#define GUPCR_PTS_SET_THREAD(P,V) (P).thread = (size_t)(V)
+#define GUPCR_PTS_SET_PHASE(P,V) (P).phase = (size_t)(V)
+
+#elif GUPCR_PTS_PACKED_REP
+
+#if GUPCR_PTS_VADDR_FIRST
+#define GUPCR_PTS_VADDR_SHIFT (GUPCR_PTS_THREAD_SHIFT \
+ + GUPCR_PTS_THREAD_SIZE)
+#define GUPCR_PTS_THREAD_SHIFT GUPCR_PTS_PHASE_SIZE
+#define GUPCR_PTS_PHASE_SHIFT 0
+#else
+#define GUPCR_PTS_VADDR_SHIFT 0
+#define GUPCR_PTS_THREAD_SHIFT GUPCR_PTS_VADDR_SIZE
+#define GUPCR_PTS_PHASE_SHIFT (GUPCR_PTS_THREAD_SHIFT \
+ + GUPCR_PTS_THREAD_SIZE)
+#endif
+#define GUPCR_PTS_TO_REP(V) *((upc_shared_ptr_t *)&(V))
+#if GUPCR_TARGET64
+#define GUPCR_ONE 1UL
+#define GUPCR_PTS_REP_T unsigned long
+#else
+#define GUPCR_ONE 1ULL
+#define GUPCR_PTS_REP_T unsigned long long
+#endif
+#define GUPCR_PTS_VADDR_MASK ((GUPCR_ONE << GUPCR_PTS_VADDR_SIZE) \
+ - GUPCR_ONE)
+#define GUPCR_PTS_THREAD_MASK ((GUPCR_ONE << GUPCR_PTS_THREAD_SIZE) \
+ - GUPCR_ONE)
+#define GUPCR_PTS_PHASE_MASK ((GUPCR_ONE << GUPCR_PTS_PHASE_SIZE) \
+ - GUPCR_ONE)
+
+#if !__GCC_UPC__
+/* upc_dbg_shared_ptr_t is used by debugger to figure out
+ shared pointer layout. */
+typedef struct shared_ptr_struct
+{
+#if GUPCR_PTS_VADDR_FIRST
+ unsigned long long vaddr:GUPCR_PTS_VADDR_SIZE;
+ unsigned int thread:GUPCR_PTS_THREAD_SIZE;
+ unsigned int phase:GUPCR_PTS_PHASE_SIZE;
+#else
+ unsigned int phase:GUPCR_PTS_PHASE_SIZE;
+ unsigned int thread:GUPCR_PTS_THREAD_SIZE;
+ unsigned long long vaddr:GUPCR_PTS_VADDR_SIZE;
+#endif
+} upc_dbg_shared_ptr_t;
+
+typedef GUPCR_PTS_REP_T upc_shared_ptr_t;
+typedef upc_shared_ptr_t *upc_shared_ptr_p;
+#endif
+
+#define GUPCR_PTS_IS_NULL(P) !(P)
+#define GUPCR_PTS_SET_NULL_SHARED(P) { (P) = 0; }
+
+/* access functions are optimized for a representation of the
+ form (vaddr,thread,phase) and where the value is unsigned.
+ Thus, right shift is logical (not arithmetic), and masking
+ is avoided for vaddr, and shifting is avoided for phase.
+ Further, the value being inserted must fit into the field.
+ It will not be masked. */
+#define GUPCR_PTS_VADDR(P) \
+ (void *)((size_t)((P)>>GUPCR_PTS_VADDR_SHIFT & GUPCR_PTS_VADDR_MASK))
+#define GUPCR_PTS_THREAD(P) ((size_t)((P)>>GUPCR_PTS_THREAD_SHIFT \
+ & GUPCR_PTS_THREAD_MASK))
+#define GUPCR_PTS_PHASE(P) ((size_t)((P)>>GUPCR_PTS_PHASE_SHIFT \
+ & GUPCR_PTS_PHASE_MASK))
+#define GUPCR_PTS_OFFSET(P) ((size_t)((P)>>GUPCR_PTS_VADDR_SHIFT \
+ & GUPCR_PTS_VADDR_MASK))
+
+#define GUPCR_PTS_SET_VADDR(P,V) \
+ (P) = ((P) & ~(GUPCR_PTS_VADDR_MASK << GUPCR_PTS_VADDR_SHIFT)) \
+ | ((GUPCR_PTS_REP_T)(V) << GUPCR_PTS_VADDR_SHIFT)
+#define GUPCR_PTS_SET_THREAD(P,V) (P) = ((P) \
+ & ~(GUPCR_PTS_THREAD_MASK << GUPCR_PTS_THREAD_SHIFT)) \
+ | ((GUPCR_PTS_REP_T)(V) << GUPCR_PTS_THREAD_SHIFT)
+#define GUPCR_PTS_SET_PHASE(P,V) (P) = ((P) \
+ & ~(GUPCR_PTS_PHASE_MASK << GUPCR_PTS_PHASE_SHIFT)) \
+ | ((GUPCR_PTS_REP_T)(V) << GUPCR_PTS_PHASE_SHIFT)
+#define GUPCR_PTS_INCR_VADDR(P,V) \
+ ((P) += ((GUPCR_PTS_REP_T)(V) << GUPCR_PTS_VADDR_SHIFT))
+#elif GUPCR_PTS_WORD_PAIR_REP
+#error UPC word pair representation is unsupported.
+#endif /* GUPCR_PTS_*_REP__ */
+//end lib_pts_defs
+
+#endif /* gupcr_pts.h */
diff --git a/libgupc/portals4/gupcr_runtime.c b/libgupc/portals4/gupcr_runtime.c
new file mode 100644
index 00000000000..866a946f6d5
--- /dev/null
+++ b/libgupc/portals4/gupcr_runtime.c
@@ -0,0 +1,368 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Copyright (c) 2011-2012, Sandia Corporation.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ . Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ . Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ . Neither the name of the Sandia Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE. */
+
+/**
+ * @file gupcr_runtime.c
+ * GUPC Portals4 Runtime.
+ */
+
+/**
+ * @addtogroup RUNTIME GUPCR PMI
+ * @{
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <portals4.h>
+#ifdef GUPCR_JOB_LAUNCHER_SLURM
+#include <slurm/pmi.h>
+#else
+#include <portals4/pmi.h>
+#endif
+
+struct map_t
+{
+ ptl_handle_ni_t handle;
+ ptl_process_t *mapping;
+};
+
+/** Process rank */
+static int rank = -1;
+/** Number of processes */
+static int size = 0;
+struct map_t maps[4] = {
+ {PTL_INVALID_HANDLE, NULL},
+ {PTL_INVALID_HANDLE, NULL},
+ {PTL_INVALID_HANDLE, NULL},
+ {PTL_INVALID_HANDLE, NULL}
+};
+
+static int max_name_len, max_key_len, max_val_len;
+static char *name, *key, *val;
+
+static int
+encode (const void *inval, int invallen, char *outval, int outvallen)
+{
+ static unsigned char encodings[] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+ };
+ int i;
+
+ if (invallen * 2 + 1 > outvallen)
+ {
+ return 1;
+ }
+
+ for (i = 0; i < invallen; i++)
+ {
+ outval[2 * i] = encodings[((unsigned char *) inval)[i] & 0xf];
+ outval[2 * i + 1] = encodings[((unsigned char *) inval)[i] >> 4];
+ }
+
+ outval[invallen * 2] = '\0';
+
+ return 0;
+}
+
+static int
+decode (const char *inval, void *outval, int outvallen)
+{
+ int i;
+ char *ret = (char *) outval;
+
+ if (outvallen != (int) (strlen (inval) / 2))
+ {
+ return 1;
+ }
+
+ for (i = 0; i < outvallen; ++i)
+ {
+ if (*inval >= '0' && *inval <= '9')
+ {
+ ret[i] = *inval - '0';
+ }
+ else
+ {
+ ret[i] = *inval - 'a' + 10;
+ }
+ inval++;
+ if (*inval >= '0' && *inval <= '9')
+ {
+ ret[i] |= ((*inval - '0') << 4);
+ }
+ else
+ {
+ ret[i] |= ((*inval - 'a' + 10) << 4);
+ }
+ inval++;
+ }
+
+ return 0;
+}
+
+int
+gupcr_runtime_init (void)
+{
+ int initialized;
+
+ if (PMI_SUCCESS != PMI_Initialized (&initialized))
+ {
+ return 1;
+ }
+
+ if (0 == initialized)
+ {
+ if (PMI_SUCCESS != PMI_Init (&initialized))
+ {
+ return 2;
+ }
+ }
+
+ if (PMI_SUCCESS != PMI_Get_rank (&rank))
+ {
+ return 3;
+ }
+
+ if (PMI_SUCCESS != PMI_Get_size (&size))
+ {
+ return 4;
+ }
+
+ /* Initialize key/val work strings. */
+
+ if (PMI_SUCCESS != PMI_KVS_Get_name_length_max (&max_name_len))
+ {
+ return 5;
+ }
+ name = (char *) malloc (max_name_len);
+ if (NULL == name)
+ return 5;
+
+ if (PMI_SUCCESS != PMI_KVS_Get_key_length_max (&max_key_len))
+ {
+ return 5;
+ }
+ key = (char *) malloc (max_key_len);
+ if (NULL == key)
+ return 5;
+
+ if (PMI_SUCCESS != PMI_KVS_Get_value_length_max (&max_val_len))
+ {
+ return 5;
+ }
+ val = (char *) malloc (max_val_len);
+ if (NULL == val)
+ return 5;
+
+ if (PMI_SUCCESS != PMI_KVS_Get_my_name (name, max_name_len))
+ {
+ return 5;
+ }
+
+ return 0;
+}
+
+int
+gupcr_runtime_fini (void)
+{
+ int i;
+
+ for (i = 0; i < 4; ++i)
+ {
+ if (NULL != maps[i].mapping)
+ {
+ free (maps[i].mapping);
+ }
+ }
+
+ PMI_Finalize ();
+
+ return 0;
+}
+
+ptl_process_t *
+gupcr_runtime_get_mapping (ptl_handle_ni_t ni_h)
+{
+ int i, ret;
+ ptl_process_t my_id;
+ struct map_t *map = NULL;
+
+ for (i = 0; i < 4; ++i)
+ {
+ if (maps[i].handle == ni_h)
+ {
+ return maps[i].mapping;
+ }
+ }
+
+ for (i = 0; i < 4; ++i)
+ {
+ if (PTL_INVALID_HANDLE == maps[i].handle)
+ {
+ map = &maps[i];
+ break;
+ }
+ }
+
+ if (NULL == map)
+ return NULL;
+
+ ret = PtlGetPhysId (ni_h, &my_id);
+ if (PTL_OK != ret)
+ return NULL;
+
+ /* Put my information. */
+ snprintf (key, max_key_len, "libgupc-%lu-%lu-nid",
+ (long unsigned) ni_h, (long unsigned) rank);
+ if (0 != encode (&my_id.phys.nid, sizeof (my_id.phys.nid), val,
+ max_val_len))
+ {
+ return NULL;
+ }
+ if (PMI_SUCCESS != PMI_KVS_Put (name, key, val))
+ {
+ return NULL;
+ }
+
+ snprintf (key, max_key_len, "libgupc-%lu-%lu-pid",
+ (long unsigned) ni_h, (long unsigned) rank);
+ if (0 != encode (&my_id.phys.pid, sizeof (my_id.phys.pid), val,
+ max_val_len))
+ {
+ return NULL;
+ }
+ if (PMI_SUCCESS != PMI_KVS_Put (name, key, val))
+ {
+ return NULL;
+ }
+
+ if (PMI_SUCCESS != PMI_KVS_Commit (name))
+ {
+ return NULL;
+ }
+
+ if (PMI_SUCCESS != PMI_Barrier ())
+ {
+ return NULL;
+ }
+
+ /* Get everyone's information. */
+ map->mapping = malloc (sizeof (ptl_process_t) * size);
+ if (NULL == map->mapping)
+ return NULL;
+
+ for (i = 0; i < size; ++i)
+ {
+ snprintf (key, max_key_len, "libgupc-%lu-%lu-nid",
+ (long unsigned) ni_h, (long unsigned) i);
+ if (PMI_SUCCESS != PMI_KVS_Get (name, key, val, max_val_len))
+ {
+ return NULL;
+ }
+ if (0 != decode (val, &(map->mapping)[i].phys.nid,
+ sizeof ((map->mapping)[i].phys.nid)))
+ {
+ return NULL;
+ }
+
+ snprintf (key, max_key_len, "libgupc-%lu-%lu-pid",
+ (long unsigned) ni_h, (long unsigned) i);
+ if (PMI_SUCCESS != PMI_KVS_Get (name, key, val, max_val_len))
+ {
+ return NULL;
+ }
+ if (0 != decode (val, &(map->mapping)[i].phys.pid,
+ sizeof ((map->mapping)[i].phys.pid)))
+ {
+ return NULL;
+ }
+ }
+
+ return map->mapping;
+}
+
+/**
+ * Return this process rank.
+ */
+int
+gupcr_runtime_get_rank (void)
+{
+ return rank;
+}
+
+/**
+ * Return number of processes in the system.
+ */
+int
+gupcr_runtime_get_size (void)
+{
+ return size;
+}
+
+/**
+ * Runtime barrier.
+ */
+void
+gupcr_runtime_barrier (void)
+{
+ PMI_Barrier ();
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_runtime.h b/libgupc/portals4/gupcr_runtime.h
new file mode 100644
index 00000000000..c5b08ebddcd
--- /dev/null
+++ b/libgupc/portals4/gupcr_runtime.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_RUNTIME_H_
+#define _GUPCR_RUNTIME_H_
+
+/**
+ * @file gupcr_runtime.h
+ * GUPC Portals4 Runtime.
+ */
+
+extern int gupcr_runtime_init (void);
+extern int gupcr_runtime_fini (void);
+extern int gupcr_runtime_get_rank (void);
+extern int gupcr_runtime_get_size (void);
+extern void gupcr_runtime_barrier (void);
+ptl_process_t *gupcr_runtime_get_mapping (ptl_handle_ni_t);
+#endif /* gupcr_runtime.h */
diff --git a/libgupc/portals4/gupcr_shutdown.c b/libgupc/portals4/gupcr_shutdown.c
new file mode 100644
index 00000000000..c892a281d87
--- /dev/null
+++ b/libgupc/portals4/gupcr_shutdown.c
@@ -0,0 +1,328 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_shutdown.c
+ * GUPC Portals4 shutdown support.
+ *
+ * Support for upc_global_exit ().
+ *
+ * Each UPC thread (process) creates a helper (shutdown) pthread
+ * with the sole purpose of waiting for receipt of a remote request
+ * to shutdown, as a result of the other thread issuing a call
+ * to upc_global_exit.
+ *
+ * This pthread uses a special PTE/LE (GUPCR_PTL_PTE_SHUTDOWN) to receive a
+ * global exit code from another UPC thread. A simple PtlPut of the
+ * exit code issued to the shutdown PTE on some other UPC thread
+ * triggers exit of the receiving thread.
+ *
+ * The following steps are taken to initialize, wait, and signal
+ * the UPC global exit:
+ *
+ * - Each thread initializes a PTE/LE to receive an exit code that
+ * was passed in as the argument to upc_global_exit().
+ * - Each thread creates a helper pthread - gupcr_shutdown_pthread()
+ * that waits on the shutdown LE's counting event (one count only).
+ * - The main UPC thread installs a signal handler for SHUTDWON_SIGNAL
+ * that is used by the shutdown pthread to signal a need for
+ * global exit.
+ * - Remote shutdown takes the following steps:
+ * -# A UPC thread executing a call to upc_global_exit() sends the
+ * exit code to all other UPC threads by using the shutdown PTE.
+ * -# The pthread associated with each UPC thread receives the
+ * exit code and returns from the counting event Portals
+ * wait call.
+ * -# The receiving pthread sends the SHUTDOWN_SIGNAL to the main
+ * UPC thread and calls pthread_exit().
+ * -# The main UPC thread receives the signal, which invokes
+ * the signal handler.
+ * -# The signal handler waits for the shutdown pthread to exit,
+ * and then calls exit() with the code received from
+ * the thread that sent the shutdown request. The invoking thread
+ * also waits for ACKs from the first step with the configured timeout,
+ *
+ * @note
+ * -# The gupcr_exit() function is registered with atexit()
+ * and will be executed when exit() is called.
+ * -# Upon regular exit, the main UPC thread disables the
+ * SHUTDOWN_SIGNAL signal, and terminates the shutdown pthread
+ * by writing a dummy value using its own shutdown PTE.
+ *
+ * @addtogroup SHUTDOWN GUPCR Shutdown Functions
+ * @{
+ */
+
+#include <pthread.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_utils.h"
+#include "gupcr_portals.h"
+#include "gupcr_shutdown.h"
+
+/** Shutdown signal to main thread */
+#define SHUTDOWN_SIGNAL SIGUSR2
+/** Shutdown check interval (100 miliseconds) */
+#define SHUTDOWN_MICROSEC_WAIT 100000L
+
+/** Shutdown LE buffer */
+static int gupcr_shutdown_status;
+/** Shutdown LE handle */
+static ptl_handle_le_t gupcr_shutdown_le;
+/** Shutdown LE event counter */
+static ptl_handle_ct_t gupcr_shutdown_le_ct;
+
+/** Shutdown memory buffer for sending data */
+static int gupcr_shutdown_send_status;
+/** Shutdown memory MD handle */
+static ptl_handle_md_t gupcr_shutdown_md;
+/** Shutdown memory MD event counter */
+static ptl_handle_ct_t gupcr_shutdown_md_ct;
+/** Shutdown memory MD event queue */
+static ptl_handle_eq_t gupcr_shutdown_md_eq;
+
+/** Shutdown pthread ID */
+static pthread_t gupcr_shutdown_pthread_id;
+/** Shutdown pthread declaration */
+static void *gupcr_shutdown_pthread (void *arg) __attribute__ ((noreturn));
+
+/**
+ * Send a remote shutdown request to all threads.
+ *
+ * Wait for the thread's pthread and ACks from sending
+ * messages to other threads (with timeout).
+ *
+ * @param [in] status exit code passed to other threads
+ */
+void
+gupcr_signal_exit (int status)
+{
+ int thread;
+ int wait_cnt = GUPCR_GLOBAL_EXIT_TIMEOUT *
+ (1000000L / SHUTDOWN_MICROSEC_WAIT);
+ int done = 0;
+ ptl_process_t pid;
+
+ /* Protect local global exit from remote shutdown request. */
+ gupcr_signal_disable (SHUTDOWN_SIGNAL);
+
+ gupcr_shutdown_send_status = status;
+ /* Send global exit code to all threads. */
+ for (thread = 0; thread < THREADS; thread++)
+ {
+ pid.rank = thread;
+ gupcr_portals_call (PtlPut, (gupcr_shutdown_md, 0,
+ sizeof (gupcr_shutdown_send_status),
+ PTL_CT_ACK_REQ, pid,
+ GUPCR_PTL_PTE_SHUTDOWN, PTL_NO_MATCH_BITS,
+ 0, PTL_NULL_USER_PTR, PTL_NULL_HDR_DATA));
+ }
+ /* It is NOT ok to call finalize routines as there might
+ be outstanding transactions. */
+ gupcr_finalize_ok = 0;
+ /* Wait for our own shutdown pthread to complete. */
+ pthread_join (gupcr_shutdown_pthread_id, NULL);
+ /* Wait for ACKs from all threads. It should happen quickly
+ if everything is ok, otherwise timeout after configured
+ number of seconds. */
+ do
+ {
+ ptl_ct_event_t ct = { 0, 0 };
+ gupcr_portals_call (PtlCTGet, (gupcr_shutdown_md_ct, &ct));
+ if ((ct.success + ct.failure) == (ptl_size_t) THREADS)
+ done = 1;
+ else
+ gupcr_cpu_delay (SHUTDOWN_MICROSEC_WAIT);
+ }
+ while (!done && wait_cnt--);
+}
+
+/**
+ * Terminate shutdown pthread
+ *
+ * To terminate the local shutdown pthread a dummy value must
+ * be sent by this thread to its own shutdown PTE. The main thread
+ * then waits for pthread to exit.
+ */
+static void
+gupcr_shutdown_terminate_pthread (void)
+{
+ ptl_process_t pid;
+ pid.rank = MYTHREAD;
+
+ /* Disable interrupts before sending a signal to
+ shutdown pthread. */
+ gupcr_signal_disable (SHUTDOWN_SIGNAL);
+
+ gupcr_shutdown_send_status = 0;
+ gupcr_portals_call (PtlPut, (gupcr_shutdown_md, 0,
+ sizeof (gupcr_shutdown_send_status),
+ PTL_NO_ACK_REQ, pid, GUPCR_PTL_PTE_SHUTDOWN,
+ PTL_NO_MATCH_BITS, 0, PTL_NULL_USER_PTR,
+ PTL_NULL_HDR_DATA));
+ pthread_join (gupcr_shutdown_pthread_id, NULL);
+}
+
+/**
+ * Shutdown pthread that waits for remote shutdown requests.
+ *
+ * This pthread waits on a shutdown PTE to receive a shutdown
+ * request from any other thread that executed upc_global_exit().
+ * Then, it uses signal (SHUTDOWN_SIGNAL) to inform the main thread
+ * of a need to shutdown this UPC thread.
+ * @param [in] arg Pthread arguments (not used in this case)
+ * @retval Pthread's exit value
+ */
+static void *
+gupcr_shutdown_pthread (void *arg __attribute ((unused)))
+{
+ ptl_ct_event_t ct = { 0, 0 };
+ int pstatus;
+
+ gupcr_log (FC_MISC, "Shutdown pthread started");
+ /* Wait for the shutdown request. Yield control of the
+ CPU frequently as this is a low priority activity
+ that should minimize competition for resources with the
+ main thread. */
+ do
+ {
+ gupcr_cpu_delay (SHUTDOWN_MICROSEC_WAIT);
+ gupcr_portals_call_with_status (PtlCTGet, pstatus,
+ (gupcr_shutdown_le_ct, &ct));
+ }
+ while (!(ct.success + ct.failure));
+ gupcr_debug (FC_MISC, "Shutdown pthread received exit %d",
+ gupcr_shutdown_status);
+
+ /* Signal the main thread to exit. */
+ kill (getpid (), SHUTDOWN_SIGNAL);
+ /* No need for this helper pthread any more. */
+ pthread_exit (NULL);
+}
+
+/**
+ * Signal handler that performs shutdown.
+ *
+ * This signal handler will terminate the pthread
+ * that listens for shutdown requests and then
+ * exit the current process (which is associated with
+ * a UPC thread). The UPC will exit with the
+ * the status code received from the remote thread.
+ * @param [in] signum Signal number (unused)
+ */
+void
+gupcr_shutdown_signal_handler (int signum __attribute__ ((unused)))
+{
+ gupcr_debug (FC_MISC, "Shutdown signal handler for signal %d", signum);
+ /* Wait for shutdown pthread to exit. */
+ pthread_join (gupcr_shutdown_pthread_id, NULL);
+ /* It is NOT ok to call finalize routines as there might
+ be outstanding transactions. */
+ gupcr_finalize_ok = 0;
+ /* Exit with global exit code. */
+ exit (gupcr_shutdown_status);
+}
+
+/**
+ * Initialize remote shutdown resources.
+ * @ingroup INIT
+ */
+void
+gupcr_shutdown_init (void)
+{
+ ptl_md_t md;
+ ptl_pt_index_t pte;
+ ptl_le_t le;
+
+ gupcr_log (FC_MISC, "shutdown init called");
+
+ /* Create the PTE used to communicate shutdown requests. */
+ gupcr_portals_call (PtlPTAlloc, (gupcr_ptl_ni, 0,
+ PTL_EQ_NONE, GUPCR_PTL_PTE_SHUTDOWN,
+ &pte));
+ gupcr_assert (pte != GUPCR_PTL_PTE_LOCK);
+
+ gupcr_debug (FC_MISC, "Shutdown PTE allocated: %d", GUPCR_PTL_PTE_SHUTDOWN);
+
+ /* Allocate the LE used for shutdown requests. */
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_shutdown_le_ct));
+ le.start = &gupcr_shutdown_status;
+ le.length = sizeof (gupcr_shutdown_status);
+ le.ct_handle = gupcr_shutdown_le_ct;
+ le.uid = PTL_UID_ANY;
+ le.options = PTL_LE_OP_PUT | PTL_LE_OP_GET | PTL_LE_EVENT_CT_COMM;
+ gupcr_portals_call (PtlLEAppend,
+ (gupcr_ptl_ni, GUPCR_PTL_PTE_SHUTDOWN, &le,
+ PTL_PRIORITY_LIST, NULL, &gupcr_shutdown_le));
+
+ gupcr_debug (FC_MISC, "Service LE created: %lx (%lx)",
+ (long unsigned) &gupcr_shutdown_status,
+ (long unsigned) sizeof (gupcr_shutdown_status));
+
+ /* Setup the MD used to send a shutdown request to other threads. */
+ gupcr_portals_call (PtlCTAlloc, (gupcr_ptl_ni, &gupcr_shutdown_md_ct));
+ gupcr_portals_call (PtlEQAlloc, (gupcr_ptl_ni, 1, &gupcr_shutdown_md_eq));
+
+ md.start = &gupcr_shutdown_send_status;
+ md.length = sizeof (gupcr_shutdown_send_status);
+ md.options = PTL_MD_EVENT_CT_ACK | PTL_MD_EVENT_SUCCESS_DISABLE;
+ md.eq_handle = gupcr_shutdown_md_eq;
+ md.ct_handle = gupcr_shutdown_md_ct;
+ gupcr_portals_call (PtlMDBind, (gupcr_ptl_ni, &md, &gupcr_shutdown_md));
+
+ /* Start a pthread that listens for remote shutdown requests. */
+ gupcr_syscall (pthread_create,
+ (&gupcr_shutdown_pthread_id, (pthread_attr_t *) NULL,
+ &gupcr_shutdown_pthread, NULL));
+
+ /* Install a signal handler that processes remote
+ shutdown global exit requests. */
+ gupcr_signal_enable (SHUTDOWN_SIGNAL, gupcr_shutdown_signal_handler);
+}
+
+/**
+ * Release remote shutdown resources.
+ * @ingroup INIT
+ */
+void
+gupcr_shutdown_fini (void)
+{
+ gupcr_log (FC_MISC, "shutdown fini called");
+
+ /* Terminate the shutdown pthread. */
+ gupcr_shutdown_terminate_pthread ();
+
+ /* Release the shutdown MD. */
+ gupcr_portals_call (PtlMDRelease, (gupcr_shutdown_md));
+ gupcr_portals_call (PtlCTFree, (gupcr_shutdown_md_ct));
+
+ /* Release the shutdown LE and PTE. */
+ gupcr_portals_call (PtlLEUnlink, (gupcr_shutdown_le));
+ gupcr_portals_call (PtlCTFree, (gupcr_shutdown_le_ct));
+ gupcr_portals_call (PtlPTFree, (gupcr_ptl_ni, GUPCR_PTL_PTE_SHUTDOWN));
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_shutdown.h b/libgupc/portals4/gupcr_shutdown.h
new file mode 100644
index 00000000000..a6c48e6fcf2
--- /dev/null
+++ b/libgupc/portals4/gupcr_shutdown.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _GUPCR_SHUTDOWN_H_
+#define _GUPCR_SHUTDOWN_H_
+
+/**
+ * @file gupcr_shutdown.h
+ * GUPC Portals4 shutdown support.
+ */
+
+extern void gupcr_signal_exit (int status);
+extern void gupcr_shutdown_init (void);
+extern void gupcr_shutdown_fini (void);
+
+#endif /* gupcr_shutdown.h */
diff --git a/libgupc/portals4/gupcr_sup.h b/libgupc/portals4/gupcr_sup.h
new file mode 100644
index 00000000000..e3753934218
--- /dev/null
+++ b/libgupc/portals4/gupcr_sup.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_sup.h
+ * GUPC Runtime prototypes to UPC specific functions.
+ */
+
+#ifndef _GUPCR_SUP_H_
+#define _GUPCR_SUP_H_
+
+/* Internal runtime routines and external symbols. */
+
+//begin lib_runtime_api
+
+extern void *__cvtaddr (upc_shared_ptr_t);
+extern void *__getaddr (upc_shared_ptr_t);
+extern void __upc_barrier (int barrier_id);
+extern void __upc_notify (int barrier_id);
+extern void __upc_wait (int barrier_id);
+extern void __upc_exit (int status) __attribute__ ((__noreturn__));
+
+//end lib_runtime_api
+
+#endif /* gupcr_sup.h */
diff --git a/libgupc/portals4/gupcr_sync.h b/libgupc/portals4/gupcr_sync.h
new file mode 100644
index 00000000000..cedb0763faf
--- /dev/null
+++ b/libgupc/portals4/gupcr_sync.h
@@ -0,0 +1,87 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_sync.h
+ * GUPC Runtime memory read/write sync definitions.
+ */
+
+#ifndef _GUPCR_SYNC_H_
+#define _GUPCR_SYNC_H_
+
+//begin lib_mem_barrier
+
+/*
+
+The following table is excerpted from
+"Implementing the UPC memory consistency model for
+shared-memory architectures", Dan Bonachea et al.
+
+CPU Write fence Read fence
+--------------------------------------------------
+Power/PowerPC sync isync
+Alpha wmb mb
+x86 lock; addl $0,0(%%esp) none reqd.
+Athlon/Opteron mfence none reqd.
+Itanium mf none reqd.
+SPARC stbar none reqd.
+MIPS sync none reqd.
+PA-RISC SYNC none reqd. */
+
+#define GUPCR_MEM_BARRIER() \
+ { GUPCR_READ_MEM_BARRIER (); GUPCR_WRITE_MEM_BARRIER (); }
+
+#if defined (PPC)
+#define GUPCR_WRITE_MEM_BARRIER() asm __volatile__ ("sync":::"memory")
+#define GUPCR_READ_MEM_BARRIER() asm __volatile__ ("isync":::"memory")
+#elif defined (alpha)
+#define GUPCR_WRITE_MEM_BARRIER() asm __volatile__ ("wmb":::"memory")
+#define GUPCR_READ_MEM_BARRIER() asm __volatile__ ("mb":::"memory")
+#elif defined (__x86_64__)
+#define GUPCR_WRITE_MEM_BARRIER() asm __volatile__ ("mfence":::"memory")
+#define GUPCR_READ_MEM_BARRIER() asm __volatile__ ("":::"memory")
+#elif defined (__ia64__)
+#define GUPCR_WRITE_MEM_BARRIER() asm __volatile__ ("mf":::"memory")
+#define GUPCR_READ_MEM_BARRIER() asm __volatile__ ("":::"memory")
+#elif defined (i386)
+#define GUPCR_WRITE_MEM_BARRIER() asm __volatile__ ( \
+ "lock; addl $0,0(%%esp)":::"memory")
+#define GUPCR_READ_MEM_BARRIER() asm __volatile__ ("":::"memory")
+#elif defined (sparc)
+#define GUPCR_WRITE_MEM_BARRIER() asm __volatile__ ("stbar":::"memory")
+#define GUPCR_READ_MEM_BARRIER() asm __volatile__ ("":::"memory")
+#elif defined (mips)
+#define GUPCR_WRITE_MEM_BARRIER() asm __volatile__ ("sync":::"memory")
+#define GUPCR_READ_MEM_BARRIER() asm __volatile__ ("":::"memory")
+#elif defined (hppa)
+#define GUPCR_WRITE_MEM_BARRIER() asm __volatile__ ("SYNC":::"memory")
+#define GUPCR_READ_MEM_BARRIER() asm __volatile__ ("":::"memory")
+#else
+#error "No memory fence operations provided for this cpu."
+#endif
+//end lib_mem_barrier
+
+#endif /* gupcr_sync.h */
diff --git a/libgupc/portals4/gupcr_tick.c b/libgupc/portals4/gupcr_tick.c
new file mode 100644
index 00000000000..aa5ca7f68e4
--- /dev/null
+++ b/libgupc/portals4/gupcr_tick.c
@@ -0,0 +1,77 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_lib.h"
+
+#if HAVE_CLOCK_GETTIME
+#ifdef CLOCK_MONOTONIC_RAW
+/* System clock id passed to clock_gettime. CLOCK_MONOTONIC_RAW
+ is preferred. It has been available in the Linux kernel
+ since version 2.6.28. */
+#define SYS_RT_CLOCK_ID CLOCK_MONOTONIC_RAW
+#else
+#define SYS_RT_CLOCK_ID CLOCK_MONOTONIC
+#endif
+
+upc_tick_t
+upc_ticks_now (void)
+{
+ struct timespec ts;
+ upc_tick_t t;
+ if (clock_gettime (SYS_RT_CLOCK_ID, &ts) != 0)
+ {
+ perror ("clock_gettime");
+ abort ();
+ }
+ t = (upc_tick_t) ts.tv_sec * 1000000000LL + (upc_tick_t) ts.tv_nsec;
+ return t;
+}
+
+#else /* not HAVE_CLOCK_GETTIME */
+
+upc_tick_t
+upc_ticks_now (void)
+{
+ struct timeval tv;
+ upc_tick_t t;
+ if (gettimeofday (&tv, NULL) != 0)
+ {
+ perror ("gettimeofday");
+ abort ();
+ }
+ t = tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
+ return t;
+}
+
+#endif
+
+uint64_t
+upc_ticks_to_ns (upc_tick_t ticks)
+{
+ return ticks;
+}
diff --git a/libgupc/portals4/gupcr_utils.c b/libgupc/portals4/gupcr_utils.c
new file mode 100644
index 00000000000..b768ea0dc8f
--- /dev/null
+++ b/libgupc/portals4/gupcr_utils.c
@@ -0,0 +1,820 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_utils.c
+ * GUPC Runtime utility routines
+ */
+
+/**
+ * @addtogroup GUPCUTILS GUPCR Utility Functions
+ * @{
+ */
+
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_portals.h"
+#include "gupcr_runtime.h"
+#include "gupcr_utils.h"
+
+#define PATH_SEP '/'
+
+typedef struct gupcr_open_file_struct *gupcr_open_file_ref;
+typedef struct gupcr_open_file_struct
+{
+ gupcr_open_file_ref next;
+ FILE *file_ptr;
+ const char *pathname;
+} gupcr_open_file_t;
+
+static void gupcr_close_all_open_files (void);
+static void gupcr_debug_fini (void);
+static void gupcr_debug_init (void);
+static FILE *gupcr_find_open_file (const char *pathname);
+static void gupcr_open_file_list_add (FILE * file, const char *pathname);
+static void gupcr_set_short_pgm_name (void);
+static void gupcr_stats_fini (void);
+static void gupcr_stats_init (void);
+static void gupcr_trace_fini (void);
+static void gupcr_trace_init (void);
+static void gupcr_write_log (FILE * file, const char *filename,
+ const char *fmt, va_list ap);
+
+static int gupcr_is_init;
+static int gupcr_error_count;
+static const char *gupcr_pgm_name = "";
+static char gupcr_short_pgm_name[13];
+static int gupcr_pid;
+static char gupcr_pid_string[13];
+static int gupcr_inform_user = 1;
+static int gupcr_warn_user = 1;
+static size_t gupcr_shared_heap_size;
+static int gupcr_node_local_memory = 1;
+static int gupcr_forcetouch = 1;
+static int gupcr_backtrace = 0;
+
+static gupcr_open_file_ref gupcr_open_files_list;
+static int gupcr_debug_enabled;
+static const char *gupcr_debug_filename = "stderr";
+static FILE *gupcr_debug_file;
+static int gupcr_log_enabled;
+static const char *gupcr_log_filename = "stderr";
+static FILE *gupcr_log_file;
+static int gupcr_stats_enabled;
+static const char *gupcr_stats_filename = "stderr";
+static FILE *gupcr_stats_file __attribute ((unused));
+static int gupcr_trace_enabled;
+static const char *gupcr_trace_filename = "stderr";
+static FILE *gupcr_trace_file;
+
+gupcr_facility_t gupcr_debug_facility_mask;
+gupcr_facility_t gupcr_log_facility_mask;
+gupcr_facility_t gupcr_stats_facility_mask;
+gupcr_facility_t gupcr_trace_facility_mask;
+
+const char *
+gupcr_strsignal (int sig)
+{
+ return strsignal (sig);
+}
+
+const char *
+gupcr_strerror (void)
+{
+ return strerror (errno);
+}
+
+void
+gupcr_signal_enable (int signal, void (*handler) (int))
+{
+ struct sigaction action;
+
+ action.sa_handler = handler;
+ sigemptyset (&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction (signal, &action, NULL);
+}
+
+void
+gupcr_signal_disable (int signal)
+{
+ struct sigaction action;
+
+ action.sa_handler = SIG_IGN;
+ sigemptyset (&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction (signal, &action, NULL);
+}
+
+static void
+gupcr_write_log (FILE * file, const char *filename,
+ const char *fmt, va_list ap)
+{
+ const double timestamp = gupcr_clock ();
+ static double prev_timestamp;
+ double delta_timestamp;
+ char buf[1024];
+ char *bp = buf;
+ va_list args;
+ delta_timestamp = timestamp - prev_timestamp;
+ prev_timestamp = timestamp;
+ bp += sprintf (bp, "%lld ", (long long) (timestamp * 1.0e6));
+ bp += sprintf (bp, "%#.3g%s ",
+ ((delta_timestamp > 1.0) ? 1.0
+ : ((delta_timestamp > 0.001) ? 1.0e3 : 1.0e6))
+ * delta_timestamp,
+ ((delta_timestamp > 1.0) ? "s"
+ : ((delta_timestamp > 0.001) ? "m" : "u")));
+ if (MYTHREAD >= 0 && MYTHREAD < THREADS)
+ bp += sprintf (bp, "%d ", MYTHREAD);
+ else
+ bp += sprintf (bp, "??? ");
+ va_copy (args, ap);
+ bp += vsprintf (bp, fmt, args);
+ va_end (args);
+ if (fputs (buf, file) == EOF)
+ gupcr_abort_with_msg ("UPC runtime write to `%s' failed: %s",
+ filename, gupcr_strerror ());
+}
+
+void
+gupcr_abort (void)
+{
+ gupcr_utils_fini ();
+ abort ();
+}
+
+/* NOTE: registered as an exit routine. */
+void
+gupcr_exit ()
+{
+ if (gupcr_finalize_ok)
+ gupcr_fini ();
+ else
+ {
+ gupcr_runtime_fini ();
+ gupcr_utils_fini ();
+ }
+}
+
+void
+gupcr_shutdown (int exit_code)
+{
+ exit (exit_code);
+}
+
+void
+gupcr_abort_with_msg (const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ vfprintf (stderr, fmt, args);
+ va_end (args);
+ gupcr_abort ();
+}
+
+const char *
+gupcr_get_pid_as_string (void)
+{
+ return gupcr_pid_string;
+}
+
+const char *
+gupcr_get_pgm_name (void)
+{
+ return gupcr_pgm_name;
+}
+
+void
+gupcr_set_pgm_name (const char *pgm_name)
+{
+ gupcr_pgm_name = pgm_name;
+}
+
+void
+gupcr_init_complete (void)
+{
+ gupcr_is_init = 1;
+ if (gupcr_error_count)
+ gupcr_abort ();
+}
+
+void
+gupcr_be_quiet (void)
+{
+ gupcr_inform_user = 0;
+ gupcr_warn_user = 0;
+}
+
+void
+gupcr_no_warn (void)
+{
+ gupcr_warn_user = 0;
+}
+
+void
+gupcr_set_shared_heap_size (size_t heap_size)
+{
+ gupcr_shared_heap_size = heap_size;
+}
+
+size_t
+gupcr_get_shared_heap_size (void)
+{
+ return gupcr_shared_heap_size;
+}
+
+void
+gupcr_set_node_local_memory (int value)
+{
+ gupcr_node_local_memory = value;
+}
+
+int
+gupcr_is_node_local_memory_enabled (void)
+{
+ return gupcr_node_local_memory;
+}
+
+void
+gupcr_set_forcetouch (int value)
+{
+ gupcr_forcetouch = value;
+}
+
+int
+gupcr_is_forcetouch_enabled (void)
+{
+ return gupcr_forcetouch;
+}
+
+void
+gupcr_set_backtrace (int value)
+{
+ gupcr_backtrace = value;
+}
+
+int
+gupcr_is_backtrace_enabled (void)
+{
+ return gupcr_backtrace;
+}
+
+/** Node local unique name. */
+#define GUPCR_LOCAL_NAME_FMT "-%06d-%06d"
+#define GUPCR_LOCAL_NAME_FMT_SIZE 14
+
+void
+gupcr_unique_local_name (char *fname, const char *prefix, int thread,
+ int tmpenv)
+{
+ const char *tmpdir = NULL;
+ char *n = fname;
+ *n = 0;
+ if (tmpenv)
+ {
+ /* Honor TMDIR and/or TMP environment variables. */
+ if ((getuid () == geteuid ()) && (getgid () == getegid ()))
+ {
+ tmpdir = getenv ("TMPDIR");
+ if (!tmpdir)
+ tmpdir = getenv ("TMP");
+ }
+ if (!tmpdir)
+ tmpdir = "/tmp";
+ if (strlen (tmpdir) > FILENAME_MAX)
+ gupcr_fatal_error ("tmp path too long: %s", tmpdir);
+ strcpy (n, tmpdir);
+ n = n + strlen (n);
+ strcat (n, "/");
+ n = n + 1;
+ }
+ if (strlen (n) + strlen (prefix) + GUPCR_LOCAL_NAME_FMT_SIZE > FILENAME_MAX)
+ gupcr_fatal_error ("unique local name too long");
+ sprintf (n, "%s" GUPCR_LOCAL_NAME_FMT, prefix, thread,
+ gupcr_get_rank_pid (thread));
+}
+
+/* Convert buffer to string (max of 16 characters) */
+const char *
+gupcr_get_buf_as_hex (char *bufstr, const void *buf, size_t size)
+{
+ size_t cnt = (size > 16) ? 16 : size;
+ bufstr[0] = 0;
+ if (cnt > 0)
+ {
+ char *tmp = bufstr;
+ size_t i;
+ for (i = 0; i < cnt - 1; ++i)
+ {
+ sprintf (tmp, "%02x ", ((unsigned char *) buf)[i]);
+ tmp += 3;
+ }
+ sprintf (tmp, "%02x", ((unsigned char *) buf)[cnt - 1]);
+ }
+ return bufstr;
+}
+
+void
+gupcr_error_print (const char *fmt, ...)
+{
+ va_list args;
+ gupcr_assert (MYTHREAD >= 0);
+ /* If the runtime has not initialized yet, print the
+ error message on thread 0 only. */
+ if (gupcr_is_init || MYTHREAD == 0)
+ {
+ va_start (args, fmt);
+ vfprintf (stderr, fmt, args);
+ va_end (args);
+ }
+ /* Abort is deferred until the runtime has initialized
+ so that all non-fatal error diagnostics are printed
+ before the program aborts. */
+ if (gupcr_is_init)
+ gupcr_abort ();
+ ++gupcr_error_count;
+}
+
+void
+gupcr_warn_print (const char *fmt, ...)
+{
+ if (gupcr_warn_user)
+ {
+ va_list args;
+ va_start (args, fmt);
+ vfprintf (stderr, fmt, args);
+ va_end (args);
+ }
+}
+
+void
+gupcr_info_print (const char *fmt, ...)
+{
+ if (gupcr_inform_user)
+ {
+ va_list args;
+ va_start (args, fmt);
+ vfprintf (stderr, fmt, args);
+ va_end (args);
+ }
+}
+
+void
+gupcr_debug_print (const char *fmt, ...)
+{
+ if (gupcr_debug_enabled)
+ {
+ va_list args;
+ if (!gupcr_debug_file)
+ {
+ gupcr_assert (gupcr_debug_filename != NULL);
+ gupcr_debug_file = gupcr_fopen ("debug", gupcr_debug_filename, "w");
+ }
+ va_start (args, fmt);
+ gupcr_write_log (gupcr_debug_file, gupcr_debug_filename, fmt, args);
+ va_end (args);
+ }
+}
+
+void
+gupcr_set_debug_facility (gupcr_facility_t facility_mask)
+{
+ gupcr_debug_facility_mask = facility_mask;
+ gupcr_debug_enabled = (facility_mask != 0);
+}
+
+void
+gupcr_set_debug_filename (const char *filename)
+{
+ gupcr_assert (filename != NULL);
+ gupcr_debug_filename = filename;
+}
+
+void
+gupcr_log_print (const char *fmt, ...)
+{
+ if (gupcr_log_enabled)
+ {
+ va_list args;
+ if (!gupcr_log_file)
+ {
+ gupcr_assert (gupcr_log_filename != NULL);
+ gupcr_log_file = gupcr_fopen ("debug", gupcr_log_filename, "w");
+ }
+ va_start (args, fmt);
+ gupcr_write_log (gupcr_log_file, gupcr_log_filename, fmt, args);
+ va_end (args);
+ }
+}
+
+void
+gupcr_set_log_facility (gupcr_facility_t facility_mask)
+{
+ gupcr_log_facility_mask = facility_mask;
+ gupcr_log_enabled = (facility_mask != 0);
+}
+
+void
+gupcr_set_log_filename (const char *filename)
+{
+ gupcr_assert (filename != NULL);
+ gupcr_log_filename = filename;
+}
+
+void
+gupcr_set_stats_facility (gupcr_facility_t facility_mask)
+{
+ gupcr_stats_facility_mask = facility_mask;
+ gupcr_stats_enabled = (facility_mask != 0);
+}
+
+void
+gupcr_set_stats_filename (const char *filename)
+{
+ gupcr_assert (filename != NULL);
+ gupcr_stats_filename = filename;
+}
+
+void
+gupcr_trace_print (const char *fmt, ...)
+{
+ if (gupcr_trace_enabled)
+ {
+ va_list args;
+ if (!gupcr_trace_file)
+ {
+ gupcr_assert (gupcr_trace_filename != NULL);
+ gupcr_trace_file = gupcr_fopen ("trace", gupcr_trace_filename, "w");
+ }
+ va_start (args, fmt);
+ gupcr_write_log (gupcr_trace_file, gupcr_trace_filename, fmt, args);
+ va_end (args);
+ }
+}
+
+void
+gupcr_set_trace_facility (gupcr_facility_t facility_mask)
+{
+ gupcr_trace_facility_mask = facility_mask;
+ gupcr_trace_enabled = (facility_mask != 0);
+}
+
+void
+gupcr_set_trace_filename (const char *filename)
+{
+ gupcr_assert (filename != NULL);
+ gupcr_trace_filename = filename;
+}
+
+static void
+gupcr_set_short_pgm_name (void)
+{
+ char *pgm_name, *filename, *cp;
+ gupcr_strdup (pgm_name, gupcr_pgm_name);
+ filename = basename (pgm_name);
+ gupcr_assert ((sizeof (gupcr_short_pgm_name) - 1) == 12);
+ strncpy (gupcr_short_pgm_name, filename, 12);
+ gupcr_short_pgm_name[12] = '\0';
+ for (cp = gupcr_short_pgm_name; *cp; ++cp)
+ {
+ if (!(isalnum (*cp) || *cp == '_' || *cp == '.'))
+ *cp = '_';
+ }
+ gupcr_free (pgm_name);
+}
+
+static FILE *
+gupcr_find_open_file (const char *pathname)
+{
+ gupcr_open_file_ref f;
+ for (f = gupcr_open_files_list; f; f = f->next)
+ {
+ if (!strcmp (f->pathname, pathname))
+ return f->file_ptr;
+ }
+ return NULL;
+}
+
+static void
+gupcr_open_file_list_add (FILE * file, const char *pathname)
+{
+ gupcr_open_file_ref open_file;
+ gupcr_assert (file != NULL);
+ gupcr_assert (pathname != NULL && pathname[0]);
+ gupcr_malloc (open_file, sizeof (gupcr_open_file_t));
+ open_file->next = gupcr_open_files_list;
+ gupcr_strdup (open_file->pathname, pathname);
+ open_file->file_ptr = file;
+ gupcr_open_files_list = open_file;
+}
+
+FILE *
+gupcr_fopen (const char *purpose, const char *pathname, const char *mode)
+{
+ FILE *file, *already_open;
+ already_open = gupcr_find_open_file (pathname);
+ if (already_open)
+ file = already_open;
+ else
+ {
+ if (!strcmp (mode, "w"))
+ /* Create any intervening directories. */
+ gupcr_mkpath (pathname);
+ file = fopen (pathname, mode);
+ if (!file)
+ gupcr_error ("UPC runtime cannot open %s file `%s' for %s: %s",
+ purpose, pathname,
+ !strcmp (mode, "r") ? "read" : "write",
+ errno ? gupcr_strerror () : "unknown reason");
+ gupcr_open_file_list_add (file, pathname);
+ }
+ return file;
+}
+
+static void
+gupcr_close_all_open_files (void)
+{
+ gupcr_open_file_ref f, f_next;
+ for (f = gupcr_open_files_list; f; f = f_next)
+ {
+ f_next = f->next;
+ gupcr_assert (f->file_ptr != NULL);
+ (void) fclose (f->file_ptr);
+ gupcr_free ((void *) f->pathname);
+ gupcr_free (f);
+ }
+}
+
+void
+gupcr_mkpath (const char *const path)
+{
+ char *path_dup, *dirpath;
+ gupcr_strdup (path_dup, path);
+ dirpath = dirname (path_dup);
+ if (strcmp (dirpath, ".") != 0 && strcmp (dirpath, "/") != 0)
+ {
+ char *dir, *p;
+ int nlevels;
+ for (p = dirpath, nlevels = 0;
+ (dir = strtok (p, "/")); p = NULL, ++nlevels)
+ {
+ gupcr_mkdir_unless_exists (dir);
+ gupcr_syscall (chdir, (dir));
+ }
+ while (nlevels--)
+ gupcr_syscall (chdir, (".."));
+ }
+ gupcr_free (path_dup);
+}
+
+/* Parse the numeric string given by STR_ARG, and
+ multiply it by any scaling factor ('K', 'M', or 'G')
+ if present and return the result. If the conversion
+ is successful then *STATUS will be 0. Otherwise,
+ -1 There are no valid digits in the input string.
+ -2 There are extra characters in the multiplier suffix.
+ -3 The multiplier suffix specifies an invalid character.
+ -4 The number is out-of-range. */
+
+long long
+gupcr_strtoll (const char *const str,
+ long long int min_val, long long int max_val, int *status)
+{
+ long long result = 0;
+ *status = 0;
+ if (str && str[0])
+ {
+ char *suffix;
+ errno = 0;
+ result = strtoll (str, &suffix, 0);
+ if (errno == ERANGE)
+ /* Underflow/Overflow. */
+ *status = -4;
+ else if (suffix[0])
+ {
+ if (suffix == str)
+ *status = -1;
+ else if (suffix[1] && suffix[2])
+ *status = -2;
+ else if (suffix[1] && suffix[1] != 'B' && suffix[1] != 'b')
+ *status = -2;
+ else
+ {
+ int shift_count = 0;
+ long long int tmp_result = result;
+ switch (suffix[0])
+ {
+ case 'k':
+ case 'K':
+ shift_count = 10;
+ break;
+ case 'm':
+ case 'M':
+ shift_count = 20;
+ break;
+ case 'g':
+ case 'G':
+ shift_count = 30;
+ break;
+ case 't':
+ case 'T':
+ shift_count = 40;
+ break;
+ default:
+ *status = -3;
+ break;
+ }
+ if (!*status && shift_count)
+ {
+ const int is_neg = (tmp_result < 0);
+ unsigned int i;
+ tmp_result = is_neg ? -tmp_result : tmp_result;
+ if (tmp_result >= 0)
+ {
+ for (i = shift_count; i > 0; --i)
+ {
+ tmp_result <<= 1;
+ if (tmp_result < 0 && !(is_neg && i == 1))
+ {
+ *status = -4;
+ break;
+ }
+ }
+ }
+ else
+ *status = -4;
+ if (*status)
+ result = is_neg ? LLONG_MIN : LLONG_MAX;
+ else
+ result = is_neg ? -tmp_result : tmp_result;
+ }
+ }
+ }
+ if (!*status && (result < min_val || result > max_val))
+ *status = -4;
+ }
+ else
+ *status = -1;
+ return result;
+}
+
+/* Given a non-zero status returned from calling gupcr_strtoll()
+ with the STR argument, print an informative error message. */
+
+void
+gupcr_strtoll_error (const char *const str,
+ long long int val_min, long long int val_max, int status)
+{
+ gupcr_assert (status < 0 && status >= -4);
+ switch (status)
+ {
+ case -1:
+ gupcr_error ("there are no valid digits in " "the value: `%s'", str);
+ break;
+ case -2:
+ gupcr_error ("there are extra characters in "
+ "the multiplier suffix: `%s'", str);
+ break;
+ case -3:
+ gupcr_error ("invalid multiplier suffix; the suffix "
+ "may be K, M, G, or T: `%s'", str);
+ break;
+ case -4:
+ gupcr_error ("the value `%s' is out of range; it must be "
+ "in the range %lld .. %lld", str, val_min, val_max);
+ break;
+ default:
+ gupcr_fatal_error ("unreachable statement");
+ break;
+ }
+}
+
+/* Given a "tag" (a relative filename ending in XXXXXX),
+ create a temporary file using the tag.
+ Return a file descriptor associated with the newly
+ created temporary file.
+ [see: http://www.linux.com/howtos/Secure-Programs-HOWTO/avoid-race.shtml] */
+
+int
+gupcr_create_temp_file (const char *tag, char *tmp_fname,
+ const char **err_msg)
+{
+ const char *tmpdir = NULL;
+ mode_t old_mode;
+ int fd;
+ if ((getuid () == geteuid ()) && (getgid () == getegid ()))
+ {
+ tmpdir = getenv ("TMPDIR");
+ if (!tmpdir)
+ tmpdir = getenv ("TMP");
+ }
+ if (!tmpdir)
+ tmpdir = "/tmp";
+ sprintf (tmp_fname, "%s/%s", tmpdir, tag);
+ /* Create file with restrictive permissions */
+ old_mode = umask (077);
+ fd = mkstemp (tmp_fname);
+ (void) umask (old_mode);
+ if (fd < 0)
+ *err_msg = "Couldn't open temporary file";
+ return fd;
+}
+
+static void
+gupcr_debug_init (void)
+{
+ if (gupcr_debug_enabled)
+ {
+ gupcr_log (FC_ALL, "GUPCR debug enabled");
+ }
+}
+
+static void
+gupcr_stats_init (void)
+{
+ if (gupcr_stats_enabled)
+ {
+ gupcr_log (FC_ALL, "GUPCR stats enabled");
+ }
+}
+
+static void
+gupcr_trace_init (void)
+{
+ if (gupcr_trace_enabled)
+ {
+ gupcr_log (FC_ALL, "GUPCR trace enabled");
+ }
+}
+
+static void
+gupcr_debug_fini (void)
+{
+}
+
+static void
+gupcr_stats_fini (void)
+{
+}
+
+static void
+gupcr_trace_fini (void)
+{
+}
+
+void
+gupcr_utils_init (void)
+{
+ gupcr_pid = getpid ();
+ sprintf (gupcr_pid_string, "%d", gupcr_pid);
+ gupcr_shared_heap_size = GUPCR_DEFAULT_PER_THREAD_HEAP_SIZE;
+ gupcr_set_short_pgm_name ();
+ gupcr_inform_user = 1;
+ gupcr_warn_user = 1;
+ if (stdin)
+ gupcr_open_file_list_add (stdin, "stdin");
+ if (stdout)
+ gupcr_open_file_list_add (stdout, "stdout");
+ if (stderr)
+ gupcr_open_file_list_add (stderr, "stderr");
+ gupcr_env_init ();
+ gupcr_debug_init ();
+ gupcr_stats_init ();
+ gupcr_trace_init ();
+ gupcr_clock_init ();
+}
+
+void
+gupcr_utils_fini (void)
+{
+ gupcr_trace_fini ();
+ gupcr_stats_fini ();
+ gupcr_debug_fini ();
+ gupcr_close_all_open_files ();
+}
+
+/** @} */
diff --git a/libgupc/portals4/gupcr_utils.h b/libgupc/portals4/gupcr_utils.h
new file mode 100644
index 00000000000..ac4ef100299
--- /dev/null
+++ b/libgupc/portals4/gupcr_utils.h
@@ -0,0 +1,327 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/**
+ * @file gupcr_utils.h
+ * GUPC Runtime utility routines
+ */
+
+/**
+ * @addtogroup GUPCUTILS GUPCR Utility Functions
+ * @{
+ */
+
+#ifndef _GUPCR_UTILS_H_
+
+//begin lib_utils_api
+#define _GUPCR_UTILS_H_ 1
+
+#ifndef __STRING
+/** Return 'x' argument as string */
+#define __STRING(x) #x
+#endif
+
+/* Give up control of the CPU for a small time interval. */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#define gupcr_yield_cpu() do { sched_yield (); } while (0)
+#else
+#define gupcr_yield_cpu() do { usleep (1000L); } while (0)
+#endif
+
+/* Give up control of the CPU for specified amount of time. */
+#define gupcr_cpu_delay(MICROSECS) do { usleep(MICROSECS); } while (0)
+
+/* The definitions below use GCC's extensions to variadic macros.
+ * See: http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
+ * These extensions permit empty variadic arg lists. */
+
+#define gupcr_error(fmt, args...) \
+ gupcr_error_print ("%s: UPC error: " fmt "\n", \
+ gupcr_get_pgm_name (), ##args)
+
+#define gupcr_warn(fmt, args...) \
+ gupcr_warn_print ("%s: UPC warning: " fmt "\n", \
+ gupcr_get_pgm_name (), ##args)
+
+#define gupcr_info(fmt, args...) \
+ gupcr_info_print ("%s: UPC info: " fmt "\n", \
+ gupcr_get_pgm_name (), ##args)
+
+#define gupcr_fatal_error(fmt, args...) \
+ gupcr_abort_with_msg ("[%d] %s: %s:%d: %s: " fmt "\n", \
+ MYTHREAD, gupcr_get_pgm_name (), \
+ __FILE__, __LINE__, __func__, ##args)
+
+#ifdef GUPCR_HAVE_CHECKS
+#define gupcr_assert(expr) (expr) ? (void)(0) \
+ : gupcr_fatal_error ("UPC runtime assertion `%s' failed", \
+ __STRING (expr))
+#else
+#define gupcr_assert(expr)
+#endif
+
+#define gupcr_syscall(syscall, args) \
+ do \
+ { \
+ int status; \
+ status = syscall args; \
+ if (status < 0) \
+ gupcr_fatal_error ("UPC runtime system call `%s' failed: %s", \
+ __STRING (syscall), \
+ gupcr_strerror ()); \
+ } \
+ while (0)
+
+#define gupcr_getcwd(path) \
+ do \
+ { \
+ path = getcwd (NULL, 0); \
+ if (!path) \
+ gupcr_fatal_error ("UPC runtime `getcwd' failed: %s", \
+ gupcr_strerror ()); \
+ } \
+ while (0)
+
+#define gupcr_mkdir_unless_exists(dir) \
+ do \
+ { \
+ int status; \
+ status = mkdir (dir, 0755); \
+ if (status < 0 && errno != EEXIST) \
+ gupcr_fatal_error ("UPC runtime `mkdir' of `%s' failed: %s", \
+ dir, __STRING (syscall)); \
+ } \
+ while (0)
+
+#define gupcr_malloc(ptr, size) \
+ do \
+ { \
+ ptr = malloc (size); \
+ if (!ptr) \
+ gupcr_fatal_error ("UPC runtime malloc of %lld bytes failed", \
+ (long long int)size); \
+ } \
+ while (0)
+
+#define gupcr_strdup(str, orig) \
+ do \
+ { \
+ if (!orig) \
+ gupcr_fatal_error ("UPC runtime attempt to " \
+ "duplicate a null string"); \
+ str = strdup (orig); \
+ if (!str) \
+ gupcr_fatal_error ("UPC runtime strdup of %ld bytes failed", \
+ (long int)strlen (orig)); \
+ } \
+ while (0)
+
+
+#define gupcr_free(ptr) \
+ do \
+ { \
+ if (!ptr) \
+ gupcr_fatal_error ("UPC runtime attempt to " \
+ "free a null pointer"); \
+ free (ptr); \
+ } \
+ while (0)
+
+#ifdef GUPCR_HAVE_DEBUG
+#define gupcr_debug_enabled(facility) \
+ (((facility) & gupcr_debug_facility_mask) != 0)
+#define gupcr_debug(facility, fmt, args...) \
+ if (gupcr_debug_enabled (facility)) \
+ gupcr_debug_print ("%s: " fmt "\n", __func__ , ##args)
+#define gupcr_log(facility, fmt, args...) \
+ if (facility & gupcr_log_facility_mask) \
+ gupcr_log_print (fmt "\n", ##args)
+#define gupcr_stats(facility, fmt, args...) \
+ if (facility & gupcr_stats_facility_mask) \
+ gupcr_stats_print (fmt "\n", ##args)
+#define gupcr_trace(facility, fmt, args...) \
+ if (facility & gupcr_trace_facility_mask) \
+ gupcr_trace_print (fmt "\n", ##args)
+#else
+#define gupcr_debug_enabled(facility) (0)
+#define gupcr_debug(facility, fmt, args...)
+#define gupcr_log(facility, fmt, args...)
+#define gupcr_stats(facility, fmt, args...)
+#define gupcr_trace(facility, fmt, args...)
+#endif
+
+typedef enum
+{
+ FC_NONE = 0b0000000000000,
+ FC_ADDR = 0b0000000000001,
+ FC_ALLOC = 0b0000000000010,
+ FC_ATOMIC = 0b0000000000100,
+ FC_BARRIER = 0b0000000001000,
+ FC_BROADCAST = 0b0000000010000,
+ FC_COLL = 0b0000000100000,
+ FC_INFO = 0b0000001000000,
+ FC_LOCK = 0b0000010000000,
+ FC_MEM = 0b0000100000000,
+ FC_MISC = 0b0001000000000,
+ FC_NB = 0b0010000000000,
+ FC_PORTALS = 0b0100000000000,
+ FC_SYSTEM = 0b1000000000000,
+ FC_ALL = 0b1111111111111
+} gupcr_facility_t;
+
+#ifndef LONG_LONG_BITS
+#define LONG_LONG_BITS (__SIZEOF_LONG_LONG__ * 8)
+#endif /* LONG_LONG_BITS */
+
+#ifndef SIZE_T_BITS
+#define SIZE_T_BITS (__SIZEOF_SIZE_T__ * 8)
+#endif /* SIZE_T_BITS */
+
+/** Return TRUE, if 'v' is an exact power of 2. */
+static inline unsigned int
+gupcr_is_pow_2 (unsigned long long v)
+{
+ return ((v & ~-v) == 0);
+}
+
+/** Return the value 'v' with the 1 bit at position 'bit' cleared. */
+static inline unsigned long long int
+gupcr_clear_bit (unsigned long long v, unsigned int bit)
+{
+ return v & ~((unsigned long long) 1 << ((LONG_LONG_BITS - 1) - bit));
+}
+
+/** Return the value 'v' with the 1 bit at position 'bit' set. */
+static inline unsigned long long int
+gupcr_set_bit (unsigned long long v, unsigned int bit)
+{
+ return v | ((unsigned long long) 1 << ((LONG_LONG_BITS - 1) - bit));
+}
+
+/** Return the position of the next non-zero bit in 'v'.
+ If 'v' is zero, then the value LONG_LONG_BITS is returned. */
+static inline unsigned int
+gupcr_find_first_one (unsigned long long v)
+{
+ return __builtin_clzll (v);
+}
+
+/** Return the largest power of 2 that is <= 'v'. */
+static inline unsigned int
+gupcr_floor_log2 (unsigned long long v)
+{
+ return (LONG_LONG_BITS - 1) - __builtin_clzll (v);
+}
+
+/** Return the smallest power of 2 that is >= 'v'. */
+static inline unsigned int
+gupcr_log2 (unsigned long long v)
+{
+ return gupcr_floor_log2 (v) + !gupcr_is_pow_2 (v);
+}
+
+extern gupcr_facility_t gupcr_debug_facility_mask;
+extern gupcr_facility_t gupcr_log_facility_mask;
+extern gupcr_facility_t gupcr_stats_facility_mask;
+extern gupcr_facility_t gupcr_trace_facility_mask;
+
+extern void gupcr_exit (void);
+extern void gupcr_abort (void)
+ __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
+extern void gupcr_abort_with_msg (const char *fmt, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)))
+ __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
+extern void gupcr_shutdown (int exit_code);
+extern const char *gupcr_strerror (void);
+extern const char *gupcr_get_pgm_name (void);
+extern void gupcr_set_pgm_name (const char *pgm_name);
+extern void gupcr_init_complete (void);
+extern size_t gupcr_get_shared_heap_size (void);
+extern void gupcr_signal_enable (int signal, void (*handler) (int));
+extern void gupcr_signal_disable (int signal);
+extern FILE *gupcr_fopen (const char *, const char *, const char *);
+extern void gupcr_mkpath (const char *const);
+extern long long gupcr_strtoll (const char *const,
+ long long int, long long int, int *);
+extern void gupcr_strtoll_error (const char *const str,
+ long long int, long long int val_max, int);
+extern void gupcr_size_cvt_error (const char *const str, int);
+extern const char *gupcr_get_buf_as_hex (char *bufstr,
+ const void *buf, size_t size);
+extern const char *gupcr_get_pid_as_string (void);
+extern size_t gupcr_get_shared_heap_size (void);
+extern int gupcr_is_node_local_memory_enabled (void);
+extern int gupcr_is_forcetouch_enabled (void);
+extern int gupcr_is_backtrace_enabled (void);
+extern void gupcr_unique_local_name (char *, const char *, int, int);
+extern void gupcr_log_print (const char *fmt, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+extern void gupcr_debug_print (const char *fmt, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+extern void gupcr_error_print (const char *fmt, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+extern void gupcr_info_print (const char *fmt, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+extern void gupcr_trace_print (const char *fmt, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+extern void gupcr_warn_print (const char *fmt, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+extern int gupcr_create_temp_file (const char *, char *,
+ const char **);
+extern void gupcr_utils_init (void);
+extern void gupcr_utils_fini (void);
+
+/* Called from: gupcr_env.c. */
+extern void gupcr_be_quiet (void);
+extern void gupcr_no_warn (void);
+extern void gupcr_set_shared_heap_size (size_t heap_size);
+extern void gupcr_set_node_local_memory (int value);
+extern void gupcr_set_forcetouch (int value);
+extern void gupcr_set_backtrace (int value);
+extern void gupcr_set_debug_facility (gupcr_facility_t);
+extern void gupcr_set_debug_filename (const char *);
+extern void gupcr_set_log_facility (gupcr_facility_t);
+extern void gupcr_set_log_filename (const char *);
+extern void gupcr_set_stats_facility (gupcr_facility_t);
+extern void gupcr_set_stats_filename (const char *);
+extern void gupcr_set_trace_facility (gupcr_facility_t);
+extern void gupcr_set_trace_filename (const char *);
+
+/* See: gupcr_clock.c. */
+extern double gupcr_clock (void);
+extern double gupcr_clock_resolution (void);
+extern void gupcr_clock_init (void);
+
+/* See: gupcr_env.c. */
+extern void gupcr_env_init (void);
+
+/* See: gupcr_pgm_info.c. */
+extern void gupcr_validate_pgm_info (void);
+
+//end lib_utils_api
+
+/** @} */
+#endif /* gupcr_utils.h */
diff --git a/libgupc/portals4/upc_coll.h b/libgupc/portals4/upc_coll.h
new file mode 100644
index 00000000000..0fc2631c412
--- /dev/null
+++ b/libgupc/portals4/upc_coll.h
@@ -0,0 +1,90 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*****************************************************************************/
+/* */
+/* Copyright (c) 2004, Michigan Technological University */
+/* All rights reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* * Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* * Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* * Neither the name of the Michigan Technological University */
+/* nor the names of its contributors may be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
+/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
+/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
+/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
+/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
+/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
+/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
+/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/*****************************************************************************/
+
+#ifndef _UPC_COLL_H_
+#define _UPC_COLL_H_ 1
+
+/**
+ * @file upc_coll.h
+ * GUPC Portals4 reduce collectives implementation.
+ *
+ * @addtogroup COLLECTIVES GUPCR Collectives Functions
+ * @{
+ */
+
+extern int upc_coll_init_flag;
+extern void upc_coll_init (void);
+
+/**
+ * Collective reduce storage area. It is used for the portals atomic
+ * functions, reduce function storage, and signaling that upper part
+ * of the reduced tree is ready for the reduced operation.
+ */
+struct gupcr_reduce_str
+{
+ int signal; /** Signal that parent is ready */
+ long double value[GUPCR_TREE_FANOUT]; /** Reduced values from children */
+};
+typedef shared struct gupcr_reduce_str *gupcr_reduce_str_t;
+/** Allocated reduce storage space */
+extern gupcr_reduce_str_t gupcr_reduce_storage;
+
+/** @} */
+#endif /* upc_coll.h */
diff --git a/libgupc/smp/gcc-upc-lib.in b/libgupc/smp/gcc-upc-lib.in
new file mode 100644
index 00000000000..49885639265
--- /dev/null
+++ b/libgupc/smp/gcc-upc-lib.in
@@ -0,0 +1,206 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _GCC_UPC_LIB_H_
+#define _GCC_UPC_LIB_H_ 1
+
+#if __UPC_PUPC_INST__
+#pragma pupc off
+#endif /* __UPC_PUPC_INST__ */
+
+#ifdef IN_TARGET_LIBS
+#include "config.h"
+#include <unistd.h>
+/* required, for Posix sched_yield() */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#include <sched.h>
+#endif
+#endif /* IN_TARGET_LIBS */
+
+/* required, for size_t definition */
+#include <sys/types.h>
+
+#pragma upc c_code
+
+/* helper macros for expanding the value of a macro as a string. */
+#define __UPC_STR__(S) #S
+#define __UPC_XSTR__(S) __UPC_STR__(S)
+
+#ifdef __UPC_PTHREADS_MODEL_TLS__
+#define GUPCR_THREAD_LOCAL __thread
+#else
+#define GUPCR_THREAD_LOCAL
+#endif
+
+#ifdef __UPC_STATIC_THREADS__
+/* defined at compile time by the -fupc-threads=N switch */
+#define __UPC_N_THREADS__ THREADS
+#define __UPC_STR__(S) #S
+#define __UPC_XSTR__(S) __UPC_STR__(S)
+#define __UPC_THREADS_CONFIG__ " staticthreads=" __UPC_XSTR__(THREADS)
+#else
+/* defined at run time */
+extern const int THREADS;
+#define __UPC_N_THREADS__ -1
+#define __UPC_THREADS_CONFIG__ "dynamicthreads"
+#endif
+
+#ifdef __UPC_PTHREADS_MODEL_TLS__
+#define __UPC_USES_PTHREADS__ 1
+#define __UPC_THREADS_MODEL__ "pthreads-tls"
+#else
+#define __UPC_THREADS_MODEL__ "process"
+#endif
+
+/* Support for atomics - UPC Specification 1.3. */
+#define __UPC_ATOMIC__ 1
+
+/* Support for castability - UPC Specification 1.3. */
+#define __UPC_CASTABLE__ 1
+
+/* Support for UPC collectives. */
+#define __UPC_COLLECTIVE__ 1
+
+/* Support for non-blocking transfer operations - UPC Specification 1.3. */
+#define __UPC_NB__ 1
+
+/* Support for GASP - http://gasp.hcs.ufl.edu/. */
+#define __UPC_PUPC__ 1
+
+/* Support for high-performance wall-clock timer - UPC Specification 1.3. */
+#define __UPC_TICK__ 1
+
+#pragma upc upc_code
+/* Opaque data type for referencing UPC atomic domains. */
+typedef shared struct upc_atomicdomain_struct upc_atomicdomain_t;
+#pragma upc c_code
+
+/* Place configuration information required by the Berkeley
+ UPC compilation system into the object file. */
+static const char GCCUPCConfig[]
+#if __MACH__
+ __attribute__ ((section("__DATA,upc_pgm_info"))) __attribute__ ((used)) =
+#else
+ __attribute__ ((section("upc_pgm_info"))) __attribute__ ((used)) =
+#endif
+ "$GCCUPCConfig: (" __BASE_FILE__ ") "
+ __UPC_THREADS_CONFIG__ " " __UPC_THREADS_MODEL__ "$";
+
+#undef __UPC_XSTR__
+#undef __UPC_STR__
+
+extern GUPCR_THREAD_LOCAL const int MYTHREAD;
+
+/* Depth count used to implement the semantics of
+ nested upc_forall statements. */
+extern GUPCR_THREAD_LOCAL int __upc_forall_depth;
+
+#if !defined(_CRAYT3E)
+/* The UPC runtime's main program must run first,
+ * we rename the user's main to upc_main(). */
+#if __MACH__
+extern int main () __asm__("_upc_main");
+#else
+extern int main () __asm__("upc_main");
+#endif
+#endif
+
+/* Remap calls to exit so that they invoke the UPC runtime's
+ implementation of exit instead. */
+#define exit __upc_exit
+
+/* Implementation of upc_fence. */
+#define upc_fence __upc_fence()
+
+/* upc_shared_ptr_t is predefined as the representation of
+ a shared pointer type. */
+
+/* Runtime variables used by optimized code generation
+ on some targets. */
+/* The base address of the UPC global area */
+extern void * const __upc_global;
+/* The size of each thread's contribution to the global shared. */
+extern const size_t __upc_local_size;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+/* A pre-calculated value equal to:
+ (__upc_global - __upc_shared_start) which
+ is used to map a pointer-to-shared's address field
+ into a global memory address. */
+extern unsigned long const __upc_global_base;
+
+/* Runtime procedures */
+//include lib_runtime_api
+
+//include detect_target64
+
+/* Runtime shared access procedures */
+//include mode_types
+
+#if defined(__UPC_INLINE_LIB__) || defined(IN_TARGET_LIBS)
+
+/* Library routines have access to runtime internals. */
+
+//include gupcr_config_h
+//include lib_min_max
+//include lib_config_vm
+//include lib_vm_api
+//include lib_config_heap
+//include lib_heap_api
+//include lib_config_shared_section
+//include lib_pts_defs
+//include lib_max_threads_def
+//include lib_sptr_to_addr
+
+#endif /* __UPC_INLINE_LIB__ || IN_TARGET_LIBS */
+
+#ifdef IN_TARGET_LIBS
+
+//include lib_atomic
+//include lib_spin_until
+
+#endif /* IN_TARGET_LIBS */
+
+#ifdef __UPC_INLINE_LIB__
+
+//include lib_fence_defs
+/* We need to include <string.h> to define memcpy() */
+#include <string.h>
+//include lib_inline_mem_sup
+//include lib_inline_access
+
+#else
+
+//include lib_access_prototypes
+
+#endif /* __UPC_INLINE_LIB__ */
+
+#if __UPC_PUPC_INST__
+#pragma pupc on
+#endif /* __UPC_PUPC_INST__ */
+
+#endif /* !_GCC_UPC_LIB_H_ */
diff --git a/libgupc/smp/upc_access.c b/libgupc/smp/upc_access.c
new file mode 100644
index 00000000000..f16fb50b5bb
--- /dev/null
+++ b/libgupc/smp/upc_access.c
@@ -0,0 +1,455 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_access.h"
+#include "upc_sync.h"
+#include "upc_sup.h"
+#include "upc_mem.h"
+
+//begin lib_inline_access
+
+__attribute__((__always_inline__))
+static inline
+void *
+__upc_access_sptr_to_addr (upc_shared_ptr_t p)
+{
+ if (GUPCR_PTS_IS_NULL (p))
+ __upc_fatal ("Invalid access via null shared pointer");
+ if ((int)GUPCR_PTS_THREAD(p) >= THREADS)
+ __upc_fatal ("Thread number in shared address is out of range");
+ return __upc_sptr_to_addr (p);
+}
+
+//inline
+u_intQI_t
+__getqi2 (upc_shared_ptr_t p)
+{
+ const u_intQI_t *addr = (u_intQI_t *) __upc_access_sptr_to_addr (p);
+ return *addr;
+}
+
+//inline
+u_intHI_t
+__gethi2 (upc_shared_ptr_t p)
+{
+ const u_intHI_t *addr = (u_intHI_t *) __upc_access_sptr_to_addr (p);
+ return *addr;
+}
+
+//inline
+u_intSI_t
+__getsi2 (upc_shared_ptr_t p)
+{
+ const u_intSI_t *addr = (u_intSI_t *) __upc_access_sptr_to_addr (p);
+ return *addr;
+}
+
+//inline
+u_intDI_t
+__getdi2 (upc_shared_ptr_t p)
+{
+ const u_intDI_t *addr = (u_intDI_t *) __upc_access_sptr_to_addr (p);
+ return *addr;
+}
+
+#if GUPCR_TARGET64
+//inline
+u_intTI_t
+__getti2 (upc_shared_ptr_t p)
+{
+ const u_intTI_t *addr = (u_intTI_t *) __upc_access_sptr_to_addr (p);
+ return *addr;
+}
+#endif /* GUPCR_TARGET64 */
+
+//inline
+float
+__getsf2 (upc_shared_ptr_t p)
+{
+ const float *addr = (float *) __upc_access_sptr_to_addr (p);
+ return *addr;
+}
+
+//inline
+double
+__getdf2 (upc_shared_ptr_t p)
+{
+ const double *addr = (double *) __upc_access_sptr_to_addr (p);
+ return *addr;
+}
+
+//inline
+long double
+__gettf2 (upc_shared_ptr_t p)
+{
+ const long double *addr = (long double *) __upc_access_sptr_to_addr (p);
+ return *addr;
+}
+
+//inline
+long double
+__getxf2 (upc_shared_ptr_t p)
+{
+ const long double *addr = (long double *) __upc_access_sptr_to_addr (p);
+ return *addr;
+}
+
+//inline
+void
+__getblk3 (void *dest, upc_shared_ptr_t src, size_t n)
+{
+ __upc_memget (dest, src, n);
+}
+
+//inline
+void
+__putqi2 (upc_shared_ptr_t p, u_intQI_t v)
+{
+ u_intQI_t * const addr = (u_intQI_t *) __upc_access_sptr_to_addr (p);
+ *addr = v;
+}
+
+//inline
+void
+__puthi2 (upc_shared_ptr_t p, u_intHI_t v)
+{
+ u_intHI_t * const addr = (u_intHI_t *) __upc_access_sptr_to_addr (p);
+ *addr = v;
+}
+
+//inline
+void
+__putsi2 (upc_shared_ptr_t p, u_intSI_t v)
+{
+ u_intSI_t * const addr = (u_intSI_t *) __upc_access_sptr_to_addr (p);
+ *addr = v;
+}
+
+//inline
+void
+__putdi2 (upc_shared_ptr_t p, u_intDI_t v)
+{
+ u_intDI_t * const addr = (u_intDI_t *) __upc_access_sptr_to_addr (p);
+ *addr = v;
+}
+
+#if GUPCR_TARGET64
+//inline
+void
+__putti2 (upc_shared_ptr_t p, u_intTI_t v)
+{
+ u_intTI_t * const addr = (u_intTI_t *) __upc_access_sptr_to_addr (p);
+ *addr = v;
+}
+#endif /* GUPCR_TARGET64 */
+
+//inline
+void
+__putsf2 (upc_shared_ptr_t p, float v)
+{
+ float * const addr = (float *) __upc_access_sptr_to_addr (p);
+ *addr = v;
+}
+
+//inline
+void
+__putdf2 (upc_shared_ptr_t p, double v)
+{
+ double * const addr = (double *) __upc_access_sptr_to_addr (p);
+ *addr = v;
+}
+
+//inline
+void
+__puttf2 (upc_shared_ptr_t p, long double v)
+{
+ long double * const addr = (long double *) __upc_access_sptr_to_addr (p);
+ *addr = v;
+}
+
+//inline
+void
+__putxf2 (upc_shared_ptr_t p, long double v)
+{
+ long double * const addr = (long double *) __upc_access_sptr_to_addr (p);
+ *addr = v;
+}
+
+//inline
+void
+__putblk3 (upc_shared_ptr_t dest, void *src, size_t n)
+{
+ __upc_memput (dest, src, n);
+}
+
+//inline
+void
+__copyblk3 (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t n)
+{
+ __upc_memcpy (dest, src, n);
+}
+
+/* Strict memory accesses. */
+
+//inline
+u_intQI_t
+__getsqi2 (upc_shared_ptr_t p)
+{
+ const u_intQI_t *addr = (u_intQI_t *) __upc_access_sptr_to_addr (p);
+ u_intQI_t result;
+ GUPCR_FENCE ();
+ result = *addr;
+ GUPCR_READ_FENCE ();
+ return result;
+}
+
+//inline
+u_intHI_t
+__getshi2 (upc_shared_ptr_t p)
+{
+ const u_intHI_t *addr = (u_intHI_t *) __upc_access_sptr_to_addr (p);
+ u_intHI_t result;
+ GUPCR_FENCE ();
+ result = *addr;
+ GUPCR_READ_FENCE ();
+ return result;
+}
+
+//inline
+u_intSI_t
+__getssi2 (upc_shared_ptr_t p)
+{
+ const u_intSI_t *addr = (u_intSI_t *) __upc_access_sptr_to_addr (p);
+ u_intSI_t result;
+ GUPCR_FENCE ();
+ result = *addr;
+ GUPCR_READ_FENCE ();
+ return result;
+}
+
+//inline
+u_intDI_t
+__getsdi2 (upc_shared_ptr_t p)
+{
+ const u_intDI_t *addr = (u_intDI_t *) __upc_access_sptr_to_addr (p);
+ u_intDI_t result;
+ GUPCR_FENCE ();
+ result = *addr;
+ GUPCR_READ_FENCE ();
+ return result;
+}
+
+#if GUPCR_TARGET64
+//inline
+u_intTI_t
+__getsti2 (upc_shared_ptr_t p)
+{
+ const u_intTI_t *addr = (u_intTI_t *) __upc_access_sptr_to_addr (p);
+ u_intTI_t result;
+ GUPCR_FENCE ();
+ result = *addr;
+ GUPCR_READ_FENCE ();
+ return result;
+}
+#endif /* GUPCR_TARGET64 */
+
+//inline
+float
+__getssf2 (upc_shared_ptr_t p)
+{
+ const float *addr = (float *) __upc_access_sptr_to_addr (p);
+ float result;
+ GUPCR_FENCE ();
+ result = *addr;
+ GUPCR_READ_FENCE ();
+ return result;
+}
+
+//inline
+double
+__getsdf2 (upc_shared_ptr_t p)
+{
+ const double *addr = (double *) __upc_access_sptr_to_addr (p);
+ double result;
+ GUPCR_FENCE ();
+ result = *addr;
+ GUPCR_READ_FENCE ();
+ return result;
+}
+
+//inline
+long double
+__getstf2 (upc_shared_ptr_t p)
+{
+ const long double *addr = (long double *) __upc_access_sptr_to_addr (p);
+ long double result;
+ GUPCR_FENCE ();
+ result = *addr;
+ GUPCR_READ_FENCE ();
+ return result;
+}
+
+//inline
+long double
+__getsxf2 (upc_shared_ptr_t p)
+{
+ const long double *addr = (long double *) __upc_access_sptr_to_addr (p);
+ long double result;
+ GUPCR_FENCE ();
+ result = *addr;
+ GUPCR_READ_FENCE ();
+ return result;
+}
+
+//inline
+void
+__getsblk3 (void *dest, upc_shared_ptr_t src, size_t len)
+{
+ GUPCR_FENCE ();
+ __getblk3 (dest, src, len);
+ GUPCR_READ_FENCE ();
+}
+
+//inline
+void
+__putsqi2 (upc_shared_ptr_t p, u_intQI_t v)
+{
+ u_intQI_t *addr = (u_intQI_t *) __upc_access_sptr_to_addr (p);
+ GUPCR_WRITE_FENCE ();
+ *addr = v;
+ GUPCR_FENCE ();
+}
+
+//inline
+void
+__putshi2 (upc_shared_ptr_t p, u_intHI_t v)
+{
+ u_intHI_t *addr = (u_intHI_t *) __upc_access_sptr_to_addr (p);
+ GUPCR_WRITE_FENCE ();
+ *addr = v;
+ GUPCR_FENCE ();
+}
+
+//inline
+void
+__putssi2 (upc_shared_ptr_t p, u_intSI_t v)
+{
+ u_intSI_t *addr = (u_intSI_t *) __upc_access_sptr_to_addr (p);
+ GUPCR_WRITE_FENCE ();
+ *addr = v;
+ GUPCR_FENCE ();
+}
+
+//inline
+void
+__putsdi2 (upc_shared_ptr_t p, u_intDI_t v)
+{
+ u_intDI_t *addr = (u_intDI_t *) __upc_access_sptr_to_addr (p);
+ GUPCR_WRITE_FENCE ();
+ *addr = v;
+ GUPCR_FENCE ();
+}
+
+#if GUPCR_TARGET64
+//inline
+void
+__putsti2 (upc_shared_ptr_t p, u_intTI_t v)
+{
+ u_intTI_t *addr = (u_intTI_t *) __upc_access_sptr_to_addr (p);
+ GUPCR_WRITE_FENCE ();
+ *addr = v;
+ GUPCR_FENCE ();
+}
+#endif /* GUPCR_TARGET64 */
+
+//inline
+void
+__putssf2 (upc_shared_ptr_t p, float v)
+{
+ float *addr = (float *) __upc_access_sptr_to_addr (p);
+ GUPCR_WRITE_FENCE ();
+ *addr = v;
+ GUPCR_FENCE ();
+}
+
+//inline
+void
+__putsdf2 (upc_shared_ptr_t p, double v)
+{
+ double *addr = (double *) __upc_access_sptr_to_addr (p);
+ GUPCR_WRITE_FENCE ();
+ *addr = v;
+ GUPCR_FENCE ();
+}
+
+//inline
+void
+__putstf2 (upc_shared_ptr_t p, long double v)
+{
+ long double *addr = (long double *) __upc_access_sptr_to_addr (p);
+ GUPCR_WRITE_FENCE ();
+ *addr = v;
+ GUPCR_FENCE ();
+}
+
+//inline
+void
+__putsxf2 (upc_shared_ptr_t p, long double v)
+{
+ long double *addr = (long double *) __upc_access_sptr_to_addr (p);
+ GUPCR_WRITE_FENCE ();
+ *addr = v;
+ GUPCR_FENCE ();
+}
+
+//inline
+void
+__putsblk3 (upc_shared_ptr_t dest, void *src, size_t len)
+{
+ GUPCR_WRITE_FENCE ();
+ __putblk3 (dest, src, len);
+ GUPCR_FENCE ();
+}
+
+//inline
+void
+__copysblk3 (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t len)
+{
+ GUPCR_WRITE_FENCE ();
+ __copyblk3 (dest, src, len);
+ GUPCR_FENCE ();
+}
+
+//inline
+void
+__upc_fence (void)
+{
+ GUPCR_FENCE ();
+}
+//end lib_inline_access
diff --git a/libgupc/smp/upc_access.h b/libgupc/smp/upc_access.h
new file mode 100644
index 00000000000..bbffaf9cebe
--- /dev/null
+++ b/libgupc/smp/upc_access.h
@@ -0,0 +1,180 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_ACCESS_H_
+#define _UPC_ACCESS_H_
+
+
+//begin lib_access_prototypes
+/* relaxed accesses */
+
+extern u_intQI_t __getqi2 (upc_shared_ptr_t);
+extern u_intHI_t __gethi2 (upc_shared_ptr_t);
+extern u_intSI_t __getsi2 (upc_shared_ptr_t);
+extern u_intDI_t __getdi2 (upc_shared_ptr_t);
+#if GUPCR_TARGET64
+extern u_intTI_t __getti2 (upc_shared_ptr_t);
+#endif
+extern float __getsf2 (upc_shared_ptr_t);
+extern double __getdf2 (upc_shared_ptr_t);
+extern long double __gettf2 (upc_shared_ptr_t);
+extern long double __getxf2 (upc_shared_ptr_t);
+extern void __getblk3 (void *, upc_shared_ptr_t, size_t);
+
+extern void __putqi2 (upc_shared_ptr_t, u_intQI_t);
+extern void __puthi2 (upc_shared_ptr_t, u_intHI_t);
+extern void __putsi2 (upc_shared_ptr_t, u_intSI_t);
+extern void __putdi2 (upc_shared_ptr_t, u_intDI_t);
+#if GUPCR_TARGET64
+extern void __putti2 (upc_shared_ptr_t, u_intTI_t);
+#endif
+extern void __putsf2 (upc_shared_ptr_t, float);
+extern void __putdf2 (upc_shared_ptr_t, double);
+extern void __puttf2 (upc_shared_ptr_t, long double);
+extern void __putxf2 (upc_shared_ptr_t, long double);
+extern void __putblk3 (upc_shared_ptr_t, void *, size_t);
+extern void __copyblk3 (upc_shared_ptr_t, upc_shared_ptr_t, size_t);
+
+/* strict accesses */
+
+extern u_intQI_t __getsqi2 (upc_shared_ptr_t);
+extern u_intHI_t __getshi2 (upc_shared_ptr_t);
+extern u_intSI_t __getssi2 (upc_shared_ptr_t);
+extern u_intDI_t __getsdi2 (upc_shared_ptr_t);
+#if GUPCR_TARGET64
+extern u_intTI_t __getsti2 (upc_shared_ptr_t);
+#endif
+extern float __getssf2 (upc_shared_ptr_t);
+extern double __getsdf2 (upc_shared_ptr_t);
+extern long double __getstf2 (upc_shared_ptr_t);
+extern long double __getsxf2 (upc_shared_ptr_t);
+extern void __getsblk3 (void *, upc_shared_ptr_t, size_t);
+
+extern void __putsqi2 (upc_shared_ptr_t, u_intQI_t);
+extern void __putshi2 (upc_shared_ptr_t, u_intHI_t);
+extern void __putssi2 (upc_shared_ptr_t, u_intSI_t);
+extern void __putsdi2 (upc_shared_ptr_t, u_intDI_t);
+#if GUPCR_TARGET64
+extern void __putsti2 (upc_shared_ptr_t, u_intTI_t);
+#endif
+extern void __putssf2 (upc_shared_ptr_t, float);
+extern void __putsdf2 (upc_shared_ptr_t, double);
+extern void __putstf2 (upc_shared_ptr_t, long double);
+extern void __putsxf2 (upc_shared_ptr_t, long double);
+extern void __putsblk3 (upc_shared_ptr_t, void *, size_t);
+extern void __copysblk3 (upc_shared_ptr_t, upc_shared_ptr_t, size_t);
+
+/* relaxed accesses (profiled) */
+
+extern u_intQI_t __getgqi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intHI_t __getghi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intSI_t __getgsi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intDI_t __getgdi3 (upc_shared_ptr_t, const char *file, int line);
+#if GUPCR_TARGET64
+extern u_intTI_t __getgti3 (upc_shared_ptr_t, const char *file, int line);
+#endif
+extern float __getgsf3 (upc_shared_ptr_t, const char *file, int line);
+extern double __getgdf3 (upc_shared_ptr_t, const char *file, int line);
+extern long double __getgtf3 (upc_shared_ptr_t, const char *file, int line);
+extern long double __getgxf3 (upc_shared_ptr_t, const char *file, int line);
+extern void __getgblk5 (void *, upc_shared_ptr_t, size_t, const char *file,
+ int line);
+
+extern void __putgqi4 (upc_shared_ptr_t, u_intQI_t, const char *file,
+ int line);
+extern void __putghi4 (upc_shared_ptr_t, u_intHI_t, const char *file,
+ int line);
+extern void __putgsi4 (upc_shared_ptr_t, u_intSI_t, const char *file,
+ int line);
+extern void __putgdi4 (upc_shared_ptr_t, u_intDI_t, const char *file,
+ int line);
+#if GUPCR_TARGET64
+extern void __putgti4 (upc_shared_ptr_t, u_intTI_t, const char *file,
+ int line);
+#endif
+extern void __putgsf4 (upc_shared_ptr_t, float, const char *file, int line);
+extern void __putgdf4 (upc_shared_ptr_t, double, const char *file, int line);
+extern void __putgtf4 (upc_shared_ptr_t, long double, const char *file, int line);
+extern void __putgxf4 (upc_shared_ptr_t, long double, const char *file, int line);
+extern void __putgblk5 (upc_shared_ptr_t, void *, size_t, const char *file,
+ int line);
+extern void __copygblk5 (upc_shared_ptr_t, upc_shared_ptr_t, size_t,
+ const char *file, int line);
+
+/* strict accesses (profiled) */
+
+extern u_intQI_t __getsgqi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intHI_t __getsghi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intSI_t __getsgsi3 (upc_shared_ptr_t, const char *file, int line);
+extern u_intDI_t __getsgdi3 (upc_shared_ptr_t, const char *file, int line);
+#if GUPCR_TARGET64
+extern u_intTI_t __getsgti3 (upc_shared_ptr_t, const char *file, int line);
+#endif
+extern float __getsgsf3 (upc_shared_ptr_t, const char *file, int line);
+extern double __getsgdf3 (upc_shared_ptr_t, const char *file, int line);
+extern long double __getsgtf3 (upc_shared_ptr_t, const char *file, int line);
+extern long double __getsgxf3 (upc_shared_ptr_t, const char *file, int line);
+extern void __getsgblk5 (void *, upc_shared_ptr_t, size_t, const char *file,
+ int line);
+
+extern void __putsgqi4 (upc_shared_ptr_t, u_intQI_t, const char *file,
+ int line);
+extern void __putsghi4 (upc_shared_ptr_t, u_intHI_t, const char *file,
+ int line);
+extern void __putsgsi4 (upc_shared_ptr_t, u_intSI_t, const char *file,
+ int line);
+extern void __putsgdi4 (upc_shared_ptr_t, u_intDI_t, const char *file,
+ int line);
+#if GUPCR_TARGET64
+extern void __putsgti4 (upc_shared_ptr_t, u_intTI_t, const char *file,
+ int line);
+#endif
+extern void __putsgsf4 (upc_shared_ptr_t, float, const char *file, int line);
+extern void __putsgdf4 (upc_shared_ptr_t, double, const char *file, int line);
+extern void __putsgtf4 (upc_shared_ptr_t, long double, const char *file, int line);
+extern void __putsgxf4 (upc_shared_ptr_t, long double, const char *file, int line);
+extern void __putsgblk5 (upc_shared_ptr_t, void *, size_t, const char *file,
+ int line);
+extern void __copysgblk5 (upc_shared_ptr_t, upc_shared_ptr_t, size_t,
+ const char *file, int line);
+
+/* Miscellaneous access related prototypes. */
+extern void __upc_fence (void);
+
+//end lib_access_prototypes
+
+/* memory-to-memory operations (profiled) */
+extern void upc_memcpyg (upc_shared_ptr_t dest, upc_shared_ptr_t src,
+ size_t n, const char *filename, int linenum);
+extern void upc_memgetg (void *dest, upc_shared_ptr_t src, size_t n,
+ const char *filename, int linenum);
+extern void upc_memputg (upc_shared_ptr_t dest, const void *src, size_t n,
+ const char *filename, int linenum);
+extern void upc_memsetg (upc_shared_ptr_t dest, int c, size_t n,
+ const char *filename, int linenum);
+
+#endif /* _UPC_ACCESS_H_ */
diff --git a/libgupc/smp/upc_accessg.c b/libgupc/smp/upc_accessg.c
new file mode 100644
index 00000000000..e22357e6c8b
--- /dev/null
+++ b/libgupc/smp/upc_accessg.c
@@ -0,0 +1,557 @@
+/* Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_access.h"
+#include "upc_lib.h"
+#include "gasp_upc.h"
+#include "upc_pupc.h"
+
+/* relaxed accesses (profiled) */
+
+u_intQI_t
+__getgqi3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intQI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getqi2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+u_intHI_t
+__getghi3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intHI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __gethi2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+u_intSI_t
+__getgsi3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intSI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getsi2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+u_intDI_t
+__getgdi3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intDI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getdi2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+#if GUPCR_TARGET64
+u_intTI_t
+__getgti3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intTI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getti2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+#endif
+
+float
+__getgsf3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ float val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getsf2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+double
+__getgdf3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ double val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getdf2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+long double
+__getgtf3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ long double val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __gettf2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+long double
+__getgxf3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ long double val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getxf2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+void
+__getgblk5 (void *dest, upc_shared_ptr_t src, size_t n, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, dest, &src, n);
+ __getblk3 (dest, src, n);
+ p_end (GASP_UPC_GET, 1, dest, &src, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putgqi4 (upc_shared_ptr_t p, u_intQI_t v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putqi2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putghi4 (upc_shared_ptr_t p, u_intHI_t v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __puthi2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putgsi4 (upc_shared_ptr_t p, u_intSI_t v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putsi2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putgdi4 (upc_shared_ptr_t p, u_intDI_t v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putdi2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+#if GUPCR_TARGET64
+void
+__putgti4 (upc_shared_ptr_t p, u_intTI_t v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putti2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+#endif
+
+void
+__putgsf4 (upc_shared_ptr_t p, float v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putsf2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putgdf4 (upc_shared_ptr_t p, double v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putdf2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putgtf4 (upc_shared_ptr_t p, long double v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __puttf2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putgxf4 (upc_shared_ptr_t p, long double v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putxf2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putgblk5 (upc_shared_ptr_t dest, void *src, size_t n, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &dest, src, n);
+ __putblk3 (dest, src, n);
+ p_end (GASP_UPC_PUT, 1, &dest, src, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__copygblk5 (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t n,
+ const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_MEMCPY, &dest, &src, n);
+ __copyblk3 (dest, src, n);
+ p_end (GASP_UPC_MEMCPY, &dest, &src, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+/* strict accesses (profiled) */
+
+u_intQI_t
+__getsgqi3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intQI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getsqi2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+u_intHI_t
+__getsghi3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intHI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getshi2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+u_intSI_t
+__getsgsi3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intSI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getssi2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+u_intDI_t
+__getsgdi3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intDI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getsdi2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+#if GUPCR_TARGET64
+u_intTI_t
+__getsgti3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ u_intTI_t val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getsti2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+#endif
+
+float
+__getsgsf3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ float val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getssf2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+double
+__getsgdf3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ double val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getsdf2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+long double
+__getsgtf3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ long double val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getstf2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+long double
+__getsgxf3 (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ long double val;
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ val = __getsxf2 (p);
+ p_end (GASP_UPC_GET, 1, &val, &p, sizeof (val));
+ GUPCR_CLEAR_ERR_LOC();
+ return val;
+}
+
+void
+__getsgblk5 (void *dest, upc_shared_ptr_t src, size_t n, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_GET, 1, dest, &src, n);
+ __getblk3 (dest, src, n);
+ p_end (GASP_UPC_GET, 1, dest, &src, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putsgqi4 (upc_shared_ptr_t p, u_intQI_t v, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putsqi2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putsghi4 (upc_shared_ptr_t p, u_intHI_t v, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putshi2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putsgsi4 (upc_shared_ptr_t p, u_intSI_t v, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putssi2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putsgdi4 (upc_shared_ptr_t p, u_intDI_t v, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putsdi2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+#if GUPCR_TARGET64
+void
+__putsgti4 (upc_shared_ptr_t p, u_intTI_t v, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putsti2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+#endif
+
+void
+__putsgsf4 (upc_shared_ptr_t p, float v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putssf2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putsgdf4 (upc_shared_ptr_t p, double v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putsdf2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putsgtf4 (upc_shared_ptr_t p, long double v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putstf2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putsgxf4 (upc_shared_ptr_t p, long double v, const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ __putsxf2 (p, v);
+ p_end (GASP_UPC_PUT, 1, &p, &v, sizeof (v));
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__putsgblk5 (upc_shared_ptr_t dest, void *src, size_t n, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_PUT, 0, &dest, src, n);
+ __putsblk3 (dest, src, n);
+ p_end (GASP_UPC_PUT, 0, &dest, src, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+__copysgblk5 (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t n,
+ const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_MEMCPY, &dest, &src, n);
+ __copysblk3 (dest, src, n);
+ p_end (GASP_UPC_MEMCPY, &dest, &src, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+upc_memcpyg (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t n,
+ const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_MEMCPY, &dest, &src, n);
+ upc_memcpy (dest, src, n);
+ p_end (GASP_UPC_MEMCPY, &dest, &src, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+upc_memgetg (void *dest, upc_shared_ptr_t src, size_t n, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_MEMGET, &dest, &src, n);
+ upc_memget (dest, src, n);
+ p_end (GASP_UPC_MEMGET, &dest, &src, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+upc_memputg (upc_shared_ptr_t dest, const void *src, size_t n,
+ const char *filename, int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_MEMPUT, &dest, src, n);
+ upc_memput (dest, src, n);
+ p_end (GASP_UPC_MEMPUT, &dest, src, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
+
+void
+upc_memsetg (upc_shared_ptr_t dest, int c, size_t n, const char *filename,
+ int linenum)
+{
+ GUPCR_SET_ERR_LOC();
+ p_start (GASP_UPC_MEMSET, &dest, c, n);
+ upc_memset (dest, c, n);
+ p_end (GASP_UPC_MEMSET, &dest, c, n);
+ GUPCR_CLEAR_ERR_LOC();
+}
diff --git a/libgupc/smp/upc_addr.c b/libgupc/smp/upc_addr.c
new file mode 100644
index 00000000000..efe0ae88e88
--- /dev/null
+++ b/libgupc/smp/upc_addr.c
@@ -0,0 +1,121 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_sup.h"
+
+void *
+__cvtaddr (upc_shared_ptr_t p)
+{
+ upc_info_p u = __upc_info;
+ void *addr;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ if (GUPCR_PTS_IS_NULL (p))
+ return (void *) 0;
+ addr = __upc_sptr_to_addr (p);
+ return addr;
+}
+
+void *
+__getaddr (upc_shared_ptr_t p)
+{
+ upc_info_p u = __upc_info;
+ void *addr;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ if (GUPCR_PTS_IS_NULL (p))
+ return (void *) 0;
+ if ((int)GUPCR_PTS_THREAD(p) != MYTHREAD)
+ __upc_fatal ("Invalid conversion of shared address to local pointer;\nthread does not have affinity to shared address");
+ addr = __upc_sptr_to_addr (p);
+ return addr;
+}
+
+size_t
+upc_threadof (upc_shared_ptr_t p)
+{
+ upc_info_p u = __upc_info;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ if ((int)GUPCR_PTS_THREAD(p) >= THREADS)
+ __upc_fatal ("Thread number in shared address is out of range");
+ return GUPCR_PTS_THREAD (p);
+}
+
+size_t
+upc_phaseof (upc_shared_ptr_t p)
+{
+ upc_info_p u = __upc_info;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ if ((int)GUPCR_PTS_THREAD(p) >= THREADS)
+ __upc_fatal ("Thread number in shared address is out of range");
+ return GUPCR_PTS_PHASE (p);
+}
+
+upc_shared_ptr_t
+upc_resetphase (upc_shared_ptr_t p)
+{
+ upc_shared_ptr_t result;
+ result = p;
+ GUPCR_PTS_SET_PHASE (result, 0);
+ return result;
+}
+
+size_t
+upc_addrfield (upc_shared_ptr_t p)
+{
+ upc_info_p u = __upc_info;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ if ((int)GUPCR_PTS_THREAD(p) >= THREADS)
+ __upc_fatal ("Thread number in shared address is out of range");
+ return (size_t) GUPCR_PTS_VADDR (p);
+}
+
+size_t
+upc_affinitysize (size_t totalsize, size_t nbytes, size_t threadid)
+{
+ size_t result;
+ if (nbytes == 0 || totalsize == 0 || nbytes >= totalsize)
+ result = (size_t) (threadid == 0 ? totalsize : 0);
+ else
+ {
+ size_t const nblocks = (totalsize / nbytes);
+ size_t const cutoff = (nblocks % THREADS);
+ if (threadid < cutoff)
+ result = (size_t) ((nblocks + THREADS - 1) / THREADS) * nbytes;
+ else if (threadid > cutoff)
+ result = (size_t) (nblocks / THREADS) * nbytes;
+ else /* threadid == cutoff */
+ result = (size_t) ((nblocks / THREADS) * nbytes)
+ + totalsize - nblocks * nbytes;
+ }
+ return result;
+}
diff --git a/libgupc/smp/upc_affinity.c b/libgupc/smp/upc_affinity.c
new file mode 100644
index 00000000000..9ecf5497364
--- /dev/null
+++ b/libgupc/smp/upc_affinity.c
@@ -0,0 +1,221 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_sup.h"
+#include "upc_affinity.h"
+#include "upc_numa.h"
+
+/* The opaque type upc_cpu_avoid_t, forward references this type. */
+struct upc_cpu_avoid_struct
+{
+ cpu_set_t cpu_set;
+};
+
+int
+__upc_affinity_supported ()
+{
+ return 1;
+}
+
+/* Calculate the right affinity for the thread based on
+ the current scheduling and NUMA policies. Executed by
+ the monitoring thread. AVOID is a pointer to a data
+ structure that lists cpu's that aren't eligible for
+ allocation. */
+
+int
+__upc_affinity_init (upc_info_p u, upc_cpu_avoid_p avoid,
+ const char **err_msg)
+{
+ const upc_sched_policy_t sched_policy = u->sched_policy;
+ const int num_cpus = u->num_cpus;
+ const int num_nodes = u->num_nodes;
+ int t, next_sched_cpu;
+ if (!__upc_numa_init (u, err_msg))
+ return 0;
+ /* Calculate affinity for each thread. */
+ for (t = 0, next_sched_cpu = 0; t < THREADS; ++t)
+ {
+ const upc_thread_info_p tinfo = &u->thread_info[t];
+ int pelem, melem;
+ int sched_affinity, mem_affinity;
+ switch (sched_policy)
+ {
+ case GUPCR_SCHED_POLICY_CPU:
+ /* One cpu = multiple threads */
+ pelem = t % num_cpus;
+ melem = pelem % num_nodes;
+ sched_affinity = pelem;
+ mem_affinity = melem;
+ break;
+ case GUPCR_SCHED_POLICY_CPU_STRICT:
+ /* One cpu = one thread */
+ while (CPU_ISSET (next_sched_cpu, &avoid->cpu_set)
+ && next_sched_cpu < num_cpus)
+ {
+ next_sched_cpu += 1;
+ }
+ if (next_sched_cpu >= num_cpus)
+ {
+ *err_msg = "UPC error: unable to allocate CPU for all threads.";
+ return 0;
+ }
+ pelem = next_sched_cpu;
+ melem = pelem % num_nodes;
+ sched_affinity = pelem;
+ mem_affinity = melem;
+ next_sched_cpu += 1;
+ break;
+ case GUPCR_SCHED_POLICY_NODE:
+ /* Use NUMA for node scheduling */
+ if (!__upc_numa_allocate (u, t, &sched_affinity, &mem_affinity,
+ err_msg))
+ return 0;
+ break;
+ default:
+ /* Auto scheduling */
+ sched_affinity = -1;
+ mem_affinity = -1;
+ }
+ tinfo->sched_affinity = sched_affinity;
+ tinfo->mem_affinity = mem_affinity;
+ }
+ return 1;
+}
+
+/* Allocate, and return a pointer to the data structure used to record
+ the list of CPU's that are unavailable. */
+
+upc_cpu_avoid_p
+__upc_affinity_cpu_avoid_new ()
+{
+ upc_cpu_avoid_p avoid;
+ avoid = (upc_cpu_avoid_p) calloc (1, sizeof (upc_cpu_avoid_t));
+ if (!avoid)
+ {
+ perror ("calloc");
+ abort ();
+ }
+ return avoid;
+}
+
+/* Free the previously allocated data structure that is used
+ to record list of CPU's that are unavailable. */
+
+void
+__upc_affinity_cpu_avoid_free (const upc_cpu_avoid_p avoid)
+{
+ if (avoid)
+ free ((void *) avoid);
+}
+
+/* Mark CPU as being unavailable for allocation. */
+
+void
+__upc_affinity_cpu_avoid_set (const int cpu, const upc_cpu_avoid_p avoid)
+{
+ CPU_SET (cpu, &avoid->cpu_set);
+}
+
+#ifdef DEBUG_AFFINITY
+static const char *
+upc_sched_policy_to_string (const upc_sched_policy_t sched_policy)
+{
+ switch (sched_policy)
+ {
+ case GUPCR_SCHED_POLICY_AUTO:
+ return "sched auto";
+ case GUPCR_SCHED_POLICY_NODE:
+ return "sched node";
+ case GUPCR_SCHED_POLICY_CPU:
+ return "sched cpu";
+ case GUPCR_SCHED_POLICY_CPU_STRICT:
+ return "sched strict";
+ }
+ return "sched <unknown>";
+}
+
+static const char *
+upc_mem_policy_to_string (const upc_mem_policy_t mem_policy)
+{
+ switch (mem_policy)
+ {
+ case GUPCR_MEM_POLICY_AUTO:
+ return "mem auto";
+ case GUPCR_MEM_POLICY_NODE:
+ return "mem node";
+ case GUPCR_MEM_POLICY_STRICT:
+ return "mem strict";
+ }
+ return "mem <unknown>";
+}
+#endif /* DEBUG_AFFINITY */
+
+/* Set thread's affinity based on the pre-calculated
+ policies. Executed by each thread as the first thing after thread
+ is created. */
+
+void
+__upc_affinity_set (upc_info_p u, int thread_id)
+{
+ const upc_thread_info_p tinfo = &u->thread_info[thread_id];
+ switch (u->sched_policy)
+ {
+ case GUPCR_SCHED_POLICY_CPU:
+ case GUPCR_SCHED_POLICY_CPU_STRICT:
+ {
+ const int sched_affinity = tinfo->sched_affinity;
+ cpu_set_t set;
+ CPU_ZERO (&set);
+ CPU_SET (sched_affinity, &set);
+ if (sched_setaffinity (0, sizeof (set), &set))
+ {
+ __upc_fatal ("Scheduling cannot be set");
+ }
+ }
+ break;
+ case GUPCR_SCHED_POLICY_NODE:
+ __upc_numa_sched_set (u, thread_id);
+ break;
+ default:
+ /* auto - no scheduling support */
+ break;
+ }
+ /* set memory policy only if we are not AUTO scheduling */
+ if ((u->sched_policy != GUPCR_SCHED_POLICY_AUTO) &&
+ (u->mem_policy != GUPCR_MEM_POLICY_AUTO))
+ __upc_numa_memory_affinity_set (u, thread_id);
+#ifdef DEBUG_AFFINITY
+ printf ("affinity: %d (%s,%s) scheduling (%d,%d)\n", thread_id,
+ upc_sched_policy_to_string (u->sched_policy),
+ upc_mem_policy_to_string (u->mem_policy),
+ tinfo->sched_affinity, tinfo->mem_affinity);
+#endif /* DEBUG_AFFINITY */
+}
diff --git a/libgupc/smp/upc_affinity.h b/libgupc/smp/upc_affinity.h
new file mode 100644
index 00000000000..fe9a19ec9f9
--- /dev/null
+++ b/libgupc/smp/upc_affinity.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_AFFINITY_H_
+#define _UPC_AFFINITY_H_
+
+extern void __upc_affinity_cpu_avoid_free (const upc_cpu_avoid_p);
+extern upc_cpu_avoid_p __upc_affinity_cpu_avoid_new (void);
+extern void __upc_affinity_cpu_avoid_set (const int, const upc_cpu_avoid_p);
+extern int __upc_affinity_init (const upc_info_p, const upc_cpu_avoid_p,
+ const char **err_msg);
+extern void __upc_affinity_set (const upc_info_p, const int);
+extern int __upc_affinity_supported (void);
+
+#endif /* !_UPC_AFFINITY_H_ */
diff --git a/libgupc/smp/upc_affinity_stub.c b/libgupc/smp/upc_affinity_stub.c
new file mode 100644
index 00000000000..94820fff335
--- /dev/null
+++ b/libgupc/smp/upc_affinity_stub.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_affinity.h"
+
+int
+__upc_affinity_supported (void)
+{
+ return 0;
+}
+
+int
+__upc_affinity_init (const upc_info_p ARG_UNUSED (u),
+ const upc_cpu_avoid_p ARG_UNUSED (avoid),
+ const char **ARG_UNUSED (err_msg))
+{
+ return 1;
+}
+
+upc_cpu_avoid_p
+__upc_affinity_cpu_avoid_new (void)
+{
+ return NULL;
+}
+
+void
+__upc_affinity_cpu_avoid_free (const upc_cpu_avoid_p ARG_UNUSED (avoid))
+{
+}
+
+void
+__upc_affinity_cpu_avoid_set (const int ARG_UNUSED (cpu),
+ const upc_cpu_avoid_p ARG_UNUSED (avoid))
+{
+}
+
+void
+__upc_affinity_set (const upc_info_p ARG_UNUSED (u),
+ const int ARG_UNUSED (thread_id))
+{
+}
diff --git a/libgupc/smp/upc_alloc.upc b/libgupc/smp/upc_alloc.upc
new file mode 100644
index 00000000000..cc2402cede8
--- /dev/null
+++ b/libgupc/smp/upc_alloc.upc
@@ -0,0 +1,435 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include <upc.h>
+#ifdef __sgi__
+/* UPC's definitions conflict with definitions in SGI's
+ header files, which are included by upc_config.h. */
+#undef barrier
+#undef fence
+#endif /* __sgi__ */
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdio.h>
+
+#define DEBUG_ALLOC 1
+#undef DEBUG_ALLOC
+
+/* upc_alloc.upc implements UPC's dynamic memory allocation
+ routines. The implementation is written in UPC, because
+ it needs to run above the runtime library's memory mapping
+ facility. Internal runtime locks are used rather than
+ the UPC language-defined locks, because those locks
+ depend upon dynamic memory management, and we need to
+ break the circular dependency. */
+
+typedef struct upc_heap_struct
+ {
+ shared struct upc_heap_struct *next; /* MUST BE FIRST FIELD */
+ size_t size;
+ int alloc_tag;
+ int is_global;
+ int alloc_seq;
+ } upc_heap_t;
+typedef shared upc_heap_t *upc_heap_p;
+#define GUPCR_HEAP_OVERHEAD GUPCR_ROUND (sizeof (upc_heap_t), GUPCR_HEAP_ALLOC_MIN)
+
+static shared upc_heap_p __upc_global_heap;
+static shared upc_heap_p __upc_local_heap[THREADS];
+static shared void * shared __upc_all_alloc_val;
+static shared int __upc_alloc_seq;
+
+#undef NULL
+#define NULL (shared void *)0
+
+typedef union _pts_as_rep
+ {
+ shared void *pts;
+ upc_shared_ptr_t rep;
+ } pts_as_rep_t;
+
+/* Create a shared pointer, given (addrfield, thread) */
+static inline
+shared void *
+__upc_alloc_build_pts (size_t addrfield, size_t thread)
+{
+ pts_as_rep_t r;
+ r.pts = NULL;
+ GUPCR_PTS_SET_VADDR (r.rep, addrfield);
+ GUPCR_PTS_SET_THREAD (r.rep, thread);
+ return r.pts;
+}
+
+/* Increment a shared pointer, by nbytes */
+static inline
+shared void *
+__upc_alloc_ptr_add (shared void *ptr, ptrdiff_t nbytes)
+{
+ return (shared void *)(((shared [] char *)ptr) + nbytes);
+}
+
+#ifdef DEBUG_ALLOC
+static
+char *
+__upc_alloc_sptostr (shared void *p)
+{
+ static char s[100];
+ sprintf (s, "(0x%012lx,0x%02x,0x%016lx)",
+ (long unsigned int)upc_phaseof(p), (unsigned int)upc_threadof(p),
+ (long unsigned int)upc_addrfield(p));
+ return s;
+}
+#endif /* DEBUG_ALLOC */
+
+/* upc_heap_init() is called from the runtime to initially
+ create the heap. Heap_base is the virtual address
+ of where the heap should begin, and heap_size is the
+ initial heap_size. The caller has already allocated
+ the underlying space. Note that the lower level
+ heap manager doesn't use locks -- all locking must
+ be done at a higher level. */
+
+void
+__upc_heap_init (upc_shared_ptr_t heap_base, size_t heap_size)
+{
+ int t;
+ upc_heap_p heap;
+ heap = *((upc_heap_p *)&heap_base);
+ upc_memset (heap, '\0', sizeof (upc_heap_t));
+ __upc_alloc_seq = 0;
+ /* the size of each free list entry includes its overhead. */
+ heap->size = heap_size;
+ heap->next = NULL;
+ heap->is_global = 1;
+ heap->alloc_seq = ++__upc_alloc_seq;
+ __upc_global_heap = heap;
+ for (t = 0; t < THREADS; ++t)
+ __upc_local_heap[t] = NULL;
+}
+
+/* Allocate a block of size 'alloc_size' identified indirectly
+ via 'heap_p'. 'alloc_size' must include the heap overhead.
+ The 'global_flag' is simply copied into the newly allocated
+ heap node. A pointer to the heap node is returned. */
+
+static
+upc_heap_p
+__upc_heap_alloc (shared upc_heap_p *heap_p, size_t alloc_size,
+ int global_flag)
+{
+ shared upc_heap_p *p;
+ upc_heap_p alloc;
+#ifdef DEBUG_ALLOC
+ printf ("%d: --> __upc_heap_alloc (%ld): heap on entry\n", MYTHREAD, (long int) alloc_size);
+ for (p = heap_p; *p; p = (shared upc_heap_p *)&(*p)->next)
+ printf("%d: addr: %s size: %ld global: %d seq: %d\n", MYTHREAD, __upc_alloc_sptostr(*p),(long int)(*p)->size,(*p)->is_global,(*p)->alloc_seq);
+#endif /* DEBUG_ALLOC */
+ for (p = heap_p; *p && ((*p)->size < alloc_size);
+ p = (shared upc_heap_p *)&(*p)->next) /* loop */ ;
+ alloc = *p;
+ if (alloc)
+ {
+ size_t this_size = alloc->size;
+ size_t rem = this_size - alloc_size;
+ alloc->is_global = global_flag;
+ alloc->alloc_tag = GUPCR_HEAP_ALLOC_TAG;
+ /* make sure the remaining fragment meets min. size requirement */
+ if (rem < (GUPCR_HEAP_ALLOC_MIN + GUPCR_HEAP_OVERHEAD))
+ {
+ alloc_size = this_size;
+ rem = 0;
+ }
+ alloc->size = alloc_size;
+ if (rem > 0)
+ {
+ /* link the remainder onto the free list */
+ upc_heap_p frag = __upc_alloc_ptr_add (alloc, alloc_size);
+ frag->next = alloc->next;
+ frag->alloc_seq = alloc->alloc_seq;
+ frag->is_global = alloc->is_global;
+ frag->alloc_tag = 0;
+ frag->size = rem;
+ *p = frag;
+ }
+ else
+ {
+ /* entry exactly fits, delink this free list entry */
+ *p = alloc->next;
+ }
+#ifdef DEBUG_ALLOC
+ printf ("%d: __upc_heap_alloc: heap on exit\n", MYTHREAD);
+ for (p = heap_p; *p; p = ( shared upc_heap_p *)&(*p)->next)
+ printf("%d: addr: %s size: %ld global: %d seq: %d\n",MYTHREAD,__upc_alloc_sptostr(*p),(long int)(*p)->size,(*p)->is_global,(*p)->alloc_seq);
+#endif /* DEBUG_ALLOC */
+ }
+#ifdef DEBUG_ALLOC
+ printf ("%d: <- __upc_heap_alloc: %s\n", MYTHREAD, __upc_alloc_sptostr (alloc));
+#endif /* DEBUG_ALLOC */
+ return alloc;
+}
+
+static
+void
+__upc_heap_free (shared upc_heap_p *heap_p, upc_heap_p ptr)
+{
+ shared upc_heap_p *p;
+ upc_heap_p prev;
+#ifdef DEBUG_ALLOC
+ printf ("%d: --> __upc_heap_free: ", MYTHREAD);
+ printf("%d: addr: %s size: %ld global: %d seq: %d\n", MYTHREAD,
+ __upc_alloc_sptostr(ptr),(long int)ptr->size,ptr->is_global,ptr->alloc_seq);
+ printf ("%d: heap on entry\n", MYTHREAD);
+ for (p = heap_p; *p; p = ( shared upc_heap_p *)&(*p)->next)
+ printf("%d: addr: %s size: %ld global: %d seq: %d\n", MYTHREAD, __upc_alloc_sptostr(*p),(long int)(*p)->size,(*p)->is_global,(*p)->alloc_seq);
+#endif /* DEBUG_ALLOC */
+ for (p = heap_p, prev = NULL; *p && (ptr > *p);
+ prev = *p, p = (shared upc_heap_p *)&(*p)->next) /* loop */ ;
+ ptr->alloc_tag = 0;
+ ptr->next = *p;
+ *p = ptr;
+ if (ptr->next && (ptr->next == __upc_alloc_ptr_add (ptr, ptr->size))
+ && (ptr->alloc_seq == ptr->next->alloc_seq))
+ {
+ /* adjacent, merge this block with the next */
+ ptr->size += ptr->next->size;
+ ptr->next = ptr->next->next;
+ }
+ if (prev && (ptr == __upc_alloc_ptr_add (prev, prev->size))
+ && (ptr->alloc_seq == prev->alloc_seq))
+ {
+ /* adjacent, merge this block with previous */
+ prev->size += ptr->size;
+ prev->next = ptr->next;
+ }
+#ifdef DEBUG_ALLOC
+ printf ("%d: <- __upc_heap_free: heap on exit\n", MYTHREAD);
+ for (p = heap_p; *p; p = ( shared upc_heap_p *)&(*p)->next)
+ printf("%d: addr: %s size: %ld global: %d seq: %d\n",MYTHREAD,__upc_alloc_sptostr(*p),(long int)(*p)->size,(*p)->is_global,(*p)->alloc_seq);
+#endif /* DEBUG_ALLOC */
+}
+
+
+/* Allocate a block of size 'alloc_size' from the global heap.
+ Extend the heap if more space is needed. 'alloc_size' is
+ the size of the heap node returned, inclusive of overhead. */
+
+static
+upc_heap_p
+__upc_global_heap_alloc (size_t alloc_size)
+{
+ shared upc_heap_p *heap_p = &__upc_global_heap;
+ upc_heap_p alloc;
+#ifdef DEBUG_ALLOC
+ printf ("%d: -> __upc_global_heap_alloc (%ld)\n", MYTHREAD, (long int)alloc_size);
+#endif /* DEBUG_ALLOC */
+ alloc = __upc_heap_alloc (heap_p, alloc_size, 1);
+ if (!alloc)
+ {
+ /* Extend the heap. */
+ const size_t chunk_size = GUPCR_ROUND (alloc_size,
+ GUPCR_HEAP_CHUNK_SIZE);
+ const size_t vm_alloc_size = GUPCR_ROUND (chunk_size, GUPCR_VM_PAGE_SIZE);
+ const upc_page_num_t vm_alloc_pages = vm_alloc_size / GUPCR_VM_PAGE_SIZE;
+ const upc_page_num_t cur_page_alloc = __upc_vm_get_cur_page_alloc ();
+ const size_t new_alloc_base = (size_t)cur_page_alloc * GUPCR_VM_PAGE_SIZE;
+ const upc_heap_p new_alloc = __upc_alloc_build_pts (new_alloc_base, 0);
+#ifdef DEBUG_ALLOC
+ printf ("%d: __upc_global_heap_alloc: extend heap by %d pages\n",
+ MYTHREAD, vm_alloc_pages);
+#endif /* DEBUG_ALLOC */
+ if (!__upc_vm_alloc (vm_alloc_pages))
+ return NULL;
+ upc_memset (new_alloc, '\0', sizeof (upc_heap_t));
+ new_alloc->size = vm_alloc_size;
+ new_alloc->next = NULL;
+ new_alloc->is_global = 1;
+ new_alloc->alloc_seq = ++__upc_alloc_seq;;
+ /* Return the newly allocated space to the heap. */
+ __upc_heap_free (heap_p, new_alloc);
+ alloc = __upc_heap_alloc (heap_p, alloc_size, 1);
+ if (!alloc)
+ __upc_fatal ("insufficient UPC dynamic shared memory");
+ }
+#ifdef DEBUG_ALLOC
+ printf ("%d: <- __upc_global_heap_alloc: %s\n", MYTHREAD, __upc_alloc_sptostr (alloc));
+#endif /* DEBUG_ALLOC */
+ return alloc;
+}
+
+static
+shared void *
+__upc_global_alloc (size_t size)
+{
+ shared void *mem = NULL;
+ if (size)
+ {
+ const size_t alloc_size = GUPCR_ROUND (size + GUPCR_HEAP_OVERHEAD,
+ GUPCR_HEAP_ALLOC_MIN);
+ upc_heap_p alloc;
+ __upc_acquire_alloc_lock ();
+ alloc = __upc_global_heap_alloc (alloc_size);
+ __upc_release_alloc_lock ();
+ if (alloc)
+ mem = __upc_alloc_ptr_add (alloc, GUPCR_HEAP_OVERHEAD);
+#ifdef DEBUG_ALLOC
+ printf ("%d: <- __upc_global_alloc: %s\n", MYTHREAD, __upc_alloc_sptostr(mem));
+#endif /* DEBUG_ALLOC */
+ }
+ return mem;
+}
+
+static
+inline
+shared void *
+__upc_local_alloc (size_t size)
+{
+ shared void *mem = NULL;
+#ifdef DEBUG_ALLOC
+ printf ("%d: --> __upc_local_alloc (%ld)\n", MYTHREAD,(long int)size);
+#endif /* DEBUG_ALLOC */
+ if (size)
+ {
+ const size_t alloc_size = GUPCR_ROUND (size + GUPCR_HEAP_OVERHEAD,
+ GUPCR_HEAP_ALLOC_MIN);
+ shared upc_heap_p *heap_p = &__upc_local_heap[MYTHREAD];
+ upc_heap_p alloc;
+ __upc_acquire_alloc_lock ();
+ alloc = __upc_heap_alloc (heap_p, alloc_size, 0);
+ if (!alloc)
+ {
+ int chunk_seq;
+ int t;
+ size_t chunk_size = GUPCR_ROUND (size + GUPCR_HEAP_OVERHEAD,
+ GUPCR_HEAP_CHUNK_SIZE);
+ upc_heap_p chunk = __upc_global_heap_alloc (chunk_size);
+ if (!chunk)
+ return NULL;
+ chunk_size = chunk->size;
+ chunk_seq = chunk->alloc_seq;
+ /* distribute this chunk over each local free list */
+ for (t = 0; t < THREADS; ++t)
+ {
+ shared upc_heap_p *local_heap_p = &__upc_local_heap[t];
+ /* Set the thread to 't' so that we can link
+ this chunk onto the thread's local heap. */
+ upc_heap_p local_chunk = __upc_alloc_build_pts (
+ upc_addrfield (chunk), t);
+ upc_fence;
+ /* add this local chunk onto the local free list */
+ upc_memset (local_chunk, '\0', sizeof (upc_heap_t));
+ local_chunk->size = chunk_size;
+ local_chunk->alloc_seq = chunk_seq;
+ __upc_heap_free (local_heap_p, local_chunk);
+ }
+ alloc = __upc_heap_alloc (heap_p, alloc_size, 0);
+ }
+ __upc_release_alloc_lock ();
+ if (alloc)
+ mem = __upc_alloc_ptr_add (alloc, GUPCR_HEAP_OVERHEAD);
+ }
+#ifdef DEBUG_ALLOC
+ printf ("%d: <-- __upc_local_alloc: %s\n", MYTHREAD, __upc_alloc_sptostr (mem));
+#endif /* DEBUG_ALLOC */
+ return mem;
+}
+
+shared void *
+upc_global_alloc (size_t nblocks, size_t nbytes)
+{
+ size_t request_size = GUPCR_ROUND(nblocks, THREADS) * nbytes;
+ size_t alloc_size = request_size / THREADS;
+ shared void *mem = __upc_global_alloc (alloc_size);
+ return mem;
+}
+
+shared void *
+upc_all_alloc (size_t nblocks, size_t nbytes)
+{
+ size_t request_size = GUPCR_ROUND(nblocks, THREADS) * nbytes;
+ size_t alloc_size = request_size / THREADS;
+ shared void *mem = NULL;
+ if (alloc_size)
+ {
+ upc_barrier -1;
+ if (MYTHREAD == 0)
+ __upc_all_alloc_val = __upc_global_alloc (alloc_size);
+ upc_barrier -1;
+ mem = __upc_all_alloc_val;
+ }
+ return mem;
+}
+
+shared void *
+upc_alloc (size_t nbytes)
+{
+ shared void *mem = NULL;
+ if (nbytes)
+ mem = __upc_local_alloc (nbytes);
+ return mem;
+}
+
+void
+upc_all_free (shared void *ptr)
+{
+ if (ptr)
+ {
+ const int thread = (int)upc_threadof (ptr);
+ upc_barrier -1;
+ /* Check for errors only on thread 0. */
+ if ((MYTHREAD == 0) && (thread >= THREADS))
+ __upc_fatal ("upc_all_free() called with invalid shared pointer");
+ if (thread == MYTHREAD)
+ upc_free (ptr);
+ }
+}
+
+void
+upc_free (shared void *ptr)
+{
+ if (ptr)
+ {
+ const size_t offset __attribute__ ((unused)) = upc_addrfield (ptr);
+ const int thread = (int)upc_threadof (ptr);
+ const size_t phase = upc_phaseof (ptr);
+ shared upc_heap_p *heap_p;
+ upc_heap_p thisp;
+ if (phase || thread >= THREADS)
+ __upc_fatal ("upc_free() called with invalid shared pointer");
+ thisp = (upc_heap_p) __upc_alloc_ptr_add (ptr, -GUPCR_HEAP_OVERHEAD);
+ if (thisp->is_global && thread)
+ __upc_fatal ("upc_free() called with invalid shared pointer");
+ if (thisp->alloc_tag != GUPCR_HEAP_ALLOC_TAG)
+ __upc_fatal ("upc_free() called with pointer to unallocated space");
+ if (thisp->is_global)
+ heap_p = (shared upc_heap_p *)&__upc_global_heap;
+ else
+ heap_p = (shared upc_heap_p *)&__upc_local_heap[thread];
+ __upc_acquire_alloc_lock ();
+ __upc_heap_free (heap_p, thisp);
+ __upc_release_alloc_lock ();
+ }
+}
diff --git a/libgupc/smp/upc_allocg.upc b/libgupc/smp/upc_allocg.upc
new file mode 100644
index 00000000000..20fee965440
--- /dev/null
+++ b/libgupc/smp/upc_allocg.upc
@@ -0,0 +1,115 @@
+/* Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include <upc.h>
+#include "gasp_upc.h"
+#include "upc_pupc.h"
+
+#ifndef NULL
+#define NULL (void *)0
+#endif
+
+/* The filename of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+extern GUPCR_THREAD_LOCAL const char *__upc_err_filename;
+
+/* The line number of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+extern GUPCR_THREAD_LOCAL unsigned int __upc_err_linenum;
+
+#define GUPCR_SET_ERR_LOC() \
+ do \
+ { \
+ __upc_err_filename = filename; \
+ __upc_err_linenum = linenum; \
+ } while (0)
+
+#define GUPCR_CLEAR_ERR_LOC() \
+ do \
+ { \
+ __upc_err_filename = NULL; \
+ __upc_err_linenum = 0; \
+ } while (0)
+
+shared void *
+upc_global_allocg (size_t nblocks, size_t nbytes, const char *filename,
+ int linenum)
+{
+ shared void *result;
+ p_start (GASP_UPC_GLOBAL_ALLOC, nblocks, nbytes);
+ GUPCR_SET_ERR_LOC();
+ result = upc_global_alloc (nblocks, nbytes);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_GLOBAL_ALLOC, nblocks, nbytes, &result);
+ return result;
+}
+
+shared void *
+upc_all_allocg (size_t nblocks, size_t nbytes, const char *filename, int linenum)
+{
+ shared void *result;
+ p_start (GASP_UPC_ALL_ALLOC, nblocks, nbytes);
+ GUPCR_SET_ERR_LOC();
+ result = upc_all_alloc (nblocks, nbytes);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_ALL_ALLOC, nblocks, nbytes, &result);
+ return result;
+}
+
+shared void *
+upc_allocg (size_t nbytes, const char *filename, int linenum)
+{
+ shared void *val;
+ p_start (GASP_UPC_ALLOC, nbytes);
+ GUPCR_SET_ERR_LOC();
+ val = upc_alloc (nbytes);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_ALLOC, nbytes, &val);
+ return val;
+}
+
+void
+upc_freeg (shared void *ptr, const char *filename, int linenum)
+{
+ p_start (GASP_UPC_FREE, &ptr);
+ GUPCR_SET_ERR_LOC();
+ upc_free (ptr);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_FREE, &ptr);
+}
+
+void
+upc_all_freeg (shared void *ptr, const char *filename, int linenum)
+{
+ p_start (GASP_UPC_FREE, &ptr);
+ GUPCR_SET_ERR_LOC();
+ upc_all_free (ptr);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_FREE, &ptr);
+}
diff --git a/libgupc/smp/upc_atomic.def b/libgupc/smp/upc_atomic.def
new file mode 100644
index 00000000000..787e41c15aa
--- /dev/null
+++ b/libgupc/smp/upc_atomic.def
@@ -0,0 +1,5 @@
+Autogen Definitions upc_atomic;
+
+#include upc_types.def
+#include upc_ops.def
+
diff --git a/libgupc/smp/upc_atomic.tpl b/libgupc/smp/upc_atomic.tpl
new file mode 100644
index 00000000000..4e060bfbd61
--- /dev/null
+++ b/libgupc/smp/upc_atomic.tpl
@@ -0,0 +1,555 @@
+[= Autogen5 template upc =]
+/* Process the definitions file with autogen to produce upc_atomic.upc:
+
+ autogen -L ../include upc_atomic.def
+
+ Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <upc_atomic.h>
+#include "upc_config.h"
+
+/**
+ * @file __upc_atomic.upc
+ * GUPC Portals4 UPC atomics implementation.
+ */
+
+/**
+ * @addtogroup ATOMIC GUPCR Atomics Functions
+ * @{
+ */
+
+/** Atomic domain representation */
+struct upc_atomicdomain_struct
+{
+ upc_op_t ops;
+ upc_type_t optype;
+};
+
+/* Represent a bit-encoded operation as an integer. */
+typedef unsigned int upc_op_num_t;
+
+[= FOR upc_type =][=
+ IF (exist? "type_atomic_ok") =][=
+ (define abbrev-type (string-append (get "type_abbrev") "_type")) =]
+typedef [=type_c_name=] [= (. abbrev-type) =];[=
+ ENDIF =][=
+ENDFOR =]
+
+[= (define access-ops "") =][=
+ FOR upc_op =][=
+ (if (and (exist? "op_atomic_ok") (= (get "op_mode") "access"))
+ (begin
+ (if (> (string-length access-ops) 0)
+ (set! access-ops (string-append access-ops " | ")))
+ (set! access-ops (string-append access-ops
+ (get "op_upc_name"))))) =][=
+ ENDFOR =]
+#define ATOMIC_ACCESS_OPS ([= (. access-ops) =])
+[= (define num-ops "") =][=
+ FOR upc_op =][=
+ (if (and (exist? "op_atomic_ok") (= (get "op_mode") "numeric"))
+ (begin
+ (if (> (string-length num-ops) 0)
+ (set! num-ops (string-append num-ops " | ")))
+ (set! num-ops (string-append num-ops (get "op_upc_name"))))) =][=
+ ENDFOR =]
+#define ATOMIC_NUM_OPS ([= (. num-ops) =])
+[= (define bit-ops "") =][=
+ FOR upc_op =][=
+ (if (and (exist? "op_atomic_ok") (= (get "op_mode") "logical"))
+ (begin
+ (if (> (string-length bit-ops) 0)
+ (set! bit-ops (string-append bit-ops " | ")))
+ (set! bit-ops (string-append bit-ops (get "op_upc_name"))))) =][=
+ ENDFOR =]
+#define ATOMIC_BIT_OPS ([= (. bit-ops) =])
+#define ATOMIC_ALL_OPS (ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS \
+ | ATOMIC_BIT_OPS)
+
+/**
+ * Check if OP is a valid atomic operation type.
+ *
+ * @param [in] op UPC atomic operation
+ * @retval TRUE if op is a valid atomic operation
+ */
+static inline bool
+__upc_atomic_is_valid_op (upc_op_t op)
+{
+ return !((op & ~(-op)) || (op & ~ATOMIC_ALL_OPS));
+}
+
+/**
+ * Convert the bit-encoded OP into an integer.
+ *
+ * @param [in] op UPC atomic operation
+ * @retval op represented as integer index
+ * (UPC_ADD_OP, UPC_MULT_OP ...)
+ */
+static inline upc_op_num_t
+__upc_atomic_op_num (upc_op_t op)
+{
+ return (LONG_LONG_BITS - 1) - __builtin_clzll ((long long) op);
+}
+
+/**
+ * Check if UPC_TYPE is a valid atomic operation type.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval TRUE if atomic operations are supported on UPC_TYPE
+ */
+static bool
+__upc_atomic_is_valid_type (upc_type_t upc_type)
+{
+ switch (upc_type)
+ {[=
+FOR upc_type =][=
+ IF (exist? "type_atomic_ok") =]
+ case [=type_upc_name=]:[=
+ ENDIF =][=
+ENDFOR =]
+ return true;
+ default: break;
+ }
+ return false;
+}
+
+/**
+ * Return the atomic operations supported for type UPC_TYPE.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval bit vector of supported atomic operations.
+ */
+static upc_op_t
+__upc_atomic_supported_ops (upc_type_t upc_type)
+{
+ switch (upc_type)
+ {[=
+FOR upc_type =][=
+ IF (exist? "type_atomic_ok") =][=
+ (define valid-ops "ATOMIC_ACCESS_OPS")
+ (if (exist? "type_numeric_op_ok")
+ (set! valid-ops (string-append
+ valid-ops " | ATOMIC_NUM_OPS")))
+ (if (exist? "type_bit_op_ok")
+ (set! valid-ops (string-append
+ valid-ops " | ATOMIC_BIT_OPS"))) =]
+ case [=type_upc_name=]:
+ return [= (. valid-ops) =];[=
+ ENDIF =][=
+ENDFOR =]
+ }
+ return 0;
+}
+
+/**
+ * Convert UPC atomic operation into a string.
+ *
+ * @param [in] upc_op UPC atomic operation
+ * @retval Character string
+ */
+static const char *
+__upc_atomic_op_name (upc_op_num_t op_num)
+{
+ switch (op_num)
+ {[=
+FOR upc_op =][=
+ IF (exist? "op_atomic_ok") =]
+ case [=op_upc_name=]_OP:
+ return "[=op_upc_name=]";[=
+ ENDIF =][=
+ENDFOR =]
+ }
+ return NULL;
+}
+
+/**
+ * Convert UPC atomic type into a string.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval Character string
+ */
+static const char *
+__upc_atomic_type_name (upc_type_t upc_type)
+{
+ switch (upc_type)
+ {[=
+FOR upc_type =][=
+ IF (exist? "type_atomic_ok") =]
+ case [=type_upc_name=]:
+ return "[=type_upc_name=]";[=
+ ENDIF =][=
+ENDFOR =]
+ }
+ return NULL;
+}
+
+#define REQ_FETCH_PTR 0b00000001
+#define REQ_OPERAND1 0b00000010
+#define REQ_OPERAND2 0b00000100
+#define NULL_OPERAND1 0b00001000
+#define NULL_OPERAND2 0b00010000
+
+static const unsigned int operand_check[] =
+ {[=
+FOR upc_op =]
+ /* [=op_upc_name=]_OP */ [=
+ (define nil '())
+ (define check-bits nil) =][=
+ IF (exist? "op_atomic_ok") =][=
+ (if (exist? "op_require_fetch_ptr")
+ (set! check-bits (append check-bits '("REQ_FETCH_PTR"))))
+ (if (exist? "op_require_operand1")
+ (set! check-bits (append check-bits '("REQ_OPERAND1"))))
+ (if (exist? "op_require_operand2")
+ (set! check-bits (append check-bits '("REQ_OPERAND2"))))
+ (if (exist? "op_null_operand1")
+ (set! check-bits (append check-bits '("NULL_OPERAND1"))))
+ (if (exist? "op_null_operand2")
+ (set! check-bits (append check-bits '("NULL_OPERAND2")))) =][=
+ ELSE =][=
+ (set! check-bits (append check-bits "0")) =][=
+ ENDIF =][=
+ (. (join " | " check-bits)) =],[=
+ENDFOR =]
+ };
+
+static inline void
+__upc_atomic_check_operands (upc_op_num_t op_num,
+ void * restrict fetch_ptr,
+ const void * restrict operand1,
+ const void * restrict operand2)
+{
+ const unsigned int check = operand_check[op_num];
+ if ((check & REQ_FETCH_PTR) && fetch_ptr == NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a non-NULL fetch pointer",
+ __upc_atomic_op_name (op_num));
+ if ((check & REQ_OPERAND1) && operand1 == NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a non-NULL operand1 pointer",
+ __upc_atomic_op_name (op_num));
+ if ((check & REQ_OPERAND2) && operand2 == NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a non-NULL operand2 pointer",
+ __upc_atomic_op_name (op_num));
+ if ((check & NULL_OPERAND1) && operand1 != NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a NULL operand1 pointer",
+ __upc_atomic_op_name (op_num));
+ if ((check & NULL_OPERAND2) && operand2 != NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a NULL operand2 pointer",
+ __upc_atomic_op_name (op_num));
+}[=
+FOR upc_type =][= IF (exist? "type_atomic_ok") =][=
+ (define abbrev-type (string-append (get "type_abbrev") "_type")) =]
+
+static void
+__upc_atomic_[=type_abbrev=] (
+ [= (. abbrev-type) =] * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared [= (. abbrev-type) =] * restrict target,
+ [= (. abbrev-type) =] * restrict operand1 __attribute__((unused)),
+ [= (. abbrev-type) =] * restrict operand2 __attribute__((unused)))
+{
+ [= (. abbrev-type) =] orig_value __attribute__((unused));
+ [= (. abbrev-type) =] new_value __attribute__((unused));
+ [=IF (= (get "type_abbrev") "PTS") =]
+ int op_ok __attribute__((unused));[=
+ ENDIF =]
+ [= (. abbrev-type) =] *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {[=
+ FOR upc_op =][=
+ IF (exist? "op_atomic_ok") =][=
+ IF (= (get "op_mode") "access") =]
+ case [=op_upc_name=]_OP:[=
+ CASE op_upc_name =][=
+ = 'UPC_GET' =]
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);[=
+ = 'UPC_SET' =]
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);[=
+ = 'UPC_CSWAP' =]
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */[=
+ IF (= (get "type_abbrev") "PTS") =]
+ op_ok = __atomic_compare_exchange (target_ptr, &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ /* If the previous compare exchange operation failed, check
+ for UPC PTS equality (which ignores phase). If the pointers
+ compare as equal, try again. */
+ if (!op_ok && (orig_value == *operand1))
+ {
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ }[=
+ ELSE =]
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);[=
+ ENDIF =][=
+ ESAC =]
+ break;[=
+ ENDIF =][=
+ IF (or (and (exist? "type_numeric_op_ok")
+ (= (get "op_mode") "numeric"))
+ (and (exist? "type_bit_op_ok")
+ (= (get "op_mode") "logical"))) =]
+ case [=op_upc_name=]_OP:[=
+ IF (and (not (exist? "type_floating_point"))
+ (~* (get "op_upc_name")
+ "UPC_(ADD|SUB|INC|DEC|AND|OR|XOR)$")) =][=
+ CASE op_upc_name =][=
+ ~* 'UPC_(ADD|SUB|AND|OR|XOR)$' =]
+ orig_value = __atomic_fetch_[=op_name=] (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);[=
+ = 'UPC_INC' =]
+ orig_value = __atomic_fetch_add (target_ptr, ([=type_c_name=]) 1,
+ __ATOMIC_SEQ_CST);[=
+ = 'UPC_DEC' =]
+ orig_value = __atomic_fetch_sub (target_ptr, ([=type_c_name=]) 1,
+ __ATOMIC_SEQ_CST);[=
+ ESAC =][=
+ ELSE =][=
+ (define op_calc "") =][=
+ CASE op_upc_name =][=
+ ~* 'UPC_(ADD|SUB|AND|OR|XOR)$' =][=
+ (set! op_calc
+ (string-append "orig_value "
+ (get "op_op")
+ " *operand1")) =][=
+ ~* 'UPC_(INC|DEC)$' =][=
+ (set! op_calc
+ (string-append "orig_value "
+ (get "op_op")
+ " (" (get "type_c_name") ") 1")) =][=
+ = 'UPC_MULT' =][=
+ (set! op_calc "orig_value * *operand1") =][=
+ = 'UPC_MIN' =][=
+ (set! op_calc
+ "(*operand1 < orig_value) ? *operand1 : orig_value") =][=
+ = 'UPC_MAX' =][=
+ (set! op_calc
+ "(*operand1 > orig_value) ? *operand1 : orig_value") =][=
+ ESAC =]
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = [= (. op_calc) =];
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));[=
+ ENDIF =]
+ break;[=
+ ENDIF =][=
+ ENDIF =][=
+ ENDFOR =]
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}[=
+ ENDIF =][=
+ENDFOR =]
+
+/**
+ * UPC atomic relaxed operation.
+ *
+ * @param [in] domain Atomic domain
+ * @param [in] fetch_ptr Target of the update
+ * @param [in] op Atomic operation
+ * @param [in] target Target address of the operation
+ * @param [in] operand1 Operation required argument
+ * @param [in] operand2 Operation required argument
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_atomic_relaxed (upc_atomicdomain_t *domain,
+ void * restrict fetch_ptr,
+ upc_op_t op,
+ shared void * restrict target,
+ const void * restrict operand1,
+ const void * restrict operand2)
+{
+ struct upc_atomicdomain_struct *ldomain =
+ (struct upc_atomicdomain_struct *) &domain[MYTHREAD];
+ upc_op_num_t op_num;
+ if (op & ~(-op))
+ __upc_fatal ("atomic operation (0x%llx) may have only "
+ "a single bit set", (long long)op);
+ if (!__upc_atomic_is_valid_op (op))
+ __upc_fatal ("invalid atomic operation (0x%llx)",
+ (long long)op);
+ op_num = __upc_atomic_op_num (op);
+ if (op & ~ldomain->ops)
+ __upc_fatal ("invalid operation (%s) for specified domain",
+ __upc_atomic_op_name (op_num));
+ __upc_atomic_check_operands (op_num, fetch_ptr, operand1, operand2);
+ switch (ldomain->optype)
+ {[=
+ FOR upc_type =][= IF (exist? "type_atomic_ok") =][=
+ (define abbrev-type (string-append (get "type_abbrev") "_type")) =]
+ case [=type_upc_name=]:
+ __upc_atomic_[=type_abbrev=] (
+ ([= (. abbrev-type) =] *) fetch_ptr,
+ op_num,
+ (shared [= (. abbrev-type) =] *) target,
+ ([= (. abbrev-type) =] *) operand1,
+ ([= (. abbrev-type) =] *) operand2);
+ break;[=
+ ENDIF =][= ENDFOR =]
+ }
+}
+
+/**
+ * UPC atomic strict operation.
+ *
+ * @param [in] domain Atomic domain
+ * @param [in] fetch_ptr Target of the update
+ * @param [in] op Atomic operation
+ * @param [in] target Target address of the operation
+ * @param [in] operand1 Operation required argument
+ * @param [in] operand2 Operation required argument
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_atomic_strict (upc_atomicdomain_t *domain,
+ void * restrict fetch_ptr,
+ upc_op_t op,
+ shared void * restrict target,
+ const void * restrict operand1,
+ const void * restrict operand2)
+{
+ upc_fence;
+ upc_atomic_relaxed (domain, fetch_ptr, op, target, operand1, operand2);
+ upc_fence;
+}
+
+/**
+ * Collective allocation of atomic domain.
+ *
+ * Implementation uses native Portals4 atomic functions and the
+ * hint field is ignored.
+ *
+ * @parm [in] type Atomic operation type
+ * @parm [in] ops Atomic domain operations
+ * @parm [in] hints Atomic operation hint
+ * @retval Allocated atomic domain pointer
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+upc_atomicdomain_t *
+upc_all_atomicdomain_alloc (upc_type_t type,
+ upc_op_t ops,
+ __attribute__((unused)) upc_atomichint_t hints)
+{
+ upc_atomicdomain_t *domain;
+ struct upc_atomicdomain_struct *ldomain;
+ upc_op_t supported_ops;
+ if (!__upc_atomic_is_valid_type (type))
+ __upc_fatal ("unsupported atomic type: 0x%llx",
+ (long long) type);
+ supported_ops = __upc_atomic_supported_ops (type);
+ if ((ops & ~supported_ops) != 0)
+ __upc_fatal ("one/more requested atomic operations (0x%llx) unsupported "
+ "for type `%s'", (long long) ops,
+ __upc_atomic_type_name (type));
+ domain = (upc_atomicdomain_t *)
+ upc_all_alloc (THREADS, sizeof (struct upc_atomicdomain_struct));
+ if (domain == NULL)
+ __upc_fatal ("unable to allocate atomic domain");
+ ldomain = (struct upc_atomicdomain_struct *)&domain[MYTHREAD];
+ ldomain->ops = ops;
+ ldomain->optype = type;
+ return domain;
+}
+
+/**
+ * Collective free of the atomic domain.
+ *
+ * @param [in] domain Pointer to atomic domain
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_all_atomicdomain_free (upc_atomicdomain_t * domain)
+{
+ assert (domain != NULL);
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ upc_free (domain);
+ }
+ upc_barrier;
+}
+
+/**
+ * Query implementation for expected performance.
+ *
+ * @parm [in] ops Atomic domain operations
+ * @parm [in] optype Atomic operation type
+ * @parm [in] addr Atomic address
+ * @retval Expected performance
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+int
+upc_atomic_isfast (__attribute__((unused)) upc_type_t optype,
+ __attribute__((unused)) upc_op_t ops,
+ __attribute__((unused)) shared void *addr)
+{
+ /* We could make the distinction that only operations
+ directly supported by the builtin atomics are "fast",
+ but for now ... everything in the SMP runtime is
+ defined to be fast. */
+ return UPC_ATOMIC_PERFORMANCE_FAST;
+}
+
+/** @} */
diff --git a/libgupc/smp/upc_atomic.upc b/libgupc/smp/upc_atomic.upc
new file mode 100644
index 00000000000..e07d38fddbd
--- /dev/null
+++ b/libgupc/smp/upc_atomic.upc
@@ -0,0 +1,1872 @@
+/* Process the definitions file with autogen to produce upc_atomic.upc:
+
+ autogen -L ../include upc_atomic.def
+
+ Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <upc_atomic.h>
+#include "upc_config.h"
+
+/**
+ * @file __upc_atomic.upc
+ * GUPC Portals4 UPC atomics implementation.
+ */
+
+/**
+ * @addtogroup ATOMIC GUPCR Atomics Functions
+ * @{
+ */
+
+/** Atomic domain representation */
+struct upc_atomicdomain_struct
+{
+ upc_op_t ops;
+ upc_type_t optype;
+};
+
+/* Represent a bit-encoded operation as an integer. */
+typedef unsigned int upc_op_num_t;
+
+
+typedef int I_type;
+typedef unsigned int UI_type;
+typedef long L_type;
+typedef unsigned long UL_type;
+typedef long long LL_type;
+typedef unsigned long long ULL_type;
+typedef int32_t I32_type;
+typedef uint32_t UI32_type;
+typedef int64_t I64_type;
+typedef uint64_t UI64_type;
+typedef float F_type;
+typedef double D_type;
+typedef shared void * PTS_type;
+
+
+#define ATOMIC_ACCESS_OPS (UPC_GET | UPC_SET | UPC_CSWAP)
+
+#define ATOMIC_NUM_OPS (UPC_ADD | UPC_MULT | UPC_MIN | UPC_MAX | UPC_SUB | UPC_INC | UPC_DEC)
+
+#define ATOMIC_BIT_OPS (UPC_AND | UPC_OR | UPC_XOR)
+#define ATOMIC_ALL_OPS (ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS \
+ | ATOMIC_BIT_OPS)
+
+/**
+ * Check if OP is a valid atomic operation type.
+ *
+ * @param [in] op UPC atomic operation
+ * @retval TRUE if op is a valid atomic operation
+ */
+static inline bool
+__upc_atomic_is_valid_op (upc_op_t op)
+{
+ return !((op & ~(-op)) || (op & ~ATOMIC_ALL_OPS));
+}
+
+/**
+ * Convert the bit-encoded OP into an integer.
+ *
+ * @param [in] op UPC atomic operation
+ * @retval op represented as integer index
+ * (UPC_ADD_OP, UPC_MULT_OP ...)
+ */
+static inline upc_op_num_t
+__upc_atomic_op_num (upc_op_t op)
+{
+ return (LONG_LONG_BITS - 1) - __builtin_clzll ((long long) op);
+}
+
+/**
+ * Check if UPC_TYPE is a valid atomic operation type.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval TRUE if atomic operations are supported on UPC_TYPE
+ */
+static bool
+__upc_atomic_is_valid_type (upc_type_t upc_type)
+{
+ switch (upc_type)
+ {
+ case UPC_INT:
+ case UPC_UINT:
+ case UPC_LONG:
+ case UPC_ULONG:
+ case UPC_LLONG:
+ case UPC_ULLONG:
+ case UPC_INT32:
+ case UPC_UINT32:
+ case UPC_INT64:
+ case UPC_UINT64:
+ case UPC_FLOAT:
+ case UPC_DOUBLE:
+ case UPC_PTS:
+ return true;
+ default: break;
+ }
+ return false;
+}
+
+/**
+ * Return the atomic operations supported for type UPC_TYPE.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval bit vector of supported atomic operations.
+ */
+static upc_op_t
+__upc_atomic_supported_ops (upc_type_t upc_type)
+{
+ switch (upc_type)
+ {
+ case UPC_INT:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_UINT:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_LONG:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_ULONG:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_LLONG:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_ULLONG:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_INT32:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_UINT32:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_INT64:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_UINT64:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS | ATOMIC_BIT_OPS;
+ case UPC_FLOAT:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS;
+ case UPC_DOUBLE:
+ return ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS;
+ case UPC_PTS:
+ return ATOMIC_ACCESS_OPS;
+ }
+ return 0;
+}
+
+/**
+ * Convert UPC atomic operation into a string.
+ *
+ * @param [in] upc_op UPC atomic operation
+ * @retval Character string
+ */
+static const char *
+__upc_atomic_op_name (upc_op_num_t op_num)
+{
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ return "UPC_ADD";
+ case UPC_MULT_OP:
+ return "UPC_MULT";
+ case UPC_AND_OP:
+ return "UPC_AND";
+ case UPC_OR_OP:
+ return "UPC_OR";
+ case UPC_XOR_OP:
+ return "UPC_XOR";
+ case UPC_MIN_OP:
+ return "UPC_MIN";
+ case UPC_MAX_OP:
+ return "UPC_MAX";
+ case UPC_GET_OP:
+ return "UPC_GET";
+ case UPC_SET_OP:
+ return "UPC_SET";
+ case UPC_CSWAP_OP:
+ return "UPC_CSWAP";
+ case UPC_SUB_OP:
+ return "UPC_SUB";
+ case UPC_INC_OP:
+ return "UPC_INC";
+ case UPC_DEC_OP:
+ return "UPC_DEC";
+ }
+ return NULL;
+}
+
+/**
+ * Convert UPC atomic type into a string.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval Character string
+ */
+static const char *
+__upc_atomic_type_name (upc_type_t upc_type)
+{
+ switch (upc_type)
+ {
+ case UPC_INT:
+ return "UPC_INT";
+ case UPC_UINT:
+ return "UPC_UINT";
+ case UPC_LONG:
+ return "UPC_LONG";
+ case UPC_ULONG:
+ return "UPC_ULONG";
+ case UPC_LLONG:
+ return "UPC_LLONG";
+ case UPC_ULLONG:
+ return "UPC_ULLONG";
+ case UPC_INT32:
+ return "UPC_INT32";
+ case UPC_UINT32:
+ return "UPC_UINT32";
+ case UPC_INT64:
+ return "UPC_INT64";
+ case UPC_UINT64:
+ return "UPC_UINT64";
+ case UPC_FLOAT:
+ return "UPC_FLOAT";
+ case UPC_DOUBLE:
+ return "UPC_DOUBLE";
+ case UPC_PTS:
+ return "UPC_PTS";
+ }
+ return NULL;
+}
+
+#define REQ_FETCH_PTR 0b00000001
+#define REQ_OPERAND1 0b00000010
+#define REQ_OPERAND2 0b00000100
+#define NULL_OPERAND1 0b00001000
+#define NULL_OPERAND2 0b00010000
+
+static const unsigned int operand_check[] =
+ {
+ /* UPC_ADD_OP */ REQ_OPERAND1 | NULL_OPERAND2,
+ /* UPC_MULT_OP */ REQ_OPERAND1 | NULL_OPERAND2,
+ /* UPC_AND_OP */ REQ_OPERAND1 | NULL_OPERAND2,
+ /* UPC_OR_OP */ REQ_OPERAND1 | NULL_OPERAND2,
+ /* UPC_XOR_OP */ REQ_OPERAND1 | NULL_OPERAND2,
+ /* UPC_LOGAND_OP */ 0,
+ /* UPC_LOGOR_OP */ 0,
+ /* UPC_MIN_OP */ REQ_OPERAND1 | NULL_OPERAND2,
+ /* UPC_MAX_OP */ REQ_OPERAND1 | NULL_OPERAND2,
+ /* UPC_GET_OP */ REQ_FETCH_PTR | NULL_OPERAND1 | NULL_OPERAND2,
+ /* UPC_SET_OP */ REQ_OPERAND1 | NULL_OPERAND2,
+ /* UPC_CSWAP_OP */ REQ_OPERAND1 | REQ_OPERAND2,
+ /* UPC_SUB_OP */ REQ_OPERAND1 | NULL_OPERAND2,
+ /* UPC_INC_OP */ NULL_OPERAND1 | NULL_OPERAND2,
+ /* UPC_DEC_OP */ NULL_OPERAND1 | NULL_OPERAND2,
+ };
+
+static inline void
+__upc_atomic_check_operands (upc_op_num_t op_num,
+ void * restrict fetch_ptr,
+ const void * restrict operand1,
+ const void * restrict operand2)
+{
+ const unsigned int check = operand_check[op_num];
+ if ((check & REQ_FETCH_PTR) && fetch_ptr == NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a non-NULL fetch pointer",
+ __upc_atomic_op_name (op_num));
+ if ((check & REQ_OPERAND1) && operand1 == NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a non-NULL operand1 pointer",
+ __upc_atomic_op_name (op_num));
+ if ((check & REQ_OPERAND2) && operand2 == NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a non-NULL operand2 pointer",
+ __upc_atomic_op_name (op_num));
+ if ((check & NULL_OPERAND1) && operand1 != NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a NULL operand1 pointer",
+ __upc_atomic_op_name (op_num));
+ if ((check & NULL_OPERAND2) && operand2 != NULL)
+ __upc_fatal ("atomic operation `%s' "
+ "requires a NULL operand2 pointer",
+ __upc_atomic_op_name (op_num));
+}
+
+static void
+__upc_atomic_I (
+ I_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared I_type * restrict target,
+ I_type * restrict operand1 __attribute__((unused)),
+ I_type * restrict operand2 __attribute__((unused)))
+{
+ I_type orig_value __attribute__((unused));
+ I_type new_value __attribute__((unused));
+
+ I_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (int) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (int) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_UI (
+ UI_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared UI_type * restrict target,
+ UI_type * restrict operand1 __attribute__((unused)),
+ UI_type * restrict operand2 __attribute__((unused)))
+{
+ UI_type orig_value __attribute__((unused));
+ UI_type new_value __attribute__((unused));
+
+ UI_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (unsigned int) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (unsigned int) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_L (
+ L_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared L_type * restrict target,
+ L_type * restrict operand1 __attribute__((unused)),
+ L_type * restrict operand2 __attribute__((unused)))
+{
+ L_type orig_value __attribute__((unused));
+ L_type new_value __attribute__((unused));
+
+ L_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (long) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (long) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_UL (
+ UL_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared UL_type * restrict target,
+ UL_type * restrict operand1 __attribute__((unused)),
+ UL_type * restrict operand2 __attribute__((unused)))
+{
+ UL_type orig_value __attribute__((unused));
+ UL_type new_value __attribute__((unused));
+
+ UL_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (unsigned long) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (unsigned long) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_LL (
+ LL_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared LL_type * restrict target,
+ LL_type * restrict operand1 __attribute__((unused)),
+ LL_type * restrict operand2 __attribute__((unused)))
+{
+ LL_type orig_value __attribute__((unused));
+ LL_type new_value __attribute__((unused));
+
+ LL_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (long long) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (long long) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_ULL (
+ ULL_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared ULL_type * restrict target,
+ ULL_type * restrict operand1 __attribute__((unused)),
+ ULL_type * restrict operand2 __attribute__((unused)))
+{
+ ULL_type orig_value __attribute__((unused));
+ ULL_type new_value __attribute__((unused));
+
+ ULL_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (unsigned long long) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (unsigned long long) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_I32 (
+ I32_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared I32_type * restrict target,
+ I32_type * restrict operand1 __attribute__((unused)),
+ I32_type * restrict operand2 __attribute__((unused)))
+{
+ I32_type orig_value __attribute__((unused));
+ I32_type new_value __attribute__((unused));
+
+ I32_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (int32_t) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (int32_t) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_UI32 (
+ UI32_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared UI32_type * restrict target,
+ UI32_type * restrict operand1 __attribute__((unused)),
+ UI32_type * restrict operand2 __attribute__((unused)))
+{
+ UI32_type orig_value __attribute__((unused));
+ UI32_type new_value __attribute__((unused));
+
+ UI32_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (uint32_t) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (uint32_t) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_I64 (
+ I64_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared I64_type * restrict target,
+ I64_type * restrict operand1 __attribute__((unused)),
+ I64_type * restrict operand2 __attribute__((unused)))
+{
+ I64_type orig_value __attribute__((unused));
+ I64_type new_value __attribute__((unused));
+
+ I64_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (int64_t) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (int64_t) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_UI64 (
+ UI64_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared UI64_type * restrict target,
+ UI64_type * restrict operand1 __attribute__((unused)),
+ UI64_type * restrict operand2 __attribute__((unused)))
+{
+ UI64_type orig_value __attribute__((unused));
+ UI64_type new_value __attribute__((unused));
+
+ UI64_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ orig_value = __atomic_fetch_add (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_AND_OP:
+ orig_value = __atomic_fetch_and (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_OR_OP:
+ orig_value = __atomic_fetch_or (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_XOR_OP:
+ orig_value = __atomic_fetch_xor (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, *operand1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_INC_OP:
+ orig_value = __atomic_fetch_add (target_ptr, (uint64_t) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_DEC_OP:
+ orig_value = __atomic_fetch_sub (target_ptr, (uint64_t) 1,
+ __ATOMIC_SEQ_CST);
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_F (
+ F_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared F_type * restrict target,
+ F_type * restrict operand1 __attribute__((unused)),
+ F_type * restrict operand2 __attribute__((unused)))
+{
+ F_type orig_value __attribute__((unused));
+ F_type new_value __attribute__((unused));
+
+ F_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value + *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value - *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_INC_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value + (float) 1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_DEC_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value - (float) 1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_D (
+ D_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared D_type * restrict target,
+ D_type * restrict operand1 __attribute__((unused)),
+ D_type * restrict operand2 __attribute__((unused)))
+{
+ D_type orig_value __attribute__((unused));
+ D_type new_value __attribute__((unused));
+
+ D_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_ADD_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value + *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MULT_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value * *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MIN_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 < orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_MAX_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = (*operand1 > orig_value) ? *operand1 : orig_value;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SUB_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value - *operand1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_INC_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value + (double) 1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ case UPC_DEC_OP:
+ do
+ {
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ new_value = orig_value - (double) 1;
+ }
+ while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST));
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+static void
+__upc_atomic_PTS (
+ PTS_type * restrict fetch_ptr,
+ upc_op_num_t op_num,
+ shared PTS_type * restrict target,
+ PTS_type * restrict operand1 __attribute__((unused)),
+ PTS_type * restrict operand2 __attribute__((unused)))
+{
+ PTS_type orig_value __attribute__((unused));
+ PTS_type new_value __attribute__((unused));
+
+ int op_ok __attribute__((unused));
+ PTS_type *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+ switch (op_num)
+ {
+ case UPC_GET_OP:
+ __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+ break;
+ case UPC_SET_OP:
+ if (fetch_ptr == NULL)
+ __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+ else
+ __atomic_exchange (target_ptr, operand1, &orig_value,
+ /* memmodel */ __ATOMIC_SEQ_CST);
+ break;
+ case UPC_CSWAP_OP:
+ orig_value = *operand1;
+ /* __atomic_compare_exchange will return the previous value
+ in &orig_value independent of whether operand2 is written
+ to the target location. */
+ op_ok = __atomic_compare_exchange (target_ptr, &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ /* If the previous compare exchange operation failed, check
+ for UPC PTS equality (which ignores phase). If the pointers
+ compare as equal, try again. */
+ if (!op_ok && (orig_value == *operand1))
+ {
+ (void) __atomic_compare_exchange (target_ptr,
+ &orig_value, operand2,
+ /* weak */ 0,
+ /* success_memmodel */ __ATOMIC_SEQ_CST,
+ /* failure_memmodel */ __ATOMIC_SEQ_CST);
+ }
+ break;
+ default: break;
+ }
+ if (fetch_ptr != NULL)
+ *fetch_ptr = orig_value;
+}
+
+/**
+ * UPC atomic relaxed operation.
+ *
+ * @param [in] domain Atomic domain
+ * @param [in] fetch_ptr Target of the update
+ * @param [in] op Atomic operation
+ * @param [in] target Target address of the operation
+ * @param [in] operand1 Operation required argument
+ * @param [in] operand2 Operation required argument
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_atomic_relaxed (upc_atomicdomain_t *domain,
+ void * restrict fetch_ptr,
+ upc_op_t op,
+ shared void * restrict target,
+ const void * restrict operand1,
+ const void * restrict operand2)
+{
+ struct upc_atomicdomain_struct *ldomain =
+ (struct upc_atomicdomain_struct *) &domain[MYTHREAD];
+ upc_op_num_t op_num;
+ if (op & ~(-op))
+ __upc_fatal ("atomic operation (0x%llx) may have only "
+ "a single bit set", (long long)op);
+ if (!__upc_atomic_is_valid_op (op))
+ __upc_fatal ("invalid atomic operation (0x%llx)",
+ (long long)op);
+ op_num = __upc_atomic_op_num (op);
+ if (op & ~ldomain->ops)
+ __upc_fatal ("invalid operation (%s) for specified domain",
+ __upc_atomic_op_name (op_num));
+ __upc_atomic_check_operands (op_num, fetch_ptr, operand1, operand2);
+ switch (ldomain->optype)
+ {
+ case UPC_INT:
+ __upc_atomic_I (
+ (I_type *) fetch_ptr,
+ op_num,
+ (shared I_type *) target,
+ (I_type *) operand1,
+ (I_type *) operand2);
+ break;
+ case UPC_UINT:
+ __upc_atomic_UI (
+ (UI_type *) fetch_ptr,
+ op_num,
+ (shared UI_type *) target,
+ (UI_type *) operand1,
+ (UI_type *) operand2);
+ break;
+ case UPC_LONG:
+ __upc_atomic_L (
+ (L_type *) fetch_ptr,
+ op_num,
+ (shared L_type *) target,
+ (L_type *) operand1,
+ (L_type *) operand2);
+ break;
+ case UPC_ULONG:
+ __upc_atomic_UL (
+ (UL_type *) fetch_ptr,
+ op_num,
+ (shared UL_type *) target,
+ (UL_type *) operand1,
+ (UL_type *) operand2);
+ break;
+ case UPC_LLONG:
+ __upc_atomic_LL (
+ (LL_type *) fetch_ptr,
+ op_num,
+ (shared LL_type *) target,
+ (LL_type *) operand1,
+ (LL_type *) operand2);
+ break;
+ case UPC_ULLONG:
+ __upc_atomic_ULL (
+ (ULL_type *) fetch_ptr,
+ op_num,
+ (shared ULL_type *) target,
+ (ULL_type *) operand1,
+ (ULL_type *) operand2);
+ break;
+ case UPC_INT32:
+ __upc_atomic_I32 (
+ (I32_type *) fetch_ptr,
+ op_num,
+ (shared I32_type *) target,
+ (I32_type *) operand1,
+ (I32_type *) operand2);
+ break;
+ case UPC_UINT32:
+ __upc_atomic_UI32 (
+ (UI32_type *) fetch_ptr,
+ op_num,
+ (shared UI32_type *) target,
+ (UI32_type *) operand1,
+ (UI32_type *) operand2);
+ break;
+ case UPC_INT64:
+ __upc_atomic_I64 (
+ (I64_type *) fetch_ptr,
+ op_num,
+ (shared I64_type *) target,
+ (I64_type *) operand1,
+ (I64_type *) operand2);
+ break;
+ case UPC_UINT64:
+ __upc_atomic_UI64 (
+ (UI64_type *) fetch_ptr,
+ op_num,
+ (shared UI64_type *) target,
+ (UI64_type *) operand1,
+ (UI64_type *) operand2);
+ break;
+ case UPC_FLOAT:
+ __upc_atomic_F (
+ (F_type *) fetch_ptr,
+ op_num,
+ (shared F_type *) target,
+ (F_type *) operand1,
+ (F_type *) operand2);
+ break;
+ case UPC_DOUBLE:
+ __upc_atomic_D (
+ (D_type *) fetch_ptr,
+ op_num,
+ (shared D_type *) target,
+ (D_type *) operand1,
+ (D_type *) operand2);
+ break;
+ case UPC_PTS:
+ __upc_atomic_PTS (
+ (PTS_type *) fetch_ptr,
+ op_num,
+ (shared PTS_type *) target,
+ (PTS_type *) operand1,
+ (PTS_type *) operand2);
+ break;
+ }
+}
+
+/**
+ * UPC atomic strict operation.
+ *
+ * @param [in] domain Atomic domain
+ * @param [in] fetch_ptr Target of the update
+ * @param [in] op Atomic operation
+ * @param [in] target Target address of the operation
+ * @param [in] operand1 Operation required argument
+ * @param [in] operand2 Operation required argument
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_atomic_strict (upc_atomicdomain_t *domain,
+ void * restrict fetch_ptr,
+ upc_op_t op,
+ shared void * restrict target,
+ const void * restrict operand1,
+ const void * restrict operand2)
+{
+ upc_fence;
+ upc_atomic_relaxed (domain, fetch_ptr, op, target, operand1, operand2);
+ upc_fence;
+}
+
+/**
+ * Collective allocation of atomic domain.
+ *
+ * Implementation uses native Portals4 atomic functions and the
+ * hint field is ignored.
+ *
+ * @parm [in] type Atomic operation type
+ * @parm [in] ops Atomic domain operations
+ * @parm [in] hints Atomic operation hint
+ * @retval Allocated atomic domain pointer
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+upc_atomicdomain_t *
+upc_all_atomicdomain_alloc (upc_type_t type,
+ upc_op_t ops,
+ __attribute__((unused)) upc_atomichint_t hints)
+{
+ upc_atomicdomain_t *domain;
+ struct upc_atomicdomain_struct *ldomain;
+ upc_op_t supported_ops;
+ if (!__upc_atomic_is_valid_type (type))
+ __upc_fatal ("unsupported atomic type: 0x%llx",
+ (long long) type);
+ supported_ops = __upc_atomic_supported_ops (type);
+ if ((ops & ~supported_ops) != 0)
+ __upc_fatal ("one/more requested atomic operations (0x%llx) unsupported "
+ "for type `%s'", (long long) ops,
+ __upc_atomic_type_name (type));
+ domain = (upc_atomicdomain_t *)
+ upc_all_alloc (THREADS, sizeof (struct upc_atomicdomain_struct));
+ if (domain == NULL)
+ __upc_fatal ("unable to allocate atomic domain");
+ ldomain = (struct upc_atomicdomain_struct *)&domain[MYTHREAD];
+ ldomain->ops = ops;
+ ldomain->optype = type;
+ return domain;
+}
+
+/**
+ * Collective free of the atomic domain.
+ *
+ * @param [in] domain Pointer to atomic domain
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_all_atomicdomain_free (upc_atomicdomain_t * domain)
+{
+ assert (domain != NULL);
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ upc_free (domain);
+ }
+ upc_barrier;
+}
+
+/**
+ * Query implementation for expected performance.
+ *
+ * @parm [in] ops Atomic domain operations
+ * @parm [in] optype Atomic operation type
+ * @parm [in] addr Atomic address
+ * @retval Expected performance
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+int
+upc_atomic_isfast (__attribute__((unused)) upc_type_t optype,
+ __attribute__((unused)) upc_op_t ops,
+ __attribute__((unused)) shared void *addr)
+{
+ /* We could make the distinction that only operations
+ directly supported by the builtin atomics are "fast",
+ but for now ... everything in the SMP runtime is
+ defined to be fast. */
+ return UPC_ATOMIC_PERFORMANCE_FAST;
+}
+
+/** @} */
diff --git a/libgupc/smp/upc_backtrace.c b/libgupc/smp/upc_backtrace.c
new file mode 100644
index 00000000000..2c009d78cd5
--- /dev/null
+++ b/libgupc/smp/upc_backtrace.c
@@ -0,0 +1,443 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_sup.h"
+#include "upc_access.h"
+#include "upc_backtrace.h"
+#include <signal.h>
+#include <string.h>
+#if HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+/** Skip over frames belonging to the backtrace code itself. */
+#define GUPCR_BT_SKIP_FRAME_CNT 3
+/** Maximum number of stack frames to display. */
+#define GUPCR_BT_DEPTH_CNT 128
+
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+/** Default backtrace file name prefix. */
+#define UPC_BACKTRACE_PREFIX "backtrace"
+
+/** Full path of the executable program. */
+static char *__upc_abs_execname;
+
+/** Backtrace on faults enabled flag. */
+static int bt_enabled = 0;
+
+/**
+ * GLIBC backtrace.
+ *
+ * Show backtrace by using the GLIBC backtrace functionality.
+ * Backtrace is improved with the source file/line numbers if
+ * addr2line is available.
+ *
+ * By default backtrace lines are sent to the 'stderr' file
+ * descriptor. However, an environment variable
+ * UPC_BACKTRACEFILE can be used to redirect the backtrace
+ * to an actual file and it is used as a simple prefix for
+ * the backtrace file. For example, if it is set to "/tmp/trace-upc",
+ * the actual trace file is going to be "/tmp/trace-upc-PID.MYTHREAD".
+ * If empty environment variable is provided, a simple "trace" prefix
+ * is used.
+ *
+ */
+void
+__upc_backtrace (void)
+{
+ void *strace[GUPCR_BT_DEPTH_CNT];
+ size_t size,i;
+ char **strace_str;
+ char *file_env;
+ int under_upc_main = 1;
+ FILE *traceout = stderr;
+ upc_info_p u = __upc_info;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+
+ file_env = getenv (GUPCR_BACKTRACE_FILE_ENV);
+ if (file_env)
+ {
+ #define MAX_INT_STRING ".2147483647"
+ char *tracefile;
+ int len, lenw;
+ /* Use default trace file name if one not specified by the user. */
+ if (!strlen (file_env))
+ file_env = (char *) UPC_BACKTRACE_PREFIX;
+ len = strlen (file_env) + strlen (MAX_INT_STRING) + 1;
+ tracefile = malloc (len);
+ if (!tracefile)
+ __upc_fatal ("cannot allocate (%d) memory for backtrace file %s",
+ len, file_env);
+ lenw = snprintf (tracefile, len, "%s.%d", file_env, MYTHREAD);
+ if ((lenw >= len) || (lenw < 0))
+ __upc_fatal ("cannot create backtrace file name: %s", file_env);
+ traceout = fopen (tracefile, "w");
+ if (!traceout)
+ __upc_fatal ("cannot open backtrace file: %s", tracefile);
+ free (tracefile);
+ }
+ else
+ fprintf (traceout, "Thread %d backtrace:\n", MYTHREAD);
+
+ /* Use "backtrace" functionality of glibc to receive
+ backtrace addresses. */
+ size = backtrace (strace, GUPCR_BT_DEPTH_CNT);
+ /* Add symbolic information to each address
+ and print the stack trace. */
+ for (i = GUPCR_BT_SKIP_FRAME_CNT; i < size; i++)
+ {
+ if (under_upc_main)
+ {
+# if HAVE_UPC_BACKTRACE_ADDR2LINE
+ /* Call addr2line to generate source files, line numbers,
+ and functions. In case of any error (malloc, snprintf)
+ do not abort the program. */
+ FILE *a2l;
+ #define CMD_TMPL "%s -f -e %s %p"
+ /* Allow space for addr2line, filename, command line options,
+ and address argument for addr2line. */
+ int cmd_size = strlen (GUPCR_BACKTRACE_ADDR2LINE) +
+ strlen (__upc_abs_execname) +
+ strlen (CMD_TMPL) +
+ strlen ("0x1234567812345678");
+ int sz;
+ char *cmd = malloc (cmd_size);
+ /* Create an actual addr2line command. */
+ sz = snprintf (cmd, cmd_size, CMD_TMPL, GUPCR_BACKTRACE_ADDR2LINE,
+ __upc_abs_execname, strace[i]);
+ if ((sz >= cmd_size) || (sz < 0))
+ {
+ fprintf (traceout, "unable to create addr2line "
+ "command line\n");
+ return;
+ }
+ /* Execute addr2line. */
+ a2l = popen (cmd, "r");
+ free (cmd);
+ if (a2l)
+ {
+ /* addr2line responds with two lines: procedure name and
+ the file name with line number. */
+ int max_rep = 2 * FILENAME_MAX;
+ /* Build a data structure that is identical to the
+ structure returned by the glibc backtrace_symbol(). */
+ struct back_trace {
+ char *addr;
+ char data[1];
+ };
+ struct back_trace *rep = malloc (max_rep);
+ int index = 0;
+ if (!rep)
+ {
+ fprintf (traceout, "unable to acquire memory "
+ "for backtracing\n");
+ return;
+ }
+ rep->data[0] = '\0';
+ /* Read addr2line response. */
+ while (fgets(&rep->data[index], max_rep-index, a2l))
+ {
+ /* Remove all the new lines, as addr2line returns
+ info in multiple lines. */
+ index = strlen (&rep->data[0]);
+ if (rep->data[index - 1] == '\n')
+ rep->data[index - 1] = ' ';
+ }
+ pclose (a2l);
+ rep->addr = &rep->data[0];
+ strace_str = &rep->addr;
+ }
+ else
+ {
+ /* Somehow we failed to invoke addr2line, fall back
+ to glibc. */
+ strace_str = backtrace_symbols (&strace[i], 1);
+ }
+# else
+ strace_str = backtrace_symbols (&strace[i], 1);
+# endif
+ fprintf (traceout, "[%4d][%lld] %s\n", MYTHREAD,
+ (long long int) (i - GUPCR_BT_SKIP_FRAME_CNT), *strace_str);
+ /* Extra info for the barrier. */
+ if (strstr( *strace_str, "__upc_wait"))
+ {
+ fprintf (traceout, "[%4d] BARRIER ID: %d\n", MYTHREAD,
+ __upc_barrier_id);
+ }
+ if (strstr (*strace_str, "upc_main"))
+ under_upc_main = 0;
+ /* Symbol trace buffer must be released. */
+ free (strace_str);
+ }
+ }
+ fflush (traceout);
+ if (file_env)
+ fclose (traceout);
+}
+
+#define GUPCR_BACKTRACE_PID_BUFLEN 16
+
+/**
+ * Backtrace on fatal errors.
+ *
+ * Print backtrace (stack frames) on fatal errors: run-time
+ * fatal error or segmentation fault.
+ *
+ * Only print backtrace if environment variable UPC_BACKTRACE
+ * is set to 1. The following order of backtrace capabilities
+ * is searched and executed:
+ *
+ * (1) Use GDB for backtrace (if enabled)
+ * (2) Use GLIBC backtrace with source file/line display (if
+ * addr2line is available)
+ * (3) Use GLIBC backtrace with raw addresses (display is
+ * improved if -rdynamic option is supported by the linker)
+ *
+ */
+void
+__upc_fatal_backtrace (void)
+{
+ if (bt_enabled)
+ {
+#ifdef HAVE_UPC_BACKTRACE_GDB
+ {
+ char *env;
+ const char *gdb;
+ char pid_buf[GUPCR_BACKTRACE_PID_BUFLEN];
+ int child_pid;
+ /* Which gdb to use? */
+ env = getenv (GUPCR_BACKTRACE_GDB_ENV);
+ if (!env || (strlen (env) == 0))
+ gdb = GUPCR_BACKTRACE_GDB;
+ else
+ gdb = (const char *) env;
+ if (strcmp (gdb, "none"))
+ {
+ const char *err_msg = 0;
+ char tmpf[PATH_MAX];
+ int fbt;
+ const char *btcmd = "backtrace 30\n";
+ fprintf (stderr, "Thread %d GDB backtrace:\n", MYTHREAD);
+ /* Get pid and name of the running program. */
+ sprintf(pid_buf, "%ld", (long) getpid());
+ /* Create temp file for GDB commands. */
+ if ((fbt = __upc_create_temp_file
+ ("upc_bt_gdb.XXXXXX", tmpf, &err_msg)) == -1)
+ {
+ fprintf (stderr, "cannot open gdb command - %s\n", err_msg);
+ return;
+ }
+ if (write (fbt, btcmd, sizeof (btcmd)) == -1)
+ {
+ perror ("cannot write gdb command file for backtrace");
+ return;
+ }
+ if (close (fbt))
+ {
+ perror ("cannot close gdb command file for backtrace");
+ return;
+ }
+ child_pid = fork();
+ if (!child_pid)
+ {
+ dup2(2,1);
+ execlp(gdb, gdb, "-nx", "-batch", "-x", tmpf,
+ __upc_abs_execname, pid_buf, NULL);
+ fprintf (stderr, "cannot start GDB - %s\n", gdb);
+ abort(); /* If gdb failed to start */
+ }
+ else
+ waitpid(child_pid,NULL,0);
+ unlink (tmpf);
+ return;
+ }
+ }
+#endif /* GUPCR_BACKTRACE_GDB */
+
+ /* Simple backtrace only. */
+ __upc_backtrace ();
+ }
+}
+
+/**
+ * Print thread/process mapping OR
+ * request a trace dump from UPC threads.
+ */
+static void
+__upc_backtrace_monitor (void)
+{
+ int i;
+ char *trace_file_name;
+ trace_file_name = getenv (GUPCR_BACKTRACE_FILE_ENV);
+ if (trace_file_name)
+ {
+ /* Dump backtraces into files.
+ Send signal to all UPC threads. */
+ fprintf (stderr, "Thread monitor\n");
+ fprintf (stderr, "Sending requests for trace dump\n");
+ for (i = 0; i < THREADS; i++)
+ {
+ kill (__upc_info->thread_info[i].pid, GUPCR_BACKTRACE_SIGNAL);
+ }
+ }
+ else
+ {
+ fprintf (stderr, "Thread ID to PID mappings\n");
+ fprintf (stderr, " Thread PID\n");
+ for (i = 0; i < THREADS; i++)
+ {
+ fprintf (stderr,
+ " %4d %ld\n", i, (long) __upc_info->thread_info[i].pid);
+ }
+ }
+}
+
+/**
+ * Backtrace signal handler.
+ *
+ * Display stack frames on a request. In case of the
+ * monitor thread only print the mappings between the
+ * UPC threads and processes.
+ */
+static void
+__upc_backtrace_handler (int sig __attribute__ ((unused)),
+ siginfo_t *siginfo __attribute__ ((unused)),
+ void *context __attribute__ ((unused)))
+{
+ if (MYTHREAD == -1)
+ __upc_backtrace_monitor ();
+ else
+ __upc_backtrace ();
+}
+
+/**
+ * Backtrace fault handler.
+ *
+ * A fault happened and backtrace is enabled. Allow for only
+ * one thread to print the backtrace. The restore signal
+ * handlers to their default and return ensures that
+ * signal terminates the thread and allows for the monitor
+ * thread to terminate all the other threads..
+ */
+static void
+__upc_fault_handler (int sig __attribute__ ((unused)),
+ siginfo_t *siginfo __attribute__ ((unused)),
+ void *context __attribute__ ((unused)))
+{
+ upc_info_p u = __upc_info;
+ if (u)
+ __upc_acquire_lock (&u->lock);
+ __upc_backtrace_restore_handlers ();
+ __upc_fatal_backtrace ();
+}
+
+/**
+ * Initialize UPC backtrace.
+ */
+void
+__upc_backtrace_init (const char *execname)
+{
+ char *env;
+ /* Find the full path for the executable. On linux systems we
+ might be able to read "/proc/self/exe" to the get the full
+ executable path. But, it is not portable. */
+ int slen = sizeof (__upc_abs_execname) - strlen (execname) - 2;
+ __upc_abs_execname = malloc (PATH_MAX + 1);
+ if (!__upc_abs_execname)
+ __upc_fatal ("cannot allocate space for executable file name");
+ *__upc_abs_execname = '\0';
+ if (execname[0] != '/')
+ {
+ if (!getcwd (__upc_abs_execname, slen))
+ strcpy (__upc_abs_execname, "/BT_CANNOT_CREATE_ABS_PATH");
+ strcat (__upc_abs_execname, "/");
+ }
+ strcat (__upc_abs_execname, execname);
+
+#ifdef HAVE_UPC_BACKTRACE_SIGNAL
+ {
+ /* Install backtrace signal handler (backtrace on request). */
+ struct sigaction act;
+ memset (&act, '\0', sizeof(act));
+ act.sa_sigaction = &__upc_backtrace_handler;
+ act.sa_flags = SA_SIGINFO;
+ if (sigaction(GUPCR_BACKTRACE_SIGNAL, &act, NULL) < 0) {
+ perror ("was not able to install backtrace handler");
+ }
+ }
+#endif
+
+ /* Install signal handlers only if backtrace is enabled. */
+ env = getenv (GUPCR_BACKTRACE_ENV);
+ if (env)
+ bt_enabled = atoi (env);
+
+ if (bt_enabled)
+ {
+ struct sigaction act;
+ memset (&act, '\0', sizeof(act));
+ act.sa_sigaction = &__upc_fault_handler;
+ act.sa_flags = SA_SIGINFO;
+ if (sigaction(SIGABRT, &act, NULL) < 0)
+ perror ("unable to install SIGABRT handler");
+ if (sigaction(SIGILL, &act, NULL) < 0)
+ perror ("unable to install SIGILL handler");
+ if (sigaction(SIGSEGV, &act, NULL) < 0)
+ perror ("unable to install SIGSEGV handler");
+ if (sigaction(SIGBUS, &act, NULL) < 0)
+ perror ("unable to install SIGBUS handler");
+ if (sigaction(SIGFPE, &act, NULL) < 0)
+ perror ("unable to install SIGFPE handler");
+ }
+}
+
+/**
+ * Restore default handlers.
+ *
+ * Has to be called once the run-time discovered
+ * a fatal error.
+ */
+void
+__upc_backtrace_restore_handlers (void)
+{
+ /* Don't handle any signals with backtrace code. Install
+ default handlers. */
+ signal (SIGABRT, SIG_DFL);
+ signal (SIGILL, SIG_DFL);
+ signal (SIGSEGV, SIG_DFL);
+ signal (SIGBUS, SIG_DFL);
+ signal (SIGFPE, SIG_DFL);
+}
diff --git a/libgupc/smp/upc_backtrace.h b/libgupc/smp/upc_backtrace.h
new file mode 100644
index 00000000000..410982b3e07
--- /dev/null
+++ b/libgupc/smp/upc_backtrace.h
@@ -0,0 +1,45 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_BACKTRACE_H_
+#define _UPC_BACKTRACE_H_
+
+/* Environment variables. */
+/** Enable/Disable backtrace env variable. */
+#define GUPCR_BACKTRACE_ENV "UPC_BACKTRACE"
+/** Enable/Disable STAT backtrace env variable. */
+#define GUPCR_BACKTRACE_FILE_ENV "UPC_BACKTRACEFILE"
+/** GDB command for backtrace env variable. */
+#define GUPCR_BACKTRACE_GDB_ENV "UPC_BACKTRACE_GDB"
+
+/* Interfaces. */
+extern void __upc_backtrace (void);
+extern void __upc_fatal_backtrace (void);
+extern void __upc_backtrace_init (const char *execname);
+extern void __upc_backtrace_restore_handlers (void);
+
+#endif /* !_UPC_BACKTRACE_H_ */
diff --git a/libgupc/smp/upc_barrier.upc b/libgupc/smp/upc_barrier.upc
new file mode 100644
index 00000000000..76f0493703d
--- /dev/null
+++ b/libgupc/smp/upc_barrier.upc
@@ -0,0 +1,395 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/*
+ * UPC barrier implementation support routines.
+ *
+ * The UPC barrier synchronization statements are:
+ * - upc_notify <i>expression</i>
+ * - upc_wait <i>expression</i>
+ * - upc_barrier <i>expression</i>
+ *
+ * The upc barrier statement is equivalent to the compound statement:
+ * <i>{ upc_notify barrier_value; upc_wait barrier_value; }</i>
+ *
+ * The UPC runtime implementation of the barrier organizes the UPC
+ * threads in a form of a tree with a configurable tree fanout. Each
+ * thread uses the following data structures:
+ *
+ * * A shared array of barrier block structures. Each thread has the
+ * barrier block structure consisting of the following variables:
+ * - notify - Atomically incremented by the thread and its children
+ * whenever they arrive on the notify statement. Once all
+ * of them arrive, the parent of the thread is notified.
+ * - wait - Signaling field for parent to inform children that they
+ * are allowed to proceed from the wait phase.
+ * - id[2] - Barrier ID that thread is waiting on. There are two
+ * barrier IDs to distinguish the correct notify/barrier
+ * sequence (a thread can be in a notify phase while children
+ * are still in the previous barrier wait state and need the
+ * parent's barrier ID to compare against their own).
+ * * A local array of threads' notify counts required to complete the notify
+ * phase (as we use atomic fetch and add function the required number of
+ * of notifications is equal to the children count).
+ *
+ * BARRIER NOTIFY
+ *
+ * * Each leaf thread atomically increments the 'notify' field of the parent's
+ * barrier block. Others atomically increment the same filed in their own
+ * barrier block. The number of notifies before increment is returned back.
+ * * If number of notifies is equal to the thread's notify count the parent
+ * of the thread must be notified. This propagates notification to the
+ * top of the tree (no thread waits for anyone in the notify phase). Before
+ * parent is notified, the MAX barrier ID of the thread and its children
+ * is calculated and set as the effective thread's barrier ID. At the
+ * end, the root thread has the MAX calculated ID for all threads.
+ * * The last thread notifying the root thread is also responsible for
+ * releasing the root thread from the wait.
+ *
+ * BARRIER WAIT
+ *
+ * * Each parent (or another thread on behalf of the parent) atomically
+ * increments the 'wait' filed of its children (all threads completed
+ * the notify phase)..
+ * * Each thread also atomically increments the 'wait' field in its own
+ * barrier block (thread arrived on the wait statement).
+ * * Whoever incremented the filed first is responsible for further
+ * releasing thread's children. This makes sure that all children of a
+ * thread that has not arrived on the wait statement are allowed
+ * to complete their wait statements (split phase barrier).
+ *
+ * Current limitations:
+ * - Recursive behavior in the notify and wait statements can lead into
+ * more work for some of the threads.
+ */
+
+#include <upc.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/* Thread's children. */
+static int *__upc_child;
+/* Thread's children count. */
+static int __upc_child_cnt;
+/* Thread's parent thread. */
+static int __upc_parent;
+
+/* Thread tree definitions. */
+#define ROOT_PARENT -1
+#define ROOT_NODE 0
+#define INNER_NODE 1
+#define LEAF_NODE 2
+#define ROOT_THREAD (__upc_node == ROOT_NODE)
+#define INNER_THREAD (__upc_node == INNER_NODE)
+#define LEAF_THREAD (__upc_node == LEAF_NODE)
+int __upc_node;
+
+/* Notify counts for each thread. */
+int *__upc_notify_cnt;
+
+/* Per thread barrier structure. */
+struct barrier_block
+{
+ int notify;
+ int wait;
+ int id[2];
+};
+
+typedef struct barrier_block barrier_block_t;
+strict shared barrier_block_t __upc_btree[THREADS];
+/* Alternative barrier count (even/odd). Need to distinguish barrier IDs from
+ two consecutive barriers as some threads might enter the notify statements
+ while the others have not completed the wait statement of the previous
+ barrier. */
+static int __upc_bphase = 0;
+/* Atomic increment values. */
+/* Thread arrived first on the wait (parent trying to release
+ children, or thread waiting for the parent. */
+#define GUPCR_BARRIER_FIRST_ON_WAIT 0
+/* Both parent and thread arrived. */
+#define GUPCR_BARRIER_WAIT_COMPLETED 2
+
+/* Per-thread flag set by upc_notify() and cleared by upc_wait(). */
+static GUPCR_THREAD_LOCAL int __upc_barrier_active = 0;
+
+/* Per-thread active barrier ID. */
+GUPCR_THREAD_LOCAL int __upc_barrier_id = 0;
+
+/*
+ * Shared integer atomic increment.
+ *
+ */
+__attribute__ ((__always_inline__))
+static inline
+int
+__upc_atomic_inc (strict shared void *p)
+{
+ int *addr = __upc_map_to_local (p);
+ return __upc_sync_fetch_and_add (addr, 1);
+}
+
+/*
+ * Adjust thread's barrier ID.
+ *
+ * The MAX barrier ID among all threads is being propagated
+ * to the top of the tree. Adjust barrier ID of the thread
+ * to the MAX among the thread and its children.
+ *
+ */
+__attribute__ ((__always_inline__))
+static inline
+void
+__upc_adjust_barrier_id (int thread)
+{
+ int i, maxbid;
+ maxbid = __upc_btree[thread].id[__upc_bphase];
+ for (i = 0; i < GUPCR_TREE_FANOUT; i++)
+ {
+ int child = GUPCR_TREE_FANOUT * thread + i + 1;
+ if (child < THREADS)
+ {
+ int bid = __upc_btree[child].id[__upc_bphase];
+ if (maxbid < bid)
+ maxbid = bid;
+ }
+ }
+ __upc_btree[thread].id[__upc_bphase] = maxbid;
+}
+
+/*
+ * Release waiting thread.
+ *
+ * Signal to the specified thread that it can complete
+ * the wait phase.
+ *
+ * This is a recursive function. If the specified thread did not
+ * arrive on the wait 'gate', the calling thread must release
+ * all its children with atomic inc into their wait fileds.
+ *
+ */
+static inline
+void
+__upc_release_wait (int thread)
+{
+ int wait_cnt = __upc_atomic_inc (&__upc_btree[thread].wait);
+ if (wait_cnt == GUPCR_BARRIER_FIRST_ON_WAIT)
+ {
+ int i;
+ /* Parent arrived first. Make agreed on MAX barrier ID available
+ to children before releasing them. */
+ if (INNER_THREAD)
+ __upc_btree[thread].id[__upc_bphase] =
+ __upc_btree[(thread - 1) / GUPCR_TREE_FANOUT].id[__upc_bphase];
+ for (i = 0; i < GUPCR_TREE_FANOUT; i++)
+ {
+ int child = GUPCR_TREE_FANOUT * thread + i + 1;
+ if (child < THREADS)
+ {
+ __upc_release_wait (child);
+ }
+ }
+ }
+}
+
+/*
+ * UPC notify statement implementation.
+ */
+void
+__upc_notify (int barrier_id)
+{
+ int notify_cnt;
+ int notify_thread;
+ if (__upc_barrier_active)
+ __upc_fatal ("Two successive upc_notify statements executed "
+ "without an intervening upc_wait");
+ __upc_barrier_active = 1;
+ __upc_barrier_id = barrier_id;
+
+ /* Initialize thread's barrier block. */
+ __upc_btree[MYTHREAD].id[__upc_bphase] = barrier_id;
+ __upc_btree[MYTHREAD].wait = 0;
+
+ /* Notify that thread arrived. */
+ if (LEAF_THREAD)
+ notify_thread = __upc_parent;
+ else
+ notify_thread = MYTHREAD;
+ notify_cnt = __upc_atomic_inc (&__upc_btree[notify_thread].notify);
+ if (notify_cnt == __upc_notify_cnt[notify_thread])
+ {
+ /* Notify count reached the expected notification count (thread
+ and all its children arrived on notification phase).
+ Must traverse the tree and inform parent of the thread. */
+ do
+ {
+ __upc_btree[notify_thread].notify = 0;
+ /* Adjust the barrier ID with the MAX of the
+ thread and its children. */
+ __upc_adjust_barrier_id (notify_thread);
+ if (notify_thread == 0)
+ {
+ /* Reached the top of the tree. Release the root
+ thread from the wait. */
+ __upc_release_wait (notify_thread);
+ break;
+ }
+ /* The parent of the thread is the new thread that has
+ to be notified. */
+ notify_thread = (notify_thread - 1) / GUPCR_TREE_FANOUT;
+ }
+ while (__upc_notify_cnt[notify_thread] ==
+ __upc_atomic_inc (&__upc_btree[notify_thread].notify));
+ }
+}
+
+/*
+ * UPC wait statement implementation
+ */
+void
+__upc_wait (int barrier_id)
+{
+ int wait_cnt, i;
+
+ if (!__upc_barrier_active)
+ __upc_fatal ("upc_wait statement executed without a "
+ "preceding upc_notify");
+ /* Check the barrier ID with the one from the notify phase. */
+ if (barrier_id != INT_MIN && __upc_barrier_id != INT_MIN &&
+ __upc_barrier_id != barrier_id)
+ {
+ __upc_fatal ("UPC barrier identifier mismatch");
+ }
+
+ /* Announce the thread on the wait phase. */
+ wait_cnt = __upc_atomic_inc (&__upc_btree[MYTHREAD].wait);
+ if (wait_cnt == GUPCR_BARRIER_FIRST_ON_WAIT)
+ {
+ /* Must wait for the parent. */
+ int *wait_ptr = (int *) &__upc_btree[MYTHREAD].wait;
+ __upc_spin_until (*wait_ptr == GUPCR_BARRIER_WAIT_COMPLETED);
+ }
+
+ if (wait_cnt == GUPCR_BARRIER_FIRST_ON_WAIT)
+ {
+ /* Thread arrived before parent and waited for the release
+ from the parent. Release all the children from the wait
+ and make agreed on MAX barrier ID available to them. */
+ if (INNER_THREAD)
+ __upc_btree[MYTHREAD].id[__upc_bphase] =
+ __upc_btree[__upc_parent].id[__upc_bphase];
+ for (i = 0; i < __upc_child_cnt; i++)
+ __upc_release_wait (__upc_child[i]);
+ }
+
+ /* Compare barrier ID with parent's barrier ID. */
+ if (barrier_id != INT_MIN)
+ {
+ int exp;
+ if (ROOT_THREAD)
+ exp = __upc_btree[MYTHREAD].id[__upc_bphase];
+ else
+ exp = __upc_btree[__upc_parent].id[__upc_bphase];
+ if (exp != INT_MIN && exp != barrier_id)
+ {
+ __upc_fatal ("UPC barrier identifier mismatch");
+ }
+ }
+
+ __upc_barrier_active = 0;
+ if (__upc_bphase)
+ __upc_bphase = 0;
+ else
+ __upc_bphase = 1;
+ upc_fence;
+}
+
+/*
+ * UPC barrier implementation.
+ */
+void
+__upc_barrier (int barrier_id)
+{
+ __upc_notify (barrier_id);
+ __upc_wait (barrier_id);
+}
+
+/*
+ * Initialize barrier.
+ *
+ * Initialize barrier data structures. A node tree is
+ * used to signal/ack thread's arrival on the barrier.
+ */
+void
+__upc_barrier_init (void)
+{
+ int i, thread;
+
+ /* Allocate space for children thread numbers. */
+ __upc_child = malloc (GUPCR_TREE_FANOUT * sizeof (int));
+
+ /* Find all children of this thread. */
+ for (i = 0; i < GUPCR_TREE_FANOUT; i++)
+ {
+ int child = GUPCR_TREE_FANOUT * MYTHREAD + i + 1;
+ if (child < THREADS)
+ {
+ __upc_child_cnt++;
+ __upc_child[i] = child;
+ }
+ }
+ if (MYTHREAD == 0)
+ __upc_parent = ROOT_PARENT;
+ else
+ __upc_parent = (MYTHREAD - 1) / GUPCR_TREE_FANOUT;
+
+ /* Set the node assignment for this thread. */
+ if (!MYTHREAD)
+ __upc_node = ROOT_NODE;
+ else if (__upc_child_cnt)
+ __upc_node = INNER_NODE;
+ else
+ __upc_node = LEAF_NODE;
+
+ /* Calculate notifications for each thread. Equal to children
+ count as atomic fetch and add is used. */
+ __upc_notify_cnt = malloc (THREADS * sizeof (int));
+ if (!__upc_notify_cnt)
+ __upc_fatal
+ ("UPC barrier initialization failed - cannot allocate memory");
+ for (thread = 0; thread < THREADS; thread++)
+ {
+ __upc_notify_cnt[thread] = 0;
+ for (i = 0; i < GUPCR_TREE_FANOUT; i++)
+ {
+ int child = GUPCR_TREE_FANOUT * thread + i + 1;
+ if (child < THREADS)
+ {
+ __upc_notify_cnt[thread]++;
+ }
+ }
+ }
+}
+
diff --git a/libgupc/smp/upc_castable.upc b/libgupc/smp/upc_castable.upc
new file mode 100644
index 00000000000..4606f9d6dc3
--- /dev/null
+++ b/libgupc/smp/upc_castable.upc
@@ -0,0 +1,52 @@
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <upc_castable.h>
+
+void *
+upc_cast (const shared void *ptr)
+{
+ const size_t thread = upc_threadof ((shared void *) ptr);
+ void *local_ptr = NULL;
+ if (thread == (size_t) MYTHREAD)
+ {
+ local_ptr = (void *) ptr;
+ }
+ return local_ptr;
+}
+
+upc_thread_info_t
+upc_thread_info (size_t thread)
+{
+ upc_thread_info_t cast_info = { 0, 0 };
+ if (thread == (size_t) MYTHREAD)
+ {
+ cast_info.guaranteedCastable = UPC_CASTABLE_ALL;
+ cast_info.probablyCastable = UPC_CASTABLE_ALL;
+ }
+ return cast_info;
+}
diff --git a/libgupc/smp/upc_config.h b/libgupc/smp/upc_config.h
new file mode 100644
index 00000000000..ea13bf6eff5
--- /dev/null
+++ b/libgupc/smp/upc_config.h
@@ -0,0 +1,270 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_CONFIG_H_
+#define _UPC_CONFIG_H_
+
+#include "config.h"
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#ifdef __sgi__
+#include <ulocks.h>
+#include <sys/sysmp.h>
+#endif
+
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifndef __USE_GNU
+#define __USE_GNU
+#endif
+#include <sched.h>
+#endif
+
+#include <netdb.h>
+#include <netinet/in.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#ifdef GUPCR_USE_PTHREADS
+#include <pthread.h>
+#define GUPCR_THREAD_LOCAL __thread
+#else
+#define GUPCR_THREAD_LOCAL
+#endif
+
+#define DEV_ZERO "/dev/zero"
+#define OFFSET_ZERO ((off_t) 0)
+/* Darwin has MAP_ANON defined for anonymous memory map */
+#if !MAP_ANONYMOUS && MAP_ANON
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+#define MAP_ERROR ((void *) -1)
+
+#define KILOBYTE 1024
+#define C64K (64*KILOBYTE)
+#define MEGABYTE (KILOBYTE*KILOBYTE)
+
+#ifndef LONG_LONG_BITS
+#define LONG_LONG_BITS (__SIZEOF_LONG_LONG__ * 8)
+#endif /* LONG_LONG_BITS */
+
+#ifndef SIZE_T_BITS
+#define SIZE_T_BITS (__SIZEOF_SIZE_T__ * 8)
+#endif /* SIZE_T_BITS */
+
+//begin detect_target64
+#if (defined(_LP64) && _LP64) \
+ || (defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)) \
+ || (defined(_CRAYT3E))
+#define GUPCR_TARGET64 1
+#else
+#define GUPCR_TARGET64 0
+#endif
+//end detect_target64
+
+//begin mode_types
+typedef unsigned int u_intQI_t __attribute__ ((__mode__(__QI__)));
+typedef unsigned int u_intHI_t __attribute__ ((__mode__(__HI__)));
+typedef unsigned int u_intSI_t __attribute__ ((__mode__(__SI__)));
+typedef unsigned int u_intDI_t __attribute__ ((__mode__(__DI__)));
+#if GUPCR_TARGET64
+typedef unsigned int u_intTI_t __attribute__ ((__mode__(__TI__)));
+#endif /* GUPCR_TARGET64 */
+//end mode_types
+
+//begin lib_config_vm
+#if GUPCR_TARGET64
+/* On 64-bit machines, use page size of 32M (25 bits) and a max per thread
+ offset of 256G (38 bits). This leaves 13 bits for the per thread
+ number of pages. */
+#define GUPCR_VM_OFFSET_BITS 25
+#if GUPCR_PTS_VADDR_SIZE > 38
+#define GUPCR_VM_MAX_PAGES_PER_THREAD \
+ (1 << (38 - GUPCR_VM_OFFSET_BITS))
+#else
+#define GUPCR_VM_MAX_PAGES_PER_THREAD \
+ (1 << (GUPCR_PTS_VADDR_SIZE - GUPCR_VM_OFFSET_BITS))
+#endif
+#else
+/* On 32-bit machines, use page size of 4M (22 bits) and a max per thread
+ offset of 4G (32 bits). This leaves 10 bits for the per thread
+ number of pages. */
+#define GUPCR_VM_OFFSET_BITS 22
+#if GUPCR_PTS_VADDR_SIZE > 32
+#define GUPCR_VM_MAX_PAGES_PER_THREAD \
+ (1 << (32 - GUPCR_VM_OFFSET_BITS))
+#else
+#define GUPCR_VM_MAX_PAGES_PER_THREAD \
+ (1 << (GUPCR_PTS_VADDR_SIZE - GUPCR_VM_OFFSET_BITS))
+#endif
+#endif /* GUPCR_TARGET64 */
+
+/* Derive some VM specific constants. */
+#define GUPCR_VM_PAGE_MASK (GUPCR_VM_MAX_PAGES_PER_THREAD - 1)
+#define GUPCR_VM_PAGE_SIZE (1 << GUPCR_VM_OFFSET_BITS)
+#define GUPCR_VM_OFFSET_MASK (GUPCR_VM_PAGE_SIZE - 1)
+/* Declare a type sufficiently large to hold a page number.
+ We can probably get by with a 'short' here, but it is
+ safer to just use a full 'int'.*/
+typedef unsigned int upc_page_num_t;
+
+/* Each thread caches a mapping between global page number
+ and local mapped address. The global page number is
+ hashed into a global map cache, which is N-way associative,
+ where GUPCR_VM_GLOBAL_SET_SIZE defines the value of N. */
+#define GUPCR_VM_GLOBAL_MAP_BITS 6
+#define GUPCR_VM_GLOBAL_MAP_SIZE (1 << GUPCR_VM_GLOBAL_MAP_BITS)
+#define GUPCR_VM_GLOBAL_MAP_MASK (GUPCR_VM_GLOBAL_MAP_SIZE - 1)
+#define GUPCR_VM_GLOGAl_MAP_SET_SIZE 4
+/* All 1's for the virtual page number in a global map entry (GME)
+ indicates that the entry has not yet been mapped. */
+#define GUPCR_VM_PAGE_INVALID -1U
+//end lib_config_vm
+
+//begin lib_min_max
+#ifndef INT_MIN
+/* __INT_MAX__ is predefined by the gcc compiler */
+# define INT_MIN (-__INT_MAX__ - 1)
+#endif
+
+/* helper functions */
+#define GUPCR_MIN(x,y) (((x) < (y)) ? (x): (y))
+#define GUPCR_MAX(x,y) (((x) > (y)) ? (x): (y))
+#define GUPCR_ABS(x) (((x) > 0) ? (x): -(x))
+#define GUPCR_ROUND(x, r) (((x) + (r) - 1)/(r)*(r))
+//end lib_min_max
+
+//begin lib_config_heap
+
+/* Max. heap size
+ Set here as 64 gigabytes on a 64-bit implementation
+ and 1 gigabyte on other (eg, 32 bit) implementations. */
+#define GUPCR_MAX_HEAP_SIZE (((sizeof (void *)*8) == 64) \
+ ? (64L * KILOBYTE * MEGABYTE) \
+ : ( 1L * KILOBYTE * MEGABYTE))
+
+/* Per-thread space initially allocated to UPC user's heap */
+#define GUPCR_DEFAULT_PER_THREAD_HEAP_SIZE (16*MEGABYTE)
+
+/* Per-thread maximum stack size that will be added to the OS's
+ default stack size, when creating pthreads. */
+#define GUPCR_DEFAULT_PER_THREAD_STACK_SIZE (16*MEGABYTE)
+
+/* The minimum number of bytes to allocate */
+#define GUPCR_HEAP_ALLOC_MIN 64
+
+/* Heaps are increased by multiples of this chunk size.
+ The chunk size should be an even multiple of the UPC VM page size. */
+#define GUPCR_HEAP_CHUNK_SIZE (1*GUPCR_VM_PAGE_SIZE)
+
+/* an unlikely barrier id to be used for runtime synchronization */
+#define GUPCR_RUNTIME_BARRIER_ID 0xBADF00D
+
+/* a value used to tag each heap allocated item, checked by upc_free */
+#define GUPCR_HEAP_ALLOC_TAG 0x0DDF00D
+//end lib_config_heap
+
+/* By default we let kernel schedule threads */
+#define GUPCR_SCHED_POLICY_DEFAULT GUPCR_SCHED_POLICY_AUTO
+#define GUPCR_MEM_POLICY_DEFAULT GUPCR_MEM_POLICY_AUTO
+
+/* Enable GUM debug support via this environment variable. */
+#define GUM_DEBUG_ENV "GUM_DEBUG"
+
+/* Specify the GUM port as "host:port" via this environment variable. */
+#define GUM_PORT_ENV "GUM_PORT"
+
+/* Use this environment variable to specify the time (in seconds) that
+ the UPC process should delay to give gdbserver
+ a chance to attach to it. */
+#define GUM_ATTACH_DELAY_ENV "GUM_ATTACH_DELAY"
+
+/* Specify the full pathname of gdbsever via this environment variable. */
+#define GUM_GDBSERVERPATH_ENV "GDBSERVERPATH"
+
+/* Default GUM host */
+#define GUM_HOST_DEFAULT "localhost"
+
+/* Default GUM port */
+#define GUM_PORT_DEFAULT 1234
+
+/* Default gdbserver attach delay (in seconds) */
+#define GUM_ATTACH_DELAY_DEFAULT 10
+
+/* GUM initialization routine called at start up */
+extern void __upc_gum_init (int, int);
+
+/*
+ * Main entry for UPC programs.
+ * The runtime will execute before calling the user's main
+ * program. Thus, the user's main program will renamed
+ * inside of the <upc.h> file to 'upc_main'
+ */
+#define GUPCR_START main
+#define GUPCR_MAIN upc_main
+
+//begin lib_config_shared_section
+
+/* The base address of the UPC shared section */
+#define GUPCR_SHARED_SECTION_START __upc_shared_start
+/* The ending address (plus one) of the UPC shared section */
+#define GUPCR_SHARED_SECTION_END __upc_shared_end
+
+/* The base address of the UPC compiled program info. section */
+#define GUPCR_PGM_INFO_SECTION_START __upc_pgm_info_start
+/* The ending address (plus one) of the UPC compiled program info. section */
+#define GUPCR_PGM_INFO_SECTION_END __upc_pgm_info_end
+
+/* The base address of an array of pointers to UPC initialization routines. */
+#define GUPCR_INIT_ARRAY_START __upc_init_array_start
+/* The ending address (plus one) of pointers to UPC initialization routines */
+#define GUPCR_INIT_ARRAY_END __upc_init_array_end
+
+//end lib_config_shared_section
+
+#endif /* _UPC_CONFIG_H_ */
diff --git a/libgupc/smp/upc_debug.c b/libgupc/smp/upc_debug.c
new file mode 100644
index 00000000000..9773d7b1d8e
--- /dev/null
+++ b/libgupc/smp/upc_debug.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "upc_debug.h"
+
+/* MPIR Interface support for debugging.
+ http://www.mpi-forum.org/docs/mpir-specification-10-11-2010.pdf
+
+ MPIR_being_debugged is being set by the debugger to 1.
+ As we support MPIR_partial_attach_ok (section 9.13), all
+ threads are in the hold mode and continue to run only after the
+ debugger continues the monitor thread from the MPRI_breakpoint().
+ If debugger wants to attach to any of the threads, thread's gate
+ must be lowered by the debugger. */
+
+MPIR_PROCDESC *MPIR_proctable = 0;
+int MPIR_proctable_size = 0;
+const char *MPIR_debug_abort_string = 0;
+volatile int MPIR_debug_state;
+volatile int MPIR_debug_gate = 1; /* Threads continue to run by default. */
+int MPIR_being_debugged; /* Set by the debugger. */
+int MPIR_partial_attach_ok; /* OK to attach to subset of threads. */
+
+/* Debugging breakpoint.
+ Subroutine called by the starter process to notify the debugger
+ that an MPIR event has occurred. */
+void
+MPIR_Breakpoint (void)
+{
+}
+
+/* Tell the debugger that this initial process is not to be
+ included in the set of processes which form the UPC program. */
+void
+MPIR_i_am_starter (void)
+{
+}
+
+/* Tell the debugger that we're not really MPI after all. */
+void
+MPIR_ignore_queues (void)
+{
+}
+
+/* Tell the debugger to display "main" if we stop immediately
+ after acquiring the processes at startup time. */
+void
+MPIR_force_to_main (void)
+{
+}
+
diff --git a/libgupc/smp/upc_debug.h b/libgupc/smp/upc_debug.h
new file mode 100644
index 00000000000..6d449629468
--- /dev/null
+++ b/libgupc/smp/upc_debug.h
@@ -0,0 +1,96 @@
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+/*
+ * This file defines an interface to allow a debugger easily to
+ * acquire all of the UPC processes at startup time.
+ *
+ * It exploits the interface used by MPICH http://www-unix.mcs.anl.gov/mpi/mpich/
+ * to interface to debuggers.
+ */
+
+#ifndef _UPC_DEBUG_H_
+#define _UPC_DEBUG_H_
+
+/**************************************************************************
+ * These functions are our interface to the debugger.
+ */
+
+/* A little struct to hold the target processor name and pid for
+ * each process which forms part of the MPI program.
+ *
+ * For UPC we probably don't need the host_name or executable_name,
+ * but it's easier to use the existing interface than bother to leave
+ * them out. Provided we zero them the debugger will assume they're the
+ * same as the initial program.
+ *
+ * DO NOT change the name of this structure or its fields. The debugger knows
+ * them, and will be confused if you change them.
+ */
+typedef struct
+{
+ char * host_name; /* Something we can pass to inet_addr */
+ char * executable_name; /* The name of the image */
+ int pid; /* The pid of the process */
+} MPIR_PROCDESC;
+
+/* Array of procdescs for debugging purposes */
+extern MPIR_PROCDESC *MPIR_proctable;
+extern int MPIR_proctable_size;
+
+/* Various global variables which a debugger can use for
+ * 1) finding out what the state of the program is at
+ * the time the magic breakpoint is hit.
+ * 2) inform the process that it has been attached to and is
+ * now free to run.
+ */
+extern volatile int MPIR_debug_state;
+extern volatile int MPIR_debug_gate;
+extern const char * MPIR_debug_abort_string;
+extern int MPIR_being_debugged; /* Cause extra info on internal state
+ * to be maintained
+ */
+
+/* Values for the debug_state, this seems to be all we need at the moment
+ * but that may change...
+ */
+#define MPIR_DEBUG_SPAWNED 1
+#define MPIR_DEBUG_ABORTING 2
+
+/* A function we call to tell the debugger that something worthwhile is happening.
+ */
+extern void MPIR_Breakpoint (void);
+
+/*
+ * Other functions whose mere presence in the executable provides information to the
+ * debugger.
+ */
+extern void MPIR_i_am_starter (void);
+extern void MPIR_ignore_queues (void);
+extern void MPIR_force_to_main (void);
+
+#endif /* _UPC_DEBUG_H_ */
diff --git a/libgupc/smp/upc_defs.h b/libgupc/smp/upc_defs.h
new file mode 100644
index 00000000000..b7be70bab80
--- /dev/null
+++ b/libgupc/smp/upc_defs.h
@@ -0,0 +1,171 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_DEFS_H_
+#define _UPC_DEFS_H_
+
+#include "upc_pts.h"
+
+//begin lib_max_threads_def
+/* Maximum number of THREADS supported in this implementation */
+#define GUPCR_THREAD_SIZE 12
+#define GUPCR_THREADS_MAX (1 << GUPCR_THREAD_SIZE)
+//end lib_max_threads_def
+
+#if GUPCR_PTS_PACKED_REP && (GUPCR_THREADS_SIZE > GUPCR_PTS_THREAD_SIZE)
+#error GUPCR_THREADS_MAX exceeds the size of the packed sptr threads field.
+#endif
+
+
+/* UPC thread-specific information */
+typedef struct upc_thread_info_struct
+ {
+ pid_t pid;
+ int sched_affinity;
+ int mem_affinity;
+#ifdef GUPCR_USE_PTHREADS
+ pthread_t os_thread;
+ int exit_status;
+#endif
+ } upc_thread_info_t;
+typedef upc_thread_info_t *upc_thread_info_p;
+
+#define GUPCR_PROCBITS_PER_WORD OS_BITS_PER_ATOMIC_WORD
+
+#define GUPCR_NUM_PROCBIT_WORDS ((GUPCR_THREADS_MAX + (GUPCR_PROCBITS_PER_WORD - 1)) \
+ / GUPCR_PROCBITS_PER_WORD)
+
+/* Bit vector used to manage processes */
+typedef os_atomic_t upc_procbits_vec_t[GUPCR_NUM_PROCBIT_WORDS];
+
+/* UPC thread barrier ID */
+extern GUPCR_THREAD_LOCAL int __upc_barrier_id;
+
+/* There is one global page table per UPC program.
+ The global page table maps (thread, page) into
+ a global page number in the global memory region. */
+typedef upc_page_num_t upc_pte_t;
+typedef upc_pte_t *upc_pte_p;
+
+/* scheduling policies */
+enum upc_sched_policy_enum
+ {
+ GUPCR_SCHED_POLICY_AUTO, /* kernel's scheduling policy */
+ GUPCR_SCHED_POLICY_NODE, /* schedule across nodes */
+ GUPCR_SCHED_POLICY_CPU, /* schedule across cpus - multiple threads per CPU */
+ GUPCR_SCHED_POLICY_CPU_STRICT /* schedule across cpus - one thread per CPU */
+ };
+typedef enum upc_sched_policy_enum upc_sched_policy_t;
+
+/* Non-Uniform Memory Allocation */
+enum upc_mem_policy_enum
+ {
+ GUPCR_MEM_POLICY_AUTO, /* kernel's default NUMA policy */
+ GUPCR_MEM_POLICY_NODE, /* allocate memory from the local node first */
+ GUPCR_MEM_POLICY_STRICT /* allocate memory from the local node only */
+ };
+typedef enum upc_mem_policy_enum upc_mem_policy_t;
+
+/* Data structure used keep track of cpu's that must ba avoided */
+typedef struct upc_cpu_avoid_struct upc_cpu_avoid_t;
+typedef upc_cpu_avoid_t *upc_cpu_avoid_p;
+
+/* UPC system-wide information */
+typedef struct upc_info_struct
+ {
+ char *program_name;
+ char *host_name;
+ pid_t monitor_pid;
+ int partial_attach_start;
+ os_heap_p runtime_heap;
+ os_lock_t lock;
+ upc_page_num_t init_page_alloc;
+ upc_shared_ptr_t init_heap_base;
+ size_t init_heap_size;
+ int smem_fd;
+ char *mmap_file_name;
+ upc_pte_p gpt;
+ upc_page_num_t cur_page_alloc;
+ upc_shared_ptr_t all_lock;
+ upc_thread_info_t thread_info[GUPCR_THREADS_MAX];
+ int num_cpus;
+ int num_nodes;
+ upc_sched_policy_t sched_policy;
+ upc_mem_policy_t mem_policy;
+ } upc_info_t;
+typedef upc_info_t *upc_info_p;
+
+/* system wide info */
+extern upc_info_p __upc_info;
+
+/* The filename of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+extern GUPCR_THREAD_LOCAL const char *__upc_err_filename;
+
+/* The line number of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+extern GUPCR_THREAD_LOCAL unsigned int __upc_err_linenum;
+
+#define GUPCR_SET_ERR_LOC() \
+ do \
+ { \
+ __upc_err_filename = filename; \
+ __upc_err_linenum = linenum; \
+ } while (0)
+
+#define GUPCR_CLEAR_ERR_LOC() \
+ do \
+ { \
+ __upc_err_filename = NULL; \
+ __upc_err_linenum = 0; \
+ } while (0)
+
+/* The base address of the UPC shared section */
+extern char GUPCR_SHARED_SECTION_START[1];
+
+/* The ending address (plus one) of the UPC shared section */
+extern char GUPCR_SHARED_SECTION_END[1];
+
+/* The base address of the UPC compiled program info. section */
+extern char GUPCR_PGM_INFO_SECTION_START[1];
+
+/* The ending address (plus one) of the UPC compiled program info. section */
+extern char GUPCR_PGM_INFO_SECTION_END[1];
+
+/* The value of THREADS when defined at run time */
+extern int THREADS;
+
+/* Current thread id */
+extern GUPCR_THREAD_LOCAL int MYTHREAD;
+
+#ifdef GUPCR_USE_PTHREADS
+/* The value of UPC_PTHREADS when defined at run time */
+extern int UPC_PTHREADS;
+#endif
+
+#endif /* _UPC_DEFS_H_ */
diff --git a/libgupc/smp/upc_gasp.c b/libgupc/smp/upc_gasp.c
new file mode 100644
index 00000000000..7e7fda0700c
--- /dev/null
+++ b/libgupc/smp/upc_gasp.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "gasp.h"
+
+/* Since libgupc contains references to these functions, we provide dummy
+ implementations to prevent linker warnings when GASP support has been
+ compiled into GNU UPC, but the user compiles their app regularly.
+ We define these as weak symbols so tools can override them
+ appropriately. */
+
+#pragma weak gasp_init
+#pragma weak gasp_event_notify
+#pragma weak gasp_event_notifyVA
+#pragma weak gasp_control
+#pragma weak gasp_create_event
+
+gasp_context_t
+gasp_init (gasp_model_t ARG_UNUSED (srcmodel),
+ int *ARG_UNUSED (argc), char ***ARG_UNUSED (argv))
+{
+ return 0;
+}
+
+void
+gasp_event_notify (gasp_context_t ARG_UNUSED (context),
+ unsigned int ARG_UNUSED (evttag),
+ gasp_evttype_t ARG_UNUSED (evttype),
+ const char *ARG_UNUSED (filename),
+ int ARG_UNUSED (linenum), int ARG_UNUSED (colnum), ...)
+{
+}
+
+void
+gasp_event_notifyVA (gasp_context_t ARG_UNUSED (context),
+ unsigned int ARG_UNUSED (evttag),
+ gasp_evttype_t ARG_UNUSED (evttype),
+ const char *ARG_UNUSED (filename),
+ int ARG_UNUSED (linenum),
+ int ARG_UNUSED (colnum), va_list ARG_UNUSED (varargs))
+{
+}
+
+int
+gasp_control (gasp_context_t ARG_UNUSED (context), int ARG_UNUSED (on))
+{
+ return 0;
+}
+
+unsigned int
+gasp_create_event (gasp_context_t ARG_UNUSED (context),
+ const char *ARG_UNUSED (name),
+ const char *ARG_UNUSED (desc))
+{
+ return 0;
+}
diff --git a/libgupc/smp/upc_gum.c b/libgupc/smp/upc_gum.c
new file mode 100644
index 00000000000..1bb04012f34
--- /dev/null
+++ b/libgupc/smp/upc_gum.c
@@ -0,0 +1,197 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "upc_config.h"
+
+#define GUM_MAX_BUF 1024
+#define GUM_CONDATA_FMT "Host %s PID %d MYTHREAD %d THREADS %d"
+#define GUM_GDBSDATA_FMT "Host %s port %d"
+
+void
+__upc_gum_init (int nthreads, int thread_id)
+{
+ const char *gum_host = GUM_HOST_DEFAULT;
+ int gum_port = GUM_PORT_DEFAULT;
+ const char *gdbserver = "gdbserver";
+ const char *gum_port_env = getenv (GUM_PORT_ENV);
+ const char *gum_gdbserverpath_env = getenv (GUM_GDBSERVERPATH_ENV);
+ const char *gum_attach_delay_env = getenv (GUM_ATTACH_DELAY_ENV);
+ int attach_delay = GUM_ATTACH_DELAY_DEFAULT;
+ int mypid = getpid();
+ char myhost[GUM_MAX_BUF];
+ char hostname[GUM_MAX_BUF];
+ struct hostent *hostent;
+ struct sockaddr_in sockaddr;
+ int gum_sock_fd;
+ FILE *gum_in, *gum_out;
+ char gum_reply[GUM_MAX_BUF];
+ int gum_reply_len;
+ char gum_mux_host[GUM_MAX_BUF];
+ int gum_mux_port;
+ char gum_mux_connect[GUM_MAX_BUF];
+ int gdbserver_pid;
+ if (gethostname (myhost, sizeof (myhost)) != 0)
+ {
+ perror ("gethostname");
+ abort ();
+ }
+ if (gum_port_env)
+ {
+ const char *p = gum_port_env;
+ size_t hostlen;
+ while (*p && *p != ':')
+ ++p;
+ if (!*p)
+ {
+ fprintf (stderr,
+ "Missing separator in %s environment variable: %s\n",
+ GUM_PORT_ENV, gum_port_env);
+ exit (2);
+ }
+ hostlen = (p - gum_port_env);
+ if (!hostlen)
+ {
+ fprintf (stderr,
+ "empty host name in `%s' environment variable: `%s'\n",
+ GUM_PORT_ENV, gum_port_env);
+ exit (2);
+ }
+ if (hostlen > (sizeof (hostname) - 1))
+ {
+ fprintf (stderr,
+ "host name in `%s' environment variable is too long: `%s'\n",
+ GUM_PORT_ENV, gum_port_env);
+ exit (2);
+ }
+ strncpy (hostname, gum_port_env, hostlen);
+ hostname[hostlen] = '\0';
+ gum_host = (const char *) hostname;
+ p = p + 1;
+ gum_port = atoi (p);
+ if (!gum_port)
+ {
+ fprintf (stderr,
+ "Invalid port number in %s environment variable: %s\n",
+ GUM_PORT_ENV, gum_port_env);
+ exit (2);
+ }
+ }
+ if (gum_gdbserverpath_env)
+ {
+ struct stat statbuf;
+ if (stat (gum_gdbserverpath_env, &statbuf) != 0)
+ {
+ fprintf (stderr,
+ "Cannot locate gdbserver via environment variable %s: %s\n",
+ GUM_GDBSERVERPATH_ENV, gum_gdbserverpath_env);
+ exit (2);
+ }
+ gdbserver = gum_gdbserverpath_env;
+ }
+ if (gum_attach_delay_env)
+ {
+ attach_delay = atoi (gum_attach_delay_env);
+ }
+ hostent = gethostbyname (gum_host);
+ if (!hostent)
+ {
+ fprintf (stderr, "%s: unknown GUM host\n", gum_host);
+ exit (2);
+ }
+ gum_sock_fd = socket (PF_INET, SOCK_STREAM, 0);
+ if (!gum_sock_fd)
+ {
+ perror ("Can't create GUM socket");
+ abort ();
+ }
+ sockaddr.sin_family = PF_INET;
+ sockaddr.sin_port = htons (gum_port);
+ memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr,
+ sizeof (struct in_addr));
+ if (connect (gum_sock_fd, (struct sockaddr *) &sockaddr, sizeof (sockaddr))
+ < 0)
+ {
+ perror ("Can't connect to GUM host");
+ abort ();
+ }
+ gum_in = fdopen (gum_sock_fd, "r");
+ if (!gum_in)
+ {
+ perror ("fdopen of gum_in failed");
+ abort ();
+ }
+ setlinebuf (gum_in);
+ gum_out = fdopen (gum_sock_fd, "w");
+ if (!gum_out)
+ {
+ perror ("fdopen of gum_out failed");
+ abort ();
+ }
+ setlinebuf (gum_out);
+ fprintf (gum_out, GUM_CONDATA_FMT, myhost, mypid, thread_id, nthreads);
+ fflush (gum_out);
+ if (!fgets (gum_reply, sizeof (gum_reply), gum_in))
+ {
+ fprintf (stderr, "Can't read GUM reply\n");
+ exit (2);
+ }
+ fclose (gum_in);
+ fclose (gum_out);
+ close (gum_sock_fd);
+ gum_reply_len = strlen (gum_reply);
+ if (gum_reply_len && gum_reply[gum_reply_len - 1] == '\n')
+ gum_reply[--gum_reply_len] = '\0';
+ if (sscanf (gum_reply, GUM_GDBSDATA_FMT, gum_mux_host, &gum_mux_port) != 2)
+ {
+ fprintf (stderr, "%d: invalid GUM reply: %s\n", mypid, gum_reply);
+ exit (2);
+ }
+ if (snprintf (gum_mux_connect, sizeof (gum_mux_connect), "%s:%d",
+ gum_mux_host, gum_mux_port) >= (int) sizeof (gum_mux_connect))
+ {
+ fprintf (stderr, "%d: GUM mux connect buffer exceeds size\n", mypid);
+ exit (2);
+ }
+ if ((gdbserver_pid = fork ()) > 0)
+ {
+ /* Give gdbserver a chance to connect to us. */
+ sleep (attach_delay);
+ }
+ else if (!gdbserver_pid)
+ {
+ char mypidstr[12];
+ sprintf (mypidstr, "%d", mypid);
+ execl (gdbserver, gdbserver, gum_mux_connect, "--attach", mypidstr, NULL);
+ perror ("gdbserver exec failed");
+ abort ();
+ }
+ else
+ {
+ perror ("fork of gdbserver failed");
+ abort ();
+ }
+}
diff --git a/libgupc/smp/upc_lib.h b/libgupc/smp/upc_lib.h
new file mode 100644
index 00000000000..a1804234a7e
--- /dev/null
+++ b/libgupc/smp/upc_lib.h
@@ -0,0 +1,68 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_LIB_H_
+#define _UPC_LIB_H_
+
+/* Definition of user-visible UPC library routines,
+ in a form that they can be called from the
+ "C"-based runtime. */
+
+extern size_t upc_threadof (upc_shared_ptr_t);
+extern size_t upc_phaseof (upc_shared_ptr_t);
+extern upc_shared_ptr_t upc_resetphase (upc_shared_ptr_t);
+extern size_t upc_addrfield (upc_shared_ptr_t);
+extern size_t upc_affinitysize (size_t, size_t, size_t);
+
+extern void upc_global_exit (int);
+
+extern void upc_memcpy (upc_shared_ptr_t dest, upc_shared_ptr_t src,
+ size_t n);
+extern void upc_memget (void *dest, upc_shared_ptr_t src, size_t n);
+extern void upc_memput (upc_shared_ptr_t dest, const void *src, size_t n);
+extern void upc_memset (upc_shared_ptr_t dest, int c, size_t n);
+
+extern upc_shared_ptr_t upc_global_alloc (size_t, size_t);
+extern upc_shared_ptr_t upc_all_alloc (size_t, size_t);
+extern upc_shared_ptr_t upc_alloc (size_t);
+extern void upc_free (upc_shared_ptr_t);
+extern void upc_all_free (upc_shared_ptr_t);
+
+extern upc_shared_ptr_t upc_lock_alloc (void);
+extern void upc_lock_free (upc_shared_ptr_t);
+extern void upc_all_lock_free (upc_shared_ptr_t);
+extern upc_shared_ptr_t upc_all_lock_alloc (void);
+extern upc_shared_ptr_t upc_global_lock_alloc (void);
+extern void upc_lock (upc_shared_ptr_t);
+extern int upc_lock_attempt (upc_shared_ptr_t);
+extern void upc_unlock (upc_shared_ptr_t);
+
+typedef uint64_t upc_tick_t;
+extern upc_tick_t upc_ticks_now(void);
+extern uint64_t upc_ticks_to_ns(upc_tick_t ticks);
+
+#endif /* _UPC_LIB_H_ */
diff --git a/libgupc/smp/upc_libat_lock.c b/libgupc/smp/upc_libat_lock.c
new file mode 100644
index 00000000000..903b119886c
--- /dev/null
+++ b/libgupc/smp/upc_libat_lock.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ It is derived from libatomic/config/posix/lock.c.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_libat_lock.h"
+
+/* Locking for a typical-sized operation. */
+void
+libat_lock_1 (void *ARG_UNUSED (ptr))
+{
+ upc_info_p u = __upc_info;
+ __upc_acquire_lock (&u->lock);
+}
+
+void
+libat_unlock_1 (void *ARG_UNUSED (ptr))
+{
+ upc_info_p u = __upc_info;
+ __upc_release_lock (&u->lock);
+}
+
+/* Locking for a "large" operation. This should always be some sort of
+ test-and-set operation, as we assume that the interrupt latency would
+ be unreasonably large. */
+void
+libat_lock_n (void *ARG_UNUSED (ptr), size_t ARG_UNUSED (n))
+{
+ upc_info_p u = __upc_info;
+ __upc_acquire_lock (&u->lock);
+}
+
+void
+libat_unlock_n (void *ARG_UNUSED (ptr), size_t ARG_UNUSED (n))
+{
+ upc_info_p u = __upc_info;
+ __upc_release_lock (&u->lock);
+}
diff --git a/libgupc/smp/upc_libat_lock.h b/libgupc/smp/upc_libat_lock.h
new file mode 100644
index 00000000000..e360444efcf
--- /dev/null
+++ b/libgupc/smp/upc_libat_lock.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ It is derived from libatomic/config/posix/lock.c.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_LIBAT_LOCK_H_
+#define _UPC_LIBAT_LOCK_H_
+
+/* Locking for a typical-sized operation. */
+extern void libat_lock_1 (void *ptr);
+extern void libat_unlock_1 (void *ptr);
+
+/* Locking for a "large" operation. This should always be some sort of
+ test-and-set operation, as we assume that the interrupt latency would
+ be unreasonably large. */
+extern void libat_lock_n (void *ptr, size_t n);
+extern void libat_unlock_n (void *ptr, size_t n);
+
+#endif /* !_UPC_LIBAT_LOCK_H_ */
diff --git a/libgupc/smp/upc_libg.c b/libgupc/smp/upc_libg.c
new file mode 100644
index 00000000000..7b4d74dad47
--- /dev/null
+++ b/libgupc/smp/upc_libg.c
@@ -0,0 +1,251 @@
+/* Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_sup.h"
+#include "upc_lib.h"
+#include "gasp_upc.h"
+#include "upc_pupc.h"
+
+void
+__upc_barrierg (int barrier_id, const char *filename, const int linenum)
+{
+ int named = (barrier_id != INT_MIN);
+ p_start (GASP_UPC_BARRIER, named, barrier_id);
+ GUPCR_SET_ERR_LOC();
+ __upc_barrier (barrier_id);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_BARRIER, named, barrier_id);
+}
+
+void
+__upc_notifyg (int barrier_id, const char *filename, const int linenum)
+{
+ int named = (barrier_id != INT_MIN);
+ p_start (GASP_UPC_NOTIFY, named, barrier_id);
+ GUPCR_SET_ERR_LOC();
+ __upc_notify (barrier_id);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_NOTIFY, named, barrier_id);
+}
+
+void
+__upc_waitg (int barrier_id, const char *filename, const int linenum)
+{
+ int named = (barrier_id != INT_MIN);
+ p_start (GASP_UPC_WAIT, named, barrier_id);
+ GUPCR_SET_ERR_LOC();
+ __upc_wait (barrier_id);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_WAIT, named, barrier_id);
+}
+
+upc_shared_ptr_t
+upc_global_lock_allocg (const char *filename, int linenum)
+{
+ upc_shared_ptr_t result;
+ p_start (GASP_UPC_GLOBAL_LOCK_ALLOC);
+ GUPCR_SET_ERR_LOC();
+ result = upc_global_lock_alloc();
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_GLOBAL_LOCK_ALLOC, &result);
+ return result;
+}
+
+void
+upc_all_lock_freeg (upc_shared_ptr_t ptr, const char *filename, int linenum)
+{
+ p_start (GASP_UPC_LOCK_FREE, &ptr);
+ GUPCR_SET_ERR_LOC();
+ upc_all_lock_free(ptr);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_LOCK_FREE, &ptr);
+}
+
+void
+upc_lock_freeg (upc_shared_ptr_t ptr, const char *filename, int linenum)
+{
+ p_start (GASP_UPC_LOCK_FREE, &ptr);
+ GUPCR_SET_ERR_LOC();
+ upc_lock_free(ptr);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_LOCK_FREE, &ptr);
+}
+
+upc_shared_ptr_t
+upc_all_lock_allocg (const char *filename, int linenum)
+{
+ upc_shared_ptr_t result;
+ p_start (GASP_UPC_ALL_LOCK_ALLOC);
+ GUPCR_SET_ERR_LOC();
+ result = upc_all_lock_alloc();
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_ALL_LOCK_ALLOC, &result);
+ return result;
+}
+
+void
+upc_lockg (upc_shared_ptr_t ptr, const char *filename, int linenum)
+{
+ p_start (GASP_UPC_LOCK, &ptr);
+ GUPCR_SET_ERR_LOC();
+ upc_lock(ptr);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_LOCK, &ptr);
+}
+
+int
+upc_lock_attemptg (upc_shared_ptr_t ptr, const char *filename, int linenum)
+{
+ int status;
+ p_start (GASP_UPC_LOCK_ATTEMPT, &ptr);
+ GUPCR_SET_ERR_LOC();
+ status = upc_lock_attempt(ptr);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_LOCK_ATTEMPT, &ptr, status);
+ return status;
+}
+
+void
+upc_unlockg (upc_shared_ptr_t ptr, const char *filename, int linenum)
+{
+ p_start (GASP_UPC_UNLOCK, &ptr);
+ GUPCR_SET_ERR_LOC();
+ upc_unlock(ptr);
+ GUPCR_CLEAR_ERR_LOC();
+ p_end (GASP_UPC_UNLOCK, &ptr);
+}
+
+void
+__upc_funcg (int start, const char *funcname,
+ const char *filename, const int linenum)
+{
+ if (start)
+ p_start (GASP_C_FUNC, funcname);
+ else
+ p_end (GASP_C_FUNC, funcname);
+}
+
+void
+__upc_forallg (int start, const char *filename, const int linenum)
+{
+ if (start)
+ p_start (GASP_UPC_FORALL);
+ else
+ p_end (GASP_UPC_FORALL);
+}
+
+extern void __upc_exitg (int status, const char *filename, int linenum)
+ __attribute__ ((__noreturn__));
+
+void
+__upc_exitg (int status, const char *filename, int linenum)
+{
+ p_start (GASP_UPC_COLLECTIVE_EXIT, status);
+ p_end (GASP_UPC_COLLECTIVE_EXIT, status);
+ __upc_exit (status);
+}
+
+void
+upc_global_exitg (int status, const char *filename, int linenum)
+{
+ p_atomic (GASP_UPC_NONCOLLECTIVE_EXIT, status);
+ upc_global_exit (status);
+}
+
+void *
+__cvtaddrg (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ void *result;
+ GUPCR_SET_ERR_LOC();
+ result = __cvtaddr (p);
+ GUPCR_CLEAR_ERR_LOC();
+ return result;
+}
+
+void *
+__getaddrg (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ void *result;
+ GUPCR_SET_ERR_LOC();
+ result = __getaddr (p);
+ GUPCR_CLEAR_ERR_LOC();
+ return result;
+}
+
+size_t
+upc_addrfieldg (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ size_t result;
+ GUPCR_SET_ERR_LOC();
+ result = upc_addrfield (p);
+ GUPCR_CLEAR_ERR_LOC();
+ return result;
+}
+
+size_t
+upc_affinitysizeg (size_t totalsize, size_t nbytes, size_t threadid,
+ const char *filename, int linenum)
+{
+ size_t result;
+ GUPCR_SET_ERR_LOC();
+ result = upc_affinitysize (totalsize, nbytes, threadid);
+ GUPCR_CLEAR_ERR_LOC();
+ return result;
+}
+
+size_t
+upc_phaseofg (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ size_t result;
+ GUPCR_SET_ERR_LOC();
+ result = upc_phaseof (p);
+ GUPCR_CLEAR_ERR_LOC();
+ return result;
+}
+
+upc_shared_ptr_t
+upc_resetphaseg (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ upc_shared_ptr_t result;
+ GUPCR_SET_ERR_LOC();
+ result = upc_resetphase (p);
+ GUPCR_CLEAR_ERR_LOC();
+ return result;
+}
+
+size_t
+upc_threadofg (upc_shared_ptr_t p, const char *filename, int linenum)
+{
+ size_t result;
+ GUPCR_SET_ERR_LOC();
+ result = upc_threadof (p);
+ GUPCR_CLEAR_ERR_LOC();
+ return result;
+}
diff --git a/libgupc/smp/upc_lock.h b/libgupc/smp/upc_lock.h
new file mode 100644
index 00000000000..26b9ca71b00
--- /dev/null
+++ b/libgupc/smp/upc_lock.h
@@ -0,0 +1,31 @@
+/* Copyright (C) 2010-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_LOCK_H_
+#define _UPC_LOCK_H_
+
+extern void __upc_lock_init (void);
+#endif /* !_UPC_LOCK_H_ */
diff --git a/libgupc/smp/upc_lock.upc b/libgupc/smp/upc_lock.upc
new file mode 100644
index 00000000000..0280d550294
--- /dev/null
+++ b/libgupc/smp/upc_lock.upc
@@ -0,0 +1,419 @@
+/* Copyright (C) 2010-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include "config.h"
+#include "upc_lock_sup.h"
+
+/* UPC lock implementation.
+
+ The UPC lock functions use MCS locks as described in the
+ Mellor-Crummey and Scott paper: "Algorithms for Scalable Synchronization
+ on Shared-Memory Multiprocessors", ACM Transaction on Computer Systems,
+ February 1991.
+
+ The following data structures are used in this implementation:
+
+ * Lock link block
+ A data structure in the shared address space used to link threads
+ waiting on the lock. Each thread inserts itself on the list with
+ a link block that but has affinity to the thread itself. It has
+ three fields: (1) next - link list pointer, (2) signal - notification
+ of lock ownership transfer, (3) free flag - link block was freed by
+ some other thread. A link block has affinity to the owner of the block.
+ * Lock Link block reference
+ A 64 bits container for pointer to shared that contains only a thread
+ number and address field. Link reference allow the lock routines to
+ efficiently execute atomic operations on shared pointers.
+ * Lock structure (upc_lock_t)
+ A lock is a data structure living in the shared memory space.
+ Contains two lock link references: (1) last - a lock link reference
+ to the link block of the last thread on the lock waiting list,
+ (2) owner - link reference to the lock's owner link block. The lock
+ data structure has affinity of the thread that created the lock.
+
+ The lock data structure goes though the following states:
+
+ * Lock is free
+ Last link block reference is NULL.
+ * Lock is taken
+ Last link block reference points to the last thread's link block on
+ the waiting queue. Owner link reference points to the owner thread's
+ link block. Only the owner of the lock is allowed to manipulate the
+ owner's link reference in the lock data structure.
+
+ The following operations are performed on the lock data structure:
+
+ * Lock acquire
+ Thread allocates a link block and write its reference to the 'last'
+ filed of the lock data structure by performing an atomic SWAP
+ operation. If returned value is NULL, thread is the owner of the
+ lock. Otherwise a link reference to the last thread on the waiting
+ queue is returned and thread needs to link itself on the waiting
+ queue.
+ * Lock release
+ Attempt to write a NULL link block reference into the lock's 'last'
+ field with atomic CSWAP operation. If successful, lock is released.
+ Otherwise, the ownership of the lock must be passed to the first
+ thread on the wait queue.
+ * Lock allocation/free
+ Lock is allocated from the shared memory space or from the local
+ free list. They are freed by placing the lock data structure on
+ the local lock free list if the lock has affinity of the thread that
+ releases it. Otherwise lock's memory is released.
+*/
+
+struct upc_lock_link_cache_struct
+{
+ upc_lock_link_t lock_links[GUPCR_MAX_LOCKS];
+};
+typedef struct upc_lock_link_cache_struct upc_lock_link_cache_t;
+
+/* Array of lock links managed as a per-thread free list. */
+static shared upc_lock_link_cache_t upc_lock_link_cache[THREADS];
+
+/* Per thread lock link free list. */
+static upc_lock_link_t *upc_lock_links;
+/* Null link block reference. Used for CSWAP operations. */
+upc_link_ref null_link = {.atomic = 0 };
+
+/* UPC lock free list. */
+static upc_lock_t *lock_free;
+
+/* Memory allocation support. */
+upc_lock_t *shared __upc_all_lock;
+shared upc_lock_t __upc_alloc_lock;
+
+__attribute__ ((__always_inline__))
+static inline
+void
+upc_new_lock_init (upc_lock_t *lock)
+{
+ lock->last.atomic = 0;
+ lock->owner_link.atomic = 0;
+}
+
+/* Lock link block utilities. */
+
+/* Lock link block is a data structure that links
+ lock waiting threads. It is located in the
+ shared space of the thread waiting for the lock.
+ They are locally managed with a free list rooted
+ at 'upc_lock_links'.
+
+ NOTE:
+ The current design for memory allocation uses
+ UPC locks in alloc/free routines. Thus, link blocks
+ cannot be allocate with the UPC memory allocation
+ routines. */
+
+/* Initialize lock link block free list.
+ NOTE: Link with local addresses for faster access. */
+static void
+upc_lock_link_init (void)
+{
+ shared [] upc_lock_link_t *slink = upc_lock_link_cache[MYTHREAD].lock_links;
+ upc_lock_link_t *link = (upc_lock_link_t *) slink;
+ upc_lock_links = link;
+ memset (link, '\0', sizeof (upc_lock_link_cache_t));
+ for (int i = 0; i < (GUPCR_MAX_LOCKS - 1); i++)
+ {
+ link[i].link_ref = upc_to_link_ref (slink++);
+ link[i].link = &link[i + 1];
+ }
+ link[GUPCR_MAX_LOCKS - 1].link_ref = upc_to_link_ref (slink++);
+}
+
+/* Release lock link block. */
+__attribute__ ((__always_inline__))
+static inline
+void
+upc_lock_link_free (upc_lock_link_t * link)
+{
+ SET_NULL_LOCK_REF (link->next);
+ link->signal = 0;
+ link->link = upc_lock_links;
+ upc_lock_links = link;
+}
+
+/* Allocate lock link block. */
+__attribute__ ((__always_inline__))
+static inline
+upc_lock_link_t *
+upc_lock_link_alloc (void)
+{
+ upc_lock_link_t *link = upc_lock_links;
+ if (!link)
+ {
+ /* Try to find a link block that has been freed by
+ some other thread and thus not returned to the free list. */
+ upc_lock_link_t *llink = (upc_lock_link_t *)
+ upc_lock_link_cache[MYTHREAD].lock_links;
+ for (int i = 0; i < (GUPCR_MAX_LOCKS - 1); ++i)
+ {
+ if (llink->free)
+ {
+ llink->free = 0;
+ upc_lock_link_free (llink);
+ }
+ llink++;
+ }
+ link = upc_lock_links;
+ if (!link)
+ __upc_fatal ("Cannot allocate a UPC lock link. "
+ "The number of allocated per thread lock links "
+ "exceeds the configuration defined maximum of entries.");
+ }
+ upc_lock_links = link->link;
+ return link;
+}
+
+/* Allocate a lock and return a pointer to it.
+ This is not a collective function. */
+upc_lock_t *
+upc_global_lock_alloc (void)
+{
+ upc_lock_t *lock;
+ if (lock_free)
+ {
+ lock = lock_free;
+ lock_free = lock->free_link;
+ }
+ else
+ {
+ /* Allocate space for the lock from shared memory with
+ affinity to the calling thread. */
+ lock = upc_alloc (sizeof (upc_lock_t));
+ if (lock == NULL)
+ __upc_fatal ("Cannot allocate memory for the lock");
+ }
+ upc_new_lock_init (lock);
+ return lock;
+}
+
+/* Free all lock resources.
+ If lock has affinity to the calling thread it is released on the
+ local free list. If 'lock' is a null pointer, no action occurs.
+ Otherwise, if the argument does not match a pointer earlier
+ returned by the alloc function, or if the lock has been de-allocated
+ by a previous call to 'upc_lock_free' the behavior is undefined. */
+
+void
+upc_lock_free (upc_lock_t *lock)
+{
+ upc_link_ref owner;
+ if (lock == NULL)
+ return;
+ /* Release the link block if this thread owns the lock. */
+ owner = lock->owner_link;
+ if (!NULL_LOCK_REF (owner))
+ {
+ shared upc_lock_link_t *link = upc_from_link_ref (owner);
+ if (MYTHREAD == (int) upc_threadof (link))
+ {
+ upc_lock_link_free ((upc_lock_link_t *) link);
+ }
+ else
+ link->free = 1;
+ }
+ if (MYTHREAD == (int) upc_threadof (lock))
+ {
+ /* Release it on the local free list. */
+ lock->free_link = lock_free;
+ lock_free = lock;
+ }
+ else
+ upc_free (lock);
+}
+
+/* Collective free all lock resources. */
+void
+upc_all_lock_free (upc_lock_t *lock)
+{
+ upc_link_ref owner;
+ if (lock == NULL)
+ return;
+ /* Release the link block if this thread owns the lock. */
+ owner = lock->owner_link;
+ if (!NULL_LOCK_REF (owner))
+ {
+ shared upc_lock_link_t *link = upc_from_link_ref (owner);
+ if (MYTHREAD == (int) upc_threadof (link))
+ {
+ upc_lock_link_free ((upc_lock_link_t *) link);
+ }
+ }
+ if (MYTHREAD == (int) upc_threadof (lock))
+ {
+ /* Release it on the local free list. */
+ lock->free_link = lock_free;
+ lock_free = lock;
+ }
+ upc_barrier;
+}
+
+/* Allocate a lock and return a pointer to it.
+ 'upc_all_lock_alloc' is a collective function. */
+upc_lock_t *
+upc_all_lock_alloc (void)
+{
+ upc_lock_t *lock;
+ upc_barrier (-1);
+ if (MYTHREAD == 0)
+ {
+ if (lock_free)
+ {
+ lock = lock_free;
+ lock_free = lock->free_link;
+ }
+ else
+ {
+ lock = upc_alloc (sizeof (upc_lock_t));
+ if (lock == NULL)
+ __upc_fatal ("Cannot allocate memory for the lock");
+ }
+ upc_new_lock_init (lock);
+ __upc_all_lock = lock;
+ }
+ upc_barrier (-1);
+ return __upc_all_lock;
+}
+
+/* UPC lock acquire. */
+void
+upc_lock (upc_lock_t *lock)
+{
+ upc_lock_link_t *link;
+ upc_link_ref old_link_ref;
+ link = upc_lock_link_alloc ();
+
+ /* Insert this thread on the waiting list. */
+ upc_link_ref_swap (&lock->last, &old_link_ref, link->link_ref);
+ if (!NULL_LOCK_REF (old_link_ref))
+ {
+ /* We have to wait. "old_link_ref" contains a reference
+ to the last thread on the wait queue. */
+ shared upc_lock_link_t *rmt_link = upc_from_link_ref (old_link_ref);
+ upc_link_ref_put ((shared upc_link_ref *) &rmt_link->next,
+ link->link_ref);
+ /* Wait for lock ownership notification. */
+ __upc_spin_until (link->signal);
+ }
+ lock->owner_link = link->link_ref;
+ upc_fence;
+}
+
+/* UPC lock acquire attempt.
+ Return 1 if lock is acquired, 0 otherwise. */
+int
+upc_lock_attempt (upc_lock_t *lock)
+{
+ upc_lock_link_t *link;
+ int compare_ok;
+ /* No need go further if lock is unavailable. */
+ if (!NULL_LOCK_REF (upc_link_ref_last (&lock->last)))
+ return 0;
+ /* Try to allocate the lock. */
+ link = upc_lock_link_alloc ();
+ compare_ok = upc_link_ref_cswap (&lock->last, null_link, link->link_ref);
+ if (compare_ok)
+ {
+ lock->owner_link = link->link_ref;
+ upc_fence;
+ }
+ else
+ {
+ upc_lock_link_free (link);
+ }
+ return compare_ok;
+}
+
+/* UPC lock release. */
+void
+upc_unlock (upc_lock_t *lock)
+{
+ upc_lock_link_t *link;
+ upc_link_ref link_ref = lock->owner_link;
+ int compare_ok;
+
+ if (!lock)
+ __upc_fatal ("Trying to release a NULL lock");
+ if (NULL_LOCK_REF (link_ref))
+ __upc_fatal ("Trying to release a lock that is not locked");
+ upc_fence;
+ link = (upc_lock_link_t *) upc_from_link_ref (link_ref);
+
+ /* Try to release the lock by trying to write a NULL into lock
+ block (last). Use CSWAP with link_ref as expected. */
+ compare_ok = upc_link_ref_cswap (&lock->last, link_ref, null_link);
+ if (!compare_ok)
+ {
+ /* Another thread is already waiting for the lock,
+ pass the ownership. */
+ /* Make sure that waiting thread completed insertion on the
+ waiting list. */
+ __upc_spin_until (!NULL_LOCK_REF (upc_link_ref_get (&link->next)));
+ /* Notify the waiting thread that it now owns the lock. */
+ {
+ shared upc_lock_link_t *rmt_link;
+ rmt_link = upc_from_link_ref (link->next);
+ rmt_link->signal = 1;
+ }
+ }
+ upc_lock_link_free (link);
+}
+
+/* Heap manager lock support. */
+
+void
+__upc_acquire_alloc_lock ()
+{
+ upc_lock (&__upc_alloc_lock);
+}
+
+void
+__upc_release_alloc_lock ()
+{
+ upc_unlock (&__upc_alloc_lock);
+}
+
+/* Initialize UPC lock resources. */
+void
+__upc_lock_init (void)
+{
+ upc_lock_link_init ();
+ lock_free = NULL;
+
+ /* Heap manager lock must be manually initialized. */
+ if (!MYTHREAD)
+ upc_new_lock_init (&__upc_alloc_lock);
+}
+
+/** @} */
diff --git a/libgupc/smp/upc_lock_sup.c b/libgupc/smp/upc_lock_sup.c
new file mode 100644
index 00000000000..ff86afeda8f
--- /dev/null
+++ b/libgupc/smp/upc_lock_sup.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2010-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+
+/* On some 32 bit targets 64 bit CSWAP is not available. */
+#if !defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
+/* Use OS spin lock to protect the critical section. */
+unsigned char
+__sync_bool_compare_and_swap_8 (long long *addr, long long exp, long long val)
+{
+ unsigned char result = 0;
+ upc_info_p u = __upc_info;
+ __upc_acquire_lock (&u->lock);
+ if (*addr == exp)
+ {
+ *addr = val;
+ result = 1;
+ }
+ __upc_release_lock (&u->lock);
+ return result;
+}
+#endif
+
diff --git a/libgupc/smp/upc_lock_sup.h b/libgupc/smp/upc_lock_sup.h
new file mode 100644
index 00000000000..1f00b1198d5
--- /dev/null
+++ b/libgupc/smp/upc_lock_sup.h
@@ -0,0 +1,226 @@
+/* Copyright (C) 2010-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef _UPC_LOCK_SUP_H_
+#define _UPC_LOCK_SUP_H_
+
+/* GUPC lock implementation support routines. */
+
+/* Lock reference atomic type definitions. */
+#define GUPCR_LOCK_ATOMIC_THREAD_TYPE unsigned long
+#define GUPCR_LOCK_ATOMIC_VADDR_TYPE unsigned long long
+#define GUPCR_LOCK_ATOMIC_TYPE unsigned long long
+/* Store/Load of lock reference values must be atomic. On 32 bit
+ use atomic functions. */
+#if __SIZEOF_POINTER__ == 4
+#define GUPCR_ATOMIC_LOCK_REF_ACCESS 1
+#else
+#define GUPCR_ATOMIC_LOCK_REF_ACCESS 0
+#endif
+/* Lock reference value is a 64 bits value. If bigger (struct
+ implementation on 64 bit) it must be converted. */
+#if defined (GUPCR_PTS_STRUCT_REP) && __SIZEOF_POINTER__ == 8
+#define GUPCR_CONVERT_LOCK_REF 1
+#else
+#define GUPCR_CONVERT_LOCK_REF 0
+#endif
+
+/* Lock link reference pointer.
+ "shared" pointer with thread and offset only. Small enough that
+ runtime can read/write it without the need to have the exclusive
+ rights to the memory (at least for packed/64bits). */
+struct upc_lock_thread_struct
+ {
+ GUPCR_LOCK_ATOMIC_THREAD_TYPE thread:GUPCR_THREAD_SIZE;
+ GUPCR_LOCK_ATOMIC_VADDR_TYPE addr:64-GUPCR_THREAD_SIZE;
+ };
+union upc_lock_link_ptr
+ {
+ struct upc_lock_thread_struct sptr;
+ GUPCR_LOCK_ATOMIC_TYPE atomic;
+ };
+typedef union upc_lock_link_ptr upc_link_ref;
+#define NULL_LOCK_REF(P) (P.atomic == 0)
+#define SET_NULL_LOCK_REF(P) (P.atomic = 0)
+#define LOCK_REF_THREAD(P) (P.sptr.thread)
+#define SAME_LOCK_REF(P,V) (P.atomic == V.atomic)
+
+typedef struct upc_lock_link_struct upc_lock_link_t;
+
+/* upc_lock_t is an opaque shared type. The 'upc_lock_struct'
+ structure describes the internal representation of the
+ UPC lock type.
+
+ UPC lock implementation uses builtin atomic functions
+ for swap/cswap of the UPC shared pointer. */
+
+struct upc_lock_struct
+{
+ upc_link_ref last; /* Last thread on the waiting list. */
+ upc_link_ref owner_link; /* Lock owner link block pointer. */
+ upc_lock_t *free_link;
+} __attribute__ ((aligned(64)));
+
+struct upc_lock_link_struct
+{
+ upc_link_ref next; /* Next thread on the waiting list. */
+ int signal; /* Notification of lock ownership. */
+ int free; /* Indication that link block is not used. */
+ upc_link_ref link_ref; /* Lock reference of this block. */
+ upc_lock_link_t *link; /* Free list link pointer. */
+} __attribute__ ((aligned(64)));
+
+/* UPC shared point to C representation. */
+typedef union pts_as_rep
+ {
+ shared void *pts;
+ upc_shared_ptr_t rep;
+ } pts_as_rep_t;
+
+/* Convert pointer to shared into the link reference. */
+__attribute__((__always_inline__))
+static inline
+upc_link_ref
+upc_to_link_ref (shared void *p)
+{
+#if GUPCR_CONVERT_LOCK_REF
+ upc_link_ref ref;
+ union pts_as_rep
+ {
+ shared void *s;
+ upc_shared_ptr_t v;
+ } pts = { .s = p };
+ ref.sptr.thread = GUPCR_PTS_THREAD (pts.v);
+ ref.sptr.addr = GUPCR_PTS_VADDR (pts.v);
+ return ref;
+#else
+ union pts_as_rep
+ {
+ shared void *pts;
+ upc_link_ref ref;
+ } pts = { .pts = p };
+ return pts.ref;
+#endif
+}
+
+/* Convert link reference into a pointer to shared. */
+__attribute__((__always_inline__))
+static inline
+shared upc_lock_link_t *
+upc_from_link_ref (upc_link_ref val)
+{
+#if GUPCR_CONVERT_LOCK_REF
+ union pts_as_rep
+ {
+ shared upc_lock_link_t *s;
+ upc_shared_ptr_t v;
+ } pts;
+ GUPCR_PTS_SET_NULL_SHARED (pts.v);
+ GUPCR_PTS_SET_VADDR (pts.v, (GUPCR_LOCK_ATOMIC_VADDR_TYPE)val.sptr.addr);
+ GUPCR_PTS_SET_THREAD (pts.v, val.sptr.thread);
+ return pts.s;
+#else
+ union pts_as_rep
+ {
+ shared upc_lock_link_t *pts;
+ upc_link_ref ref;
+ } pts = { .ref = val };
+ return pts.pts;
+#endif
+}
+
+__attribute__((__always_inline__))
+static inline
+void
+upc_link_ref_swap (shared void *p, upc_link_ref *old, upc_link_ref val)
+{
+ upc_link_ref *addr = __upc_map_to_local (p);
+ do
+ {
+ *old = *addr;
+ } while (!__sync_bool_compare_and_swap ((GUPCR_LOCK_ATOMIC_TYPE *) addr,
+ old->atomic, val.atomic));
+}
+
+__attribute__((__always_inline__))
+static inline
+int
+upc_link_ref_cswap (shared void *p, upc_link_ref cmp, upc_link_ref val)
+{
+ upc_link_ref *addr = __upc_map_to_local (p);
+ return __sync_bool_compare_and_swap ((GUPCR_LOCK_ATOMIC_TYPE *) addr,
+ cmp.atomic, val.atomic);
+}
+
+__attribute__((__always_inline__))
+static inline
+void
+upc_link_ref_put (shared upc_link_ref *p, upc_link_ref val)
+{
+ GUPCR_LOCK_ATOMIC_TYPE *addr;
+ addr = __upc_map_to_local(p);
+#if GUPCR_ATOMIC_LOCK_REF_ACCESS
+ {
+ GUPCR_LOCK_ATOMIC_TYPE tmp;
+ do
+ {
+ tmp = *addr;
+ } while (!__sync_bool_compare_and_swap (addr, tmp, val.atomic));
+ }
+#else
+ *addr = val.atomic;
+#endif
+}
+
+__attribute__((__always_inline__))
+static inline
+upc_link_ref
+upc_link_ref_get (upc_link_ref *p)
+{
+#if GUPCR_ATOMIC_LOCK_REF_ACCESS
+ GUPCR_LOCK_ATOMIC_TYPE *addr = (GUPCR_LOCK_ATOMIC_TYPE *) p;;
+ GUPCR_LOCK_ATOMIC_TYPE tmp;
+ do
+ {
+ tmp = * (GUPCR_LOCK_ATOMIC_TYPE *) addr;
+ } while (!__sync_bool_compare_and_swap (
+ (GUPCR_LOCK_ATOMIC_TYPE *) addr, tmp, tmp));
+ return (upc_link_ref) tmp;
+#else
+ return *p;
+#endif
+}
+
+__attribute__((__always_inline__))
+static inline
+upc_link_ref
+upc_link_ref_last (shared void *p)
+{
+ upc_link_ref *addr = __upc_map_to_local (p);
+ return upc_link_ref_get (addr);
+}
+
+#endif /* !_UPC_LOCK_SUP_H_ */
diff --git a/libgupc/smp/upc_main.c b/libgupc/smp/upc_main.c
new file mode 100644
index 00000000000..e02904e6ab3
--- /dev/null
+++ b/libgupc/smp/upc_main.c
@@ -0,0 +1,1176 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_lock.h"
+#include "upc_sup.h"
+#include "upc_sync.h"
+#include "upc_affinity.h"
+#include "upc_numa.h"
+#include "upc_debug.h"
+#include "gasp_upc.h"
+#include "upc_pupc.h"
+#if HAVE_UPC_BACKTRACE
+#include "upc_backtrace.h"
+#endif
+
+/* user's main program */
+extern int GUPCR_MAIN (int argc, char *argv[]);
+
+/* The number of THREADS, as specified on the command line */
+int THREADS = -1;
+
+#ifdef GUPCR_USE_PTHREADS
+/* The number of pthreads to run per process, as specified on the
+ command line. Required to be equal to the number of UPC threads
+ in the current implementation. */
+int UPC_PTHREADS = -1;
+#endif /* GUPCR_USE_PTHREADS */
+
+/* The current thread number (range: 0..THREADS-1) */
+GUPCR_THREAD_LOCAL int MYTHREAD;
+
+/* Depth count used to implement the semantics of
+ nested upc_forall statements. */
+GUPCR_THREAD_LOCAL int __upc_forall_depth;
+
+/* The UPC page size, in bits. Don't use 'const' here
+ because we want this to end up the loaded data where
+ the debug assistant can read it. Eventually move this
+ to the upc_info structure. */
+int __upc_page_shift = GUPCR_VM_OFFSET_BITS;
+
+/* Executable program's name */
+static char *__upc_pgm_name;
+
+/* Runtime state information */
+upc_info_p __upc_info;
+
+/* The filename of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+GUPCR_THREAD_LOCAL const char *__upc_err_filename;
+
+/* The line number of the location where a runtime
+ error was detected. This is set by the various
+ debug-enabled ('g') UPC runtime library routines. */
+GUPCR_THREAD_LOCAL unsigned int __upc_err_linenum;
+
+/* Local host name. */
+#define HOST_NAME_LEN 256
+static char host_name[HOST_NAME_LEN];
+
+/* per-thread initial heap size */
+static size_t __upc_init_heap_size = GUPCR_DEFAULT_PER_THREAD_HEAP_SIZE;
+
+/* CPU scheduling policy */
+static upc_sched_policy_t __upc_sched_policy = GUPCR_SCHED_POLICY_DEFAULT;
+
+/* CPU memory affinity policy */
+static upc_mem_policy_t __upc_mem_policy = GUPCR_MEM_POLICY_DEFAULT;
+
+/* list of CPU's that must be avoided */
+static upc_cpu_avoid_p __upc_cpu_avoid_set;
+
+/* UPC debug on/off */
+static int __upc_gum_debug = 0;
+
+/* UPC debug - UDA server shared pointer.
+ Shared pointer type definition must be used, otherwise compiler
+ removes type definition. */
+static upc_dbg_shared_ptr_t dbg_shared_ptr __attribute__ ((__unused__));
+
+#define IS_MULT_CHAR(c) ((c) == 'k' || (c) == 'K' \
+ || (c) == 'm' || (c) == 'M' \
+ || (c) == 'g' || (c) == 'G')
+#define MULT_FACTOR(c) (((c) == 'k' || (c) == 'K') ? 1024 \
+ : ((c) == 'm' || (c) == 'M') ? 1024*1024 \
+ : ((c) == 'g' || (c) == 'G') ? 1024*1024*1024 : 1)
+
+/* switches that require extra argument (values) */
+#define SWITCH_TAKES_ARG(STR) \
+ (!strcmp (STR, "-n") || !strcmp(STR, "-heap") \
+ || !strcmp (STR, "-sched-policy") \
+ || !strcmp (STR, "-mem-policy") \
+ || !strcmp (STR, "-sched-cpu-avoid"))
+
+static int
+__upc_get_int_value (const char *str, long int *val,
+ int accept_multiplier, long int low, long int high)
+{
+ const char *s = str;
+ int factor = 1;
+ long int v;
+ *val = 0;
+ while (*s && isdigit ((int) *s))
+ ++s;
+ if (*s)
+ {
+ if (accept_multiplier && IS_MULT_CHAR (s[0])
+ && (!s[1] || (s[1] == 'b' || s[1] == 'B')))
+ factor = MULT_FACTOR (s[0]);
+ else
+ return 0;
+ }
+ v = atol (str) * factor;
+ if (v < low || v > high)
+ return 0;
+ *val = v;
+ return 1;
+}
+
+/* Get list of CPUs to exclude from scheduling on (n1,n2,...) */
+static int
+__upc_get_cpu_avoid_values (const char *str, const upc_cpu_avoid_p avoid)
+{
+ const char *s = str;
+ char digits[10];
+ char *const last_digit = &digits[sizeof (digits) - 2];
+ const long int max_cpus = (__upc_num_cpus - 1);
+ while (*s)
+ {
+ char *d = digits;
+ long int v;
+ int status;
+ /* A number has to begin with a valid digit. */
+ if (!isdigit ((int) *s))
+ return 0;
+ while (*s && isdigit ((int) *s) && d <= last_digit)
+ *d++ = *s++;
+ /* Too many digits. */
+ if (*s && isdigit ((int) *s))
+ return 0;
+ *d = '\0';
+ status = __upc_get_int_value (digits, &v, 0, 0, max_cpus);
+ if (!status)
+ return 0;
+ __upc_affinity_cpu_avoid_set (v, avoid);
+ if (*s == ',')
+ {
+ ++s;
+ /* Something has to follow the comma. */
+ if (!*s)
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static void
+__upc_print_help_and_exit (char *pgm)
+{
+ fprintf (stderr, "usage: %s [UPC switches] ...\n", pgm);
+ fprintf (stderr, "where the possible UPC switches are:\n");
+ fprintf (stderr,
+ " -fupc-threads=N or -n N N is number of threads to run\n");
+ fprintf (stderr,
+ " (N must be in the range 1..%d)\n",
+ GUPCR_THREADS_MAX);
+ fprintf (stderr,
+ " -fupc-heap=N or -heap N N is the maximum per-thread memory\n");
+ fprintf (stderr,
+ " allocation heap size\n");
+ fprintf (stderr,
+ " The value of N may be followed\n");
+ fprintf (stderr,
+ " by a scale factor of K, M, or G\n");
+ fprintf (stderr,
+ " (N must be in the range 1..%ld)\n",
+ GUPCR_MAX_HEAP_SIZE);
+ fprintf (stderr,
+ " -sched-policy [cpu,strict,node,auto] UPC scheduling policy\n");
+ fprintf (stderr,
+ " cpu - bind to CPU\n");
+ fprintf (stderr,
+ " strict - bind to CPU (one thread per CPU)\n");
+ fprintf (stderr,
+ " node - bind to node (if NUMA available)\n");
+ fprintf (stderr,
+ " auto - let kernel schedule\n");
+ fprintf (stderr,
+ " -sched-cpu-avoid n1,n2,.. List of CPUs to avoid scheduling on\n");
+ fprintf (stderr,
+ " 0 to max CPUs\n");
+ fprintf (stderr,
+ " -mem-policy [node,strict,auto] UPC memory allocation policy\n");
+ fprintf (stderr,
+ " node - allocate on local node first\n");
+ fprintf (stderr,
+ " strict - only allocate on local node\n");
+ fprintf (stderr,
+ " -g Turn on UPC source code debugging\n");
+
+ exit (2);
+}
+
+static void
+__upc_shift_args (int *argc, char *argv[])
+{
+ if (*argc > 1)
+ {
+ int i;
+ --*argc;
+ for (i = 1; i < *argc; ++i)
+ argv[i] = argv[i + 1];
+ }
+}
+
+static void
+__upc_process_switches (char *pgm, int *argc, char *argv[])
+{
+ long int threads_switch_value = 0;
+#ifdef GUPCR_USE_PTHREADS
+ long int pthreads_switch_value = 0;
+#endif /* GUPCR_USE_PTHREADS */
+ long int heap_switch_value = 0;
+ const char *gum_debug_env = getenv (GUM_DEBUG_ENV);
+ /* Check if GUM debugging is enabled by environment variable. */
+ if (gum_debug_env && atoi(gum_debug_env))
+ {
+ __upc_gum_debug = 1;
+ }
+ while (*argc >= 2)
+ {
+ const char *arg = argv[1];
+ const char *tval;
+ if (!strcmp (arg, "--"))
+ {
+ /* -- terminates any upc switches */
+ __upc_shift_args (argc, argv);
+ break; /* exit loop */
+ }
+ if (SWITCH_TAKES_ARG (arg) && (*argc < 3))
+ {
+ fprintf (stderr, "%s argument requires a value\n", arg);
+ __upc_print_help_and_exit (pgm);
+ }
+ if (!strncmp (arg, "-fupc-threads=", 14)
+ || !strncmp (arg, "-fupc-threads-", 14))
+ {
+ tval = arg + 14;
+ if (!__upc_get_int_value (tval, &threads_switch_value, 0,
+ 1L, (long int) GUPCR_THREADS_MAX))
+ {
+ fprintf (stderr, "Invalid THREADS value\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ }
+ else if (!strcmp (arg, "-n"))
+ {
+ tval = argv[2];
+ if (!__upc_get_int_value (tval, &threads_switch_value, 0,
+ 1L, (long int) GUPCR_THREADS_MAX))
+ {
+ fprintf (stderr, "Invalid THREADS value\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ __upc_shift_args (argc, argv);
+ }
+ else if (!strncmp (arg, "-n", 2))
+ {
+ tval = arg + 2;
+ if (!__upc_get_int_value (tval, &threads_switch_value, 0,
+ 1L, (long int) GUPCR_THREADS_MAX))
+ {
+ fprintf (stderr, "Invalid THREADS value\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ }
+#ifdef GUPCR_USE_PTHREADS
+ else if (!strncmp (arg, "-fupc-pthreads-", 15))
+ {
+ tval = arg + 15;
+ if (!__upc_get_int_value (tval, &pthreads_switch_value, 0,
+ 1L, (long int) GUPCR_THREADS_MAX))
+ {
+ fprintf (stderr, "Invalid UPC pthreads value\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ }
+#endif /* GUPCR_USE_PTHREADS */
+ else if (!strncmp (arg, "-fupc-heap=", 11)
+ || !strncmp (arg, "-fupc-heap-", 11))
+ {
+ tval = arg + 11;
+ if (!__upc_get_int_value (tval, &heap_switch_value, 1,
+ 1L, GUPCR_MAX_HEAP_SIZE))
+ {
+ fprintf (stderr, "Invalid heap size value\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ }
+ else if (!strcmp (arg, "-heap"))
+ {
+ tval = argv[2];
+ if (!__upc_get_int_value (tval, &heap_switch_value, 1,
+ 1L, GUPCR_MAX_HEAP_SIZE))
+ {
+ fprintf (stderr, "Invalid heap size value\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ __upc_shift_args (argc, argv);
+ }
+ else if (!strncmp (arg, "-heap", 5))
+ {
+ tval = arg + 5;
+ if (!__upc_get_int_value (tval, &heap_switch_value, 1,
+ 1L, GUPCR_MAX_HEAP_SIZE))
+ {
+ fprintf (stderr, "Invalid heap size value\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ __upc_shift_args (argc, argv);
+ }
+ else if (!strcmp (arg, "-sched-policy"))
+ {
+ if (!__upc_affinity_supported ())
+ {
+ fprintf (stderr,
+ "Scheduling affinity not supported or configured\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ tval = argv[2];
+ if (!strcmp (tval, "node"))
+ {
+ if (!__upc_numa_supported ())
+ {
+ fprintf (stderr,
+ "NUMA node affinity not supported or configured\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ __upc_sched_policy = GUPCR_SCHED_POLICY_NODE;
+ }
+ else if (!strcmp (tval, "strict"))
+ {
+ __upc_sched_policy = GUPCR_SCHED_POLICY_CPU_STRICT;
+ }
+ else if (!strcmp (tval, "cpu"))
+ {
+ __upc_sched_policy = GUPCR_SCHED_POLICY_CPU;
+ }
+ else if (!strcmp (tval, "auto"))
+ {
+ __upc_sched_policy = GUPCR_SCHED_POLICY_AUTO;
+ }
+ else
+ {
+ fprintf (stderr, "Invalid scheduling policy specified\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ __upc_shift_args (argc, argv);
+ }
+ else if (!strcmp (arg, "-mem-policy"))
+ {
+ if (!__upc_numa_supported ())
+ {
+ fprintf (stderr,
+ "NUMA node affinity not supported or configured\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ tval = argv[2];
+ if (!strcmp (tval, "node"))
+ {
+ __upc_mem_policy = GUPCR_MEM_POLICY_NODE;
+ }
+ else if (!strcmp (tval, "strict"))
+ {
+ __upc_mem_policy = GUPCR_MEM_POLICY_STRICT;
+ }
+ else if (!strcmp (tval, "auto"))
+ {
+ __upc_mem_policy = GUPCR_MEM_POLICY_AUTO;
+ }
+ else
+ {
+ fprintf (stderr,
+ "Invalid memory allocation policy specified\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ __upc_shift_args (argc, argv);
+ }
+ else if (!strcmp (arg, "-sched-cpu-avoid"))
+ {
+ if (!__upc_affinity_supported ())
+ {
+ fprintf (stderr,
+ "Scheduling affinity not supported or configured\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ tval = argv[2];
+ if (!__upc_get_cpu_avoid_values (tval, __upc_cpu_avoid_set))
+ {
+ fprintf (stderr, "Invalid CPU to avoid string\n");
+ __upc_print_help_and_exit (pgm);
+ }
+ __upc_shift_args (argc, argv);
+ }
+ else if (!strcmp (arg, "-g"))
+ {
+ __upc_gum_debug = 1;
+ }
+ else
+ /* exit loop at first unrecognized switch. */
+ break;
+ __upc_shift_args (argc, argv);
+ }
+ if (heap_switch_value)
+ {
+ __upc_init_heap_size = heap_switch_value;
+ }
+ if (threads_switch_value)
+ {
+ if (THREADS > 0)
+ {
+ if (threads_switch_value != THREADS)
+ {
+ fprintf (stderr, "%s: UPC error: The value of the"
+ " -fupc-threads=N switch: %ld,"
+ " does not agree with the value given at"
+ " compile-time: %d\n",
+ pgm, threads_switch_value, THREADS);
+ exit (2);
+ }
+ }
+ else
+ {
+ THREADS = threads_switch_value;
+#ifdef GUPCR_USE_PTHREADS
+ if (UPC_PTHREADS == -1)
+ {
+ /* UPC threads per process specified as 'dynamic'.
+ Set it GUPCR_THREADS to specified value of THREADS. */
+ UPC_PTHREADS = THREADS;
+ }
+#endif /* GUPCR_USE_PTHREADS */
+ }
+ }
+ if (THREADS <= 0)
+ {
+ fprintf (stderr, "%s: UPC error: No value given for THREADS\n", pgm);
+ __upc_print_help_and_exit (pgm);
+ }
+#ifdef GUPCR_USE_PTHREADS
+ if (pthreads_switch_value)
+ {
+ if (pthreads_switch_value != THREADS)
+ {
+ fprintf (stderr,
+ "%s: UPC error: pthreads value must equal the number of UPC threads\n",
+ pgm);
+ __upc_print_help_and_exit (pgm);
+ }
+ else
+ {
+ UPC_PTHREADS = pthreads_switch_value;
+ }
+ }
+#endif /* GUPCR_USE_PTHREADS */
+#if !GUPCR_HAVE_GUM_DEBUG
+ if (__upc_gum_debug)
+ {
+ fprintf (stderr, "UPC debugging not supported or configured\n");
+ __upc_print_help_and_exit (pgm);
+ }
+#endif
+}
+
+static upc_info_p
+__upc_init (char *pgm, const char **err_msg)
+{
+ upc_info_p u;
+ os_heap_p runtime_heap;
+ size_t alloc_data_size, local_size, max_init_alloc, heap_size;
+ size_t mmap_fn_len;
+ char mmap_file_name[2046];
+ upc_page_num_t init_page_alloc;
+ const size_t gpt_size = (GUPCR_VM_MAX_PAGES_PER_THREAD * THREADS)
+ * sizeof (upc_pte_t);
+
+ /* On SGI/Irix, create the shared arena, used for inter-process
+ synchronization, otherwise probably a no-op. */
+ max_init_alloc =
+ GUPCR_ROUND (sizeof (upc_info_t) + gpt_size + sizeof (mmap_file_name),
+ 0x4000);
+ runtime_heap = __upc_create_runtime_heap (max_init_alloc, err_msg);
+ if (!runtime_heap)
+ return 0;
+
+ /* allocate the UPC info structure */
+ u = __upc_runtime_alloc (sizeof (upc_info_t), &runtime_heap, err_msg);
+ if (!u)
+ return 0;
+ memset (u, '\0', sizeof (upc_info_t));
+
+ u->runtime_heap = runtime_heap;
+ u->program_name = pgm;
+ u->monitor_pid = getpid ();
+ u->num_cpus = __upc_num_cpus;
+ /* Defaults to 1, will be overridden if NUMA supported. */
+ u->num_nodes = 1;
+ u->sched_policy = __upc_sched_policy;
+ u->mem_policy = __upc_mem_policy;
+
+ /* MPIR_partial_attach_ok support. */
+ if (MPIR_being_debugged)
+ u->partial_attach_start = 0; /* Stop the threads until MPIR_Breakpoint. */
+ else
+ u->partial_attach_start = 1; /* No debugging, threads can proceed. */
+ /* Find host name for MPIR interface. */
+ if (!gethostname (host_name, HOST_NAME_LEN))
+ u->host_name = host_name;
+ else
+ perror ("unable to find hostname");
+
+ /* Calculate per-thread contribution to global shared memory region. */
+ alloc_data_size = GUPCR_SHARED_SECTION_END - GUPCR_SHARED_SECTION_START;
+ alloc_data_size = GUPCR_ROUND (alloc_data_size, C64K);
+ heap_size = GUPCR_ROUND (__upc_init_heap_size, C64K);
+ local_size = alloc_data_size + heap_size;
+ /* Round up to a page boundary */
+ local_size = GUPCR_ROUND (local_size, GUPCR_VM_PAGE_SIZE);
+ init_page_alloc = local_size / GUPCR_VM_PAGE_SIZE;
+ /* Everything that isn't initially allocated to data will
+ be used for the heap. */
+ heap_size = local_size - alloc_data_size;
+ u->init_page_alloc = init_page_alloc;
+ u->init_heap_size = heap_size;
+ GUPCR_PTS_SET_NULL_SHARED (u->init_heap_base);
+ GUPCR_PTS_SET_VADDR (u->init_heap_base, alloc_data_size);
+ u->smem_fd = __upc_create_global_mem_file (mmap_file_name, err_msg);
+ if (u->smem_fd < 0)
+ return 0;
+ mmap_fn_len = strlen (mmap_file_name);
+ u->mmap_file_name = (char *) __upc_runtime_alloc (mmap_fn_len + 1,
+ &runtime_heap, err_msg);
+ if (!u->mmap_file_name)
+ return 0;
+ strcpy (u->mmap_file_name, mmap_file_name);
+ /* Allocate the GPT. Avoid initializing it, because it may
+ be a rather large data structure of which only a few initial
+ locations are used. The VM routines that manipulate the
+ GPT will initialize all needed entries as they are used. */
+ u->gpt = (upc_pte_p) __upc_runtime_alloc (gpt_size, &runtime_heap, err_msg);
+ if (!u->gpt)
+ return 0;
+ return u;
+}
+
+/* Per thread initialization. The VM system has to be initialized
+ in each thread, because it maintains a record of locally
+ mapped memory regions. Further, for thread 0, the initial
+ data values need to be copied over, and the heap manager
+ must be initialized. The barrier that is executed subsequent
+ to calling this per thread initialization procedure and prior to
+ calling the main program ensures that the initialization
+ completes before the main program runs. */
+
+static void
+__upc_per_thread_init (upc_info_p u)
+{
+ typedef void (*func_ptr_t) (void);
+ extern func_ptr_t GUPCR_INIT_ARRAY_START[];
+ extern func_ptr_t GUPCR_INIT_ARRAY_END[];
+ const int n_init = (int)(GUPCR_INIT_ARRAY_END - GUPCR_INIT_ARRAY_START);
+ int i;
+ __upc_vm_init_per_thread ();
+ __upc_lock_init ();
+ __upc_heap_init (u->init_heap_base, u->init_heap_size);
+ __upc_barrier_init ();
+ for (i = 0; i < n_init; ++i)
+ {
+ func_ptr_t init_func = GUPCR_INIT_ARRAY_START[i];
+ /* Skip zero words introduced by section marker, or by the linker. */
+ if (init_func)
+ (*init_func) ();
+ }
+}
+
+#ifndef GUPCR_USE_PTHREADS
+
+static void
+__upc_run_this_thread (upc_info_p u, int argc, char *argv[],
+ unsigned int thread_id)
+{
+ int status;
+ MYTHREAD = thread_id;
+ /* Perform per thread initialization. */
+ __upc_per_thread_init (u);
+ if (THREADS == 1)
+ {
+ /* A single thread is handled as a special case.
+ No child process is created to run the thread. */
+ MPIR_being_debugged = 0;
+ /* Give the debugger a chance to pick up runtime info. */
+ MPIR_Breakpoint ();
+ /* It is safe to unlink the temporary file, after the breakpoint
+ is hit. This gives the debugger a chance to open the mmap
+ global memory file so that it can access UPC shared memory. */
+ if (unlink (u->mmap_file_name) < 0)
+ {
+ perror ("cannot unlink global shared memory file");
+ abort ();
+ }
+ }
+ else if (MPIR_being_debugged)
+ {
+ /* Wait for partial attach flag. */
+ while (!u->partial_attach_start)
+ __upc_yield_cpu ();
+
+ /* Wait for the debugger to acquire us. */
+ while (!MPIR_debug_gate)
+ __upc_yield_cpu ();
+ }
+#if GUPCR_HAVE_GUM_DEBUG
+ if (__upc_gum_debug)
+ {
+ __upc_gum_init (THREADS, thread_id);
+ }
+#endif
+ __upc_barrier (GUPCR_RUNTIME_BARRIER_ID);
+ __upc_pupc_init (&argc, &argv);
+ status = GUPCR_MAIN (argc, argv);
+ p_startx (GASP_UPC_COLLECTIVE_EXIT, status);
+ p_endx (GASP_UPC_COLLECTIVE_EXIT, status);
+ __upc_exit (status);
+}
+
+/* Implement UPC threads as processes. */
+static void
+__upc_run_threads (upc_info_p u, int argc, char *argv[])
+{
+ int thread_id;
+ int flag;
+
+ /* Set O_APPEND on stdout and stderr (see Berkeley UPC bug 2136). */
+ flag = fcntl (STDOUT_FILENO, F_GETFL, 0);
+ if (flag >= 0)
+ (void) fcntl (STDOUT_FILENO, F_SETFL, flag | O_APPEND);
+ flag = fcntl (STDERR_FILENO, F_GETFL, 0);
+ if (flag >= 0)
+ (void) fcntl (STDERR_FILENO, F_SETFL, flag | O_APPEND);
+
+ if (THREADS == 1)
+ {
+ __upc_affinity_set (u, 0);
+ __upc_run_this_thread (u, argc, argv, 0);
+ /* Shouldn't get here. */
+ abort ();
+ }
+
+ /* In case a debugger is using the value;
+ we don't want it to see two thread zeros */
+ MYTHREAD = -1;
+ /* Allocate space to tell the debugger about
+ the process we're creating */
+ MPIR_proctable = malloc (THREADS * sizeof (*MPIR_proctable));
+ /* Tell the debugger this process is a starter process. */
+ MPIR_i_am_starter ();
+ for (thread_id = 0; thread_id < THREADS; ++thread_id)
+ {
+ pid_t pid = fork ();
+ if (pid == 0)
+ {
+ /* child */
+ __upc_affinity_set (u, thread_id);
+ __upc_run_this_thread (u, argc, argv, thread_id);
+ }
+ else if (pid > 0)
+ {
+ /* parent */
+ u->thread_info[thread_id].pid = pid;
+ if (MPIR_being_debugged)
+ {
+ MPIR_proctable[thread_id].host_name = u->host_name;
+ MPIR_proctable[thread_id].executable_name = u->program_name;
+ MPIR_proctable[thread_id].pid = pid;
+ }
+ }
+ else
+ {
+ /* error */
+ perror ("fork");
+ exit (2);
+ }
+ }
+ /* We're the main process, there are child processes and they're all started.
+ * Let the debugger know about that.
+ */
+ if (MPIR_being_debugged)
+ {
+ MPIR_proctable_size = THREADS;
+ MPIR_debug_state = MPIR_DEBUG_SPAWNED;
+ /* The debugger will have set a breakpoint there... */
+ MPIR_Breakpoint ();
+ /* Release threads. */
+ u->partial_attach_start = 1;
+ }
+ if (unlink (u->mmap_file_name) < 0)
+ {
+ perror ("cannot unlink global shared memory file");
+ abort ();
+ }
+}
+
+static int
+__upc_get_thread_id (pid_t pid)
+{
+ upc_info_p u = __upc_info;
+ int thread_id;
+ for (thread_id = THREADS - 1;
+ thread_id >= 0 && u->thread_info[thread_id].pid != pid;
+ --thread_id) /* loop */ ;
+ return thread_id;
+}
+
+/* Terminate program.
+ The monitor thread received a SIGTERM. Terminate
+ all processes in the current process group. */
+static void
+__upc_sigterm_handler (int sig)
+{
+ struct sigaction action;
+ /* Install the default SIGTERM so monitor thread
+ is killed as part of the group. */
+ action.sa_handler = SIG_DFL;
+ sigemptyset (&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction (sig, &action, NULL);
+ /* Kill the whole group. */
+ if (killpg (getpgrp (), sig) == -1)
+ {
+ perror ("killpg");
+ abort ();
+ }
+}
+
+static int
+__upc_monitor_threads (void)
+{
+ upc_info_p u = __upc_info;
+ pid_t pid;
+ int wait_status;
+ int exit_status;
+ int thread_id;
+ int global_exit_invoked;
+ struct sigaction action;
+ exit_status = -1;
+ global_exit_invoked = 0;
+ /* Install SIGTERM handler responsible for
+ terminating the whole program. */
+ action.sa_handler = __upc_sigterm_handler;
+ sigemptyset (&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction (SIGTERM, &action, NULL);
+ /* Wait for threads to finish. */
+ for (;;)
+ {
+ pid = waitpid (-1, &wait_status, WNOHANG);
+ /* Check for errors. */
+ if (pid == -1)
+ {
+ /* Continue checking if interrupted
+ (handling other signals). */
+ if (errno == EINTR)
+ continue;
+ /* Stop waiting if no more children. */
+ if (errno == ECHILD)
+ break;
+ /* Abort if invalid argument. */
+ if (errno == EINVAL)
+ {
+ perror ("waitpid");
+ abort ();
+ }
+ }
+ /* Not a child exit? */
+ if (pid == 0)
+ {
+ /* Check for debugger attach. */
+ MPIR_Breakpoint ();
+ /* Release the CPU for 100mS and continue checking. */
+ usleep (100000);
+ continue;
+ }
+ /* Check for child process that exited. */
+ thread_id = __upc_get_thread_id (pid);
+ if (!global_exit_invoked && WIFEXITED (wait_status))
+ {
+ int child_exit = WEXITSTATUS (wait_status);
+ if (child_exit & 0x80)
+ {
+ /* By convention, the result of a call to upc_global_exit
+ has the high bit in the byte set.
+ Terminate all the other threads in the program. */
+ int t;
+ for (t = 0; t < THREADS; ++t)
+ {
+ int pid = u->thread_info[t].pid;
+ if (pid <= 0)
+ abort ();
+ if (t != thread_id)
+ (void) kill (pid, SIGKILL);
+ }
+ child_exit &= 0x7f;
+ global_exit_invoked = 1;
+ }
+ else if ((exit_status != -1) && exit_status != child_exit)
+ {
+ fprintf (stderr, "conflicting exit status (%d) for"
+ " thread %d\n", child_exit, thread_id);
+ }
+ exit_status = child_exit;
+ }
+ else if (WIFSIGNALED (wait_status))
+ {
+ int child_sig = WTERMSIG (wait_status);
+ /* Ignore SIGKILL signals.
+ We use them to implement upc_global_exit(). */
+ if (child_sig == SIGKILL && global_exit_invoked)
+ continue;
+ fprintf (stderr, "thread %d terminated with signal: '%s'\n",
+ thread_id, __upc_strsignal (child_sig));
+ /* GASP note: We can't record a noncollective GASP
+ exit event here, because the process has already died. */
+ /* We'll all go away now. */
+ if (killpg (getpid (), SIGTERM) == -1)
+ {
+ perror ("killpg");
+ exit (-1);
+ }
+ }
+ }
+ return exit_status;
+}
+
+/* Calls to exit() are rewritten into calls to __upc_exit()
+ by #define in <gcc-upc.h>. Simply perform a upc_barrier and
+ then exit the process. Monitor_threads() will pick up
+ the returned status code. */
+void
+__upc_exit (int status)
+{
+ upc_info_p u = __upc_info;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ __upc_acquire_lock (&u->lock);
+ fflush (0);
+ fsync (1);
+ fsync (2);
+ __upc_release_lock (&u->lock);
+ __upc_barrier (GUPCR_RUNTIME_BARRIER_ID);
+ exit (status);
+}
+
+/* upc_global_exit - exit program with given status, terminate
+ all other threads.
+
+ The implementation imposes a restriction on exit return codes.
+ If the return code has bit 7 (0x80) set, then the exit code will
+ be interpreted as the code passed to upc_global_exit() and the
+ monitor program will cancel all other executing threads. */
+void
+upc_global_exit (int status)
+{
+ upc_info_p u = __upc_info;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ exit ((THREADS > 1) ? ((status & 0x7f) | 0x80) : status);
+}
+
+#else /* !USE_UPC_PTHREADS */
+
+/* Implement UPC threads as POSIX threads. */
+
+/* UPC rand() pthreads implementation uses per thread seed */
+
+static GUPCR_THREAD_LOCAL unsigned int __upc_rand_seed;
+
+int
+__upc_rand (void)
+{
+ return rand_r (&__upc_rand_seed);
+}
+
+void
+__upc_srand (unsigned int _seed)
+{
+ __upc_rand_seed = _seed;
+}
+
+typedef struct upc_startup_args_struct
+{
+ int thread_id;
+ int argc;
+ char **argv;
+} upc_startup_args_t;
+typedef upc_startup_args_t *upc_startup_args_p;
+
+static void *
+__upc_start_pthread (void *arg)
+{
+ upc_startup_args_p startup_args = arg;
+ int thread_id = startup_args->thread_id;
+ upc_info_p u = __upc_info;
+ int *status_ptr;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ /* MYTHREAD is located in thread local storage */
+ MYTHREAD = thread_id;
+ __upc_affinity_set (u, thread_id);
+ /* Perform per thread initialization. */
+ __upc_per_thread_init (u);
+ /* Initialize random number generator seed.
+ Note: C99 requires an initial seed value of 1, per 7.20.2.2. */
+ __upc_srand (1);
+ status_ptr = &u->thread_info[thread_id].exit_status;
+ __upc_barrier (GUPCR_RUNTIME_BARRIER_ID);
+ __upc_pupc_init (&startup_args->argc, &startup_args->argv);
+ *status_ptr = GUPCR_MAIN (startup_args->argc, startup_args->argv);
+ p_startx (GASP_UPC_COLLECTIVE_EXIT, *status_ptr);
+ p_endx (GASP_UPC_COLLECTIVE_EXIT, *status_ptr);
+ return status_ptr;
+}
+
+static void
+__upc_run_threads (upc_info_p u, int argc, char *argv[])
+{
+ int thread_id;
+ pthread_attr_t thread_attr;
+ size_t stack_size;
+
+ if (THREADS != UPC_PTHREADS)
+ {
+ fprintf (stderr,
+ "GUPC pthreads implementation requires that PTHREADS be to THREADS.\n");
+ abort ();
+ }
+
+ if (pthread_attr_init(&thread_attr))
+ {
+ perror ("pthread_attr_init");
+ abort ();
+ }
+ if (pthread_attr_getstacksize(&thread_attr, &stack_size))
+ {
+ perror ("pthread_attr_getstacksize");
+ abort ();
+ }
+ /* Add the GUPC's default per-thread stack size to the
+ operating system default. The OS default will often
+ include enough space to account for TLS variables declared
+ using the __thread qualifier. */
+ stack_size += GUPCR_DEFAULT_PER_THREAD_STACK_SIZE;
+ if (pthread_attr_setstacksize(&thread_attr, stack_size))
+ {
+ perror ("pthread_attr_setstacksize");
+ abort ();
+ }
+
+ /* technically, we should probably make a thread-local
+ copy of the arg vector. For now, just pass the address. */
+
+ for (thread_id = 0; thread_id < THREADS; ++thread_id)
+ {
+ upc_startup_args_p startup_args;
+ int status;
+ pthread_t pthread_id;
+ startup_args =
+ (upc_startup_args_p) malloc (sizeof (upc_startup_args_t));
+ if (!startup_args)
+ {
+ perror ("malloc");
+ abort ();
+ }
+ startup_args->argc = argc;
+ startup_args->argv = argv;
+ startup_args->thread_id = thread_id;
+ status = pthread_create (&pthread_id, &thread_attr,
+ __upc_start_pthread, startup_args);
+ if (status)
+ {
+ perror ("pthread_create");
+ abort ();
+ }
+ u->thread_info[thread_id].os_thread = pthread_id;
+ }
+ if (unlink (u->mmap_file_name) < 0)
+ {
+ perror ("cannot unlink global shared memory file");
+ abort ();
+ }
+}
+
+/* Wait for all pthreads to exit. This implementation requires
+ that there is one pthread per UPC thread. */
+static int
+__upc_monitor_threads (void)
+{
+ int exit_status = -1;
+ upc_info_p u = __upc_info;
+ int t;
+ for (t = 0; t < THREADS; ++t)
+ {
+ pthread_t os_thread = u->thread_info[t].os_thread;
+ void *exit_p;
+ int child_exit = 0;
+ int status;
+ status = pthread_join (os_thread, &exit_p);
+ if (status)
+ {
+ perror ("pthread_join");
+ abort ();
+ }
+ child_exit = *((int *) exit_p);
+ if ((exit_status != -1) && exit_status != child_exit)
+ {
+ fprintf (stderr, "conflicting exit status (%d) for"
+ " thread %d\n", child_exit, t);
+ }
+ exit_status = child_exit;
+ }
+ return exit_status;
+}
+
+void
+__upc_exit (int status)
+{
+ upc_info_p u = __upc_info;
+ int *status_ptr;
+ int thread_id = MYTHREAD;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ __upc_barrier (GUPCR_RUNTIME_BARRIER_ID);
+ status_ptr = &u->thread_info[thread_id].exit_status;
+ *status_ptr = status;
+ pthread_exit (status_ptr);
+}
+
+/* upc_global_exit - exit program with given status, terminate
+ all other threads.
+
+ In the pthreads implementation inside a single process,
+ upc_global_exit equates to exit(). */
+void
+upc_global_exit (int status)
+{
+ exit (status);
+}
+
+#endif /* !GUPCR_USE_PTHREADS */
+
+static void
+__upc_notify_debugger_of_abort (const char *mesg)
+{
+ MPIR_debug_abort_string = mesg;
+ MPIR_debug_state = MPIR_DEBUG_ABORTING;
+ MPIR_Breakpoint ();
+}
+
+/* Issue a fatal UPC runtime error.
+
+ Note: this is called by a UPC thread (process) when a fatal runtime
+ error is detected. */
+void
+__upc_fatal (const char *fmt, ...)
+{
+ upc_info_p u = __upc_info;
+ char msg[4096];
+ char *bp = msg;
+ va_list args, ap;
+ if (u)
+ __upc_acquire_lock (&u->lock);
+ bp += sprintf (bp, "%s: ", __upc_pgm_name);
+ if (__upc_err_filename && __upc_err_linenum)
+ bp += sprintf (bp, "at %s:%u ", __upc_err_filename, __upc_err_linenum);
+ bp += sprintf (bp, "UPC error: ");
+ va_start (ap, fmt);
+ va_copy (args, ap);
+ bp += vsprintf (bp, fmt, args);
+ va_end (args);
+ *bp++ = '\n';
+ fflush (0);
+ (void) fputs (msg, stderr);
+ fflush (0);
+ __upc_notify_debugger_of_abort (msg);
+#if HAVE_UPC_BACKTRACE
+ __upc_backtrace_restore_handlers ();
+ __upc_fatal_backtrace ();
+#endif
+ abort ();
+}
+
+/* UPC runtime start up. */
+int
+GUPCR_START (int argc, char *argv[])
+{
+ const char *err_msg = 0;
+ int status;
+ upc_info_p u;
+ __upc_sys_init ();
+ __upc_pgm_name = argv[0];
+ __upc_validate_pgm_info (__upc_pgm_name);
+ __upc_cpu_avoid_set = __upc_affinity_cpu_avoid_new ();
+ __upc_process_switches (__upc_pgm_name, &argc, argv);
+ u = __upc_init (__upc_pgm_name, &err_msg);
+ if (!u)
+ {
+ fprintf (stderr, "%s: UPC initialization failed.\n"
+ "%s: reason: %s\n", __upc_pgm_name, __upc_pgm_name, err_msg);
+ __upc_notify_debugger_of_abort (err_msg);
+ abort ();
+ }
+ __upc_info = u;
+
+#if HAVE_UPC_BACKTRACE
+ /* Initialize backtrace support. */
+ __upc_backtrace_init (__upc_pgm_name);
+#endif
+ /* Initialize UPC runtime spin lock. We do this after
+ __upc_info has been allocated and initialized, because __upc_init_lock
+ refers to __upc_info on some platforms (eg, SGI/Irix). */
+ __upc_init_lock (&u->lock);
+ /* Initialize the VM system */
+ __upc_vm_init (u->init_page_alloc);
+ /* Initialize thread affinity */
+ if (!__upc_affinity_init (u, __upc_cpu_avoid_set, &err_msg))
+ {
+ fprintf (stderr, "%s: UPC initialization failed.\n"
+ "%s: reason: %s\n", __upc_pgm_name, __upc_pgm_name, err_msg);
+ __upc_notify_debugger_of_abort (err_msg);
+ abort ();
+ }
+ __upc_affinity_cpu_avoid_free (__upc_cpu_avoid_set);
+ /* Ensure that the upc_forall depth count is initialized to 0. */
+ __upc_forall_depth = 0;
+ /* Run the program */
+ __upc_run_threads (u, argc, argv);
+ status = __upc_monitor_threads ();
+ exit (status);
+}
diff --git a/libgupc/smp/upc_mem.c b/libgupc/smp/upc_mem.c
new file mode 100644
index 00000000000..7ac1ceb82cb
--- /dev/null
+++ b/libgupc/smp/upc_mem.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_sup.h"
+#include "upc_access.h"
+#include "upc_mem.h"
+
+void
+upc_memcpy (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t n)
+{
+ __upc_memcpy (dest, src, n);
+}
+
+void
+upc_memget (void *dest, upc_shared_ptr_t src, size_t n)
+{
+ __upc_memget (dest, src, n);
+}
+
+void
+upc_memput (upc_shared_ptr_t dest, const void *src, size_t n)
+{
+ __upc_memput (dest, src, n);
+}
+
+void
+upc_memset (upc_shared_ptr_t dest, int c, size_t n)
+{
+ __upc_memset (dest, c, n);
+}
diff --git a/libgupc/smp/upc_mem.h b/libgupc/smp/upc_mem.h
new file mode 100644
index 00000000000..15273fab2fc
--- /dev/null
+++ b/libgupc/smp/upc_mem.h
@@ -0,0 +1,136 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_MEM_H_
+#define _UPC_MEM_H_
+
+/* The following memory-to-memory operations have been
+ factored into this file because they are needed both
+ by upc_access.c and upc_mem.c */
+
+//begin lib_inline_mem_sup
+
+__attribute__((__always_inline__))
+static inline
+void
+__upc_memcpy (upc_shared_ptr_t dest, upc_shared_ptr_t src, size_t n)
+{
+ if (GUPCR_PTS_IS_NULL (src))
+ __upc_fatal ("Invalid access via null shared pointer");
+ if (GUPCR_PTS_IS_NULL (dest))
+ __upc_fatal ("Invalid access via null shared pointer");
+ for (;;)
+ {
+ char *srcp = (char *)__upc_sptr_to_addr (src);
+ size_t s_offset = GUPCR_PTS_OFFSET(src);
+ size_t ps_offset = (s_offset & GUPCR_VM_OFFSET_MASK);
+ size_t ns_copy = GUPCR_VM_PAGE_SIZE - ps_offset;
+ char *destp = (char *)__upc_sptr_to_addr (dest);
+ size_t d_offset = GUPCR_PTS_OFFSET(dest);
+ size_t pd_offset = (d_offset & GUPCR_VM_OFFSET_MASK);
+ size_t nd_copy = GUPCR_VM_PAGE_SIZE - pd_offset;
+ size_t n_copy = GUPCR_MIN (GUPCR_MIN (ns_copy, nd_copy), n);
+ memcpy (destp, srcp, n_copy);
+ n -= n_copy;
+ if (!n)
+ break;
+ GUPCR_PTS_INCR_VADDR (src, n_copy);
+ GUPCR_PTS_INCR_VADDR (dest, n_copy);
+ }
+}
+
+__attribute__((__always_inline__))
+static inline
+void
+__upc_memget (void *dest, upc_shared_ptr_t src, size_t n)
+{
+ if (!dest)
+ __upc_fatal ("Invalid access via null shared pointer");
+ if (GUPCR_PTS_IS_NULL (src))
+ __upc_fatal ("Invalid access via null shared pointer");
+ for (;;)
+ {
+ char *srcp = (char *)__upc_sptr_to_addr (src);
+ size_t offset = GUPCR_PTS_OFFSET(src);
+ size_t p_offset = (offset & GUPCR_VM_OFFSET_MASK);
+ size_t n_copy = GUPCR_MIN (GUPCR_VM_PAGE_SIZE - p_offset, n);
+ memcpy (dest, srcp, n_copy);
+ n -= n_copy;
+ if (!n)
+ break;
+ GUPCR_PTS_INCR_VADDR (src, n_copy);
+ dest = (char *) dest + n_copy;
+ }
+}
+
+__attribute__((__always_inline__))
+static inline
+void
+__upc_memput (upc_shared_ptr_t dest, const void *src, size_t n)
+{
+ if (!src)
+ __upc_fatal ("Invalid access via null shared pointer");
+ if (GUPCR_PTS_IS_NULL (dest))
+ __upc_fatal ("Invalid access via null shared pointer");
+ for (;;)
+ {
+ char *destp = (char *)__upc_sptr_to_addr (dest);
+ size_t offset = GUPCR_PTS_OFFSET(dest);
+ size_t p_offset = (offset & GUPCR_VM_OFFSET_MASK);
+ size_t n_copy = GUPCR_MIN (GUPCR_VM_PAGE_SIZE - p_offset, n);
+ memcpy (destp, src, n_copy);
+ n -= n_copy;
+ if (!n)
+ break;
+ GUPCR_PTS_INCR_VADDR (dest, n_copy);
+ src = (char *) src + n_copy;
+ }
+}
+
+__attribute__((__always_inline__))
+static inline
+void
+__upc_memset (upc_shared_ptr_t dest, int c, size_t n)
+{
+ if (GUPCR_PTS_IS_NULL (dest))
+ __upc_fatal ("Invalid access via null shared pointer");
+ for (;;)
+ {
+ char *destp = (char *)__upc_sptr_to_addr (dest);
+ size_t offset = GUPCR_PTS_OFFSET(dest);
+ size_t p_offset = (offset & GUPCR_VM_OFFSET_MASK);
+ size_t n_set = GUPCR_MIN (GUPCR_VM_PAGE_SIZE - p_offset, n);
+ memset (destp, c, n_set);
+ n -= n_set;
+ if (!n)
+ break;
+ GUPCR_PTS_INCR_VADDR (dest, n_set);
+ }
+}
+//end lib_inline_mem_sup
+
+#endif /* _UPC_MEM_H_ */
diff --git a/libgupc/smp/upc_nb.upc b/libgupc/smp/upc_nb.upc
new file mode 100644
index 00000000000..4d029af0f90
--- /dev/null
+++ b/libgupc/smp/upc_nb.upc
@@ -0,0 +1,189 @@
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <upc_nb.h>
+
+/**
+ * Copy memory with non-blocking explicit handle transfer.
+ *
+ * @param[in] dst Destination shared memory pointer
+ * @param[in] src Source shared memory pointer
+ * @param[in] n Number of bytes to transfer
+ * @retval UPC non-blocking transfer handle
+ */
+upc_handle_t
+upc_memcpy_nb (shared void *restrict dst,
+ shared const void *restrict src, size_t n)
+{
+ upc_memcpy (dst, src, n);
+ return UPC_COMPLETE_HANDLE;
+}
+
+/**
+ * Get memory with non-blocking explicit handle transfer.
+ *
+ * @param[in] dst Destination local memory pointer
+ * @param[in] src Source remote memory pointer
+ * @param[in] n Number of bytes to transfer
+ * @retval UPC non-blocking transfer handle
+ */
+upc_handle_t
+upc_memget_nb (void *restrict dst,
+ shared const void *restrict src, size_t n)
+{
+ upc_memget (dst, src, n);
+ return UPC_COMPLETE_HANDLE;
+}
+
+/**
+ * Put memory with non-blocking explicit handle transfer.
+ *
+ * @param[in] dst Destination remote memory pointer
+ * @param[in] src Source local memory pointer
+ * @param[in] n Number of bytes to transfer
+ * @retval UPC non-blocking transfer handle
+ */
+upc_handle_t
+upc_memput_nb (shared void *restrict dst,
+ const void *restrict src, size_t n)
+{
+ upc_memput (dst, src, n);
+ return UPC_COMPLETE_HANDLE;
+}
+
+/**
+ * Set memory with non-blocking implicit handle transfer.
+ *
+ * @param[in] dst Shared remote pointer
+ * @param[in] c Value for set operation
+ * @param[in] n Number of bytes to set
+ * @retval UPC non-blocking transfer handle
+ */
+upc_handle_t
+upc_memset_nb (shared void *dst, int c, size_t n)
+{
+ upc_memset (dst, c, n);
+ return UPC_COMPLETE_HANDLE;
+}
+
+/**
+ * Explicit handle non-blocking transfer sync attempt.
+ *
+ * @param[in] handle Transfer explicit handle
+ * @retval UPC_NB_COMPLETED returned if transfer completed,
+ * otherwise UPC_NB_NOT_COMPLETED
+ */
+int
+upc_sync_attempt (upc_handle_t ARG_UNUSED(handle))
+{
+ return UPC_NB_COMPLETED;
+}
+
+/**
+ * Explicit handle non-blocking transfer sync.
+ *
+ * @param[in] handle Non-blocking transfer explicit handle
+ */
+void
+upc_sync (upc_handle_t ARG_UNUSED(handle))
+{
+}
+
+/**
+ * Copy memory with non-blocking implicit handle transfer.
+ *
+ * @param[in] dst Shared remote memory pointer
+ * @param[in] src Shared remote memory pointer
+ * @param[in] n Number of bytes to transfer
+ */
+void
+upc_memcpy_nbi (shared void *restrict dst,
+ shared const void *restrict src, size_t n)
+{
+ upc_memcpy (dst, src, n);
+}
+
+/**
+ * Get memory with non-blocking implicit handle transfer.
+ *
+ * @param[in] dst Local memory pointer
+ * @param[in] src Shared remote memory pointer
+ * @param[in] n Number of bytes to transfer
+ */
+void
+upc_memget_nbi (void *restrict dst,
+ shared const void *restrict src, size_t n)
+{
+ upc_memget (dst, src, n);
+}
+
+/**
+ * Put memory with non-blocking implicit handle transfer.
+ *
+ * @param[in] dst Shared remote memory pointer
+ * @param[in] src Local memory pointer
+ * @param[in] n Number of bytes to transfer
+ */
+void
+upc_memput_nbi (shared void *restrict dst,
+ const void *restrict src, size_t n)
+{
+ upc_memput (dst, src, n);
+}
+
+/**
+ * Set memory with non-blocking implicit handle transfer.
+ *
+ * @param[in] dst Shared remote pointer
+ * @param[in] c Value for set operation
+ * @param[in] n Number of bytes to set
+ */
+void
+upc_memset_nbi (shared void *dst, int c, size_t n)
+{
+ upc_memset (dst, c, n);
+}
+
+/**
+ * Check on implicit handle non-blocking transfers.
+ *
+ * @retval UPC_NB_COMPLETED if no transfers pending, otherwise
+ * UPC_NB_NOT_COMPLETED is returned
+ */
+int
+upc_synci_attempt (void)
+{
+ return UPC_NB_COMPLETED;
+}
+
+/**
+ * Complete implicit handle non-blocking transfers.
+ */
+void
+upc_synci (void)
+{
+}
diff --git a/libgupc/smp/upc_numa.c b/libgupc/smp/upc_numa.c
new file mode 100644
index 00000000000..e48358c5daa
--- /dev/null
+++ b/libgupc/smp/upc_numa.c
@@ -0,0 +1,125 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include <numa.h>
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_sup.h"
+#include "upc_affinity.h"
+
+int
+__upc_numa_supported (void)
+{
+ return 1;
+}
+
+int
+__upc_numa_init (const upc_info_p u, const char **ARG_UNUSED (err_msg))
+{
+ u->num_nodes = numa_max_node () + 1;
+ return 1;
+}
+
+int
+__upc_numa_allocate (const upc_info_p u, const int thread_id,
+ int *sched_affinity, int *mem_affinity,
+ const char **ARG_UNUSED (err_msg))
+{
+ int pelem;
+ /* schedule threads over nodes */
+ pelem = thread_id % u->num_nodes;
+ *sched_affinity = pelem;
+ *mem_affinity = pelem;
+ return 1;
+}
+
+/* Set node scheduling policy. */
+
+void
+__upc_numa_sched_set (const upc_info_p u, const int thread_id)
+{
+#if defined(LIBNUMA_API_VERSION) && (LIBNUMA_API_VERSION==2)
+ struct bitmask *set = numa_allocate_cpumask();
+ numa_node_to_cpus (u->thread_info[thread_id].sched_affinity, set);
+ if (numa_sched_setaffinity (0, set))
+ {
+ __upc_fatal ("Scheduling cannot be set");
+ }
+#else
+ cpu_set_t set;
+ CPU_ZERO (&set);
+ numa_node_to_cpus (u->thread_info[thread_id].sched_affinity,
+ (unsigned long *) &set, sizeof (set));
+ if (sched_setaffinity (0, sizeof (set), &set))
+ {
+ __upc_fatal ("Scheduling cannot be set");
+ }
+#endif
+}
+
+/* Set memory allocation policy */
+
+void
+__upc_numa_memory_affinity_set (const upc_info_p u, const int thread_id)
+{
+ if (u->mem_policy == GUPCR_MEM_POLICY_NODE)
+ {
+ numa_set_preferred (u->thread_info[thread_id].mem_affinity);
+ }
+ else if (u->mem_policy == GUPCR_MEM_POLICY_STRICT)
+ {
+#if defined(LIBNUMA_API_VERSION) && (LIBNUMA_API_VERSION==2)
+ struct bitmask *nodemask = numa_bitmask_alloc(u->num_nodes);
+ numa_bitmask_setbit (nodemask, u->thread_info[thread_id].mem_affinity);
+ numa_set_membind (nodemask);
+ numa_bitmask_free (nodemask);
+#else
+ nodemask_t nodemask;
+ nodemask_zero (&nodemask);
+ nodemask_set (&nodemask, u->thread_info[thread_id].mem_affinity);
+ numa_set_membind (&nodemask);
+#endif
+ }
+}
+
+/* Set affinity for memory region */
+
+void
+__upc_numa_memory_region_affinity_set (const upc_info_p u,
+ const int thread_id,
+ const void *region, const size_t size)
+{
+ if ((u->sched_policy != GUPCR_SCHED_POLICY_AUTO) &&
+ (u->mem_policy != GUPCR_MEM_POLICY_AUTO))
+ {
+ /* memory is being allocated with affinity to "thread" */
+ if (thread_id == MYTHREAD)
+ numa_tonode_memory ((void *) region, size,
+ u->thread_info[thread_id].mem_affinity);
+ }
+}
diff --git a/libgupc/smp/upc_numa.h b/libgupc/smp/upc_numa.h
new file mode 100644
index 00000000000..07b1b7c630b
--- /dev/null
+++ b/libgupc/smp/upc_numa.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_NUMA_H_
+#define _UPC_NUMA_H_
+
+extern int __upc_numa_supported (void);
+extern int __upc_numa_init (const upc_info_p,
+ const char **err_msg);
+extern int __upc_numa_allocate (const upc_info_p u, const int thread_id,
+ int *sched_affinity, int *mem_affinity,
+ const char **err_msg);
+extern void __upc_numa_sched_set (const upc_info_p, const int);
+extern void __upc_numa_memory_affinity_set (const upc_info_p, const int);
+extern void __upc_numa_memory_region_affinity_set (const upc_info_p u,
+ const int thread_id,
+ const void *region,
+ const size_t size);
+
+#endif /* !_UPC_NUMA_H */
diff --git a/libgupc/smp/upc_numa_stub.c b/libgupc/smp/upc_numa_stub.c
new file mode 100644
index 00000000000..2b791cf7d8f
--- /dev/null
+++ b/libgupc/smp/upc_numa_stub.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_numa.h"
+
+int
+__upc_numa_supported (void)
+{
+ return 0;
+}
+
+int
+__upc_numa_init (const upc_info_p ARG_UNUSED (u),
+ const char **ARG_UNUSED (err_msg))
+{
+ return 1;
+}
+
+int
+__upc_numa_allocate (const upc_info_p ARG_UNUSED (u),
+ const int ARG_UNUSED (thread_id),
+ int *ARG_UNUSED (sched_affinity),
+ int *ARG_UNUSED (mem_affinity),
+ const char **err_msg)
+{
+ *err_msg = "UPC error: unable to schedule over nodes - NUMA not available.";
+ return 0;
+}
+
+void
+__upc_numa_sched_set (const upc_info_p ARG_UNUSED (u),
+ const int ARG_UNUSED (thread_id))
+{
+}
+
+void
+__upc_numa_memory_affinity_set (const upc_info_p ARG_UNUSED (u),
+ const int ARG_UNUSED (thread_id))
+{
+}
+
+void
+__upc_numa_memory_region_affinity_set (const upc_info_p ARG_UNUSED (u),
+ const int ARG_UNUSED (thread_id),
+ const void *ARG_UNUSED (region),
+ const size_t ARG_UNUSED (size))
+{
+}
diff --git a/libgupc/smp/upc_pgm_info.c b/libgupc/smp/upc_pgm_info.c
new file mode 100644
index 00000000000..8df85819b10
--- /dev/null
+++ b/libgupc/smp/upc_pgm_info.c
@@ -0,0 +1,303 @@
+/* Copyright (C) 2004-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_sup.h"
+
+
+typedef enum
+ {
+ upc_threads_model_none = 0,
+ upc_threads_model_process = 1,
+ upc_threads_model_pthreads_tls = 2
+ } upc_threads_model_t;
+
+typedef struct upc_compiled_thread_info_struct
+ {
+ struct upc_compiled_thread_info_struct *next;
+ char *filename;
+ int nthreads;
+ int npthreads;
+ upc_threads_model_t threads_model;
+ } upc_compiled_thread_info_t;
+typedef upc_compiled_thread_info_t *upc_compiled_thread_info_p;
+
+/* List of compiled UPC files, and the value of THREADS (and pthreads
+ per process) specified at compile-time (-1 means no value given
+ at compile-time). */
+static upc_compiled_thread_info_p __upc_compiled_thread_info = 0;
+
+static
+void
+__upc_print_upc_compiled_thread_info (void)
+{
+ upc_compiled_thread_info_p p;
+ fprintf (stderr, " THREADS Threads Model PTHREADS Filename\n");
+ for (p = __upc_compiled_thread_info; p; p = p->next)
+ {
+ if (p->nthreads > 0)
+ {
+ fprintf (stderr, "%10d", p->nthreads);
+ }
+ else
+ {
+ fprintf (stderr, " <dynamic>");
+ }
+ if (p->threads_model == upc_threads_model_process)
+ {
+ fprintf (stderr, " process");
+ }
+ else if (p->threads_model == upc_threads_model_pthreads_tls)
+ {
+ fprintf (stderr, " pthreads-tls");
+ }
+ if (p->npthreads > 0)
+ {
+ fprintf (stderr, "%10d", p->npthreads);
+ }
+ else
+ {
+ fprintf (stderr, " <dynamic>");
+ }
+ fprintf (stderr, " %s\n", p->filename);
+ }
+}
+
+static
+void
+__upc_register_pgm_info (char *filename, int nthreads,
+ upc_threads_model_t threads_model, int npthreads)
+{
+ upc_compiled_thread_info_p info =
+ malloc (sizeof (upc_compiled_thread_info_t));
+ upc_compiled_thread_info_p *p;
+ /* Sort the list by file name. */
+ for (p = &__upc_compiled_thread_info;
+ *p && strcmp (filename, (*p)->filename) >= 0;
+ p = &(*p)->next) /* loop */;
+ info->filename = filename;
+ info->nthreads = nthreads;
+ info->threads_model = threads_model;
+ info->npthreads = npthreads;
+ info->next = *p;
+ *p = info;
+}
+
+static
+void
+__upc_skip_spaces (const char **s)
+{
+ while (**s == ' ') ++(*s);
+}
+
+static
+int
+__upc_match_string (const char **s, const char *string)
+{
+ int slen = strlen(string);
+ if (strncmp(*s, string, slen) != 0)
+ return 0;
+ *s += slen;
+ return 1;
+}
+
+static
+int
+__upc_match_until (const char **s, const char *string)
+{
+ int slen = strlen (string);
+ while (**s && (strncmp(*s, string, slen) != 0)) ++(*s);
+ if (!**s)
+ return 0;
+ *s += slen;
+ return 1;
+}
+
+static
+int
+__upc_match_num (const char **s, int *num)
+{
+ *num = 0;
+ while (**s >= '0' && **s <= '9')
+ {
+ *num = *num * 10 + (**s - '0');
+ ++(*s);
+ }
+ if (*num == 0)
+ return 0;
+ return 1;
+}
+
+/* Examples:
+ $GCCUPCConfig: (t.upc) dynamicthreads process$
+ $GCCUPCConfig: (t.upc) staticcthreads=4 pthreads-tls staticpthreads=4$ */
+static
+void
+__upc_parse_program_info (char *info)
+{
+ char *filename;
+ int nthreads = -1;
+ upc_threads_model_t threads_model = upc_threads_model_none;
+ int npthreads = -1;
+ const char *fname;
+ int fname_len;
+ const char *s = info;
+ if (!__upc_match_string(&s, "$GCCUPCConfig:"))
+ return;
+ __upc_skip_spaces (&s);
+ if (!__upc_match_string(&s, "("))
+ return;
+ fname = s;
+ if (!__upc_match_until(&s, ")"))
+ return;
+ fname_len = (s - fname - 1);
+ filename = (char *)malloc(fname_len + 1);
+ strncpy (filename, fname, fname_len);
+ filename[fname_len] = '\0';
+ while (*s)
+ {
+ __upc_skip_spaces (&s);
+ if (__upc_match_string(&s, "$"))
+ {
+ break;
+ }
+ else if (__upc_match_string(&s, "dynamicthreads"))
+ {
+ nthreads = -1;
+ }
+ else if (__upc_match_string(&s, "staticthreads="))
+ {
+ if (!__upc_match_num(&s, &nthreads))
+ return;
+ }
+ else if (__upc_match_string(&s, "process"))
+ {
+ threads_model = upc_threads_model_process;
+ }
+ else if (__upc_match_string(&s, "pthreads-tls"))
+ {
+ threads_model = upc_threads_model_pthreads_tls;
+ }
+ else if (__upc_match_string(&s, "dynamicpthreads"))
+ {
+ npthreads = -1;
+ }
+ else if (__upc_match_string(&s, "staticpthreads="))
+ {
+ if (!__upc_match_num(&s, &npthreads))
+ return;
+ }
+ else
+ return;
+ }
+ __upc_register_pgm_info (filename, nthreads, threads_model, npthreads);
+}
+
+void
+__upc_validate_pgm_info (char *pgm)
+{
+ upc_compiled_thread_info_p p;
+ char *info;
+ int nthreads = -1;
+ int npthreads = -1;
+ /* Process all the strings within the program information section.
+ (Ignore intervening null bytes.) */
+ for (info = GUPCR_PGM_INFO_SECTION_START;
+ info < GUPCR_PGM_INFO_SECTION_END;
+ ++info)
+ {
+ if (*info)
+ {
+ __upc_parse_program_info (info);
+ info += strlen(info);
+ }
+ }
+ if (!__upc_compiled_thread_info)
+ {
+ fprintf (stderr, "%s: UPC Warning: There are no UPC source files"
+ " compiled into this program,"
+ " or <upc.h> was not included?\n", pgm);
+ return;
+ }
+ for (p = __upc_compiled_thread_info; p; p = p->next)
+ {
+ if (p->nthreads > 0 && nthreads <= 0)
+ nthreads = p->nthreads;
+ if (p->npthreads > 0 && npthreads <= 0)
+ npthreads = p->npthreads;
+ /* Static thread/pthread compilations can be intermixed
+ with dynamic threads compilations, but static values must agree. */
+ if (((p->nthreads != nthreads)
+ && (p->nthreads > 0)
+ && (nthreads > 0))
+ || ((p->npthreads != npthreads)
+ && (p->npthreads > 0)
+ && (npthreads > 0))
+ || (p->threads_model != __upc_compiled_thread_info->threads_model))
+ {
+ fprintf (stderr, "%s: UPC error: The UPC source files in this"
+ " program were not compiled with the same value"
+ " of UPC settings.\n", pgm);
+ fprintf (stderr, "%s: A list of each UPC source file and"
+ " its compiled UPC settings follows.\n", pgm);
+ __upc_print_upc_compiled_thread_info ();
+ exit (2);
+ }
+ }
+
+#ifndef GUPCR_USE_PTHREADS
+ if (__upc_compiled_thread_info->threads_model != upc_threads_model_process)
+ {
+ fprintf (stderr, "%s: The selected GUPC runtime library"
+ " supports only the process model."
+ " Did you link with the correct runtime library?\n",
+ pgm);
+ exit (2);
+ }
+#else
+ if (__upc_compiled_thread_info->threads_model != upc_threads_model_pthreads_tls)
+ {
+ fprintf (stderr, "%s: The selected GUPC runtime library"
+ " supports only the POSIX threads model."
+ " Did you link with the correct runtime library?\n",
+ pgm);
+ exit (2);
+ }
+#endif /* !GUPCR_USE_PTHREADS */
+
+ THREADS = nthreads;
+#ifdef GUPCR_USE_PTHREADS
+ UPC_PTHREADS = npthreads;
+ if (UPC_PTHREADS == -1)
+ {
+ UPC_PTHREADS = THREADS;
+ }
+#endif /* GUPCR_USE_PTHREADS */
+
+}
diff --git a/libgupc/smp/upc_pts.h b/libgupc/smp/upc_pts.h
new file mode 100644
index 00000000000..471c1d79c76
--- /dev/null
+++ b/libgupc/smp/upc_pts.h
@@ -0,0 +1,175 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_PTS_H_
+#define _UPC_PTS_H_ 1
+
+//begin lib_pts_defs
+
+/* UPC pointer representation */
+
+#if (defined(GUPCR_PTS_STRUCT_REP) + defined(GUPCR_PTS_WORD_PAIR_REP) \
+ + defined(GUPCR_PTS_PACKED_REP)) == 0
+# error Unknown PTS representation.
+#elif (defined(GUPCR_PTS_STRUCT_REP) + defined(GUPCR_PTS_WORD_PAIR_REP) \
+ + defined(GUPCR_PTS_PACKED_REP)) != 1
+# error Only one UPC shared pointer representation setting is permitted.
+#endif
+
+#ifdef GUPCR_PTS_STRUCT_REP
+
+#if GUPCR_PTS_THREAD_SIZE == 32
+#undef GUPCR_PTS_THREAD_TYPE
+#define GUPCR_PTS_THREAD_TYPE u_intSI_t
+#elif GUPCR_PTS_THREAD_SIZE == 16
+#undef GUPCR_PTS_THREAD_TYPE
+#define GUPCR_PTS_THREAD_TYPE u_intHI_t
+#endif
+#if GUPCR_PTS_PHASE_SIZE == 32
+#undef GUPCR_PTS_PHASE_TYPE
+#define GUPCR_PTS_PHASE_TYPE u_intSI_t
+#elif GUPCR_PTS_PHASE_SIZE == 16
+#undef GUPCR_PTS_PHASE_TYPE
+#define GUPCR_PTS_PHASE_TYPE u_intHI_t
+#endif
+
+#if !__GCC_UPC__
+/* The UPC compiler pre-defines upc_shared_ptr_t to be the
+ representation of a shared pointer. Since most of the
+ runtime is written in regular "C", we need to define
+ the pointer representation here. */
+typedef struct shared_ptr_struct
+ {
+#if GUPCR_PTS_VADDR_FIRST
+ GUPCR_PTS_VADDR_TYPE vaddr;
+ GUPCR_PTS_THREAD_TYPE thread;
+ GUPCR_PTS_PHASE_TYPE phase;
+#else
+ GUPCR_PTS_PHASE_TYPE phase;
+ GUPCR_PTS_THREAD_TYPE thread;
+ GUPCR_PTS_VADDR_TYPE vaddr;
+#endif
+ } upc_shared_ptr_t
+#ifdef GUPCR_PTS_ALIGN
+ __attribute__ ((aligned (GUPCR_PTS_ALIGN)))
+#endif
+ ;
+typedef upc_shared_ptr_t *upc_shared_ptr_p;
+/* upc_dbg_shared_ptr_t is used by debugger to figure out
+ shared pointer layout */
+typedef upc_shared_ptr_t upc_dbg_shared_ptr_t;
+#endif
+
+#define GUPCR_PTS_TO_REP(V) *((upc_shared_ptr_t *)&(V))
+#define GUPCR_PTS_IS_NULL(P) (!(P).vaddr && !(P).thread && !(P).phase)
+#define GUPCR_PTS_SET_NULL_SHARED(P) \
+ {(P).vaddr = 0; (P).thread = 0; (P).phase = 0;}
+
+#define GUPCR_PTS_VADDR(P) ((size_t)(P).vaddr - (size_t)GUPCR_SHARED_SECTION_START)
+#define GUPCR_PTS_OFFSET(P) ((size_t)(P).vaddr - (size_t)GUPCR_SHARED_SECTION_START)
+#define GUPCR_PTS_THREAD(P) (P).thread
+#define GUPCR_PTS_PHASE(P) (P).phase
+
+#define GUPCR_PTS_SET_VADDR(P,V) (P).vaddr = (GUPCR_PTS_VADDR_TYPE)((char *)(V) \
+ + (size_t)GUPCR_SHARED_SECTION_START)
+#define GUPCR_PTS_INCR_VADDR(P,V) (P).vaddr += ((size_t)(V))
+#define GUPCR_PTS_SET_THREAD(P,V) (P).thread = (size_t)(V)
+#define GUPCR_PTS_SET_PHASE(P,V) (P).phase = (size_t)(V)
+
+#elif GUPCR_PTS_PACKED_REP
+
+#if GUPCR_PTS_VADDR_FIRST
+#define GUPCR_PTS_VADDR_SHIFT (GUPCR_PTS_THREAD_SHIFT + GUPCR_PTS_THREAD_SIZE)
+#define GUPCR_PTS_THREAD_SHIFT GUPCR_PTS_PHASE_SIZE
+#define GUPCR_PTS_PHASE_SHIFT 0
+#else
+#define GUPCR_PTS_VADDR_SHIFT 0
+#define GUPCR_PTS_THREAD_SHIFT GUPCR_PTS_VADDR_SIZE
+#define GUPCR_PTS_PHASE_SHIFT (GUPCR_PTS_THREAD_SHIFT + GUPCR_PTS_THREAD_SIZE)
+#endif
+#define GUPCR_PTS_TO_REP(V) *((upc_shared_ptr_t *)&(V))
+#if GUPCR_TARGET64
+#define GUPCR_ONE 1UL
+#define GUPCR_PTS_REP_T unsigned long
+#else
+#define GUPCR_ONE 1ULL
+#define GUPCR_PTS_REP_T unsigned long long
+#endif
+#define GUPCR_PTS_VADDR_MASK ((GUPCR_ONE << GUPCR_PTS_VADDR_SIZE) - GUPCR_ONE)
+#define GUPCR_PTS_THREAD_MASK ((GUPCR_ONE << GUPCR_PTS_THREAD_SIZE) - GUPCR_ONE)
+#define GUPCR_PTS_PHASE_MASK ((GUPCR_ONE << GUPCR_PTS_PHASE_SIZE) - GUPCR_ONE)
+
+#if !__GCC_UPC__
+/* upc_dbg_shared_ptr_t is used by debugger to figure out
+ shared pointer layout */
+typedef struct shared_ptr_struct
+ {
+#if GUPCR_PTS_VADDR_FIRST
+ unsigned long long vaddr:GUPCR_PTS_VADDR_SIZE;
+ unsigned int thread:GUPCR_PTS_THREAD_SIZE;
+ unsigned int phase:GUPCR_PTS_PHASE_SIZE;
+#else
+ unsigned int phase:GUPCR_PTS_PHASE_SIZE;
+ unsigned int thread:GUPCR_PTS_THREAD_SIZE;
+ unsigned long long vaddr:GUPCR_PTS_VADDR_SIZE;
+#endif
+ } upc_dbg_shared_ptr_t;
+
+typedef GUPCR_PTS_REP_T upc_shared_ptr_t;
+typedef upc_shared_ptr_t *upc_shared_ptr_p;
+#endif
+
+#define GUPCR_PTS_IS_NULL(P) !(P)
+#define GUPCR_PTS_SET_NULL_SHARED(P) { (P) = 0; }
+
+/* Access functions are optimized for a representation of the
+ form (vaddr,thread,phase) and where the value is unsigned.
+ Thus, right shift is logical (not arithmetic), and masking
+ is avoided for vaddr, and shifting is avoided for phase.
+ Further, the value being inserted must fit into the field.
+ It will not be masked. */
+#define GUPCR_PTS_VADDR(P) \
+ (void *)((size_t)((P)>>GUPCR_PTS_VADDR_SHIFT & GUPCR_PTS_VADDR_MASK))
+#define GUPCR_PTS_THREAD(P) ((size_t)((P)>>GUPCR_PTS_THREAD_SHIFT & GUPCR_PTS_THREAD_MASK))
+#define GUPCR_PTS_PHASE(P) ((size_t)((P)>>GUPCR_PTS_PHASE_SHIFT & GUPCR_PTS_PHASE_MASK))
+#define GUPCR_PTS_OFFSET(P) ((size_t)((P)>>GUPCR_PTS_VADDR_SHIFT & GUPCR_PTS_VADDR_MASK))
+
+#define GUPCR_PTS_SET_VADDR(P,V) \
+ (P) = ((P) & ~(GUPCR_PTS_VADDR_MASK << GUPCR_PTS_VADDR_SHIFT)) \
+ | ((GUPCR_PTS_REP_T)(V) << GUPCR_PTS_VADDR_SHIFT)
+#define GUPCR_PTS_SET_THREAD(P,V) (P) = ((P) & ~(GUPCR_PTS_THREAD_MASK << GUPCR_PTS_THREAD_SHIFT)) \
+ | ((GUPCR_PTS_REP_T)(V) << GUPCR_PTS_THREAD_SHIFT)
+#define GUPCR_PTS_SET_PHASE(P,V) (P) = ((P) & ~(GUPCR_PTS_PHASE_MASK << GUPCR_PTS_PHASE_SHIFT)) \
+ | ((GUPCR_PTS_REP_T)(V) << GUPCR_PTS_PHASE_SHIFT)
+#define GUPCR_PTS_INCR_VADDR(P,V) \
+ ((P) += ((GUPCR_PTS_REP_T)(V) << GUPCR_PTS_VADDR_SHIFT))
+#elif GUPCR_PTS_WORD_PAIR_REP
+#error UPC word pair representation is unsupported.
+#endif /* GUPCR_PTS_*_REP__ */
+//end lib_pts_defs
+
+#endif /* !_UPC_PTS_H_ */
diff --git a/libgupc/smp/upc_pupc.c b/libgupc/smp/upc_pupc.c
new file mode 100644
index 00000000000..d64ee9ea4a5
--- /dev/null
+++ b/libgupc/smp/upc_pupc.c
@@ -0,0 +1,111 @@
+/* Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "gasp.h"
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_pupc.h"
+
+static GUPCR_THREAD_LOCAL gasp_context_t __upc_gasp_ctx;
+
+int
+pupc_control (int on)
+{
+ return gasp_control (__upc_gasp_ctx, on);
+}
+
+unsigned int
+pupc_create_event (const char *name, const char *desc)
+{
+ return gasp_create_event (__upc_gasp_ctx, name, desc);
+}
+
+void
+pupc_event_start (unsigned int evttag, ...)
+{
+ va_list argptr;
+ va_start (argptr, evttag);
+ gasp_event_notifyVA (__upc_gasp_ctx, evttag, GASP_START, NULL, 0, 0,
+ argptr);
+ va_end (argptr);
+}
+
+void
+pupc_event_end (unsigned int evttag, ...)
+{
+ va_list argptr;
+ va_start (argptr, evttag);
+ gasp_event_notifyVA (__upc_gasp_ctx, evttag, GASP_END, NULL, 0, 0, argptr);
+ va_end (argptr);
+}
+
+void
+pupc_event_atomic (unsigned int evttag, ...)
+{
+ va_list argptr;
+ va_start (argptr, evttag);
+ gasp_event_notifyVA (__upc_gasp_ctx, evttag, GASP_ATOMIC, NULL, 0, 0,
+ argptr);
+ va_end (argptr);
+}
+
+void
+pupc_event_startg (unsigned int evttag, const char *filename, int linenum, ...)
+{
+ va_list argptr;
+ va_start (argptr, linenum);
+ gasp_event_notifyVA (__upc_gasp_ctx, evttag, GASP_START, filename, linenum, 0,
+ argptr);
+ va_end (argptr);
+}
+
+void
+pupc_event_endg (unsigned int evttag, const char *filename, int linenum, ...)
+{
+ va_list argptr;
+ va_start (argptr, linenum);
+ gasp_event_notifyVA (__upc_gasp_ctx, evttag, GASP_END, filename, linenum, 0,
+ argptr);
+ va_end (argptr);
+}
+
+void
+pupc_event_atomicg (unsigned int evttag, const char *filename, int linenum, ...)
+{
+ va_list argptr;
+ va_start (argptr, linenum);
+ gasp_event_notifyVA (__upc_gasp_ctx, evttag, GASP_ATOMIC,
+ filename, linenum, 0, argptr);
+ va_end (argptr);
+}
+
+void
+__upc_pupc_init (int *argc, char ***argv)
+{
+ __upc_gasp_ctx = gasp_init (GASP_MODEL_UPC, argc, argv);
+}
diff --git a/libgupc/smp/upc_pupc.h b/libgupc/smp/upc_pupc.h
new file mode 100644
index 00000000000..2e0ff55af62
--- /dev/null
+++ b/libgupc/smp/upc_pupc.h
@@ -0,0 +1,57 @@
+/* Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_PUPC_H_
+#define _UPC_PUPC_H_
+
+/* See GASP Specification (version 1.5)
+ http://gasp.hcs.ufl.edu/gasp-1.5-61606.pdf */
+
+extern int pupc_control (int on);
+extern unsigned int pupc_create_event (const char *name, const char *desc);
+
+extern void pupc_event_start (unsigned int evttag, ...);
+extern void pupc_event_end (unsigned int evttag, ...);
+extern void pupc_event_atomic (unsigned int evttag, ...);
+
+extern void pupc_event_startg (unsigned int evttag, const char *file, int line, ...);
+extern void pupc_event_endg (unsigned int evttag, const char *file, int line, ...);
+extern void pupc_event_atomicg (unsigned int evttag, const char *file, int line, ...);
+
+extern void __upc_pupc_init (int *, char ***);
+
+/* The "##__VAR_ARGS__" syntax below, is required to support an empty optional argument
+ see: http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html */
+#define p_start(evttag, ...) pupc_event_startg (evttag, filename, linenum, ##__VA_ARGS__)
+#define p_end(evttag, ...) pupc_event_endg (evttag, filename, linenum, ##__VA_ARGS__)
+#define p_atomic(evttag, ...) pupc_event_atomicg (evttag, filename, linenum, ##__VA_ARGS__)
+
+#define p_startx(evttag, ...) pupc_event_startg (evttag, NULL, 0, ##__VA_ARGS__)
+#define p_endx(evttag, ...) pupc_event_endg (evttag, NULL, 0, ##__VA_ARGS__)
+#define p_atomicx(evttag, ...) pupc_event_atomicg (evttag, NULL, 0, ##__VA_ARGS__)
+
+#endif /* _UPC_PUPC_H_ */
diff --git a/libgupc/smp/upc_sup.h b/libgupc/smp/upc_sup.h
new file mode 100644
index 00000000000..064a86037bf
--- /dev/null
+++ b/libgupc/smp/upc_sup.h
@@ -0,0 +1,116 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_SUP_H_
+#define _UPC_SUP_H_
+
+/* Internal runtime routines and external symbols. */
+
+//begin lib_runtime_api
+
+extern void *__cvtaddr (upc_shared_ptr_t);
+extern void *__getaddr (upc_shared_ptr_t);
+extern void __upc_barrier (int barrier_id);
+extern void __upc_notify (int barrier_id);
+extern void __upc_wait (int barrier_id);
+extern void __upc_exit (int status)
+ __attribute__ ((__nothrow__))
+ __attribute__ ((__noreturn__));
+extern void __upc_fatal (const char *fmt, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)))
+ __attribute__ ((__nothrow__))
+ __attribute__ ((__noreturn__));
+
+/* Profiled versions of runtime routines. */
+extern void *__cvtaddrg (upc_shared_ptr_t, const char *filename, const int linenum);
+extern void *__getaddrg (upc_shared_ptr_t, const char *filename, const int linenum);
+extern void __upc_barrierg (int barrier_id, const char *filename, const int linenum);
+extern void __upc_notifyg (int barrier_id, const char *filename, const int linenum);
+extern void __upc_waitg (int barrier_id, const char *filename, const int linenum);
+extern void __upc_exitg (int status, const char *filename, const int linenum)
+ __attribute__ ((__noreturn__));
+extern void __upc_funcg (int start, const char *funcname,
+ const char *filename, const int linenum);
+extern void __upc_forallg (int start, const char *filename, const int linenum);
+//end lib_runtime_api
+
+//begin lib_heap_api
+
+extern void __upc_acquire_alloc_lock (void);
+extern void __upc_release_alloc_lock (void);
+//end lib_heap_api
+
+//begin lib_vm_api
+
+extern void *__upc_vm_map_addr (upc_shared_ptr_t);
+extern int __upc_vm_alloc (upc_page_num_t);
+extern upc_page_num_t __upc_vm_get_cur_page_alloc (void);
+//end lib_vm_api
+
+extern void __upc_heap_init (upc_shared_ptr_t, size_t);
+extern int __upc_start (int argc, char *argv[]);
+extern void __upc_validate_pgm_info (char *);
+extern void __upc_vm_init_per_thread (void);
+extern void __upc_vm_init (upc_page_num_t);
+extern void __upc_barrier_init (void);
+
+//begin lib_sptr_to_addr
+
+/* To speed things up, the last two unique (page, thread)
+ lookups are cached. Caller must validate the pointer
+ 'p' (check for NULL, etc.) before calling this routine. */
+__attribute__((__always_inline__))
+static inline
+void *
+__upc_sptr_to_addr (upc_shared_ptr_t p)
+{
+ extern GUPCR_THREAD_LOCAL unsigned long __upc_page1_ref, __upc_page2_ref;
+ extern GUPCR_THREAD_LOCAL void *__upc_page1_base, *__upc_page2_base;
+ void *addr;
+ size_t offset, p_offset;
+ upc_page_num_t pn;
+ unsigned long this_page;
+ offset = GUPCR_PTS_OFFSET (p);
+ p_offset = offset & GUPCR_VM_OFFSET_MASK;
+ pn = (offset >> GUPCR_VM_OFFSET_BITS) & GUPCR_VM_PAGE_MASK;
+ this_page = (pn << GUPCR_THREAD_SIZE) | GUPCR_PTS_THREAD (p);
+ if (this_page == __upc_page1_ref)
+ addr = (char *) __upc_page1_base + p_offset;
+ else if (this_page == __upc_page2_ref)
+ addr = (char *) __upc_page2_base + p_offset;
+ else
+ addr = __upc_vm_map_addr (p);
+ return addr;
+}
+
+#ifdef __UPC__
+ #define __upc_map_to_local(P)(__upc_sptr_to_addr(*(upc_shared_ptr_t *)&(P)))
+#endif
+
+//end lib_sptr_to_addr
+
+#endif /* _UPC_SUP_H_ */
diff --git a/libgupc/smp/upc_sync.h b/libgupc/smp/upc_sync.h
new file mode 100644
index 00000000000..0cc1e611ea3
--- /dev/null
+++ b/libgupc/smp/upc_sync.h
@@ -0,0 +1,157 @@
+/* Copyright (C) 2004-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#ifndef _UPC_SYNC_H_
+#define _UPC_SYNC_H_
+
+//begin lib_fence_defs
+
+/*
+
+The following table (up to PA-RISC) is excerpted from
+"Implementing the UPC memory consistency model for
+shared-memory architectures", Dan Bonachea et al.
+
+CPU Write fence Read fence
+--------------------------------------------------
+Power/PowerPC lwsync isync
+Alpha wmb mb
+x86 lock; addl $0,0(%%esp) none reqd.
+Athlon/Opteron mfence none reqd.
+Itanium mf none reqd.
+SPARC stbar none reqd.
+MIPS sync none reqd.
+PA-RISC SYNC none reqd.
+--
+AARCH64 dmb ishst dmb ishld
+
+*/
+
+#define GUPCR_FENCE() { GUPCR_READ_FENCE (); GUPCR_WRITE_FENCE (); }
+
+#if defined (PPC) || defined (__PPC__)
+#define GUPCR_WRITE_FENCE() asm __volatile__ ("lwsync":::"memory")
+#define GUPCR_READ_FENCE() asm __volatile__ ("isync":::"memory")
+#elif defined (alpha)
+#define GUPCR_WRITE_FENCE() asm __volatile__ ("wmb":::"memory")
+#define GUPCR_READ_FENCE() asm __volatile__ ("mb":::"memory")
+#elif defined (__x86_64__)
+#define GUPCR_WRITE_FENCE() asm __volatile__ ("mfence":::"memory")
+#define GUPCR_READ_FENCE() asm __volatile__ ("":::"memory")
+#elif defined (__ia64__)
+#define GUPCR_WRITE_FENCE() asm __volatile__ ("mf":::"memory")
+#define GUPCR_READ_FENCE() asm __volatile__ ("":::"memory")
+#elif defined (i386)
+#define GUPCR_WRITE_FENCE() asm __volatile__ ("lock; addl $0,0(%%esp)":::"memory")
+#define GUPCR_READ_FENCE() asm __volatile__ ("":::"memory")
+#elif defined (sparc)
+#define GUPCR_WRITE_FENCE() asm __volatile__ ("stbar":::"memory")
+#define GUPCR_READ_FENCE() asm __volatile__ ("":::"memory")
+#elif defined (mips)
+#define GUPCR_WRITE_FENCE() asm __volatile__ ("sync":::"memory")
+#define GUPCR_READ_FENCE() asm __volatile__ ("":::"memory")
+#elif defined (hppa)
+#define GUPCR_WRITE_FENCE() asm __volatile__ ("SYNC":::"memory")
+#define GUPCR_READ_FENCE() asm __volatile__ ("":::"memory")
+#elif defined (__aarch64__)
+#define GUPCR_WRITE_FENCE() asm __volatile__ ("dmb ishst":::"memory")
+#define GUPCR_READ_FENCE() asm __volatile__ ("dmb ishld":::"memory")
+#else
+# error "No memory fence operations provided for this cpu."
+#endif
+//end lib_fence_defs
+
+//begin lib_atomic
+#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) \
+ || defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
+ /* Use GCC's builtin implementation, if available. */
+ #define __upc_atomic_cas(PTR, OLD_VAL, NEW_VAL) \
+ __sync_bool_compare_and_swap (PTR, OLD_VAL, NEW_VAL)
+#else
+ extern int __upc_atomic_cas (os_atomic_p, os_atomic_t, os_atomic_t);
+#endif
+
+#if defined (HAVE_SYNC_FETCH_AND_ADD_8) \
+ || defined (HAVE_SYNC_FETCH_AND_ADD_4)
+#define __upc_sync_fetch_and_add(PTR, INC) \
+ __sync_fetch_and_add (PTR, INC)
+#else
+__attribute__ ((__always_inline__))
+static inline
+int
+__upc_sync_fetch_and_add (int *addr, int inc)
+{
+ int old_val, new_val;
+ do
+ {
+ old_val = *addr;
+ new_val = old_val + inc;
+ }
+ while (!__upc_atomic_cas (addr, old_val, new_val));
+ return old_val;
+}
+#endif
+//end lib_atomic
+
+//begin lib_spin_until
+
+/* Give up control of the cpu for a small time interval. */
+#ifdef __sgi__
+#define __upc_yield_cpu() do { sginap(0); } while (0)
+#else
+# ifdef _POSIX_PRIORITY_SCHEDULING
+# define __upc_yield_cpu() do { sched_yield(); } while (0)
+# else
+# define __upc_yield_cpu() do { usleep(1000L); } while (0)
+# endif
+#endif
+
+/* Number of cpu's available */
+extern int __upc_num_cpus;
+
+/* Max. number of iterations to poll waiting for a
+ * spinlock loop condition to be satisfied.
+ */
+#define OS_MAX_SPIN_COUNT (__upc_num_cpus > 1 ? 500 : 0)
+/* Keep spinning until PREDICATE is true,
+ * (this needs to be a macro, to ensure that
+ * PREDICATE is re-evaluated on each iteration. */
+#define __upc_spin_until(PREDICATE) \
+ { \
+ int i = 0; \
+ while (!(PREDICATE)) \
+ { \
+ if (++i >= OS_MAX_SPIN_COUNT) \
+ { \
+ __upc_yield_cpu (); \
+ i = 0; \
+ } \
+ } \
+ }
+//end lib_spin_until
+
+#endif /* _UPC_SYNC_H_ */
diff --git a/libgupc/smp/upc_sysdep.c b/libgupc/smp/upc_sysdep.c
new file mode 100644
index 00000000000..0090b25ad2a
--- /dev/null
+++ b/libgupc/smp/upc_sysdep.c
@@ -0,0 +1,319 @@
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+ 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 2, 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 COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_sup.h"
+#include "upc_sync.h"
+
+#ifdef __sgi__
+#ifndef _SC_NPROCESSORS_ONLN
+#define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
+#endif
+#endif
+
+int __upc_num_cpus;
+
+void
+__upc_sys_init ()
+{
+ __upc_num_cpus = (int) sysconf (_SC_NPROCESSORS_ONLN);
+
+ /* Make sure that this main process is the process group leader */
+ if (getpgrp() != getpid())
+ {
+ if (setpgid(0, 0) == -1)
+ { perror("setpgid"); exit (2); }
+ }
+}
+
+char *__upc_strsignal (sig)
+ int sig;
+{
+ static char sigbuf[64];
+#if defined(__sgi__) || defined(__sun__)
+ char **sys_siglist = _sys_siglist;
+ const int nsig = _sys_nsig;
+#else
+#ifndef __NetBSD__ // signal.h has pointer decl instead of array
+ extern const char * const sys_siglist[];
+#endif
+ const int nsig = NSIG;
+#endif
+ if (sig > 0 && sig < nsig)
+ return (char *)sys_siglist[sig];
+ else
+ return (sprintf (sigbuf, "signal number %d", sig), sigbuf);
+}
+
+#ifndef __upc_atomic_cas
+/* If a builtin implementation of __upc_atomic_cas was found,
+ then the symbol will be defined as a pre-processor macro.
+ Otherwise, implement the function out-of-line. */
+#ifdef __sgi__
+int
+__upc_atomic_cas (os_atomic_p ptr, os_atomic_t old, os_atomic_t new)
+{
+ upc_info_p u = __upc_info;
+ return uscas ((void *)ptr, old, new, (usptr_t *)u->runtime_heap);
+}
+#elif __i386__
+
+#define LOCK_PREFIX "lock ; "
+
+int
+__upc_atomic_cas (os_atomic_p ptr, os_atomic_t old, os_atomic_t new)
+{
+ os_atomic_t prev;
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*ptr), "0"(old)
+ : "memory");
+ return prev == old;
+}
+#elif __x86_64__
+
+#define LOCK_PREFIX "lock ; "
+
+int
+__upc_atomic_cas (os_atomic_p ptr, os_atomic_t old, os_atomic_t new)
+{
+ os_atomic_t prev;
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*ptr), "0"(old)
+ : "memory");
+ return prev == old;
+}
+
+#elif __ia64__
+
+#include <linux/types.h>
+#include <asm/intrinsics.h>
+
+int
+__upc_atomic_cas (os_atomic_p ptr, os_atomic_t old, os_atomic_t new)
+{
+ os_atomic_t prev;
+ prev = cmpxchg (ptr, old, new);
+ return prev == old;
+}
+#else
+ #error "__upc_atomic_cas not implemented on this target"
+#endif
+#endif /* ! __upc_atomic_cas */
+
+int
+__upc_atomic_get_bit (os_atomic_p bits, int bitnum)
+{
+ os_atomic_t *word_ptr = bits + (bitnum / OS_BITS_PER_ATOMIC_WORD);
+ os_atomic_t bit = (1 << (bitnum % OS_BITS_PER_ATOMIC_WORD));
+ os_atomic_t word = *word_ptr;
+ GUPCR_READ_FENCE();
+ return (word & bit) != 0;
+}
+
+void
+__upc_atomic_set_bit (os_atomic_p bits, int bitnum)
+{
+ os_atomic_t *word = bits + (bitnum / OS_BITS_PER_ATOMIC_WORD);
+ os_atomic_t bit = (1 << (bitnum % OS_BITS_PER_ATOMIC_WORD));
+ os_atomic_t old_val, new_val;
+ do
+ {
+ old_val = *word;
+ new_val = old_val | bit;
+ }
+ while (!__upc_atomic_cas (word, old_val, new_val));
+}
+
+os_heap_p
+__upc_create_runtime_heap (size_t ARG_UNUSED (max_size),
+ const char **ARG_UNUSED (err_msg))
+{
+ os_heap_p heap;
+#ifdef __sgi__
+ /* Create the shared arena. */
+ (void) usconfig (CONF_INITSIZE, max_size);
+ heap = (os_heap_p) usinit (DEV_ZERO);
+ if (!heap)
+ { *err_msg = strerror(errno); return 0; }
+#else
+ /* On platforms other than SGI/Irix we don't
+ need a heap, because mmap() will work well
+ for the limited number of data structures
+ allocated during runtime initialization. */
+ heap = (void *)-1;
+#endif
+ return heap;
+}
+
+void *
+__upc_runtime_alloc (size_t size, os_heap_p *ARG_UNUSED (heap),
+ const char **err_msg)
+{
+ void *alloc;
+#ifdef __sgi__
+ alloc = (void *) usmalloc (size, (usptr_t *)*heap);
+ if (!alloc)
+ { *err_msg = strerror(errno); return 0; }
+#else
+ alloc = mmap ((void *) 0, size,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_ANONYMOUS, -1, OFFSET_ZERO);
+ if (!alloc || alloc == MAP_ERROR)
+ { *err_msg = strerror(errno); return 0; }
+#endif
+ return alloc;
+}
+
+void
+__upc_init_lock (lock)
+ os_lock_p lock;
+{
+#ifdef __sgi__
+ {
+ upc_info_p u = __upc_info;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ *lock = (os_lock_t) usnewlock ((usptr_t *) u->runtime_heap);
+ if (!*lock)
+ { perror ("__upc_init_lock"); abort (); }
+ }
+#else
+ *lock = 0;
+#endif
+}
+
+void
+__upc_acquire_lock (lock)
+ os_lock_p lock;
+{
+ if (!lock)
+ __upc_fatal ("NULL shared pointer passed to UPC lock operation");
+#ifdef __sgi__
+ {
+ int status;
+ status = ussetlock(*lock);
+ if (status == 0)
+ __upc_fatal ("upc_lock() could not acquire lock");
+ else if (status < 0)
+ { perror ("upc_acquire_lock"); abort (); }
+ }
+#else
+ __upc_spin_until (__upc_atomic_cas ((os_atomic_p) lock, 0, 1));
+#endif
+ GUPCR_FENCE();
+}
+
+int
+__upc_try_acquire_lock (lock)
+ os_lock_p lock;
+{
+ int status;
+ if (!lock)
+ __upc_fatal ("NULL shared pointer passed to UPC lock operation");
+#ifdef __sgi__
+ status = uscsetlock(*lock, 0);
+ if (status < 0)
+ { perror ("upc_try_acquire_lock"); abort (); }
+#else
+ status = __upc_atomic_cas ((os_atomic_p) lock, 0, 1);
+#endif
+ if (status)
+ GUPCR_FENCE();
+ return status;
+}
+
+void
+__upc_release_lock (lock)
+ os_lock_p lock;
+{
+ if (!lock)
+ __upc_fatal ("NULL shared pointer passed to UPC lock operation");
+ GUPCR_FENCE();
+#ifdef __sgi__
+ {
+ int status;
+ status = usunsetlock(*lock);
+ if (status > 0)
+ __upc_fatal ("upc_unlock() could not release lock");
+ else if (status < 0)
+ { perror ("upc_unlock"); abort (); }
+ }
+#else
+ *((os_atomic_p) lock) = 0;
+#endif
+}
+
+/* Given a "tag" (a relative filename ending in XXXXXX),
+ create a temporary file using the tag.
+ Return a file descriptor associated with the newly
+ created temporary file.
+ [see: http://www.linux.com/howtos/Secure-Programs-HOWTO/avoid-race.shtml] */
+
+int
+__upc_create_temp_file (const char *tag, char *tmp_fname,
+ const char **err_msg)
+{
+ const char *tmpdir = NULL;
+ mode_t old_mode;
+ int fd;
+ if ((getuid () == geteuid ()) && (getgid () == getegid ()))
+ {
+ tmpdir = getenv ("TMPDIR");
+ if (!tmpdir)
+ tmpdir = getenv ("TMP");
+ }
+ if (!tmpdir)
+ tmpdir = "/tmp";
+ sprintf (tmp_fname, "%s/%s", tmpdir, tag);
+ /* Create file with restrictive permissions */
+ old_mode = umask (077);
+ fd = mkstemp (tmp_fname);
+ (void) umask (old_mode);
+ if (fd < 0)
+ *err_msg = "Couldn't open temporary file";
+ return fd;
+}
+
+/* Create a file that will be used as the backing store
+ for the UPC program's global shared memory. Return
+ a file descriptor that can subsequently be used
+ to mmap() the file. If an error is encountered,
+ fd will be set to -1, and err_msg will contain
+ a descriptive error message. */
+int
+__upc_create_global_mem_file (char *tmp_fname, const char **err_msg)
+{
+ int fd;
+ char fname_template[30];
+ sprintf (fname_template, "upc_shmem.%d.XXXXXX", (int)getpid());
+ fd = __upc_create_temp_file (fname_template, tmp_fname, err_msg);
+ return fd;
+}
diff --git a/libgupc/smp/upc_sysdep.h b/libgupc/smp/upc_sysdep.h
new file mode 100644
index 00000000000..b959303f57c
--- /dev/null
+++ b/libgupc/smp/upc_sysdep.h
@@ -0,0 +1,80 @@
+/* GNU UPC Runtime Operating System and Target Platform Dependent Support
+ Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+ 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 2, 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 COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#ifndef _UPC_OS_H_
+#define _UPC_OS_H_
+
+
+/* An actual heap is required only for the SGI Irix
+ based systems, because spin lock related data
+ structures must live there. The runtime doesn't
+ otherwise need its own heap, so a null handle is
+ passed around. */
+#ifdef __sgi__
+typedef usptr_t os_heap_t;
+#else
+typedef void *os_heap_t;
+#endif
+typedef os_heap_t *os_heap_p;
+
+#ifdef __sgi__
+typedef volatile ptrdiff_t os_atomic_t;
+#else
+typedef volatile int os_atomic_t;
+#endif
+typedef os_atomic_t *os_atomic_p;
+
+#define OS_ATOMIC_WORD_SIZE (sizeof(os_atomic_t))
+#define OS_BITS_PER_ATOMIC_WORD (OS_ATOMIC_WORD_SIZE * 8)
+
+#ifdef __sgi__
+typedef ulock_t os_lock_t;
+#else
+typedef os_atomic_t os_lock_t;
+#endif
+typedef os_lock_t *os_lock_p;
+
+extern void __upc_sys_init (void);
+
+extern int __upc_atomic_get_bit (os_atomic_p, int);
+extern void __upc_atomic_set_bit (os_atomic_p, int);
+
+extern void __upc_init_lock (os_lock_p);
+extern void __upc_acquire_lock (os_lock_p);
+extern int __upc_try_acquire_lock (os_lock_p);
+extern void __upc_release_lock (os_lock_p);
+
+extern os_heap_p __upc_create_runtime_heap (size_t, const char **);
+extern void *__upc_runtime_alloc (size_t, os_heap_p *, const char **);
+extern int __upc_create_temp_file (const char *tag, char *tmp_fname,
+ const char **err_msg);
+extern int __upc_create_global_mem_file (char *tmp_fname, const char **err_msg);
+extern char *__upc_strsignal (int);
+
+#endif /* !_UPC_OS_H_ */
diff --git a/libgupc/smp/upc_tick.c b/libgupc/smp/upc_tick.c
new file mode 100644
index 00000000000..f68a77924be
--- /dev/null
+++ b/libgupc/smp/upc_tick.c
@@ -0,0 +1,78 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime Library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_lib.h"
+
+#if HAVE_CLOCK_GETTIME
+#ifdef CLOCK_MONOTONIC_RAW
+/* System clock id passed to clock_gettime. CLOCK_MONOTONIC_RAW
+ is preferred. It has been available in the Linux kernel
+ since version 2.6.28 */
+#define SYS_RT_CLOCK_ID CLOCK_MONOTONIC_RAW
+#else
+#define SYS_RT_CLOCK_ID CLOCK_MONOTONIC
+#endif
+
+upc_tick_t
+upc_ticks_now (void)
+{
+ struct timespec ts;
+ upc_tick_t t;
+ if (clock_gettime (SYS_RT_CLOCK_ID, &ts) != 0)
+ {
+ perror ("clock_gettime");
+ abort ();
+ }
+ t = (upc_tick_t) ts.tv_sec * 1000000000LL + (upc_tick_t) ts.tv_nsec;
+ return t;
+}
+
+#else /* !HAVE_CLOCK_GETTIME */
+
+upc_tick_t
+upc_ticks_now (void)
+{
+ struct timeval tv;
+ upc_tick_t t;
+ if (gettimeofday (&tv, NULL) != 0)
+ {
+ perror ("gettimeofday");
+ abort ();
+ }
+ t = (upc_tick_t) tv.tv_sec * 1000000000LL + (upc_tick_t) tv.tv_usec * 1000;
+ return t;
+}
+
+#endif
+
+uint64_t
+upc_ticks_to_ns (upc_tick_t ticks)
+{
+ return ticks;
+}
diff --git a/libgupc/smp/upc_vm.c b/libgupc/smp/upc_vm.c
new file mode 100644
index 00000000000..8363221b3da
--- /dev/null
+++ b/libgupc/smp/upc_vm.c
@@ -0,0 +1,363 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "upc_config.h"
+#include "upc_sysdep.h"
+#include "upc_defs.h"
+#include "upc_sup.h"
+#include "upc_sync.h"
+#include "upc_numa.h"
+
+/* There is a local page table for each thread. The
+ local page table maps a local page to the location
+ where it has been mapped into the thread's memory. */
+typedef void *upc_lpte_t;
+typedef upc_lpte_t *upc_lpte_p;
+GUPCR_THREAD_LOCAL upc_lpte_p __upc_lpt;
+
+/* To speed things up, the last two unique (page, thread)
+ lookups are cached. See __upc_sptr_to_addr() in upc_sup.h.
+ NOTE: for this to work correctly GUPCR_VM_GLOBAL_SET_SIZE
+ must be >=2, otherwise a cached mapped entry might be
+ swapped out. */
+GUPCR_THREAD_LOCAL unsigned long __upc_page1_ref, __upc_page2_ref;
+GUPCR_THREAD_LOCAL void *__upc_page1_base, *__upc_page2_base;
+
+/* Each thread maintains a series of mapped regions
+ of memory that are mapped to specific global pages.
+ The Global Map Table (gmt) is indexed by a hashed
+ global page number to select a row (associative set)
+ of entries that are searched to find a per thread
+ mapping to the global page. All pages that do not
+ have affinity with the referencing thread are
+ considered to be global. */
+typedef struct upc_gme_struct
+ {
+ upc_page_num_t global_page_num;
+ void *local_page;
+ } upc_gme_t;
+typedef upc_gme_t *upc_gme_p;
+typedef upc_gme_t upc_gme_set_t[GUPCR_VM_GLOGAl_MAP_SET_SIZE];
+typedef upc_gme_set_t *upc_gme_set_p;
+typedef upc_gme_set_t upc_global_map_t[GUPCR_VM_GLOBAL_MAP_SIZE];
+typedef upc_global_map_t *upc_global_map_p;
+static GUPCR_THREAD_LOCAL upc_global_map_p __upc_gmt;
+
+/* Record the current value of the number of pages allocated.
+ This value is updated to the global value in the UPC info.
+ structure whenever an attempt is made to access a page
+ whose page number is not less than this current value. */
+GUPCR_THREAD_LOCAL upc_page_num_t __upc_cur_page_alloc;
+
+/* If this thread's idea of how many pages have been allocated
+ per thread is less than the actual value stored in the
+ UPC information structure, map the additional pages allocated
+ for this thread into the local page table. Mappings
+ in the local page table are never unmapped; this ensures that
+ conversions from pointer to shared to local pointers work
+ as expected. */
+
+upc_page_num_t
+__upc_vm_get_cur_page_alloc ()
+{
+ const upc_info_p u = __upc_info;
+ const upc_page_num_t old_page_alloc = __upc_cur_page_alloc;
+ upc_page_num_t alloc_pages, p, pt;
+ upc_page_num_t i, j;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ __upc_acquire_lock (&u->lock);
+ /* get the latest value */
+ GUPCR_FENCE ();
+ __upc_cur_page_alloc = u->cur_page_alloc;
+ GUPCR_READ_FENCE ();
+ __upc_release_lock (&u->lock);
+ alloc_pages = __upc_cur_page_alloc - old_page_alloc;
+ if (alloc_pages)
+ {
+ /* Additional pages have been allocated since we last checked.
+ Update the local page table to point to the pages
+ newly allocated to this thread. We need to map contiguous regions
+ in a single mmap call so that conversions to local pointers
+ work properly. */
+ upc_page_num_t first_page = old_page_alloc;
+ upc_page_num_t next_global_page = u->gpt[first_page * THREADS + MYTHREAD];
+ upc_page_num_t region_size = 0;
+ for (i = 0; i < alloc_pages; ++i)
+ {
+ const upc_page_num_t this_global_page = next_global_page;
+ region_size += 1;
+ if (i < (alloc_pages - 1))
+ {
+ /* If not at the last page, then calculate the
+ next global page number, so that it can be checked
+ against the current global page number for contiguity. */
+ p = old_page_alloc + (i + 1);
+ pt = p * THREADS + MYTHREAD;
+ next_global_page = u->gpt[pt];
+ }
+ if ((i == (alloc_pages - 1))
+ || (next_global_page != (this_global_page + 1)))
+ {
+ /* End of region detected. Map the current region
+ into the current thread's address space and update
+ the Local Page Table. */
+ const upc_page_num_t gpn = u->gpt[first_page * THREADS + MYTHREAD];
+ const off_t global_mem_offset = (off_t)gpn * GUPCR_VM_PAGE_SIZE;
+ const void *region_base = mmap ((void *) 0,
+ region_size * GUPCR_VM_PAGE_SIZE,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ u->smem_fd, global_mem_offset);
+ if (region_base == MAP_ERROR)
+ {
+ perror ("UPC runtime error: can't map local region");
+ abort ();
+ }
+ /* set affinity to this region */
+ __upc_numa_memory_region_affinity_set (u, MYTHREAD, region_base,
+ region_size * GUPCR_VM_PAGE_SIZE);
+ /* Update the local page table */
+ for (j = 0; j < region_size; ++j)
+ {
+ p = first_page + j;
+ __upc_lpt[p] = (void *)((size_t)region_base + j * GUPCR_VM_PAGE_SIZE);
+ }
+ first_page += region_size;
+ region_size = 0;
+ }
+ }
+ }
+ return __upc_cur_page_alloc;
+}
+
+/* For pages in threads other than the current thread,
+ check the Global Map Table (gmt) to see if the page
+ has already been mapped into this thread's address
+ space. The lookup is implemented by first converting
+ (thread, page) into its corresponding global page number.
+ The global page number is then converted into a hash
+ index by adding its higher order bits into the low order
+ bits and then masking modulo the GMT size. The hash value
+ selects a series of entries which are organized into an
+ N-way associative set, sorted in MRU order. If no matching
+ entry is found, then map the appropriate global page and
+ update the GMT. */
+
+static void *
+__upc_vm_map_global_page (int t, upc_page_num_t p)
+{
+ const upc_info_p u = __upc_info;
+ const upc_page_num_t pt = p * THREADS + t;
+ const upc_page_num_t gpn = u->gpt[pt];
+ const upc_page_num_t hash_gpn = ((gpn >> GUPCR_VM_GLOBAL_MAP_BITS) + gpn)
+ & GUPCR_VM_GLOBAL_MAP_MASK;
+ const upc_gme_set_p s = &(*__upc_gmt)[hash_gpn];
+ upc_gme_p g;
+ upc_page_num_t this_gpn;
+ off_t global_offset;
+ void *page_base;
+ int i, j;
+ for (i = 0; i < GUPCR_VM_GLOGAl_MAP_SET_SIZE; ++i)
+ {
+ g = &(*s)[i];
+ this_gpn = g->global_page_num;
+ if (gpn == this_gpn)
+ {
+ /* Found a matching entry. */
+ page_base = g->local_page;
+ if (i > 0)
+ {
+ const upc_gme_t m = *g;
+ /* Move this match to the front to preserve MRU order. */
+ for (j = i; j > 0; --j) (*s)[j] = (*s)[j - 1];
+ (*s)[0] = m;
+ }
+ return page_base;
+ }
+ /* If this entry is empty, then no match. Exit early
+ with 'i' pointing to this entry. */
+ if (this_gpn == GUPCR_VM_PAGE_INVALID)
+ break;
+ }
+ if (i == GUPCR_VM_GLOGAl_MAP_SET_SIZE)
+ {
+ /* The set is full. Unmap the last entry. */
+ g = &(*s)[GUPCR_VM_GLOGAl_MAP_SET_SIZE - 1];
+ page_base = g->local_page;
+ if (munmap (page_base, GUPCR_VM_PAGE_SIZE))
+ { perror ("UPC runtime error: global unmap"); abort (); }
+ /* Decrement 'i' so that it points to the last entry. */
+ i = i - 1;
+ }
+ /* Shift entries in associative set; make room at the front. */
+ for (j = i; j > 0; --j) (*s)[j] = (*s)[j - 1];
+ /* Map the new entry. */
+ global_offset = (off_t)gpn << GUPCR_VM_OFFSET_BITS;
+ page_base = mmap ((void *) 0, GUPCR_VM_PAGE_SIZE, PROT_READ | PROT_WRITE,
+ MAP_SHARED, u->smem_fd, global_offset);
+ if (page_base == MAP_ERROR)
+ { perror ("UPC runtime error: can't map global address"); abort (); }
+ /* Add the new entry at the front and return the mapped address. */
+ g = &(*s)[0];
+ g->global_page_num = gpn;
+ g->local_page = page_base;
+ return page_base;
+}
+
+/* Initialize the VM system. Create the Global Page Table
+ and initially allocate 'num_init_local_pages' per UPC thread.
+ Although the required physical storage is allocated, the initial
+ mapping occurs is deferred until each thread initializes. */
+
+void
+__upc_vm_init (upc_page_num_t num_init_local_pages)
+{
+ if (!__upc_vm_alloc (num_init_local_pages))
+ { perror ("UPC runtime error: can't allocate global memory"); abort (); }
+}
+
+/* Per thread VM initialization. Create the Local Page Table (lpt)
+ and the Global Map Table (gmt). Then update the lpt to reflect
+ the initially allocated storage. */
+
+void
+__upc_vm_init_per_thread ()
+{
+ int i, j;
+ __upc_lpt = (upc_lpte_p) calloc (GUPCR_VM_MAX_PAGES_PER_THREAD, sizeof (upc_lpte_t));
+ if (!__upc_lpt)
+ { perror ("UPC runtime error: can't allocate LPT"); abort (); }
+ __upc_gmt = (upc_global_map_p) malloc (sizeof (upc_global_map_t));
+ if (!__upc_gmt)
+ { perror ("UPC runtime error: can't allocate GMT"); abort (); }
+ /* All entries in the global map are initially empty */
+ for (i = 0; i < GUPCR_VM_GLOBAL_MAP_SIZE; ++i)
+ for (j = 0; j < GUPCR_VM_GLOGAl_MAP_SET_SIZE; ++j)
+ {
+ upc_gme_p g = &(*__upc_gmt)[i][j];
+ g->global_page_num = GUPCR_VM_PAGE_INVALID;
+ g->local_page = (void *)0;
+ }
+ /* Invalidate the page lookup cache keys */
+ __upc_page1_ref = GUPCR_VM_PAGE_INVALID;
+ __upc_page2_ref = GUPCR_VM_PAGE_INVALID;
+ /* Update Local Page Table to reflect initial allocation. */
+ __upc_cur_page_alloc = 0;
+ (void) __upc_vm_get_cur_page_alloc ();
+}
+
+/* Expand the shared memory file to hold an additional
+ 'alloc_pages' per thread. Update the '__upc_cur_page_alloc'
+ field in the UPC info. block to reflect the size increase. */
+
+int
+__upc_vm_alloc (upc_page_num_t alloc_pages)
+{
+ const upc_info_p u = __upc_info;
+ upc_page_num_t page_alloc;
+ upc_page_num_t new_page_alloc;
+ off_t smem_size;
+ upc_page_num_t i;
+ if (!u)
+ __upc_fatal ("UPC runtime not initialized");
+ __upc_acquire_lock (&u->lock);
+ GUPCR_FENCE ();
+ page_alloc = u->cur_page_alloc;
+ GUPCR_READ_FENCE ();
+ new_page_alloc = __upc_cur_page_alloc + alloc_pages;
+ if (new_page_alloc > GUPCR_VM_MAX_PAGES_PER_THREAD)
+ {
+ __upc_release_lock (&u->lock);
+ return 0;
+ }
+ smem_size = ((off_t)(new_page_alloc * THREADS)) << GUPCR_VM_OFFSET_BITS;
+ if (ftruncate (u->smem_fd, smem_size))
+ {
+ __upc_release_lock (&u->lock);
+ return 0;
+ }
+ for (i = 0; i < alloc_pages; ++i)
+ {
+ const upc_page_num_t p = page_alloc + i;
+ int t;
+ for (t = 0; t < THREADS; ++t)
+ {
+ upc_page_num_t pt = p * THREADS + t;
+ u->gpt[pt] = (page_alloc * THREADS) + (alloc_pages * t) + i;
+ }
+ }
+ GUPCR_WRITE_FENCE ();
+ u->cur_page_alloc = new_page_alloc;
+ GUPCR_FENCE ();
+ __upc_release_lock (&u->lock);
+ return 1;
+}
+
+/* Convert a non-null shared pointer into an address mapped
+ in the current thread's address space. */
+
+void *
+__upc_vm_map_addr (upc_shared_ptr_t p)
+{
+ size_t offset, p_offset;
+ upc_page_num_t pn;
+ int t;
+ void *page_base;
+ void *addr;
+ offset = GUPCR_PTS_OFFSET(p);
+ p_offset = (offset & GUPCR_VM_OFFSET_MASK);
+ pn = (offset >> GUPCR_VM_OFFSET_BITS) & GUPCR_VM_PAGE_MASK;
+ t = GUPCR_PTS_THREAD(p);
+ /* If the page number exceeds the current value maintained
+ by the referencing thread, update to the most current value,
+ and check again. */
+ if (pn >= __upc_cur_page_alloc)
+ {
+ __upc_cur_page_alloc = __upc_vm_get_cur_page_alloc ();
+ if (pn >= __upc_cur_page_alloc)
+ __upc_fatal ("Virtual address in shared address is out of range");
+ }
+ if (t == MYTHREAD)
+ {
+ /* A local reference:
+ Refer to the Local Page Table to find the proper mapping. */
+ page_base = __upc_lpt[pn];
+ }
+ else
+ {
+ /* A global reference to another thread's storage:
+ Refer to the cached map entries in the Global Map Table. */
+ page_base = __upc_vm_map_global_page (t, pn);
+ }
+ /* Update the cached lookup entries. */
+ __upc_page2_ref = __upc_page1_ref;
+ __upc_page2_base = __upc_page1_base;
+ __upc_page1_ref = (pn << GUPCR_THREAD_SIZE) | t;
+ __upc_page1_base = page_base;
+ addr = (char *)page_base + p_offset;
+ return addr;
+}
diff --git a/libgupc/testsuite/Makefile.am b/libgupc/testsuite/Makefile.am
new file mode 100644
index 00000000000..561b7e25448
--- /dev/null
+++ b/libgupc/testsuite/Makefile.am
@@ -0,0 +1,13 @@
+## Process this file with automake to produce Makefile.in.
+
+AUTOMAKE_OPTIONS = foreign dejagnu
+
+# May be used by various substitution variables.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+
+EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
+ echo $(top_builddir)/../expect/expect; else echo expect; fi)
+
+_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
+ echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
+RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
diff --git a/libgupc/testsuite/Makefile.in b/libgupc/testsuite/Makefile.in
new file mode 100644
index 00000000000..c19a223ff41
--- /dev/null
+++ b/libgupc/testsuite/Makefile.in
@@ -0,0 +1,509 @@
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = testsuite
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/enable.m4 \
+ $(top_srcdir)/../config/futex.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/multi.m4 \
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/stdint.m4 \
+ $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 \
+ $(top_srcdir)/ax_prog_doxygen.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DEJATOOL = $(PACKAGE)
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADDR2LINE = @ADDR2LINE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOXYGEN_AUTHOR = @DOXYGEN_AUTHOR@
+DOXYGEN_DATE = @DOXYGEN_DATE@
+DOXYGEN_DATETIME = @DOXYGEN_DATETIME@
+DOXYGEN_HTML_LOGO = @DOXYGEN_HTML_LOGO@
+DOXYGEN_LOGO = @DOXYGEN_LOGO@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_TITLE = @DOXYGEN_TITLE@
+DOXYGEN_VERSION = @DOXYGEN_VERSION@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FILE = @DX_FILE@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_DOT = @HAVE_DOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_GDB = @PATH_TO_GDB@
+PERL = @PERL@
+RANLIB = @RANLIB@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+UPC = @UPC@
+UPCDEPMODE = @UPCDEPMODE@
+UPCFLAGS = @UPCFLAGS@
+VERSION = @VERSION@
+XCFLAGS = @XCFLAGS@
+XLDFLAGS = @XLDFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_UPC = @ac_ct_UPC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bfdinc = @bfdinc@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+config_path = @config_path@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_upc_runtime_debug = @enable_upc_runtime_debug@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libtool_VERSION = @libtool_VERSION@
+link_upc_spec = @link_upc_spec@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+portals4inc = @portals4inc@
+portals4libs = @portals4libs@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+upc_crtbegin_spec = @upc_crtbegin_spec@
+upc_crtend_spec = @upc_crtend_spec@
+upc_crtstuff_cflags = @upc_crtstuff_cflags@
+upc_crtstuff_objs = @upc_crtstuff_objs@
+AUTOMAKE_OPTIONS = foreign dejagnu
+
+# May be used by various substitution variables.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
+ echo $(top_builddir)/../expect/expect; else echo expect; fi)
+
+_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
+ echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
+
+RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign testsuite/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-DEJAGNU: site.exp
+ srcdir='$(srcdir)'; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
+ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+ then :; else exit_status=1; fi; \
+ done; \
+ else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi; \
+ exit $$exit_status
+site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
+ @echo 'Making a new site.exp file...'
+ @echo '## these variables are automatically generated by make ##' >site.tmp
+ @echo '# Do not edit here. If you wish to override these values' >>site.tmp
+ @echo '# edit the last section' >>site.tmp
+ @echo 'set srcdir "$(srcdir)"' >>site.tmp
+ @echo "set objdir `pwd`" >>site.tmp
+ @echo 'set build_alias "$(build_alias)"' >>site.tmp
+ @echo 'set build_triplet $(build_triplet)' >>site.tmp
+ @echo 'set host_alias "$(host_alias)"' >>site.tmp
+ @echo 'set host_triplet $(host_triplet)' >>site.tmp
+ @echo 'set target_alias "$(target_alias)"' >>site.tmp
+ @echo 'set target_triplet $(target_triplet)' >>site.tmp
+ @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
+ echo "## Begin content included from file $$f. Do not modify. ##" \
+ && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
+ && echo "## End content included from file $$f. ##" \
+ || exit 1; \
+ done >> site.tmp
+ @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
+ @if test -f site.exp; then \
+ sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
+ fi
+ @-rm -f site.bak
+ @test ! -f site.exp || mv site.exp site.bak
+ @mv site.tmp site.exp
+
+distclean-DEJAGNU:
+ -rm -f site.exp site.bak
+ -l='$(DEJATOOL)'; for tool in $$l; do \
+ rm -f $$tool.sum $$tool.log; \
+ done
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-DEJAGNU distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \
+ clean-libtool distclean distclean-DEJAGNU distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libgupc/testsuite/config/default.exp b/libgupc/testsuite/config/default.exp
new file mode 100644
index 00000000000..72c7364142c
--- /dev/null
+++ b/libgupc/testsuite/config/default.exp
@@ -0,0 +1,17 @@
+# Copyright (C) 1997-2015 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+load_lib "standard.exp"
diff --git a/libgupc/testsuite/lib/libgupc-dg.exp b/libgupc/testsuite/lib/libgupc-dg.exp
new file mode 100644
index 00000000000..c7dd547452e
--- /dev/null
+++ b/libgupc/testsuite/lib/libgupc-dg.exp
@@ -0,0 +1,77 @@
+proc libgupc-dg-test { prog do_what extra_tool_flags } {
+ return [gcc-dg-test-1 libgupc_target_compile $prog $do_what $extra_tool_flags]
+}
+
+proc libgupc-dg-prune { system text } {
+ return [gcc-dg-prune $system $text]
+}
+
+# Check for portals runtime
+set upc_portals [check_no_compiler_messages portals object {
+ #include "config.h"
+ #ifndef GUPCR_PORTALS_RUNTIME
+ # error UPC runtime is not configured for Portals4
+ #endif
+ } ]
+
+# Check if YOD is supported for UPC program launching
+set upc_runtime_yod [check_no_compiler_messages yod object {
+ #include "config.h"
+ #ifndef GUPCR_JOB_LAUNCHER_YOD
+ # error YOD is not supported
+ #endif
+ } ]
+
+# Find YOD if portals runtime is used
+if { $upc_portals } {
+ # YOD or SLURM?
+ if { $upc_runtime_yod } {
+ set env_var YOD
+ set run_var yod
+ } else {
+ set env_var "SRUN"
+ set run_var "srun"
+ }
+ # Environment variable set?
+ if { [info exists ::env($env_var)] } {
+ set upc_run_cmd $::env($env_var)
+ } else {
+ # Find run command on the exec path
+ set path [split $::env(PATH) ":"]
+ foreach d $path {
+ set upc_run_cmd [file join $d "$run_var"]
+ verbose "UPC checking for $env_var: $run_var in dir: $d" 2
+ if [file executable $upc_run_cmd] {
+ break
+ }
+ }
+ if { [string compare $upc_run_cmd ""] == 0 } {
+ error "UPC: Portals4 run command ($run_var) cannot be found."
+ }
+ verbose "UPC using run command: $upc_run_cmd" 2
+ }
+}
+
+# libgupc_load -- wrapper around default libupc_load to pass an extra
+# argument for dynamic threads UPC tests.
+# For the Portals4 based runtime, use a job scheduler to execute tests.
+
+if { [info procs libgupc_load] != [list] \
+ && [info procs prev_libgupc_load] == [list] } {
+ rename libgupc_load prev_libgupc_load
+
+ proc libgupc_load { program args } {
+ global upc_portals
+ global upc_run_arguments
+ global upc_run_cmd
+
+ if { $upc_portals } {
+ set args [concat $upc_run_arguments $program $args]
+ set program $upc_run_cmd
+ } else {
+ set args [concat $upc_run_arguments $args]
+ }
+
+ return [prev_libgupc_load $program $args]
+ }
+}
diff --git a/libgupc/testsuite/lib/libgupc.exp b/libgupc/testsuite/lib/libgupc.exp
new file mode 100644
index 00000000000..0ec1b20c1e5
--- /dev/null
+++ b/libgupc/testsuite/lib/libgupc.exp
@@ -0,0 +1,257 @@
+# Damn dejagnu for not having proper library search paths for load_lib.
+# We have to explicitly load everything that gcc-dg.exp wants to load.
+
+proc load_gcc_lib { filename } {
+ global srcdir loaded_libs
+
+ load_file $srcdir/../../gcc/testsuite/lib/$filename
+ set loaded_libs($filename) ""
+}
+
+load_lib dg.exp
+
+# Required to use gcc-dg.exp - however, the latter should NOT be
+# loaded until ${tool}_target_compile is defined since it uses that
+# to determine default LTO options.
+
+load_gcc_lib multiline.exp
+load_gcc_lib prune.exp
+load_gcc_lib target-libpath.exp
+load_gcc_lib wrapper.exp
+load_gcc_lib target-supports.exp
+load_gcc_lib target-utils.exp
+load_gcc_lib gcc-defs.exp
+load_gcc_lib timeout.exp
+load_gcc_lib file-format.exp
+load_gcc_lib target-supports-dg.exp
+load_gcc_lib scanasm.exp
+load_gcc_lib scandump.exp
+load_gcc_lib scanrtl.exp
+load_gcc_lib scantree.exp
+load_gcc_lib scanipa.exp
+load_gcc_lib timeout-dg.exp
+load_gcc_lib torture-options.exp
+load_gcc_lib fortran-modules.exp
+
+set dg-do-what-default run
+
+#
+# GCC_UNDER_TEST is the compiler under test.
+#
+
+set libgupc_compile_options ""
+
+#
+# libgupc_init
+#
+
+if [info exists TOOL_OPTIONS] {
+ set multilibs [get_multilibs $TOOL_OPTIONS]
+} else {
+ set multilibs [get_multilibs]
+}
+
+proc libgupc_init { args } {
+ global srcdir blddir objdir tool_root_dir
+ global libgupc_initialized
+ global tmpdir
+ global blddir
+ global gluefile wrap_flags
+ global ALWAYS_CFLAGS
+ global CFLAGS
+ global TOOL_EXECUTABLE TOOL_OPTIONS
+ global GCC_UNDER_TEST
+ global TESTING_IN_BUILD_TREE
+ global target_triplet
+ global always_ld_library_path
+
+ set blddir [lookfor_file [get_multilibs] libgupc]
+
+ # We set LC_ALL and LANG to C so that we get the same error
+ # messages as expected.
+ setenv LC_ALL C
+ setenv LANG C
+
+ # Many hosts now default to a non-ASCII C locale, however, so
+ # they can set a charset encoding here if they need.
+ if { [ishost "*-*-cygwin*"] } {
+ setenv LC_ALL C.ASCII
+ setenv LANG C.ASCII
+ }
+
+ if ![info exists GCC_UNDER_TEST] then {
+ if [info exists TOOL_EXECUTABLE] {
+ set GCC_UNDER_TEST $TOOL_EXECUTABLE
+ } else {
+ set GCC_UNDER_TEST "[find_gcc]"
+ }
+ }
+
+ if ![info exists tmpdir] {
+ set tmpdir "/tmp"
+ }
+
+ if [info exists gluefile] {
+ unset gluefile
+ }
+
+ if {![info exists CFLAGS]} {
+ set CFLAGS ""
+ }
+
+ # Locate libgcc.a so we don't need to account for different values of
+ # SHLIB_EXT on different platforms
+ set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
+ if {$gccdir != ""} {
+ set gccdir [file dirname $gccdir]
+ }
+
+ # Compute what needs to be put into LD_LIBRARY_PATH
+ set always_ld_library_path ".:${blddir}/.libs"
+
+ # Compute what needs to be added to the existing LD_LIBRARY_PATH.
+ if {$gccdir != ""} {
+ # Add AIX pthread directory first.
+ if { [llength [glob -nocomplain ${gccdir}/pthread/libgcc_s*.a]] >= 1 } {
+ append always_ld_library_path ":${gccdir}/pthread"
+ }
+ append always_ld_library_path ":${gccdir}"
+ set compiler [lindex $GCC_UNDER_TEST 0]
+
+ if { [is_remote host] == 0 && [which $compiler] != 0 } {
+ foreach i "[exec $compiler --print-multi-lib]" {
+ set mldir ""
+ regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
+ set mldir [string trimright $mldir "\;@"]
+ if { "$mldir" == "." } {
+ continue
+ }
+ if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
+ append always_ld_library_path ":${gccdir}/${mldir}"
+ }
+ }
+ }
+ }
+
+ set ALWAYS_CFLAGS ""
+ if { $blddir != "" } {
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
+ # targets that use libgupc.a%s in their specs need a -B option
+ # for uninstalled testing.
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
+ lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
+ # Add -I of source include directory for upc.h, gcc-upc.h, etc.
+ lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/../include"
+ lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+ }
+ lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
+
+ # We use atomic operations in the testcases to validate results.
+ if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
+ && [check_effective_target_ia32] } {
+ lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
+ }
+
+ if [istarget *-*-darwin*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
+ }
+
+ if [istarget sparc*-*-*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-mcpu=v9"
+ }
+
+ if [info exists TOOL_OPTIONS] {
+ lappend ALWAYS_CFLAGS "additional_flags=$TOOL_OPTIONS"
+ }
+
+ # Make sure that lines are not wrapped. That can confuse the
+ # error-message parsing machinery.
+ lappend ALWAYS_CFLAGS "additional_flags=-fmessage-length=0"
+
+ # Disable caret
+ lappend ALWAYS_CFLAGS "additional_flags=-fno-diagnostics-show-caret"
+
+ # Disable color diagnostics
+ lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
+}
+
+#
+# libgupc_target_compile -- compile a source file
+#
+
+proc libgupc_target_compile { source dest type options } {
+ global blddir
+ global libgupc_compile_options
+ global gluefile wrap_flags
+ global ALWAYS_CFLAGS
+ global GCC_UNDER_TEST
+ global lang_test_file
+ global lang_library_path
+ global lang_link_flags
+ global lang_include_flags
+ global lang_source_re
+ global upc_run_arguments
+ global upc_portals
+
+ # Save compile options for later parsing
+ set compile_flags $options
+
+ if { [info exists lang_test_file] } {
+ if { $blddir != "" } {
+ # Some targets use libgfortran.a%s in their specs, so they need
+ # a -B option for uninstalled testing.
+ lappend options "additional_flags=-B${blddir}/${lang_library_path}"
+ lappend options "ldflags=-L${blddir}/${lang_library_path}"
+ }
+ lappend options "ldflags=${lang_link_flags}"
+ if { [info exists lang_include_flags] \
+ && [regexp ${lang_source_re} ${source}] } {
+ lappend options "additional_flags=${lang_include_flags}"
+ }
+ }
+
+ if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
+ lappend options "libs=${gluefile}"
+ lappend options "ldflags=${wrap_flags}"
+ }
+
+ lappend options "additional_flags=[libio_include_flags]"
+ lappend options "timeout=[timeout_value]"
+ lappend options "compiler=$GCC_UNDER_TEST"
+
+ set options [concat $libgupc_compile_options $options]
+
+ if [info exists ALWAYS_CFLAGS] {
+ set options [concat "$ALWAYS_CFLAGS" $options]
+ }
+
+ set options [dg-additional-files-options $options $source]
+
+ # Set the default number of threads to 4.
+ set threads 4
+ # If the number of threads was given at compile time, use that.
+ regexp ".*-fupc-threads\[-=](\\d+)" \
+ $compile_flags "" threads
+ set upc_run_arguments "-n $threads"
+
+ set result [target_compile $source $dest $type $options]
+
+ return $result
+}
+
+proc libgupc_option_help { } {
+ send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n"
+}
+
+proc libgupc_option_proc { option } {
+ if [regexp "^--additional_options," $option] {
+ global libgupc_compile_options
+ regsub "--additional_options," $option "" option
+ foreach x [split $option ","] {
+ lappend libgupc_compile_options "additional_flags=$x"
+ }
+ return 1
+ } else {
+ return 0
+ }
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/ChangeLog b/libgupc/testsuite/libgupc.upc/intrepid/ChangeLog
new file mode 100644
index 00000000000..90bb9c7dbe2
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/ChangeLog
@@ -0,0 +1,146 @@
+2015-09-21 Gary Funck <gary@intrepid.com>
+
+ * test05.upc: Remove dependency upon stable values for gaps
+ in a struct.
+
+2014-04-16 Gary Funck <gary@intrepid.com>
+
+ * test26..upc: Add test case for comparisons involving
+ generic pointer-to-shared operands.
+
+2013-06-07 Nenad Vukicevic <nenad@intrepid.com>
+
+ * test07.upc: Split test into two separate compilation units.
+ * test07_sep.upc: New.
+ * test08.upc: Split test into two separate compilation units.
+ * test08_sep.upc: New.
+
+2012-09-26 Gary Funck <gary@intrepid.com>
+
+ * test31.upc: Make the timing check more tolerant.
+
+2012-09-26 Gary Funck <gary@intrepid.com>
+
+ * test17.upc: Call upc_all_lock_free.
+ * test18.upc: Call upc_all_free, upc_all_lock_free,
+ and call upc_alloc instead of deprecated upc_local_alloc.
+ * test19.upc: Call upc_all_free.
+ * test20.upc: Call upc_all_free.
+ * test21.upc: Call upc_all_free.
+ * test22.upc: Call upc_alloc instead of deprecated upc_local_alloc.
+ * test24.upc: Call upc_alloc instead of deprecated upc_local_alloc.
+ * test28.upc: Call upc_all_lock_free.
+ * test31.upc: New. Test UPC wall-clock timer (upc_tick) library.
+
+2012-08-14 Gary Funck <gary@intrepid.com>
+
+ * test29.upc: handle sprintf overflow on systems that
+ do no provide correct support for long double
+
+2012-08-09 Gary Funck <gary@intrepid.com>
+
+ * test27.upc (fold_address_of_test): New.
+ Implement test for correct handling of &array[0].field
+ where 'array' is a UPC shared array.
+ Improve formatting and indentation.
+
+2012-07-25 Gary Funck <gary@intrepid.com>
+
+ * test26.upc: Implement check for 6.4.2p6 conformance
+ and improve formatting and indentation.
+
+2012-01-04 Gary Funck <gary@intrepid.com>
+
+ * test18.upc: Revert lost GCC/UPC -> GUPC change.
+ * test28.upc: Ditto.
+ * test30.upc: Ditto.
+
+2012-01-04 Gary Funck <gary@intrepid.com>
+
+ * test00.upc: Fix spelling errors and split long lines.
+ * test03.upc: Ditto.
+ * test04.upc: Ditto.
+ * test07.upc: Ditto.
+ * test08.upc: Ditto.
+ * test12.upc: Ditto.
+ * test14.upc: Ditto.
+ * test15.upc: Ditto.
+ * test16.upc: Ditto.
+ * test17.upc: Ditto.
+ * test18.upc: Ditto.
+ * test19.upc: Ditto.
+ * test20.upc: Ditto.
+ * test21.upc: Ditto.
+ * test22.upc: Ditto.
+ * test23.upc: Ditto.
+ * test24.upc: Ditto.
+ * test25.upc: Ditto.
+ * test26.upc: Ditto.
+ * test27.upc: Ditto.
+ * test28.upc: Ditto.
+ * test30.upc: Ditto.
+
+2011-10-25 Gary Funck <gary@intrepid.com>
+
+ Re-fix typo in previous commit.
+
+2011-10-24 Gary Funck <gary@intrepid.com>
+
+ * test21.upc: Fix typo in "passed" message. Terminate with '.'.
+ * test24.upc: Ditto.
+ * test25.upc: Ditto.
+ * test30.upc: Ditto.
+
+2011-10-26 Gary Funck <gary@intrepid.com>
+
+ Rename "GCC/UPC" to "GNU UPC", "UPC" to "GUPC", and
+ "libupc" to "libgupc".
+ * test18.upc: Change "GCC/UPC" to "GNU UPC".
+ * test28.upc: Ditto.
+ * test30.upc: Ditto.
+
+2011-09-07 Gary Funck <gary@intrepid.com>
+
+ * test30.upc: Fix spelling error in diagnostic message.
+
+2011-09-07 Gary Funck <gary@intrepid.com>
+
+ * test30.upc: New. Missed in previous commit.
+ Print "pass" even when compiled with packed
+ UPC pointer-to-shared configuration.
+
+2011-09-07 Gary Funck <gary@intrepid.com>
+
+ * test30.upc: New. Test UPC pointer-to-shared alignment
+ for struct PTS.
+
+2011-02-08 Gary Funck <gary@intrepid.com>
+
+ * test00.upc, test01.upc, test02.upc, test03.upc, test04.upc,
+ test05.upc, test06.upc, test07.upc, test08.upc, test09.upc,
+ test10.upc, test11.upc, test12.upc, test13.upc, test14.upc,
+ test15.upc, test16.upc, test17.upc, test18.upc, test19.upc,
+ test20.upc, test21.upc, test22.upc, test23.upc, test24.upc,
+ test25.upc, test26.upc, test27.upc, test28.upc, test29.upc:
+ Update copyright notices.
+
+2010-11-28 Gary Funck <gary@intrepid.com>
+
+ Merge GCC/UPC 4.5.1.2 changes into gupc branch.
+ * test18.upc: Add new test for ICE when compiling
+ a declaration of the form:
+ shared [*] int A[THREADS][16];
+ when compiled in a dynamic THREADS context.
+ Conditionally defined __attribute__()
+ to match the non- GCC-specific version of this test.
+ * test29.upc: New test.
+ Add a test for operations on 'shared long double types'.
+
+2010-07-03 Gary Funck <gary@intrepid.com>
+
+ Merge trunk version 161517 into gupc branch.
+ * test18.upc:
+ Add 'unused' attributes to avoid "set, but
+ not referenced" warnings.
+ * test19.upc:
+ Likewise.
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test00.upc b/libgupc/testsuite/libgupc.upc/intrepid/test00.upc
new file mode 100644
index 00000000000..69d60f8f15d
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test00.upc
@@ -0,0 +1,107 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+shared char x1;
+shared short x2;
+shared int x3;
+shared long long x4;
+shared float x5;
+shared double x6;
+
+#define CHAR_VAL 0x7f
+#define SHORT_VAL 0x1234
+#define INT_VAL 0x12345678
+#define LL_VAL 0x1234567887654321LL
+
+#define SF_VAL 1193046.0
+#define DF_VAL 20015998343868.0
+
+void
+test00 ()
+{
+ if (MYTHREAD == 0)
+ {
+ x1 = CHAR_VAL;
+ x2 = SHORT_VAL;
+ x3 = INT_VAL;
+ x4 = LL_VAL;
+ x5 = SF_VAL;
+ x6 = DF_VAL;
+ }
+ upc_barrier;
+ if (x1 != CHAR_VAL)
+ {
+ fprintf (stderr, "%d: Error %s : %d = %d\n",
+ MYTHREAD, "char", x1, CHAR_VAL);
+ abort ();
+ }
+ if (x2 != SHORT_VAL)
+ {
+ fprintf (stderr, "%d: Error %s : %d = %d\n",
+ MYTHREAD, "short", x2, SHORT_VAL);
+ abort ();
+ }
+ if (x3 != INT_VAL)
+ {
+ fprintf (stderr, "%d: Error %s : %d = %d\n",
+ MYTHREAD, "int", x3, INT_VAL);
+ abort ();
+ }
+ if (x4 != LL_VAL)
+ {
+ fprintf (stderr, "%d: Error %s : %lld = %lld\n",
+ MYTHREAD, "long long", x4, LL_VAL);
+ abort ();
+ }
+ if (x5 != SF_VAL)
+ {
+ fprintf (stderr, "%d: Error %s : %f = %f\n",
+ MYTHREAD, "float", x5, SF_VAL);
+ abort ();
+ }
+ if (x6 != DF_VAL)
+ {
+ fprintf (stderr, "%d: Error %s : %f = %f\n",
+ MYTHREAD, "double", x6, DF_VAL);
+ abort ();
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ printf ("test00: access shared scalars - passed.\n");
+ }
+}
+
+int
+main ()
+{
+ test00 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test01.upc b/libgupc/testsuite/libgupc.upc/intrepid/test01.upc
new file mode 100644
index 00000000000..69efa819a19
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test01.upc
@@ -0,0 +1,65 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FACTOR 100
+shared int array[FACTOR * THREADS];
+
+void
+test01 ()
+{
+ int i;
+ for (i = MYTHREAD; i < FACTOR * THREADS; i += THREADS)
+ {
+ array[i] = i + 1;
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < FACTOR * THREADS; ++i)
+ {
+ int got = array[i];
+ int expected = i + 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "test01: Error at element %d. Expected %d, got %d\n",
+ i, expected, got);
+ abort ();
+ }
+ }
+ printf ("test01: simple array test - passed.\n");
+ }
+}
+
+int
+main ()
+{
+ test01 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test02.upc b/libgupc/testsuite/libgupc.upc/intrepid/test02.upc
new file mode 100644
index 00000000000..683253c3c7a
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test02.upc
@@ -0,0 +1,70 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#define DIM1 1024
+
+shared int array[DIM1][THREADS];
+
+void
+test02 ()
+{
+ int i, j;
+ for (i = 0; i < DIM1; ++i)
+ {
+ array[i][MYTHREAD] = (i + 1) * (MYTHREAD + 1);
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < DIM1; ++i)
+ {
+ for (j = 0; j < THREADS; ++j)
+ {
+ int got = array[i][j];
+ int expected = (i + 1) * (j + 1);
+ if (got != expected)
+ {
+ fprintf (stderr, "test02: Error at element [%d,%d]. Expected %d, got %d\n",
+ i, j, expected, got);
+ abort ();
+ }
+ }
+ }
+ printf ("test02: simple 2-dimensional array test - passed.\n");
+ }
+}
+
+int
+main ()
+{
+ test02 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test03.upc b/libgupc/testsuite/libgupc.upc/intrepid/test03.upc
new file mode 100644
index 00000000000..cb00ef1e918
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test03.upc
@@ -0,0 +1,85 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+struct data_struct
+{
+ char x1;
+ short x2;
+ int x3;
+ long long x4;
+};
+
+shared struct data_struct s;
+
+void
+test03 ()
+{
+ if (MYTHREAD == 0)
+ {
+ s.x1 = 127;
+ s.x2 = -2;
+ s.x3 = -3;
+ s.x4 = -4;
+ }
+ upc_barrier;
+ if (s.x1 != 127)
+ {
+ fprintf (stderr, "%d: Error %s : %d = 255\n", MYTHREAD, "char", s.x1);
+ abort ();
+ }
+ if (s.x2 != -2)
+ {
+ fprintf (stderr, "%d: Error %s : %d = -2\n", MYTHREAD, "short", s.x2);
+ abort ();
+ }
+ if (s.x3 != -3)
+ {
+ fprintf (stderr, "%d: Error %s : %d = -3\n", MYTHREAD, "int", s.x3);
+ abort ();
+ }
+ if (s.x4 != -4)
+ {
+ fprintf (stderr, "%d: Error %s : %lld = -4\n",
+ MYTHREAD, "long long", s.x4);
+ abort ();
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ printf ("test03 (access shared struct) - passed.\n");
+ }
+}
+
+int
+main ()
+{
+ test03 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test04.upc b/libgupc/testsuite/libgupc.upc/intrepid/test04.upc
new file mode 100644
index 00000000000..190c73eeab9
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test04.upc
@@ -0,0 +1,106 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+shared char x1;
+shared short x2;
+shared int x3;
+shared long long x4;
+
+
+void
+set_proc (shared char *p1, char v1, shared short *p2,
+ short v2, shared int *p3, int v3, shared long long *p4,
+ long long v4)
+{
+ *p1 = v1;
+ *p2 = v2;
+ *p3 = v3;
+ *p4 = v4;
+}
+
+void
+get_proc (shared char *p1, char *v1, shared short *p2,
+ short *v2, shared int *p3, int *v3, shared long long *p4,
+ long long *v4)
+{
+ *v1 = *p1;
+ *v2 = *p2;
+ *v3 = *p3;
+ *v4 = *p4;
+}
+
+void
+test04 ()
+{
+ char xv1;
+ short xv2;
+ int xv3;
+ long long xv4;
+ if (MYTHREAD == 0)
+ {
+ set_proc (&x1, 127, &x2, -2, &x3, -3, &x4, -4);
+ }
+ upc_barrier;
+ get_proc (&x1, &xv1, &x2, &xv2, &x3, &xv3, &x4, &xv4);
+ if (xv1 != 127)
+ {
+ fprintf (stderr, "%d: Error %s : %d = 127\n", MYTHREAD, "char", xv1);
+ abort ();
+ }
+ if (xv2 != -2)
+ {
+ fprintf (stderr, "%d: Error %s : %d = -2\n", MYTHREAD, "short", xv2);
+ abort ();
+ }
+ if (xv3 != -3)
+ {
+ fprintf (stderr, "%d: Error %s : %d = -3\n", MYTHREAD, "int", xv3);
+ abort ();
+ }
+ if (xv4 != -4)
+ {
+ fprintf (stderr, "%d: Error %s : %lld = -4\n", MYTHREAD, "long long",
+ xv4);
+ abort ();
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ printf ("test04 (access shared values via"
+ " (shared *) parameters) - passed.\n");
+ }
+}
+
+int
+main ()
+{
+ test04 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test05.upc b/libgupc/testsuite/libgupc.upc/intrepid/test05.upc
new file mode 100644
index 00000000000..6d6ad150eb2
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test05.upc
@@ -0,0 +1,102 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct data_struct
+ {
+ char x1;
+ short x2;
+ int x3;
+ long long x4;
+ int x5[5];
+ };
+
+#define FACTOR 10
+shared struct data_struct array[FACTOR*THREADS];
+
+void
+test05()
+{
+ int i, j;
+ for (i = MYTHREAD; i < FACTOR*THREADS; i += THREADS)
+ {
+ struct data_struct * const s = (struct data_struct *)&array[i];
+ s->x1 = i*4 + 1;
+ s->x2 = i*4 + 2;
+ s->x3 = i*4 + 3;
+ s->x4 = i*4 + 4;
+ for (j = 0; j < 5; ++j)
+ s->x5[j] = i*4 + j + 5;
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < FACTOR*THREADS; ++i)
+ {
+ struct data_struct got = array[i];
+ struct data_struct expected;
+ expected.x1 = i*4 + 1;
+ expected.x2 = i*4 + 2;
+ expected.x3 = i*4 + 3;
+ expected.x4 = i*4 + 4;
+ for (j = 0; j < 5; ++j)
+ expected.x5[j] = i*4 + j + 5;
+ if ((got.x1 != expected.x1)
+ || (got.x2 != expected.x2)
+ || (got.x3 != expected.x3)
+ || (got.x4 != expected.x4)
+ || (got.x5[0] != expected.x5[0])
+ || (got.x5[1] != expected.x5[1])
+ || (got.x5[2] != expected.x5[2])
+ || (got.x5[3] != expected.x5[3])
+ || (got.x5[4] != expected.x5[4]))
+ {
+ fprintf(stderr, "test05: error at element %d."
+ " Expected (%d,%d,%d,%lld,%d,%d,%d,%d,%d),"
+ " got (%d,%d,%d,%lld,%d,%d,%d,%d,%d)\n",
+ i, expected.x1, expected.x2, expected.x3, expected.x4,
+ expected.x5[0], expected.x5[1], expected.x5[2],
+ expected.x5[3], expected.x5[4],
+ got.x1, got.x2, got.x3, got.x4,
+ got.x5[0], got.x5[1], got.x5[2], got.x5[3], got.x5[4]);
+ abort ();
+ }
+ }
+ printf ("test05: access structured shared array element\n"
+ " using a local pointer - passed.\n");
+ }
+}
+
+int
+main()
+{
+ test05 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test06.upc b/libgupc/testsuite/libgupc.upc/intrepid/test06.upc
new file mode 100644
index 00000000000..48eff4df21a
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test06.upc
@@ -0,0 +1,68 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FACTOR 100
+shared int array[FACTOR*THREADS];
+
+void
+test06()
+{
+ int i;
+ for (i = MYTHREAD; i < FACTOR*THREADS; i += THREADS)
+ {
+ /* declare, and use a local pointer */
+ int *s = (int *)&array[i];
+ *s = i+1;
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < FACTOR*THREADS; ++i)
+ {
+ shared int *got;
+ int expected = i+1;
+ got = (shared int *)&array[i];
+ if (*got != expected)
+ {
+ fprintf(stderr, "test06: error at element %d. Expected %d, got %d\n",
+ i, expected, *got);
+ abort ();
+ }
+ }
+ printf ("test06: test shared->local, and shared pointers - passed.\n");
+ }
+}
+
+int
+main()
+{
+ test06 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test07.upc b/libgupc/testsuite/libgupc.upc/intrepid/test07.upc
new file mode 100644
index 00000000000..22855327e7b
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test07.upc
@@ -0,0 +1,44 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* { dg-additional-sources "test07_sep.upc" } */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FACTOR 100
+
+shared int array[FACTOR*THREADS];
+
+extern void test07 (); /* separate */
+
+int
+main()
+{
+ test07 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test07_sep.upc b/libgupc/testsuite/libgupc.upc/intrepid/test07_sep.upc
new file mode 100644
index 00000000000..e9bcf3dc393
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test07_sep.upc
@@ -0,0 +1,60 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* { dg-do compile } */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FACTOR 100
+
+void
+test07 ()
+{
+ extern shared int array[FACTOR * THREADS];
+ int i;
+ for (i = MYTHREAD; i < FACTOR * THREADS; i += THREADS)
+ {
+ array[i] = i + 1;
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < FACTOR * THREADS; ++i)
+ {
+ int got = array[i];
+ int expected = i + 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "test07: error at element %d. Expected %d, got %d\n",
+ i, expected, got);
+ abort ();
+ }
+ }
+ printf ("test07: simple external shared array test - passed.\n");
+ }
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test08.upc b/libgupc/testsuite/libgupc.upc/intrepid/test08.upc
new file mode 100644
index 00000000000..6233ee759ed
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test08.upc
@@ -0,0 +1,44 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* { dg-additional-sources "test08_sep.upc" } */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define DIM1 1024
+
+shared int array[DIM1][THREADS];
+
+extern void test08 (); /* separate */
+
+int
+main()
+{
+ test08 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test08_sep.upc b/libgupc/testsuite/libgupc.upc/intrepid/test08_sep.upc
new file mode 100644
index 00000000000..d7087388bde
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test08_sep.upc
@@ -0,0 +1,63 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* { dg-do compile } */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define DIM1 1024
+
+void
+test08 ()
+{
+ extern shared int array[DIM1][THREADS];
+ int i, j;
+ for (i = 0; i < DIM1; ++i)
+ {
+ array[i][MYTHREAD] = (i + 1) * (MYTHREAD + 1);
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < DIM1; ++i)
+ {
+ for (j = 0; j < THREADS; ++j)
+ {
+ int got = array[i][j];
+ int expected = (i + 1) * (j + 1);
+ if (got != expected)
+ {
+ fprintf (stderr, "test08: error at element [%d,%d]. Expected %d, got %d\n",
+ i, j, expected, got);
+ abort ();
+ }
+ }
+ }
+ printf ("test08: simple external 2-dimensional array test - passed.\n");
+ }
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test09.upc b/libgupc/testsuite/libgupc.upc/intrepid/test09.upc
new file mode 100644
index 00000000000..930a877e3f9
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test09.upc
@@ -0,0 +1,74 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define BLKSIZE 25
+#define BLKS_PER_THREAD 4
+#define FACTOR (BLKSIZE*BLKS_PER_THREAD)
+#define NELEM (FACTOR*THREADS)
+
+shared [BLKSIZE] int array[NELEM];
+
+void
+test09()
+{
+ int i, j;
+ for (i = 0; i < BLKS_PER_THREAD; ++i)
+ {
+ int blk_index = (MYTHREAD + i * THREADS) * BLKSIZE;
+ int *block = (int *)&array[blk_index];
+ for (j = 0; j < BLKSIZE; ++j)
+ {
+ block[j] = blk_index + j + 1;
+ }
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < NELEM; ++i)
+ {
+ int got = array[i];
+ int expected = i+1;
+ if (got != expected)
+ {
+ fprintf(stderr, "test09: error at element %d. Expected %d, got %d\n",
+ i, expected, got);
+ abort ();
+ }
+ }
+ printf ("test09: simple blocked array test - passed.\n");
+ }
+}
+
+int
+main()
+{
+ test09 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test10.upc b/libgupc/testsuite/libgupc.upc/intrepid/test10.upc
new file mode 100644
index 00000000000..11cdb0f0e65
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test10.upc
@@ -0,0 +1,80 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#define DIM1 1024
+
+shared int array[DIM1][THREADS];
+
+void
+test10()
+{
+ int i, j;
+ upc_forall (i = 0; i < DIM1; ++i; continue)
+ {
+ upc_forall (j = 0; j < THREADS; ++j; &array[i][j])
+ {
+ if (upc_threadof(&array[i][j]) != (size_t) MYTHREAD)
+ {
+ fprintf (stderr, "test10: error at element [%d,%d]."
+ " Does not have affinity with thread %d, inside"
+ " nested upc_forall.\n", i, j, MYTHREAD);
+ abort ();
+ }
+ array[i][j] = (i+1)*(MYTHREAD + 1);
+ }
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < DIM1; ++i)
+ {
+ for (j = 0; j < THREADS; ++j)
+ {
+ int got = array[i][j];
+ int expected = (i + 1) * (j + 1);
+ if (got != expected)
+ {
+ fprintf(stderr, "test10: error at element [%d,%d]. Expected %d, got %d\n",
+ i, j, expected, got);
+ abort ();
+ }
+ }
+ }
+ printf ("test10: nested upc_forall test - passed.\n");
+ }
+}
+
+int
+main()
+{
+ test10 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test11.upc b/libgupc/testsuite/libgupc.upc/intrepid/test11.upc
new file mode 100644
index 00000000000..0dc135e27b2
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test11.upc
@@ -0,0 +1,72 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FACTOR 100
+shared int array[FACTOR][THREADS];
+
+void
+test11()
+{
+ int i, j;
+ for (i = 0; i < FACTOR; i += 1)
+ {
+ /* declare, and use a local pointer */
+ int *s = (int *)&array[i][MYTHREAD];
+ *s = (i+1) * (MYTHREAD + 1);
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < FACTOR; ++i)
+ {
+ for (j = 0; j < THREADS; ++j)
+ {
+ shared int *got;
+ int expected = (i+1) * (j+1);
+ got = (shared int *)&array[i][j];
+ if (*got != expected)
+ {
+ fprintf(stderr, "test11: error at element %d. Expected %d, got %d\n",
+ i, expected, *got);
+ abort ();
+ }
+ }
+ }
+ printf ("test11: test shared->local, and shared pointers"
+ " using two-dimensional array - passed.\n");
+ }
+}
+
+int
+main()
+{
+ test11 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test12.upc b/libgupc/testsuite/libgupc.upc/intrepid/test12.upc
new file mode 100644
index 00000000000..a7ac0377d12
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test12.upc
@@ -0,0 +1,95 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* This test replicates a problem where incorrect code was generated
+ whenever an intervening declaration of a type that has the same type
+ as the basic element type of a shared array whose dimension included
+ a reference to THREADS. In that situation, the compiler "forgot"
+ to scale all references to the array, by THREADS (when compiled in
+ the dynamic compilation environment. */
+
+#define FACTOR 100
+shared int a[FACTOR][THREADS];
+/* following variable is not used, but is required to demonstrate problem */
+#if !defined(__GNUC__) && !defined(__attribute__)
+#define __attribute__(X)
+#endif
+shared int unused_var __attribute__ ((unused));
+shared int *Ptr;
+
+void
+test12 ()
+{
+ int i, j;
+ int got, expected;
+ for (i = 0; i < FACTOR; ++i)
+ {
+ Ptr = &a[i][MYTHREAD];
+ got = upc_threadof(Ptr);
+ expected = MYTHREAD;
+ if (got != MYTHREAD)
+ {
+ fprintf (stderr, "Error at element [%d,%d]."
+ " Address of array element has affinity %d,"
+ " but should have affinity to this thread (%d).\n",
+ i, MYTHREAD, got, expected);
+ abort ();
+ }
+ *Ptr = i * THREADS + MYTHREAD;
+ }
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ for (i = 0; i < FACTOR; ++i)
+ {
+ for (j = 0; j < THREADS; ++j)
+ {
+ expected = i * THREADS + j;
+ got = a[i][j];
+ if (got != expected)
+ {
+ fprintf (stderr, "Error at element [%d,%d]."
+ " Got `%d', expected `%d'.\n",
+ i, j, got, expected);
+ abort ();
+ }
+ }
+ }
+ printf ("test12: test multi-dimension array accesses\n"
+ " in a dynamic compilation environment - passed.\n");
+ }
+}
+
+int
+main ()
+{
+ test12 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test13.upc b/libgupc/testsuite/libgupc.upc/intrepid/test13.upc
new file mode 100644
index 00000000000..e5edda5a1ba
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test13.upc
@@ -0,0 +1,79 @@
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* This test calculates the difference between two shared pointers.
+ Further, it declares shared pointers in a stack local context. */
+
+shared int vec[THREADS];
+
+size_t
+ptr_diff(shared int *p1, shared int *p2)
+{
+ return p1 - p2;
+}
+
+void
+test13()
+{
+ size_t s1, s2;
+ shared int *p_t, *p_0;
+ p_t = &vec[THREADS - 1];
+ p_0 = &vec[0];
+ s1 = ptr_diff(p_t, p_0);
+ s2 = p_t - p_0;
+ if (s1 != (size_t)(THREADS - 1))
+ {
+ fprintf (stderr, "Error in pointer difference,"
+ " got: %lld, expected: %lld.\n",
+ (long long)s1, (long long)(THREADS - 1));
+ abort ();
+ }
+ if (s1 != s2)
+ {
+ fprintf (stderr, "Error in pointer difference,"
+ " s1: %lld not equal to s2: %lld.\n",
+ (long long)s1, (long long)s2);
+ abort ();
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ printf ("test13: test pointer difference and local declaration"
+ " of shared pointers - passed.\n");
+ }
+}
+
+int
+main ()
+{
+ test13 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test14.upc b/libgupc/testsuite/libgupc.upc/intrepid/test14.upc
new file mode 100644
index 00000000000..05d66e702e5
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test14.upc
@@ -0,0 +1,78 @@
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+void
+test14 ()
+{
+ int shared * res;
+ int *p;
+ res = 0;
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ if (res)
+ {
+ fprintf (stderr, "Error: null PTS test 'if (res)' failed.\n");
+ abort ();
+ }
+ if (res != 0)
+ {
+ fprintf (stderr, "Error: null PTS test 'if (res !=0)' failed.\n");
+ abort ();
+ }
+ p = (int *)res;
+ if (p)
+ {
+ fprintf (stderr, "Error: null PTS to local test 'if (p)' failed.\n");
+ abort ();
+ }
+ if ((int *) res != 0)
+ {
+ fprintf (stderr, "Error: null PTS to local "
+ "test 'if ((int *) res != 0)' failed.\n");
+ abort ();
+ }
+ if (0 != (int *) res)
+ {
+ fprintf (stderr, "Error: null PTS to local "
+ "test 'if (0 != (int *) res)' failed.\n");
+ abort ();
+ }
+ printf ("test14: test assignment, comparison, and "
+ "conversion of a null shared pointer - passed.\n");
+ }
+}
+
+int main ()
+{
+ test14 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test15.upc b/libgupc/testsuite/libgupc.upc/intrepid/test15.upc
new file mode 100644
index 00000000000..729ca1b834d
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test15.upc
@@ -0,0 +1,81 @@
+/* Copyright (C) 2004-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FACTOR 100
+shared int array[FACTOR*THREADS];
+
+void
+test15()
+{
+ int i;
+ shared int *p;
+ for (i = MYTHREAD; i < FACTOR*THREADS; i += THREADS)
+ {
+ array[i] = i+1;
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ p = &array[0];
+ for (i = 0; i < FACTOR*THREADS; ++i)
+ {
+ int expected = i+1;
+ int got = *p++;
+ if (got != expected)
+ {
+ fprintf(stderr, "test15: error at element %d. Expected %d, got %d\n",
+ i, expected, got);
+ abort ();
+ }
+ }
+ /* C standard allows pointers to last element plus one */
+ p = &array[FACTOR*THREADS];
+ for (i = FACTOR*THREADS-1; i >= 0; --i)
+ {
+ int expected = i+1;
+ int got = *--p;
+ if (got != expected)
+ {
+ fprintf(stderr, "test15: error at element %d. Expected %d, got %d\n",
+ i, expected, got);
+ abort ();
+ }
+ }
+ printf ("test15: test increment/decrement operations "
+ "on shared pointers - passed.\n");
+ }
+}
+
+int
+main()
+{
+ test15 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test16.upc b/libgupc/testsuite/libgupc.upc/intrepid/test16.upc
new file mode 100644
index 00000000000..5c48900f686
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test16.upc
@@ -0,0 +1,80 @@
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <upc.h>
+
+#define BLKSIZE 10
+int shared [BLKSIZE] a[100*THREADS];
+
+struct row {
+ int x, y, z;
+ };
+
+/* Triples of random integers in the range 1..99 */
+struct row data[20] = {
+ {23,29,84}, {15,58,19}, {81,17,48}, {15,36,49},
+ {10,63,1}, {72,10,48}, {25,67,89}, {75,72,90},
+ {92,37,89}, {77,32,19}, {99,16,70}, {50,93,71},
+ {10,20,55}, {70,7,51}, {19,27,63}, {44,3,46},
+ {91,26,89}, {22,63,57}, {33,10,50}, {56,85,4}
+ };
+
+int main ()
+{
+ int i;
+ int shared [BLKSIZE] *p0, *p1;
+ int diff, expected;
+ for (i = 0; i < 19; ++i)
+ {
+ int t0 = MYTHREAD;
+ int t1 = (MYTHREAD + data[i].x) % THREADS;
+ int j = data[i].y;
+ int k = data[i].z;
+ int ediff = (k - j);
+ int pdiff = k % BLKSIZE - j % BLKSIZE;
+ int tdiff = (t1 - t0);
+ p0 = &a[((j / BLKSIZE) * THREADS + t0) * BLKSIZE + (j % BLKSIZE)];
+ p1 = &a[((k / BLKSIZE) * THREADS + t1) * BLKSIZE + (k % BLKSIZE)];
+ diff = p1 - p0;
+ expected = (ediff - pdiff) * THREADS + tdiff * BLKSIZE + pdiff;
+ if (diff != expected)
+ {
+ fprintf (stderr, "Error: pointer difference: %d not equal "
+ "to expected: %d\n", diff, expected);
+ abort ();
+ }
+ }
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ printf ("test16: test pointer difference between pointers "
+ "to shared array with layout specifier - passed.\n");
+ }
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test17.upc b/libgupc/testsuite/libgupc.upc/intrepid/test17.upc
new file mode 100644
index 00000000000..fcd82987603
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test17.upc
@@ -0,0 +1,99 @@
+/* Copyright (C) 2005-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FACTOR 100
+#define BLKSIZE 5
+shared [BLKSIZE] int array[FACTOR*THREADS];
+
+/* ptr is a shared pointer that lives in shared memory */
+shared [BLKSIZE] int * shared ptr;
+shared int counter;
+
+/* serialization lock */
+upc_lock_t *lock;
+
+void
+test17()
+{
+ int i;
+ lock = upc_all_lock_alloc();
+ if (!MYTHREAD)
+ {
+ counter = 0;
+ ptr = &array[0];
+ }
+ upc_barrier;
+ for (i = 0; i < FACTOR; ++i)
+ {
+ upc_lock (lock);
+ counter = counter + 1;
+ *ptr = counter;
+ ptr = ptr + 1;
+ upc_unlock (lock);
+ }
+ upc_all_lock_free (lock);
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ int expected;
+ int got;
+ shared [BLKSIZE] int *p, *last;
+ for (p = &array[0], last = &array[FACTOR*THREADS-1], i = 0;
+ p <= last; ++p)
+ {
+ expected = ++i;
+ got = *p;
+ if (got != expected)
+ {
+ fprintf(stderr, "test17: error at element %d. Expected %d, got %d.\n",
+ i, expected, got);
+ abort ();
+ }
+ }
+ got = i;
+ expected = FACTOR*THREADS;
+ if (got != expected)
+ {
+ fprintf(stderr, "test17: error: loop iteration mismatch."
+ " Expected %d, got %d.\n", expected, got);
+ abort ();
+ }
+ printf ("test17: test indirection via a shared pointer to shared, "
+ "and pointer comparison, for pointers with "
+ "blocking factors - passed.\n");
+ }
+}
+
+int
+main()
+{
+ test17 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test18.upc b/libgupc/testsuite/libgupc.upc/intrepid/test18.upc
new file mode 100644
index 00000000000..2f91227186f
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test18.upc
@@ -0,0 +1,1090 @@
+/* Copyright (C) 2005-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc_strict.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+
+#if !defined(__GNUC__) && !defined(__attribute__)
+#define __attribute__(X)
+#endif
+
+shared [5] int a_blk5[10*THREADS];
+shared [5] int *ptr_to_blk5;
+shared [3] int *ptr_to_blk3;
+shared [5] int * shared shared_ptr_to_shared;
+shared int shared_int;
+int local_int = 99;
+shared int * ptr_to_shared_int;
+upc_lock_t *lock;
+typedef shared [3] int a_3[3];
+a_3 a_3_by_3[3*THREADS];
+shared [] int a_indef[10];
+shared [*] int a_star_10[10*THREADS];
+/* below, unused, but caused compilation error in the past. */
+shared [] int* shared shared_a_indef_ptr[THREADS] __attribute__ ((unused));
+int * shared shared_ptr_to_local_int;
+/* bug 39: can't statically initialize pointer-to-shared with NULL */
+shared int * shared_ptr_null_init = 0;
+/* bug 62: pointer to shared incomplete type with layout specifier
+ not deferred to type completion */
+shared [10] struct inc_struct *ptr_to_incomplete;
+struct inc_struct { int x; int y; };
+/* bug 95: cast of pointer to shared const misclassified as an error */
+struct struct95
+ {
+ int field[10];
+ };
+shared struct struct95 shared_struct;
+/* bug 96: access to 2-dim shared volatile element crashes compiler. */
+shared volatile int shared_vol2[10][THREADS];
+/* bug 100: local pointer set to null pointer to shared. */
+double localData;
+double *localPtr;
+
+/* bug 103: ICE: codegen (AMD64) - fail while evaluating shared array element
+ actual parameters */
+shared double save_err[100][4][THREADS];
+
+/* gimple bug. */
+shared int gimple_arr[THREADS];
+
+/* BUPC bug53 - de-reference via shared pointer to local.*/
+int * shared bupc_bug53_p;
+
+/* BUPC bug206 - de-reference via local pointer
+ to pointer to unblocked shared. */
+typedef shared [] int *sintptr;
+shared [] int bupc_206_A[10];
+sintptr bupc_206_S;
+
+#undef abs
+#define abs(x) ((x) < 0 ? -(x) : (x))
+
+int
+process_errors (double e1, double e2, double e3, double e4)
+{
+ double s = abs(e1) + abs(e2) + abs(e3) + abs(e4);
+ return (s < 1.0e-5);
+}
+
+/* bug 104: Erroneous code generated */
+shared int bug104_TT[16][THREADS];
+
+void
+bug104_proc_1 (int i, int j)
+{
+ if (i == j)
+ return;
+ fprintf (stderr, "Error bug 104: failed - i != j (%d != %d)\n", i, j);
+ abort ();
+}
+
+void
+bug104_proc (int i, int j)
+{
+ if (j != MYTHREAD)
+ return;
+ /* The gets of bug104_TT[i][j] below were interfering with the
+ save area on the stack where i and j are stored.
+ This caused the second call to fail. */
+ bug104_proc_1 (bug104_TT[i][j], i);
+ bug104_proc_1 (bug104_TT[i][j]+2, i+2);
+}
+
+/* Bug 106: GUPC fails with internal error on a few
+ UPCR regression tests on OPTERON (x86_64) systems */
+
+typedef struct bug106_U_shared bug106_u_t;
+struct bug106_U_shared
+{
+ double local[9][8][7][6][5];
+};
+shared [] bug106_u_t *bug106_u;
+
+shared [] double *
+bug106_func(int i, int j)
+{
+ shared [] double *result;
+ result = &bug106_u[0].local[1][i][j][2][0];
+ return result;
+}
+
+/* bug 195: ICE: fail to parse shared array declaration after a similar
+ declaration has already been seen */
+extern shared [2941*2] double sh_buf[THREADS][2941*2];
+shared [2941*2] double sh_buf[THREADS][2941*2];
+
+/* bug 213: pragma upc appearing just after opening bracket not supported.
+ This was causing a compilation warning, because it was an unsupported
+ pragma. The code below doesn't do anything meaningful. It just nests
+ some brackets to test that aspect of pragma upc handling. */
+void
+bug213_func (shared double *x, shared double *y, shared double *z[])
+{
+ int i;
+ for (i = 0; i < 100; ++i)
+ {
+ int j;
+ for (j = 0; j < 100; ++j)
+ {
+ #pragma upc strict
+ if (x[i] < x[j])
+ {
+ z[i][j] = x[i] * y[j];
+ }
+ else
+ {
+ z[i][j] = -x[i] * y[j];
+ }
+ }
+ }
+}
+
+struct bupc_156_struct {
+ char No;
+ int a[20];
+};
+
+shared [10] struct bupc_156_struct bupc_156;
+void
+bupc156_test()
+{
+ size_t bs_No __attribute__ ((unused));
+ size_t bs_a __attribute__ ((unused));
+ bs_No = upc_blocksizeof(*&(bupc_156.No));
+ bs_a = upc_blocksizeof(*&(bupc_156.a));
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ shared [] char * x = &(bupc_156.No);
+ int i;
+ for (i = 0; i < 20; ++i)
+ bupc_156.a[i] = (i + 1);
+ *x = 'X';
+ }
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ int *a = (int *)&bupc_156.a[0];
+ int i;
+ if (bupc_156.No != 'X')
+ {
+ fprintf (stderr, "Error bupc156 test failed: bupc_156.No mismatch"
+ " - expected 'X', got '%c'\n", bupc_156.No);
+ abort ();
+ }
+ for (i = 0; i < 20; ++i)
+ {
+ int expected = i + 1;
+ int got = a[i];
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bupc156 test failed: "
+ "expected %d got %d at i = %d\n",
+ expected, got, i);
+ abort ();
+ }
+ }
+ }
+ upc_barrier;
+}
+
+#define NB228 100
+struct bug228_struct {
+ double a[NB228];
+};
+
+shared struct bug228_struct bug228_array[THREADS];
+
+void
+bug228_test (void)
+{
+ int i, t;
+ upc_barrier;
+ for (i = 0; i < NB228; ++i)
+ bug228_array[MYTHREAD].a[i] = (double)((i + 1)*(MYTHREAD+1));
+ upc_barrier;
+ if (MYTHREAD > 0)
+ {
+ bug228_array[MYTHREAD] = bug228_array[0];
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (t = 0; t < THREADS; ++t)
+ for (i = 0; i < NB228; ++i)
+ {
+ double expected = (double)(i + 1);
+ double got = bug228_array[t].a[i];
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug228 test failed: expected %.3g got %.3g"
+ " at t = %d, i = %d\n",
+ expected, got, t, i);
+ abort ();
+ }
+ }
+ }
+ upc_barrier;
+}
+
+/* 'strict' is needed here, because on a 64 bit machine,
+ two threads might try to write each half of a 64 bit
+ word and a race condition results. */
+strict shared int bug230_ia[2][10*THREADS];
+
+void
+bug230_proc(strict shared int ia[2][10*THREADS])
+{
+ int i, j;
+ for (i = 0; i < 2; ++i)
+ for (j = 0; j < 10; ++j)
+ ia[i][j*THREADS+MYTHREAD] = i*10*THREADS + (j*THREADS + MYTHREAD);
+}
+
+
+/* Note: Bug 229 is a compile-time bug, that this
+ test reproduces when compiled. At runtime,
+ this test exercises bug 230 (when compiled with
+ static threads and THREADS=2). */
+void
+bug230_test()
+{
+ int i, j, t;
+ upc_barrier;
+ bug230_proc (bug230_ia);
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (t = 0; t < THREADS; ++t)
+ for (i = 0; i < 2; ++i)
+ for (j = 0; j < 10; ++j)
+ {
+ int expected = i*10*THREADS + (j*THREADS + t);
+ int got = bug230_ia[i][j*THREADS+t];
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug #230 test failed: expected %d got %d"
+ " at t = %d, i = %d, j = %d\n",
+ expected, got, t, i, j);
+ abort ();
+ }
+ }
+ }
+ upc_barrier;
+}
+
+/* Bug 233: upc_alloc.upc fails to compile, with complaint
+ about attempt to copy shared pointer to local. */
+
+shared int bug233_v1;
+shared int * shared bug233_p1;
+shared int * shared bug233_p2;
+
+void
+bug233_test ()
+{
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ bug233_v1 = 101;
+ bug233_p1 = &bug233_v1;
+ /* The statement above should compile without complaint. */
+ bug233_p2 = bug233_p1;
+ }
+ upc_barrier;
+ if (bug233_p1 == NULL)
+ {
+ fprintf (stderr, "Error p1 is NULL - bug233 test failed.\n");
+ abort ();
+ }
+ if (bug233_p2 != bug233_p1)
+ {
+ fprintf (stderr, "Error p2 != p1 - bug233 test failed.\n");
+ abort ();
+ }
+ if (bug233_p2 != &bug233_v1)
+ {
+ fprintf (stderr, "Error p2 != &v1 - bug233 test failed.\n");
+ abort ();
+ }
+ if (*bug233_p2 != 101)
+ {
+ fprintf (stderr, "Error *p2 = %d, expected: 101 - bug233 test failed.\n",
+ *bug233_p2);
+ abort ();
+ }
+ upc_barrier;
+}
+
+/* Bug 235: incorrect address calculation involving blocked PTS
+ * and a negative index. This failure was originally discovered
+ * when running the "compound_test" test in the new (RC2) GWU GUTS
+ * test, though it has nothing to do with that test. This test
+ * fails only if THREADS > 2. Upon further analysis, the incorrect
+ * calculation implies to all negative index values. The reasons
+ * for this boil down to the need to insure that a signed
+ * floor_div() and floor_mod() calculation is used when performing
+ * the address calculation. */
+void
+bug235_test()
+{
+ shared [5] int *p1;
+ int i;
+ p1 = (shared[5] int *) upc_all_alloc(3*THREADS, 5*sizeof(int));
+ if (!p1)
+ {
+ fprintf(stderr, "Error Bug #235 allocation failed.\n");
+ abort();
+ }
+ for (i = 1; i <= 3*THREADS*5; ++i)
+ {
+ int got = upc_threadof(p1+i-1);
+ int expected = ((i-1)/5)%THREADS;
+ if (got != expected)
+ {
+ fprintf(stderr, "Error Bug #235: affinity check for p1+i-1 failed.\n"
+ " i = %d MYTHREAD = %d affinity = %d expected = %d\n",
+ i, MYTHREAD, got, expected);
+ abort ();
+ }
+ }
+ upc_all_free (p1);
+}
+
+/* bug 236: bugzilla/bug1126.upc fails to compile -
+ reports __copyblk3 has incompatible type for argument 2
+ Problem occurs when a PTS is in shared space. The result
+ of incrementing/decrementing the pointer is erroneously
+ qualified as "shared". A similar situation arises
+ for regular pointer arithmetic (bug 226) which is also
+ tested below. */
+shared [5] int bug236_A[5*THREADS];
+shared [5] int * shared bug236_ptr;
+void bug236_test ()
+{
+ int i;
+ if (!MYTHREAD)
+ bug236_ptr = bug236_A;
+ upc_barrier;
+ for (i = 0; i < 5*THREADS; ++i)
+ {
+ upc_barrier;
+ if (MYTHREAD == ((i/5)%THREADS))
+ {
+ int expected, got;
+ expected = (i/5)%THREADS;
+ got = upc_threadof (bug236_ptr);
+ bug236_ptr = bug236_ptr + 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error threadof(%i) = %d, "
+ "expected: %d - bug226 test failed.\n",
+ i, got, expected);
+ abort ();
+ }
+ }
+ upc_barrier;
+ }
+ upc_barrier;
+ if (!MYTHREAD)
+ bug236_ptr = bug236_A;
+ upc_barrier;
+ for (i = 0; i < 5*THREADS; ++i)
+ {
+ upc_barrier;
+ if (MYTHREAD == ((i/5)%THREADS))
+ {
+ int expected, got;
+ expected = (i/5)%THREADS;
+ got = upc_threadof (bug236_ptr++);
+ if (got != expected)
+ {
+ fprintf (stderr, "Error threadof(%i) = %d, "
+ "expected: %d - bug236 test failed.\n",
+ i, got, expected);
+ abort ();
+ }
+ }
+ upc_barrier;
+ }
+ upc_barrier;
+}
+
+int
+get_prev()
+{
+ /* The following generated an internal compiler error
+ in gimplify_expr() when compiled at -O0 using the
+ packed PTS representation. */
+ int val = gimple_arr[MYTHREAD?(MYTHREAD-1):THREADS-1];
+ return val;
+}
+
+void
+gimple_bug_test()
+{
+ int expected, got;
+ if (!MYTHREAD)
+ {
+ int i;
+ for (i = 0; i < THREADS; ++i) gimple_arr[i] = (i+1);
+ }
+ upc_barrier;
+ expected = MYTHREAD ? MYTHREAD : THREADS;
+ got = get_prev();
+ if (got != expected)
+ {
+ fprintf (stderr, "thread %i: Error: "
+ "expected: %d got %d - gimple bug test failed.\n",
+ MYTHREAD, got, expected);
+ abort ();
+ }
+ upc_barrier;
+}
+
+void
+bupc_bug53_test ()
+{
+ if (MYTHREAD == 0)
+ {
+ int i;
+ bupc_bug53_p = (int *) malloc (10 * sizeof (int));
+ for (i = 0; i < 10; i++)
+ bupc_bug53_p[i] = i;
+ for (i = 0; i < 10; i++)
+ {
+ int expected = i;
+ int got = bupc_bug53_p[i];
+ if (got != expected)
+ {
+ fprintf (stderr, "Error: expected: %d, got: %d "
+ "- BUPC bug53 test failed\n",
+ expected, got);
+ abort ();
+ }
+ }
+ free (bupc_bug53_p);
+ }
+}
+
+void
+bupc_bug206_test()
+{
+ sintptr *local = &bupc_206_S;
+ bupc_206_S = bupc_206_A;
+ local[0] = NULL; /* local[0] is an alias for 'S' */
+ if (bupc_206_S != NULL)
+ {
+ fprintf (stderr, "%d: Error: S != NULL"
+ " - BUPC bug206 test failed.\n", MYTHREAD);
+ abort();
+ }
+}
+
+void
+bug323_test ()
+{
+ static size_t shared full_filevec_datasz = 10;
+ static size_t shared full_full_smemvec_cnt1 __attribute__ ((unused)) = 0;
+ static size_t shared full_full_smemvec_cnt __attribute__ ((unused)) = 0;
+ static unsigned int neededsz_bytes = 0;
+ while (0) {
+ /* Bug 323: ICE: in statement below.
+ "The cause of failure is subtle. Internally, the compiler tries to
+ cache constants in the form (<type> <value>). In the failing test, there
+ are two places that it creates a ((shared unsigned int) 0) constant.
+ But the internal cache discards "shared", yet the code tries to compare
+ the constant's type that it pulls from the cache with the (shared
+ unsigned int) type. They don't match, and the assertion fails." */
+ if (full_filevec_datasz > 0 &&
+ full_filevec_datasz >= neededsz_bytes) break;
+ }
+}
+
+
+typedef struct
+{
+ shared [] unsigned char *r;
+} RowOfBytes;
+
+#define BLK_349 100
+shared [BLK_349] unsigned char data_349[BLK_349 * THREADS];
+shared RowOfBytes A_349[THREADS];
+
+void bug349_proc (shared RowOfBytes *arr, int i)
+{
+ int j;
+ for (j = 0; j < BLK_349; ++j)
+ {
+ /* Bug 349: ICE: GUPC 4.3 - assertion check on
+ attempt to create a shared temp, when compiling
+ sobel (optimized). */
+ arr[i].r[j] = (unsigned char) (j + 1);
+ }
+}
+
+void
+bug349_test ()
+{
+ A_349[MYTHREAD].r = (shared [] unsigned char *)
+ &data_349[BLK_349 * MYTHREAD];
+ upc_barrier;
+ bug349_proc (A_349, MYTHREAD);
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ int i, j;
+ for (i = 0; i < THREADS; ++i)
+ {
+ for (j = 0; j < BLK_349; ++j)
+ {
+ unsigned char expected = (unsigned char) (j + 1);
+ unsigned char got = A_349[i].r[j];
+ if (got != expected)
+ {
+ fprintf (stderr, "Error: expected: %d, got: %d - bug 349 test failed\n",
+ (int) expected, (int) got);
+ abort ();
+ }
+ }
+ }
+ }
+}
+
+#define SZ_351 1000
+shared int A_351[SZ_351*THREADS];
+
+void
+bug351_test ()
+{
+ /* bug 351: THREADS factor ignored in sizeof() calculation when compiled in
+ * dynamic environment. */
+ if (!MYTHREAD)
+ {
+ unsigned long expected = ((unsigned long) SZ_351
+ * (unsigned long) THREADS
+ * (unsigned long) sizeof(A_351[0]));
+ unsigned long got = (unsigned long) sizeof (A_351);
+ if (got != expected)
+ {
+ fprintf (stderr, "Error: expected: %lu, got: %lu - bug 351 test failed\n",
+ expected, got);
+ abort ();
+ }
+ }
+}
+
+/* Bug 362: ICE for pointer comparison when compiler
+ configured with --enable-checking-types.
+
+ error: type mismatch in comparison expression
+ internal compiler error: verify_gimple failed */
+
+shared [10] int A_362[20*THREADS];
+
+void
+bug362_test ()
+{
+ /* Code partially taken from BUPC Bugzilla bug2280.upc */
+ const int expected = 1;
+ int got;
+ shared [10] int *p = &A_362[8];
+ shared [10] int *q = &A_362[11];
+ /* ICE on pointer comparison below. Note: the comparison
+ and assignment to 'got' should remain as written. */
+ if (p > q)
+ got = 1;
+ else
+ got = 0;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug362: shared pointer comparison failed"
+ " got %d expected %d\n", got, expected);
+ abort ();
+ }
+}
+
+
+/* bug 402: ICE: '[*]' layout factor on multi-dimensional shared array with
+ dynamic threads. */
+shared [*] int A_402[THREADS][16];
+
+void
+bug402_test ()
+{
+ int i, j;
+ for (j = 0; j < 16; ++j)
+ A_402[MYTHREAD][j] = MYTHREAD*16 + j + 1;
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ if (upc_blocksizeof(A_402) != 16)
+ {
+ fprintf (stderr, "Error: blocksizeof(A_402) != 16 "
+ "- bug 402 test failed\n");
+ abort ();
+ }
+ for (i = 0; i < THREADS; ++i)
+ for (j = 0; j < 16; ++j)
+ {
+ int expected = i*16 + j + 1;
+ int got = A_402[i][j];
+ if (got != expected)
+ {
+ fprintf (stderr, "Error: expected: %d, got: %d - bug 402 test failed\n",
+ expected, got);
+ abort ();
+ }
+ }
+ }
+}
+
+void
+test18()
+{
+ int i, j;
+ int got;
+ int expected;
+ /* bug 56: can't initialize a shared pointer to NULL at auto scope */
+ shared int *sptr_auto = 0;
+ /* bug 63: compiler refuses to initialize a pointer-to-shared,
+ unless the initialization expression is 'simple' */
+ shared [3] int * p_3_init = &(a_3_by_3[2][2]);
+ /* bug 67: ICE on array initializer that references the address
+ of shared variable */
+ shared [5] int *p5_array[] = {&a_blk5[0], &a_blk5[9],
+ &a_blk5[4*MYTHREAD], 0};
+ /* bug 24: upc_elemsizeof unimplemented */
+ got = upc_elemsizeof a_3_by_3;
+ expected = sizeof (int);
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug24: upc_elemsizeof failed: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 25: upc_blocksizeof fails on arrays with THREADS multiple */
+ got = upc_blocksizeof a_3_by_3;
+ expected = 3;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug25: upc_blocksizeof fails "
+ "on arrays with THREADS multiple: got %d expected %d\n",
+ got, expected);
+ abort ();
+ }
+ /* bug 26: upc_blocksizeof does not return 0 for arrays
+ with indefinite block size */
+ got = upc_blocksizeof a_indef;
+ expected = 0;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug26: upc_blocksizeof does not "
+ "return 0 for arrays with indefinite block size: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 31: layout '[*]' not implemented */
+ got = upc_blocksizeof a_star_10;
+ expected = 10;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 31: layout '[*]' not implemented: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 39: can't statically initialize pointer-to-shared with NULL */
+ got = !shared_ptr_null_init;
+ expected = 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 39: can't statically initialize "
+ "pointer-to-shared with NULL: got %d expected %d\n",
+ got, expected);
+ abort ();
+ }
+ /* bug 46: upc_alloc unimplemented */
+ ptr_to_shared_int = upc_alloc (sizeof (int));
+ got = !!ptr_to_shared_int;
+ expected = 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 46: upc_alloc unimplemented: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 46: upc_affinitysize unimplemented */
+ got = upc_affinitysize (3 * 5 * sizeof(int) * THREADS,
+ 5 * sizeof(int), MYTHREAD);
+ expected = 3 * 5 * sizeof (int);
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 46: upc_affinitysize unimplemented: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 48: upc_lock_free unimplemented */
+ /* We can't test upc_lock_free(), so we'll just call it. */
+ lock = upc_global_lock_alloc ();
+ upc_lock_free (lock);
+#ifndef sgi /* KNOWN BUG #89 */
+ /* bug 52: upc_resetphase unimplemented */
+ ptr_to_blk5 = upc_resetphase (&a_blk5[1]);
+ got = upc_phaseof (ptr_to_blk5);
+ expected = 0;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 52: upc_resetphase unimplemented: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+#endif /* !sgi */
+ /* bug 53: cast of pointer-to-shared with differing block size
+ does not reset phase */
+ ptr_to_blk5 = &a_blk5[3];
+ ptr_to_blk3 = (shared [3] int *)ptr_to_blk5;
+ got = upc_phaseof (ptr_to_blk3);
+ expected = 0;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 53: cast of pointer-to-shared "
+ "with differing block size does not reset phase: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 54: upc_fence is unimplemented */
+ upc_fence;
+ /* bug 55: upc_poll is unimplemented */
+ upc_poll();
+ /* bug 56: can't initialize a shared pointer to NULL at auto scope */
+ got = (sptr_auto == (shared void *)0);
+ expected = 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 56: can't initialize a "
+ "shared pointer to NULL at auto scope: got %d expected %d\n",
+ got, expected);
+ abort ();
+ }
+ /* bug 59: UPC_MAX_BLOCK_SIZE is not an integer constant */
+#if UPC_MAX_BLOCK_SIZE > 0
+ got = 1;
+#else
+ got = 0;
+#endif
+ expected = 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 59: UPC_MAX_BLOCK_SIZE is not "
+ "an integer constant: got %d expected %d\n",
+ got, expected);
+ abort ();
+ }
+ /* bug 62: pointer to shared incomplete type with
+ layout specifier not deferred to type completion */
+ got = upc_blocksizeof *ptr_to_incomplete;
+ expected = 10;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 62: pointer to shared incomplete type "
+ "with layout specifier not deferred to type completion: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 63: compiler refuses to initialize a pointer-to-shared,
+ unless the initialization expression is 'simple' */
+ got = (p_3_init == &a_3_by_3[2][2]);
+ expected = 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 63: compiler refuses to initialize "
+ "a pointer-to-shared, unless the initialization "
+ "expression is 'simple': got %d expected %d\n",
+ got, expected);
+ abort ();
+ }
+ /* bug 67: ICE on array initializer that references the address
+ of shared variable */
+ got = (p5_array[2] == &a_blk5[4*MYTHREAD]);
+ expected = 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 67: ICE on array initializer "
+ "that references the address of shared variable: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 68: comparison between generic pointer to shared,
+ and pointer to shared fails */
+ ptr_to_blk5 = &a_blk5[4];
+ got = ((shared void *)&a_blk5[4] == ptr_to_blk5);
+ expected = 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 68: comparison between "
+ "generic pointer to shared, and pointer to shared fails: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 70: indirection through shared local pointer fails */
+ lock = upc_all_lock_alloc ();
+ upc_barrier;
+ upc_lock (lock);
+ shared_ptr_to_local_int = &local_int;
+ got = *shared_ptr_to_local_int;
+ upc_unlock (lock);
+ upc_all_lock_free (lock);
+ upc_barrier;
+ expected = 99;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 70: indirection through "
+ "shared local pointer fails: got %d expected %d\n",
+ got, expected);
+ abort ();
+ }
+ /* bug 71: upc_forall with integer affinity fails */
+ upc_forall (i = 0; i < THREADS; ++i; i)
+ {
+ got = i;
+ expected = MYTHREAD;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 71: upc_forall with "
+ "integer affinity fails: got %d expected %d\n",
+ got, expected);
+ abort ();
+ }
+ }
+ /* bug 75: indirection through pointer-to-shared which is
+ itself shared fails */
+ if (!MYTHREAD)
+ {
+ a_blk5[1] = 99;
+ shared_ptr_to_shared = &a_blk5[1];
+ }
+ upc_barrier;
+ got = *shared_ptr_to_shared;
+ expected = 99;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 75: indirection through "
+ "pointer-to-shared which is itself shared fails: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 77: anonymous barriers generate barrier id mismatch */
+ if (MYTHREAD % 2)
+ {
+ upc_barrier 1;
+ got = (MYTHREAD % 2) == 1;
+ }
+ else
+ {
+ upc_barrier;
+ got = (MYTHREAD % 2) == 0;
+ }
+ expected = 1;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 77: anonymous barriers "
+ "generate barrier id mismatch: "
+ "got %d expected %d\n", got, expected);
+ abort ();
+ }
+ /* bug 95: cast of pointer to shared const misclassified as an error */
+ upc_barrier;
+ for (i = 0; i < 10; ++i)
+ {
+ shared_struct.field[i] = 99;
+ }
+ expected = 99;
+ /* should not complain attempt to cast shared pointer to local pointer */
+ got = *((shared int *)shared_struct.field);
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 95: cast of pointer to shared const"
+ "misclassified as an error: got %d expected %d\n",
+ got, expected);
+ abort ();
+ }
+ /* bug 96: ICE: combination of shared and volatile crashes the compiler */
+ upc_barrier;
+ for (i = 0; i < 10; ++i)
+ {
+ shared_vol2[i][MYTHREAD] = i*THREADS + MYTHREAD;
+ }
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ for (i = 0; i < 10; ++i)
+ {
+ for (j = 0; j < THREADS; ++j)
+ {
+ expected = i*THREADS + j;
+ got = shared_vol2[i][j];
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 96: ICE: combination of "
+ "shared and volatile crashes the "
+ "compiler failed: got %d expected %d\n",
+ got, expected);
+ abort ();
+ }
+ }
+ }
+ }
+ /* bug 100: invalid compilation error when casting null
+ pointer to shared to local pointer */
+ upc_barrier;
+ localPtr = &localData;
+ localPtr = (double *)(shared [] double *) NULL;
+ if (localPtr != NULL)
+ {
+ fprintf (stderr, "Error bug 100: failed #1 "
+ "- null local pointer expected.\n");
+ }
+ localPtr = &localData;
+ localPtr = (double *)(shared void *) NULL;
+ if (localPtr != NULL)
+ {
+ fprintf (stderr, "Error bug 100: failed #2 "
+ "- null local pointer expected.\n");
+ }
+ localPtr = &localData;
+ localPtr = (double *)((shared void *) 0);
+ if (localPtr != NULL)
+ {
+ fprintf (stderr, "Error bug 100: failed #3 "
+ "- null local pointer expected.\n");
+ }
+ upc_barrier;
+ /* Bug 103: ICE: codegen (AMD64) - fail in emit_move_insn
+ when evaluating shared array element actual parameters */
+ for (i=0; i<100; i++)
+ for (j=0; j<4; j++)
+ save_err[i][j][MYTHREAD] = 1.0e-6;
+ upc_barrier;
+ for (i=0; i<100; i++)
+ {
+ int ok;
+ ok = process_errors (save_err[i][0][MYTHREAD], save_err[i][1][MYTHREAD],
+ save_err[i][2][MYTHREAD], save_err[i][3][MYTHREAD]);
+ if (!ok)
+ {
+ fprintf (stderr, "Error bug 103: failed "
+ "- save_err[%d][0..3][%d] exceeds"
+ " error tolerance (%0.3lg,%0.3lg,%0.3lg,%0.3lg)\n",
+ i, MYTHREAD,
+ save_err[i][0][MYTHREAD], save_err[i][1][MYTHREAD],
+ save_err[i][2][MYTHREAD], save_err[i][3][MYTHREAD]);
+ abort ();
+ }
+ }
+ upc_barrier;
+ /* Bug 104: Erroneous code generated */
+ for (i=0; i<16; i++)
+ {
+ bug104_TT[i][MYTHREAD] = i;
+ }
+ upc_barrier;
+ bug104_proc (4, MYTHREAD);
+ upc_barrier;
+ /* Bug 106: GUPC fails with internal error on
+ a few UPCR regression tests on OPTERON (x86_64) systems */
+ {
+ int i1, i2, i3, i4, i5, i6;
+ shared [] double *p;
+ double got, expected;
+ bug106_u = upc_alloc (10 * sizeof(bug106_u_t));
+ j = 0;
+ for (i1 = 0; i1 < 10; ++i1)
+ for (i2 = 0; i2 < 9; ++i2)
+ for (i3 = 0; i3 < 8; ++i3)
+ for (i4 = 0; i4 < 7; ++i4)
+ for (i5 = 0; i5 < 6; ++i5)
+ for (i6 = 0; i6 < 5; ++i6)
+ bug106_u[i1].local[i2][i3][i4][i5][i6] = (double)(++j);
+ upc_barrier;
+ p = bug106_func (2, 1);
+ got = *p;
+ expected = 2141;
+ if (got != expected)
+ {
+ fprintf (stderr, "Error bug 106: failed - got: %0.5g expected %0.5g\n",
+ got, expected);
+ abort ();
+ }
+ }
+ upc_barrier;
+ bupc156_test ();
+ upc_barrier;
+ bug228_test ();
+ upc_barrier;
+ bug230_test ();
+ upc_barrier;
+ bug233_test ();
+ upc_barrier;
+ bug235_test ();
+ upc_barrier;
+ bug236_test ();
+ upc_barrier;
+ gimple_bug_test ();
+ upc_barrier;
+ bupc_bug53_test ();
+ upc_barrier;
+ bupc_bug206_test ();
+ upc_barrier;
+ bug323_test ();
+ upc_barrier;
+ bug349_test ();
+ upc_barrier;
+ bug351_test ();
+ upc_barrier;
+ bug402_test ();
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ printf ("test18: miscellaneous regression tests - passed.\n");
+ }
+}
+
+int two() { return 2; }
+volatile int v2;
+
+int
+main()
+{
+ test18 ();
+ /* bug 65: default 'return 0;' not being implemented for main program */
+ /* force the value 2 into the return register before falling off 'main'
+ to ensure that the return from main isn't zero, unless the compiler
+ adds the required default 'return 0;'. */
+ v2 = two ();
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test19.upc b/libgupc/testsuite/libgupc.upc/intrepid/test19.upc
new file mode 100644
index 00000000000..aa3d6b2fa91
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test19.upc
@@ -0,0 +1,286 @@
+/* Copyright (C) 2005-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#undef min
+#undef max
+#undef abs
+#undef ceil
+#undef round_up
+
+#define min(x,y) (((x) < (y)) ? (x): (y))
+#define max(x,y) (((x) > (y)) ? (x): (y))
+#define abs(x) (((x) > 0) ? (x): -(x))
+#define ceil(x, r) (((x) + (r) - 1)/(r))
+#define round_up(x, r) (ceil(x,r)*(r))
+
+#define ALLOC_OVERHEAD 64
+#define ALLOC_CHUNK_SIZE 64
+#define MIN_ALLOC (ALLOC_OVERHEAD + ALLOC_CHUNK_SIZE)
+/* We calculate the largest (default) allocation,
+ adjusting for overhead and for the allocation of a lock. */
+#define MAX_ALLOC_SIZE (10*1024*1024-ALLOC_OVERHEAD-MIN_ALLOC)
+#define AVE_ALLOC_SIZE 10000
+/* Given that the sizes are generated randomly, it is unlikely that
+ we'll need a table as large as twice the expected average number
+ of allocations. Further since we're distributing the allocations
+ across threads, the actual maximum is likely much lower than this. */
+#define AVE_ALLOCS ceil(MAX_ALLOC_SIZE, AVE_ALLOC_SIZE)
+#define MAX_ALLOCS 2*AVE_ALLOCS
+/* Given that allocations occur in a 2:1 ratio in the first
+ phase and that deallocations occur in a 2:1 ratio in the
+ second phase, we would expect on average 3 times the expected
+ number of allocations for the number of
+ iterations inclusive of allocations and deallocations
+ in each phase. */
+#define MAX_ITERS 3*AVE_ALLOCS
+shared void *ptrs[MAX_ALLOCS];
+size_t sizes[MAX_ALLOCS];
+/* 'N' records the number of entries in (ptrs, sizes) */
+int N;
+/* 'N_max' is used in the deallocation phase to record
+ the high water value of 'N' */
+int N_max;
+
+upc_lock_t *lock;
+shared void * strict shared global_ptr;
+
+/* Burn a few random cycles */
+void keep_busy ()
+{
+ volatile long busy_count;
+ busy_count = (long)(random() % 20000);
+ while (--busy_count > 0) /* loop */ ;
+}
+
+void
+test19()
+{
+ shared void *p;
+ int i;
+ size_t sz;
+ size_t alloc_quota;
+ /* set random seed so each thread generates a different sequence */
+ srandom (MYTHREAD + 1);
+ lock = upc_all_lock_alloc();
+ if (!lock)
+ {
+ fprintf (stderr, "Error: upc_all_lock_alloc() failed.\n");
+ abort ();
+ }
+ upc_barrier;
+ if (!MYTHREAD) global_ptr = 0;
+ upc_barrier;
+ /* allocate a big block and/or free it 10 times on each thread */
+ for (i = 0; i < 10; ++i)
+ {
+ /* delay a little to randomize sequencing on the lock */
+ keep_busy ();
+ upc_lock (lock);
+ if (global_ptr)
+ {
+ upc_free (global_ptr);
+ global_ptr = 0;
+ }
+ else
+ {
+ global_ptr = upc_global_alloc (THREADS, MAX_ALLOC_SIZE);
+ if (!global_ptr)
+ {
+ fprintf (stderr, "%d: Error: failed to "
+ "allocate large block\n", MYTHREAD);
+ abort ();
+
+ }
+ }
+ upc_unlock (lock);
+ }
+ upc_barrier;
+ /* clean up */
+ upc_all_free (global_ptr);
+ upc_barrier;
+ /* The following test proceeds in two phases. The first is an
+ allocation phase, where about 2/3's of the time the threads
+ will allocate and 1/3 of the time, they'll deallocate.
+
+ Then, once everything is allocated, go into a deallocation
+ phase where about 2/3's of the time de-allocations are performed
+ and 1/3 of the time they'll be allocated.
+
+ Once everything has been deallocated, we verify that we
+ can once again allocate the largest possible memory
+ segment. */
+ /* Each thread will try to allocate its 'quota' of memory
+ space. Note that since most dynamic memory managers
+ generate internal fragmentation, it is unlikely that
+ each thread will allocate its quota. This is
+ unimportant, because what we're after is the test at
+ the end to see that all the memory was returned. */
+ alloc_quota = MAX_ALLOC_SIZE / THREADS;
+ if (MYTHREAD == (THREADS - 1))
+ alloc_quota += MAX_ALLOC_SIZE % THREADS;
+#ifdef VERBOSE
+ setbuf(stdout, 0);
+ upc_lock (lock);
+ printf ("%d: allocation quota = %d\n", MYTHREAD, (int)alloc_quota);
+ upc_unlock (lock);
+#endif /* VERBOSE */
+ N = 0;
+ int iter = 0;
+ while (alloc_quota > 0)
+ {
+ int do_alloc = (random() % 3) < 2;
+ if (do_alloc || N == 0 || iter++ > MAX_ITERS)
+ {
+ size_t alloc_size;
+ sz = random() % (2 * AVE_ALLOC_SIZE) + 1;
+ alloc_size = ALLOC_OVERHEAD + round_up (sz, ALLOC_CHUNK_SIZE);
+ if ((alloc_size >= alloc_quota)
+ || (alloc_quota < MIN_ALLOC))
+ sz = alloc_quota - ALLOC_OVERHEAD;
+ alloc_size = ALLOC_OVERHEAD + round_up (sz, ALLOC_CHUNK_SIZE);
+ if (alloc_size > alloc_quota)
+ {
+ alloc_quota = 0;
+ continue;
+ }
+ alloc_quota -= alloc_size;
+#ifdef VERBOSE
+ upc_lock (lock);
+ printf ("%d: allocate %ld, %d\n", MYTHREAD, (long int)sz, (int)alloc_quota);
+ upc_unlock (lock);
+#endif /* VERBOSE */
+ p = upc_global_alloc (THREADS, sz);
+ if (p)
+ {
+ ptrs[N] = p;
+ sizes[N++] = sz;
+ }
+ else
+ break;
+ if (N == MAX_ALLOCS) break; /* DOB: prevent buffer overrun */
+ }
+ else
+ {
+ int k;
+ /* deallocate a random entry */
+ k = random() % N;
+ p = ptrs[k];
+ sz = sizes[k];
+ for (i = k; i < (N - 1); ++i)
+ {
+ ptrs[i] = ptrs[i+1];
+ sizes[i] = sizes[i+1];
+ }
+ N = N - 1;
+#ifdef VERBOSE
+ upc_lock (lock);
+ printf ("%d: free %d, %d\n", MYTHREAD, (int)sz, (int)alloc_quota);
+ upc_unlock (lock);
+#endif /* VERBOSE */
+ upc_free (p);
+ alloc_quota += ALLOC_OVERHEAD
+ + round_up (sz, ALLOC_CHUNK_SIZE);
+ }
+ }
+ upc_barrier;
+#ifdef VERBOSE
+ upc_lock (lock);
+ printf ("%d: finished allocation phase, %ld bytes left\n",
+ MYTHREAD, (long int)alloc_quota);
+ upc_unlock (lock);
+#endif /* VERBOSE */
+ /* deallocation phase */
+ N_max = N;
+ iter = 0;
+ while (N > 0)
+ {
+ int do_alloc = (random() % 3) < 1;
+ iter++;
+ if (do_alloc && (N < N_max) && iter < MAX_ITERS)
+ {
+ sz = sizes[N];
+#ifdef VERBOSE
+ upc_lock (lock);
+ printf ("%d: allocate %ld\n", MYTHREAD, (long int)sz);
+ upc_unlock (lock);
+#endif /* VERBOSE */
+ p = upc_global_alloc (THREADS, sz);
+ if (p)
+ ptrs[N++] = p;
+ else
+ continue;
+ }
+ else
+ {
+ int k;
+ /* deallocate a random entry */
+ k = random() % N;
+ p = ptrs[k];
+ sz = sizes[k];
+ for (i = k; i < (N_max - 1); ++i)
+ {
+ ptrs[i] = ptrs[i+1];
+ sizes[i] = sizes[i+1];
+ }
+ sizes[N_max-1] = sz;
+ N = N - 1;
+#ifdef VERBOSE
+ upc_lock (lock);
+ printf ("%d: free %d\n", MYTHREAD, (int)sz);
+ upc_unlock (lock);
+#endif /* VERBOSE */
+ upc_free (p);
+ }
+ }
+ upc_barrier;
+ /* At this point, everything should've been deallocated, and
+ we can safely allocate the big block again. */
+ if (MYTHREAD == 0)
+ {
+ global_ptr = upc_global_alloc (THREADS, MAX_ALLOC_SIZE);
+ if (!global_ptr)
+ {
+ fprintf (stderr, "Error: Failed to allocate large block in final stage.\n");
+ abort ();
+
+ }
+ upc_free (global_ptr);
+ printf ("test19: intensive global memory allocator test - passed.\n");
+ }
+}
+
+int
+main()
+{
+ test19 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test20.upc b/libgupc/testsuite/libgupc.upc/intrepid/test20.upc
new file mode 100644
index 00000000000..ac1ba4806ac
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test20.upc
@@ -0,0 +1,97 @@
+/* Copyright (C) 2005-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef struct {
+ double real;
+ double imag;
+} dcomplex;
+
+#define NTDIVNP 65536
+
+typedef struct dcomplex_cell_s dcomplex_cell_t;
+struct dcomplex_cell_s {
+ dcomplex cell[NTDIVNP];
+};
+
+shared dcomplex_cell_t *sh0;
+shared dcomplex_cell_t *sh1;
+
+void
+test20 ()
+{
+ int i;
+ sh0 = (shared dcomplex_cell_t *)
+ upc_all_alloc (THREADS, sizeof (dcomplex_cell_t));
+ sh1 = (shared dcomplex_cell_t *)
+ upc_all_alloc (THREADS, sizeof (dcomplex_cell_t));
+ for (i = 0; i < NTDIVNP; ++i)
+ {
+ sh0[MYTHREAD].cell[i].real = (double)(MYTHREAD * NTDIVNP + i);
+ sh0[MYTHREAD].cell[i].imag = -sh0[MYTHREAD].cell[i].real;
+ }
+ upc_barrier;
+ /* block copy from shared memory to local slice, same thread. */
+ upc_memget ((dcomplex *)&sh1[MYTHREAD].cell[0],
+ &sh0[MYTHREAD].cell[0], sizeof(dcomplex) * NTDIVNP);
+ upc_barrier;
+ for (i = 0; i < NTDIVNP; ++i)
+ {
+ double expected_real = (double)(MYTHREAD * NTDIVNP + i);
+ double expected_imag = -expected_real;
+ double got_real = sh1[MYTHREAD].cell[i].real;
+ double got_imag = sh1[MYTHREAD].cell[i].imag;
+ if (got_real != expected_real)
+ {
+ fprintf (stderr, "%d: Error mismatch at %i"
+ "- real, expected: %7.0lf got: %7.0lf\n",
+ MYTHREAD, i, expected_real, got_real);
+ abort ();
+ }
+ if (got_imag != expected_imag)
+ {
+ fprintf (stderr, "%d: Error mismatch at %i"
+ "- imag, expected: %7.0lf got: %7.0lf\n",
+ MYTHREAD, i, expected_imag, got_imag);
+ abort ();
+ }
+ }
+ upc_all_free (sh0);
+ upc_all_free (sh1);
+ upc_barrier;
+ if (MYTHREAD == 0)
+ printf ("test20: block copy via upc_memget test passed.\n");
+ upc_barrier;
+}
+
+int main ()
+{
+ test20 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test21.upc b/libgupc/testsuite/libgupc.upc/intrepid/test21.upc
new file mode 100644
index 00000000000..d4b462a0817
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test21.upc
@@ -0,0 +1,83 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* The size needs to be large enough to cross several pages
+ of the underlying runtime implemented virtual memory. */
+#define BUF_SIZE 31419265
+
+void
+test21 ()
+{
+ shared char *ptr;
+ shared [] char *str;
+ char *s;
+ int k;
+ ptr = upc_all_alloc (THREADS, BUF_SIZE);
+ if (!ptr)
+ {
+ fprintf (stderr, "%d: Error: upc_all_alloc() failed\n",
+ MYTHREAD);
+ abort ();
+ }
+ upc_barrier;
+ /* Verify that the local addresses are sequential and that
+ they map back to the remote addresses */
+ s = (char *)&ptr[MYTHREAD]; /* local <- shared */
+ str = (shared [] char *)&ptr[MYTHREAD];
+ for (k = 0; k < BUF_SIZE; ++k)
+ {
+ void *local_addr = (void *)&s[k];
+ void *remote_to_local_addr = (void *)&str[k];
+ if (local_addr != remote_to_local_addr)
+ {
+ fprintf (stderr, "%d: Error: address compare "
+ "for size %ld failed at index %d\n"
+ " Local address %016lx != %016lx "
+ "vaddr = %016lx\n",
+ MYTHREAD, (long int)BUF_SIZE, k,
+ (long unsigned)local_addr,
+ (long unsigned)remote_to_local_addr,
+ (long unsigned)upc_addrfield(
+ &(((shared [] char *)&ptr[MYTHREAD])[k])));
+ abort ();
+ }
+ }
+ upc_all_free (ptr);
+ upc_barrier;
+}
+
+int
+main ()
+{
+ test21 ();
+ if (MYTHREAD == 0)
+ printf ("test21: global/local address check - passed.\n");
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test22.upc b/libgupc/testsuite/libgupc.upc/intrepid/test22.upc
new file mode 100644
index 00000000000..938c333245b
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test22.upc
@@ -0,0 +1,70 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ALLOC_SIZE 0x100000 /* 1mb at the time */
+#define NALLOC 5
+
+void
+test22 ()
+{
+ shared char *x[NALLOC];
+ shared char *y;
+ int cnt = 0;
+ int i;
+
+ y = upc_global_alloc (1, 0x100);
+ for (i=0; i < NALLOC; i++)
+ {
+ x[i] = upc_alloc (ALLOC_SIZE);
+ if (x[i]) cnt++;
+ }
+ if (cnt != 5)
+ {
+ fprintf (stderr, "test22: Error: Thread %d allocated "
+ "only %d local buffers.\n", MYTHREAD, cnt);
+ abort ();
+ }
+ for (i=0; i < NALLOC; i++)
+ {
+ upc_free(x[i]);
+ }
+ upc_barrier;
+ if (!MYTHREAD)
+ printf ("test22: heap local allocation - passed.\n");
+ upc_barrier;
+ upc_free(y);
+}
+
+int
+main ()
+{
+ test22 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test23.upc b/libgupc/testsuite/libgupc.upc/intrepid/test23.upc
new file mode 100644
index 00000000000..67f9ad6178a
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test23.upc
@@ -0,0 +1,84 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdio.h>
+
+struct node_s
+ {
+ shared struct node_s *next;
+ int data;
+ };
+typedef struct node_s node_t;
+typedef shared node_t *node_p;
+
+shared void *
+add_ptr(node_p ptr, size_t offset)
+{
+ return (shared void *)((shared [] char *)ptr + offset);
+}
+
+shared node_t S;
+
+void
+test23()
+{
+ node_p node = &S;
+ shared void *ptr;
+ size_t diff;
+ ptr = add_ptr (node, 64);
+ if (upc_phaseof (ptr) != 0)
+ {
+ fprintf (stderr, "Error: phase of (ptr) != 0 equals: %d\n",
+ (int)upc_phaseof(ptr));
+ abort ();
+ }
+ if (upc_threadof (ptr) != 0)
+ {
+ fprintf (stderr, "Error: thread of (ptr) != 0 equals: %d\n",
+ (int)upc_threadof(ptr));
+ abort ();
+ }
+ diff = (shared [] char *)ptr - (shared [] char *)node;
+ if (diff != 64)
+ {
+ fprintf (stderr, "Error: address of (ptr)"
+ "- address of (node) != 64 equals: %ld\n",
+ (long)diff);
+ abort ();
+ }
+ upc_barrier;
+ if (!MYTHREAD)
+ printf ("test23: add integer to (shared void *) - passed.\n");
+}
+
+int
+main ()
+{
+ test23 ();
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test24.upc b/libgupc/testsuite/libgupc.upc/intrepid/test24.upc
new file mode 100644
index 00000000000..6a00e31a879
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test24.upc
@@ -0,0 +1,296 @@
+/* Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#undef min
+#define min(x,y) (((x) < (y)) ? (x) : (y))
+#undef max
+#define max(x,y) (((x) > (y)) ? (x) : (y))
+#undef abs
+#define abs(x) (((x) > 0) ? (x) : -(x))
+#undef ceil
+#define ceil(x, r) (((x) + (r) - 1)/(r))
+#undef round_up
+#define round_up(x, r) (ceil(x,r)*(r))
+
+/* The following sequence of numbers, when interpreted as
+ a plus number meaning allocation and a minus meaning
+ de-allocation will eventually allocate roughly 54 megabytes,
+ where approximately 1/3 of the sequence will free memory
+ and 2/3's will allocate memory. */
+const int alloc_seq[] = {
+ 39603, 76, 3571, 103682, 123, 199, 4870847, -39603, 29, -4870847,
+ -3571, 7, -103682, -7, 15127, 1149851, 11, 1364, 3010349, -199,
+ 4870847, 20633239, 9349, -3010349, 3, 24476, 199, 4, -76, -15127,
+ -199, 76, -9349, -20633239, 3010349, 47, 64079, 843, 15127, 7,
+ -47, -3010349, 47, -47, 199, 103682, 9349, 710647, 3010349, 521,
+ 39603, -15127, -843, 2207, 271443, 20633239, 18, -4, 3571, 15127,
+ -3571, -64079, 167761, 64079, 12752043, 1860498, -271443, 843,
+ 7881196, 3571, 4, -24476, 24476, 5778, 271443, 47, 439204, 322};
+#define n_alloc_seq (sizeof (alloc_seq)/sizeof(int))
+
+typedef struct alloc_node_s {
+ struct alloc_node_s *next;
+ struct alloc_node_s *prev;
+ shared void *ptr;
+ size_t size;
+} alloc_t;
+typedef alloc_t *alloc_p;
+
+alloc_t alloc_list;
+
+shared [] char * shared local_alloc[THREADS];
+
+/* Return a character code that hashes thread number 't'
+ and size 'size'. */
+int
+char_code (int t, size_t size)
+{
+ int c = 'A' + (size * 8 + t % 8) % 26;
+ return c;
+}
+
+/* Add entry for (p, size) into the allocated list. */
+void
+add_to_alloc_list (shared void *p, size_t size)
+{
+ alloc_p last = alloc_list.prev;
+ alloc_p a = malloc (sizeof (alloc_t));
+ if (!a)
+ { perror ("malloc"); abort (); }
+ a->prev = last;
+ a->next = &alloc_list;
+ a->ptr = p;
+ a->size = size;
+ last->next = a;
+ alloc_list.prev = a;
+}
+
+/* Return the first entry in the allocated list with
+ a size matching the 'size' parameter, and delete
+ it from the allocated list. */
+alloc_p
+remove_from_alloc_list (size_t size)
+{
+ alloc_p last = alloc_list.prev;
+ alloc_p a;
+ for (a = alloc_list.next; (a != last) && (a->size != size);
+ a = a->next) /* loop */;
+ if (a->size != size)
+ return NULL;
+ a->prev->next = a->next;
+ a->next->prev = a->prev;
+ return a;
+}
+
+void
+test24()
+{
+ const int nxt_thread = (MYTHREAD + 1) % THREADS;
+ int pass;
+ size_t i, max_alloc;
+ char *buf;
+ alloc_t alloc_list_init = {&alloc_list, &alloc_list, 0, 0};
+ alloc_list = alloc_list_init;
+ for (i = 0, max_alloc = 0; i < n_alloc_seq; ++i)
+ max_alloc = max (max_alloc, (size_t) abs(alloc_seq[i]));
+ max_alloc += 1; /* add 1 for null terminator */
+ buf = (char *) malloc (max_alloc);
+ if (!buf)
+ { perror ("malloc"); abort (); }
+ /* Global allocation test */
+#ifdef DEBUG
+ if (MYTHREAD == 0)
+ printf ("--- Global Allocation Test ---\n");
+#endif /* DEBUG */
+ upc_barrier 1;
+ for (pass = 1; pass <= 2; ++pass)
+ {
+ int de_alloc_pass = (pass == 2);
+ for (i = 0; i < n_alloc_seq; ++i)
+ {
+ size_t size = abs (alloc_seq[i]) + 1; /* add 1 for null char. */
+ int is_alloc = (alloc_seq[i] >= 0) ^ de_alloc_pass;
+ if (is_alloc)
+ {
+ int c = char_code (nxt_thread, size);
+ shared char *ptr;
+ shared [] char *s;
+ ptr = upc_all_alloc (THREADS, size);
+ if (!ptr)
+ {
+ fprintf (stderr, "%d: Error: upc_all_alloc() failed\n",
+ MYTHREAD);
+ abort ();
+ }
+ s = (shared [] char *)&ptr[nxt_thread];
+#ifdef DEBUG
+ printf ("%d: allocate %ld\n", MYTHREAD, (long int)size);
+#endif /* DEBUG */
+ /* set the data for the next thread */
+ upc_memset (s, c, size-1);
+ s[size-1] = '\0';
+ add_to_alloc_list (ptr, size);
+ }
+ else
+ {
+ int c = char_code (MYTHREAD, size);
+ alloc_p a = remove_from_alloc_list (size);
+ shared char *ptr;
+ char *s;
+ if (!a)
+ {
+ fprintf (stderr, "%d: Error: can't find alloc "
+ "list entry for size %ld\n",
+ MYTHREAD, (long int)size);
+ abort ();
+ }
+ memset (buf, c, size - 1);
+ buf[size-1] = '\0';
+ ptr = a->ptr;
+#ifdef DEBUG
+ printf ("%d: check %ld\n", MYTHREAD, (long int)size);
+#endif /* DEBUG */
+ /* shared -> local */
+ s = (char *)&ptr[MYTHREAD];
+ if (strcmp (s, buf))
+ {
+ fprintf (stderr, "%d: Error: global alloc pass %d:"
+ " data comparison failed for size %ld\n",
+ MYTHREAD, pass, (long int)size);
+ abort ();
+ }
+ free (a);
+ upc_barrier 2;
+ /* Only one thread can free the data. Choose a
+ a unique thread based upon the size of the data. */
+ if ((size_t) MYTHREAD == (size % THREADS))
+ {
+#ifdef DEBUG
+ printf ("%d: free %ld\n", MYTHREAD, (long int)size);
+#endif /* DEBUG */
+ upc_free (ptr);
+ }
+ }
+ upc_barrier 3;
+ }
+ }
+ /* Local allocation test */
+#ifdef DEBUG
+ if (MYTHREAD == 0)
+ printf ("--- Local Allocation Test ---\n");
+#endif /* DEBUG */
+ upc_barrier 4;
+ for (pass = 1; pass <= 2; ++pass)
+ {
+ int de_alloc_pass = (pass == 2);
+ for (i = 0; i < n_alloc_seq; ++i)
+ {
+ size_t size = abs (alloc_seq[i]) + 1; /* add 1 for null char. */
+ int is_alloc = (alloc_seq[i] >= 0) ^ de_alloc_pass;
+ if (is_alloc)
+ {
+ int c = char_code (nxt_thread, size);
+ shared [] char *s;
+ s = upc_alloc (size);
+ if (!s)
+ {
+ fprintf (stderr, "%d: Error: upc_all_alloc() failed\n",
+ MYTHREAD);
+ abort ();
+ }
+#ifdef DEBUG
+ printf ("%d: allocate %ld\n", MYTHREAD, (long int)size);
+#endif /* DEBUG */
+ add_to_alloc_list (s, size);
+ local_alloc[MYTHREAD] = s;
+ upc_barrier 5;
+ /* set the data for the next thread */
+ s = local_alloc[nxt_thread];
+ upc_memset (s, c, size-1);
+ s[size-1] = '\0';
+ }
+ else
+ {
+ int c = char_code (MYTHREAD, size);
+ alloc_p a = remove_from_alloc_list (size);
+ shared [] char *ptr;
+ char *s;
+ int t_free;
+ if (!a)
+ {
+ fprintf (stderr, "%d: Error: can't find alloc "
+ "list entry for size %ld\n",
+ MYTHREAD, (long int)size);
+ abort ();
+ }
+ ptr = a->ptr;
+ memset (buf, c, size - 1);
+ buf[size-1] = '\0';
+#ifdef DEBUG
+ printf ("%d: check %ld\n", MYTHREAD, (long int)size);
+#endif /* DEBUG */
+ /* shared -> local */
+ s = (char *)ptr;
+ if (strcmp (s, buf))
+ {
+ fprintf (stderr, "%d: Error: local alloc pass %d:"
+ " data comparison failed for size %ld\n",
+ MYTHREAD, pass, (long int)size);
+ abort ();
+ }
+ free (a);
+ local_alloc[MYTHREAD] = ptr;
+ upc_barrier 6;
+ /* differing threads, based upon the size of the data,
+ will free the locally allocated data of other
+ threads (possibly their own data). */
+ t_free = (MYTHREAD + size) % THREADS;
+ ptr = local_alloc[t_free];
+#ifdef DEBUG
+ printf ("%d: free %ld\n", MYTHREAD, (long int)size);
+#endif /* DEBUG */
+ upc_free (ptr);
+ }
+ upc_barrier 7;
+ }
+ }
+ free (buf);
+ upc_barrier 8;
+}
+
+int
+main()
+{
+ test24 ();
+ if (MYTHREAD == 0)
+ printf ("test24: global/local allocation test - passed.\n");
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test25.upc b/libgupc/testsuite/libgupc.upc/intrepid/test25.upc
new file mode 100644
index 00000000000..ae0f444e4e4
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test25.upc
@@ -0,0 +1,91 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+shared float f1 = 1.0;
+shared float f9 = 9.0;
+
+typedef struct { double real; double imag; } dcomplex;
+shared dcomplex complex_1_2 = { 1.0, 2.0 };
+
+/* ICE: In function '__upc_init_decls':
+ internal compiler error: in upc_shared_addr, */
+shared int * shared ptr = NULL;
+
+void
+test25 ()
+{
+ if (!MYTHREAD)
+ {
+ int error_flag = 0;
+ float f_expected, f_got;
+ double dr_expected, dr_got;
+ double di_expected, di_got;
+ f_expected = 1.0; f_got = f1;
+ if (f_got != f_expected)
+ {
+ fprintf (stderr, "Error: f1 initialization failed, "
+ "expected: %0.4g got: %0.4g\n", f_expected, f_got);
+ error_flag = 1;
+ }
+ f_expected = 9.0; f_got = f9;
+ if (f_got != f_expected)
+ {
+ fprintf (stderr, "Error: f9 initialization failed, "
+ "expected: %0.4g got: %0.4g\n", f_expected, f_got);
+ error_flag = 1;
+ }
+ dr_expected = 1.0; dr_got = complex_1_2.real;
+ di_expected = 2.0; di_got = complex_1_2.imag;
+ if ((dr_got != dr_expected) || (di_got != di_expected))
+ {
+ fprintf (stderr, "Error: complex_1_2 initialization failed, "
+ "expected: (%0.4lg,%0.4lg) got: (%0.4lg,%0.4lg)\n",
+ dr_expected, di_expected, dr_got, di_got);
+ error_flag = 1;
+ }
+ if (ptr)
+ {
+ fprintf (stderr, "Error: ptr initialization failed, "
+ " expected NULL pointer\n");
+ error_flag = 1;
+ }
+ if (error_flag)
+ abort();
+ }
+}
+
+int
+main()
+{
+ test25 ();
+ if (MYTHREAD == 0)
+ printf ("test25: UPC initialization test - passed.\n");
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test26.upc b/libgupc/testsuite/libgupc.upc/intrepid/test26.upc
new file mode 100644
index 00000000000..8bd466ed044
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test26.upc
@@ -0,0 +1,239 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define BLKSIZE 3
+#define FACTOR 33
+#define N (FACTOR * BLKSIZE)
+#define NT (N * THREADS)
+
+shared int a[NT];
+shared [BLKSIZE] int ablocked[NT];
+
+char *
+sptr (char *buf, shared void *p)
+{
+ sprintf (buf, "(0x%0lx,%ld,%ld)",
+ (long) upc_addrfield (p), (long) upc_threadof (p),
+ (long) upc_phaseof (p));
+ return buf;
+}
+
+enum cmp_op
+{ EQ_OP, NE_OP, GT_OP, GE_OP, LT_OP, LE_OP,
+ FIRST_OP = EQ_OP,
+ LAST_OP = LE_OP
+};
+const char * const op_name_tbl[] =
+ {"==", "!=", ">", ">=", "<", "<="};
+
+enum pkind {phaseless, phased};
+const char * const pkind_name_tbl[] =
+ {"phaseless", "phased"};
+
+void
+test_compare (enum pkind kind, enum cmp_op op,
+ int t0, int t1, int j, int k)
+{
+ const char *const kind_s = pkind_name_tbl[kind];
+ int bs = (kind == phased) ? BLKSIZE : 1;
+ /* Calculate the index of item 'j' on thread 't0'. */
+ int jj = ((j / bs) * THREADS + t0) * bs + (j % bs);
+ /* Calculate the index of item 'k' on thread 't1'. */
+ int kk = ((k / bs) * THREADS + t1) * bs + (k % bs);
+ int diff = (jj - kk);
+ int expected, got;
+ if (jj < 0 || jj >= NT)
+ abort ();
+ if (kk < 0 || kk >= NT)
+ abort ();
+ switch (op)
+ {
+ case EQ_OP: expected = (diff == 0); break;
+ case NE_OP: expected = (diff != 0); break;
+ case GT_OP: expected = (diff > 0); break;
+ case GE_OP: expected = (diff >= 0); break;
+ case LT_OP: expected = (diff < 0); break;
+ case LE_OP: expected = (diff <= 0); break;
+ default: abort();
+ }
+ if (kind == phased)
+ {
+ shared [] int *const pp0_phase_reset = (shared [] int *) &ablocked[jj];
+ shared [] int *const pp1_phase_reset = (shared [] int *) &ablocked[kk];
+ shared [BLKSIZE] int *pp0, *pp1;
+ pp0 = &ablocked[jj];
+ pp1 = &ablocked[kk];
+ /* Per 6.4.2p6:
+ Two compatible pointers-to-shared which point to the
+ same object (i.e. having the same address and thread
+ components) shall compare as equal according
+ to == and !=, regardless of whether the phase
+ components match. */
+ if (op == EQ_OP)
+ pp0 = (shared [BLKSIZE] int *) pp0_phase_reset;
+ else if (op == NE_OP)
+ pp1 = (shared [BLKSIZE] int *) pp1_phase_reset;
+ switch (op)
+ {
+ case EQ_OP: got = (pp0 == pp1); break;
+ case NE_OP: got = (pp0 != pp1); break;
+ case GT_OP: got = (pp0 > pp1); break;
+ case GE_OP: got = (pp0 >= pp1); break;
+ case LT_OP: got = (pp0 < pp1); break;
+ case LE_OP: got = (pp0 <= pp1); break;
+ default: abort ();
+ }
+ if (got != expected)
+ {
+ char b1[100], b2[100];
+ const char *const op_s = op_name_tbl[op];
+ const char *const p0_s = sptr (b1, pp0);
+ const char *const p1_s = sptr (b2, pp1);
+ fprintf (stderr, "test26: Error: thread %d: %s PTS comparison "
+ "%s failed.\n"
+ " t0=%d t1=%d j=%d k=%d jj=%d kk=%d "
+ "p0=%s p1=%s expected=%d got=%d\n",
+ MYTHREAD, kind_s, op_s, t0, t1, j, k, jj, kk,
+ p0_s, p1_s, expected, got);
+ abort ();
+ }
+ if (op == EQ_OP || op == NE_OP)
+ {
+ /* Per C99 6.5.9, the following comparison is allowed
+ and does not require a cast:
+ one operand is a pointer to an object or incomplete type
+ and the other is a pointer to a qualified or
+ unqualified version of void. */
+ shared void *const vp0 = (shared void *) &ablocked[jj];
+ shared void *const vp1 = (shared void *) &ablocked[kk];
+ /* xp0 and xp1 are used in error diagnostics to print
+ the operand values. */
+ shared void *xp0, *xp1;
+ switch (op)
+ {
+ case EQ_OP:
+ xp0 = pp0_phase_reset;
+ xp1 = vp1;
+ got = (pp0_phase_reset == vp1);
+ break;
+ case NE_OP:
+ xp0 = vp0;
+ xp1 = pp1_phase_reset;
+ got = (vp0 != pp1_phase_reset);
+ break;
+ default: abort ();
+ }
+ if (got != expected)
+ {
+ char b1[100], b2[100];
+ const char *const op_s = op_name_tbl[op];
+ const char *const p0_s = sptr (b1, xp0);
+ const char *const p1_s = sptr (b2, xp1);
+ fprintf (stderr, "test26: Error: thread %d: %s PTS comparison "
+ "%s to (shared void *) failed.\n"
+ " t0=%d t1=%d j=%d k=%d jj=%d kk=%d "
+ "p0=%s p1=%s expected=%d got=%d\n",
+ MYTHREAD, kind_s, op_s, t0, t1, j, k, jj, kk,
+ p0_s, p1_s, expected, got);
+ abort ();
+ }
+ }
+ }
+ else
+ {
+ shared int *p0, *p1;
+ p0 = &a[jj];
+ p1 = &a[kk];
+ switch (op)
+ {
+ case EQ_OP: got = (p0 == p1); break;
+ case NE_OP: got = (p0 != p1); break;
+ case GT_OP: got = (p0 > p1); break;
+ case GE_OP: got = (p0 >= p1); break;
+ case LT_OP: got = (p0 < p1); break;
+ case LE_OP: got = (p0 <= p1); break;
+ default: abort ();
+ }
+ if (got != expected)
+ {
+ char b1[100], b2[100];
+ const char *const op_s = op_name_tbl[op];
+ const char *const p0_s = sptr (b1, p0);
+ const char *const p1_s = sptr (b2, p1);
+ fprintf (stderr, "test26: Error: thread %d: %s "
+ "PTS comparison %s failed.\n"
+ " t0=%d t1=%d j=%d k=%d jj=%d kk=%d "
+ "p0=%s p1=%s expected=%d got=%d\n",
+ MYTHREAD, kind_s, op_s, t0, t1, j, k, jj, kk,
+ p0_s, p1_s, expected, got);
+ abort ();
+ }
+ }
+}
+
+void
+test26 ()
+{
+ enum pkind kind;
+ enum cmp_op op;
+ int t0, t1, j, k;
+ t0 = MYTHREAD;
+ for (kind = phaseless; kind <= phased; ++kind)
+ {
+ for (op = FIRST_OP; op <= LAST_OP; ++op)
+ {
+ int tmax = (THREADS > 128) ? 128 : THREADS;
+ for (t1 = 0; t1 < tmax; ++t1)
+ {
+ for (j = 0; j < N; ++j)
+ {
+ for (k = 0; k < N; ++k)
+ {
+ test_compare (kind, op, t0, t1, j, k);
+ }
+ }
+ }
+ }
+ }
+}
+
+
+int
+main ()
+{
+ test26 ();
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ printf ("test26: test pointer-to-shared comparison - passed.\n");
+ }
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test27.upc b/libgupc/testsuite/libgupc.upc/intrepid/test27.upc
new file mode 100644
index 00000000000..58c34234813
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test27.upc
@@ -0,0 +1,360 @@
+/* Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef shared [] int *sintptr;
+shared [] int bupc_206_A[10];
+sintptr bupc_206_S;
+
+typedef struct point_name
+{
+ double x;
+ double y;
+ int gid;
+} point_t;
+
+typedef struct
+{
+ int n;
+ shared [] point_t *points;
+} hullinfo_t;
+
+shared [] hullinfo_t *bupc_bug275a_hull;
+
+int *shared bupc_bug53_p;
+
+shared struct point_name *shared bupc_bug645_p;
+
+typedef struct heap_struct
+{
+ shared struct heap_struct *next;
+ size_t size;
+ int alloc_seq;
+} heap_t;
+typedef shared heap_t *heap_p;
+
+struct barrier_block
+{
+ int notify;
+ int wait;
+ int id[2];
+};
+
+typedef struct barrier_block barrier_block_t;
+shared barrier_block_t btree[THREADS];
+volatile int zero;
+
+shared heap_p global_heap;
+
+
+void
+bupc_bug53_test ()
+{
+ if (MYTHREAD == 0)
+ {
+ int i;
+ bupc_bug53_p = (int *) malloc (10 * sizeof (int));
+ for (i = 0; i < 10; i++)
+ bupc_bug53_p[i] = i;
+ for (i = 0; i < 10; i++)
+ {
+ if (bupc_bug53_p[i] != i)
+ {
+ printf ("Error: mismatch p[%d] != %d"
+ " - BUPC bug53 test failed.\n", i, i);
+ abort ();
+ }
+ }
+ free (bupc_bug53_p);
+ }
+}
+
+void
+bupc_bug206_test ()
+{
+ sintptr *local = &bupc_206_S;
+ /* Failed with ICE on following assignment. */
+ bupc_206_S = bupc_206_A;
+ /* local[0] is an alias for 'S' */
+ local[0] = NULL;
+ if (bupc_206_S != NULL)
+ {
+ fprintf (stderr, "%d: Error: S != NULL"
+ " - BUPC bug206 test failed.\n", MYTHREAD);
+ abort ();
+ }
+}
+
+void
+bupc_bug275a_test ()
+{
+ int i = 0;
+ point_t *lpoints;
+ /* Allocate hull struct on this thread */
+ bupc_bug275a_hull =
+ (shared [] hullinfo_t *) upc_alloc (sizeof (hullinfo_t));
+ if (!bupc_bug275a_hull)
+ {
+ fprintf (stderr, "%d: Error: can't allocate hull struct"
+ " - bupc_bug275a test failed.\n", MYTHREAD);
+ abort ();
+ }
+ /* Allocate 10 points in each hull structure. */
+ bupc_bug275a_hull->n = 10;
+ bupc_bug275a_hull->points =
+ (shared [] point_t *) upc_alloc (10 * sizeof (point_t));
+ if (!bupc_bug275a_hull->points)
+ {
+ fprintf (stderr, "%d: Error: can't allocate points struct"
+ " - bupc_bug275a test failed.\n", MYTHREAD);
+ abort ();
+ }
+ for (i = 0; i < 10; ++i)
+ {
+ int k = i + 1;
+ /* Failed with ICE on references to fields of points structure. */
+ bupc_bug275a_hull->points[i].x = k * 1;
+ bupc_bug275a_hull->points[i].y = k * 2;
+ bupc_bug275a_hull->points[i].gid = k * 3;
+ }
+ upc_fence;
+ lpoints = (point_t *) bupc_bug275a_hull->points;
+ for (i = 0; i < 10; ++i)
+ {
+ int k = i + 1;
+ if (lpoints[i].x != 1 * k || lpoints[i].y != 2 * k
+ || lpoints[i].gid != 3 * k)
+ {
+ fprintf (stderr, "%d: Error: lpoints[%d] mismatch"
+ " got: (%lf,%lf,%d) expected: (%d,%d,%d)"
+ " - BUPC bug275a test failed.\n",
+ MYTHREAD, i,
+ lpoints[i].x, lpoints[i].y, lpoints[i].gid,
+ 1 * k, 2 * k, 3 * k);
+ }
+ }
+ upc_free (bupc_bug275a_hull->points);
+ upc_free (bupc_bug275a_hull);
+}
+
+void
+bupc_bug645_f (struct point_name x)
+{
+ if (x.x != 5.0 || x.y != 6.0 || x.gid != 100)
+ fprintf (stderr, "%d: Error: point_name mismatch"
+ " got: (%0.3lg,%0.3lg,%i) expected: (5,6.100)"
+ " - BUPC bug645 test failed.\n", MYTHREAD, x.x, x.y, x.gid);
+}
+
+void
+bupc_bug645_test ()
+{
+ if (MYTHREAD == 0)
+ {
+ bupc_bug645_p = upc_global_alloc (1, sizeof (struct point_name));
+ if (!bupc_bug645_p)
+ {
+ fprintf (stderr, "Error: upc_global_alloc() call returned NULL"
+ " - BUPC bug645 test failed.\n");
+ abort ();
+ }
+ bupc_bug645_p->x = 5.0;
+ bupc_bug645_p->y = 6.0;
+ bupc_bug645_p->gid = 100;
+ }
+ upc_barrier;
+ bupc_bug645_f (*bupc_bug645_p);
+}
+
+struct bupc_bug979_struct
+{
+ int curid;
+ int last;
+};
+
+void
+bupc_bug979_test ()
+{
+ shared struct bupc_bug979_struct *G;
+ int got, expected;
+ G = (shared struct bupc_bug979_struct *)
+ upc_alloc (sizeof (struct bupc_bug979_struct));
+ G->curid = 1;
+ G->last = 90;
+ upc_fence;
+ /* Failed with ICE on following assignment. */
+ G->last += 10;
+ got = G->last;
+ expected = 100;
+ if (got != expected)
+ {
+ fprintf (stderr, "%d: Error: G->last mismatch, got: %d expected: %d"
+ " - BUPC bug979 test failed.\n", MYTHREAD, got, expected);
+ abort ();
+ }
+}
+
+void
+heap_init (shared void *heap_base, size_t heap_size)
+{
+ heap_p heap;
+ heap = (heap_p) heap_base;
+ upc_memset (heap, '\0', sizeof (heap_t));
+ /* the size of each free list entry includes its overhead. */
+ heap->size = heap_size;
+ heap->next = NULL;
+ heap->alloc_seq = 1;
+ /* Failed with ICE on 64-bit target, and "struct" pointer representation. */
+ global_heap = heap;
+}
+
+void
+heap_merge (heap_p ptr)
+{
+ /* Failed with ICE, with "struct" pointer representation,
+ on reference to ptr->next->alloc_seq. */
+ if (ptr->next)
+ {
+ const shared void *const next_block =
+ (shared void *) ((shared [] char *) ptr + ptr->size);
+ if ((ptr->next == next_block)
+ && (ptr->alloc_seq == ptr->next->alloc_seq))
+ {
+ /* adjacent, merge this block with the next */
+ ptr->size += ptr->next->size;
+ ptr->next = ptr->next->next;
+ }
+ }
+}
+
+#define round_up(x, r) (((x) + (r) - 1)/(r)*(r))
+#define HEAP_ALIGN 64
+
+void
+heap_test ()
+{
+ if (!MYTHREAD)
+ {
+ const size_t sz1 = round_up (sizeof (heap_t) + 195, 64);
+ const size_t sz2 = round_up (sizeof (heap_t) + 311, 64);
+ const size_t alloc_size = sz1 + sz2;
+ heap_p heap_base;
+ heap_base = (heap_p) upc_alloc (alloc_size);
+ if (!heap_base)
+ {
+ fprintf (stderr, "Error: can't allocate heap memory"
+ " - heap_test failed.\n");
+ abort ();
+ }
+ heap_init (heap_base, alloc_size);
+ if (heap_base != global_heap)
+ {
+ fprintf (stderr, "Error: heap_base != global_heap"
+ " - heap_test failed.\n");
+ abort ();
+ }
+ /* Fake allocations of 195 and 311. */
+ heap_base->size = sz1;
+ heap_base->alloc_seq = 2;
+ heap_base->next = (heap_p) ((shared [] char *) heap_base + sz1);
+ heap_base->next->size = sz2;
+ heap_base->next->alloc_seq = heap_base->alloc_seq;
+ heap_base->next->next = NULL;
+ heap_merge (heap_base);
+ upc_fence;
+ if (global_heap->size != alloc_size)
+ {
+ fprintf (stderr, "Error: unexpected heap size after merge,"
+ "got %ld expected %ld"
+ " - heap_test failed.\n",
+ (long) global_heap->size, (long) alloc_size);
+ abort ();
+ }
+ if (global_heap->alloc_seq != 2)
+ {
+ fprintf (stderr,
+ "Error: unexpected heap alloc sequence id after merge,"
+ "got %d expected %d" " - heap_test failed.\n",
+ global_heap->alloc_seq, 2);
+ abort ();
+ }
+ }
+}
+
+void
+fold_address_of_test ()
+{
+ shared int *ptr1, *ptr2;
+ zero = 0;
+ ptr1 = (shared int *) &btree[0].wait;
+ ptr2 = (shared int *) &btree[zero].wait;
+ if ((MYTHREAD == 0) && (ptr1 != ptr2))
+ {
+ fprintf (stderr, "&__upc_btreex = (%llx,%d)\n",
+ (long long) upc_addrfield (btree), (int) upc_threadof (btree));
+ fprintf (stderr, "ptr1 = (%llx,%d)\n",
+ (long long) upc_addrfield (ptr1), (int) upc_threadof (ptr1));
+ fprintf (stderr, "ptr2 = (%llx,%d)\n",
+ (long long) upc_addrfield (ptr2), (int) upc_threadof (ptr2));
+ fprintf (stderr, "ptr1 != ptr2; fold_address_of test failed\n");
+ abort ();
+ }
+}
+
+void
+test27 ()
+{
+ bupc_bug53_test ();
+ upc_barrier;
+ bupc_bug206_test ();
+ upc_barrier;
+ bupc_bug275a_test ();
+ upc_barrier;
+ bupc_bug645_test ();
+ upc_barrier;
+ bupc_bug979_test ();
+ upc_barrier;
+ heap_test ();
+ upc_barrier;
+ fold_address_of_test ();
+ upc_barrier;
+}
+
+int
+main ()
+{
+ test27 ();
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ printf
+ ("test27: Test miscellaneous pointer-to-shared references - passed.\n");
+ }
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test28.upc b/libgupc/testsuite/libgupc.upc/intrepid/test28.upc
new file mode 100644
index 00000000000..edbfa31acb1
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test28.upc
@@ -0,0 +1,117 @@
+/* Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#define N 1000
+shared unsigned long A[N * THREADS];
+shared unsigned long ix;
+
+upc_lock_t *lock;
+
+/* Burn a few random cycles */
+static void
+keep_busy ()
+{
+ volatile long busy_count;
+ busy_count = 100 + (long) (random () % 900);
+ while (--busy_count > 0) /* loop */ ;
+}
+
+/* Test for Bug 350: GUPC 4.3.2 - post-increment inside array index,
+ increments twice (for struct sptr rep). This test is derived from
+ the MTU "test_locks2" test, though does a better job of testing
+ lock correctness. */
+
+void
+test28 ()
+{
+ int i;
+ if (MYTHREAD == 0)
+ ix = 0;
+ lock = upc_all_lock_alloc ();
+ if (!lock)
+ {
+ fprintf (stderr, "Error: upc_all_lock_alloc() failed.\n");
+ abort ();
+ }
+ upc_barrier;
+ /* random seed based on thread number. */
+ srand (211 * (MYTHREAD + 1));
+ for (i = 0; i < N; ++i)
+ {
+ unsigned long ix_prev;
+ /* delay a little to randomize sequencing on the lock */
+ keep_busy ();
+ upc_lock (lock);
+ ix_prev = ix;
+ A[ix++] = ix_prev;
+ upc_unlock (lock);
+ }
+ upc_all_lock_free (lock);
+ upc_barrier;
+ if (MYTHREAD == 0)
+ {
+ int fail = 0;
+ int error_count = 0;
+ for (i = 0; i < N * THREADS; ++i)
+ {
+ unsigned long expected = i;
+ unsigned long got = A[i];
+ if (got != expected)
+ {
+ if (++error_count <= 20)
+ fprintf (stderr, "A[%2d] = %2ld, expected %2ld\n", i, got,
+ expected);
+ else if (error_count == 21)
+ fprintf (stderr, "[...]\n");
+ fail = 1;
+ }
+ }
+ if (fail)
+ {
+ fprintf (stderr, "test28: failed.\n");
+ abort ();
+ }
+ }
+}
+
+int
+main ()
+{
+ test28 ();
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ printf
+ ("test28: Test post-increment as shared array index - passed.\n");
+ }
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test29.upc b/libgupc/testsuite/libgupc.upc/intrepid/test29.upc
new file mode 100644
index 00000000000..489c851e744
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test29.upc
@@ -0,0 +1,163 @@
+/* Copyright (C) 2010-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Test Assumptions
+ 1. A "long double" has at least 64 bits of mantissa, which
+ offers 19 significant decimal digits.
+ 2. The value of PI below has 15 digits of fraction
+ and one whole digit, thus 16 significant decimal digits.
+ 3. There is some round-off in this calculation:
+ B[j] = A[j] + (xdouble) 100.0L;
+ Thus, we might expect that B[j] drops one significant
+ digit here/there.
+ 4. By allowing for a comparison to 18 significant digits, we
+ force the comparison to require at least 4 more significant
+ digits than a regular "double" (14 digits), but leave some
+ room for accumulated round-off errors. */
+
+#undef PI
+/* PI to 15 places */
+#define PI 3.141592653589793L
+typedef long double xdouble;
+
+#define N_PER_THREAD 10000
+#define N (N_PER_THREAD * THREADS)
+strict shared xdouble A[N];
+relaxed shared xdouble B[N];
+strict shared xdouble xA1, xA2;
+relaxed shared xdouble xB1, xB2;
+
+strict shared int pass_fail = 1;
+
+#define FAIL(msg) \
+ { \
+ fprintf (stderr, "%s:%d (thread %d) %s\n", \
+ __FILE__, __LINE__, MYTHREAD, msg); \
+ pass_fail = 0; \
+ abort (); \
+ }
+
+#define MSG_LEN 80
+
+void
+test29 ()
+{
+ int i;
+ if (!MYTHREAD)
+ {
+ xA1 = 100.0L * PI;
+ xB1 = 200.0L * PI;
+ }
+ for (i = MYTHREAD; i < N; i += THREADS)
+ {
+ A[i] = 100.0L + (xdouble) i * PI;
+ }
+ upc_barrier;
+ for (i = MYTHREAD; i < N; i += THREADS)
+ {
+ int j = (i + 1) % N;
+ B[j] = A[j] + (xdouble) 100.0L;
+ }
+ if (!MYTHREAD)
+ {
+ xA2 = xA1;
+ xB2 = xB1;
+ }
+ upc_barrier;
+ if (xA1 != 100.0L * PI)
+ FAIL ("xA1 != 100.0 * PI");
+ if (xB1 != 200.0L * PI)
+ FAIL ("xB1 != 200.0 * PI");
+ if (xA1 != xA2)
+ FAIL ("xA1 != xA2");
+ if (xB1 != xB2)
+ FAIL ("xB1 != xB2");
+ if (xA1 >= xB1)
+ FAIL ("xA1 >= xB1");
+ if (xA2 >= xB2)
+ FAIL ("xA2 >= xB2");
+ if (xB1 <= xA1)
+ FAIL ("xB1 <= xA1");
+ if (xB2 <= xA2)
+ FAIL ("xB2 <= xA2");
+ for (i = MYTHREAD; i < N; i += THREADS)
+ {
+ xdouble expected = (100.0L + (xdouble) i * PI);
+ xdouble got = A[i];
+ /* This comparison should be exact. */
+ if (got != expected)
+ {
+ char msg[MSG_LEN];
+ int n_chars;
+ xdouble rel_err;
+ rel_err = got / expected - 1.0L;
+ if (rel_err < 0.0)
+ rel_err = -rel_err;
+ n_chars = snprintf (msg, MSG_LEN,
+ "A[%d] is: %0.15Lf expected: %0.15Lf error: %0.2Le\n",
+ i, got, expected, rel_err);
+ if (n_chars >= MSG_LEN)
+ sprintf (msg, "A[%d] got != expected: output overflow\n", i);
+ FAIL (msg);
+ }
+ }
+ for (i = MYTHREAD; i < N; i += THREADS)
+ {
+ xdouble expected = (200.0L + (xdouble) i * PI);
+ xdouble got = B[i];
+ xdouble rel_err;
+ rel_err = got / expected - 1.0L;
+ if (rel_err < 0.0)
+ rel_err = -rel_err;
+ /* This comparison should be within 18 (ie, 3+15) digits. */
+ if (rel_err > 1.0e-18)
+ {
+ char msg[MSG_LEN];
+ int n_chars;
+ n_chars = snprintf (msg, MSG_LEN,
+ "B[%d] is: %0.15Lf expected: %0.15Lf error: %0.2Le\n",
+ i, got, expected, rel_err);
+ if (n_chars >= MSG_LEN)
+ sprintf (msg, "B[%d] got != expected: output overflow\n", i);
+ FAIL (msg);
+ }
+ }
+}
+
+int
+main ()
+{
+ test29 ();
+ upc_barrier;
+ if (!MYTHREAD)
+ printf ("test29: test shared access to long double type: %s.\n",
+ pass_fail ? "passed" : "failed");
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test30.upc b/libgupc/testsuite/libgupc.upc/intrepid/test30.upc
new file mode 100644
index 00000000000..d9f7f5afd54
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test30.upc
@@ -0,0 +1,142 @@
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+#include <upc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#if defined(__GCC_UPC__) && defined(__UPC_PTS_STRUCT_REP__)
+
+struct sptr
+{
+#if __UPC_VADDR_FIRST__
+ __UPC_VADDR_TYPE__ vaddr;
+ __UPC_THREAD_TYPE__ thread;
+ __UPC_PHASE_TYPE__ phase;
+#else
+ __UPC_PHASE_TYPE__ phase;
+ __UPC_THREAD_TYPE__ thread;
+ __UPC_VADDR_TYPE__ vaddr;
+#endif
+}
+#ifdef __UPC_PTS_ALIGN__
+__attribute__ ((aligned (__UPC_PTS_ALIGN__)))
+#endif
+ ;
+
+#define EXPECTED_PTS_ALIGN (__alignof (shared int *))
+
+struct upc_struct
+{
+ size_t len;
+ shared int *addr;
+};
+
+struct c_struct
+{
+ size_t len;
+ struct sptr addr;
+};
+
+struct upc_struct upc_a[10];
+struct c_struct c_a[10];
+
+int pass_fail = 1;
+
+void
+test30 ()
+{
+ if (!MYTHREAD)
+ {
+ if (sizeof (struct upc_struct) != sizeof (struct c_struct))
+ {
+ fprintf (stderr,
+ "Error: struct with PTS has different size (%d)\n"
+ " than the size of a struct\n"
+ " with an equivalent representation (%d)\n",
+ (int) sizeof (struct upc_struct),
+ (int) sizeof (struct c_struct));
+ pass_fail = 0;
+ }
+ if (sizeof (upc_a) != sizeof (c_a))
+ {
+ fprintf (stderr,
+ "Error: array of structs with PTS has different size (%d)\n"
+ " than the size of an array of structs\n"
+ " with an equivalent representation (%d)\n",
+ (int) sizeof (upc_a), (int) sizeof (c_a));
+ pass_fail = 0;
+ }
+ if (__alignof (upc_a[0].addr) != __alignof (c_a[0].addr))
+ {
+ fprintf (stderr,
+ "Error: PTS field of struct has different alignment (%d)\n"
+ " than the similar field of a struct with\n"
+ " with an equivalent representation (%d)\n",
+ (int) __alignof (upc_a[0].addr),
+ (int) __alignof (c_a[0].addr));
+ pass_fail = 0;
+ }
+ if (__alignof (c_a[0].addr) != EXPECTED_PTS_ALIGN)
+ {
+ fprintf (stderr,
+ "Error: PTS representation field of a struct\n"
+ " has different alignment (%d)\n"
+ " than the expected alignment of a PTS (%d)\n",
+ (int) __alignof (c_a[0].addr), (int) EXPECTED_PTS_ALIGN);
+ pass_fail = 0;
+ }
+ }
+}
+#endif
+
+int
+main ()
+{
+#ifdef __GCC_UPC__
+ #ifdef __UPC_PTS_STRUCT_REP__
+ test30 ();
+ upc_barrier;
+ if (!MYTHREAD)
+ {
+ printf ("test30: test GUPC struct PTS alignment: %s.\n",
+ pass_fail ? "passed" : "failed");
+ if (!pass_fail)
+ abort ();
+ }
+ #else
+ if (!MYTHREAD)
+ printf ("test30: test GUPC struct PTS alignment: passed.\n"
+ "(This test applies only to GUPC's struct "
+ "PTS representation)\n");
+ #endif
+#else
+ if (!MYTHREAD)
+ printf ("test30: test GUPC struct PTS alignment: non-applicable\n"
+ "(This test must be compiled with GUPC)\n");
+#endif
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/intrepid/test31.upc b/libgupc/testsuite/libgupc.upc/intrepid/test31.upc
new file mode 100644
index 00000000000..18c21149747
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/intrepid/test31.upc
@@ -0,0 +1,103 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the UPC runtime library test suite.
+ Written by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <upc.h>
+#include <upc_tick.h>
+
+
+/* Generic timing function. */
+static
+uint64_t
+ref_get_ns (void)
+{
+ struct timeval tv;
+ uint64_t t;
+ if (gettimeofday (&tv, NULL) != 0)
+ {
+ perror ("gettimeofday");
+ abort ();
+ }
+ t = (uint64_t) tv.tv_sec * 1000000000LL
+ + (uint64_t) tv.tv_usec * 1000LL;
+ return t;
+}
+
+void
+test31 (void)
+{
+ upc_tick_t start, stop, elapsed;
+ uint64_t ref_start_ns, ref_stop_ns, ref_elapsed_ns;
+ uint64_t elapsed_ns;
+ double elapsed_sec, total_elapsed_sec;
+ double ref_elapsed_sec, ref_pct_err;
+ upc_barrier;
+ ref_start_ns = ref_get_ns();
+ total_elapsed_sec = 0.0;
+ for (int n = 0; n < 100; ++n)
+ {
+ start = upc_ticks_now ();
+ /* Sleep 0.01 seconds */
+ usleep (10000L);
+ stop = upc_ticks_now ();
+ elapsed = (stop - start);
+ elapsed_ns = upc_ticks_to_ns (elapsed);
+ elapsed_sec = (double) elapsed_ns * 1.0e-9;
+ total_elapsed_sec += elapsed_sec;
+ }
+ ref_stop_ns = ref_get_ns();
+ ref_elapsed_ns = (ref_stop_ns - ref_start_ns);
+ ref_elapsed_sec = (double) ref_elapsed_ns * 1.0e-9;
+ ref_pct_err = 100.0 * (1.0 - total_elapsed_sec / ref_elapsed_sec);
+ if (ref_pct_err < 0.0)
+ ref_pct_err = -ref_pct_err;
+#ifdef DEBUG
+ printf ("elapsed: %0.5g ref: %0.5g error: %0.5g\n",
+ total_elapsed_sec, ref_elapsed_sec, ref_pct_err);
+#endif
+ if (ref_pct_err > 3.0)
+ {
+ fprintf (stderr, "upc_tick differs from reference by "
+ "more than 3%% on thread %d\n"
+ "measured error is: %0.1f%%\n",
+ MYTHREAD, ref_pct_err);
+ abort ();
+ }
+ upc_barrier;
+ if (!MYTHREAD)
+ printf ("test31: upc_tick wall clock timer library test - passed.\n");
+}
+
+int
+main ()
+{
+ test31 ();
+ return 0;
+}
diff --git a/libgupc/testsuite/libgupc.upc/upc.exp b/libgupc/testsuite/libgupc.upc/upc.exp
new file mode 100644
index 00000000000..a37f1e866ef
--- /dev/null
+++ b/libgupc/testsuite/libgupc.upc/upc.exp
@@ -0,0 +1,37 @@
+if [info exists lang_library_path] then {
+ unset lang_library_path
+ unset lang_link_flags
+}
+if [info exists lang_test_file] then {
+ unset lang_test_file
+}
+if [info exists lang_include_flags] then {
+ unset lang_include_flags
+}
+
+load_lib libgupc-dg.exp
+load_gcc_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS "-O2 -fupc-threads=2"
+}
+
+# Initialize dg.
+dg-init
+
+# Turn on UPC.
+lappend ALWAYS_CFLAGS "additional_flags=-fupc"
+
+# Gather a list of all tests.
+set tests [lsort [find $srcdir/$subdir *.upc]]
+
+set ld_library_path $always_ld_library_path
+append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+set_ld_library_path_env_vars
+
+# Main loop.
+dg-runtest $tests "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/libgupc/upc-crtbegin.spec.in b/libgupc/upc-crtbegin.spec.in
new file mode 100644
index 00000000000..ead77e7545f
--- /dev/null
+++ b/libgupc/upc-crtbegin.spec.in
@@ -0,0 +1,3 @@
+# This spec file is read by gcc when linking. It is used to specify the
+# standard libraries we need in order to link with -fupc.
+*upc_crtbegin: @upc_crtbegin_spec@
diff --git a/libgupc/upc-crtend.spec.in b/libgupc/upc-crtend.spec.in
new file mode 100644
index 00000000000..2dbfff1eb9b
--- /dev/null
+++ b/libgupc/upc-crtend.spec.in
@@ -0,0 +1,3 @@
+# This spec file is read by gcc when linking. It is used to specify the
+# standard libraries we need in order to link with -fupc.
+*upc_crtend: @upc_crtend_spec@
diff --git a/libgupc/upc-crtstuff.c b/libgupc/upc-crtstuff.c
new file mode 100644
index 00000000000..66f15db005d
--- /dev/null
+++ b/libgupc/upc-crtstuff.c
@@ -0,0 +1,66 @@
+/* upc-crtstuff.c: UPC specific "C Runtime Support"
+ Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ Contributed by Gary Funck <gary@intrepid.com>
+ and Nenad Vukicevic <nenad@intrepid.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "upc-crt-config.h"
+#include "upc-crt-begin-end.h"
+
+/* Only define section start/end if no link script is used. */
+
+#ifdef CRT_BEGIN
+
+/* Shared begin is always defined in order to allocate space
+ at the beginning of the section. */
+#ifdef UPC_SHARED_SECTION_BEGIN
+/* Establish a symbol at the beginning of the data section. */
+UPC_SHARED_SECTION_BEGIN
+#endif /* UPC_SHARED_SECTION_BEGIN */
+
+#ifndef HAVE_UPC_LINK_SCRIPT
+#ifdef UPC_PGM_INFO_SECTION_BEGIN
+/* Establish a symbol at the beginning of the program info data section. */
+UPC_PGM_INFO_SECTION_BEGIN
+#endif /* UPC_PGM_INFO_SECTION_BEGIN */
+#ifdef UPC_INIT_ARRAY_SECTION_BEGIN
+/* Establish a symbol at the beginning of the initialization array section. */
+UPC_INIT_ARRAY_SECTION_BEGIN
+#endif /* UPC_INIT_ARRAY_SECTION_BEGIN */
+#endif /* !HAVE_UPC_LINK_SCRIPT */
+
+#elif defined(CRT_END) /* ! CRT_BEGIN */
+
+#ifndef HAVE_UPC_LINK_SCRIPT
+#ifdef UPC_SHARED_SECTION_END
+/* Establish a symbol at the end of the shared data section. */
+UPC_SHARED_SECTION_END
+#endif /* UPC_SHARED_SECTION_END */
+#ifdef UPC_PGM_INFO_SECTION_END
+/* Establish a symbol at the end of the program info data section. */
+UPC_PGM_INFO_SECTION_END
+#endif /* UPC_PGM_INFO_SECTION_END */
+#ifdef UPC_INIT_ARRAY_SECTION_END
+/* Establish a symbol at the end of the initialization array section. */
+UPC_INIT_ARRAY_SECTION_END
+#endif /* UPC_INIT_ARRAY_SECTION_END */
+#endif /* !HAVE_UPC_LINK_SCRIPT */
+#else /* ! CRT_BEGIN && ! CRT_END */
+#error "One of CRT_BEGIN or CRT_END must be defined."
+#endif