This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp4 2/6] Prepare for extending omp_clause_map_kind.
- From: <thomas at codesourcery dot com>
- To: <jakub at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>
- Date: Tue, 14 Jan 2014 16:10:04 +0100
- Subject: [gomp4 2/6] Prepare for extending omp_clause_map_kind.
- Authentication-results: sourceware.org; auth=none
- References: <87ppnuvbv6 dot fsf at schwinge dot name> <1389712208-416-1-git-send-email-thomas at codesourcery dot com>
From: Thomas Schwinge <thomas@codesourcery.com>
gcc/
* tree-core.h (omp_clause_map_kind): Make the identifiers' bit
patterns more obvious. Add comments.
* omp-low.c (lower_oacc_parallel, lower_omp_target): Test for
omp_clause_map_kind flags set instead of for values.
---
gcc/omp-low.c | 22 ++++++++++++++--------
gcc/tree-core.h | 16 +++++++++++-----
2 files changed, 25 insertions(+), 13 deletions(-)
diff --git gcc/omp-low.c gcc/omp-low.c
index eb755c3..899e970 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -8855,13 +8855,16 @@ lower_oacc_parallel (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree avar = create_tmp_var (TREE_TYPE (var), NULL);
mark_addressable (avar);
- if (OMP_CLAUSE_MAP_KIND (c) != OMP_CLAUSE_MAP_ALLOC
- && OMP_CLAUSE_MAP_KIND (c) != OMP_CLAUSE_MAP_FROM)
+ enum omp_clause_map_kind map_kind
+ = OMP_CLAUSE_MAP_KIND (c);
+ if ((!(map_kind & OMP_CLAUSE_MAP_SPECIAL)
+ && (map_kind & OMP_CLAUSE_MAP_TO))
+ || map_kind == OMP_CLAUSE_MAP_POINTER)
gimplify_assign (avar, var, &ilist);
avar = build_fold_addr_expr (avar);
gimplify_assign (x, avar, &ilist);
- if ((OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_FROM
- || OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_TOFROM)
+ if ((!(map_kind & OMP_CLAUSE_MAP_SPECIAL)
+ && (map_kind & OMP_CLAUSE_MAP_FROM))
&& !TYPE_READONLY (TREE_TYPE (var)))
{
x = build_sender_ref (ovar, ctx);
@@ -10331,13 +10334,16 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gcc_assert (kind == GF_OMP_TARGET_KIND_REGION);
tree avar = create_tmp_var (TREE_TYPE (var), NULL);
mark_addressable (avar);
- if (OMP_CLAUSE_MAP_KIND (c) != OMP_CLAUSE_MAP_ALLOC
- && OMP_CLAUSE_MAP_KIND (c) != OMP_CLAUSE_MAP_FROM)
+ enum omp_clause_map_kind map_kind
+ = OMP_CLAUSE_MAP_KIND (c);
+ if ((!(map_kind & OMP_CLAUSE_MAP_SPECIAL)
+ && (map_kind & OMP_CLAUSE_MAP_TO))
+ || map_kind == OMP_CLAUSE_MAP_POINTER)
gimplify_assign (avar, var, &ilist);
avar = build_fold_addr_expr (avar);
gimplify_assign (x, avar, &ilist);
- if ((OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_FROM
- || OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_TOFROM)
+ if ((!(map_kind & OMP_CLAUSE_MAP_SPECIAL)
+ && (map_kind & OMP_CLAUSE_MAP_FROM))
&& !TYPE_READONLY (TREE_TYPE (var)))
{
x = build_sender_ref (ovar, ctx);
diff --git gcc/tree-core.h gcc/tree-core.h
index e2750e0..3602b5f 100644
--- gcc/tree-core.h
+++ gcc/tree-core.h
@@ -1112,14 +1112,20 @@ enum omp_clause_depend_kind
enum omp_clause_map_kind
{
- OMP_CLAUSE_MAP_ALLOC,
- OMP_CLAUSE_MAP_TO,
- OMP_CLAUSE_MAP_FROM,
- OMP_CLAUSE_MAP_TOFROM,
+ /* If not already present, allocate. */
+ OMP_CLAUSE_MAP_ALLOC = 0,
+ /* ..., and copy to device. */
+ OMP_CLAUSE_MAP_TO = 1 << 0,
+ /* ..., and copy from device. */
+ OMP_CLAUSE_MAP_FROM = 1 << 1,
+ /* ..., and copy to and from device. */
+ OMP_CLAUSE_MAP_TOFROM = OMP_CLAUSE_MAP_TO | OMP_CLAUSE_MAP_FROM,
+ /* Special map kinds. */
+ OMP_CLAUSE_MAP_SPECIAL = 1 << 2,
/* The following kind is an internal only map kind, used for pointer based
array sections. OMP_CLAUSE_SIZE for these is not the pointer size,
which is implicitly POINTER_SIZE / BITS_PER_UNIT, but the bias. */
- OMP_CLAUSE_MAP_POINTER
+ OMP_CLAUSE_MAP_POINTER = OMP_CLAUSE_MAP_SPECIAL
};
enum omp_clause_proc_bind_kind
--
1.8.1.1