From 324f918438715b4a0d024af5930628c1674f4fcd Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 19 Jan 2019 08:50:56 +0000 Subject: Update the file headers across all of the LLVM projects in the monorepo to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/OpenMPKinds.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/Basic/OpenMPKinds.cpp') diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index a5bfac86e6..c89c96f82d 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -1,9 +1,8 @@ //===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// \file -- cgit v1.2.3 From d58879f85687fa30cafb3d377bbf05a6929a8032 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Mon, 28 Jan 2019 17:04:11 +0000 Subject: [clang][OpenMP] OMPFlushClause is synthetic, no such clause exists Summary: As discussed in https://reviews.llvm.org/D57112#inline-506781, 'flush' clause does not exist in the OpenMP spec, it can not be specified, and `OMPFlushClause` class is just a helper class. Therefore `OPENMP_CLAUSE()` in `clang/Basic/OpenMPKinds.def` should not contain 'flush' "clause". I have simply removed the `OPENMP_CLAUSE(flush, OMPFlushClause)` from `clang/Basic/OpenMPKinds.def`, grepped for `OPENMP_CLAUSE` and added `OPENMP_CLAUSE(flush, OMPFlushClause)` back to the **every** place where `OPENMP_CLAUSE` is defined and `clang/Basic/OpenMPKinds.def` is then included. So as-is, this patch is a NFC. Possibly, some of these `OPENMP_CLAUSE(flush, OMPFlushClause)` should be dropped, i don't really know. Test plan: `ninja check-clang` Reviewers: ABataev Reviewed By: ABataev Subscribers: guansong, arphaman, cfe-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D57280 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352390 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/OpenMPKinds.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/Basic/OpenMPKinds.cpp') diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index c89c96f82d..c421517006 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -67,6 +67,8 @@ const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) { case OMPC_##Name: \ return #Name; #include "clang/Basic/OpenMPKinds.def" + case OMPC_flush: + return "flush"; case OMPC_uniform: return "uniform"; case OMPC_threadprivate: -- cgit v1.2.3 From e93ddfad28fbdc140c8b92f273c602876342d030 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 1 Feb 2019 20:25:04 +0000 Subject: [OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive. This patch implements parsing and sema for "omp declare mapper" directive. User defined mapper, i.e., declare mapper directive, is a new feature in OpenMP 5.0. It is introduced to extend existing map clauses for the purpose of simplifying the copy of complex data structures between host and device (i.e., deep copy). An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(struct S s) map(s, s.d[0:s.len]) // Memory region that d points to is also mapped using this mapper. Contributed-by: Lingda Li Differential Revision: https://reviews.llvm.org/D56326 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352906 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/OpenMPKinds.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/Basic/OpenMPKinds.cpp') diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index c421517006..ea8a46b495 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -761,6 +761,16 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind, #define OPENMP_TASKGROUP_CLAUSE(Name) \ case OMPC_##Name: \ return true; +#include "clang/Basic/OpenMPKinds.def" + default: + break; + } + break; + case OMPD_declare_mapper: + switch (CKind) { +#define OPENMP_DECLARE_MAPPER_CLAUSE(Name) \ + case OMPC_##Name: \ + return true; #include "clang/Basic/OpenMPKinds.def" default: break; @@ -1000,6 +1010,7 @@ void clang::getOpenMPCaptureRegions( case OMPD_cancel: case OMPD_flush: case OMPD_declare_reduction: + case OMPD_declare_mapper: case OMPD_declare_simd: case OMPD_declare_target: case OMPD_end_declare_target: -- cgit v1.2.3 From 8130704f582967dffaa0e99c1fe23889c2b6a0ba Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 22 Feb 2019 22:29:42 +0000 Subject: [OpenMP 5.0] Parsing/sema support for to clause with mapper modifier. This patch implements the parsing and sema support for OpenMP to clause with potential user-defined mappers attached. User defined mapper is a new feature in OpenMP 5.0. A to/from clause can have an explicit or implicit associated mapper, which instructs the compiler to generate and use customized mapping functions. An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len]) struct S ss; #pragma omp target update to(mapper(id): ss) // use the mapper with name 'id' to map ss to device Contributed-by: Differential Revision: https://reviews.llvm.org/D58523 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354698 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/OpenMPKinds.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'lib/Basic/OpenMPKinds.cpp') diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index ea8a46b495..47830c324d 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -116,6 +116,12 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, .Case(#Name, static_cast(OMPC_MAP_MODIFIER_##Name)) #include "clang/Basic/OpenMPKinds.def" .Default(OMPC_MAP_unknown); + case OMPC_to: + return llvm::StringSwitch(Str) +#define OPENMP_TO_MODIFIER_KIND(Name) \ + .Case(#Name, static_cast(OMPC_TO_MODIFIER_##Name)) +#include "clang/Basic/OpenMPKinds.def" + .Default(OMPC_TO_MODIFIER_unknown); case OMPC_dist_schedule: return llvm::StringSwitch(Str) #define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name) @@ -174,7 +180,6 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, case OMPC_num_tasks: case OMPC_hint: case OMPC_uniform: - case OMPC_to: case OMPC_from: case OMPC_use_device_ptr: case OMPC_is_device_ptr: @@ -260,6 +265,18 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, break; } llvm_unreachable("Invalid OpenMP 'map' clause type"); + case OMPC_to: + switch (Type) { + case OMPC_TO_MODIFIER_unknown: + return "unknown"; +#define OPENMP_TO_MODIFIER_KIND(Name) \ + case OMPC_TO_MODIFIER_##Name: \ + return #Name; +#include "clang/Basic/OpenMPKinds.def" + default: + break; + } + llvm_unreachable("Invalid OpenMP 'to' clause type"); case OMPC_dist_schedule: switch (Type) { case OMPC_DIST_SCHEDULE_unknown: @@ -333,7 +350,6 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, case OMPC_num_tasks: case OMPC_hint: case OMPC_uniform: - case OMPC_to: case OMPC_from: case OMPC_use_device_ptr: case OMPC_is_device_ptr: -- cgit v1.2.3 From 01e162c2965d114aa4e21c91b6341454210ad8fb Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 25 Feb 2019 20:34:15 +0000 Subject: [OpenMP 5.0] Parsing/sema support for from clause with mapper modifier. This patch implements the parsing and sema support for the OpenMP 'from'-clause with potential user-defined mappers attached. User-defined mappers are a new feature in OpenMP 5.0. A 'from'-clause can have an explicit or implicit associated mapper, which instructs the compiler to generate and use customized mapping functions. An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len]) struct S ss; #pragma omp target update from(mapper(id): ss) // use the mapper with name 'id' to map ss from device Contributed-by: Lingda Li Differential Revision: https://reviews.llvm.org/D58638 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354817 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/OpenMPKinds.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'lib/Basic/OpenMPKinds.cpp') diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index 47830c324d..b10c6d2498 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -122,6 +122,12 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, .Case(#Name, static_cast(OMPC_TO_MODIFIER_##Name)) #include "clang/Basic/OpenMPKinds.def" .Default(OMPC_TO_MODIFIER_unknown); + case OMPC_from: + return llvm::StringSwitch(Str) +#define OPENMP_FROM_MODIFIER_KIND(Name) \ + .Case(#Name, static_cast(OMPC_FROM_MODIFIER_##Name)) +#include "clang/Basic/OpenMPKinds.def" + .Default(OMPC_FROM_MODIFIER_unknown); case OMPC_dist_schedule: return llvm::StringSwitch(Str) #define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name) @@ -180,7 +186,6 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, case OMPC_num_tasks: case OMPC_hint: case OMPC_uniform: - case OMPC_from: case OMPC_use_device_ptr: case OMPC_is_device_ptr: case OMPC_unified_address: @@ -277,6 +282,18 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, break; } llvm_unreachable("Invalid OpenMP 'to' clause type"); + case OMPC_from: + switch (Type) { + case OMPC_FROM_MODIFIER_unknown: + return "unknown"; +#define OPENMP_FROM_MODIFIER_KIND(Name) \ + case OMPC_FROM_MODIFIER_##Name: \ + return #Name; +#include "clang/Basic/OpenMPKinds.def" + default: + break; + } + llvm_unreachable("Invalid OpenMP 'from' clause type"); case OMPC_dist_schedule: switch (Type) { case OMPC_DIST_SCHEDULE_unknown: @@ -350,7 +367,6 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, case OMPC_num_tasks: case OMPC_hint: case OMPC_uniform: - case OMPC_from: case OMPC_use_device_ptr: case OMPC_is_device_ptr: case OMPC_unified_address: -- cgit v1.2.3 From 134d9aa746792d05d7b2e93b99809bc5efb9ae95 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Wed, 6 Mar 2019 07:45:10 +0000 Subject: [clang][OpenMP] Revert "OMPFlushClause is synthetic, no such clause exists" Summary: This reverts rL352390 / D57280. As discussed in https://reviews.llvm.org/D57112#inline-506781, 'flush' clause does not exist in the OpenMP spec, it can not be specified, and `OMPFlushClause` class is just a helper class. Now, here's the caveat. I have read @ABataev's > Well, I think it would be good to filter out OMPC_flush somehow > because there is no such clause actually, it is a pseudo clause > for better handling of the flush directive. as if that clause is pseudo clause that only exists for the sole purpose of simplifying the parser. As in, it never reaches AST. I did not however try to verify that. Too bad, i was wrong. It absolutely *does* reach AST. Therefore my understanding/justification for the change was flawed, which makes the patch a regression which **must** be reverted. @gribozavr has brought that up again in https://reviews.llvm.org/D57112#inline-521238 > > ... > Sorry to be late for this discussion, but I don't think this conclusion > follows. ASTMatchers are supposed to match the AST as it is. > Even if OMPC_flush is synthetic, it exists in the AST, and users might > want to match it. I think users would find anything else (trying to filter > out AST nodes that are not in the source code) to be surprising. For example, > there's a matcher materializeTemporaryExpr even though this AST node is a > Clang invention and is not a part of the C++ spec. > > Matching only constructs that appear in the source code is not feasible with > ASTMatchers, because they are based on Clang's AST that exposes tons of semantic > information, and its design is dictated by the structure of the semantic information. > See "RFC: Tree-based refactorings with Clang" in cfe-dev for a library that will > focus on representing source code as faithfully as possible. > > Not to even mention that this code is in ASTTypeTraits, a general library for > handling AST nodes, not specifically for AST Matchers... Reviewers: gribozavr, ABataev, rjmccall, aaron.ballman Reviewed By: gribozavr, ABataev Subscribers: dylanmckay, guansong, arphaman, jdoerfert, cfe-commits, gribozavr, ABataev Tags: #clang, #openmp Differential Revision: https://reviews.llvm.org/D58979 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355486 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/OpenMPKinds.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/Basic/OpenMPKinds.cpp') diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index b10c6d2498..493ac7b2c6 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -67,8 +67,6 @@ const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) { case OMPC_##Name: \ return #Name; #include "clang/Basic/OpenMPKinds.def" - case OMPC_flush: - return "flush"; case OMPC_uniform: return "uniform"; case OMPC_threadprivate: -- cgit v1.2.3 From 3fbbfdb3b66a8cfc4dc51bb9f1aa677fbe2d46af Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Thu, 7 Mar 2019 17:54:44 +0000 Subject: [OPENMP 5.0]Add initial support for 'allocate' directive. Added parsing/sema analysis/serialization/deserialization support for 'allocate' directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355614 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/OpenMPKinds.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/Basic/OpenMPKinds.cpp') diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index 493ac7b2c6..969828705f 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -71,6 +71,8 @@ const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) { return "uniform"; case OMPC_threadprivate: return "threadprivate or thread local"; + case OMPC_allocate: + return "allocate"; } llvm_unreachable("Invalid OpenMP clause kind"); } @@ -147,6 +149,7 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown); case OMPC_unknown: case OMPC_threadprivate: + case OMPC_allocate: case OMPC_if: case OMPC_final: case OMPC_num_threads: @@ -328,6 +331,7 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type"); case OMPC_unknown: case OMPC_threadprivate: + case OMPC_allocate: case OMPC_if: case OMPC_final: case OMPC_num_threads: @@ -810,6 +814,7 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind, case OMPD_end_declare_target: case OMPD_unknown: case OMPD_threadprivate: + case OMPD_allocate: case OMPD_section: case OMPD_master: case OMPD_taskyield: @@ -1033,6 +1038,7 @@ void clang::getOpenMPCaptureRegions( CaptureRegions.push_back(OMPD_unknown); break; case OMPD_threadprivate: + case OMPD_allocate: case OMPD_taskyield: case OMPD_barrier: case OMPD_taskwait: -- cgit v1.2.3 From 457ce20d09c5fedf7e606d6a49bba9fa81f8caea Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Tue, 12 Mar 2019 18:52:33 +0000 Subject: [OPENMP 5.0]Initial support for 'allocator' clause. Added parsing/sema analysis/serialization/deserialization for the 'allocator' clause of the 'allocate' directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355952 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/OpenMPKinds.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/Basic/OpenMPKinds.cpp') diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index 969828705f..e4e8adda93 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -155,6 +155,7 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, case OMPC_num_threads: case OMPC_safelen: case OMPC_simdlen: + case OMPC_allocator: case OMPC_collapse: case OMPC_private: case OMPC_firstprivate: @@ -337,6 +338,7 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, case OMPC_num_threads: case OMPC_safelen: case OMPC_simdlen: + case OMPC_allocator: case OMPC_collapse: case OMPC_private: case OMPC_firstprivate: @@ -805,6 +807,16 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind, #define OPENMP_DECLARE_MAPPER_CLAUSE(Name) \ case OMPC_##Name: \ return true; +#include "clang/Basic/OpenMPKinds.def" + default: + break; + } + break; + case OMPD_allocate: + switch (CKind) { +#define OPENMP_ALLOCATE_CLAUSE(Name) \ + case OMPC_##Name: \ + return true; #include "clang/Basic/OpenMPKinds.def" default: break; @@ -814,7 +826,6 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind, case OMPD_end_declare_target: case OMPD_unknown: case OMPD_threadprivate: - case OMPD_allocate: case OMPD_section: case OMPD_master: case OMPD_taskyield: -- cgit v1.2.3 From 18917301298ad6df9e989983ed1e22cb0f9dff29 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Wed, 27 Mar 2019 14:14:31 +0000 Subject: [OPENMP]Initial support for 'allocate' clause. Added parsing/sema analysis of the allocate clause. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357068 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/OpenMPKinds.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/Basic/OpenMPKinds.cpp') diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index e4e8adda93..82e193efef 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -71,8 +71,6 @@ const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) { return "uniform"; case OMPC_threadprivate: return "threadprivate or thread local"; - case OMPC_allocate: - return "allocate"; } llvm_unreachable("Invalid OpenMP clause kind"); } @@ -149,13 +147,13 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown); case OMPC_unknown: case OMPC_threadprivate: - case OMPC_allocate: case OMPC_if: case OMPC_final: case OMPC_num_threads: case OMPC_safelen: case OMPC_simdlen: case OMPC_allocator: + case OMPC_allocate: case OMPC_collapse: case OMPC_private: case OMPC_firstprivate: @@ -332,13 +330,13 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type"); case OMPC_unknown: case OMPC_threadprivate: - case OMPC_allocate: case OMPC_if: case OMPC_final: case OMPC_num_threads: case OMPC_safelen: case OMPC_simdlen: case OMPC_allocator: + case OMPC_allocate: case OMPC_collapse: case OMPC_private: case OMPC_firstprivate: -- cgit v1.2.3