blob: 51fe587de999989cc027f77d2978f0816b9aa157 [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;
Johannes Doerferteb3e81f2019-11-04 22:00:49 -060021using namespace llvm::omp;
Alexey Bataeva769e072013-03-22 06:34:35 +000022
Alexey Bataevfde11e92019-11-07 11:03:10 -050023OpenMPContextSelectorSetKind
24clang::getOpenMPContextSelectorSet(llvm::StringRef Str) {
25 return llvm::StringSwitch<OpenMPContextSelectorSetKind>(Str)
26#define OPENMP_CONTEXT_SELECTOR_SET(Name) .Case(#Name, OMP_CTX_SET_##Name)
27#include "clang/Basic/OpenMPKinds.def"
28 .Default(OMP_CTX_SET_unknown);
29}
30
31llvm::StringRef
32clang::getOpenMPContextSelectorSetName(OpenMPContextSelectorSetKind Kind) {
33 switch (Kind) {
34 case OMP_CTX_SET_unknown:
35 return "unknown";
36#define OPENMP_CONTEXT_SELECTOR_SET(Name) \
37 case OMP_CTX_SET_##Name: \
38 return #Name;
39#include "clang/Basic/OpenMPKinds.def"
40 break;
41 }
42 llvm_unreachable("Invalid OpenMP context selector set kind");
43}
44
45OpenMPContextSelectorKind clang::getOpenMPContextSelector(llvm::StringRef Str) {
46 return llvm::StringSwitch<OpenMPContextSelectorKind>(Str)
47#define OPENMP_CONTEXT_SELECTOR(Name) .Case(#Name, OMP_CTX_##Name)
48#include "clang/Basic/OpenMPKinds.def"
49 .Default(OMP_CTX_unknown);
50}
51
52llvm::StringRef
53clang::getOpenMPContextSelectorName(OpenMPContextSelectorKind Kind) {
54 switch (Kind) {
55 case OMP_CTX_unknown:
56 return "unknown";
57#define OPENMP_CONTEXT_SELECTOR(Name) \
58 case OMP_CTX_##Name: \
59 return #Name;
60#include "clang/Basic/OpenMPKinds.def"
61 break;
62 }
63 llvm_unreachable("Invalid OpenMP context selector kind");
64}
65
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000066OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) {
Alexey Bataev2b5f3f02014-07-29 09:17:39 +000067 // 'flush' clause cannot be specified explicitly, because this is an implicit
68 // clause for 'flush' directive. If the 'flush' clause is explicitly specified
69 // the Parser should generate a warning about extra tokens at the end of the
70 // directive.
Alexey Bataev6125da92014-07-21 11:26:11 +000071 if (Str == "flush")
72 return OMPC_unknown;
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000073 return llvm::StringSwitch<OpenMPClauseKind>(Str)
Alexey Bataev23b69422014-06-18 07:08:49 +000074#define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name)
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000075#include "clang/Basic/OpenMPKinds.def"
Alexey Bataeve48a5fc2016-04-12 05:28:34 +000076 .Case("uniform", OMPC_uniform)
Alexey Bataev729e2422019-08-23 16:11:14 +000077 .Case("device_type", OMPC_device_type)
Alexey Bataevdba792c2019-09-23 18:13:31 +000078 .Case("match", OMPC_match)
Alexey Bataev23b69422014-06-18 07:08:49 +000079 .Default(OMPC_unknown);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000080}
81
82const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) {
Alexey Bataev4ca40ed2014-05-12 04:23:46 +000083 assert(Kind <= OMPC_unknown);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000084 switch (Kind) {
85 case OMPC_unknown:
86 return "unknown";
Alexey Bataev23b69422014-06-18 07:08:49 +000087#define OPENMP_CLAUSE(Name, Class) \
88 case OMPC_##Name: \
89 return #Name;
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000090#include "clang/Basic/OpenMPKinds.def"
Alexey Bataeve48a5fc2016-04-12 05:28:34 +000091 case OMPC_uniform:
92 return "uniform";
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000093 case OMPC_threadprivate:
94 return "threadprivate or thread local";
Alexey Bataev729e2422019-08-23 16:11:14 +000095 case OMPC_device_type:
96 return "device_type";
Alexey Bataevdba792c2019-09-23 18:13:31 +000097 case OMPC_match:
98 return "match";
Alexey Bataev5ec3eb12013-07-19 03:13:43 +000099 }
100 llvm_unreachable("Invalid OpenMP clause kind");
101}
102
103unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
104 StringRef Str) {
105 switch (Kind) {
106 case OMPC_default:
107 return llvm::StringSwitch<OpenMPDefaultClauseKind>(Str)
Alexey Bataev23b69422014-06-18 07:08:49 +0000108#define OPENMP_DEFAULT_KIND(Name) .Case(#Name, OMPC_DEFAULT_##Name)
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000109#include "clang/Basic/OpenMPKinds.def"
Alexey Bataev23b69422014-06-18 07:08:49 +0000110 .Default(OMPC_DEFAULT_unknown);
Alexey Bataevbcbadb62014-05-06 06:04:14 +0000111 case OMPC_proc_bind:
112 return llvm::StringSwitch<OpenMPProcBindClauseKind>(Str)
Alexey Bataev23b69422014-06-18 07:08:49 +0000113#define OPENMP_PROC_BIND_KIND(Name) .Case(#Name, OMPC_PROC_BIND_##Name)
Alexey Bataevbcbadb62014-05-06 06:04:14 +0000114#include "clang/Basic/OpenMPKinds.def"
Alexey Bataev23b69422014-06-18 07:08:49 +0000115 .Default(OMPC_PROC_BIND_unknown);
Alexey Bataev56dafe82014-06-20 07:16:17 +0000116 case OMPC_schedule:
Alexey Bataev6402bca2015-12-28 07:25:51 +0000117 return llvm::StringSwitch<unsigned>(Str)
118#define OPENMP_SCHEDULE_KIND(Name) \
119 .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
120#define OPENMP_SCHEDULE_MODIFIER(Name) \
121 .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
Alexey Bataev56dafe82014-06-20 07:16:17 +0000122#include "clang/Basic/OpenMPKinds.def"
123 .Default(OMPC_SCHEDULE_unknown);
Alexey Bataev1c2cfbc2015-06-23 14:25:19 +0000124 case OMPC_depend:
125 return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
126#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
127#include "clang/Basic/OpenMPKinds.def"
128 .Default(OMPC_DEPEND_unknown);
Alexey Bataev182227b2015-08-20 10:54:39 +0000129 case OMPC_linear:
130 return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
131#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
132#include "clang/Basic/OpenMPKinds.def"
133 .Default(OMPC_LINEAR_unknown);
Kelvin Li0bff7af2015-11-23 05:32:03 +0000134 case OMPC_map:
Kelvin Lief579432018-12-18 22:18:41 +0000135 return llvm::StringSwitch<unsigned>(Str)
136#define OPENMP_MAP_KIND(Name) \
137 .Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
138#define OPENMP_MAP_MODIFIER_KIND(Name) \
139 .Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
Kelvin Li0bff7af2015-11-23 05:32:03 +0000140#include "clang/Basic/OpenMPKinds.def"
141 .Default(OMPC_MAP_unknown);
Michael Kruse01f670d2019-02-22 22:29:42 +0000142 case OMPC_to:
143 return llvm::StringSwitch<unsigned>(Str)
144#define OPENMP_TO_MODIFIER_KIND(Name) \
145 .Case(#Name, static_cast<unsigned>(OMPC_TO_MODIFIER_##Name))
146#include "clang/Basic/OpenMPKinds.def"
147 .Default(OMPC_TO_MODIFIER_unknown);
Michael Kruse0336c752019-02-25 20:34:15 +0000148 case OMPC_from:
149 return llvm::StringSwitch<unsigned>(Str)
150#define OPENMP_FROM_MODIFIER_KIND(Name) \
151 .Case(#Name, static_cast<unsigned>(OMPC_FROM_MODIFIER_##Name))
152#include "clang/Basic/OpenMPKinds.def"
153 .Default(OMPC_FROM_MODIFIER_unknown);
Carlo Bertollib4adf552016-01-15 18:50:31 +0000154 case OMPC_dist_schedule:
155 return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
156#define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
157#include "clang/Basic/OpenMPKinds.def"
158 .Default(OMPC_DIST_SCHEDULE_unknown);
Arpith Chacko Jacob3cf89042016-01-26 16:37:23 +0000159 case OMPC_defaultmap:
160 return llvm::StringSwitch<unsigned>(Str)
161#define OPENMP_DEFAULTMAP_KIND(Name) \
162 .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
163#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
164 .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
165#include "clang/Basic/OpenMPKinds.def"
166 .Default(OMPC_DEFAULTMAP_unknown);
Patrick Lyster7a2a27c2018-11-02 12:18:11 +0000167 case OMPC_atomic_default_mem_order:
168 return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
169#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
170 .Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
171#include "clang/Basic/OpenMPKinds.def"
172 .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
Alexey Bataev729e2422019-08-23 16:11:14 +0000173 case OMPC_device_type:
174 return llvm::StringSwitch<OpenMPDeviceType>(Str)
175#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
176#include "clang/Basic/OpenMPKinds.def"
177 .Default(OMPC_DEVICE_TYPE_unknown);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000178 case OMPC_unknown:
179 case OMPC_threadprivate:
Alexey Bataevaadd52e2014-02-13 05:29:23 +0000180 case OMPC_if:
Alexey Bataev3778b602014-07-17 07:32:53 +0000181 case OMPC_final:
Alexey Bataev568a8332014-03-06 06:15:19 +0000182 case OMPC_num_threads:
Alexey Bataev62c87d22014-03-21 04:51:18 +0000183 case OMPC_safelen:
Alexey Bataev66b15b52015-08-21 11:14:16 +0000184 case OMPC_simdlen:
Alexey Bataev9cc10fc2019-03-12 18:52:33 +0000185 case OMPC_allocator:
Alexey Bataeve04483e2019-03-27 14:14:31 +0000186 case OMPC_allocate:
Alexander Musman8bd31e62014-05-27 15:12:19 +0000187 case OMPC_collapse:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000188 case OMPC_private:
Alexey Bataevd5af8e42013-10-01 05:32:34 +0000189 case OMPC_firstprivate:
Alexander Musman1bb328c2014-06-04 13:06:39 +0000190 case OMPC_lastprivate:
David Blaikie3e8aa9a2013-09-06 20:58:25 +0000191 case OMPC_shared:
Alexey Bataevc5e02582014-06-16 07:08:35 +0000192 case OMPC_reduction:
Alexey Bataev169d96a2017-07-18 20:17:46 +0000193 case OMPC_task_reduction:
Alexey Bataevfa312f32017-07-21 18:48:21 +0000194 case OMPC_in_reduction:
Alexander Musmanf0d76e72014-05-29 14:36:25 +0000195 case OMPC_aligned:
Alexey Bataevd48bcd82014-03-31 03:36:38 +0000196 case OMPC_copyin:
Alexey Bataevbae9a792014-06-27 10:37:06 +0000197 case OMPC_copyprivate:
Alexey Bataev142e1fc2014-06-20 09:44:06 +0000198 case OMPC_ordered:
Alexey Bataev236070f2014-06-20 11:19:47 +0000199 case OMPC_nowait:
Alexey Bataev7aea99a2014-07-17 12:19:31 +0000200 case OMPC_untied:
Alexey Bataev74ba3a52014-07-17 12:47:03 +0000201 case OMPC_mergeable:
Alexey Bataev6125da92014-07-21 11:26:11 +0000202 case OMPC_flush:
Alexey Bataevf98b00c2014-07-23 02:27:21 +0000203 case OMPC_read:
Alexey Bataevdea47612014-07-23 07:46:59 +0000204 case OMPC_write:
Alexey Bataev67a4f222014-07-23 10:25:33 +0000205 case OMPC_update:
Alexey Bataev459dec02014-07-24 06:46:57 +0000206 case OMPC_capture:
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000207 case OMPC_seq_cst:
Michael Wonge710d542015-08-07 16:16:36 +0000208 case OMPC_device:
Alexey Bataev346265e2015-09-25 10:37:12 +0000209 case OMPC_threads:
Alexey Bataevd14d1e62015-09-28 06:39:35 +0000210 case OMPC_simd:
Kelvin Li099bb8c2015-11-24 20:50:12 +0000211 case OMPC_num_teams:
Kelvin Lia15fb1a2015-11-27 18:47:36 +0000212 case OMPC_thread_limit:
Alexey Bataeva0569352015-12-01 10:17:31 +0000213 case OMPC_priority:
Alexey Bataev1fd4aed2015-12-07 12:52:51 +0000214 case OMPC_grainsize:
Alexey Bataevb825de12015-12-07 10:51:44 +0000215 case OMPC_nogroup:
Alexey Bataev382967a2015-12-08 12:06:20 +0000216 case OMPC_num_tasks:
Alexey Bataev28c75412015-12-15 08:19:24 +0000217 case OMPC_hint:
Alexey Bataeve48a5fc2016-04-12 05:28:34 +0000218 case OMPC_uniform:
Carlo Bertolli2404b172016-07-13 15:37:16 +0000219 case OMPC_use_device_ptr:
Carlo Bertolli70594e92016-07-13 17:16:49 +0000220 case OMPC_is_device_ptr:
Kelvin Li1408f912018-09-26 04:28:39 +0000221 case OMPC_unified_address:
Patrick Lyster4a370b92018-10-01 13:47:43 +0000222 case OMPC_unified_shared_memory:
Patrick Lyster6bdf63b2018-10-03 20:07:58 +0000223 case OMPC_reverse_offload:
Patrick Lyster3fe9e392018-10-11 14:41:10 +0000224 case OMPC_dynamic_allocators:
Alexey Bataevdba792c2019-09-23 18:13:31 +0000225 case OMPC_match:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000226 break;
227 }
228 llvm_unreachable("Invalid OpenMP simple clause kind");
229}
230
231const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
232 unsigned Type) {
233 switch (Kind) {
234 case OMPC_default:
235 switch (Type) {
236 case OMPC_DEFAULT_unknown:
237 return "unknown";
Alexey Bataev23b69422014-06-18 07:08:49 +0000238#define OPENMP_DEFAULT_KIND(Name) \
239 case OMPC_DEFAULT_##Name: \
240 return #Name;
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000241#include "clang/Basic/OpenMPKinds.def"
242 }
243 llvm_unreachable("Invalid OpenMP 'default' clause type");
Alexey Bataevbcbadb62014-05-06 06:04:14 +0000244 case OMPC_proc_bind:
245 switch (Type) {
246 case OMPC_PROC_BIND_unknown:
247 return "unknown";
Alexey Bataev23b69422014-06-18 07:08:49 +0000248#define OPENMP_PROC_BIND_KIND(Name) \
249 case OMPC_PROC_BIND_##Name: \
250 return #Name;
Alexey Bataevbcbadb62014-05-06 06:04:14 +0000251#include "clang/Basic/OpenMPKinds.def"
252 }
253 llvm_unreachable("Invalid OpenMP 'proc_bind' clause type");
Alexey Bataev56dafe82014-06-20 07:16:17 +0000254 case OMPC_schedule:
255 switch (Type) {
256 case OMPC_SCHEDULE_unknown:
Alexey Bataev6402bca2015-12-28 07:25:51 +0000257 case OMPC_SCHEDULE_MODIFIER_last:
Alexey Bataev56dafe82014-06-20 07:16:17 +0000258 return "unknown";
259#define OPENMP_SCHEDULE_KIND(Name) \
Alexey Bataev6402bca2015-12-28 07:25:51 +0000260 case OMPC_SCHEDULE_##Name: \
261 return #Name;
262#define OPENMP_SCHEDULE_MODIFIER(Name) \
263 case OMPC_SCHEDULE_MODIFIER_##Name: \
264 return #Name;
Alexey Bataev56dafe82014-06-20 07:16:17 +0000265#include "clang/Basic/OpenMPKinds.def"
266 }
Alexey Bataev6402bca2015-12-28 07:25:51 +0000267 llvm_unreachable("Invalid OpenMP 'schedule' clause type");
Alexey Bataev1c2cfbc2015-06-23 14:25:19 +0000268 case OMPC_depend:
269 switch (Type) {
270 case OMPC_DEPEND_unknown:
271 return "unknown";
272#define OPENMP_DEPEND_KIND(Name) \
273 case OMPC_DEPEND_##Name: \
274 return #Name;
275#include "clang/Basic/OpenMPKinds.def"
276 }
Alexey Bataev6402bca2015-12-28 07:25:51 +0000277 llvm_unreachable("Invalid OpenMP 'depend' clause type");
Alexey Bataev182227b2015-08-20 10:54:39 +0000278 case OMPC_linear:
279 switch (Type) {
280 case OMPC_LINEAR_unknown:
281 return "unknown";
282#define OPENMP_LINEAR_KIND(Name) \
283 case OMPC_LINEAR_##Name: \
284 return #Name;
285#include "clang/Basic/OpenMPKinds.def"
286 }
287 llvm_unreachable("Invalid OpenMP 'linear' clause type");
Kelvin Li0bff7af2015-11-23 05:32:03 +0000288 case OMPC_map:
289 switch (Type) {
290 case OMPC_MAP_unknown:
Kelvin Lief579432018-12-18 22:18:41 +0000291 case OMPC_MAP_MODIFIER_last:
Kelvin Li0bff7af2015-11-23 05:32:03 +0000292 return "unknown";
293#define OPENMP_MAP_KIND(Name) \
294 case OMPC_MAP_##Name: \
295 return #Name;
Kelvin Lief579432018-12-18 22:18:41 +0000296#define OPENMP_MAP_MODIFIER_KIND(Name) \
297 case OMPC_MAP_MODIFIER_##Name: \
298 return #Name;
Kelvin Li0bff7af2015-11-23 05:32:03 +0000299#include "clang/Basic/OpenMPKinds.def"
300 default:
301 break;
302 }
303 llvm_unreachable("Invalid OpenMP 'map' clause type");
Michael Kruse01f670d2019-02-22 22:29:42 +0000304 case OMPC_to:
305 switch (Type) {
306 case OMPC_TO_MODIFIER_unknown:
307 return "unknown";
308#define OPENMP_TO_MODIFIER_KIND(Name) \
309 case OMPC_TO_MODIFIER_##Name: \
310 return #Name;
311#include "clang/Basic/OpenMPKinds.def"
312 default:
313 break;
314 }
315 llvm_unreachable("Invalid OpenMP 'to' clause type");
Michael Kruse0336c752019-02-25 20:34:15 +0000316 case OMPC_from:
317 switch (Type) {
318 case OMPC_FROM_MODIFIER_unknown:
319 return "unknown";
320#define OPENMP_FROM_MODIFIER_KIND(Name) \
321 case OMPC_FROM_MODIFIER_##Name: \
322 return #Name;
323#include "clang/Basic/OpenMPKinds.def"
324 default:
325 break;
326 }
327 llvm_unreachable("Invalid OpenMP 'from' clause type");
Carlo Bertollib4adf552016-01-15 18:50:31 +0000328 case OMPC_dist_schedule:
329 switch (Type) {
330 case OMPC_DIST_SCHEDULE_unknown:
331 return "unknown";
332#define OPENMP_DIST_SCHEDULE_KIND(Name) \
333 case OMPC_DIST_SCHEDULE_##Name: \
334 return #Name;
335#include "clang/Basic/OpenMPKinds.def"
336 }
337 llvm_unreachable("Invalid OpenMP 'dist_schedule' clause type");
Arpith Chacko Jacob3cf89042016-01-26 16:37:23 +0000338 case OMPC_defaultmap:
339 switch (Type) {
340 case OMPC_DEFAULTMAP_unknown:
341 case OMPC_DEFAULTMAP_MODIFIER_last:
342 return "unknown";
343#define OPENMP_DEFAULTMAP_KIND(Name) \
344 case OMPC_DEFAULTMAP_##Name: \
345 return #Name;
346#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
347 case OMPC_DEFAULTMAP_MODIFIER_##Name: \
348 return #Name;
349#include "clang/Basic/OpenMPKinds.def"
350 }
351 llvm_unreachable("Invalid OpenMP 'schedule' clause type");
Patrick Lyster7a2a27c2018-11-02 12:18:11 +0000352 case OMPC_atomic_default_mem_order:
353 switch (Type) {
354 case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
355 return "unknown";
356#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
357 case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name: \
358 return #Name;
359#include "clang/Basic/OpenMPKinds.def"
360}
361 llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type");
Alexey Bataev729e2422019-08-23 16:11:14 +0000362 case OMPC_device_type:
363 switch (Type) {
364 case OMPC_DEVICE_TYPE_unknown:
365 return "unknown";
366#define OPENMP_DEVICE_TYPE_KIND(Name) \
367 case OMPC_DEVICE_TYPE_##Name: \
368 return #Name;
369#include "clang/Basic/OpenMPKinds.def"
370 }
371 llvm_unreachable("Invalid OpenMP 'device_type' clause type");
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000372 case OMPC_unknown:
373 case OMPC_threadprivate:
Alexey Bataevaadd52e2014-02-13 05:29:23 +0000374 case OMPC_if:
Alexey Bataev3778b602014-07-17 07:32:53 +0000375 case OMPC_final:
Alexey Bataev568a8332014-03-06 06:15:19 +0000376 case OMPC_num_threads:
Alexey Bataev62c87d22014-03-21 04:51:18 +0000377 case OMPC_safelen:
Alexey Bataev66b15b52015-08-21 11:14:16 +0000378 case OMPC_simdlen:
Alexey Bataev9cc10fc2019-03-12 18:52:33 +0000379 case OMPC_allocator:
Alexey Bataeve04483e2019-03-27 14:14:31 +0000380 case OMPC_allocate:
Alexander Musman8bd31e62014-05-27 15:12:19 +0000381 case OMPC_collapse:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000382 case OMPC_private:
Alexey Bataevd5af8e42013-10-01 05:32:34 +0000383 case OMPC_firstprivate:
Alexander Musman1bb328c2014-06-04 13:06:39 +0000384 case OMPC_lastprivate:
David Blaikie3e8aa9a2013-09-06 20:58:25 +0000385 case OMPC_shared:
Alexey Bataevc5e02582014-06-16 07:08:35 +0000386 case OMPC_reduction:
Alexey Bataev169d96a2017-07-18 20:17:46 +0000387 case OMPC_task_reduction:
Alexey Bataevfa312f32017-07-21 18:48:21 +0000388 case OMPC_in_reduction:
Alexander Musmanf0d76e72014-05-29 14:36:25 +0000389 case OMPC_aligned:
Alexey Bataevd48bcd82014-03-31 03:36:38 +0000390 case OMPC_copyin:
Alexey Bataevbae9a792014-06-27 10:37:06 +0000391 case OMPC_copyprivate:
Alexey Bataev142e1fc2014-06-20 09:44:06 +0000392 case OMPC_ordered:
Alexey Bataev236070f2014-06-20 11:19:47 +0000393 case OMPC_nowait:
Alexey Bataev7aea99a2014-07-17 12:19:31 +0000394 case OMPC_untied:
Alexey Bataev74ba3a52014-07-17 12:47:03 +0000395 case OMPC_mergeable:
Alexey Bataev6125da92014-07-21 11:26:11 +0000396 case OMPC_flush:
Alexey Bataevf98b00c2014-07-23 02:27:21 +0000397 case OMPC_read:
Alexey Bataevdea47612014-07-23 07:46:59 +0000398 case OMPC_write:
Alexey Bataev67a4f222014-07-23 10:25:33 +0000399 case OMPC_update:
Alexey Bataev459dec02014-07-24 06:46:57 +0000400 case OMPC_capture:
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000401 case OMPC_seq_cst:
Michael Wonge710d542015-08-07 16:16:36 +0000402 case OMPC_device:
Alexey Bataev346265e2015-09-25 10:37:12 +0000403 case OMPC_threads:
Alexey Bataevd14d1e62015-09-28 06:39:35 +0000404 case OMPC_simd:
Kelvin Li099bb8c2015-11-24 20:50:12 +0000405 case OMPC_num_teams:
Kelvin Lia15fb1a2015-11-27 18:47:36 +0000406 case OMPC_thread_limit:
Alexey Bataeva0569352015-12-01 10:17:31 +0000407 case OMPC_priority:
Alexey Bataev1fd4aed2015-12-07 12:52:51 +0000408 case OMPC_grainsize:
Alexey Bataevb825de12015-12-07 10:51:44 +0000409 case OMPC_nogroup:
Alexey Bataev382967a2015-12-08 12:06:20 +0000410 case OMPC_num_tasks:
Alexey Bataev28c75412015-12-15 08:19:24 +0000411 case OMPC_hint:
Alexey Bataeve48a5fc2016-04-12 05:28:34 +0000412 case OMPC_uniform:
Carlo Bertolli2404b172016-07-13 15:37:16 +0000413 case OMPC_use_device_ptr:
Carlo Bertolli70594e92016-07-13 17:16:49 +0000414 case OMPC_is_device_ptr:
Kelvin Li1408f912018-09-26 04:28:39 +0000415 case OMPC_unified_address:
Patrick Lyster4a370b92018-10-01 13:47:43 +0000416 case OMPC_unified_shared_memory:
Patrick Lyster6bdf63b2018-10-03 20:07:58 +0000417 case OMPC_reverse_offload:
Patrick Lyster3fe9e392018-10-11 14:41:10 +0000418 case OMPC_dynamic_allocators:
Alexey Bataevdba792c2019-09-23 18:13:31 +0000419 case OMPC_match:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000420 break;
421 }
422 llvm_unreachable("Invalid OpenMP simple clause kind");
423}
424
425bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
Alexey Bataevd08c0562019-11-19 12:07:54 -0500426 OpenMPClauseKind CKind,
427 unsigned OpenMPVersion) {
Johannes Doerferteb3e81f2019-11-04 22:00:49 -0600428 assert(unsigned(DKind) <= unsigned(OMPD_unknown));
Alexey Bataev4ca40ed2014-05-12 04:23:46 +0000429 assert(CKind <= OMPC_unknown);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000430 switch (DKind) {
431 case OMPD_parallel:
432 switch (CKind) {
Alexey Bataev23b69422014-06-18 07:08:49 +0000433#define OPENMP_PARALLEL_CLAUSE(Name) \
434 case OMPC_##Name: \
435 return true;
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000436#include "clang/Basic/OpenMPKinds.def"
437 default:
438 break;
439 }
440 break;
Alexey Bataev1b59ab52014-02-27 08:29:12 +0000441 case OMPD_simd:
Alexey Bataevd08c0562019-11-19 12:07:54 -0500442 if (OpenMPVersion < 50 && CKind == OMPC_if)
443 return false;
Alexey Bataev1b59ab52014-02-27 08:29:12 +0000444 switch (CKind) {
Alexey Bataev23b69422014-06-18 07:08:49 +0000445#define OPENMP_SIMD_CLAUSE(Name) \
446 case OMPC_##Name: \
447 return true;
Alexey Bataev1b59ab52014-02-27 08:29:12 +0000448#include "clang/Basic/OpenMPKinds.def"
449 default:
450 break;
451 }
452 break;
Alexey Bataevf29276e2014-06-18 04:14:57 +0000453 case OMPD_for:
454 switch (CKind) {
Alexey Bataev23b69422014-06-18 07:08:49 +0000455#define OPENMP_FOR_CLAUSE(Name) \
456 case OMPC_##Name: \
457 return true;
Alexey Bataevf29276e2014-06-18 04:14:57 +0000458#include "clang/Basic/OpenMPKinds.def"
459 default:
460 break;
461 }
462 break;
Alexander Musmanf82886e2014-09-18 05:12:34 +0000463 case OMPD_for_simd:
Alexey Bataev103f3c9e2019-11-20 15:59:03 -0500464 if (OpenMPVersion < 50 && CKind == OMPC_if)
465 return false;
Alexander Musmanf82886e2014-09-18 05:12:34 +0000466 switch (CKind) {
467#define OPENMP_FOR_SIMD_CLAUSE(Name) \
468 case OMPC_##Name: \
469 return true;
470#include "clang/Basic/OpenMPKinds.def"
471 default:
472 break;
473 }
474 break;
Alexey Bataevd3f8dd22014-06-25 11:44:49 +0000475 case OMPD_sections:
476 switch (CKind) {
Alexey Bataevbae9a792014-06-27 10:37:06 +0000477#define OPENMP_SECTIONS_CLAUSE(Name) \
Alexey Bataevd3f8dd22014-06-25 11:44:49 +0000478 case OMPC_##Name: \
479 return true;
480#include "clang/Basic/OpenMPKinds.def"
481 default:
482 break;
483 }
484 break;
Alexey Bataevd1e40fb2014-06-26 12:05:45 +0000485 case OMPD_single:
486 switch (CKind) {
Alexey Bataevbae9a792014-06-27 10:37:06 +0000487#define OPENMP_SINGLE_CLAUSE(Name) \
Alexey Bataevd1e40fb2014-06-26 12:05:45 +0000488 case OMPC_##Name: \
489 return true;
490#include "clang/Basic/OpenMPKinds.def"
491 default:
492 break;
493 }
494 break;
Alexey Bataev4acb8592014-07-07 13:01:15 +0000495 case OMPD_parallel_for:
496 switch (CKind) {
497#define OPENMP_PARALLEL_FOR_CLAUSE(Name) \
498 case OMPC_##Name: \
499 return true;
500#include "clang/Basic/OpenMPKinds.def"
501 default:
502 break;
503 }
504 break;
Alexander Musmane4e893b2014-09-23 09:33:00 +0000505 case OMPD_parallel_for_simd:
506 switch (CKind) {
507#define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) \
508 case OMPC_##Name: \
509 return true;
510#include "clang/Basic/OpenMPKinds.def"
511 default:
512 break;
513 }
514 break;
cchen47d60942019-12-05 13:43:48 -0500515 case OMPD_parallel_master:
516 switch (CKind) {
517#define OPENMP_PARALLEL_MASTER_CLAUSE(Name) \
518 case OMPC_##Name: \
519 return true;
520#include "clang/Basic/OpenMPKinds.def"
521 default:
522 break;
523 }
524 break;
Alexey Bataev84d0b3e2014-07-08 08:12:03 +0000525 case OMPD_parallel_sections:
526 switch (CKind) {
527#define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) \
528 case OMPC_##Name: \
529 return true;
530#include "clang/Basic/OpenMPKinds.def"
531 default:
532 break;
533 }
534 break;
Alexey Bataev9c2e8ee2014-07-11 11:25:16 +0000535 case OMPD_task:
536 switch (CKind) {
537#define OPENMP_TASK_CLAUSE(Name) \
538 case OMPC_##Name: \
539 return true;
540#include "clang/Basic/OpenMPKinds.def"
541 default:
542 break;
543 }
544 break;
Alexey Bataev6125da92014-07-21 11:26:11 +0000545 case OMPD_flush:
546 return CKind == OMPC_flush;
547 break;
Alexey Bataev0162e452014-07-22 10:10:35 +0000548 case OMPD_atomic:
549 switch (CKind) {
550#define OPENMP_ATOMIC_CLAUSE(Name) \
551 case OMPC_##Name: \
552 return true;
553#include "clang/Basic/OpenMPKinds.def"
554 default:
555 break;
556 }
557 break;
Alexey Bataev0bd520b2014-09-19 08:19:49 +0000558 case OMPD_target:
559 switch (CKind) {
560#define OPENMP_TARGET_CLAUSE(Name) \
561 case OMPC_##Name: \
562 return true;
563#include "clang/Basic/OpenMPKinds.def"
564 default:
565 break;
566 }
567 break;
Kelvin Li1408f912018-09-26 04:28:39 +0000568 case OMPD_requires:
569 switch (CKind) {
570#define OPENMP_REQUIRES_CLAUSE(Name) \
571 case OMPC_##Name: \
572 return true;
573#include "clang/Basic/OpenMPKinds.def"
574 default:
575 break;
576 }
577 break;
Michael Wong65f367f2015-07-21 13:44:28 +0000578 case OMPD_target_data:
579 switch (CKind) {
580#define OPENMP_TARGET_DATA_CLAUSE(Name) \
581 case OMPC_##Name: \
582 return true;
583#include "clang/Basic/OpenMPKinds.def"
584 default:
585 break;
586 }
587 break;
Samuel Antaodf67fc42016-01-19 19:15:56 +0000588 case OMPD_target_enter_data:
589 switch (CKind) {
590#define OPENMP_TARGET_ENTER_DATA_CLAUSE(Name) \
591 case OMPC_##Name: \
592 return true;
593#include "clang/Basic/OpenMPKinds.def"
594 default:
595 break;
596 }
597 break;
Samuel Antao72590762016-01-19 20:04:50 +0000598 case OMPD_target_exit_data:
599 switch (CKind) {
600#define OPENMP_TARGET_EXIT_DATA_CLAUSE(Name) \
601 case OMPC_##Name: \
602 return true;
603#include "clang/Basic/OpenMPKinds.def"
604 default:
605 break;
606 }
607 break;
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000608 case OMPD_target_parallel:
609 switch (CKind) {
610#define OPENMP_TARGET_PARALLEL_CLAUSE(Name) \
611 case OMPC_##Name: \
612 return true;
613#include "clang/Basic/OpenMPKinds.def"
614 default:
615 break;
616 }
617 break;
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000618 case OMPD_target_parallel_for:
619 switch (CKind) {
620#define OPENMP_TARGET_PARALLEL_FOR_CLAUSE(Name) \
621 case OMPC_##Name: \
622 return true;
623#include "clang/Basic/OpenMPKinds.def"
624 default:
625 break;
626 }
627 break;
Samuel Antao686c70c2016-05-26 17:30:50 +0000628 case OMPD_target_update:
629 switch (CKind) {
630#define OPENMP_TARGET_UPDATE_CLAUSE(Name) \
631 case OMPC_##Name: \
632 return true;
633#include "clang/Basic/OpenMPKinds.def"
634 default:
635 break;
636 }
637 break;
Alexey Bataev13314bf2014-10-09 04:18:56 +0000638 case OMPD_teams:
639 switch (CKind) {
640#define OPENMP_TEAMS_CLAUSE(Name) \
641 case OMPC_##Name: \
642 return true;
643#include "clang/Basic/OpenMPKinds.def"
644 default:
645 break;
646 }
647 break;
Alexey Bataev87933c72015-09-18 08:07:34 +0000648 case OMPD_cancel:
649 switch (CKind) {
650#define OPENMP_CANCEL_CLAUSE(Name) \
651 case OMPC_##Name: \
652 return true;
653#include "clang/Basic/OpenMPKinds.def"
654 default:
655 break;
656 }
657 break;
Alexey Bataev346265e2015-09-25 10:37:12 +0000658 case OMPD_ordered:
659 switch (CKind) {
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000660#define OPENMP_ORDERED_CLAUSE(Name) \
Alexey Bataev346265e2015-09-25 10:37:12 +0000661 case OMPC_##Name: \
662 return true;
663#include "clang/Basic/OpenMPKinds.def"
664 default:
665 break;
666 }
667 break;
Alexey Bataev49f6e782015-12-01 04:18:41 +0000668 case OMPD_taskloop:
669 switch (CKind) {
670#define OPENMP_TASKLOOP_CLAUSE(Name) \
671 case OMPC_##Name: \
672 return true;
673#include "clang/Basic/OpenMPKinds.def"
674 default:
675 break;
676 }
677 break;
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000678 case OMPD_taskloop_simd:
679 switch (CKind) {
680#define OPENMP_TASKLOOP_SIMD_CLAUSE(Name) \
681 case OMPC_##Name: \
682 return true;
683#include "clang/Basic/OpenMPKinds.def"
684 default:
685 break;
686 }
687 break;
Alexey Bataev60e51c42019-10-10 20:13:02 +0000688 case OMPD_master_taskloop:
689 switch (CKind) {
690#define OPENMP_MASTER_TASKLOOP_CLAUSE(Name) \
691 case OMPC_##Name: \
692 return true;
693#include "clang/Basic/OpenMPKinds.def"
694 default:
695 break;
696 }
697 break;
Alexey Bataevb8552ab2019-10-18 16:47:35 +0000698 case OMPD_master_taskloop_simd:
699 switch (CKind) {
700#define OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(Name) \
701 case OMPC_##Name: \
702 return true;
703#include "clang/Basic/OpenMPKinds.def"
704 default:
705 break;
706 }
707 break;
Alexey Bataev5bbcead2019-10-14 17:17:41 +0000708 case OMPD_parallel_master_taskloop:
709 switch (CKind) {
710#define OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(Name) \
711 case OMPC_##Name: \
712 return true;
713#include "clang/Basic/OpenMPKinds.def"
714 default:
715 break;
716 }
717 break;
Alexey Bataev14a388f2019-10-25 10:27:13 -0400718 case OMPD_parallel_master_taskloop_simd:
719 switch (CKind) {
720#define OPENMP_PARALLEL_MASTER_TASKLOOP_SIMD_CLAUSE(Name) \
721 case OMPC_##Name: \
722 return true;
723#include "clang/Basic/OpenMPKinds.def"
724 default:
725 break;
726 }
727 break;
Alexey Bataev28c75412015-12-15 08:19:24 +0000728 case OMPD_critical:
729 switch (CKind) {
730#define OPENMP_CRITICAL_CLAUSE(Name) \
731 case OMPC_##Name: \
732 return true;
733#include "clang/Basic/OpenMPKinds.def"
734 default:
735 break;
736 }
737 break;
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000738 case OMPD_distribute:
739 switch (CKind) {
740#define OPENMP_DISTRIBUTE_CLAUSE(Name) \
741 case OMPC_##Name: \
742 return true;
743#include "clang/Basic/OpenMPKinds.def"
744 default:
745 break;
746 }
747 break;
Carlo Bertolli9925f152016-06-27 14:55:37 +0000748 case OMPD_distribute_parallel_for:
749 switch (CKind) {
750#define OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
751 case OMPC_##Name: \
752 return true;
753#include "clang/Basic/OpenMPKinds.def"
754 default:
755 break;
756 }
757 break;
Kelvin Li4a39add2016-07-05 05:00:15 +0000758 case OMPD_distribute_parallel_for_simd:
759 switch (CKind) {
760#define OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
761 case OMPC_##Name: \
762 return true;
763#include "clang/Basic/OpenMPKinds.def"
764 default:
765 break;
766 }
767 break;
Kelvin Li787f3fc2016-07-06 04:45:38 +0000768 case OMPD_distribute_simd:
Alexey Bataev779a1802019-12-06 12:21:31 -0500769 if (OpenMPVersion < 50 && CKind == OMPC_if)
770 return false;
Kelvin Li787f3fc2016-07-06 04:45:38 +0000771 switch (CKind) {
772#define OPENMP_DISTRIBUTE_SIMD_CLAUSE(Name) \
773 case OMPC_##Name: \
774 return true;
775#include "clang/Basic/OpenMPKinds.def"
776 default:
777 break;
778 }
779 break;
Kelvin Lia579b912016-07-14 02:54:56 +0000780 case OMPD_target_parallel_for_simd:
781 switch (CKind) {
782#define OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(Name) \
783 case OMPC_##Name: \
784 return true;
785#include "clang/Basic/OpenMPKinds.def"
786 default:
787 break;
788 }
789 break;
Kelvin Li986330c2016-07-20 22:57:10 +0000790 case OMPD_target_simd:
791 switch (CKind) {
792#define OPENMP_TARGET_SIMD_CLAUSE(Name) \
793 case OMPC_##Name: \
794 return true;
795#include "clang/Basic/OpenMPKinds.def"
796 default:
797 break;
798 }
799 break;
Kelvin Li02532872016-08-05 14:37:37 +0000800 case OMPD_teams_distribute:
801 switch (CKind) {
802#define OPENMP_TEAMS_DISTRIBUTE_CLAUSE(Name) \
803 case OMPC_##Name: \
804 return true;
805#include "clang/Basic/OpenMPKinds.def"
806 default:
807 break;
808 }
809 break;
Kelvin Li4e325f72016-10-25 12:50:55 +0000810 case OMPD_teams_distribute_simd:
811 switch (CKind) {
812#define OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \
813 case OMPC_##Name: \
814 return true;
815#include "clang/Basic/OpenMPKinds.def"
816 default:
817 break;
818 }
819 break;
Kelvin Li579e41c2016-11-30 23:51:03 +0000820 case OMPD_teams_distribute_parallel_for_simd:
821 switch (CKind) {
822#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
823 case OMPC_##Name: \
824 return true;
825#include "clang/Basic/OpenMPKinds.def"
826 default:
827 break;
828 }
829 break;
Kelvin Li7ade93f2016-12-09 03:24:30 +0000830 case OMPD_teams_distribute_parallel_for:
831 switch (CKind) {
832#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
833 case OMPC_##Name: \
834 return true;
835#include "clang/Basic/OpenMPKinds.def"
836 default:
837 break;
838 }
839 break;
Kelvin Libf594a52016-12-17 05:48:59 +0000840 case OMPD_target_teams:
841 switch (CKind) {
842#define OPENMP_TARGET_TEAMS_CLAUSE(Name) \
843 case OMPC_##Name: \
844 return true;
845#include "clang/Basic/OpenMPKinds.def"
846 default:
847 break;
848 }
849 break;
Kelvin Li83c451e2016-12-25 04:52:54 +0000850 case OMPD_target_teams_distribute:
851 switch (CKind) {
852#define OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(Name) \
853 case OMPC_##Name: \
854 return true;
855#include "clang/Basic/OpenMPKinds.def"
856 default:
857 break;
858 }
859 break;
Kelvin Li80e8f562016-12-29 22:16:30 +0000860 case OMPD_target_teams_distribute_parallel_for:
861 switch (CKind) {
862#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
863 case OMPC_##Name: \
864 return true;
865#include "clang/Basic/OpenMPKinds.def"
866 default:
867 break;
868 }
869 break;
Kelvin Li1851df52017-01-03 05:23:48 +0000870 case OMPD_target_teams_distribute_parallel_for_simd:
871 switch (CKind) {
872#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
873 case OMPC_##Name: \
874 return true;
875#include "clang/Basic/OpenMPKinds.def"
876 default:
877 break;
878 }
879 break;
Kelvin Lida681182017-01-10 18:08:18 +0000880 case OMPD_target_teams_distribute_simd:
881 switch (CKind) {
882#define OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \
883 case OMPC_##Name: \
884 return true;
885#include "clang/Basic/OpenMPKinds.def"
886 default:
887 break;
888 }
889 break;
Alexey Bataev169d96a2017-07-18 20:17:46 +0000890 case OMPD_taskgroup:
891 switch (CKind) {
892#define OPENMP_TASKGROUP_CLAUSE(Name) \
893 case OMPC_##Name: \
894 return true;
895#include "clang/Basic/OpenMPKinds.def"
896 default:
897 break;
898 }
899 break;
Michael Kruse251e1482019-02-01 20:25:04 +0000900 case OMPD_declare_mapper:
901 switch (CKind) {
902#define OPENMP_DECLARE_MAPPER_CLAUSE(Name) \
903 case OMPC_##Name: \
904 return true;
905#include "clang/Basic/OpenMPKinds.def"
906 default:
907 break;
908 }
909 break;
Alexey Bataev9cc10fc2019-03-12 18:52:33 +0000910 case OMPD_allocate:
911 switch (CKind) {
912#define OPENMP_ALLOCATE_CLAUSE(Name) \
913 case OMPC_##Name: \
914 return true;
915#include "clang/Basic/OpenMPKinds.def"
916 default:
917 break;
918 }
919 break;
Alexey Bataevdba792c2019-09-23 18:13:31 +0000920 case OMPD_declare_variant:
921 switch (CKind) {
922#define OPENMP_DECLARE_VARIANT_CLAUSE(Name) \
923 case OMPC_##Name: \
924 return true;
925#include "clang/Basic/OpenMPKinds.def"
926 default:
927 break;
928 }
929 break;
Dmitry Polukhin0b0da292016-04-06 11:38:59 +0000930 case OMPD_declare_target:
931 case OMPD_end_declare_target:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000932 case OMPD_unknown:
933 case OMPD_threadprivate:
Alexey Bataev1e0498a2014-06-26 08:21:58 +0000934 case OMPD_section:
Alexander Musman80c22892014-07-17 08:54:58 +0000935 case OMPD_master:
Alexey Bataev68446b72014-07-18 07:47:19 +0000936 case OMPD_taskyield:
Alexey Bataev4d1dfea2014-07-18 09:11:51 +0000937 case OMPD_barrier:
Alexey Bataev2df347a2014-07-18 10:17:07 +0000938 case OMPD_taskwait:
Alexey Bataev6d4ed052015-07-01 06:57:41 +0000939 case OMPD_cancellation_point:
Alexey Bataev94a4f0c2016-03-03 05:21:39 +0000940 case OMPD_declare_reduction:
Alexey Bataevd158cf62019-09-13 20:18:17 +0000941 case OMPD_declare_simd:
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000942 break;
943 }
944 return false;
945}
Alexey Bataevf29276e2014-06-18 04:14:57 +0000946
947bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
Alexander Musmane4e893b2014-09-23 09:33:00 +0000948 return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
Alexey Bataev49f6e782015-12-01 04:18:41 +0000949 DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000950 DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
Alexey Bataevb8552ab2019-10-18 16:47:35 +0000951 DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
Alexey Bataev14a388f2019-10-25 10:27:13 -0400952 DKind == OMPD_parallel_master_taskloop ||
953 DKind == OMPD_parallel_master_taskloop_simd ||
954 DKind == OMPD_distribute || DKind == OMPD_target_parallel_for ||
Kelvin Li4a39add2016-07-05 05:00:15 +0000955 DKind == OMPD_distribute_parallel_for ||
Kelvin Li787f3fc2016-07-06 04:45:38 +0000956 DKind == OMPD_distribute_parallel_for_simd ||
Kelvin Lia579b912016-07-14 02:54:56 +0000957 DKind == OMPD_distribute_simd ||
Kelvin Li02532872016-08-05 14:37:37 +0000958 DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
Kelvin Li579e41c2016-11-30 23:51:03 +0000959 DKind == OMPD_teams_distribute ||
960 DKind == OMPD_teams_distribute_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +0000961 DKind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li83c451e2016-12-25 04:52:54 +0000962 DKind == OMPD_teams_distribute_parallel_for ||
Kelvin Li80e8f562016-12-29 22:16:30 +0000963 DKind == OMPD_target_teams_distribute ||
Kelvin Li1851df52017-01-03 05:23:48 +0000964 DKind == OMPD_target_teams_distribute_parallel_for ||
Kelvin Lida681182017-01-10 18:08:18 +0000965 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
966 DKind == OMPD_target_teams_distribute_simd;
Alexey Bataevf29276e2014-06-18 04:14:57 +0000967}
968
969bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
Alexander Musmane4e893b2014-09-23 09:33:00 +0000970 return DKind == OMPD_for || DKind == OMPD_for_simd ||
971 DKind == OMPD_sections || DKind == OMPD_section ||
Alexey Bataev84d0b3e2014-07-08 08:12:03 +0000972 DKind == OMPD_single || DKind == OMPD_parallel_for ||
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000973 DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
Carlo Bertolli9925f152016-06-27 14:55:37 +0000974 DKind == OMPD_target_parallel_for ||
Kelvin Li4a39add2016-07-05 05:00:15 +0000975 DKind == OMPD_distribute_parallel_for ||
Kelvin Lia579b912016-07-14 02:54:56 +0000976 DKind == OMPD_distribute_parallel_for_simd ||
Kelvin Li579e41c2016-11-30 23:51:03 +0000977 DKind == OMPD_target_parallel_for_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +0000978 DKind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li80e8f562016-12-29 22:16:30 +0000979 DKind == OMPD_teams_distribute_parallel_for ||
Kelvin Li1851df52017-01-03 05:23:48 +0000980 DKind == OMPD_target_teams_distribute_parallel_for ||
981 DKind == OMPD_target_teams_distribute_parallel_for_simd;
Alexey Bataevf29276e2014-06-18 04:14:57 +0000982}
983
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000984bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
Alexey Bataev60e51c42019-10-10 20:13:02 +0000985 return DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
Alexey Bataevb8552ab2019-10-18 16:47:35 +0000986 DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
Alexey Bataev14a388f2019-10-25 10:27:13 -0400987 DKind == OMPD_parallel_master_taskloop ||
988 DKind == OMPD_parallel_master_taskloop_simd;
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000989}
990
Alexey Bataevf29276e2014-06-18 04:14:57 +0000991bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
Alexey Bataev84d0b3e2014-07-08 08:12:03 +0000992 return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000993 DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
Carlo Bertolli9925f152016-06-27 14:55:37 +0000994 DKind == OMPD_target_parallel || DKind == OMPD_target_parallel_for ||
Kelvin Li4a39add2016-07-05 05:00:15 +0000995 DKind == OMPD_distribute_parallel_for ||
Kelvin Lia579b912016-07-14 02:54:56 +0000996 DKind == OMPD_distribute_parallel_for_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +0000997 DKind == OMPD_target_parallel_for_simd ||
998 DKind == OMPD_teams_distribute_parallel_for ||
Kelvin Li80e8f562016-12-29 22:16:30 +0000999 DKind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li1851df52017-01-03 05:23:48 +00001000 DKind == OMPD_target_teams_distribute_parallel_for ||
Alexey Bataev5bbcead2019-10-14 17:17:41 +00001001 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
cchen47d60942019-12-05 13:43:48 -05001002 DKind == OMPD_parallel_master ||
Alexey Bataev14a388f2019-10-25 10:27:13 -04001003 DKind == OMPD_parallel_master_taskloop ||
1004 DKind == OMPD_parallel_master_taskloop_simd;
Alexey Bataevf29276e2014-06-18 04:14:57 +00001005}
1006
Arpith Chacko Jacob3d58f262016-02-02 04:00:47 +00001007bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +00001008 return DKind == OMPD_target || DKind == OMPD_target_parallel ||
Alexey Bataev5d7edca2017-11-09 17:32:15 +00001009 DKind == OMPD_target_parallel_for ||
Kelvin Libf594a52016-12-17 05:48:59 +00001010 DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
Kelvin Li80e8f562016-12-29 22:16:30 +00001011 DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
Kelvin Li1851df52017-01-03 05:23:48 +00001012 DKind == OMPD_target_teams_distribute_parallel_for ||
Kelvin Lida681182017-01-10 18:08:18 +00001013 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
1014 DKind == OMPD_target_teams_distribute_simd;
Arpith Chacko Jacob3d58f262016-02-02 04:00:47 +00001015}
1016
1017bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
Arpith Chacko Jacob3d58f262016-02-02 04:00:47 +00001018 return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
Samuel Antao686c70c2016-05-26 17:30:50 +00001019 DKind == OMPD_target_exit_data || DKind == OMPD_target_update;
Samuel Antao4be30e92015-10-02 17:14:03 +00001020}
1021
Kelvin Libf594a52016-12-17 05:48:59 +00001022bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
Kelvin Li4e325f72016-10-25 12:50:55 +00001023 return DKind == OMPD_teams || DKind == OMPD_teams_distribute ||
Kelvin Li579e41c2016-11-30 23:51:03 +00001024 DKind == OMPD_teams_distribute_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +00001025 DKind == OMPD_teams_distribute_parallel_for_simd ||
1026 DKind == OMPD_teams_distribute_parallel_for;
Kelvin Libf594a52016-12-17 05:48:59 +00001027}
1028
1029bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
1030 return isOpenMPNestingTeamsDirective(DKind) ||
Kelvin Li80e8f562016-12-29 22:16:30 +00001031 DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
Kelvin Li1851df52017-01-03 05:23:48 +00001032 DKind == OMPD_target_teams_distribute_parallel_for ||
Kelvin Lida681182017-01-10 18:08:18 +00001033 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
1034 DKind == OMPD_target_teams_distribute_simd;
Alexey Bataev13314bf2014-10-09 04:18:56 +00001035}
1036
Alexey Bataevf29276e2014-06-18 04:14:57 +00001037bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
Alexander Musmane4e893b2014-09-23 09:33:00 +00001038 return DKind == OMPD_simd || DKind == OMPD_for_simd ||
Kelvin Li4a39add2016-07-05 05:00:15 +00001039 DKind == OMPD_parallel_for_simd || DKind == OMPD_taskloop_simd ||
Alexey Bataevb8552ab2019-10-18 16:47:35 +00001040 DKind == OMPD_master_taskloop_simd ||
Alexey Bataev14a388f2019-10-25 10:27:13 -04001041 DKind == OMPD_parallel_master_taskloop_simd ||
Kelvin Li787f3fc2016-07-06 04:45:38 +00001042 DKind == OMPD_distribute_parallel_for_simd ||
Kelvin Li4e325f72016-10-25 12:50:55 +00001043 DKind == OMPD_distribute_simd || DKind == OMPD_target_simd ||
Kelvin Li579e41c2016-11-30 23:51:03 +00001044 DKind == OMPD_teams_distribute_simd ||
Kelvin Li1851df52017-01-03 05:23:48 +00001045 DKind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Lida681182017-01-10 18:08:18 +00001046 DKind == OMPD_target_teams_distribute_parallel_for_simd ||
Alexey Bataev9a5e64f2017-11-09 17:01:35 +00001047 DKind == OMPD_target_teams_distribute_simd ||
1048 DKind == OMPD_target_parallel_for_simd;
Alexey Bataevf29276e2014-06-18 04:14:57 +00001049}
1050
Kelvin Li02532872016-08-05 14:37:37 +00001051bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
Kelvin Li4a39add2016-07-05 05:00:15 +00001052 return Kind == OMPD_distribute || Kind == OMPD_distribute_parallel_for ||
Kelvin Li787f3fc2016-07-06 04:45:38 +00001053 Kind == OMPD_distribute_parallel_for_simd ||
1054 Kind == OMPD_distribute_simd;
Kelvin Li4a39add2016-07-05 05:00:15 +00001055 // TODO add next directives.
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001056}
1057
Kelvin Li02532872016-08-05 14:37:37 +00001058bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
1059 return isOpenMPNestingDistributeDirective(Kind) ||
Kelvin Li579e41c2016-11-30 23:51:03 +00001060 Kind == OMPD_teams_distribute || Kind == OMPD_teams_distribute_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +00001061 Kind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li83c451e2016-12-25 04:52:54 +00001062 Kind == OMPD_teams_distribute_parallel_for ||
Kelvin Li80e8f562016-12-29 22:16:30 +00001063 Kind == OMPD_target_teams_distribute ||
Kelvin Li1851df52017-01-03 05:23:48 +00001064 Kind == OMPD_target_teams_distribute_parallel_for ||
Kelvin Lida681182017-01-10 18:08:18 +00001065 Kind == OMPD_target_teams_distribute_parallel_for_simd ||
1066 Kind == OMPD_target_teams_distribute_simd;
Kelvin Li02532872016-08-05 14:37:37 +00001067}
1068
Alexey Bataevf29276e2014-06-18 04:14:57 +00001069bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
1070 return Kind == OMPC_private || Kind == OMPC_firstprivate ||
1071 Kind == OMPC_lastprivate || Kind == OMPC_linear ||
Alexey Bataevfa312f32017-07-21 18:48:21 +00001072 Kind == OMPC_reduction || Kind == OMPC_task_reduction ||
1073 Kind == OMPC_in_reduction; // TODO add next clauses like 'reduction'.
Alexey Bataevf29276e2014-06-18 04:14:57 +00001074}
1075
1076bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
Alexey Bataevf56f98c2015-04-16 05:39:01 +00001077 return Kind == OMPC_threadprivate || Kind == OMPC_copyin;
Alexey Bataevf29276e2014-06-18 04:14:57 +00001078}
1079
Alexey Bataev35aaee62016-04-13 13:36:48 +00001080bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
1081 return Kind == OMPD_task || isOpenMPTaskLoopDirective(Kind);
1082}
Carlo Bertolli9925f152016-06-27 14:55:37 +00001083
1084bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
Kelvin Li4a39add2016-07-05 05:00:15 +00001085 return Kind == OMPD_distribute_parallel_for ||
Kelvin Li787f3fc2016-07-06 04:45:38 +00001086 Kind == OMPD_distribute_parallel_for_simd ||
Kelvin Li7ade93f2016-12-09 03:24:30 +00001087 Kind == OMPD_teams_distribute_parallel_for_simd ||
Kelvin Li83c451e2016-12-25 04:52:54 +00001088 Kind == OMPD_teams_distribute_parallel_for ||
Kelvin Li1851df52017-01-03 05:23:48 +00001089 Kind == OMPD_target_teams_distribute_parallel_for ||
Carlo Bertolliffafe102017-04-20 00:39:39 +00001090 Kind == OMPD_target_teams_distribute_parallel_for_simd;
Carlo Bertolli9925f152016-06-27 14:55:37 +00001091}
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001092
1093void clang::getOpenMPCaptureRegions(
1094 SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
1095 OpenMPDirectiveKind DKind) {
1096 assert(DKind <= OMPD_unknown);
1097 switch (DKind) {
1098 case OMPD_parallel:
1099 case OMPD_parallel_for:
1100 case OMPD_parallel_for_simd:
cchen47d60942019-12-05 13:43:48 -05001101 case OMPD_parallel_master:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001102 case OMPD_parallel_sections:
Carlo Bertolli8429d812017-02-17 21:29:13 +00001103 case OMPD_distribute_parallel_for:
Alexey Bataev974acd62017-11-27 19:38:52 +00001104 case OMPD_distribute_parallel_for_simd:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001105 CaptureRegions.push_back(OMPD_parallel);
1106 break;
Arpith Chacko Jacob86f9e462017-01-25 01:45:59 +00001107 case OMPD_target_teams:
Alexey Bataevdfa430f2017-12-08 15:03:50 +00001108 case OMPD_target_teams_distribute:
Alexey Bataevfbe17fb2017-12-13 19:45:06 +00001109 case OMPD_target_teams_distribute_simd:
Alexey Bataev8451efa2018-01-15 19:06:12 +00001110 CaptureRegions.push_back(OMPD_task);
Arpith Chacko Jacob99a1e0e2017-01-25 02:18:43 +00001111 CaptureRegions.push_back(OMPD_target);
1112 CaptureRegions.push_back(OMPD_teams);
1113 break;
Alexey Bataev2ba67042017-11-28 21:11:44 +00001114 case OMPD_teams:
Carlo Bertolliba1487b2017-10-04 14:12:09 +00001115 case OMPD_teams_distribute:
Alexey Bataev2ba67042017-11-28 21:11:44 +00001116 case OMPD_teams_distribute_simd:
Carlo Bertolliba1487b2017-10-04 14:12:09 +00001117 CaptureRegions.push_back(OMPD_teams);
1118 break;
Alexey Bataev2ba67042017-11-28 21:11:44 +00001119 case OMPD_target:
Alexey Bataevf8365372017-11-17 17:57:25 +00001120 case OMPD_target_simd:
Alexey Bataev8451efa2018-01-15 19:06:12 +00001121 CaptureRegions.push_back(OMPD_task);
Alexey Bataevf8365372017-11-17 17:57:25 +00001122 CaptureRegions.push_back(OMPD_target);
1123 break;
Carlo Bertolli62fae152017-11-20 20:46:39 +00001124 case OMPD_teams_distribute_parallel_for:
Carlo Bertolli56a2aa42017-12-04 20:57:19 +00001125 case OMPD_teams_distribute_parallel_for_simd:
Carlo Bertolli62fae152017-11-20 20:46:39 +00001126 CaptureRegions.push_back(OMPD_teams);
1127 CaptureRegions.push_back(OMPD_parallel);
1128 break;
Alexey Bataev7f96c372017-11-22 17:19:31 +00001129 case OMPD_target_parallel:
1130 case OMPD_target_parallel_for:
1131 case OMPD_target_parallel_for_simd:
Alexey Bataev8451efa2018-01-15 19:06:12 +00001132 CaptureRegions.push_back(OMPD_task);
Alexey Bataev7f96c372017-11-22 17:19:31 +00001133 CaptureRegions.push_back(OMPD_target);
1134 CaptureRegions.push_back(OMPD_parallel);
1135 break;
Alexey Bataev2ba67042017-11-28 21:11:44 +00001136 case OMPD_task:
Alexey Bataev7f96c372017-11-22 17:19:31 +00001137 case OMPD_target_enter_data:
1138 case OMPD_target_exit_data:
1139 case OMPD_target_update:
1140 CaptureRegions.push_back(OMPD_task);
1141 break;
Alexey Bataev2ba67042017-11-28 21:11:44 +00001142 case OMPD_taskloop:
1143 case OMPD_taskloop_simd:
Alexey Bataev60e51c42019-10-10 20:13:02 +00001144 case OMPD_master_taskloop:
Alexey Bataevb8552ab2019-10-18 16:47:35 +00001145 case OMPD_master_taskloop_simd:
Alexey Bataev2ba67042017-11-28 21:11:44 +00001146 CaptureRegions.push_back(OMPD_taskloop);
1147 break;
Alexey Bataev5bbcead2019-10-14 17:17:41 +00001148 case OMPD_parallel_master_taskloop:
Alexey Bataev14a388f2019-10-25 10:27:13 -04001149 case OMPD_parallel_master_taskloop_simd:
Alexey Bataev5bbcead2019-10-14 17:17:41 +00001150 CaptureRegions.push_back(OMPD_parallel);
1151 CaptureRegions.push_back(OMPD_taskloop);
1152 break;
Carlo Bertolli52978c32018-01-03 21:12:44 +00001153 case OMPD_target_teams_distribute_parallel_for:
Alexey Bataev647dd842018-01-15 20:59:40 +00001154 case OMPD_target_teams_distribute_parallel_for_simd:
Alexey Bataev8451efa2018-01-15 19:06:12 +00001155 CaptureRegions.push_back(OMPD_task);
Carlo Bertolli52978c32018-01-03 21:12:44 +00001156 CaptureRegions.push_back(OMPD_target);
1157 CaptureRegions.push_back(OMPD_teams);
1158 CaptureRegions.push_back(OMPD_parallel);
1159 break;
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001160 case OMPD_simd:
1161 case OMPD_for:
1162 case OMPD_for_simd:
1163 case OMPD_sections:
1164 case OMPD_section:
1165 case OMPD_single:
1166 case OMPD_master:
1167 case OMPD_critical:
1168 case OMPD_taskgroup:
1169 case OMPD_distribute:
1170 case OMPD_ordered:
1171 case OMPD_atomic:
1172 case OMPD_target_data:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001173 case OMPD_distribute_simd:
Alexey Bataev2ba67042017-11-28 21:11:44 +00001174 CaptureRegions.push_back(OMPD_unknown);
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001175 break;
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001176 case OMPD_threadprivate:
Alexey Bataev25ed0c02019-03-07 17:54:44 +00001177 case OMPD_allocate:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001178 case OMPD_taskyield:
1179 case OMPD_barrier:
1180 case OMPD_taskwait:
1181 case OMPD_cancellation_point:
1182 case OMPD_cancel:
1183 case OMPD_flush:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001184 case OMPD_declare_reduction:
Michael Kruse251e1482019-02-01 20:25:04 +00001185 case OMPD_declare_mapper:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001186 case OMPD_declare_simd:
1187 case OMPD_declare_target:
1188 case OMPD_end_declare_target:
Kelvin Li1408f912018-09-26 04:28:39 +00001189 case OMPD_requires:
Alexey Bataevd158cf62019-09-13 20:18:17 +00001190 case OMPD_declare_variant:
Arpith Chacko Jacob19b911c2017-01-18 18:18:53 +00001191 llvm_unreachable("OpenMP Directive is not allowed");
1192 case OMPD_unknown:
1193 llvm_unreachable("Unknown OpenMP directive");
1194 }
1195}