gcc/
commit2b4ed8e0a06135d28b80161ffeec76fd579a6802
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Jul 2015 17:12:19 +0000 (29 17:12 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Jul 2015 17:12:19 +0000 (29 17:12 +0000)
treefdfda8965a2a06e1f2fba1c89fb475a295225165
parent4615ba4137428ad326d8894abd43326a993d3ee9
gcc/
* tree.h (OMP_TARGET_COMBINED): Define.
(OMP_CLAUSE_SET_MAP_KIND): Cast to unsigned int rather than unsigned
char.
(OMP_CLAUSE_MAP_PRIVATE,
OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION): Define.
* tree-core.h (struct tree_omp_clause): Change type of map_kind
from unsigned char to unsigned int.
* gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_0LEN_ARRAY.
(enum omp_region_type): Add ORT_COMBINED_TARGET.
(struct gimplify_omp_ctx): Add target_map_scalars_firstprivate,
target_map_pointers_as_0len_arrays and
target_firstprivatize_array_bases fields.
(maybe_fold_stmt): Adjust check for ORT_TARGET for the addition of
ORT_COMBINED_TARGET.
(omp_notice_threadprivate_variable): Likewise.
(omp_firstprivatize_variable): Likewise.
If ctx->target_map_scalars_firstprivate is set, firstprivatize
as GOVD_FIRSTPRIVATE.
(omp_add_variable): Allow map clause together with data sharing
clauses.  For data sharing clause with VLA decl
on omp target/target data don't add firstprivate for the pointer.
(omp_notice_variable): Adjust check for ORT_TARGET for the addition
of ORT_COMBINED_TARGET.  Handle implicit mapping of pointers
as zero length array sections and
ctx->target_map_scalars_firstprivate mapping of scalars as
firstprivate data sharing.
(gimplify_scan_omp_clauses): Initialize
ctx->target_map_scalars_firstprivate,
ctx->target_firstprivatize_array_bases and
ctx->target_map_pointers_as_0len_arrays.  Add firstprivate for
linear clause even to target region if combined.  Remove
map clauses with GOMP_MAP_FIRSTPRIVATE_POINTER kind from
OMP_TARGET_{,ENTER_,EXIT_}DATA.  For GOMP_MAP_FIRSTPRIVATE_POINTER
map kind with non-INTEGER_CST OMP_CLAUSE_SIZE firstprivatize
the bias.
(gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_0LEN_ARRAY.
If gimplify_omp_ctxp->target_firstprivatize_array_bases, use
GOMP_MAP_FIRSTPRIVATE_POINTER map kind instead of
GOMP_MAP_POINTER.
(gimplify_adjust_omp_clauses): Adjust check for ORT_TARGET for the
addition of ORT_COMBINED_TARGET.  Use
GOMP_MAP_FIRSTPRIVATE_POINTER instead of GOMP_MAP_POINTER if
ctx->target_firstprivatize_array_bases for VLAs.  Set
OMP_CLAUSE_MAP_PRIVATE if both data sharing and map clause
appear together.
(gimplify_omp_workshare): Adjust check for ORT_TARGET for the
addition of ORT_COMBINED_TARGET.  Use ORT_COMBINED_TARGET if
OMP_TARGET_COMBINED.
* omp-low.c (lookup_sfield): Change first argument to
splay_tree_key, add overload with tree first argument.
(maybe_lookup_field): Likewise.
(build_sender_ref): Likewise.
(scan_sharing_clauses): Handle VLAs in target firstprivate and
is_device_ptr clauses.  Fix up variable shadowing.  Handle
OMP_CLAUSE_USE_DEVICE_PTR.  Handle OMP_CLAUSE_MAP_PRIVATE.  Handle
GOMP_MAP_FIRSTPRIVATE_POINTER map kind.
(handle_simd_reference): Use get_name.
(lower_rec_input_clauses): Likewise.  Use BUILT_IN_ALLOCA_WITH_ALIGN
instead of BUILT_IN_ALLOCA.
(lower_send_clauses): Use new lookup_sfield overload.
(lower_omp_target): Handle GOMP_MAP_FIRSTPRIVATE_POINTER map kind.
Handle OMP_CLAUSE_PRIVATE VLAs.  Handle OMP_CLAUSE_USE_DEVICE_PTR,
handle arrays and references to arrays in OMP_CLAUSE_IS_DEVICE_PTR
clause.  Handle OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION.
* tree-pretty-print.c (dump_omp_clause): Handle
GOMP_MAP_FIRSTPRIVATE_POINTER.
gcc/c/
* c-tree.h (c_finish_omp_clauses): Add is_omp argument.
* c-parser.c (c_parser_oacc_all_clauses, c_parser_omp_all_clauses,
c_parser_oacc_cache, omp_split_clauses, c_parser_cilk_for): Adjust
c_finish_omp_clauses callers.
(c_parser_omp_target_data, c_parser_omp_target_enter_data,
c_parser_omp_target_exit_data): Disallow GOMP_MAP_POINTER, allow
GOMP_MAP_FIRSTPRIVATE_POINTER but don't set map_seen for it.
(c_parser_omp_target): Set OMP_TARGET_COMBINED if combined.
Disallow GOMP_MAP_POINTER, allow GOMP_MAP_FIRSTPRIVATE_POINTER.
* c-typeck.c (handle_omp_array_sections): Add is_omp argument.
Set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if needed.
Use GOMP_MAP_FIRSTPRIVATE_POINTER instead of GOMP_MAP_POINTER
if is_omp.
(c_finish_omp_clauses): Add is_omp argument, pass it down to
handle_omp_array_sections.  Handle GOMP_MAP_FIRSTPRIVATE_POINTER.
For is_device_ptr/use_device_ptr clauses allow ARRAY_TYPE.
gcc/cp/
* parser.c (cp_parser_omp_target_data, cp_parser_omp_target_enter_data,
cp_parser_omp_target_exit_data): Formatting fixes.  Disallow
GOMP_MAP_POINTER, allow GOMP_MAP_FIRSTPRIVATE_POINTER but don't set
map_seen for it.
(cp_parser_omp_target): Set OMP_TARGET_COMBINED if combined.
Disallow GOMP_MAP_POINTER, allow GOMP_MAP_FIRSTPRIVATE_POINTER.
* semantics.c (handle_omp_array_sections): Add is_omp argument.
Set OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if needed.
Use GOMP_MAP_FIRSTPRIVATE_POINTER instead of GOMP_MAP_POINTER
if is_omp.
(finish_omp_clauses): Handle GOMP_MAP_FIRSTPRIVATE_POINTER.
For is_device_ptr/use_device_ptr clauses allow ARRAY_TYPE
and REFERENCE_TYPE to ARRAY_TYPE.
include/
* gomp-constants.h (enum gomp_map_kind): Add
GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR,
GOMP_MAP_ZERO_LEN_ARRAY_SECTION and
GOMP_MAP_FIRSTPRIVATE_POINTER.
libgomp/
* libgomp.h (struct target_var_desc): Fix up comments
about offset and length fields.
* target.c (gomp_map_lookup): New function.
(gomp_map_pointer): Use it.
(gomp_map_vars): Handle GOMP_MAP_FIRSTPRIVATE_INT,
GOMP_MAP_USE_DEVICE_PTR and GOMP_MAP_ZERO_LEN_ARRAY_SECTION.
Add tgt->list[i].offset for mappings with non-NULL
tgt->list[i].key.
(GOMP_target_41): Handle GOMP_MAP_FIRSTPRIVATE even
for host fallback.
(omp_target_is_present): Use gomp_map_lookup.
(omp_target_associate_ptr): Likewise.
(omp_target_disassociate_ptr): Likewise.
* testsuite/libgomp.c++/target-2.C (fn2): Add map(tofrom: s).
* testsuite/libgomp.c++/target-7.C: New test.
* testsuite/libgomp.c++/target-8.C: New test.
* testsuite/libgomp.c++/target-9.C: New test.
* testsuite/libgomp.c/target-1.c (fn2, fn3, fn4): Add
map(tofrom:s).
* testsuite/libgomp.c/target-2.c (fn2, fn3, fn4): Likewise.
* testsuite/libgomp.c/target-7.c (foo): Add map(h) where needed.
* testsuite/libgomp.c/target-15.c: New test.
* testsuite/libgomp.c/target-16.c: New test.
* testsuite/libgomp.c/target-17.c: New test.
* testsuite/libgomp.c/target-18.c: New test.
* testsuite/libgomp.c/target-19.c: New test.
* testsuite/libgomp.c/examples-4/e.51.3.c (gramSchmidt): Add
map(tofrom:tmp).
* testsuite/libgomp.c/examples-4/e.53.1.c (fib_wrapper): Add
map(from:x).
* testsuite/libgomp.c/examples-4/e.53.4.c (accum): Add
map(tofrom:tmp).
* testsuite/libgomp.c/examples-4/e.53.5.c (accum): Likewise.
* testsuite/libgomp.c/examples-4/e.54.2.c (dotprod): Add
map(tofrom: sum).
* testsuite/libgomp.c/examples-4/e.54.3.c (dotprod): Likewise.
* testsuite/libgomp.c/examples-4/e.54.4.c (dotprod): Likewise.
* testsuite/libgomp.c/examples-4/e.57.1.c (main): Add
map(from: c) and map(from: b, d) where needed.
* testsuite/libgomp.c/examples-4/e.57.3.c (main): Add
map(from: res).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_1-branch@226356 138bc75d-0d04-0410-961f-82ee72b054a4
39 files changed:
gcc/ChangeLog.gomp
gcc/c/ChangeLog.gomp
gcc/c/c-parser.c
gcc/c/c-tree.h
gcc/c/c-typeck.c
gcc/cp/ChangeLog.gomp
gcc/cp/parser.c
gcc/cp/semantics.c
gcc/gimplify.c
gcc/omp-low.c
gcc/tree-core.h
gcc/tree-pretty-print.c
gcc/tree.h
include/ChangeLog.gomp
include/gomp-constants.h
libgomp/ChangeLog.gomp
libgomp/libgomp.h
libgomp/target.c
libgomp/testsuite/libgomp.c++/target-2.C
libgomp/testsuite/libgomp.c++/target-7.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-8.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-9.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c/examples-4/e.51.3.c
libgomp/testsuite/libgomp.c/examples-4/e.53.1.c
libgomp/testsuite/libgomp.c/examples-4/e.53.4.c
libgomp/testsuite/libgomp.c/examples-4/e.53.5.c
libgomp/testsuite/libgomp.c/examples-4/e.54.2.c
libgomp/testsuite/libgomp.c/examples-4/e.54.3.c
libgomp/testsuite/libgomp.c/examples-4/e.54.4.c
libgomp/testsuite/libgomp.c/examples-4/e.57.1.c
libgomp/testsuite/libgomp.c/examples-4/e.57.3.c
libgomp/testsuite/libgomp.c/target-1.c
libgomp/testsuite/libgomp.c/target-15.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/target-16.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/target-17.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/target-18.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/target-19.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/target-2.c
libgomp/testsuite/libgomp.c/target-7.c