1f4a2713aSLionel Sambuc //===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
2f4a2713aSLionel Sambuc //
3f4a2713aSLionel Sambuc // The LLVM Compiler Infrastructure
4f4a2713aSLionel Sambuc //
5f4a2713aSLionel Sambuc // This file is distributed under the University of Illinois Open Source
6f4a2713aSLionel Sambuc // License. See LICENSE.TXT for details.
7f4a2713aSLionel Sambuc //
8f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
9f4a2713aSLionel Sambuc /// \file
10f4a2713aSLionel Sambuc /// \brief This file implements the OpenMP enum and support functions.
11f4a2713aSLionel Sambuc ///
12f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
13f4a2713aSLionel Sambuc
14f4a2713aSLionel Sambuc #include "clang/Basic/OpenMPKinds.h"
15f4a2713aSLionel Sambuc #include "clang/Basic/IdentifierTable.h"
16f4a2713aSLionel Sambuc #include "llvm/ADT/StringRef.h"
17f4a2713aSLionel Sambuc #include "llvm/ADT/StringSwitch.h"
18f4a2713aSLionel Sambuc #include "llvm/Support/ErrorHandling.h"
19f4a2713aSLionel Sambuc #include <cassert>
20f4a2713aSLionel Sambuc
21f4a2713aSLionel Sambuc using namespace clang;
22f4a2713aSLionel Sambuc
getOpenMPDirectiveKind(StringRef Str)23f4a2713aSLionel Sambuc OpenMPDirectiveKind clang::getOpenMPDirectiveKind(StringRef Str) {
24f4a2713aSLionel Sambuc return llvm::StringSwitch<OpenMPDirectiveKind>(Str)
25*0a6a1f1dSLionel Sambuc #define OPENMP_DIRECTIVE(Name) .Case(#Name, OMPD_##Name)
26*0a6a1f1dSLionel Sambuc #define OPENMP_DIRECTIVE_EXT(Name, Str) .Case(Str, OMPD_##Name)
27f4a2713aSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
28f4a2713aSLionel Sambuc .Default(OMPD_unknown);
29f4a2713aSLionel Sambuc }
30f4a2713aSLionel Sambuc
getOpenMPDirectiveName(OpenMPDirectiveKind Kind)31f4a2713aSLionel Sambuc const char *clang::getOpenMPDirectiveName(OpenMPDirectiveKind Kind) {
32*0a6a1f1dSLionel Sambuc assert(Kind <= OMPD_unknown);
33f4a2713aSLionel Sambuc switch (Kind) {
34f4a2713aSLionel Sambuc case OMPD_unknown:
35f4a2713aSLionel Sambuc return "unknown";
36f4a2713aSLionel Sambuc #define OPENMP_DIRECTIVE(Name) \
37*0a6a1f1dSLionel Sambuc case OMPD_##Name: \
38*0a6a1f1dSLionel Sambuc return #Name;
39*0a6a1f1dSLionel Sambuc #define OPENMP_DIRECTIVE_EXT(Name, Str) \
40*0a6a1f1dSLionel Sambuc case OMPD_##Name: \
41*0a6a1f1dSLionel Sambuc return Str;
42f4a2713aSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
43f4a2713aSLionel Sambuc break;
44f4a2713aSLionel Sambuc }
45f4a2713aSLionel Sambuc llvm_unreachable("Invalid OpenMP directive kind");
46f4a2713aSLionel Sambuc }
47f4a2713aSLionel Sambuc
getOpenMPClauseKind(StringRef Str)48f4a2713aSLionel Sambuc OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) {
49*0a6a1f1dSLionel Sambuc // 'flush' clause cannot be specified explicitly, because this is an implicit
50*0a6a1f1dSLionel Sambuc // clause for 'flush' directive. If the 'flush' clause is explicitly specified
51*0a6a1f1dSLionel Sambuc // the Parser should generate a warning about extra tokens at the end of the
52*0a6a1f1dSLionel Sambuc // directive.
53*0a6a1f1dSLionel Sambuc if (Str == "flush")
54*0a6a1f1dSLionel Sambuc return OMPC_unknown;
55f4a2713aSLionel Sambuc return llvm::StringSwitch<OpenMPClauseKind>(Str)
56*0a6a1f1dSLionel Sambuc #define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name)
57f4a2713aSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
58f4a2713aSLionel Sambuc .Default(OMPC_unknown);
59f4a2713aSLionel Sambuc }
60f4a2713aSLionel Sambuc
getOpenMPClauseName(OpenMPClauseKind Kind)61f4a2713aSLionel Sambuc const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) {
62*0a6a1f1dSLionel Sambuc assert(Kind <= OMPC_unknown);
63f4a2713aSLionel Sambuc switch (Kind) {
64f4a2713aSLionel Sambuc case OMPC_unknown:
65f4a2713aSLionel Sambuc return "unknown";
66f4a2713aSLionel Sambuc #define OPENMP_CLAUSE(Name, Class) \
67*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
68*0a6a1f1dSLionel Sambuc return #Name;
69f4a2713aSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
70f4a2713aSLionel Sambuc case OMPC_threadprivate:
71f4a2713aSLionel Sambuc return "threadprivate or thread local";
72f4a2713aSLionel Sambuc }
73f4a2713aSLionel Sambuc llvm_unreachable("Invalid OpenMP clause kind");
74f4a2713aSLionel Sambuc }
75f4a2713aSLionel Sambuc
getOpenMPSimpleClauseType(OpenMPClauseKind Kind,StringRef Str)76f4a2713aSLionel Sambuc unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
77f4a2713aSLionel Sambuc StringRef Str) {
78f4a2713aSLionel Sambuc switch (Kind) {
79f4a2713aSLionel Sambuc case OMPC_default:
80f4a2713aSLionel Sambuc return llvm::StringSwitch<OpenMPDefaultClauseKind>(Str)
81*0a6a1f1dSLionel Sambuc #define OPENMP_DEFAULT_KIND(Name) .Case(#Name, OMPC_DEFAULT_##Name)
82f4a2713aSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
83f4a2713aSLionel Sambuc .Default(OMPC_DEFAULT_unknown);
84*0a6a1f1dSLionel Sambuc case OMPC_proc_bind:
85*0a6a1f1dSLionel Sambuc return llvm::StringSwitch<OpenMPProcBindClauseKind>(Str)
86*0a6a1f1dSLionel Sambuc #define OPENMP_PROC_BIND_KIND(Name) .Case(#Name, OMPC_PROC_BIND_##Name)
87*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
88*0a6a1f1dSLionel Sambuc .Default(OMPC_PROC_BIND_unknown);
89*0a6a1f1dSLionel Sambuc case OMPC_schedule:
90*0a6a1f1dSLionel Sambuc return llvm::StringSwitch<OpenMPScheduleClauseKind>(Str)
91*0a6a1f1dSLionel Sambuc #define OPENMP_SCHEDULE_KIND(Name) .Case(#Name, OMPC_SCHEDULE_##Name)
92*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
93*0a6a1f1dSLionel Sambuc .Default(OMPC_SCHEDULE_unknown);
94f4a2713aSLionel Sambuc case OMPC_unknown:
95f4a2713aSLionel Sambuc case OMPC_threadprivate:
96*0a6a1f1dSLionel Sambuc case OMPC_if:
97*0a6a1f1dSLionel Sambuc case OMPC_final:
98*0a6a1f1dSLionel Sambuc case OMPC_num_threads:
99*0a6a1f1dSLionel Sambuc case OMPC_safelen:
100*0a6a1f1dSLionel Sambuc case OMPC_collapse:
101f4a2713aSLionel Sambuc case OMPC_private:
102f4a2713aSLionel Sambuc case OMPC_firstprivate:
103*0a6a1f1dSLionel Sambuc case OMPC_lastprivate:
104f4a2713aSLionel Sambuc case OMPC_shared:
105*0a6a1f1dSLionel Sambuc case OMPC_reduction:
106*0a6a1f1dSLionel Sambuc case OMPC_linear:
107*0a6a1f1dSLionel Sambuc case OMPC_aligned:
108*0a6a1f1dSLionel Sambuc case OMPC_copyin:
109*0a6a1f1dSLionel Sambuc case OMPC_copyprivate:
110*0a6a1f1dSLionel Sambuc case OMPC_ordered:
111*0a6a1f1dSLionel Sambuc case OMPC_nowait:
112*0a6a1f1dSLionel Sambuc case OMPC_untied:
113*0a6a1f1dSLionel Sambuc case OMPC_mergeable:
114*0a6a1f1dSLionel Sambuc case OMPC_flush:
115*0a6a1f1dSLionel Sambuc case OMPC_read:
116*0a6a1f1dSLionel Sambuc case OMPC_write:
117*0a6a1f1dSLionel Sambuc case OMPC_update:
118*0a6a1f1dSLionel Sambuc case OMPC_capture:
119*0a6a1f1dSLionel Sambuc case OMPC_seq_cst:
120f4a2713aSLionel Sambuc break;
121f4a2713aSLionel Sambuc }
122f4a2713aSLionel Sambuc llvm_unreachable("Invalid OpenMP simple clause kind");
123f4a2713aSLionel Sambuc }
124f4a2713aSLionel Sambuc
getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,unsigned Type)125f4a2713aSLionel Sambuc const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
126f4a2713aSLionel Sambuc unsigned Type) {
127f4a2713aSLionel Sambuc switch (Kind) {
128f4a2713aSLionel Sambuc case OMPC_default:
129f4a2713aSLionel Sambuc switch (Type) {
130f4a2713aSLionel Sambuc case OMPC_DEFAULT_unknown:
131f4a2713aSLionel Sambuc return "unknown";
132f4a2713aSLionel Sambuc #define OPENMP_DEFAULT_KIND(Name) \
133*0a6a1f1dSLionel Sambuc case OMPC_DEFAULT_##Name: \
134*0a6a1f1dSLionel Sambuc return #Name;
135f4a2713aSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
136f4a2713aSLionel Sambuc }
137f4a2713aSLionel Sambuc llvm_unreachable("Invalid OpenMP 'default' clause type");
138*0a6a1f1dSLionel Sambuc case OMPC_proc_bind:
139*0a6a1f1dSLionel Sambuc switch (Type) {
140*0a6a1f1dSLionel Sambuc case OMPC_PROC_BIND_unknown:
141*0a6a1f1dSLionel Sambuc return "unknown";
142*0a6a1f1dSLionel Sambuc #define OPENMP_PROC_BIND_KIND(Name) \
143*0a6a1f1dSLionel Sambuc case OMPC_PROC_BIND_##Name: \
144*0a6a1f1dSLionel Sambuc return #Name;
145*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
146*0a6a1f1dSLionel Sambuc }
147*0a6a1f1dSLionel Sambuc llvm_unreachable("Invalid OpenMP 'proc_bind' clause type");
148*0a6a1f1dSLionel Sambuc case OMPC_schedule:
149*0a6a1f1dSLionel Sambuc switch (Type) {
150*0a6a1f1dSLionel Sambuc case OMPC_SCHEDULE_unknown:
151*0a6a1f1dSLionel Sambuc return "unknown";
152*0a6a1f1dSLionel Sambuc #define OPENMP_SCHEDULE_KIND(Name) \
153*0a6a1f1dSLionel Sambuc case OMPC_SCHEDULE_##Name: \
154*0a6a1f1dSLionel Sambuc return #Name;
155*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
156*0a6a1f1dSLionel Sambuc }
157*0a6a1f1dSLionel Sambuc llvm_unreachable("Invalid OpenMP 'schedule' clause type");
158f4a2713aSLionel Sambuc case OMPC_unknown:
159f4a2713aSLionel Sambuc case OMPC_threadprivate:
160*0a6a1f1dSLionel Sambuc case OMPC_if:
161*0a6a1f1dSLionel Sambuc case OMPC_final:
162*0a6a1f1dSLionel Sambuc case OMPC_num_threads:
163*0a6a1f1dSLionel Sambuc case OMPC_safelen:
164*0a6a1f1dSLionel Sambuc case OMPC_collapse:
165f4a2713aSLionel Sambuc case OMPC_private:
166f4a2713aSLionel Sambuc case OMPC_firstprivate:
167*0a6a1f1dSLionel Sambuc case OMPC_lastprivate:
168f4a2713aSLionel Sambuc case OMPC_shared:
169*0a6a1f1dSLionel Sambuc case OMPC_reduction:
170*0a6a1f1dSLionel Sambuc case OMPC_linear:
171*0a6a1f1dSLionel Sambuc case OMPC_aligned:
172*0a6a1f1dSLionel Sambuc case OMPC_copyin:
173*0a6a1f1dSLionel Sambuc case OMPC_copyprivate:
174*0a6a1f1dSLionel Sambuc case OMPC_ordered:
175*0a6a1f1dSLionel Sambuc case OMPC_nowait:
176*0a6a1f1dSLionel Sambuc case OMPC_untied:
177*0a6a1f1dSLionel Sambuc case OMPC_mergeable:
178*0a6a1f1dSLionel Sambuc case OMPC_flush:
179*0a6a1f1dSLionel Sambuc case OMPC_read:
180*0a6a1f1dSLionel Sambuc case OMPC_write:
181*0a6a1f1dSLionel Sambuc case OMPC_update:
182*0a6a1f1dSLionel Sambuc case OMPC_capture:
183*0a6a1f1dSLionel Sambuc case OMPC_seq_cst:
184f4a2713aSLionel Sambuc break;
185f4a2713aSLionel Sambuc }
186f4a2713aSLionel Sambuc llvm_unreachable("Invalid OpenMP simple clause kind");
187f4a2713aSLionel Sambuc }
188f4a2713aSLionel Sambuc
isAllowedClauseForDirective(OpenMPDirectiveKind DKind,OpenMPClauseKind CKind)189f4a2713aSLionel Sambuc bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
190f4a2713aSLionel Sambuc OpenMPClauseKind CKind) {
191*0a6a1f1dSLionel Sambuc assert(DKind <= OMPD_unknown);
192*0a6a1f1dSLionel Sambuc assert(CKind <= OMPC_unknown);
193f4a2713aSLionel Sambuc switch (DKind) {
194f4a2713aSLionel Sambuc case OMPD_parallel:
195f4a2713aSLionel Sambuc switch (CKind) {
196f4a2713aSLionel Sambuc #define OPENMP_PARALLEL_CLAUSE(Name) \
197*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
198*0a6a1f1dSLionel Sambuc return true;
199*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
200*0a6a1f1dSLionel Sambuc default:
201*0a6a1f1dSLionel Sambuc break;
202*0a6a1f1dSLionel Sambuc }
203*0a6a1f1dSLionel Sambuc break;
204*0a6a1f1dSLionel Sambuc case OMPD_simd:
205*0a6a1f1dSLionel Sambuc switch (CKind) {
206*0a6a1f1dSLionel Sambuc #define OPENMP_SIMD_CLAUSE(Name) \
207*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
208*0a6a1f1dSLionel Sambuc return true;
209*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
210*0a6a1f1dSLionel Sambuc default:
211*0a6a1f1dSLionel Sambuc break;
212*0a6a1f1dSLionel Sambuc }
213*0a6a1f1dSLionel Sambuc break;
214*0a6a1f1dSLionel Sambuc case OMPD_for:
215*0a6a1f1dSLionel Sambuc switch (CKind) {
216*0a6a1f1dSLionel Sambuc #define OPENMP_FOR_CLAUSE(Name) \
217*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
218*0a6a1f1dSLionel Sambuc return true;
219*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
220*0a6a1f1dSLionel Sambuc default:
221*0a6a1f1dSLionel Sambuc break;
222*0a6a1f1dSLionel Sambuc }
223*0a6a1f1dSLionel Sambuc break;
224*0a6a1f1dSLionel Sambuc case OMPD_for_simd:
225*0a6a1f1dSLionel Sambuc switch (CKind) {
226*0a6a1f1dSLionel Sambuc #define OPENMP_FOR_SIMD_CLAUSE(Name) \
227*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
228*0a6a1f1dSLionel Sambuc return true;
229*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
230*0a6a1f1dSLionel Sambuc default:
231*0a6a1f1dSLionel Sambuc break;
232*0a6a1f1dSLionel Sambuc }
233*0a6a1f1dSLionel Sambuc break;
234*0a6a1f1dSLionel Sambuc case OMPD_sections:
235*0a6a1f1dSLionel Sambuc switch (CKind) {
236*0a6a1f1dSLionel Sambuc #define OPENMP_SECTIONS_CLAUSE(Name) \
237*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
238*0a6a1f1dSLionel Sambuc return true;
239*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
240*0a6a1f1dSLionel Sambuc default:
241*0a6a1f1dSLionel Sambuc break;
242*0a6a1f1dSLionel Sambuc }
243*0a6a1f1dSLionel Sambuc break;
244*0a6a1f1dSLionel Sambuc case OMPD_single:
245*0a6a1f1dSLionel Sambuc switch (CKind) {
246*0a6a1f1dSLionel Sambuc #define OPENMP_SINGLE_CLAUSE(Name) \
247*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
248*0a6a1f1dSLionel Sambuc return true;
249*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
250*0a6a1f1dSLionel Sambuc default:
251*0a6a1f1dSLionel Sambuc break;
252*0a6a1f1dSLionel Sambuc }
253*0a6a1f1dSLionel Sambuc break;
254*0a6a1f1dSLionel Sambuc case OMPD_parallel_for:
255*0a6a1f1dSLionel Sambuc switch (CKind) {
256*0a6a1f1dSLionel Sambuc #define OPENMP_PARALLEL_FOR_CLAUSE(Name) \
257*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
258*0a6a1f1dSLionel Sambuc return true;
259*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
260*0a6a1f1dSLionel Sambuc default:
261*0a6a1f1dSLionel Sambuc break;
262*0a6a1f1dSLionel Sambuc }
263*0a6a1f1dSLionel Sambuc break;
264*0a6a1f1dSLionel Sambuc case OMPD_parallel_for_simd:
265*0a6a1f1dSLionel Sambuc switch (CKind) {
266*0a6a1f1dSLionel Sambuc #define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) \
267*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
268*0a6a1f1dSLionel Sambuc return true;
269*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
270*0a6a1f1dSLionel Sambuc default:
271*0a6a1f1dSLionel Sambuc break;
272*0a6a1f1dSLionel Sambuc }
273*0a6a1f1dSLionel Sambuc break;
274*0a6a1f1dSLionel Sambuc case OMPD_parallel_sections:
275*0a6a1f1dSLionel Sambuc switch (CKind) {
276*0a6a1f1dSLionel Sambuc #define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) \
277*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
278*0a6a1f1dSLionel Sambuc return true;
279*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
280*0a6a1f1dSLionel Sambuc default:
281*0a6a1f1dSLionel Sambuc break;
282*0a6a1f1dSLionel Sambuc }
283*0a6a1f1dSLionel Sambuc break;
284*0a6a1f1dSLionel Sambuc case OMPD_task:
285*0a6a1f1dSLionel Sambuc switch (CKind) {
286*0a6a1f1dSLionel Sambuc #define OPENMP_TASK_CLAUSE(Name) \
287*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
288*0a6a1f1dSLionel Sambuc return true;
289*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
290*0a6a1f1dSLionel Sambuc default:
291*0a6a1f1dSLionel Sambuc break;
292*0a6a1f1dSLionel Sambuc }
293*0a6a1f1dSLionel Sambuc break;
294*0a6a1f1dSLionel Sambuc case OMPD_flush:
295*0a6a1f1dSLionel Sambuc return CKind == OMPC_flush;
296*0a6a1f1dSLionel Sambuc break;
297*0a6a1f1dSLionel Sambuc case OMPD_atomic:
298*0a6a1f1dSLionel Sambuc switch (CKind) {
299*0a6a1f1dSLionel Sambuc #define OPENMP_ATOMIC_CLAUSE(Name) \
300*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
301*0a6a1f1dSLionel Sambuc return true;
302*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
303*0a6a1f1dSLionel Sambuc default:
304*0a6a1f1dSLionel Sambuc break;
305*0a6a1f1dSLionel Sambuc }
306*0a6a1f1dSLionel Sambuc break;
307*0a6a1f1dSLionel Sambuc case OMPD_target:
308*0a6a1f1dSLionel Sambuc switch (CKind) {
309*0a6a1f1dSLionel Sambuc #define OPENMP_TARGET_CLAUSE(Name) \
310*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
311*0a6a1f1dSLionel Sambuc return true;
312*0a6a1f1dSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
313*0a6a1f1dSLionel Sambuc default:
314*0a6a1f1dSLionel Sambuc break;
315*0a6a1f1dSLionel Sambuc }
316*0a6a1f1dSLionel Sambuc break;
317*0a6a1f1dSLionel Sambuc case OMPD_teams:
318*0a6a1f1dSLionel Sambuc switch (CKind) {
319*0a6a1f1dSLionel Sambuc #define OPENMP_TEAMS_CLAUSE(Name) \
320*0a6a1f1dSLionel Sambuc case OMPC_##Name: \
321*0a6a1f1dSLionel Sambuc return true;
322f4a2713aSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
323f4a2713aSLionel Sambuc default:
324f4a2713aSLionel Sambuc break;
325f4a2713aSLionel Sambuc }
326f4a2713aSLionel Sambuc break;
327f4a2713aSLionel Sambuc case OMPD_unknown:
328f4a2713aSLionel Sambuc case OMPD_threadprivate:
329*0a6a1f1dSLionel Sambuc case OMPD_section:
330*0a6a1f1dSLionel Sambuc case OMPD_master:
331*0a6a1f1dSLionel Sambuc case OMPD_critical:
332*0a6a1f1dSLionel Sambuc case OMPD_taskyield:
333*0a6a1f1dSLionel Sambuc case OMPD_barrier:
334*0a6a1f1dSLionel Sambuc case OMPD_taskwait:
335*0a6a1f1dSLionel Sambuc case OMPD_ordered:
336f4a2713aSLionel Sambuc break;
337f4a2713aSLionel Sambuc }
338f4a2713aSLionel Sambuc return false;
339f4a2713aSLionel Sambuc }
340*0a6a1f1dSLionel Sambuc
isOpenMPLoopDirective(OpenMPDirectiveKind DKind)341*0a6a1f1dSLionel Sambuc bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
342*0a6a1f1dSLionel Sambuc return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
343*0a6a1f1dSLionel Sambuc DKind == OMPD_parallel_for ||
344*0a6a1f1dSLionel Sambuc DKind == OMPD_parallel_for_simd; // TODO add next directives.
345*0a6a1f1dSLionel Sambuc }
346*0a6a1f1dSLionel Sambuc
isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)347*0a6a1f1dSLionel Sambuc bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
348*0a6a1f1dSLionel Sambuc return DKind == OMPD_for || DKind == OMPD_for_simd ||
349*0a6a1f1dSLionel Sambuc DKind == OMPD_sections || DKind == OMPD_section ||
350*0a6a1f1dSLionel Sambuc DKind == OMPD_single || DKind == OMPD_parallel_for ||
351*0a6a1f1dSLionel Sambuc DKind == OMPD_parallel_for_simd ||
352*0a6a1f1dSLionel Sambuc DKind == OMPD_parallel_sections; // TODO add next directives.
353*0a6a1f1dSLionel Sambuc }
354*0a6a1f1dSLionel Sambuc
isOpenMPParallelDirective(OpenMPDirectiveKind DKind)355*0a6a1f1dSLionel Sambuc bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
356*0a6a1f1dSLionel Sambuc return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
357*0a6a1f1dSLionel Sambuc DKind == OMPD_parallel_for_simd ||
358*0a6a1f1dSLionel Sambuc DKind == OMPD_parallel_sections; // TODO add next directives.
359*0a6a1f1dSLionel Sambuc }
360*0a6a1f1dSLionel Sambuc
isOpenMPTeamsDirective(OpenMPDirectiveKind DKind)361*0a6a1f1dSLionel Sambuc bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
362*0a6a1f1dSLionel Sambuc return DKind == OMPD_teams; // TODO add next directives.
363*0a6a1f1dSLionel Sambuc }
364*0a6a1f1dSLionel Sambuc
isOpenMPSimdDirective(OpenMPDirectiveKind DKind)365*0a6a1f1dSLionel Sambuc bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
366*0a6a1f1dSLionel Sambuc return DKind == OMPD_simd || DKind == OMPD_for_simd ||
367*0a6a1f1dSLionel Sambuc DKind == OMPD_parallel_for_simd; // TODO add next directives.
368*0a6a1f1dSLionel Sambuc }
369*0a6a1f1dSLionel Sambuc
isOpenMPPrivate(OpenMPClauseKind Kind)370*0a6a1f1dSLionel Sambuc bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
371*0a6a1f1dSLionel Sambuc return Kind == OMPC_private || Kind == OMPC_firstprivate ||
372*0a6a1f1dSLionel Sambuc Kind == OMPC_lastprivate || Kind == OMPC_linear ||
373*0a6a1f1dSLionel Sambuc Kind == OMPC_reduction; // TODO add next clauses like 'reduction'.
374*0a6a1f1dSLionel Sambuc }
375*0a6a1f1dSLionel Sambuc
isOpenMPThreadPrivate(OpenMPClauseKind Kind)376*0a6a1f1dSLionel Sambuc bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
377*0a6a1f1dSLionel Sambuc return Kind == OMPC_threadprivate ||
378*0a6a1f1dSLionel Sambuc Kind == OMPC_copyin; // TODO add next clauses like 'copyprivate'.
379*0a6a1f1dSLionel Sambuc }
380*0a6a1f1dSLionel Sambuc
381