Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 1 | //===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// \file |
Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame] | 10 | /// This file implements the OpenMP enum and support functions. |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 11 | /// |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "clang/Basic/OpenMPKinds.h" |
| 15 | #include "clang/Basic/IdentifierTable.h" |
Matt Beaumont-Gay | 07544fa | 2013-03-25 21:32:02 +0000 | [diff] [blame] | 16 | #include "llvm/ADT/StringRef.h" |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/StringSwitch.h" |
| 18 | #include "llvm/Support/ErrorHandling.h" |
| 19 | #include <cassert> |
| 20 | |
| 21 | using namespace clang; |
| 22 | |
| 23 | OpenMPDirectiveKind clang::getOpenMPDirectiveKind(StringRef Str) { |
| 24 | return llvm::StringSwitch<OpenMPDirectiveKind>(Str) |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 25 | #define OPENMP_DIRECTIVE(Name) .Case(#Name, OMPD_##Name) |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 26 | #define OPENMP_DIRECTIVE_EXT(Name, Str) .Case(Str, OMPD_##Name) |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 27 | #include "clang/Basic/OpenMPKinds.def" |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 28 | .Default(OMPD_unknown); |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | const char *clang::getOpenMPDirectiveName(OpenMPDirectiveKind Kind) { |
Alexey Bataev | 4ca40ed | 2014-05-12 04:23:46 +0000 | [diff] [blame] | 32 | assert(Kind <= OMPD_unknown); |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 33 | switch (Kind) { |
| 34 | case OMPD_unknown: |
Alexey Bataev | 6f6f3b4 | 2013-05-13 04:18:18 +0000 | [diff] [blame] | 35 | return "unknown"; |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 36 | #define OPENMP_DIRECTIVE(Name) \ |
| 37 | case OMPD_##Name: \ |
| 38 | return #Name; |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 39 | #define OPENMP_DIRECTIVE_EXT(Name, Str) \ |
| 40 | case OMPD_##Name: \ |
| 41 | return Str; |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 42 | #include "clang/Basic/OpenMPKinds.def" |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 43 | break; |
| 44 | } |
| 45 | llvm_unreachable("Invalid OpenMP directive kind"); |
| 46 | } |
Alexey Bataev | 6f6f3b4 | 2013-05-13 04:18:18 +0000 | [diff] [blame] | 47 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 48 | OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) { |
Alexey Bataev | 2b5f3f0 | 2014-07-29 09:17:39 +0000 | [diff] [blame] | 49 | // 'flush' clause cannot be specified explicitly, because this is an implicit |
| 50 | // clause for 'flush' directive. If the 'flush' clause is explicitly specified |
| 51 | // the Parser should generate a warning about extra tokens at the end of the |
| 52 | // directive. |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 53 | if (Str == "flush") |
| 54 | return OMPC_unknown; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 55 | return llvm::StringSwitch<OpenMPClauseKind>(Str) |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 56 | #define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name) |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 57 | #include "clang/Basic/OpenMPKinds.def" |
Alexey Bataev | e48a5fc | 2016-04-12 05:28:34 +0000 | [diff] [blame] | 58 | .Case("uniform", OMPC_uniform) |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 59 | .Default(OMPC_unknown); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) { |
Alexey Bataev | 4ca40ed | 2014-05-12 04:23:46 +0000 | [diff] [blame] | 63 | assert(Kind <= OMPC_unknown); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 64 | switch (Kind) { |
| 65 | case OMPC_unknown: |
| 66 | return "unknown"; |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 67 | #define OPENMP_CLAUSE(Name, Class) \ |
| 68 | case OMPC_##Name: \ |
| 69 | return #Name; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 70 | #include "clang/Basic/OpenMPKinds.def" |
Alexey Bataev | e48a5fc | 2016-04-12 05:28:34 +0000 | [diff] [blame] | 71 | case OMPC_uniform: |
| 72 | return "uniform"; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 73 | case OMPC_threadprivate: |
| 74 | return "threadprivate or thread local"; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 75 | } |
| 76 | llvm_unreachable("Invalid OpenMP clause kind"); |
| 77 | } |
| 78 | |
| 79 | unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, |
| 80 | StringRef Str) { |
| 81 | switch (Kind) { |
| 82 | case OMPC_default: |
| 83 | return llvm::StringSwitch<OpenMPDefaultClauseKind>(Str) |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 84 | #define OPENMP_DEFAULT_KIND(Name) .Case(#Name, OMPC_DEFAULT_##Name) |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 85 | #include "clang/Basic/OpenMPKinds.def" |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 86 | .Default(OMPC_DEFAULT_unknown); |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 87 | case OMPC_proc_bind: |
| 88 | return llvm::StringSwitch<OpenMPProcBindClauseKind>(Str) |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 89 | #define OPENMP_PROC_BIND_KIND(Name) .Case(#Name, OMPC_PROC_BIND_##Name) |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 90 | #include "clang/Basic/OpenMPKinds.def" |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 91 | .Default(OMPC_PROC_BIND_unknown); |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 92 | case OMPC_schedule: |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 93 | return llvm::StringSwitch<unsigned>(Str) |
| 94 | #define OPENMP_SCHEDULE_KIND(Name) \ |
| 95 | .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name)) |
| 96 | #define OPENMP_SCHEDULE_MODIFIER(Name) \ |
| 97 | .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name)) |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 98 | #include "clang/Basic/OpenMPKinds.def" |
| 99 | .Default(OMPC_SCHEDULE_unknown); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 100 | case OMPC_depend: |
| 101 | return llvm::StringSwitch<OpenMPDependClauseKind>(Str) |
| 102 | #define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name) |
| 103 | #include "clang/Basic/OpenMPKinds.def" |
| 104 | .Default(OMPC_DEPEND_unknown); |
Alexey Bataev | 182227b | 2015-08-20 10:54:39 +0000 | [diff] [blame] | 105 | case OMPC_linear: |
| 106 | return llvm::StringSwitch<OpenMPLinearClauseKind>(Str) |
| 107 | #define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name) |
| 108 | #include "clang/Basic/OpenMPKinds.def" |
| 109 | .Default(OMPC_LINEAR_unknown); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 110 | case OMPC_map: |
| 111 | return llvm::StringSwitch<OpenMPMapClauseKind>(Str) |
| 112 | #define OPENMP_MAP_KIND(Name) .Case(#Name, OMPC_MAP_##Name) |
| 113 | #include "clang/Basic/OpenMPKinds.def" |
| 114 | .Default(OMPC_MAP_unknown); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 115 | case OMPC_dist_schedule: |
| 116 | return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str) |
| 117 | #define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name) |
| 118 | #include "clang/Basic/OpenMPKinds.def" |
| 119 | .Default(OMPC_DIST_SCHEDULE_unknown); |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 120 | case OMPC_defaultmap: |
| 121 | return llvm::StringSwitch<unsigned>(Str) |
| 122 | #define OPENMP_DEFAULTMAP_KIND(Name) \ |
| 123 | .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name)) |
| 124 | #define OPENMP_DEFAULTMAP_MODIFIER(Name) \ |
| 125 | .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name)) |
| 126 | #include "clang/Basic/OpenMPKinds.def" |
| 127 | .Default(OMPC_DEFAULTMAP_unknown); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 128 | case OMPC_unknown: |
| 129 | case OMPC_threadprivate: |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 130 | case OMPC_if: |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 131 | case OMPC_final: |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 132 | case OMPC_num_threads: |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 133 | case OMPC_safelen: |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 134 | case OMPC_simdlen: |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 135 | case OMPC_collapse: |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 136 | case OMPC_private: |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 137 | case OMPC_firstprivate: |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 138 | case OMPC_lastprivate: |
David Blaikie | 3e8aa9a | 2013-09-06 20:58:25 +0000 | [diff] [blame] | 139 | case OMPC_shared: |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 140 | case OMPC_reduction: |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 141 | case OMPC_task_reduction: |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 142 | case OMPC_in_reduction: |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 143 | case OMPC_aligned: |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 144 | case OMPC_copyin: |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 145 | case OMPC_copyprivate: |
Alexey Bataev | 142e1fc | 2014-06-20 09:44:06 +0000 | [diff] [blame] | 146 | case OMPC_ordered: |
Alexey Bataev | 236070f | 2014-06-20 11:19:47 +0000 | [diff] [blame] | 147 | case OMPC_nowait: |
Alexey Bataev | 7aea99a | 2014-07-17 12:19:31 +0000 | [diff] [blame] | 148 | case OMPC_untied: |
Alexey Bataev | 74ba3a5 | 2014-07-17 12:47:03 +0000 | [diff] [blame] | 149 | case OMPC_mergeable: |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 150 | case OMPC_flush: |
Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 151 | case OMPC_read: |
Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 152 | case OMPC_write: |
Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 153 | case OMPC_update: |
Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 154 | case OMPC_capture: |
Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 155 | case OMPC_seq_cst: |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 156 | case OMPC_device: |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 157 | case OMPC_threads: |
Alexey Bataev | d14d1e6 | 2015-09-28 06:39:35 +0000 | [diff] [blame] | 158 | case OMPC_simd: |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 159 | case OMPC_num_teams: |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 160 | case OMPC_thread_limit: |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 161 | case OMPC_priority: |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 162 | case OMPC_grainsize: |
Alexey Bataev | b825de1 | 2015-12-07 10:51:44 +0000 | [diff] [blame] | 163 | case OMPC_nogroup: |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 164 | case OMPC_num_tasks: |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 165 | case OMPC_hint: |
Alexey Bataev | e48a5fc | 2016-04-12 05:28:34 +0000 | [diff] [blame] | 166 | case OMPC_uniform: |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 167 | case OMPC_to: |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 168 | case OMPC_from: |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 169 | case OMPC_use_device_ptr: |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 170 | case OMPC_is_device_ptr: |
Kelvin Li | 1408f91 | 2018-09-26 04:28:39 +0000 | [diff] [blame] | 171 | case OMPC_unified_address: |
Patrick Lyster | 4a370b9 | 2018-10-01 13:47:43 +0000 | [diff] [blame^] | 172 | case OMPC_unified_shared_memory: |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 173 | break; |
| 174 | } |
| 175 | llvm_unreachable("Invalid OpenMP simple clause kind"); |
| 176 | } |
| 177 | |
| 178 | const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, |
| 179 | unsigned Type) { |
| 180 | switch (Kind) { |
| 181 | case OMPC_default: |
| 182 | switch (Type) { |
| 183 | case OMPC_DEFAULT_unknown: |
| 184 | return "unknown"; |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 185 | #define OPENMP_DEFAULT_KIND(Name) \ |
| 186 | case OMPC_DEFAULT_##Name: \ |
| 187 | return #Name; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 188 | #include "clang/Basic/OpenMPKinds.def" |
| 189 | } |
| 190 | llvm_unreachable("Invalid OpenMP 'default' clause type"); |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 191 | case OMPC_proc_bind: |
| 192 | switch (Type) { |
| 193 | case OMPC_PROC_BIND_unknown: |
| 194 | return "unknown"; |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 195 | #define OPENMP_PROC_BIND_KIND(Name) \ |
| 196 | case OMPC_PROC_BIND_##Name: \ |
| 197 | return #Name; |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 198 | #include "clang/Basic/OpenMPKinds.def" |
| 199 | } |
| 200 | llvm_unreachable("Invalid OpenMP 'proc_bind' clause type"); |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 201 | case OMPC_schedule: |
| 202 | switch (Type) { |
| 203 | case OMPC_SCHEDULE_unknown: |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 204 | case OMPC_SCHEDULE_MODIFIER_last: |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 205 | return "unknown"; |
| 206 | #define OPENMP_SCHEDULE_KIND(Name) \ |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 207 | case OMPC_SCHEDULE_##Name: \ |
| 208 | return #Name; |
| 209 | #define OPENMP_SCHEDULE_MODIFIER(Name) \ |
| 210 | case OMPC_SCHEDULE_MODIFIER_##Name: \ |
| 211 | return #Name; |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 212 | #include "clang/Basic/OpenMPKinds.def" |
| 213 | } |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 214 | llvm_unreachable("Invalid OpenMP 'schedule' clause type"); |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 215 | case OMPC_depend: |
| 216 | switch (Type) { |
| 217 | case OMPC_DEPEND_unknown: |
| 218 | return "unknown"; |
| 219 | #define OPENMP_DEPEND_KIND(Name) \ |
| 220 | case OMPC_DEPEND_##Name: \ |
| 221 | return #Name; |
| 222 | #include "clang/Basic/OpenMPKinds.def" |
| 223 | } |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 224 | llvm_unreachable("Invalid OpenMP 'depend' clause type"); |
Alexey Bataev | 182227b | 2015-08-20 10:54:39 +0000 | [diff] [blame] | 225 | case OMPC_linear: |
| 226 | switch (Type) { |
| 227 | case OMPC_LINEAR_unknown: |
| 228 | return "unknown"; |
| 229 | #define OPENMP_LINEAR_KIND(Name) \ |
| 230 | case OMPC_LINEAR_##Name: \ |
| 231 | return #Name; |
| 232 | #include "clang/Basic/OpenMPKinds.def" |
| 233 | } |
| 234 | llvm_unreachable("Invalid OpenMP 'linear' clause type"); |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 235 | case OMPC_map: |
| 236 | switch (Type) { |
| 237 | case OMPC_MAP_unknown: |
| 238 | return "unknown"; |
| 239 | #define OPENMP_MAP_KIND(Name) \ |
| 240 | case OMPC_MAP_##Name: \ |
| 241 | return #Name; |
| 242 | #include "clang/Basic/OpenMPKinds.def" |
| 243 | default: |
| 244 | break; |
| 245 | } |
| 246 | llvm_unreachable("Invalid OpenMP 'map' clause type"); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 247 | case OMPC_dist_schedule: |
| 248 | switch (Type) { |
| 249 | case OMPC_DIST_SCHEDULE_unknown: |
| 250 | return "unknown"; |
| 251 | #define OPENMP_DIST_SCHEDULE_KIND(Name) \ |
| 252 | case OMPC_DIST_SCHEDULE_##Name: \ |
| 253 | return #Name; |
| 254 | #include "clang/Basic/OpenMPKinds.def" |
| 255 | } |
| 256 | llvm_unreachable("Invalid OpenMP 'dist_schedule' clause type"); |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 257 | case OMPC_defaultmap: |
| 258 | switch (Type) { |
| 259 | case OMPC_DEFAULTMAP_unknown: |
| 260 | case OMPC_DEFAULTMAP_MODIFIER_last: |
| 261 | return "unknown"; |
| 262 | #define OPENMP_DEFAULTMAP_KIND(Name) \ |
| 263 | case OMPC_DEFAULTMAP_##Name: \ |
| 264 | return #Name; |
| 265 | #define OPENMP_DEFAULTMAP_MODIFIER(Name) \ |
| 266 | case OMPC_DEFAULTMAP_MODIFIER_##Name: \ |
| 267 | return #Name; |
| 268 | #include "clang/Basic/OpenMPKinds.def" |
| 269 | } |
| 270 | llvm_unreachable("Invalid OpenMP 'schedule' clause type"); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 271 | case OMPC_unknown: |
| 272 | case OMPC_threadprivate: |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 273 | case OMPC_if: |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 274 | case OMPC_final: |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 275 | case OMPC_num_threads: |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 276 | case OMPC_safelen: |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 277 | case OMPC_simdlen: |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 278 | case OMPC_collapse: |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 279 | case OMPC_private: |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 280 | case OMPC_firstprivate: |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 281 | case OMPC_lastprivate: |
David Blaikie | 3e8aa9a | 2013-09-06 20:58:25 +0000 | [diff] [blame] | 282 | case OMPC_shared: |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 283 | case OMPC_reduction: |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 284 | case OMPC_task_reduction: |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 285 | case OMPC_in_reduction: |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 286 | case OMPC_aligned: |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 287 | case OMPC_copyin: |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 288 | case OMPC_copyprivate: |
Alexey Bataev | 142e1fc | 2014-06-20 09:44:06 +0000 | [diff] [blame] | 289 | case OMPC_ordered: |
Alexey Bataev | 236070f | 2014-06-20 11:19:47 +0000 | [diff] [blame] | 290 | case OMPC_nowait: |
Alexey Bataev | 7aea99a | 2014-07-17 12:19:31 +0000 | [diff] [blame] | 291 | case OMPC_untied: |
Alexey Bataev | 74ba3a5 | 2014-07-17 12:47:03 +0000 | [diff] [blame] | 292 | case OMPC_mergeable: |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 293 | case OMPC_flush: |
Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 294 | case OMPC_read: |
Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 295 | case OMPC_write: |
Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 296 | case OMPC_update: |
Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 297 | case OMPC_capture: |
Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 298 | case OMPC_seq_cst: |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 299 | case OMPC_device: |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 300 | case OMPC_threads: |
Alexey Bataev | d14d1e6 | 2015-09-28 06:39:35 +0000 | [diff] [blame] | 301 | case OMPC_simd: |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 302 | case OMPC_num_teams: |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 303 | case OMPC_thread_limit: |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 304 | case OMPC_priority: |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 305 | case OMPC_grainsize: |
Alexey Bataev | b825de1 | 2015-12-07 10:51:44 +0000 | [diff] [blame] | 306 | case OMPC_nogroup: |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 307 | case OMPC_num_tasks: |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 308 | case OMPC_hint: |
Alexey Bataev | e48a5fc | 2016-04-12 05:28:34 +0000 | [diff] [blame] | 309 | case OMPC_uniform: |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 310 | case OMPC_to: |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 311 | case OMPC_from: |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 312 | case OMPC_use_device_ptr: |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 313 | case OMPC_is_device_ptr: |
Kelvin Li | 1408f91 | 2018-09-26 04:28:39 +0000 | [diff] [blame] | 314 | case OMPC_unified_address: |
Patrick Lyster | 4a370b9 | 2018-10-01 13:47:43 +0000 | [diff] [blame^] | 315 | case OMPC_unified_shared_memory: |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 316 | break; |
| 317 | } |
| 318 | llvm_unreachable("Invalid OpenMP simple clause kind"); |
| 319 | } |
| 320 | |
| 321 | bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind, |
| 322 | OpenMPClauseKind CKind) { |
Alexey Bataev | 4ca40ed | 2014-05-12 04:23:46 +0000 | [diff] [blame] | 323 | assert(DKind <= OMPD_unknown); |
| 324 | assert(CKind <= OMPC_unknown); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 325 | switch (DKind) { |
| 326 | case OMPD_parallel: |
| 327 | switch (CKind) { |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 328 | #define OPENMP_PARALLEL_CLAUSE(Name) \ |
| 329 | case OMPC_##Name: \ |
| 330 | return true; |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 331 | #include "clang/Basic/OpenMPKinds.def" |
| 332 | default: |
| 333 | break; |
| 334 | } |
| 335 | break; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 336 | case OMPD_simd: |
| 337 | switch (CKind) { |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 338 | #define OPENMP_SIMD_CLAUSE(Name) \ |
| 339 | case OMPC_##Name: \ |
| 340 | return true; |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 341 | #include "clang/Basic/OpenMPKinds.def" |
| 342 | default: |
| 343 | break; |
| 344 | } |
| 345 | break; |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 346 | case OMPD_for: |
| 347 | switch (CKind) { |
Alexey Bataev | 23b6942 | 2014-06-18 07:08:49 +0000 | [diff] [blame] | 348 | #define OPENMP_FOR_CLAUSE(Name) \ |
| 349 | case OMPC_##Name: \ |
| 350 | return true; |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 351 | #include "clang/Basic/OpenMPKinds.def" |
| 352 | default: |
| 353 | break; |
| 354 | } |
| 355 | break; |
Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 356 | case OMPD_for_simd: |
| 357 | switch (CKind) { |
| 358 | #define OPENMP_FOR_SIMD_CLAUSE(Name) \ |
| 359 | case OMPC_##Name: \ |
| 360 | return true; |
| 361 | #include "clang/Basic/OpenMPKinds.def" |
| 362 | default: |
| 363 | break; |
| 364 | } |
| 365 | break; |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 366 | case OMPD_sections: |
| 367 | switch (CKind) { |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 368 | #define OPENMP_SECTIONS_CLAUSE(Name) \ |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 369 | case OMPC_##Name: \ |
| 370 | return true; |
| 371 | #include "clang/Basic/OpenMPKinds.def" |
| 372 | default: |
| 373 | break; |
| 374 | } |
| 375 | break; |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 376 | case OMPD_single: |
| 377 | switch (CKind) { |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 378 | #define OPENMP_SINGLE_CLAUSE(Name) \ |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 379 | case OMPC_##Name: \ |
| 380 | return true; |
| 381 | #include "clang/Basic/OpenMPKinds.def" |
| 382 | default: |
| 383 | break; |
| 384 | } |
| 385 | break; |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 386 | case OMPD_parallel_for: |
| 387 | switch (CKind) { |
| 388 | #define OPENMP_PARALLEL_FOR_CLAUSE(Name) \ |
| 389 | case OMPC_##Name: \ |
| 390 | return true; |
| 391 | #include "clang/Basic/OpenMPKinds.def" |
| 392 | default: |
| 393 | break; |
| 394 | } |
| 395 | break; |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 396 | case OMPD_parallel_for_simd: |
| 397 | switch (CKind) { |
| 398 | #define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) \ |
| 399 | case OMPC_##Name: \ |
| 400 | return true; |
| 401 | #include "clang/Basic/OpenMPKinds.def" |
| 402 | default: |
| 403 | break; |
| 404 | } |
| 405 | break; |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 406 | case OMPD_parallel_sections: |
| 407 | switch (CKind) { |
| 408 | #define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) \ |
| 409 | case OMPC_##Name: \ |
| 410 | return true; |
| 411 | #include "clang/Basic/OpenMPKinds.def" |
| 412 | default: |
| 413 | break; |
| 414 | } |
| 415 | break; |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 416 | case OMPD_task: |
| 417 | switch (CKind) { |
| 418 | #define OPENMP_TASK_CLAUSE(Name) \ |
| 419 | case OMPC_##Name: \ |
| 420 | return true; |
| 421 | #include "clang/Basic/OpenMPKinds.def" |
| 422 | default: |
| 423 | break; |
| 424 | } |
| 425 | break; |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 426 | case OMPD_flush: |
| 427 | return CKind == OMPC_flush; |
| 428 | break; |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 429 | case OMPD_atomic: |
| 430 | switch (CKind) { |
| 431 | #define OPENMP_ATOMIC_CLAUSE(Name) \ |
| 432 | case OMPC_##Name: \ |
| 433 | return true; |
| 434 | #include "clang/Basic/OpenMPKinds.def" |
| 435 | default: |
| 436 | break; |
| 437 | } |
| 438 | break; |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 439 | case OMPD_target: |
| 440 | switch (CKind) { |
| 441 | #define OPENMP_TARGET_CLAUSE(Name) \ |
| 442 | case OMPC_##Name: \ |
| 443 | return true; |
| 444 | #include "clang/Basic/OpenMPKinds.def" |
| 445 | default: |
| 446 | break; |
| 447 | } |
| 448 | break; |
Kelvin Li | 1408f91 | 2018-09-26 04:28:39 +0000 | [diff] [blame] | 449 | case OMPD_requires: |
| 450 | switch (CKind) { |
| 451 | #define OPENMP_REQUIRES_CLAUSE(Name) \ |
| 452 | case OMPC_##Name: \ |
| 453 | return true; |
| 454 | #include "clang/Basic/OpenMPKinds.def" |
| 455 | default: |
| 456 | break; |
| 457 | } |
| 458 | break; |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 459 | case OMPD_target_data: |
| 460 | switch (CKind) { |
| 461 | #define OPENMP_TARGET_DATA_CLAUSE(Name) \ |
| 462 | case OMPC_##Name: \ |
| 463 | return true; |
| 464 | #include "clang/Basic/OpenMPKinds.def" |
| 465 | default: |
| 466 | break; |
| 467 | } |
| 468 | break; |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 469 | case OMPD_target_enter_data: |
| 470 | switch (CKind) { |
| 471 | #define OPENMP_TARGET_ENTER_DATA_CLAUSE(Name) \ |
| 472 | case OMPC_##Name: \ |
| 473 | return true; |
| 474 | #include "clang/Basic/OpenMPKinds.def" |
| 475 | default: |
| 476 | break; |
| 477 | } |
| 478 | break; |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 479 | case OMPD_target_exit_data: |
| 480 | switch (CKind) { |
| 481 | #define OPENMP_TARGET_EXIT_DATA_CLAUSE(Name) \ |
| 482 | case OMPC_##Name: \ |
| 483 | return true; |
| 484 | #include "clang/Basic/OpenMPKinds.def" |
| 485 | default: |
| 486 | break; |
| 487 | } |
| 488 | break; |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 489 | case OMPD_target_parallel: |
| 490 | switch (CKind) { |
| 491 | #define OPENMP_TARGET_PARALLEL_CLAUSE(Name) \ |
| 492 | case OMPC_##Name: \ |
| 493 | return true; |
| 494 | #include "clang/Basic/OpenMPKinds.def" |
| 495 | default: |
| 496 | break; |
| 497 | } |
| 498 | break; |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 499 | case OMPD_target_parallel_for: |
| 500 | switch (CKind) { |
| 501 | #define OPENMP_TARGET_PARALLEL_FOR_CLAUSE(Name) \ |
| 502 | case OMPC_##Name: \ |
| 503 | return true; |
| 504 | #include "clang/Basic/OpenMPKinds.def" |
| 505 | default: |
| 506 | break; |
| 507 | } |
| 508 | break; |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 509 | case OMPD_target_update: |
| 510 | switch (CKind) { |
| 511 | #define OPENMP_TARGET_UPDATE_CLAUSE(Name) \ |
| 512 | case OMPC_##Name: \ |
| 513 | return true; |
| 514 | #include "clang/Basic/OpenMPKinds.def" |
| 515 | default: |
| 516 | break; |
| 517 | } |
| 518 | break; |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 519 | case OMPD_teams: |
| 520 | switch (CKind) { |
| 521 | #define OPENMP_TEAMS_CLAUSE(Name) \ |
| 522 | case OMPC_##Name: \ |
| 523 | return true; |
| 524 | #include "clang/Basic/OpenMPKinds.def" |
| 525 | default: |
| 526 | break; |
| 527 | } |
| 528 | break; |
Alexey Bataev | 587e1de | 2016-03-30 10:43:55 +0000 | [diff] [blame] | 529 | case OMPD_declare_simd: |
| 530 | break; |
Alexey Bataev | 87933c7 | 2015-09-18 08:07:34 +0000 | [diff] [blame] | 531 | case OMPD_cancel: |
| 532 | switch (CKind) { |
| 533 | #define OPENMP_CANCEL_CLAUSE(Name) \ |
| 534 | case OMPC_##Name: \ |
| 535 | return true; |
| 536 | #include "clang/Basic/OpenMPKinds.def" |
| 537 | default: |
| 538 | break; |
| 539 | } |
| 540 | break; |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 541 | case OMPD_ordered: |
| 542 | switch (CKind) { |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 543 | #define OPENMP_ORDERED_CLAUSE(Name) \ |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 544 | case OMPC_##Name: \ |
| 545 | return true; |
| 546 | #include "clang/Basic/OpenMPKinds.def" |
| 547 | default: |
| 548 | break; |
| 549 | } |
| 550 | break; |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 551 | case OMPD_taskloop: |
| 552 | switch (CKind) { |
| 553 | #define OPENMP_TASKLOOP_CLAUSE(Name) \ |
| 554 | case OMPC_##Name: \ |
| 555 | return true; |
| 556 | #include "clang/Basic/OpenMPKinds.def" |
| 557 | default: |
| 558 | break; |
| 559 | } |
| 560 | break; |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 561 | case OMPD_taskloop_simd: |
| 562 | switch (CKind) { |
| 563 | #define OPENMP_TASKLOOP_SIMD_CLAUSE(Name) \ |
| 564 | case OMPC_##Name: \ |
| 565 | return true; |
| 566 | #include "clang/Basic/OpenMPKinds.def" |
| 567 | default: |
| 568 | break; |
| 569 | } |
| 570 | break; |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 571 | case OMPD_critical: |
| 572 | switch (CKind) { |
| 573 | #define OPENMP_CRITICAL_CLAUSE(Name) \ |
| 574 | case OMPC_##Name: \ |
| 575 | return true; |
| 576 | #include "clang/Basic/OpenMPKinds.def" |
| 577 | default: |
| 578 | break; |
| 579 | } |
| 580 | break; |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 581 | case OMPD_distribute: |
| 582 | switch (CKind) { |
| 583 | #define OPENMP_DISTRIBUTE_CLAUSE(Name) \ |
| 584 | case OMPC_##Name: \ |
| 585 | return true; |
| 586 | #include "clang/Basic/OpenMPKinds.def" |
| 587 | default: |
| 588 | break; |
| 589 | } |
| 590 | break; |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 591 | case OMPD_distribute_parallel_for: |
| 592 | switch (CKind) { |
| 593 | #define OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \ |
| 594 | case OMPC_##Name: \ |
| 595 | return true; |
| 596 | #include "clang/Basic/OpenMPKinds.def" |
| 597 | default: |
| 598 | break; |
| 599 | } |
| 600 | break; |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 601 | case OMPD_distribute_parallel_for_simd: |
| 602 | switch (CKind) { |
| 603 | #define OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \ |
| 604 | case OMPC_##Name: \ |
| 605 | return true; |
| 606 | #include "clang/Basic/OpenMPKinds.def" |
| 607 | default: |
| 608 | break; |
| 609 | } |
| 610 | break; |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 611 | case OMPD_distribute_simd: |
| 612 | switch (CKind) { |
| 613 | #define OPENMP_DISTRIBUTE_SIMD_CLAUSE(Name) \ |
| 614 | case OMPC_##Name: \ |
| 615 | return true; |
| 616 | #include "clang/Basic/OpenMPKinds.def" |
| 617 | default: |
| 618 | break; |
| 619 | } |
| 620 | break; |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 621 | case OMPD_target_parallel_for_simd: |
| 622 | switch (CKind) { |
| 623 | #define OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(Name) \ |
| 624 | case OMPC_##Name: \ |
| 625 | return true; |
| 626 | #include "clang/Basic/OpenMPKinds.def" |
| 627 | default: |
| 628 | break; |
| 629 | } |
| 630 | break; |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 631 | case OMPD_target_simd: |
| 632 | switch (CKind) { |
| 633 | #define OPENMP_TARGET_SIMD_CLAUSE(Name) \ |
| 634 | case OMPC_##Name: \ |
| 635 | return true; |
| 636 | #include "clang/Basic/OpenMPKinds.def" |
| 637 | default: |
| 638 | break; |
| 639 | } |
| 640 | break; |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 641 | case OMPD_teams_distribute: |
| 642 | switch (CKind) { |
| 643 | #define OPENMP_TEAMS_DISTRIBUTE_CLAUSE(Name) \ |
| 644 | case OMPC_##Name: \ |
| 645 | return true; |
| 646 | #include "clang/Basic/OpenMPKinds.def" |
| 647 | default: |
| 648 | break; |
| 649 | } |
| 650 | break; |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 651 | case OMPD_teams_distribute_simd: |
| 652 | switch (CKind) { |
| 653 | #define OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \ |
| 654 | case OMPC_##Name: \ |
| 655 | return true; |
| 656 | #include "clang/Basic/OpenMPKinds.def" |
| 657 | default: |
| 658 | break; |
| 659 | } |
| 660 | break; |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 661 | case OMPD_teams_distribute_parallel_for_simd: |
| 662 | switch (CKind) { |
| 663 | #define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \ |
| 664 | case OMPC_##Name: \ |
| 665 | return true; |
| 666 | #include "clang/Basic/OpenMPKinds.def" |
| 667 | default: |
| 668 | break; |
| 669 | } |
| 670 | break; |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 671 | case OMPD_teams_distribute_parallel_for: |
| 672 | switch (CKind) { |
| 673 | #define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \ |
| 674 | case OMPC_##Name: \ |
| 675 | return true; |
| 676 | #include "clang/Basic/OpenMPKinds.def" |
| 677 | default: |
| 678 | break; |
| 679 | } |
| 680 | break; |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 681 | case OMPD_target_teams: |
| 682 | switch (CKind) { |
| 683 | #define OPENMP_TARGET_TEAMS_CLAUSE(Name) \ |
| 684 | case OMPC_##Name: \ |
| 685 | return true; |
| 686 | #include "clang/Basic/OpenMPKinds.def" |
| 687 | default: |
| 688 | break; |
| 689 | } |
| 690 | break; |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 691 | case OMPD_target_teams_distribute: |
| 692 | switch (CKind) { |
| 693 | #define OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(Name) \ |
| 694 | case OMPC_##Name: \ |
| 695 | return true; |
| 696 | #include "clang/Basic/OpenMPKinds.def" |
| 697 | default: |
| 698 | break; |
| 699 | } |
| 700 | break; |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 701 | case OMPD_target_teams_distribute_parallel_for: |
| 702 | switch (CKind) { |
| 703 | #define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \ |
| 704 | case OMPC_##Name: \ |
| 705 | return true; |
| 706 | #include "clang/Basic/OpenMPKinds.def" |
| 707 | default: |
| 708 | break; |
| 709 | } |
| 710 | break; |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 711 | case OMPD_target_teams_distribute_parallel_for_simd: |
| 712 | switch (CKind) { |
| 713 | #define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \ |
| 714 | case OMPC_##Name: \ |
| 715 | return true; |
| 716 | #include "clang/Basic/OpenMPKinds.def" |
| 717 | default: |
| 718 | break; |
| 719 | } |
| 720 | break; |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 721 | case OMPD_target_teams_distribute_simd: |
| 722 | switch (CKind) { |
| 723 | #define OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \ |
| 724 | case OMPC_##Name: \ |
| 725 | return true; |
| 726 | #include "clang/Basic/OpenMPKinds.def" |
| 727 | default: |
| 728 | break; |
| 729 | } |
| 730 | break; |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 731 | case OMPD_taskgroup: |
| 732 | switch (CKind) { |
| 733 | #define OPENMP_TASKGROUP_CLAUSE(Name) \ |
| 734 | case OMPC_##Name: \ |
| 735 | return true; |
| 736 | #include "clang/Basic/OpenMPKinds.def" |
| 737 | default: |
| 738 | break; |
| 739 | } |
| 740 | break; |
Dmitry Polukhin | 0b0da29 | 2016-04-06 11:38:59 +0000 | [diff] [blame] | 741 | case OMPD_declare_target: |
| 742 | case OMPD_end_declare_target: |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 743 | case OMPD_unknown: |
| 744 | case OMPD_threadprivate: |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 745 | case OMPD_section: |
Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 746 | case OMPD_master: |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 747 | case OMPD_taskyield: |
Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 748 | case OMPD_barrier: |
Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 749 | case OMPD_taskwait: |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 750 | case OMPD_cancellation_point: |
Alexey Bataev | 94a4f0c | 2016-03-03 05:21:39 +0000 | [diff] [blame] | 751 | case OMPD_declare_reduction: |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 752 | break; |
| 753 | } |
| 754 | return false; |
| 755 | } |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 756 | |
| 757 | bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) { |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 758 | return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd || |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 759 | DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd || |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 760 | DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd || |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 761 | DKind == OMPD_distribute || DKind == OMPD_target_parallel_for || |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 762 | DKind == OMPD_distribute_parallel_for || |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 763 | DKind == OMPD_distribute_parallel_for_simd || |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 764 | DKind == OMPD_distribute_simd || |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 765 | DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd || |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 766 | DKind == OMPD_teams_distribute || |
| 767 | DKind == OMPD_teams_distribute_simd || |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 768 | DKind == OMPD_teams_distribute_parallel_for_simd || |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 769 | DKind == OMPD_teams_distribute_parallel_for || |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 770 | DKind == OMPD_target_teams_distribute || |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 771 | DKind == OMPD_target_teams_distribute_parallel_for || |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 772 | DKind == OMPD_target_teams_distribute_parallel_for_simd || |
| 773 | DKind == OMPD_target_teams_distribute_simd; |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 774 | } |
| 775 | |
| 776 | bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) { |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 777 | return DKind == OMPD_for || DKind == OMPD_for_simd || |
| 778 | DKind == OMPD_sections || DKind == OMPD_section || |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 779 | DKind == OMPD_single || DKind == OMPD_parallel_for || |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 780 | DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections || |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 781 | DKind == OMPD_target_parallel_for || |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 782 | DKind == OMPD_distribute_parallel_for || |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 783 | DKind == OMPD_distribute_parallel_for_simd || |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 784 | DKind == OMPD_target_parallel_for_simd || |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 785 | DKind == OMPD_teams_distribute_parallel_for_simd || |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 786 | DKind == OMPD_teams_distribute_parallel_for || |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 787 | DKind == OMPD_target_teams_distribute_parallel_for || |
| 788 | DKind == OMPD_target_teams_distribute_parallel_for_simd; |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 789 | } |
| 790 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 791 | bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) { |
| 792 | return DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd; |
| 793 | } |
| 794 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 795 | bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) { |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 796 | return DKind == OMPD_parallel || DKind == OMPD_parallel_for || |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 797 | DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections || |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 798 | DKind == OMPD_target_parallel || DKind == OMPD_target_parallel_for || |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 799 | DKind == OMPD_distribute_parallel_for || |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 800 | DKind == OMPD_distribute_parallel_for_simd || |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 801 | DKind == OMPD_target_parallel_for_simd || |
| 802 | DKind == OMPD_teams_distribute_parallel_for || |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 803 | DKind == OMPD_teams_distribute_parallel_for_simd || |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 804 | DKind == OMPD_target_teams_distribute_parallel_for || |
| 805 | DKind == OMPD_target_teams_distribute_parallel_for_simd; |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 806 | } |
| 807 | |
Arpith Chacko Jacob | 3d58f26 | 2016-02-02 04:00:47 +0000 | [diff] [blame] | 808 | bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) { |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 809 | return DKind == OMPD_target || DKind == OMPD_target_parallel || |
Alexey Bataev | 5d7edca | 2017-11-09 17:32:15 +0000 | [diff] [blame] | 810 | DKind == OMPD_target_parallel_for || |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 811 | DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd || |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 812 | DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute || |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 813 | DKind == OMPD_target_teams_distribute_parallel_for || |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 814 | DKind == OMPD_target_teams_distribute_parallel_for_simd || |
| 815 | DKind == OMPD_target_teams_distribute_simd; |
Arpith Chacko Jacob | 3d58f26 | 2016-02-02 04:00:47 +0000 | [diff] [blame] | 816 | } |
| 817 | |
| 818 | bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) { |
Arpith Chacko Jacob | 3d58f26 | 2016-02-02 04:00:47 +0000 | [diff] [blame] | 819 | return DKind == OMPD_target_data || DKind == OMPD_target_enter_data || |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 820 | DKind == OMPD_target_exit_data || DKind == OMPD_target_update; |
Samuel Antao | 4be30e9 | 2015-10-02 17:14:03 +0000 | [diff] [blame] | 821 | } |
| 822 | |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 823 | bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) { |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 824 | return DKind == OMPD_teams || DKind == OMPD_teams_distribute || |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 825 | DKind == OMPD_teams_distribute_simd || |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 826 | DKind == OMPD_teams_distribute_parallel_for_simd || |
| 827 | DKind == OMPD_teams_distribute_parallel_for; |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 828 | } |
| 829 | |
| 830 | bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) { |
| 831 | return isOpenMPNestingTeamsDirective(DKind) || |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 832 | DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute || |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 833 | DKind == OMPD_target_teams_distribute_parallel_for || |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 834 | DKind == OMPD_target_teams_distribute_parallel_for_simd || |
| 835 | DKind == OMPD_target_teams_distribute_simd; |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 836 | } |
| 837 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 838 | bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) { |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 839 | return DKind == OMPD_simd || DKind == OMPD_for_simd || |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 840 | DKind == OMPD_parallel_for_simd || DKind == OMPD_taskloop_simd || |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 841 | DKind == OMPD_distribute_parallel_for_simd || |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 842 | DKind == OMPD_distribute_simd || DKind == OMPD_target_simd || |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 843 | DKind == OMPD_teams_distribute_simd || |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 844 | DKind == OMPD_teams_distribute_parallel_for_simd || |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 845 | DKind == OMPD_target_teams_distribute_parallel_for_simd || |
Alexey Bataev | 9a5e64f | 2017-11-09 17:01:35 +0000 | [diff] [blame] | 846 | DKind == OMPD_target_teams_distribute_simd || |
| 847 | DKind == OMPD_target_parallel_for_simd; |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 848 | } |
| 849 | |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 850 | bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) { |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 851 | return Kind == OMPD_distribute || Kind == OMPD_distribute_parallel_for || |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 852 | Kind == OMPD_distribute_parallel_for_simd || |
| 853 | Kind == OMPD_distribute_simd; |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 854 | // TODO add next directives. |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 855 | } |
| 856 | |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 857 | bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) { |
| 858 | return isOpenMPNestingDistributeDirective(Kind) || |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 859 | Kind == OMPD_teams_distribute || Kind == OMPD_teams_distribute_simd || |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 860 | Kind == OMPD_teams_distribute_parallel_for_simd || |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 861 | Kind == OMPD_teams_distribute_parallel_for || |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 862 | Kind == OMPD_target_teams_distribute || |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 863 | Kind == OMPD_target_teams_distribute_parallel_for || |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 864 | Kind == OMPD_target_teams_distribute_parallel_for_simd || |
| 865 | Kind == OMPD_target_teams_distribute_simd; |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 866 | } |
| 867 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 868 | bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) { |
| 869 | return Kind == OMPC_private || Kind == OMPC_firstprivate || |
| 870 | Kind == OMPC_lastprivate || Kind == OMPC_linear || |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame] | 871 | Kind == OMPC_reduction || Kind == OMPC_task_reduction || |
| 872 | Kind == OMPC_in_reduction; // TODO add next clauses like 'reduction'. |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 873 | } |
| 874 | |
| 875 | bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) { |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 876 | return Kind == OMPC_threadprivate || Kind == OMPC_copyin; |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 877 | } |
| 878 | |
Alexey Bataev | 35aaee6 | 2016-04-13 13:36:48 +0000 | [diff] [blame] | 879 | bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) { |
| 880 | return Kind == OMPD_task || isOpenMPTaskLoopDirective(Kind); |
| 881 | } |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 882 | |
| 883 | bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) { |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 884 | return Kind == OMPD_distribute_parallel_for || |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 885 | Kind == OMPD_distribute_parallel_for_simd || |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 886 | Kind == OMPD_teams_distribute_parallel_for_simd || |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 887 | Kind == OMPD_teams_distribute_parallel_for || |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 888 | Kind == OMPD_target_teams_distribute_parallel_for || |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 889 | Kind == OMPD_target_teams_distribute_parallel_for_simd; |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 890 | } |
Arpith Chacko Jacob | 19b911c | 2017-01-18 18:18:53 +0000 | [diff] [blame] | 891 | |
| 892 | void clang::getOpenMPCaptureRegions( |
| 893 | SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions, |
| 894 | OpenMPDirectiveKind DKind) { |
| 895 | assert(DKind <= OMPD_unknown); |
| 896 | switch (DKind) { |
| 897 | case OMPD_parallel: |
| 898 | case OMPD_parallel_for: |
| 899 | case OMPD_parallel_for_simd: |
| 900 | case OMPD_parallel_sections: |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 901 | case OMPD_distribute_parallel_for: |
Alexey Bataev | 974acd6 | 2017-11-27 19:38:52 +0000 | [diff] [blame] | 902 | case OMPD_distribute_parallel_for_simd: |
Arpith Chacko Jacob | 19b911c | 2017-01-18 18:18:53 +0000 | [diff] [blame] | 903 | CaptureRegions.push_back(OMPD_parallel); |
| 904 | break; |
Arpith Chacko Jacob | 86f9e46 | 2017-01-25 01:45:59 +0000 | [diff] [blame] | 905 | case OMPD_target_teams: |
Alexey Bataev | dfa430f | 2017-12-08 15:03:50 +0000 | [diff] [blame] | 906 | case OMPD_target_teams_distribute: |
Alexey Bataev | fbe17fb | 2017-12-13 19:45:06 +0000 | [diff] [blame] | 907 | case OMPD_target_teams_distribute_simd: |
Alexey Bataev | 8451efa | 2018-01-15 19:06:12 +0000 | [diff] [blame] | 908 | CaptureRegions.push_back(OMPD_task); |
Arpith Chacko Jacob | 99a1e0e | 2017-01-25 02:18:43 +0000 | [diff] [blame] | 909 | CaptureRegions.push_back(OMPD_target); |
| 910 | CaptureRegions.push_back(OMPD_teams); |
| 911 | break; |
Alexey Bataev | 2ba6704 | 2017-11-28 21:11:44 +0000 | [diff] [blame] | 912 | case OMPD_teams: |
Carlo Bertolli | ba1487b | 2017-10-04 14:12:09 +0000 | [diff] [blame] | 913 | case OMPD_teams_distribute: |
Alexey Bataev | 2ba6704 | 2017-11-28 21:11:44 +0000 | [diff] [blame] | 914 | case OMPD_teams_distribute_simd: |
Carlo Bertolli | ba1487b | 2017-10-04 14:12:09 +0000 | [diff] [blame] | 915 | CaptureRegions.push_back(OMPD_teams); |
| 916 | break; |
Alexey Bataev | 2ba6704 | 2017-11-28 21:11:44 +0000 | [diff] [blame] | 917 | case OMPD_target: |
Alexey Bataev | f836537 | 2017-11-17 17:57:25 +0000 | [diff] [blame] | 918 | case OMPD_target_simd: |
Alexey Bataev | 8451efa | 2018-01-15 19:06:12 +0000 | [diff] [blame] | 919 | CaptureRegions.push_back(OMPD_task); |
Alexey Bataev | f836537 | 2017-11-17 17:57:25 +0000 | [diff] [blame] | 920 | CaptureRegions.push_back(OMPD_target); |
| 921 | break; |
Carlo Bertolli | 62fae15 | 2017-11-20 20:46:39 +0000 | [diff] [blame] | 922 | case OMPD_teams_distribute_parallel_for: |
Carlo Bertolli | 56a2aa4 | 2017-12-04 20:57:19 +0000 | [diff] [blame] | 923 | case OMPD_teams_distribute_parallel_for_simd: |
Carlo Bertolli | 62fae15 | 2017-11-20 20:46:39 +0000 | [diff] [blame] | 924 | CaptureRegions.push_back(OMPD_teams); |
| 925 | CaptureRegions.push_back(OMPD_parallel); |
| 926 | break; |
Alexey Bataev | 7f96c37 | 2017-11-22 17:19:31 +0000 | [diff] [blame] | 927 | case OMPD_target_parallel: |
| 928 | case OMPD_target_parallel_for: |
| 929 | case OMPD_target_parallel_for_simd: |
Alexey Bataev | 8451efa | 2018-01-15 19:06:12 +0000 | [diff] [blame] | 930 | CaptureRegions.push_back(OMPD_task); |
Alexey Bataev | 7f96c37 | 2017-11-22 17:19:31 +0000 | [diff] [blame] | 931 | CaptureRegions.push_back(OMPD_target); |
| 932 | CaptureRegions.push_back(OMPD_parallel); |
| 933 | break; |
Alexey Bataev | 2ba6704 | 2017-11-28 21:11:44 +0000 | [diff] [blame] | 934 | case OMPD_task: |
Alexey Bataev | 7f96c37 | 2017-11-22 17:19:31 +0000 | [diff] [blame] | 935 | case OMPD_target_enter_data: |
| 936 | case OMPD_target_exit_data: |
| 937 | case OMPD_target_update: |
| 938 | CaptureRegions.push_back(OMPD_task); |
| 939 | break; |
Alexey Bataev | 2ba6704 | 2017-11-28 21:11:44 +0000 | [diff] [blame] | 940 | case OMPD_taskloop: |
| 941 | case OMPD_taskloop_simd: |
| 942 | CaptureRegions.push_back(OMPD_taskloop); |
| 943 | break; |
Carlo Bertolli | 52978c3 | 2018-01-03 21:12:44 +0000 | [diff] [blame] | 944 | case OMPD_target_teams_distribute_parallel_for: |
Alexey Bataev | 647dd84 | 2018-01-15 20:59:40 +0000 | [diff] [blame] | 945 | case OMPD_target_teams_distribute_parallel_for_simd: |
Alexey Bataev | 8451efa | 2018-01-15 19:06:12 +0000 | [diff] [blame] | 946 | CaptureRegions.push_back(OMPD_task); |
Carlo Bertolli | 52978c3 | 2018-01-03 21:12:44 +0000 | [diff] [blame] | 947 | CaptureRegions.push_back(OMPD_target); |
| 948 | CaptureRegions.push_back(OMPD_teams); |
| 949 | CaptureRegions.push_back(OMPD_parallel); |
| 950 | break; |
Arpith Chacko Jacob | 19b911c | 2017-01-18 18:18:53 +0000 | [diff] [blame] | 951 | case OMPD_simd: |
| 952 | case OMPD_for: |
| 953 | case OMPD_for_simd: |
| 954 | case OMPD_sections: |
| 955 | case OMPD_section: |
| 956 | case OMPD_single: |
| 957 | case OMPD_master: |
| 958 | case OMPD_critical: |
| 959 | case OMPD_taskgroup: |
| 960 | case OMPD_distribute: |
| 961 | case OMPD_ordered: |
| 962 | case OMPD_atomic: |
| 963 | case OMPD_target_data: |
Arpith Chacko Jacob | 19b911c | 2017-01-18 18:18:53 +0000 | [diff] [blame] | 964 | case OMPD_distribute_simd: |
Alexey Bataev | 2ba6704 | 2017-11-28 21:11:44 +0000 | [diff] [blame] | 965 | CaptureRegions.push_back(OMPD_unknown); |
Arpith Chacko Jacob | 19b911c | 2017-01-18 18:18:53 +0000 | [diff] [blame] | 966 | break; |
Arpith Chacko Jacob | 19b911c | 2017-01-18 18:18:53 +0000 | [diff] [blame] | 967 | case OMPD_threadprivate: |
| 968 | case OMPD_taskyield: |
| 969 | case OMPD_barrier: |
| 970 | case OMPD_taskwait: |
| 971 | case OMPD_cancellation_point: |
| 972 | case OMPD_cancel: |
| 973 | case OMPD_flush: |
Arpith Chacko Jacob | 19b911c | 2017-01-18 18:18:53 +0000 | [diff] [blame] | 974 | case OMPD_declare_reduction: |
| 975 | case OMPD_declare_simd: |
| 976 | case OMPD_declare_target: |
| 977 | case OMPD_end_declare_target: |
Kelvin Li | 1408f91 | 2018-09-26 04:28:39 +0000 | [diff] [blame] | 978 | case OMPD_requires: |
Arpith Chacko Jacob | 19b911c | 2017-01-18 18:18:53 +0000 | [diff] [blame] | 979 | llvm_unreachable("OpenMP Directive is not allowed"); |
| 980 | case OMPD_unknown: |
| 981 | llvm_unreachable("Unknown OpenMP directive"); |
| 982 | } |
| 983 | } |