clang  6.0.0svn
OpenMPKinds.cpp
Go to the documentation of this file.
1 //===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 /// \brief This file implements the OpenMP enum and support functions.
11 ///
12 //===----------------------------------------------------------------------===//
13 
16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/ADT/StringSwitch.h"
18 #include "llvm/Support/ErrorHandling.h"
19 #include <cassert>
20 
21 using namespace clang;
22 
24  return llvm::StringSwitch<OpenMPDirectiveKind>(Str)
25 #define OPENMP_DIRECTIVE(Name) .Case(#Name, OMPD_##Name)
26 #define OPENMP_DIRECTIVE_EXT(Name, Str) .Case(Str, OMPD_##Name)
27 #include "clang/Basic/OpenMPKinds.def"
28  .Default(OMPD_unknown);
29 }
30 
32  assert(Kind <= OMPD_unknown);
33  switch (Kind) {
34  case OMPD_unknown:
35  return "unknown";
36 #define OPENMP_DIRECTIVE(Name) \
37  case OMPD_##Name: \
38  return #Name;
39 #define OPENMP_DIRECTIVE_EXT(Name, Str) \
40  case OMPD_##Name: \
41  return Str;
42 #include "clang/Basic/OpenMPKinds.def"
43  break;
44  }
45  llvm_unreachable("Invalid OpenMP directive kind");
46 }
47 
49  // 'flush' clause cannot be specified explicitly, because this is an implicit
50  // clause for 'flush' directive. If the 'flush' clause is explicitly specified
51  // the Parser should generate a warning about extra tokens at the end of the
52  // directive.
53  if (Str == "flush")
54  return OMPC_unknown;
55  return llvm::StringSwitch<OpenMPClauseKind>(Str)
56 #define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name)
57 #include "clang/Basic/OpenMPKinds.def"
58  .Case("uniform", OMPC_uniform)
59  .Default(OMPC_unknown);
60 }
61 
63  assert(Kind <= OMPC_unknown);
64  switch (Kind) {
65  case OMPC_unknown:
66  return "unknown";
67 #define OPENMP_CLAUSE(Name, Class) \
68  case OMPC_##Name: \
69  return #Name;
70 #include "clang/Basic/OpenMPKinds.def"
71  case OMPC_uniform:
72  return "uniform";
73  case OMPC_threadprivate:
74  return "threadprivate or thread local";
75  }
76  llvm_unreachable("Invalid OpenMP clause kind");
77 }
78 
80  StringRef Str) {
81  switch (Kind) {
82  case OMPC_default:
83  return llvm::StringSwitch<OpenMPDefaultClauseKind>(Str)
84 #define OPENMP_DEFAULT_KIND(Name) .Case(#Name, OMPC_DEFAULT_##Name)
85 #include "clang/Basic/OpenMPKinds.def"
86  .Default(OMPC_DEFAULT_unknown);
87  case OMPC_proc_bind:
88  return llvm::StringSwitch<OpenMPProcBindClauseKind>(Str)
89 #define OPENMP_PROC_BIND_KIND(Name) .Case(#Name, OMPC_PROC_BIND_##Name)
90 #include "clang/Basic/OpenMPKinds.def"
91  .Default(OMPC_PROC_BIND_unknown);
92  case OMPC_schedule:
93  return llvm::StringSwitch<unsigned>(Str)
94 #define OPENMP_SCHEDULE_KIND(Name) \
95  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
96 #define OPENMP_SCHEDULE_MODIFIER(Name) \
97  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
98 #include "clang/Basic/OpenMPKinds.def"
99  .Default(OMPC_SCHEDULE_unknown);
100  case OMPC_depend:
101  return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
102 #define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
103 #include "clang/Basic/OpenMPKinds.def"
104  .Default(OMPC_DEPEND_unknown);
105  case OMPC_linear:
106  return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
107 #define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
108 #include "clang/Basic/OpenMPKinds.def"
109  .Default(OMPC_LINEAR_unknown);
110  case OMPC_map:
111  return llvm::StringSwitch<OpenMPMapClauseKind>(Str)
112 #define OPENMP_MAP_KIND(Name) .Case(#Name, OMPC_MAP_##Name)
113 #include "clang/Basic/OpenMPKinds.def"
114  .Default(OMPC_MAP_unknown);
115  case OMPC_dist_schedule:
116  return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
117 #define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
118 #include "clang/Basic/OpenMPKinds.def"
119  .Default(OMPC_DIST_SCHEDULE_unknown);
120  case OMPC_defaultmap:
121  return llvm::StringSwitch<unsigned>(Str)
122 #define OPENMP_DEFAULTMAP_KIND(Name) \
123  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
124 #define OPENMP_DEFAULTMAP_MODIFIER(Name) \
125  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
126 #include "clang/Basic/OpenMPKinds.def"
127  .Default(OMPC_DEFAULTMAP_unknown);
128  case OMPC_unknown:
129  case OMPC_threadprivate:
130  case OMPC_if:
131  case OMPC_final:
132  case OMPC_num_threads:
133  case OMPC_safelen:
134  case OMPC_simdlen:
135  case OMPC_collapse:
136  case OMPC_private:
137  case OMPC_firstprivate:
138  case OMPC_lastprivate:
139  case OMPC_shared:
140  case OMPC_reduction:
141  case OMPC_task_reduction:
142  case OMPC_in_reduction:
143  case OMPC_aligned:
144  case OMPC_copyin:
145  case OMPC_copyprivate:
146  case OMPC_ordered:
147  case OMPC_nowait:
148  case OMPC_untied:
149  case OMPC_mergeable:
150  case OMPC_flush:
151  case OMPC_read:
152  case OMPC_write:
153  case OMPC_update:
154  case OMPC_capture:
155  case OMPC_seq_cst:
156  case OMPC_device:
157  case OMPC_threads:
158  case OMPC_simd:
159  case OMPC_num_teams:
160  case OMPC_thread_limit:
161  case OMPC_priority:
162  case OMPC_grainsize:
163  case OMPC_nogroup:
164  case OMPC_num_tasks:
165  case OMPC_hint:
166  case OMPC_uniform:
167  case OMPC_to:
168  case OMPC_from:
169  case OMPC_use_device_ptr:
170  case OMPC_is_device_ptr:
171  break;
172  }
173  llvm_unreachable("Invalid OpenMP simple clause kind");
174 }
175 
177  unsigned Type) {
178  switch (Kind) {
179  case OMPC_default:
180  switch (Type) {
182  return "unknown";
183 #define OPENMP_DEFAULT_KIND(Name) \
184  case OMPC_DEFAULT_##Name: \
185  return #Name;
186 #include "clang/Basic/OpenMPKinds.def"
187  }
188  llvm_unreachable("Invalid OpenMP 'default' clause type");
189  case OMPC_proc_bind:
190  switch (Type) {
192  return "unknown";
193 #define OPENMP_PROC_BIND_KIND(Name) \
194  case OMPC_PROC_BIND_##Name: \
195  return #Name;
196 #include "clang/Basic/OpenMPKinds.def"
197  }
198  llvm_unreachable("Invalid OpenMP 'proc_bind' clause type");
199  case OMPC_schedule:
200  switch (Type) {
203  return "unknown";
204 #define OPENMP_SCHEDULE_KIND(Name) \
205  case OMPC_SCHEDULE_##Name: \
206  return #Name;
207 #define OPENMP_SCHEDULE_MODIFIER(Name) \
208  case OMPC_SCHEDULE_MODIFIER_##Name: \
209  return #Name;
210 #include "clang/Basic/OpenMPKinds.def"
211  }
212  llvm_unreachable("Invalid OpenMP 'schedule' clause type");
213  case OMPC_depend:
214  switch (Type) {
215  case OMPC_DEPEND_unknown:
216  return "unknown";
217 #define OPENMP_DEPEND_KIND(Name) \
218  case OMPC_DEPEND_##Name: \
219  return #Name;
220 #include "clang/Basic/OpenMPKinds.def"
221  }
222  llvm_unreachable("Invalid OpenMP 'depend' clause type");
223  case OMPC_linear:
224  switch (Type) {
225  case OMPC_LINEAR_unknown:
226  return "unknown";
227 #define OPENMP_LINEAR_KIND(Name) \
228  case OMPC_LINEAR_##Name: \
229  return #Name;
230 #include "clang/Basic/OpenMPKinds.def"
231  }
232  llvm_unreachable("Invalid OpenMP 'linear' clause type");
233  case OMPC_map:
234  switch (Type) {
235  case OMPC_MAP_unknown:
236  return "unknown";
237 #define OPENMP_MAP_KIND(Name) \
238  case OMPC_MAP_##Name: \
239  return #Name;
240 #include "clang/Basic/OpenMPKinds.def"
241  default:
242  break;
243  }
244  llvm_unreachable("Invalid OpenMP 'map' clause type");
245  case OMPC_dist_schedule:
246  switch (Type) {
248  return "unknown";
249 #define OPENMP_DIST_SCHEDULE_KIND(Name) \
250  case OMPC_DIST_SCHEDULE_##Name: \
251  return #Name;
252 #include "clang/Basic/OpenMPKinds.def"
253  }
254  llvm_unreachable("Invalid OpenMP 'dist_schedule' clause type");
255  case OMPC_defaultmap:
256  switch (Type) {
259  return "unknown";
260 #define OPENMP_DEFAULTMAP_KIND(Name) \
261  case OMPC_DEFAULTMAP_##Name: \
262  return #Name;
263 #define OPENMP_DEFAULTMAP_MODIFIER(Name) \
264  case OMPC_DEFAULTMAP_MODIFIER_##Name: \
265  return #Name;
266 #include "clang/Basic/OpenMPKinds.def"
267  }
268  llvm_unreachable("Invalid OpenMP 'schedule' clause type");
269  case OMPC_unknown:
270  case OMPC_threadprivate:
271  case OMPC_if:
272  case OMPC_final:
273  case OMPC_num_threads:
274  case OMPC_safelen:
275  case OMPC_simdlen:
276  case OMPC_collapse:
277  case OMPC_private:
278  case OMPC_firstprivate:
279  case OMPC_lastprivate:
280  case OMPC_shared:
281  case OMPC_reduction:
282  case OMPC_task_reduction:
283  case OMPC_in_reduction:
284  case OMPC_aligned:
285  case OMPC_copyin:
286  case OMPC_copyprivate:
287  case OMPC_ordered:
288  case OMPC_nowait:
289  case OMPC_untied:
290  case OMPC_mergeable:
291  case OMPC_flush:
292  case OMPC_read:
293  case OMPC_write:
294  case OMPC_update:
295  case OMPC_capture:
296  case OMPC_seq_cst:
297  case OMPC_device:
298  case OMPC_threads:
299  case OMPC_simd:
300  case OMPC_num_teams:
301  case OMPC_thread_limit:
302  case OMPC_priority:
303  case OMPC_grainsize:
304  case OMPC_nogroup:
305  case OMPC_num_tasks:
306  case OMPC_hint:
307  case OMPC_uniform:
308  case OMPC_to:
309  case OMPC_from:
310  case OMPC_use_device_ptr:
311  case OMPC_is_device_ptr:
312  break;
313  }
314  llvm_unreachable("Invalid OpenMP simple clause kind");
315 }
316 
318  OpenMPClauseKind CKind) {
319  assert(DKind <= OMPD_unknown);
320  assert(CKind <= OMPC_unknown);
321  switch (DKind) {
322  case OMPD_parallel:
323  switch (CKind) {
324 #define OPENMP_PARALLEL_CLAUSE(Name) \
325  case OMPC_##Name: \
326  return true;
327 #include "clang/Basic/OpenMPKinds.def"
328  default:
329  break;
330  }
331  break;
332  case OMPD_simd:
333  switch (CKind) {
334 #define OPENMP_SIMD_CLAUSE(Name) \
335  case OMPC_##Name: \
336  return true;
337 #include "clang/Basic/OpenMPKinds.def"
338  default:
339  break;
340  }
341  break;
342  case OMPD_for:
343  switch (CKind) {
344 #define OPENMP_FOR_CLAUSE(Name) \
345  case OMPC_##Name: \
346  return true;
347 #include "clang/Basic/OpenMPKinds.def"
348  default:
349  break;
350  }
351  break;
352  case OMPD_for_simd:
353  switch (CKind) {
354 #define OPENMP_FOR_SIMD_CLAUSE(Name) \
355  case OMPC_##Name: \
356  return true;
357 #include "clang/Basic/OpenMPKinds.def"
358  default:
359  break;
360  }
361  break;
362  case OMPD_sections:
363  switch (CKind) {
364 #define OPENMP_SECTIONS_CLAUSE(Name) \
365  case OMPC_##Name: \
366  return true;
367 #include "clang/Basic/OpenMPKinds.def"
368  default:
369  break;
370  }
371  break;
372  case OMPD_single:
373  switch (CKind) {
374 #define OPENMP_SINGLE_CLAUSE(Name) \
375  case OMPC_##Name: \
376  return true;
377 #include "clang/Basic/OpenMPKinds.def"
378  default:
379  break;
380  }
381  break;
382  case OMPD_parallel_for:
383  switch (CKind) {
384 #define OPENMP_PARALLEL_FOR_CLAUSE(Name) \
385  case OMPC_##Name: \
386  return true;
387 #include "clang/Basic/OpenMPKinds.def"
388  default:
389  break;
390  }
391  break;
392  case OMPD_parallel_for_simd:
393  switch (CKind) {
394 #define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) \
395  case OMPC_##Name: \
396  return true;
397 #include "clang/Basic/OpenMPKinds.def"
398  default:
399  break;
400  }
401  break;
402  case OMPD_parallel_sections:
403  switch (CKind) {
404 #define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) \
405  case OMPC_##Name: \
406  return true;
407 #include "clang/Basic/OpenMPKinds.def"
408  default:
409  break;
410  }
411  break;
412  case OMPD_task:
413  switch (CKind) {
414 #define OPENMP_TASK_CLAUSE(Name) \
415  case OMPC_##Name: \
416  return true;
417 #include "clang/Basic/OpenMPKinds.def"
418  default:
419  break;
420  }
421  break;
422  case OMPD_flush:
423  return CKind == OMPC_flush;
424  break;
425  case OMPD_atomic:
426  switch (CKind) {
427 #define OPENMP_ATOMIC_CLAUSE(Name) \
428  case OMPC_##Name: \
429  return true;
430 #include "clang/Basic/OpenMPKinds.def"
431  default:
432  break;
433  }
434  break;
435  case OMPD_target:
436  switch (CKind) {
437 #define OPENMP_TARGET_CLAUSE(Name) \
438  case OMPC_##Name: \
439  return true;
440 #include "clang/Basic/OpenMPKinds.def"
441  default:
442  break;
443  }
444  break;
445  case OMPD_target_data:
446  switch (CKind) {
447 #define OPENMP_TARGET_DATA_CLAUSE(Name) \
448  case OMPC_##Name: \
449  return true;
450 #include "clang/Basic/OpenMPKinds.def"
451  default:
452  break;
453  }
454  break;
455  case OMPD_target_enter_data:
456  switch (CKind) {
457 #define OPENMP_TARGET_ENTER_DATA_CLAUSE(Name) \
458  case OMPC_##Name: \
459  return true;
460 #include "clang/Basic/OpenMPKinds.def"
461  default:
462  break;
463  }
464  break;
465  case OMPD_target_exit_data:
466  switch (CKind) {
467 #define OPENMP_TARGET_EXIT_DATA_CLAUSE(Name) \
468  case OMPC_##Name: \
469  return true;
470 #include "clang/Basic/OpenMPKinds.def"
471  default:
472  break;
473  }
474  break;
475  case OMPD_target_parallel:
476  switch (CKind) {
477 #define OPENMP_TARGET_PARALLEL_CLAUSE(Name) \
478  case OMPC_##Name: \
479  return true;
480 #include "clang/Basic/OpenMPKinds.def"
481  default:
482  break;
483  }
484  break;
485  case OMPD_target_parallel_for:
486  switch (CKind) {
487 #define OPENMP_TARGET_PARALLEL_FOR_CLAUSE(Name) \
488  case OMPC_##Name: \
489  return true;
490 #include "clang/Basic/OpenMPKinds.def"
491  default:
492  break;
493  }
494  break;
495  case OMPD_target_update:
496  switch (CKind) {
497 #define OPENMP_TARGET_UPDATE_CLAUSE(Name) \
498  case OMPC_##Name: \
499  return true;
500 #include "clang/Basic/OpenMPKinds.def"
501  default:
502  break;
503  }
504  break;
505  case OMPD_teams:
506  switch (CKind) {
507 #define OPENMP_TEAMS_CLAUSE(Name) \
508  case OMPC_##Name: \
509  return true;
510 #include "clang/Basic/OpenMPKinds.def"
511  default:
512  break;
513  }
514  break;
515  case OMPD_declare_simd:
516  break;
517  case OMPD_cancel:
518  switch (CKind) {
519 #define OPENMP_CANCEL_CLAUSE(Name) \
520  case OMPC_##Name: \
521  return true;
522 #include "clang/Basic/OpenMPKinds.def"
523  default:
524  break;
525  }
526  break;
527  case OMPD_ordered:
528  switch (CKind) {
529 #define OPENMP_ORDERED_CLAUSE(Name) \
530  case OMPC_##Name: \
531  return true;
532 #include "clang/Basic/OpenMPKinds.def"
533  default:
534  break;
535  }
536  break;
537  case OMPD_taskloop:
538  switch (CKind) {
539 #define OPENMP_TASKLOOP_CLAUSE(Name) \
540  case OMPC_##Name: \
541  return true;
542 #include "clang/Basic/OpenMPKinds.def"
543  default:
544  break;
545  }
546  break;
547  case OMPD_taskloop_simd:
548  switch (CKind) {
549 #define OPENMP_TASKLOOP_SIMD_CLAUSE(Name) \
550  case OMPC_##Name: \
551  return true;
552 #include "clang/Basic/OpenMPKinds.def"
553  default:
554  break;
555  }
556  break;
557  case OMPD_critical:
558  switch (CKind) {
559 #define OPENMP_CRITICAL_CLAUSE(Name) \
560  case OMPC_##Name: \
561  return true;
562 #include "clang/Basic/OpenMPKinds.def"
563  default:
564  break;
565  }
566  break;
567  case OMPD_distribute:
568  switch (CKind) {
569 #define OPENMP_DISTRIBUTE_CLAUSE(Name) \
570  case OMPC_##Name: \
571  return true;
572 #include "clang/Basic/OpenMPKinds.def"
573  default:
574  break;
575  }
576  break;
577  case OMPD_distribute_parallel_for:
578  switch (CKind) {
579 #define OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
580  case OMPC_##Name: \
581  return true;
582 #include "clang/Basic/OpenMPKinds.def"
583  default:
584  break;
585  }
586  break;
587  case OMPD_distribute_parallel_for_simd:
588  switch (CKind) {
589 #define OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
590  case OMPC_##Name: \
591  return true;
592 #include "clang/Basic/OpenMPKinds.def"
593  default:
594  break;
595  }
596  break;
597  case OMPD_distribute_simd:
598  switch (CKind) {
599 #define OPENMP_DISTRIBUTE_SIMD_CLAUSE(Name) \
600  case OMPC_##Name: \
601  return true;
602 #include "clang/Basic/OpenMPKinds.def"
603  default:
604  break;
605  }
606  break;
607  case OMPD_target_parallel_for_simd:
608  switch (CKind) {
609 #define OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(Name) \
610  case OMPC_##Name: \
611  return true;
612 #include "clang/Basic/OpenMPKinds.def"
613  default:
614  break;
615  }
616  break;
617  case OMPD_target_simd:
618  switch (CKind) {
619 #define OPENMP_TARGET_SIMD_CLAUSE(Name) \
620  case OMPC_##Name: \
621  return true;
622 #include "clang/Basic/OpenMPKinds.def"
623  default:
624  break;
625  }
626  break;
627  case OMPD_teams_distribute:
628  switch (CKind) {
629 #define OPENMP_TEAMS_DISTRIBUTE_CLAUSE(Name) \
630  case OMPC_##Name: \
631  return true;
632 #include "clang/Basic/OpenMPKinds.def"
633  default:
634  break;
635  }
636  break;
637  case OMPD_teams_distribute_simd:
638  switch (CKind) {
639 #define OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \
640  case OMPC_##Name: \
641  return true;
642 #include "clang/Basic/OpenMPKinds.def"
643  default:
644  break;
645  }
646  break;
647  case OMPD_teams_distribute_parallel_for_simd:
648  switch (CKind) {
649 #define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
650  case OMPC_##Name: \
651  return true;
652 #include "clang/Basic/OpenMPKinds.def"
653  default:
654  break;
655  }
656  break;
657  case OMPD_teams_distribute_parallel_for:
658  switch (CKind) {
659 #define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
660  case OMPC_##Name: \
661  return true;
662 #include "clang/Basic/OpenMPKinds.def"
663  default:
664  break;
665  }
666  break;
667  case OMPD_target_teams:
668  switch (CKind) {
669 #define OPENMP_TARGET_TEAMS_CLAUSE(Name) \
670  case OMPC_##Name: \
671  return true;
672 #include "clang/Basic/OpenMPKinds.def"
673  default:
674  break;
675  }
676  break;
677  case OMPD_target_teams_distribute:
678  switch (CKind) {
679 #define OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(Name) \
680  case OMPC_##Name: \
681  return true;
682 #include "clang/Basic/OpenMPKinds.def"
683  default:
684  break;
685  }
686  break;
687  case OMPD_target_teams_distribute_parallel_for:
688  switch (CKind) {
689 #define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
690  case OMPC_##Name: \
691  return true;
692 #include "clang/Basic/OpenMPKinds.def"
693  default:
694  break;
695  }
696  break;
697  case OMPD_target_teams_distribute_parallel_for_simd:
698  switch (CKind) {
699 #define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
700  case OMPC_##Name: \
701  return true;
702 #include "clang/Basic/OpenMPKinds.def"
703  default:
704  break;
705  }
706  break;
707  case OMPD_target_teams_distribute_simd:
708  switch (CKind) {
709 #define OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \
710  case OMPC_##Name: \
711  return true;
712 #include "clang/Basic/OpenMPKinds.def"
713  default:
714  break;
715  }
716  break;
717  case OMPD_taskgroup:
718  switch (CKind) {
719 #define OPENMP_TASKGROUP_CLAUSE(Name) \
720  case OMPC_##Name: \
721  return true;
722 #include "clang/Basic/OpenMPKinds.def"
723  default:
724  break;
725  }
726  break;
727  case OMPD_declare_target:
728  case OMPD_end_declare_target:
729  case OMPD_unknown:
730  case OMPD_threadprivate:
731  case OMPD_section:
732  case OMPD_master:
733  case OMPD_taskyield:
734  case OMPD_barrier:
735  case OMPD_taskwait:
736  case OMPD_cancellation_point:
737  case OMPD_declare_reduction:
738  break;
739  }
740  return false;
741 }
742 
744  return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
745  DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
746  DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
747  DKind == OMPD_distribute || DKind == OMPD_target_parallel_for ||
748  DKind == OMPD_distribute_parallel_for ||
749  DKind == OMPD_distribute_parallel_for_simd ||
750  DKind == OMPD_distribute_simd ||
751  DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
752  DKind == OMPD_teams_distribute ||
753  DKind == OMPD_teams_distribute_simd ||
754  DKind == OMPD_teams_distribute_parallel_for_simd ||
755  DKind == OMPD_teams_distribute_parallel_for ||
756  DKind == OMPD_target_teams_distribute ||
757  DKind == OMPD_target_teams_distribute_parallel_for ||
758  DKind == OMPD_target_teams_distribute_parallel_for_simd ||
759  DKind == OMPD_target_teams_distribute_simd;
760 }
761 
763  return DKind == OMPD_for || DKind == OMPD_for_simd ||
764  DKind == OMPD_sections || DKind == OMPD_section ||
765  DKind == OMPD_single || DKind == OMPD_parallel_for ||
766  DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
767  DKind == OMPD_target_parallel_for ||
768  DKind == OMPD_distribute_parallel_for ||
769  DKind == OMPD_distribute_parallel_for_simd ||
770  DKind == OMPD_target_parallel_for_simd ||
771  DKind == OMPD_teams_distribute_parallel_for_simd ||
772  DKind == OMPD_teams_distribute_parallel_for ||
773  DKind == OMPD_target_teams_distribute_parallel_for ||
774  DKind == OMPD_target_teams_distribute_parallel_for_simd;
775 }
776 
778  return DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd;
779 }
780 
782  return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
783  DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
784  DKind == OMPD_target_parallel || DKind == OMPD_target_parallel_for ||
785  DKind == OMPD_distribute_parallel_for ||
786  DKind == OMPD_distribute_parallel_for_simd ||
787  DKind == OMPD_target_parallel_for_simd ||
788  DKind == OMPD_teams_distribute_parallel_for ||
789  DKind == OMPD_teams_distribute_parallel_for_simd ||
790  DKind == OMPD_target_teams_distribute_parallel_for ||
791  DKind == OMPD_target_teams_distribute_parallel_for_simd;
792 }
793 
795  return DKind == OMPD_target || DKind == OMPD_target_parallel ||
796  DKind == OMPD_target_parallel_for ||
797  DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
798  DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
799  DKind == OMPD_target_teams_distribute_parallel_for ||
800  DKind == OMPD_target_teams_distribute_parallel_for_simd ||
801  DKind == OMPD_target_teams_distribute_simd;
802 }
803 
805  return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
806  DKind == OMPD_target_exit_data || DKind == OMPD_target_update;
807 }
808 
810  return DKind == OMPD_teams || DKind == OMPD_teams_distribute ||
811  DKind == OMPD_teams_distribute_simd ||
812  DKind == OMPD_teams_distribute_parallel_for_simd ||
813  DKind == OMPD_teams_distribute_parallel_for;
814 }
815 
817  return isOpenMPNestingTeamsDirective(DKind) ||
818  DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
819  DKind == OMPD_target_teams_distribute_parallel_for ||
820  DKind == OMPD_target_teams_distribute_parallel_for_simd ||
821  DKind == OMPD_target_teams_distribute_simd;
822 }
823 
825  return DKind == OMPD_simd || DKind == OMPD_for_simd ||
826  DKind == OMPD_parallel_for_simd || DKind == OMPD_taskloop_simd ||
827  DKind == OMPD_distribute_parallel_for_simd ||
828  DKind == OMPD_distribute_simd || DKind == OMPD_target_simd ||
829  DKind == OMPD_teams_distribute_simd ||
830  DKind == OMPD_teams_distribute_parallel_for_simd ||
831  DKind == OMPD_target_teams_distribute_parallel_for_simd ||
832  DKind == OMPD_target_teams_distribute_simd;
833 }
834 
836  return Kind == OMPD_distribute || Kind == OMPD_distribute_parallel_for ||
837  Kind == OMPD_distribute_parallel_for_simd ||
838  Kind == OMPD_distribute_simd;
839  // TODO add next directives.
840 }
841 
843  return isOpenMPNestingDistributeDirective(Kind) ||
844  Kind == OMPD_teams_distribute || Kind == OMPD_teams_distribute_simd ||
845  Kind == OMPD_teams_distribute_parallel_for_simd ||
846  Kind == OMPD_teams_distribute_parallel_for ||
847  Kind == OMPD_target_teams_distribute ||
848  Kind == OMPD_target_teams_distribute_parallel_for ||
849  Kind == OMPD_target_teams_distribute_parallel_for_simd ||
850  Kind == OMPD_target_teams_distribute_simd;
851 }
852 
854  return Kind == OMPC_private || Kind == OMPC_firstprivate ||
855  Kind == OMPC_lastprivate || Kind == OMPC_linear ||
856  Kind == OMPC_reduction || Kind == OMPC_task_reduction ||
857  Kind == OMPC_in_reduction; // TODO add next clauses like 'reduction'.
858 }
859 
861  return Kind == OMPC_threadprivate || Kind == OMPC_copyin;
862 }
863 
865  return Kind == OMPD_task || isOpenMPTaskLoopDirective(Kind);
866 }
867 
869  return Kind == OMPD_distribute_parallel_for ||
870  Kind == OMPD_distribute_parallel_for_simd ||
871  Kind == OMPD_teams_distribute_parallel_for_simd ||
872  Kind == OMPD_teams_distribute_parallel_for ||
873  Kind == OMPD_target_teams_distribute_parallel_for ||
874  Kind == OMPD_target_teams_distribute_parallel_for_simd;
875 }
876 
878  SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
879  OpenMPDirectiveKind DKind) {
880  assert(DKind <= OMPD_unknown);
881  switch (DKind) {
882  case OMPD_parallel:
883  case OMPD_parallel_for:
884  case OMPD_parallel_for_simd:
885  case OMPD_parallel_sections:
886  case OMPD_distribute_parallel_for:
887  CaptureRegions.push_back(OMPD_parallel);
888  break;
889  case OMPD_target_teams:
890  CaptureRegions.push_back(OMPD_target);
891  CaptureRegions.push_back(OMPD_teams);
892  break;
893  case OMPD_teams_distribute:
894  CaptureRegions.push_back(OMPD_teams);
895  break;
896  case OMPD_teams:
897  case OMPD_simd:
898  case OMPD_for:
899  case OMPD_for_simd:
900  case OMPD_sections:
901  case OMPD_section:
902  case OMPD_single:
903  case OMPD_master:
904  case OMPD_critical:
905  case OMPD_taskgroup:
906  case OMPD_distribute:
907  case OMPD_ordered:
908  case OMPD_atomic:
909  case OMPD_target_data:
910  case OMPD_target:
911  case OMPD_target_parallel_for:
912  case OMPD_target_parallel_for_simd:
913  case OMPD_target_simd:
914  case OMPD_task:
915  case OMPD_taskloop:
916  case OMPD_taskloop_simd:
917  case OMPD_distribute_parallel_for_simd:
918  case OMPD_distribute_simd:
919  case OMPD_teams_distribute_simd:
920  case OMPD_teams_distribute_parallel_for_simd:
921  case OMPD_teams_distribute_parallel_for:
922  case OMPD_target_teams_distribute:
923  case OMPD_target_teams_distribute_parallel_for:
924  case OMPD_target_teams_distribute_parallel_for_simd:
925  case OMPD_target_teams_distribute_simd:
926  CaptureRegions.push_back(DKind);
927  break;
928  case OMPD_target_parallel:
929  CaptureRegions.push_back(OMPD_target);
930  CaptureRegions.push_back(OMPD_parallel);
931  break;
932  case OMPD_threadprivate:
933  case OMPD_taskyield:
934  case OMPD_barrier:
935  case OMPD_taskwait:
936  case OMPD_cancellation_point:
937  case OMPD_cancel:
938  case OMPD_flush:
939  case OMPD_target_enter_data:
940  case OMPD_target_exit_data:
941  case OMPD_declare_reduction:
942  case OMPD_declare_simd:
943  case OMPD_declare_target:
944  case OMPD_end_declare_target:
945  case OMPD_target_update:
946  llvm_unreachable("OpenMP Directive is not allowed");
947  case OMPD_unknown:
948  llvm_unreachable("Unknown OpenMP directive");
949  }
950 }
#define OPENMP_MAP_KIND(Name)
bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a distribute directive in the outerm...
bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target data offload directive.
The base class of the type hierarchy.
Definition: Type.h:1300
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind, OpenMPClauseKind CKind)
#define OPENMP_LINEAR_KIND(Name)
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
Definition: OpenMPKinds.cpp:62
bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of tasking directives - task, taskloop or taksloop simd...
Defines some OpenMP-specific enums and functions.
bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a teams-kind directive.
OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str)
bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target code offload directive.
#define OPENMP_DEFAULTMAP_KIND(Name)
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
#define OPENMP_CLAUSE(Name, Class)
#define OPENMP_PROC_BIND_KIND(Name)
bool isOpenMPPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of private clauses like &#39;private&#39;, &#39;firstprivate&#39;, &#39;reduction&#39; etc.
bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a parallel-kind directive.
#define OPENMP_DEPEND_KIND(Name)
OpenMPClauseKind
OpenMP clauses.
Definition: OpenMPKinds.h:33
#define OPENMP_DIRECTIVE(Name)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
Kind
OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:23
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
Dataflow Directional Tag Classes.
bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a simd directive.
#define OPENMP_DEFAULT_KIND(Name)
bool isOpenMPThreadPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of threadprivate clauses like &#39;threadprivate&#39;, &#39;copyin&#39; or &#39;copyprivate&#39;.
void getOpenMPCaptureRegions(llvm::SmallVectorImpl< OpenMPDirectiveKind > &CaptureRegions, OpenMPDirectiveKind DKind)
Return the captured regions of an OpenMP directive.
unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str)
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str)
const char * getOpenMPDirectiveName(OpenMPDirectiveKind Kind)
Definition: OpenMPKinds.cpp:31
#define OPENMP_SCHEDULE_KIND(Name)
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
#define OPENMP_DIST_SCHEDULE_KIND(Name)
bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a teams directive in the outermost n...