blob: 4e6c677f11dbaa703ca5fdf82a89891a89525ddd [file] [log] [blame]
Alexey Bataeva769e072013-03-22 06:34:35 +00001//===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Alexey Bataeva769e072013-03-22 06:34:35 +00006//
7//===----------------------------------------------------------------------===//
8/// \file
Adrian Prantl9fc8faf2018-05-09 01:00:01 +00009/// This file implements the OpenMP enum and support functions.
Alexey Bataeva769e072013-03-22 06:34:35 +000010///
11//===----------------------------------------------------------------------===//
12
13#include "clang/Basic/OpenMPKinds.h"
14#include "clang/Basic/IdentifierTable.h"
Matt Beaumont-Gay07544fa2013-03-25 21:32:02 +000015#include "llvm/ADT/StringRef.h"
Alexey Bataeva769e072013-03-22 06:34:35 +000016#include "llvm/ADT/StringSwitch.h"
17#include "llvm/Support/ErrorHandling.h"
18#include <cassert>
19
20using namespace clang;
21
Alexey Bataevfde11e92019-11-07 11:03:10 -050022OpenMPContextSelectorSetKind
23clang::getOpenMPContextSelectorSet(llvm::StringRef Str) {
24 return llvm::StringSwitch<OpenMPContextSelectorSetKind>(Str)
25#define OPENMP_CONTEXT_SELECTOR_SET(Name) .Case(#Name, OMP_CTX_SET_##Name)
26#include "clang/Basic/OpenMPKinds.def"
27 .Default(OMP_CTX_SET_unknown);
28}
29
30llvm::StringRef
31clang::getOpenMPContextSelectorSetName(OpenMPContextSelectorSetKind Kind) {
32 switch (Kind) {
33 case OMP_CTX_SET_unknown:
34 return "unknown";
35#define OPENMP_CONTEXT_SELECTOR_SET(Name) \
36 case OMP_CTX_SET_##Name: \
37 return #Name;
38#include "clang/Basic/OpenMPKinds.def"
39 break;
40 }
41 llvm_unreachable("Invalid OpenMP context selector set kind");
42}
43
44OpenMPContextSelectorKind clang::getOpenMPContextSelector(llvm::StringRef Str) {
45 return llvm::StringSwitch<OpenMPContextSelectorKind>(Str)
46#define OPENMP_CONTEXT_SELECTOR(Name) .Case(#Name, OMP_CTX_##Name)
47#include "clang/Basic/OpenMPKinds.def"
48 .Default(OMP_CTX_unknown);
49}
50
51llvm::StringRef
52clang::getOpenMPContextSelectorName(OpenMPContextSelectorKind Kind) {
53 switch (Kind) {
54 case OMP_CTX_unknown:
55 return "unknown";
56#define OPENMP_CONTEXT_SELECTOR(Name) \
57 case OMP_CTX_##Name: \
58 return #Name;
59#include "clang/Basic/OpenMPKinds.def"
60 break;
61 }
62 llvm_unreachable("Invalid OpenMP context selector kind");
63}
64
Alexey Bataeva769e072013-03-22 06:34:35 +000065OpenMPDirectiveKind clang::getOpenMPDirectiveKind(StringRef Str) {
66 return llvm::StringSwitch<OpenMPDirectiveKind>(Str)
Alexey Bataev23b69422014-06-18 07:08:49 +000067#define OPENMP_DIRECTIVE(Name) .Case(#Name, OMPD_##Name)
Alexey Bataev4acb8592014-07-07 13:01:15 +000068#define OPENMP_DIRECTIVE_EXT(Name, Str) .Case(Str, OMPD_##Name)
Alexey Bataeva769e072013-03-22 06:34:35 +000069#include "clang/Basic/OpenMPKinds.def"
Alexey Bataev23b69422014-06-18 07:08:49 +000070 .Default(OMPD_unknown);
Alexey Bataeva769e072013-03-22 06:34:35 +000071}
72
73const char *clang::getOpenMPDirectiveName(OpenMPDirectiveKind Kind) {
Alexey Bataev4ca40ed2014-05-12 04:23:46 +000074 assert(Kind <= OMPD_unknown);
Alexey Bataeva769e072013-03-22 06:34:35 +000075 switch (Kind) {
76 case OMPD_unknown:
Alexey Bataev6f6f3b42013-05-13 04:18:18 +000077 return "unknown";
Alexey Bataev23b69422014-06-18 07:08:49 +000078#define OPENMP_DIRECTIVE(Name) \
79 case OMPD_##Name: \
80 return #Name;
Alexey Bataev4acb8592014-07-07 13:01:15 +000081#define OPENMP_DIRECTIVE_EXT(Name, Str) \
82 case OMPD_##Name: \
83 return Str;
Alexey Bataeva769e072013-03-22 06:34:35 +000084#include "clang/Basic/OpenMPKinds.def"
Alexey Bataeva769e072013-03-22 06:34:35 +000085 break;
86 }
87 llvm_unreachable("Invalid OpenMP directive kind");
88}
Alexey Bataev6f6f3b42013-05-13 04:18:18 +000089
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000090OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) {
Alexey Bataev2b5f3f02014-07-29 09:17:39 +000091 // 'flush' clause cannot be specified explicitly, because this is an implicit
92 // clause for 'flush' directive. If the 'flush' clause is explicitly specified
93 // the Parser should generate a warning about extra tokens at the end of the
94 // directive.
Alexey Bataev6125da92014-07-21 11:26:11 +000095 if (Str == "flush")
96 return OMPC_unknown;
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000097 return llvm::StringSwitch<OpenMPClauseKind>(Str)
Alexey Bataev23b69422014-06-18 07:08:49 +000098#define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name)
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000099#include "clang/Basic/OpenMPKinds.def"
Alexey Bataeve48a5fc2016-04-12 05:28:34 +0000100 .Case("uniform", OMPC_uniform)
Alexey Bataev729e2422019-08-23 16:11:14 +0000101 .Case("device_type", OMPC_device_type)
Alexey Bataevdba792c2019-09-23 18:13:31 +0000102 .Case("match", OMPC_match)
Alexey Bataev23b69422014-06-18 07:08:49 +0000103 .Default(OMPC_unknown);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000104}
105
106const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) {
Alexey Bataev4ca40ed2014-05-12 04:23:46 +0000107 assert(Kind <= OMPC_unknown);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000108 switch (Kind) {
109 case OMPC_unknown:
110 return "unknown";
Alexey Bataev23b69422014-06-18 07:08:49 +0000111#define OPENMP_CLAUSE(Name, Class) \
112 case OMPC_##Name: \
113 return #Name;
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000114#include "clang/Basic/OpenMPKinds.def"
Alexey Bataeve48a5fc2016-04-12 05:28:34 +0000115 case OMPC_uniform:
116 return "uniform";
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000117 case OMPC_threadprivate:
118 return "threadprivate or thread local";
Alexey Bataev729e2422019-08-23 16:11:14 +0000119 case OMPC_device_type:
120 return "device_type";
Alexey Bataevdba792c2019-09-23 18:13:31 +0000121 case OMPC_match:
122 return "match";
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000123 }
124 llvm_unreachable("Invalid OpenMP clause kind");
125}
126
127unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
128 StringRef Str) {
129 switch (Kind) {
130 case OMPC_default:
131 return llvm::StringSwitch<OpenMPDefaultClauseKind>(Str)
Alexey Bataev23b69422014-06-18 07:08:49 +0000132#define OPENMP_DEFAULT_KIND(Name) .Case(#Name, OMPC_DEFAULT_##Name)
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000133#include "clang/Basic/OpenMPKinds.def"
Alexey Bataev23b69422014-06-18 07:08:49 +0000134 .Default(OMPC_DEFAULT_unknown);
Alexey Bataevbcbadb62014-05-06 06:04:14 +0000135 case OMPC_proc_bind:
136 return llvm::StringSwitch<OpenMPProcBindClauseKind>(Str)
Alexey Bataev23b69422014-06-18 07:08:49 +0000137#define OPENMP_PROC_BIND_KIND(Name) .Case(#Name, OMPC_PROC_BIND_##Name)
Alexey Bataevbcbadb62014-05-06 06:04:14 +0000138#include "clang/Basic/OpenMPKinds.def"
Alexey Bataev23b69422014-06-18 07:08:49 +0000139 .Default(OMPC_PROC_BIND_unknown);
Alexey Bataev56dafe82014-06-20 07:16:17 +0000140 case OMPC_schedule:
Alexey Bataev6402bca2015-12-28 07:25:51 +0000141 return llvm::StringSwitch<unsigned>(Str)
142#define OPENMP_SCHEDULE_KIND(Name) \
143 .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
144#define OPENMP_SCHEDULE_MODIFIER(Name) \
145 .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
Alexey Bataev56dafe82014-06-20 07:16:17 +0000146#include "clang/Basic/OpenMPKinds.def"
147 .Default(OMPC_SCHEDULE_unknown);
Alexey Bataev1c2cfbc2015-06-23 14:25:19 +0000148 case OMPC_depend:
149 return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
150#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
151#include "clang/Basic/OpenMPKinds.def"
152 .Default(OMPC_DEPEND_unknown);
Alexey Bataev182227b2015-08-20 10:54:39 +0000153 case OMPC_linear:
154 return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
155#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
156#include "clang/Basic/OpenMPKinds.def"
157 .Default(OMPC_LINEAR_unknown);
Kelvin Li0bff7af2015-11-23 05:32:03 +0000158 case OMPC_map:
Kelvin Lief579432018-12-18 22:18:41 +0000159 return llvm::StringSwitch<unsigned>(Str)
160#define OPENMP_MAP_KIND(Name) \
161 .Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
162#define OPENMP_MAP_MODIFIER_KIND(Name) \
163 .Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
Kelvin Li0bff7af2015-11-23 05:32:03 +0000164#include "clang/Basic/OpenMPKinds.def"
165 .Default(OMPC_MAP_unknown);
Michael Kruse01f670d2019-02-22 22:29:42 +0000166 case OMPC_to:
167 return llvm::StringSwitch<unsigned>(Str)
168#define OPENMP_TO_MODIFIER_KIND(Name) \
169 .Case(#Name, static_cast<unsigned>(OMPC_TO_MODIFIER_##Name))
170#include "clang/Basic/OpenMPKinds.def"
171 .Default(OMPC_TO_MODIFIER_unknown);
Michael Kruse0336c752019-02-25 20:34:15 +0000172 case OMPC_from:
173 return llvm::StringSwitch<unsigned>(Str)
174#define OPENMP_FROM_MODIFIER_KIND(Name) \
175 .Case(#Name, static_cast<unsigned>(OMPC_FROM_MODIFIER_##Name))
176#include "clang/Basic/OpenMPKinds.def"
177 .Default(OMPC_FROM_MODIFIER_unknown);
Carlo Bertollib4adf552016-01-15 18:50:31 +0000178 case OMPC_dist_schedule:
179 return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
180#define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
181#include "clang/Basic/OpenMPKinds.def"
182 .Default(OMPC_DIST_SCHEDULE_unknown);
Arpith Chacko Jacob3cf89042016-01-26 16:37:23 +0000183 case OMPC_defaultmap:
184 return llvm::StringSwitch<unsigned>(Str)
185#define OPENMP_DEFAULTMAP_KIND(Name) \
186 .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
187#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
188 .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
189#include "clang/Basic/OpenMPKinds.def"
190 .Default(OMPC_DEFAULTMAP_unknown);
Patrick Lyster7a2a27c2018-11-02 12:18:11 +0000191 case OMPC_atomic_default_mem_order:
192 return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
193#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
194 .Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
195#include "clang/Basic/OpenMPKinds.def"
196 .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
Alexey Bataev729e2422019-08-23 16:11:14 +0000197 case OMPC_device_type:
198 return llvm::StringSwitch<OpenMPDeviceType>(Str)
199#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
200#include "clang/Basic/OpenMPKinds.def"
201 .Default(OMPC_DEVICE_TYPE_unknown);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000202 case OMPC_unknown:
203 case OMPC_threadprivate:
Alexey Bataevaadd52e2014-02-13 05:29:23 +0000204 case OMPC_if:
Alexey Bataev3778b602014-07-17 07:32:53 +0000205 case OMPC_final:
Alexey Bataev568a8332014-03-06 06:15:19 +0000206 case OMPC_num_threads:
Alexey Bataev62c87d22014-03-21 04:51:18 +0000207 case OMPC_safelen:
Alexey Bataev66b15b52015-08-21 11:14:16 +0000208 case OMPC_simdlen:
Alexey Bataev9cc10fc2019-03-12 18:52:33 +0000209 case OMPC_allocator:
Alexey Bataeve04483e2019-03-27 14:14:31 +0000210 case OMPC_allocate:
Alexander Musman8bd31e62014-05-27 15:12:19 +0000211 case OMPC_collapse:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000212 case OMPC_private:
Alexey Bataevd5af8e42013-10-01 05:32:34 +0000213 case OMPC_firstprivate:
Alexander Musman1bb328c2014-06-04 13:06:39 +0000214 case OMPC_lastprivate:
David Blaikie3e8aa9a2013-09-06 20:58:25 +0000215 case OMPC_shared:
Alexey Bataevc5e02582014-06-16 07:08:35 +0000216 case OMPC_reduction:
Alexey Bataev169d96a2017-07-18 20:17:46 +0000217 case OMPC_task_reduction:
Alexey Bataevfa312f32017-07-21 18:48:21 +0000218 case OMPC_in_reduction:
Alexander Musmanf0d76e72014-05-29 14:36:25 +0000219 case OMPC_aligned:
Alexey Bataevd48bcd82014-03-31 03:36:38 +0000220 case OMPC_copyin:
Alexey Bataevbae9a792014-06-27 10:37:06 +0000221 case OMPC_copyprivate:
Alexey Bataev142e1fc2014-06-20 09:44:06 +0000222 case OMPC_ordered:
Alexey Bataev236070f2014-06-20 11:19:47 +0000223 case OMPC_nowait:
Alexey Bataev7aea99a2014-07-17 12:19:31 +0000224 case OMPC_untied:
Alexey Bataev74ba3a52014-07-17 12:47:03 +0000225 case OMPC_mergeable:
Alexey Bataev6125da92014-07-21 11:26:11 +0000226 case OMPC_flush:
Alexey Bataevf98b00c2014-07-23 02:27:21 +0000227 case OMPC_read:
Alexey Bataevdea47612014-07-23 07:46:59 +0000228 case OMPC_write:
Alexey Bataev67a4f222014-07-23 10:25:33 +0000229 case OMPC_update:
Alexey Bataev459dec02014-07-24 06:46:57 +0000230 case OMPC_capture:
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000231 case OMPC_seq_cst:
Michael Wonge710d542015-08-07 16:16:36 +0000232 case OMPC_device:
Alexey Bataev346265e2015-09-25 10:37:12 +0000233 case OMPC_threads:
Alexey Bataevd14d1e62015-09-28 06:39:35 +0000234 case OMPC_simd:
Kelvin Li099bb8c2015-11-24 20:50:12 +0000235 case OMPC_num_teams:
Kelvin Lia15fb1a2015-11-27 18:47:36 +0000236 case OMPC_thread_limit:
Alexey Bataeva0569352015-12-01 10:17:31 +0000237 case OMPC_priority:
Alexey Bataev1fd4aed2015-12-07 12:52:51 +0000238 case OMPC_grainsize:
Alexey Bataevb825de12015-12-07 10:51:44 +0000239 case OMPC_nogroup:
Alexey Bataev382967a2015-12-08 12:06:20 +0000240 case OMPC_num_tasks:
Alexey Bataev28c75412015-12-15 08:19:24 +0000241 case OMPC_hint:
Alexey Bataeve48a5fc2016-04-12 05:28:34 +0000242 case OMPC_uniform:
Carlo Bertolli2404b172016-07-13 15:37:16 +0000243 case OMPC_use_device_ptr:
Carlo Bertolli70594e92016-07-13 17:16:49 +0000244 case OMPC_is_device_ptr:
Kelvin Li1408f912018-09-26 04:28:39 +0000245 case OMPC_unified_address:
Patrick Lyster4a370b92018-10-01 13:47:43 +0000246 case OMPC_unified_shared_memory:
Patrick Lyster6bdf63b2018-10-03 20:07:58 +0000247 case OMPC_reverse_offload:
Patrick Lyster3fe9e392018-10-11 14:41:10 +0000248 case OMPC_dynamic_allocators:
Alexey Bataevdba792c2019-09-23 18:13:31 +0000249 case OMPC_match:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000250 break;
251 }
252 llvm_unreachable("Invalid OpenMP simple clause kind");
253}
254
255const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
256 unsigned Type) {
257 switch (Kind) {
258 case OMPC_default:
259 switch (Type) {
260 case OMPC_DEFAULT_unknown:
261 return "unknown";
Alexey Bataev23b69422014-06-18 07:08:49 +0000262#define OPENMP_DEFAULT_KIND(Name) \
263 case OMPC_DEFAULT_##Name: \
264 return #Name;
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000265#include "clang/Basic/OpenMPKinds.def"
266 }
267 llvm_unreachable("Invalid OpenMP 'default' clause type");
Alexey Bataevbcbadb62014-05-06 06:04:14 +0000268 case OMPC_proc_bind:
269 switch (Type) {
270 case OMPC_PROC_BIND_unknown:
271 return "unknown";
Alexey Bataev23b69422014-06-18 07:08:49 +0000272#define OPENMP_PROC_BIND_KIND(Name) \
273 case OMPC_PROC_BIND_##Name: \
274 return #Name;
Alexey Bataevbcbadb62014-05-06 06:04:14 +0000275#include "clang/Basic/OpenMPKinds.def"
276 }
277 llvm_unreachable("Invalid OpenMP 'proc_bind' clause type");
Alexey Bataev56dafe82014-06-20 07:16:17 +0000278 case OMPC_schedule:
279 switch (Type) {
280 case OMPC_SCHEDULE_unknown:
Alexey Bataev6402bca2015-12-28 07:25:51 +0000281 case OMPC_SCHEDULE_MODIFIER_last:
Alexey Bataev56dafe82014-06-20 07:16:17 +0000282 return "unknown";
283#define OPENMP_SCHEDULE_KIND(Name) \
Alexey Bataev6402bca2015-12-28 07:25:51 +0000284 case OMPC_SCHEDULE_##Name: \
285 return #Name;
286#define OPENMP_SCHEDULE_MODIFIER(Name) \
287 case OMPC_SCHEDULE_MODIFIER_##Name: \
288 return #Name;
Alexey Bataev56dafe82014-06-20 07:16:17 +0000289#include "clang/Basic/OpenMPKinds.def"
290 }
Alexey Bataev6402bca2015-12-28 07:25:51 +0000291 llvm_unreachable("Invalid OpenMP 'schedule' clause type");
Alexey Bataev1c2cfbc2015-06-23 14:25:19 +0000292 case OMPC_depend:
293 switch (Type) {
294 case OMPC_DEPEND_unknown:
295 return "unknown";
296#define OPENMP_DEPEND_KIND(Name) \
297 case OMPC_DEPEND_##Name: \
298 return #Name;
299#include "clang/Basic/OpenMPKinds.def"
300 }
Alexey Bataev6402bca2015-12-28 07:25:51 +0000301 llvm_unreachable("Invalid OpenMP 'depend' clause type");
Alexey Bataev182227b2015-08-20 10:54:39 +0000302 case OMPC_linear:
303 switch (Type) {
304 case OMPC_LINEAR_unknown:
305 return "unknown";
306#define OPENMP_LINEAR_KIND(Name) \
307 case OMPC_LINEAR_##Name: \
308 return #Name;
309#include "clang/Basic/OpenMPKinds.def"
310 }
311 llvm_unreachable("Invalid OpenMP 'linear' clause type");
Kelvin Li0bff7af2015-11-23 05:32:03 +0000312 case OMPC_map:
313 switch (Type) {
314 case OMPC_MAP_unknown:
Kelvin Lief579432018-12-18 22:18:41 +0000315 case OMPC_MAP_MODIFIER_last:
Kelvin Li0bff7af2015-11-23 05:32:03 +0000316 return "unknown";
317#define OPENMP_MAP_KIND(Name) \
318 case OMPC_MAP_##Name: \
319 return #Name;
Kelvin Lief579432018-12-18 22:18:41 +0000320#define OPENMP_MAP_MODIFIER_KIND(Name) \
321 case OMPC_MAP_MODIFIER_##Name: \
322 return #Name;
Kelvin Li0bff7af2015-11-23 05:32:03 +0000323#include "clang/Basic/OpenMPKinds.def"
324 default:
325 break;
326 }
327 llvm_unreachable("Invalid OpenMP 'map' clause type");
Michael Kruse01f670d2019-02-22 22:29:42 +0000328 case OMPC_to:
329 switch (Type) {
330 case OMPC_TO_MODIFIER_unknown:
331 return "unknown";
332#define OPENMP_TO_MODIFIER_KIND(Name) \
333 case OMPC_TO_MODIFIER_##Name: \
334 return #Name;
335#include "clang/Basic/OpenMPKinds.def"
336 default:
337 break;
338 }
339 llvm_unreachable("Invalid OpenMP 'to' clause type");
Michael Kruse0336c752019-02-25 20:34:15 +0000340 case OMPC_from:
341 switch (Type) {
342 case OMPC_FROM_MODIFIER_unknown:
343 return "unknown";
344#define OPENMP_FROM_MODIFIER_KIND(Name) \
345 case OMPC_FROM_MODIFIER_##Name: \
346 return #Name;
347#include "clang/Basic/OpenMPKinds.def"
348 default:
349 break;
350 }
351 llvm_unreachable("Invalid OpenMP 'from' clause type");
Carlo Bertollib4adf552016-01-15 18:50:31 +0000352 case OMPC_dist_schedule:
353 switch (Type) {
354 case OMPC_DIST_SCHEDULE_unknown:
355 return "unknown";
356#define OPENMP_DIST_SCHEDULE_KIND(Name) \
357 case OMPC_DIST_SCHEDULE_##Name: \
358 return #Name;
359#include "clang/Basic/OpenMPKinds.def"
360 }
361 llvm_unreachable("Invalid OpenMP 'dist_schedule' clause type");
Arpith Chacko Jacob3cf89042016-01-26 16:37:23 +0000362 case OMPC_defaultmap:
363 switch (Type) {
364 case OMPC_DEFAULTMAP_unknown:
365 case OMPC_DEFAULTMAP_MODIFIER_last:
366 return "unknown";
367#define OPENMP_DEFAULTMAP_KIND(Name) \
368 case OMPC_DEFAULTMAP_##Name: \
369 return #Name;
370#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
371 case OMPC_DEFAULTMAP_MODIFIER_##Name: \
372 return #Name;
373#include "clang/Basic/OpenMPKinds.def"
374 }
375 llvm_unreachable("Invalid OpenMP 'schedule' clause type");
Patrick Lyster7a2a27c2018-11-02 12:18:11 +0000376 case OMPC_atomic_default_mem_order:
377 switch (Type) {
378 case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
379 return "unknown";
380#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
381 case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name: \
382 return #Name;
383#include "clang/Basic/OpenMPKinds.def"
384}
385 llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type");
Alexey Bataev729e2422019-08-23 16:11:14 +0000386 case OMPC_device_type:
387 switch (Type) {
388 case OMPC_DEVICE_TYPE_unknown:
389 return "unknown";
390#define OPENMP_DEVICE_TYPE_KIND(Name) \
391 case OMPC_DEVICE_TYPE_##Name: \
392 return #Name;
393#include "clang/Basic/OpenMPKinds.def"
394 }
395 llvm_unreachable("Invalid OpenMP 'device_type' clause type");
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000396 case OMPC_unknown:
397 case OMPC_threadprivate:
Alexey Bataevaadd52e2014-02-13 05:29:23 +0000398 case OMPC_if:
Alexey Bataev3778b602014-07-17 07:32:53 +0000399 case OMPC_final:
Alexey Bataev568a8332014-03-06 06:15:19 +0000400 case OMPC_num_threads:
Alexey Bataev62c87d22014-03-21 04:51:18 +0000401 case OMPC_safelen:
Alexey Bataev66b15b52015-08-21 11:14:16 +0000402 case OMPC_simdlen:
Alexey Bataev9cc10fc2019-03-12 18:52:33 +0000403 case OMPC_allocator:
Alexey Bataeve04483e2019-03-27 14:14:31 +0000404 case OMPC_allocate:
Alexander Musman8bd31e62014-05-27 15:12:19 +0000405 case OMPC_collapse:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000406 case OMPC_private:
Alexey Bataevd5af8e42013-10-01 05:32:34 +0000407 case OMPC_firstprivate:
Alexander Musman1bb328c2014-06-04 13:06:39 +0000408 case OMPC_lastprivate:
David Blaikie3e8aa9a2013-09-06 20:58:25 +0000409 case OMPC_shared:
Alexey Bataevc5e02582014-06-16 07:08:35 +0000410 case OMPC_reduction:
Alexey Bataev169d96a2017-07-18 20:17:46 +0000411 case OMPC_task_reduction:
Alexey Bataevfa312f32017-07-21 18:48:21 +0000412 case OMPC_in_reduction:
Alexander Musmanf0d76e72014-05-29 14:36:25 +0000413 case OMPC_aligned:
Alexey Bataevd48bcd82014-03-31 03:36:38 +0000414 case OMPC_copyin:
Alexey Bataevbae9a792014-06-27 10:37:06 +0000415 case OMPC_copyprivate:
Alexey Bataev142e1fc2014-06-20 09:44:06 +0000416 case OMPC_ordered:
Alexey Bataev236070f2014-06-20 11:19:47 +0000417 case OMPC_nowait:
Alexey Bataev7aea99a2014-07-17 12:19:31 +0000418 case OMPC_untied:
Alexey Bataev74ba3a52014-07-17 12:47:03 +0000419 case OMPC_mergeable:
Alexey Bataev6125da92014-07-21 11:26:11 +0000420 case OMPC_flush:
Alexey Bataevf98b00c2014-07-23 02:27:21 +0000421 case OMPC_read:
Alexey Bataevdea47612014-07-23 07:46:59 +0000422 case OMPC_write:
Alexey Bataev67a4f222014-07-23 10:25:33 +0000423 case OMPC_update:
Alexey Bataev459dec02014-07-24 06:46:57 +0000424 case OMPC_capture:
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000425 case OMPC_seq_cst:
Michael Wonge710d542015-08-07 16:16:36 +0000426 case OMPC_device:
Alexey Bataev346265e2015-09-25 10:37:12 +0000427 case OMPC_threads:
Alexey Bataevd14d1e62015-09-28 06:39:35 +0000428 case OMPC_simd:
Kelvin Li099bb8c2015-11-24 20:50:12 +0000429 case OMPC_num_teams:
Kelvin Lia15fb1a2015-11-27 18:47:36 +0000430 case OMPC_thread_limit:
Alexey Bataeva0569352015-12-01 10:17:31 +0000431 case OMPC_priority:
Alexey Bataev1fd4aed2015-12-07 12:52:51 +0000432 case OMPC_grainsize:
Alexey Bataevb825de12015-12-07 10:51:44 +0000433 case OMPC_nogroup:
Alexey Bataev382967a2015-12-08 12:06:20 +0000434 case OMPC_num_tasks:
Alexey Bataev28c75412015-12-15 08:19:24 +0000435 case OMPC_hint:
Alexey Bataeve48a5fc2016-04-12 05:28:34 +0000436 case OMPC_uniform:
Carlo Bertolli2404b172016-07-13 15:37:16 +0000437 case OMPC_use_device_ptr:
Carlo Bertolli70594e92016-07-13 17:16:49 +0000438 case OMPC_is_device_ptr:
Kelvin Li1408f912018-09-26 04:28:39 +0000439 case OMPC_unified_address:
Patrick Lyster4a370b92018-10-01 13:47:43 +0000440 case OMPC_unified_shared_memory:
Patrick Lyster6bdf63b2018-10-03 20:07:58 +0000441 case OMPC_reverse_offload:
Patrick Lyster3fe9e392018-10-11 14:41:10 +0000442 case OMPC_dynamic_allocators:
Alexey Bataevdba792c2019-09-23 18:13:31 +0000443 case OMPC_match:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000444 break;
445 }
446 llvm_unreachable("Invalid OpenMP simple clause kind");
447}
448
449bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
450 OpenMPClauseKind CKind) {
Alexey Bataev4ca40ed2014-05-12 04:23:46 +0000451 assert(DKind <= OMPD_unknown);
452 assert(CKind <= OMPC_unknown);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000453 switch (DKind) {
454 case OMPD_parallel:
455 switch (CKind) {
Alexey Bataev23b69422014-06-18 07:08:49 +0000456#define OPENMP_PARALLEL_CLAUSE(Name) \
457 case OMPC_##Name: \
458 return true;
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000459#include "clang/Basic/OpenMPKinds.def"
460 default:
461 break;
462 }
463 break;
Alexey Bataev1b59ab52014-02-27 08:29:12 +0000464 case OMPD_simd:
465 switch (CKind) {
Alexey Bataev23b69422014-06-18 07:08:49 +0000466#define OPENMP_SIMD_CLAUSE(Name) \
467 case OMPC_##Name: \
468 return true;
Alexey Bataev1b59ab52014-02-27 08:29:12 +0000469#include "clang/Basic/OpenMPKinds.def"
470 default:
471 break;
472 }
473 break;
Alexey Bataevf29276e2014-06-18 04:14:57 +0000474 case OMPD_for:
475 switch (CKind) {
Alexey Bataev23b69422014-06-18 07:08:49 +0000476#define OPENMP_FOR_CLAUSE(Name) \
477 case OMPC_##Name: \
478 return true;
Alexey Bataevf29276e2014-06-18 04:14:57 +0000479#include "clang/Basic/OpenMPKinds.def"
480 default:
481 break;
482 }
483 break;
Alexander Musmanf82886e2014-09-18 05:12:34 +0000484 case OMPD_for_simd:
485 switch (CKind) {
486#define OPENMP_FOR_SIMD_CLAUSE(Name) \
487 case OMPC_##Name: \
488 return true;
489#include "clang/Basic/OpenMPKinds.def"
490 default:
491 break;
492 }
493 break;
Alexey Bataevd3f8dd22014-06-25 11:44:49 +0000494 case OMPD_sections:
495 switch (CKind) {
Alexey Bataevbae9a792014-06-27 10:37:06 +0000496#define OPENMP_SECTIONS_CLAUSE(Name) \
Alexey Bataevd3f8dd22014-06-25 11:44:49 +0000497 case OMPC_##Name: \
498 return true;
499#include "clang/Basic/OpenMPKinds.def"
500 default:
501 break;
502 }
503 break;
Alexey Bataevd1e40fb2014-06-26 12:05:45 +0000504 case OMPD_single:
505 switch (CKind) {
Alexey Bataevbae9a792014-06-27 10:37:06 +0000506#define OPENMP_SINGLE_CLAUSE(Name) \
Alexey Bataevd1e40fb2014-06-26 12:05:45 +0000507 case OMPC_##Name: \
508 return true;
509#include "clang/Basic/OpenMPKinds.def"
510 default:
511 break;
512 }
513 break;
Alexey Bataev4acb8592014-07-07 13:01:15 +0000514 case OMPD_parallel_for:
515 switch (CKind) {
516#define OPENMP_PARALLEL_FOR_CLAUSE(Name) \
517 case OMPC_##Name: \
518 return true;
519#include "clang/Basic/OpenMPKinds.def"
520 default:
521 break;
522 }
523 break;
Alexander Musmane4e893b2014-09-23 09:33:00 +0000524 case OMPD_parallel_for_simd:
525 switch (CKind) {
526#define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) \
527 case OMPC_##Name: \
528 return true;
529#include "clang/Basic/OpenMPKinds.def"
530 default:
531 break;
532 }
533 break;
Alexey Bataev84d0b3e2014-07-08 08:12:03 +0000534 case OMPD_parallel_sections:
535 switch (CKind) {
536#define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) \
537 case OMPC_##Name: \
538 return true;
539#include "clang/Basic/OpenMPKinds.def"
540 default:
541 break;
542 }
543 break;
Alexey Bataev9c2e8ee2014-07-11 11:25:16 +0000544 case OMPD_task:
545 switch (CKind) {
546#define OPENMP_TASK_CLAUSE(Name) \
547 case OMPC_##Name: \
548 return true;
549#include "clang/Basic/OpenMPKinds.def"
550 default:
551 break;
552 }
553 break;
Alexey Bataev6125da92014-07-21 11:26:11 +0000554 case OMPD_flush:
555 return CKind == OMPC_flush;
556 break;
Alexey Bataev0162e452014-07-22 10:10:35 +0000557 case OMPD_atomic:
558 switch (CKind) {
559#define OPENMP_ATOMIC_CLAUSE(Name) \
560 case OMPC_##Name: \
561 return true;
562#include "clang/Basic/OpenMPKinds.def"
563 default:
564 break;
565 }
566 break;
Alexey Bataev0bd520b2014-09-19 08:19:49 +0000567 case OMPD_target:
568 switch (CKind) {
569#define OPENMP_TARGET_CLAUSE(Name) \
570 case OMPC_##Name: \
571 return true;
572#include "clang/Basic/OpenMPKinds.def"
573 default:
574 break;
575 }
576 break;
Kelvin Li1408f912018-09-26 04:28:39 +0000577 case OMPD_requires:
578 switch (CKind) {
579#define OPENMP_REQUIRES_CLAUSE(Name) \
580 case OMPC_##Name: \
581 return true;
582#include "clang/Basic/OpenMPKinds.def"
583 default:
584 break;
585 }
586 break;
Michael Wong65f367f2015-07-21 13:44:28 +0000587 case OMPD_target_data:
588 switch (CKind) {
589#define OPENMP_TARGET_DATA_CLAUSE(Name) \
590 case OMPC_##Name: \
591 return true;
592#include "clang/Basic/OpenMPKinds.def"
593 default:
594 break;
595 }
596 break;
Samuel Antaodf67fc42016-01-19 19:15:56 +0000597 case OMPD_target_enter_data:
598 switch (CKind) {
599#define OPENMP_TARGET_ENTER_DATA_CLAUSE(Name) \
600 case OMPC_##Name: \
601 return true;
602#include "clang/Basic/OpenMPKinds.def"
603 default:
604 break;
605 }
606 break;
Samuel Antao72590762016-01-19 20:04:50 +0000607 case OMPD_target_exit_data:
608 switch (CKind) {
609#define OPENMP_TARGET_EXIT_DATA_CLAUSE(Name) \
610 case OMPC_##Name: \
611 return true;
612#include "clang/Basic/OpenMPKinds.def"
613 default:
614 break;
615 }
616 break;
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000617 case OMPD_target_parallel:
618 switch (CKind) {
619#define OPENMP_TARGET_PARALLEL_CLAUSE(Name) \
620 case OMPC_##Name: \
621 return true;
622#include "clang/Basic/OpenMPKinds.def"
623 default:
624 break;
625 }
626 break;
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000627 case OMPD_target_parallel_for:
628 switch (CKind) {
629#define OPENMP_TARGET_PARALLEL_FOR_CLAUSE(Name) \
630 case OMPC_##Name: \
631 return true;
632#include "clang/Basic/OpenMPKinds.def"
633 default:
634 break;
635 }
636 break;
Samuel Antao686c70c2016-05-26 17:30:50 +0000637 case OMPD_target_update:
638 switch (CKind) {
639#define OPENMP_TARGET_UPDATE_CLAUSE(Name) \
640 case OMPC_##Name: \
641 return true;
642#include "clang/Basic/OpenMPKinds.def"
643 default:
644 break;
645 }
646 break;
Alexey Bataev13314bf2014-10-09 04:18:56 +0000647 case OMPD_teams:
648 switch (CKind) {
649#define OPENMP_TEAMS_CLAUSE(Name) \
650 case OMPC_##Name: \
651 return true;
652#include "clang/Basic/OpenMPKinds.def"
653 default:
654 break;
655 }
656 break;
Alexey Bataev87933c72015-09-18 08:07:34 +0000657 case OMPD_cancel:
658 switch (CKind) {
659#define OPENMP_CANCEL_CLAUSE(Name) \
660 case OMPC_##Name: \
661 return true;
662#include "clang/Basic/OpenMPKinds.def"
663 default:
664 break;
665 }
666 break;
Alexey Bataev346265e2015-09-25 10:37:12 +0000667 case OMPD_ordered:
668 switch (CKind) {
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000669#define OPENMP_ORDERED_CLAUSE(Name) \
Alexey Bataev346265e2015-09-25 10:37:12 +0000670 case OMPC_##Name: \
671 return true;
672#include "clang/Basic/OpenMPKinds.def"
673 default:
674 break;
675 }
676 break;
Alexey Bataev49f6e782015-12-01 04:18:41 +0000677 case OMPD_taskloop:
678 switch (CKind) {
679#define OPENMP_TASKLOOP_CLAUSE(Name) \
680 case OMPC_##Name: \
681 return true;
682#include "clang/Basic/OpenMPKinds.def"
683 default:
684 break;
685 }
686 break;
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000687 case OMPD_taskloop_simd:
688 switch (CKind) {
689#define OPENMP_TASKLOOP_SIMD_CLAUSE(Name) \
690 case OMPC_##Name: \
691 return true;
692#include "clang/Basic/OpenMPKinds.def"
693 default:
694 break;
695 }
696 break;
Alexey Bataev60e51c42019-10-10 20:13:02 +0000697 case OMPD_master_taskloop:
698 switch (CKind) {
699#define OPENMP_MASTER_TASKLOOP_CLAUSE(Name) \
700 case OMPC_##Name: \
701 return true;
702#include "clang/Basic/OpenMPKinds.def"
703 default:
704 break;
705 }
706 break;
Alexey Bataevb8552ab2019-10-18 16:47:35 +0000707 case OMPD_master_taskloop_simd:
708 switch (CKind) {
709#define OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(Name) \
710 case OMPC_##Name: \
711 return true;
712#include "clang/Basic/OpenMPKinds.def"
713 default:
714 break;
715 }
716 break;
Alexey Bataev5bbcead2019-10-14 17:17:41 +0000717 case OMPD_parallel_master_taskloop:
718 switch (CKind) {
719#define OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(Name) \
720 case OMPC_##Name: \
721 return true;
722#include "clang/Basic/OpenMPKinds.def"
723 default:
724 break;
725 }
726 break;
Alexey Bataev14a388f2019-10-25 10:27:13 -0400727 case OMPD_parallel_master_taskloop_simd:
728 switch (CKind) {
729#define OPENMP_PARALLEL_MASTER_TASKLOOP_SIMD_CLAUSE(Name) \
730 case OMPC_##Name: \
731 return true;
732#include "clang/Basic/OpenMPKinds.def"
733 default:
734 break;
735 }
736 break;
Alexey Bataev28c75412015-12-15 08:19:24 +0000737 case OMPD_critical:
738 switch (CKind) {
739#define OPENMP_CRITICAL_CLAUSE(Name) \
740 case OMPC_##Name: \
741 return true;
742#include "clang/Basic/OpenMPKinds.def"
743 default:
744 break;
745 }
746 break;
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000747 case OMPD_distribute:
748 switch (CKind) {
749#define OPENMP_DISTRIBUTE_CLAUSE(Name) \
750 case OMPC_##Name: \
751 return true;
752#include "clang/Basic/OpenMPKinds.def"
753 default:
754 break;
755 }
756 break;
Carlo Bertolli9925f152016-06-27 14:55:37 +0000757 case OMPD_distribute_parallel_for:
758 switch (CKind) {
759#define OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
760 case OMPC_##Name: \
761 return true;
762#include "clang/Basic/OpenMPKinds.def"
763 default:
764 break;
765 }
766 break;
Kelvin Li4a39add2016-07-05 05:00:15 +0000767 case OMPD_distribute_parallel_for_simd:
768 switch (CKind) {
769#define OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
770 case OMPC_##Name: \
771 return true;
772#include "clang/Basic/OpenMPKinds.def"
773 default:
774 break;
775 }
776 break;
Kelvin Li787f3fc2016-07-06 04:45:38 +0000777 case OMPD_distribute_simd:
778 switch (CKind) {
779#define OPENMP_DISTRIBUTE_SIMD_CLAUSE(Name) \
780 case OMPC_##Name: \
781 return true;
782#include "clang/Basic/OpenMPKinds.def"
783 default:
784 break;
785 }
786 break;
Kelvin Lia579b912016-07-14 02:54:56 +0000787 case OMPD_target_parallel_for_simd:
788 switch (CKind) {
789#define OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(Name) \
790 case OMPC_##Name: \
791 return true;
792#include "clang/Basic/OpenMPKinds.def"
793 default:
794 break;
795 }
796 break;
Kelvin Li986330c2016-07-20 22:57:10 +0000797 case OMPD_target_simd:
798 switch (CKind) {
799#define OPENMP_TARGET_SIMD_CLAUSE(Name) \
800 case OMPC_##Name: \
801 return true;
802#include "clang/Basic/OpenMPKinds.def"
803 default:
804 break;
805 }
806 break;
Kelvin Li02532872016-08-05 14:37:37 +0000807 case OMPD_teams_distribute:
808 switch (CKind) {
809#define OPENMP_TEAMS_DISTRIBUTE_CLAUSE(Name) \
810 case OMPC_##Name: \
811 return true;
812#include "clang/Basic/OpenMPKinds.def"
813 default:
814 break;
815 }
816 break;
Kelvin Li4e325f72016-10-25 12:50:55 +0000817 case OMPD_teams_distribute_simd:
818 switch (CKind) {
819#define OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \
820 case OMPC_##Name: \
821 return true;
822#include "clang/Basic/OpenMPKinds.def"
823 default:
824 break;
825 }
826 break;
Kelvin Li579e41c2016-11-30 23:51:03 +0000827 case OMPD_teams_distribute_parallel_for_simd:
828 switch (CKind) {
829#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
830 case OMPC_##Name: \
831 return true;
832#include "clang/Basic/OpenMPKinds.def"
833 default:
834 break;
835 }
836 break;
Kelvin Li7ade93f2016-12-09 03:24:30 +0000837 case OMPD_teams_distribute_parallel_for:
838 switch (CKind) {
839#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
840 case OMPC_##Name: \
841 return true;
842#include "clang/Basic/OpenMPKinds.def"
843 default:
844 break;
845 }
846 break;
Kelvin Libf594a52016-12-17 05:48:59 +0000847 case OMPD_target_teams:
848 switch (CKind) {
849#define OPENMP_TARGET_TEAMS_CLAUSE(Name) \
850 case OMPC_##Name: \
851 return true;
852#include "clang/Basic/OpenMPKinds.def"
853 default:
854 break;
855 }
856 break;
Kelvin Li83c451e2016-12-25 04:52:54 +0000857 case OMPD_target_teams_distribute:
858 switch (CKind) {
859#define OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(Name) \
860 case OMPC_##Name: \
861 return true;
862#include "clang/Basic/OpenMPKinds.def"
863 default:
864 break;
865 }
866 break;
Kelvin Li80e8f562016-12-29 22:16:30 +0000867 case OMPD_target_teams_distribute_parallel_for:
868 switch (CKind) {
869#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
870 case OMPC_##Name: \
871 return true;
872#include "clang/Basic/OpenMPKinds.def"
873 default:
874 break;
875 }
876 break;
Kelvin Li1851df52017-01-03 05:23:48 +0000877 case OMPD_target_teams_distribute_parallel_for_simd:
878 switch (CKind) {
879#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
880 case OMPC_##Name: \
881 return true;
882#include "clang/Basic/OpenMPKinds.def"
883 default:
884 break;
885 }
886 break;
Kelvin Lida681182017-01-10 18:08:18 +0000887 case OMPD_target_teams_distribute_simd:
888 switch (CKind) {
889#define OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \
890 case OMPC_##Name: \
891 return true;
892#include "clang/Basic/OpenMPKinds.def"
893 default:
894 break;
895 }
896 break;
Alexey Bataev169d96a2017-07-18 20:17:46 +0000897 case OMPD_taskgroup:
898 switch (CKind) {
899#define OPENMP_TASKGROUP_CLAUSE(Name) \
900 case OMPC_##Name: \
901 return true;
902#include "clang/Basic/OpenMPKinds.def"
903 default:
904 break;
905 }
906 break;
Michael Kruse251e1482019-02-01 20:25:04 +0000907 case OMPD_declare_mapper:
908 switch (CKind) {
909#define OPENMP_DECLARE_MAPPER_CLAUSE(Name) \
910 case OMPC_##Name: \
911 return true;
912#include "clang/Basic/OpenMPKinds.def"
913 default:
914 break;
915 }
916 break;
Alexey Bataev9cc10fc2019-03-12 18:52:33 +0000917 case OMPD_allocate:
918 switch (CKind) {
919#define OPENMP_ALLOCATE_CLAUSE(Name) \
920 case OMPC_##Name: \
921 return true;
922#include "clang/Basic/OpenMPKinds.def"
923 default:
924 break;
925 }
926 break;
Alexey Bataevdba792c2019-09-23 18:13:31 +0000927 case OMPD_declare_variant:
928 switch (CKind) {
929#define OPENMP_DECLARE_VARIANT_CLAUSE(Name) \
930 case OMPC_##Name: \
931 return true;
932#include "clang/Basic/OpenMPKinds.def"
933 default:
934 break;
935 }
936 break;
Dmitry Polukhin0b0da292016-04-06 11:38:59 +0000937 case OMPD_declare_target:
938 case OMPD_end_declare_target:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000939 case OMPD_unknown:
940 case OMPD_threadprivate:
Alexey Bataev1e0498a2014-06-26 08:21:58 +0000941 case OMPD_section:
Alexander Musman80c22892014-07-17 08:54:58 +0000942 case OMPD_master:
Alexey Bataev68446b72014-07-18 07:47:19 +0000943 case OMPD_taskyield:
Alexey Bataev4d1dfea2014-07-18 09:11:51 +0000944 case OMPD_barrier:
Alexey Bataev2df347a2014-07-18 10:17:07 +0000945 case OMPD_taskwait:
Alexey Bataev6d4ed052015-07-01 06:57:41 +0000946 case OMPD_cancellation_point:
Alexey Bataev94a4f0c2016-03-03 05:21:39 +0000947 case OMPD_declare_reduction:
Alexey Bataevd158cf62019-09-13 20:18:17 +0000948 case OMPD_declare_simd:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000949 break;
950 }
951 return false;
952}
Alexey Bataevf29276e2014-06-18 04:14:57 +0000953
954bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
Alexander Musmane4e893b2014-09-23 09:33:00 +0000955 return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
Alexey Bataev49f6e782015-12-01 04:18:41 +0000956 DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000957 DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
Alexey Bataevb8552ab2019-10-18 16:47:35 +0000958 DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
Alexey Bataev14a388f2019-10-25 10:27:13 -0400959 DKind == OMPD_parallel_master_taskloop ||
960 DKind == OMPD_parallel_master_taskloop_simd ||
961 DKind == OMPD_distribute || DKind == OMPD_target_parallel_for ||
Kelvin Li4a39add2016-07-05 05:00:15 +0000962 DKind == OMPD_distribute_parallel_for ||
Kelvin Li787f3fc2016-07-06 04:45:38 +0000963 DKind == OMPD_distribute_parallel_for_simd ||
Kelvin Lia579b912016-07-14 02:54:56 +0000964 DKind == OMPD_distribute_simd ||
Kelvin Li02532872016-08-05 14:37:37 +0000965 DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
Kelvin Li579e41c2016-11-30 23:51:03 +0000966 DKind == OMPD_teams_distribute ||
967 DKind == OMPD_teams_distribute_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +0000968 DKind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li83c451e2016-12-25 04:52:54 +0000969 DKind == OMPD_teams_distribute_parallel_for ||
Kelvin Li80e8f562016-12-29 22:16:30 +0000970 DKind == OMPD_target_teams_distribute ||
Kelvin Li1851df52017-01-03 05:23:48 +0000971 DKind == OMPD_target_teams_distribute_parallel_for ||
Kelvin Lida681182017-01-10 18:08:18 +0000972 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
973 DKind == OMPD_target_teams_distribute_simd;
Alexey Bataevf29276e2014-06-18 04:14:57 +0000974}
975
976bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
Alexander Musmane4e893b2014-09-23 09:33:00 +0000977 return DKind == OMPD_for || DKind == OMPD_for_simd ||
978 DKind == OMPD_sections || DKind == OMPD_section ||
Alexey Bataev84d0b3e2014-07-08 08:12:03 +0000979 DKind == OMPD_single || DKind == OMPD_parallel_for ||
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000980 DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
Carlo Bertolli9925f152016-06-27 14:55:37 +0000981 DKind == OMPD_target_parallel_for ||
Kelvin Li4a39add2016-07-05 05:00:15 +0000982 DKind == OMPD_distribute_parallel_for ||
Kelvin Lia579b912016-07-14 02:54:56 +0000983 DKind == OMPD_distribute_parallel_for_simd ||
Kelvin Li579e41c2016-11-30 23:51:03 +0000984 DKind == OMPD_target_parallel_for_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +0000985 DKind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li80e8f562016-12-29 22:16:30 +0000986 DKind == OMPD_teams_distribute_parallel_for ||
Kelvin Li1851df52017-01-03 05:23:48 +0000987 DKind == OMPD_target_teams_distribute_parallel_for ||
988 DKind == OMPD_target_teams_distribute_parallel_for_simd;
Alexey Bataevf29276e2014-06-18 04:14:57 +0000989}
990
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000991bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
Alexey Bataev60e51c42019-10-10 20:13:02 +0000992 return DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
Alexey Bataevb8552ab2019-10-18 16:47:35 +0000993 DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
Alexey Bataev14a388f2019-10-25 10:27:13 -0400994 DKind == OMPD_parallel_master_taskloop ||
995 DKind == OMPD_parallel_master_taskloop_simd;
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000996}
997
Alexey Bataevf29276e2014-06-18 04:14:57 +0000998bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
Alexey Bataev84d0b3e2014-07-08 08:12:03 +0000999 return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +00001000 DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
Carlo Bertolli9925f152016-06-27 14:55:37 +00001001 DKind == OMPD_target_parallel || DKind == OMPD_target_parallel_for ||
Kelvin Li4a39add2016-07-05 05:00:15 +00001002 DKind == OMPD_distribute_parallel_for ||
Kelvin Lia579b912016-07-14 02:54:56 +00001003 DKind == OMPD_distribute_parallel_for_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +00001004 DKind == OMPD_target_parallel_for_simd ||
1005 DKind == OMPD_teams_distribute_parallel_for ||
Kelvin Li80e8f562016-12-29 22:16:30 +00001006 DKind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li1851df52017-01-03 05:23:48 +00001007 DKind == OMPD_target_teams_distribute_parallel_for ||
Alexey Bataev5bbcead2019-10-14 17:17:41 +00001008 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
Alexey Bataev14a388f2019-10-25 10:27:13 -04001009 DKind == OMPD_parallel_master_taskloop ||
1010 DKind == OMPD_parallel_master_taskloop_simd;
Alexey Bataevf29276e2014-06-18 04:14:57 +00001011}
1012
Arpith Chacko Jacob3d58f262016-02-02 04:00:47 +00001013bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +00001014 return DKind == OMPD_target || DKind == OMPD_target_parallel ||
Alexey Bataev5d7edca2017-11-09 17:32:15 +00001015 DKind == OMPD_target_parallel_for ||
Kelvin Libf594a52016-12-17 05:48:59 +00001016 DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
Kelvin Li80e8f562016-12-29 22:16:30 +00001017 DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
Kelvin Li1851df52017-01-03 05:23:48 +00001018 DKind == OMPD_target_teams_distribute_parallel_for ||
Kelvin Lida681182017-01-10 18:08:18 +00001019 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
1020 DKind == OMPD_target_teams_distribute_simd;
Arpith Chacko Jacob3d58f262016-02-02 04:00:47 +00001021}
1022
1023bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
Arpith Chacko Jacob3d58f262016-02-02 04:00:47 +00001024 return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
Samuel Antao686c70c2016-05-26 17:30:50 +00001025 DKind == OMPD_target_exit_data || DKind == OMPD_target_update;
Samuel Antao4be30e92015-10-02 17:14:03 +00001026}
1027
Kelvin Libf594a52016-12-17 05:48:59 +00001028bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
Kelvin Li4e325f72016-10-25 12:50:55 +00001029 return DKind == OMPD_teams || DKind == OMPD_teams_distribute ||
Kelvin Li579e41c2016-11-30 23:51:03 +00001030 DKind == OMPD_teams_distribute_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +00001031 DKind == OMPD_teams_distribute_parallel_for_simd ||
1032 DKind == OMPD_teams_distribute_parallel_for;
Kelvin Libf594a52016-12-17 05:48:59 +00001033}
1034
1035bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
1036 return isOpenMPNestingTeamsDirective(DKind) ||
Kelvin Li80e8f562016-12-29 22:16:30 +00001037 DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
Kelvin Li1851df52017-01-03 05:23:48 +00001038 DKind == OMPD_target_teams_distribute_parallel_for ||
Kelvin Lida681182017-01-10 18:08:18 +00001039 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
1040 DKind == OMPD_target_teams_distribute_simd;
Alexey Bataev13314bf2014-10-09 04:18:56 +00001041}
1042
Alexey Bataevf29276e2014-06-18 04:14:57 +00001043bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
Alexander Musmane4e893b2014-09-23 09:33:00 +00001044 return DKind == OMPD_simd || DKind == OMPD_for_simd ||
Kelvin Li4a39add2016-07-05 05:00:15 +00001045 DKind == OMPD_parallel_for_simd || DKind == OMPD_taskloop_simd ||
Alexey Bataevb8552ab2019-10-18 16:47:35 +00001046 DKind == OMPD_master_taskloop_simd ||
Alexey Bataev14a388f2019-10-25 10:27:13 -04001047 DKind == OMPD_parallel_master_taskloop_simd ||
Kelvin Li787f3fc2016-07-06 04:45:38 +00001048 DKind == OMPD_distribute_parallel_for_simd ||
Kelvin Li4e325f72016-10-25 12:50:55 +00001049 DKind == OMPD_distribute_simd || DKind == OMPD_target_simd ||
Kelvin Li579e41c2016-11-30 23:51:03 +00001050 DKind == OMPD_teams_distribute_simd ||
Kelvin Li1851df52017-01-03 05:23:48 +00001051 DKind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Lida681182017-01-10 18:08:18 +00001052 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
Alexey Bataev9a5e64f2017-11-09 17:01:35 +00001053 DKind == OMPD_target_teams_distribute_simd ||
1054 DKind == OMPD_target_parallel_for_simd;
Alexey Bataevf29276e2014-06-18 04:14:57 +00001055}
1056
Kelvin Li02532872016-08-05 14:37:37 +00001057bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
Kelvin Li4a39add2016-07-05 05:00:15 +00001058 return Kind == OMPD_distribute || Kind == OMPD_distribute_parallel_for ||
Kelvin Li787f3fc2016-07-06 04:45:38 +00001059 Kind == OMPD_distribute_parallel_for_simd ||
1060 Kind == OMPD_distribute_simd;
Kelvin Li4a39add2016-07-05 05:00:15 +00001061 // TODO add next directives.
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001062}
1063
Kelvin Li02532872016-08-05 14:37:37 +00001064bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
1065 return isOpenMPNestingDistributeDirective(Kind) ||
Kelvin Li579e41c2016-11-30 23:51:03 +00001066 Kind == OMPD_teams_distribute || Kind == OMPD_teams_distribute_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +00001067 Kind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li83c451e2016-12-25 04:52:54 +00001068 Kind == OMPD_teams_distribute_parallel_for ||
Kelvin Li80e8f562016-12-29 22:16:30 +00001069 Kind == OMPD_target_teams_distribute ||
Kelvin Li1851df52017-01-03 05:23:48 +00001070 Kind == OMPD_target_teams_distribute_parallel_for ||
Kelvin Lida681182017-01-10 18:08:18 +00001071 Kind == OMPD_target_teams_distribute_parallel_for_simd ||
1072 Kind == OMPD_target_teams_distribute_simd;
Kelvin Li02532872016-08-05 14:37:37 +00001073}
1074
Alexey Bataevf29276e2014-06-18 04:14:57 +00001075bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
1076 return Kind == OMPC_private || Kind == OMPC_firstprivate ||
1077 Kind == OMPC_lastprivate || Kind == OMPC_linear ||
Alexey Bataevfa312f32017-07-21 18:48:21 +00001078 Kind == OMPC_reduction || Kind == OMPC_task_reduction ||
1079 Kind == OMPC_in_reduction; // TODO add next clauses like 'reduction'.
Alexey Bataevf29276e2014-06-18 04:14:57 +00001080}
1081
1082bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
Alexey Bataevf56f98c2015-04-16 05:39:01 +00001083 return Kind == OMPC_threadprivate || Kind == OMPC_copyin;
Alexey Bataevf29276e2014-06-18 04:14:57 +00001084}
1085
Alexey Bataev35aaee62016-04-13 13:36:48 +00001086bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
1087 return Kind == OMPD_task || isOpenMPTaskLoopDirective(Kind);
1088}
Carlo Bertolli9925f152016-06-27 14:55:37 +00001089
1090bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
Kelvin Li4a39add2016-07-05 05:00:15 +00001091 return Kind == OMPD_distribute_parallel_for ||
Kelvin Li787f3fc2016-07-06 04:45:38 +00001092 Kind == OMPD_distribute_parallel_for_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +00001093 Kind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li83c451e2016-12-25 04:52:54 +00001094 Kind == OMPD_teams_distribute_parallel_for ||
Kelvin Li1851df52017-01-03 05:23:48 +00001095 Kind == OMPD_target_teams_distribute_parallel_for ||
Carlo Bertolliffafe102017-04-20 00:39:39 +00001096 Kind == OMPD_target_teams_distribute_parallel_for_simd;
Carlo Bertolli9925f152016-06-27 14:55:37 +00001097}
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001098
1099void clang::getOpenMPCaptureRegions(
1100 SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
1101 OpenMPDirectiveKind DKind) {
1102 assert(DKind <= OMPD_unknown);
1103 switch (DKind) {
1104 case OMPD_parallel:
1105 case OMPD_parallel_for:
1106 case OMPD_parallel_for_simd:
1107 case OMPD_parallel_sections:
Carlo Bertolli8429d812017-02-17 21:29:13 +00001108 case OMPD_distribute_parallel_for:
Alexey Bataev974acd62017-11-27 19:38:52 +00001109 case OMPD_distribute_parallel_for_simd:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001110 CaptureRegions.push_back(OMPD_parallel);
1111 break;
Arpith Chacko Jacob86f9e462017-01-25 01:45:59 +00001112 case OMPD_target_teams:
Alexey Bataevdfa430f2017-12-08 15:03:50 +00001113 case OMPD_target_teams_distribute:
Alexey Bataevfbe17fb2017-12-13 19:45:06 +00001114 case OMPD_target_teams_distribute_simd:
Alexey Bataev8451efa2018-01-15 19:06:12 +00001115 CaptureRegions.push_back(OMPD_task);
Arpith Chacko Jacob99a1e0e2017-01-25 02:18:43 +00001116 CaptureRegions.push_back(OMPD_target);
1117 CaptureRegions.push_back(OMPD_teams);
1118 break;
Alexey Bataev2ba67042017-11-28 21:11:44 +00001119 case OMPD_teams:
Carlo Bertolliba1487b2017-10-04 14:12:09 +00001120 case OMPD_teams_distribute:
Alexey Bataev2ba67042017-11-28 21:11:44 +00001121 case OMPD_teams_distribute_simd:
Carlo Bertolliba1487b2017-10-04 14:12:09 +00001122 CaptureRegions.push_back(OMPD_teams);
1123 break;
Alexey Bataev2ba67042017-11-28 21:11:44 +00001124 case OMPD_target:
Alexey Bataevf8365372017-11-17 17:57:25 +00001125 case OMPD_target_simd:
Alexey Bataev8451efa2018-01-15 19:06:12 +00001126 CaptureRegions.push_back(OMPD_task);
Alexey Bataevf8365372017-11-17 17:57:25 +00001127 CaptureRegions.push_back(OMPD_target);
1128 break;
Carlo Bertolli62fae152017-11-20 20:46:39 +00001129 case OMPD_teams_distribute_parallel_for:
Carlo Bertolli56a2aa42017-12-04 20:57:19 +00001130 case OMPD_teams_distribute_parallel_for_simd:
Carlo Bertolli62fae152017-11-20 20:46:39 +00001131 CaptureRegions.push_back(OMPD_teams);
1132 CaptureRegions.push_back(OMPD_parallel);
1133 break;
Alexey Bataev7f96c372017-11-22 17:19:31 +00001134 case OMPD_target_parallel:
1135 case OMPD_target_parallel_for:
1136 case OMPD_target_parallel_for_simd:
Alexey Bataev8451efa2018-01-15 19:06:12 +00001137 CaptureRegions.push_back(OMPD_task);
Alexey Bataev7f96c372017-11-22 17:19:31 +00001138 CaptureRegions.push_back(OMPD_target);
1139 CaptureRegions.push_back(OMPD_parallel);
1140 break;
Alexey Bataev2ba67042017-11-28 21:11:44 +00001141 case OMPD_task:
Alexey Bataev7f96c372017-11-22 17:19:31 +00001142 case OMPD_target_enter_data:
1143 case OMPD_target_exit_data:
1144 case OMPD_target_update:
1145 CaptureRegions.push_back(OMPD_task);
1146 break;
Alexey Bataev2ba67042017-11-28 21:11:44 +00001147 case OMPD_taskloop:
1148 case OMPD_taskloop_simd:
Alexey Bataev60e51c42019-10-10 20:13:02 +00001149 case OMPD_master_taskloop:
Alexey Bataevb8552ab2019-10-18 16:47:35 +00001150 case OMPD_master_taskloop_simd:
Alexey Bataev2ba67042017-11-28 21:11:44 +00001151 CaptureRegions.push_back(OMPD_taskloop);
1152 break;
Alexey Bataev5bbcead2019-10-14 17:17:41 +00001153 case OMPD_parallel_master_taskloop:
Alexey Bataev14a388f2019-10-25 10:27:13 -04001154 case OMPD_parallel_master_taskloop_simd:
Alexey Bataev5bbcead2019-10-14 17:17:41 +00001155 CaptureRegions.push_back(OMPD_parallel);
1156 CaptureRegions.push_back(OMPD_taskloop);
1157 break;
Carlo Bertolli52978c32018-01-03 21:12:44 +00001158 case OMPD_target_teams_distribute_parallel_for:
Alexey Bataev647dd842018-01-15 20:59:40 +00001159 case OMPD_target_teams_distribute_parallel_for_simd:
Alexey Bataev8451efa2018-01-15 19:06:12 +00001160 CaptureRegions.push_back(OMPD_task);
Carlo Bertolli52978c32018-01-03 21:12:44 +00001161 CaptureRegions.push_back(OMPD_target);
1162 CaptureRegions.push_back(OMPD_teams);
1163 CaptureRegions.push_back(OMPD_parallel);
1164 break;
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001165 case OMPD_simd:
1166 case OMPD_for:
1167 case OMPD_for_simd:
1168 case OMPD_sections:
1169 case OMPD_section:
1170 case OMPD_single:
1171 case OMPD_master:
1172 case OMPD_critical:
1173 case OMPD_taskgroup:
1174 case OMPD_distribute:
1175 case OMPD_ordered:
1176 case OMPD_atomic:
1177 case OMPD_target_data:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001178 case OMPD_distribute_simd:
Alexey Bataev2ba67042017-11-28 21:11:44 +00001179 CaptureRegions.push_back(OMPD_unknown);
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001180 break;
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001181 case OMPD_threadprivate:
Alexey Bataev25ed0c02019-03-07 17:54:44 +00001182 case OMPD_allocate:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001183 case OMPD_taskyield:
1184 case OMPD_barrier:
1185 case OMPD_taskwait:
1186 case OMPD_cancellation_point:
1187 case OMPD_cancel:
1188 case OMPD_flush:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001189 case OMPD_declare_reduction:
Michael Kruse251e1482019-02-01 20:25:04 +00001190 case OMPD_declare_mapper:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001191 case OMPD_declare_simd:
1192 case OMPD_declare_target:
1193 case OMPD_end_declare_target:
Kelvin Li1408f912018-09-26 04:28:39 +00001194 case OMPD_requires:
Alexey Bataevd158cf62019-09-13 20:18:17 +00001195 case OMPD_declare_variant:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001196 llvm_unreachable("OpenMP Directive is not allowed");
1197 case OMPD_unknown:
1198 llvm_unreachable("Unknown OpenMP directive");
1199 }
1200}