diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-09-22 09:29:13 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-09-22 09:29:13 +0200 |
commit | 059b819e3c94aae3dd0be55bd512ee6ee4e28798 (patch) | |
tree | bb8b074085f64d452820b382f51a65c04cf26448 /gcc/tree-pretty-print.c | |
parent | 578b76873383784841f5478573f4ac5d251aa0ba (diff) | |
download | gcc-059b819e3c94aae3dd0be55bd512ee6ee4e28798.zip gcc-059b819e3c94aae3dd0be55bd512ee6ee4e28798.tar.gz gcc-059b819e3c94aae3dd0be55bd512ee6ee4e28798.tar.bz2 |
openmp: Add support for allocator and align modifiers on allocate clauses
As the allocate-2.c testcase shows, this change isn't 100% backwards compatible,
one could have allocate and/or align functions that return an OpenMP allocator
handle and previously it would call those functions and now would use those
names as keywords for the modifiers. But it allows specify extra alignment
requirements for the allocations.
2021-09-22 Jakub Jelinek <jakub@redhat.com>
gcc/
* tree.h (OMP_CLAUSE_ALLOCATE_ALIGN): Define.
* tree.c (omp_clause_num_ops): Change number of OMP_CLAUSE_ALLOCATE
arguments from 2 to 3.
* tree-pretty-print.c (dump_omp_clause): Print allocator() around
allocate clause allocator and print align if present.
* omp-low.c (scan_sharing_clauses): Force allocate_map entry even
for omp_default_mem_alloc if align modifier is present. If align
modifier is present, use TREE_LIST to encode both allocator and
align.
(lower_private_allocate, lower_rec_input_clauses, create_task_copyfn):
Handle align modifier on allocator clause if present.
gcc/c-family/
* c-omp.c (c_omp_split_clauses): Copy over OMP_CLAUSE_ALLOCATE_ALIGN.
gcc/c/
* c-parser.c (c_parser_omp_clause_allocate): Parse allocate clause
modifiers.
gcc/cp/
* parser.c (cp_parser_omp_clause_allocate): Parse allocate clause
modifiers.
* semantics.c (finish_omp_clauses) <OMP_CLAUSE_ALLOCATE>: Perform
semantic analysis of OMP_CLAUSE_ALLOCATE_ALIGN.
* pt.c (tsubst_omp_clauses) <case OMP_CLAUSE_ALLOCATE>: Handle
also OMP_CLAUSE_ALLOCATE_ALIGN.
gcc/testsuite/
* c-c++-common/gomp/allocate-6.c: New test.
* c-c++-common/gomp/allocate-7.c: New test.
* g++.dg/gomp/allocate-4.C: New test.
libgomp/
* testsuite/libgomp.c-c++-common/allocate-2.c: New test.
* testsuite/libgomp.c-c++-common/allocate-3.c: New test.
Diffstat (limited to 'gcc/tree-pretty-print.c')
-rw-r--r-- | gcc/tree-pretty-print.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 7de12f3..35e567c 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -735,10 +735,23 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags) pp_string (pp, "allocate("); if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause)) { + pp_string (pp, "allocator("); dump_generic_node (pp, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause), spc, flags, false); - pp_colon (pp); + pp_right_paren (pp); + } + if (OMP_CLAUSE_ALLOCATE_ALIGN (clause)) + { + if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause)) + pp_comma (pp); + pp_string (pp, "align("); + dump_generic_node (pp, OMP_CLAUSE_ALLOCATE_ALIGN (clause), + spc, flags, false); + pp_right_paren (pp); } + if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause) + || OMP_CLAUSE_ALLOCATE_ALIGN (clause)) + pp_colon (pp); dump_generic_node (pp, OMP_CLAUSE_DECL (clause), spc, flags, false); pp_right_paren (pp); |