xref: /netbsd-src/external/apache2/llvm/dist/clang/lib/Basic/OpenMPKinds.cpp (revision e038c9c4676b0f19b1b7dd08a940c6ed64a6d5ae)
17330f729Sjoerg //===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
27330f729Sjoerg //
37330f729Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
47330f729Sjoerg // See https://llvm.org/LICENSE.txt for license information.
57330f729Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
67330f729Sjoerg //
77330f729Sjoerg //===----------------------------------------------------------------------===//
87330f729Sjoerg /// \file
97330f729Sjoerg /// This file implements the OpenMP enum and support functions.
107330f729Sjoerg ///
117330f729Sjoerg //===----------------------------------------------------------------------===//
127330f729Sjoerg 
137330f729Sjoerg #include "clang/Basic/OpenMPKinds.h"
147330f729Sjoerg #include "clang/Basic/IdentifierTable.h"
157330f729Sjoerg #include "llvm/ADT/StringRef.h"
167330f729Sjoerg #include "llvm/ADT/StringSwitch.h"
177330f729Sjoerg #include "llvm/Support/ErrorHandling.h"
187330f729Sjoerg #include <cassert>
197330f729Sjoerg 
207330f729Sjoerg using namespace clang;
21*e038c9c4Sjoerg using namespace llvm::omp;
227330f729Sjoerg 
getOpenMPSimpleClauseType(OpenMPClauseKind Kind,StringRef Str,unsigned OpenMPVersion)23*e038c9c4Sjoerg unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, StringRef Str,
24*e038c9c4Sjoerg                                           unsigned OpenMPVersion) {
257330f729Sjoerg   switch (Kind) {
267330f729Sjoerg   case OMPC_default:
27*e038c9c4Sjoerg     return llvm::StringSwitch<unsigned>(Str)
28*e038c9c4Sjoerg #define OMP_DEFAULT_KIND(Enum, Name) .Case(Name, unsigned(Enum))
29*e038c9c4Sjoerg #include "llvm/Frontend/OpenMP/OMPKinds.def"
30*e038c9c4Sjoerg         .Default(unsigned(llvm::omp::OMP_DEFAULT_unknown));
317330f729Sjoerg   case OMPC_proc_bind:
32*e038c9c4Sjoerg     return llvm::StringSwitch<unsigned>(Str)
33*e038c9c4Sjoerg #define OMP_PROC_BIND_KIND(Enum, Name, Value) .Case(Name, Value)
34*e038c9c4Sjoerg #include "llvm/Frontend/OpenMP/OMPKinds.def"
35*e038c9c4Sjoerg         .Default(unsigned(llvm::omp::OMP_PROC_BIND_unknown));
367330f729Sjoerg   case OMPC_schedule:
377330f729Sjoerg     return llvm::StringSwitch<unsigned>(Str)
387330f729Sjoerg #define OPENMP_SCHEDULE_KIND(Name)                                             \
397330f729Sjoerg   .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
407330f729Sjoerg #define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
417330f729Sjoerg   .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
427330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
437330f729Sjoerg         .Default(OMPC_SCHEDULE_unknown);
447330f729Sjoerg   case OMPC_depend:
457330f729Sjoerg     return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
467330f729Sjoerg #define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
477330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
487330f729Sjoerg         .Default(OMPC_DEPEND_unknown);
497330f729Sjoerg   case OMPC_linear:
507330f729Sjoerg     return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
517330f729Sjoerg #define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
527330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
537330f729Sjoerg         .Default(OMPC_LINEAR_unknown);
54*e038c9c4Sjoerg   case OMPC_map: {
55*e038c9c4Sjoerg     unsigned Type = llvm::StringSwitch<unsigned>(Str)
567330f729Sjoerg #define OPENMP_MAP_KIND(Name)                                                  \
577330f729Sjoerg   .Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
587330f729Sjoerg #define OPENMP_MAP_MODIFIER_KIND(Name)                                         \
597330f729Sjoerg   .Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
607330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
617330f729Sjoerg         .Default(OMPC_MAP_unknown);
62*e038c9c4Sjoerg     if (OpenMPVersion < 51 && Type == OMPC_MAP_MODIFIER_present)
63*e038c9c4Sjoerg       return OMPC_MAP_MODIFIER_unknown;
64*e038c9c4Sjoerg     return Type;
65*e038c9c4Sjoerg   }
667330f729Sjoerg   case OMPC_to:
67*e038c9c4Sjoerg   case OMPC_from: {
68*e038c9c4Sjoerg     unsigned Type = llvm::StringSwitch<unsigned>(Str)
69*e038c9c4Sjoerg #define OPENMP_MOTION_MODIFIER_KIND(Name)                                      \
70*e038c9c4Sjoerg   .Case(#Name, static_cast<unsigned>(OMPC_MOTION_MODIFIER_##Name))
717330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
72*e038c9c4Sjoerg         .Default(OMPC_MOTION_MODIFIER_unknown);
73*e038c9c4Sjoerg     if (OpenMPVersion < 51 && Type == OMPC_MOTION_MODIFIER_present)
74*e038c9c4Sjoerg       return OMPC_MOTION_MODIFIER_unknown;
75*e038c9c4Sjoerg     return Type;
76*e038c9c4Sjoerg   }
777330f729Sjoerg   case OMPC_dist_schedule:
787330f729Sjoerg     return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
797330f729Sjoerg #define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
807330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
817330f729Sjoerg         .Default(OMPC_DIST_SCHEDULE_unknown);
827330f729Sjoerg   case OMPC_defaultmap:
837330f729Sjoerg     return llvm::StringSwitch<unsigned>(Str)
847330f729Sjoerg #define OPENMP_DEFAULTMAP_KIND(Name)                                           \
857330f729Sjoerg   .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
867330f729Sjoerg #define OPENMP_DEFAULTMAP_MODIFIER(Name)                                       \
877330f729Sjoerg   .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
887330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
897330f729Sjoerg         .Default(OMPC_DEFAULTMAP_unknown);
907330f729Sjoerg   case OMPC_atomic_default_mem_order:
917330f729Sjoerg      return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
927330f729Sjoerg #define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)       \
937330f729Sjoerg   .Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
947330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
957330f729Sjoerg         .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
967330f729Sjoerg   case OMPC_device_type:
977330f729Sjoerg     return llvm::StringSwitch<OpenMPDeviceType>(Str)
987330f729Sjoerg #define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
997330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
1007330f729Sjoerg         .Default(OMPC_DEVICE_TYPE_unknown);
101*e038c9c4Sjoerg   case OMPC_lastprivate:
102*e038c9c4Sjoerg     return llvm::StringSwitch<OpenMPLastprivateModifier>(Str)
103*e038c9c4Sjoerg #define OPENMP_LASTPRIVATE_KIND(Name) .Case(#Name, OMPC_LASTPRIVATE_##Name)
104*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
105*e038c9c4Sjoerg         .Default(OMPC_LASTPRIVATE_unknown);
106*e038c9c4Sjoerg   case OMPC_order:
107*e038c9c4Sjoerg     return llvm::StringSwitch<OpenMPOrderClauseKind>(Str)
108*e038c9c4Sjoerg #define OPENMP_ORDER_KIND(Name) .Case(#Name, OMPC_ORDER_##Name)
109*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
110*e038c9c4Sjoerg         .Default(OMPC_ORDER_unknown);
111*e038c9c4Sjoerg   case OMPC_update:
112*e038c9c4Sjoerg     return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
113*e038c9c4Sjoerg #define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
114*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
115*e038c9c4Sjoerg         .Default(OMPC_DEPEND_unknown);
116*e038c9c4Sjoerg   case OMPC_device:
117*e038c9c4Sjoerg     return llvm::StringSwitch<OpenMPDeviceClauseModifier>(Str)
118*e038c9c4Sjoerg #define OPENMP_DEVICE_MODIFIER(Name) .Case(#Name, OMPC_DEVICE_##Name)
119*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
120*e038c9c4Sjoerg         .Default(OMPC_DEVICE_unknown);
121*e038c9c4Sjoerg   case OMPC_reduction:
122*e038c9c4Sjoerg     return llvm::StringSwitch<OpenMPReductionClauseModifier>(Str)
123*e038c9c4Sjoerg #define OPENMP_REDUCTION_MODIFIER(Name) .Case(#Name, OMPC_REDUCTION_##Name)
124*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
125*e038c9c4Sjoerg         .Default(OMPC_REDUCTION_unknown);
1267330f729Sjoerg   case OMPC_unknown:
1277330f729Sjoerg   case OMPC_threadprivate:
1287330f729Sjoerg   case OMPC_if:
1297330f729Sjoerg   case OMPC_final:
1307330f729Sjoerg   case OMPC_num_threads:
1317330f729Sjoerg   case OMPC_safelen:
1327330f729Sjoerg   case OMPC_simdlen:
133*e038c9c4Sjoerg   case OMPC_sizes:
1347330f729Sjoerg   case OMPC_allocator:
1357330f729Sjoerg   case OMPC_allocate:
1367330f729Sjoerg   case OMPC_collapse:
1377330f729Sjoerg   case OMPC_private:
1387330f729Sjoerg   case OMPC_firstprivate:
1397330f729Sjoerg   case OMPC_shared:
1407330f729Sjoerg   case OMPC_task_reduction:
1417330f729Sjoerg   case OMPC_in_reduction:
1427330f729Sjoerg   case OMPC_aligned:
1437330f729Sjoerg   case OMPC_copyin:
1447330f729Sjoerg   case OMPC_copyprivate:
1457330f729Sjoerg   case OMPC_ordered:
1467330f729Sjoerg   case OMPC_nowait:
1477330f729Sjoerg   case OMPC_untied:
1487330f729Sjoerg   case OMPC_mergeable:
1497330f729Sjoerg   case OMPC_flush:
150*e038c9c4Sjoerg   case OMPC_depobj:
1517330f729Sjoerg   case OMPC_read:
1527330f729Sjoerg   case OMPC_write:
1537330f729Sjoerg   case OMPC_capture:
1547330f729Sjoerg   case OMPC_seq_cst:
155*e038c9c4Sjoerg   case OMPC_acq_rel:
156*e038c9c4Sjoerg   case OMPC_acquire:
157*e038c9c4Sjoerg   case OMPC_release:
158*e038c9c4Sjoerg   case OMPC_relaxed:
1597330f729Sjoerg   case OMPC_threads:
1607330f729Sjoerg   case OMPC_simd:
1617330f729Sjoerg   case OMPC_num_teams:
1627330f729Sjoerg   case OMPC_thread_limit:
1637330f729Sjoerg   case OMPC_priority:
1647330f729Sjoerg   case OMPC_grainsize:
1657330f729Sjoerg   case OMPC_nogroup:
1667330f729Sjoerg   case OMPC_num_tasks:
1677330f729Sjoerg   case OMPC_hint:
1687330f729Sjoerg   case OMPC_uniform:
1697330f729Sjoerg   case OMPC_use_device_ptr:
170*e038c9c4Sjoerg   case OMPC_use_device_addr:
1717330f729Sjoerg   case OMPC_is_device_ptr:
1727330f729Sjoerg   case OMPC_unified_address:
1737330f729Sjoerg   case OMPC_unified_shared_memory:
1747330f729Sjoerg   case OMPC_reverse_offload:
1757330f729Sjoerg   case OMPC_dynamic_allocators:
1767330f729Sjoerg   case OMPC_match:
177*e038c9c4Sjoerg   case OMPC_nontemporal:
178*e038c9c4Sjoerg   case OMPC_destroy:
179*e038c9c4Sjoerg   case OMPC_novariants:
180*e038c9c4Sjoerg   case OMPC_nocontext:
181*e038c9c4Sjoerg   case OMPC_detach:
182*e038c9c4Sjoerg   case OMPC_inclusive:
183*e038c9c4Sjoerg   case OMPC_exclusive:
184*e038c9c4Sjoerg   case OMPC_uses_allocators:
185*e038c9c4Sjoerg   case OMPC_affinity:
186*e038c9c4Sjoerg     break;
187*e038c9c4Sjoerg   default:
1887330f729Sjoerg     break;
1897330f729Sjoerg   }
1907330f729Sjoerg   llvm_unreachable("Invalid OpenMP simple clause kind");
1917330f729Sjoerg }
1927330f729Sjoerg 
getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,unsigned Type)1937330f729Sjoerg const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
1947330f729Sjoerg                                                  unsigned Type) {
1957330f729Sjoerg   switch (Kind) {
1967330f729Sjoerg   case OMPC_default:
197*e038c9c4Sjoerg     switch (llvm::omp::DefaultKind(Type)) {
198*e038c9c4Sjoerg #define OMP_DEFAULT_KIND(Enum, Name)                                           \
199*e038c9c4Sjoerg   case Enum:                                                                   \
200*e038c9c4Sjoerg     return Name;
201*e038c9c4Sjoerg #include "llvm/Frontend/OpenMP/OMPKinds.def"
2027330f729Sjoerg     }
2037330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'default' clause type");
2047330f729Sjoerg   case OMPC_proc_bind:
2057330f729Sjoerg     switch (Type) {
206*e038c9c4Sjoerg #define OMP_PROC_BIND_KIND(Enum, Name, Value)                                  \
207*e038c9c4Sjoerg   case Value:                                                                  \
208*e038c9c4Sjoerg     return Name;
209*e038c9c4Sjoerg #include "llvm/Frontend/OpenMP/OMPKinds.def"
2107330f729Sjoerg     }
2117330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'proc_bind' clause type");
2127330f729Sjoerg   case OMPC_schedule:
2137330f729Sjoerg     switch (Type) {
2147330f729Sjoerg     case OMPC_SCHEDULE_unknown:
2157330f729Sjoerg     case OMPC_SCHEDULE_MODIFIER_last:
2167330f729Sjoerg       return "unknown";
2177330f729Sjoerg #define OPENMP_SCHEDULE_KIND(Name)                                             \
2187330f729Sjoerg     case OMPC_SCHEDULE_##Name:                                                 \
2197330f729Sjoerg       return #Name;
2207330f729Sjoerg #define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
2217330f729Sjoerg     case OMPC_SCHEDULE_MODIFIER_##Name:                                        \
2227330f729Sjoerg       return #Name;
2237330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
2247330f729Sjoerg     }
2257330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'schedule' clause type");
2267330f729Sjoerg   case OMPC_depend:
2277330f729Sjoerg     switch (Type) {
2287330f729Sjoerg     case OMPC_DEPEND_unknown:
2297330f729Sjoerg       return "unknown";
2307330f729Sjoerg #define OPENMP_DEPEND_KIND(Name)                                             \
2317330f729Sjoerg   case OMPC_DEPEND_##Name:                                                   \
2327330f729Sjoerg     return #Name;
2337330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
2347330f729Sjoerg     }
2357330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'depend' clause type");
2367330f729Sjoerg   case OMPC_linear:
2377330f729Sjoerg     switch (Type) {
2387330f729Sjoerg     case OMPC_LINEAR_unknown:
2397330f729Sjoerg       return "unknown";
2407330f729Sjoerg #define OPENMP_LINEAR_KIND(Name)                                             \
2417330f729Sjoerg   case OMPC_LINEAR_##Name:                                                   \
2427330f729Sjoerg     return #Name;
2437330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
2447330f729Sjoerg     }
2457330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'linear' clause type");
2467330f729Sjoerg   case OMPC_map:
2477330f729Sjoerg     switch (Type) {
2487330f729Sjoerg     case OMPC_MAP_unknown:
2497330f729Sjoerg     case OMPC_MAP_MODIFIER_last:
2507330f729Sjoerg       return "unknown";
2517330f729Sjoerg #define OPENMP_MAP_KIND(Name)                                                \
2527330f729Sjoerg   case OMPC_MAP_##Name:                                                      \
2537330f729Sjoerg     return #Name;
2547330f729Sjoerg #define OPENMP_MAP_MODIFIER_KIND(Name)                                       \
2557330f729Sjoerg   case OMPC_MAP_MODIFIER_##Name:                                             \
2567330f729Sjoerg     return #Name;
2577330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
2587330f729Sjoerg     default:
2597330f729Sjoerg       break;
2607330f729Sjoerg     }
2617330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'map' clause type");
2627330f729Sjoerg   case OMPC_to:
2637330f729Sjoerg   case OMPC_from:
2647330f729Sjoerg     switch (Type) {
265*e038c9c4Sjoerg     case OMPC_MOTION_MODIFIER_unknown:
2667330f729Sjoerg       return "unknown";
267*e038c9c4Sjoerg #define OPENMP_MOTION_MODIFIER_KIND(Name)                                      \
268*e038c9c4Sjoerg   case OMPC_MOTION_MODIFIER_##Name:                                            \
2697330f729Sjoerg     return #Name;
2707330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
2717330f729Sjoerg     default:
2727330f729Sjoerg       break;
2737330f729Sjoerg     }
274*e038c9c4Sjoerg     llvm_unreachable("Invalid OpenMP 'to' or 'from' clause type");
2757330f729Sjoerg   case OMPC_dist_schedule:
2767330f729Sjoerg     switch (Type) {
2777330f729Sjoerg     case OMPC_DIST_SCHEDULE_unknown:
2787330f729Sjoerg       return "unknown";
2797330f729Sjoerg #define OPENMP_DIST_SCHEDULE_KIND(Name)                                      \
2807330f729Sjoerg   case OMPC_DIST_SCHEDULE_##Name:                                            \
2817330f729Sjoerg     return #Name;
2827330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
2837330f729Sjoerg     }
2847330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'dist_schedule' clause type");
2857330f729Sjoerg   case OMPC_defaultmap:
2867330f729Sjoerg     switch (Type) {
2877330f729Sjoerg     case OMPC_DEFAULTMAP_unknown:
2887330f729Sjoerg     case OMPC_DEFAULTMAP_MODIFIER_last:
2897330f729Sjoerg       return "unknown";
2907330f729Sjoerg #define OPENMP_DEFAULTMAP_KIND(Name)                                         \
2917330f729Sjoerg     case OMPC_DEFAULTMAP_##Name:                                             \
2927330f729Sjoerg       return #Name;
2937330f729Sjoerg #define OPENMP_DEFAULTMAP_MODIFIER(Name)                                     \
2947330f729Sjoerg     case OMPC_DEFAULTMAP_MODIFIER_##Name:                                    \
2957330f729Sjoerg       return #Name;
2967330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
2977330f729Sjoerg     }
2987330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'schedule' clause type");
2997330f729Sjoerg   case OMPC_atomic_default_mem_order:
3007330f729Sjoerg     switch (Type) {
3017330f729Sjoerg     case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
3027330f729Sjoerg       return "unknown";
3037330f729Sjoerg #define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)                           \
3047330f729Sjoerg     case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name:                               \
3057330f729Sjoerg       return #Name;
3067330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
3077330f729Sjoerg }
3087330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type");
3097330f729Sjoerg   case OMPC_device_type:
3107330f729Sjoerg     switch (Type) {
3117330f729Sjoerg     case OMPC_DEVICE_TYPE_unknown:
3127330f729Sjoerg       return "unknown";
3137330f729Sjoerg #define OPENMP_DEVICE_TYPE_KIND(Name)                                          \
3147330f729Sjoerg     case OMPC_DEVICE_TYPE_##Name:                                              \
3157330f729Sjoerg       return #Name;
3167330f729Sjoerg #include "clang/Basic/OpenMPKinds.def"
3177330f729Sjoerg     }
3187330f729Sjoerg     llvm_unreachable("Invalid OpenMP 'device_type' clause type");
319*e038c9c4Sjoerg   case OMPC_lastprivate:
320*e038c9c4Sjoerg     switch (Type) {
321*e038c9c4Sjoerg     case OMPC_LASTPRIVATE_unknown:
322*e038c9c4Sjoerg       return "unknown";
323*e038c9c4Sjoerg #define OPENMP_LASTPRIVATE_KIND(Name)                                          \
324*e038c9c4Sjoerg     case OMPC_LASTPRIVATE_##Name:                                              \
325*e038c9c4Sjoerg       return #Name;
326*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
327*e038c9c4Sjoerg     }
328*e038c9c4Sjoerg     llvm_unreachable("Invalid OpenMP 'lastprivate' clause type");
329*e038c9c4Sjoerg   case OMPC_order:
330*e038c9c4Sjoerg     switch (Type) {
331*e038c9c4Sjoerg     case OMPC_ORDER_unknown:
332*e038c9c4Sjoerg       return "unknown";
333*e038c9c4Sjoerg #define OPENMP_ORDER_KIND(Name)                                                \
334*e038c9c4Sjoerg     case OMPC_ORDER_##Name:                                                    \
335*e038c9c4Sjoerg       return #Name;
336*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
337*e038c9c4Sjoerg     }
338*e038c9c4Sjoerg     llvm_unreachable("Invalid OpenMP 'order' clause type");
339*e038c9c4Sjoerg   case OMPC_update:
340*e038c9c4Sjoerg     switch (Type) {
341*e038c9c4Sjoerg     case OMPC_DEPEND_unknown:
342*e038c9c4Sjoerg       return "unknown";
343*e038c9c4Sjoerg #define OPENMP_DEPEND_KIND(Name)                                               \
344*e038c9c4Sjoerg   case OMPC_DEPEND_##Name:                                                     \
345*e038c9c4Sjoerg     return #Name;
346*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
347*e038c9c4Sjoerg     }
348*e038c9c4Sjoerg     llvm_unreachable("Invalid OpenMP 'depend' clause type");
349*e038c9c4Sjoerg   case OMPC_device:
350*e038c9c4Sjoerg     switch (Type) {
351*e038c9c4Sjoerg     case OMPC_DEVICE_unknown:
352*e038c9c4Sjoerg       return "unknown";
353*e038c9c4Sjoerg #define OPENMP_DEVICE_MODIFIER(Name)                                           \
354*e038c9c4Sjoerg   case OMPC_DEVICE_##Name:                                                     \
355*e038c9c4Sjoerg     return #Name;
356*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
357*e038c9c4Sjoerg     }
358*e038c9c4Sjoerg     llvm_unreachable("Invalid OpenMP 'device' clause modifier");
359*e038c9c4Sjoerg   case OMPC_reduction:
360*e038c9c4Sjoerg     switch (Type) {
361*e038c9c4Sjoerg     case OMPC_REDUCTION_unknown:
362*e038c9c4Sjoerg       return "unknown";
363*e038c9c4Sjoerg #define OPENMP_REDUCTION_MODIFIER(Name)                                        \
364*e038c9c4Sjoerg   case OMPC_REDUCTION_##Name:                                                  \
365*e038c9c4Sjoerg     return #Name;
366*e038c9c4Sjoerg #include "clang/Basic/OpenMPKinds.def"
367*e038c9c4Sjoerg     }
368*e038c9c4Sjoerg     llvm_unreachable("Invalid OpenMP 'reduction' clause modifier");
3697330f729Sjoerg   case OMPC_unknown:
3707330f729Sjoerg   case OMPC_threadprivate:
3717330f729Sjoerg   case OMPC_if:
3727330f729Sjoerg   case OMPC_final:
3737330f729Sjoerg   case OMPC_num_threads:
3747330f729Sjoerg   case OMPC_safelen:
3757330f729Sjoerg   case OMPC_simdlen:
376*e038c9c4Sjoerg   case OMPC_sizes:
3777330f729Sjoerg   case OMPC_allocator:
3787330f729Sjoerg   case OMPC_allocate:
3797330f729Sjoerg   case OMPC_collapse:
3807330f729Sjoerg   case OMPC_private:
3817330f729Sjoerg   case OMPC_firstprivate:
3827330f729Sjoerg   case OMPC_shared:
3837330f729Sjoerg   case OMPC_task_reduction:
3847330f729Sjoerg   case OMPC_in_reduction:
3857330f729Sjoerg   case OMPC_aligned:
3867330f729Sjoerg   case OMPC_copyin:
3877330f729Sjoerg   case OMPC_copyprivate:
3887330f729Sjoerg   case OMPC_ordered:
3897330f729Sjoerg   case OMPC_nowait:
3907330f729Sjoerg   case OMPC_untied:
3917330f729Sjoerg   case OMPC_mergeable:
3927330f729Sjoerg   case OMPC_flush:
393*e038c9c4Sjoerg   case OMPC_depobj:
3947330f729Sjoerg   case OMPC_read:
3957330f729Sjoerg   case OMPC_write:
3967330f729Sjoerg   case OMPC_capture:
3977330f729Sjoerg   case OMPC_seq_cst:
398*e038c9c4Sjoerg   case OMPC_acq_rel:
399*e038c9c4Sjoerg   case OMPC_acquire:
400*e038c9c4Sjoerg   case OMPC_release:
401*e038c9c4Sjoerg   case OMPC_relaxed:
4027330f729Sjoerg   case OMPC_threads:
4037330f729Sjoerg   case OMPC_simd:
4047330f729Sjoerg   case OMPC_num_teams:
4057330f729Sjoerg   case OMPC_thread_limit:
4067330f729Sjoerg   case OMPC_priority:
4077330f729Sjoerg   case OMPC_grainsize:
4087330f729Sjoerg   case OMPC_nogroup:
4097330f729Sjoerg   case OMPC_num_tasks:
4107330f729Sjoerg   case OMPC_hint:
4117330f729Sjoerg   case OMPC_uniform:
4127330f729Sjoerg   case OMPC_use_device_ptr:
413*e038c9c4Sjoerg   case OMPC_use_device_addr:
4147330f729Sjoerg   case OMPC_is_device_ptr:
4157330f729Sjoerg   case OMPC_unified_address:
4167330f729Sjoerg   case OMPC_unified_shared_memory:
4177330f729Sjoerg   case OMPC_reverse_offload:
4187330f729Sjoerg   case OMPC_dynamic_allocators:
4197330f729Sjoerg   case OMPC_match:
420*e038c9c4Sjoerg   case OMPC_nontemporal:
421*e038c9c4Sjoerg   case OMPC_destroy:
422*e038c9c4Sjoerg   case OMPC_detach:
423*e038c9c4Sjoerg   case OMPC_novariants:
424*e038c9c4Sjoerg   case OMPC_nocontext:
425*e038c9c4Sjoerg   case OMPC_inclusive:
426*e038c9c4Sjoerg   case OMPC_exclusive:
427*e038c9c4Sjoerg   case OMPC_uses_allocators:
428*e038c9c4Sjoerg   case OMPC_affinity:
429*e038c9c4Sjoerg     break;
430*e038c9c4Sjoerg   default:
4317330f729Sjoerg     break;
4327330f729Sjoerg   }
4337330f729Sjoerg   llvm_unreachable("Invalid OpenMP simple clause kind");
4347330f729Sjoerg }
4357330f729Sjoerg 
isOpenMPLoopDirective(OpenMPDirectiveKind DKind)4367330f729Sjoerg bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
4377330f729Sjoerg   return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
4387330f729Sjoerg          DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
4397330f729Sjoerg          DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
4407330f729Sjoerg          DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
441*e038c9c4Sjoerg          DKind == OMPD_parallel_master_taskloop ||
442*e038c9c4Sjoerg          DKind == OMPD_parallel_master_taskloop_simd ||
443*e038c9c4Sjoerg          DKind == OMPD_distribute || DKind == OMPD_target_parallel_for ||
4447330f729Sjoerg          DKind == OMPD_distribute_parallel_for ||
4457330f729Sjoerg          DKind == OMPD_distribute_parallel_for_simd ||
4467330f729Sjoerg          DKind == OMPD_distribute_simd ||
4477330f729Sjoerg          DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
4487330f729Sjoerg          DKind == OMPD_teams_distribute ||
4497330f729Sjoerg          DKind == OMPD_teams_distribute_simd ||
4507330f729Sjoerg          DKind == OMPD_teams_distribute_parallel_for_simd ||
4517330f729Sjoerg          DKind == OMPD_teams_distribute_parallel_for ||
4527330f729Sjoerg          DKind == OMPD_target_teams_distribute ||
4537330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for ||
4547330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for_simd ||
455*e038c9c4Sjoerg          DKind == OMPD_target_teams_distribute_simd || DKind == OMPD_tile;
4567330f729Sjoerg }
4577330f729Sjoerg 
isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)4587330f729Sjoerg bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
4597330f729Sjoerg   return DKind == OMPD_for || DKind == OMPD_for_simd ||
4607330f729Sjoerg          DKind == OMPD_sections || DKind == OMPD_section ||
4617330f729Sjoerg          DKind == OMPD_single || DKind == OMPD_parallel_for ||
4627330f729Sjoerg          DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
4637330f729Sjoerg          DKind == OMPD_target_parallel_for ||
4647330f729Sjoerg          DKind == OMPD_distribute_parallel_for ||
4657330f729Sjoerg          DKind == OMPD_distribute_parallel_for_simd ||
4667330f729Sjoerg          DKind == OMPD_target_parallel_for_simd ||
4677330f729Sjoerg          DKind == OMPD_teams_distribute_parallel_for_simd ||
4687330f729Sjoerg          DKind == OMPD_teams_distribute_parallel_for ||
4697330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for ||
4707330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for_simd;
4717330f729Sjoerg }
4727330f729Sjoerg 
isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)4737330f729Sjoerg bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
4747330f729Sjoerg   return DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
4757330f729Sjoerg          DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
476*e038c9c4Sjoerg          DKind == OMPD_parallel_master_taskloop ||
477*e038c9c4Sjoerg          DKind == OMPD_parallel_master_taskloop_simd;
4787330f729Sjoerg }
4797330f729Sjoerg 
isOpenMPParallelDirective(OpenMPDirectiveKind DKind)4807330f729Sjoerg bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
4817330f729Sjoerg   return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
4827330f729Sjoerg          DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
4837330f729Sjoerg          DKind == OMPD_target_parallel || DKind == OMPD_target_parallel_for ||
4847330f729Sjoerg          DKind == OMPD_distribute_parallel_for ||
4857330f729Sjoerg          DKind == OMPD_distribute_parallel_for_simd ||
4867330f729Sjoerg          DKind == OMPD_target_parallel_for_simd ||
4877330f729Sjoerg          DKind == OMPD_teams_distribute_parallel_for ||
4887330f729Sjoerg          DKind == OMPD_teams_distribute_parallel_for_simd ||
4897330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for ||
4907330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for_simd ||
491*e038c9c4Sjoerg          DKind == OMPD_parallel_master ||
492*e038c9c4Sjoerg          DKind == OMPD_parallel_master_taskloop ||
493*e038c9c4Sjoerg          DKind == OMPD_parallel_master_taskloop_simd;
4947330f729Sjoerg }
4957330f729Sjoerg 
isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind)4967330f729Sjoerg bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
4977330f729Sjoerg   return DKind == OMPD_target || DKind == OMPD_target_parallel ||
4987330f729Sjoerg          DKind == OMPD_target_parallel_for ||
4997330f729Sjoerg          DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
5007330f729Sjoerg          DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
5017330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for ||
5027330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for_simd ||
5037330f729Sjoerg          DKind == OMPD_target_teams_distribute_simd;
5047330f729Sjoerg }
5057330f729Sjoerg 
isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind)5067330f729Sjoerg bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
5077330f729Sjoerg   return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
5087330f729Sjoerg          DKind == OMPD_target_exit_data || DKind == OMPD_target_update;
5097330f729Sjoerg }
5107330f729Sjoerg 
isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind)5117330f729Sjoerg bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
5127330f729Sjoerg   return DKind == OMPD_teams || DKind == OMPD_teams_distribute ||
5137330f729Sjoerg          DKind == OMPD_teams_distribute_simd ||
5147330f729Sjoerg          DKind == OMPD_teams_distribute_parallel_for_simd ||
5157330f729Sjoerg          DKind == OMPD_teams_distribute_parallel_for;
5167330f729Sjoerg }
5177330f729Sjoerg 
isOpenMPTeamsDirective(OpenMPDirectiveKind DKind)5187330f729Sjoerg bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
5197330f729Sjoerg   return isOpenMPNestingTeamsDirective(DKind) ||
5207330f729Sjoerg          DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
5217330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for ||
5227330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for_simd ||
5237330f729Sjoerg          DKind == OMPD_target_teams_distribute_simd;
5247330f729Sjoerg }
5257330f729Sjoerg 
isOpenMPSimdDirective(OpenMPDirectiveKind DKind)5267330f729Sjoerg bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
5277330f729Sjoerg   return DKind == OMPD_simd || DKind == OMPD_for_simd ||
5287330f729Sjoerg          DKind == OMPD_parallel_for_simd || DKind == OMPD_taskloop_simd ||
5297330f729Sjoerg          DKind == OMPD_master_taskloop_simd ||
530*e038c9c4Sjoerg          DKind == OMPD_parallel_master_taskloop_simd ||
5317330f729Sjoerg          DKind == OMPD_distribute_parallel_for_simd ||
5327330f729Sjoerg          DKind == OMPD_distribute_simd || DKind == OMPD_target_simd ||
5337330f729Sjoerg          DKind == OMPD_teams_distribute_simd ||
5347330f729Sjoerg          DKind == OMPD_teams_distribute_parallel_for_simd ||
5357330f729Sjoerg          DKind == OMPD_target_teams_distribute_parallel_for_simd ||
5367330f729Sjoerg          DKind == OMPD_target_teams_distribute_simd ||
5377330f729Sjoerg          DKind == OMPD_target_parallel_for_simd;
5387330f729Sjoerg }
5397330f729Sjoerg 
isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind)5407330f729Sjoerg bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
5417330f729Sjoerg   return Kind == OMPD_distribute || Kind == OMPD_distribute_parallel_for ||
5427330f729Sjoerg          Kind == OMPD_distribute_parallel_for_simd ||
5437330f729Sjoerg          Kind == OMPD_distribute_simd;
5447330f729Sjoerg   // TODO add next directives.
5457330f729Sjoerg }
5467330f729Sjoerg 
isOpenMPDistributeDirective(OpenMPDirectiveKind Kind)5477330f729Sjoerg bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
5487330f729Sjoerg   return isOpenMPNestingDistributeDirective(Kind) ||
5497330f729Sjoerg          Kind == OMPD_teams_distribute || Kind == OMPD_teams_distribute_simd ||
5507330f729Sjoerg          Kind == OMPD_teams_distribute_parallel_for_simd ||
5517330f729Sjoerg          Kind == OMPD_teams_distribute_parallel_for ||
5527330f729Sjoerg          Kind == OMPD_target_teams_distribute ||
5537330f729Sjoerg          Kind == OMPD_target_teams_distribute_parallel_for ||
5547330f729Sjoerg          Kind == OMPD_target_teams_distribute_parallel_for_simd ||
5557330f729Sjoerg          Kind == OMPD_target_teams_distribute_simd;
5567330f729Sjoerg }
5577330f729Sjoerg 
isOpenMPPrivate(OpenMPClauseKind Kind)5587330f729Sjoerg bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
5597330f729Sjoerg   return Kind == OMPC_private || Kind == OMPC_firstprivate ||
5607330f729Sjoerg          Kind == OMPC_lastprivate || Kind == OMPC_linear ||
5617330f729Sjoerg          Kind == OMPC_reduction || Kind == OMPC_task_reduction ||
5627330f729Sjoerg          Kind == OMPC_in_reduction; // TODO add next clauses like 'reduction'.
5637330f729Sjoerg }
5647330f729Sjoerg 
isOpenMPThreadPrivate(OpenMPClauseKind Kind)5657330f729Sjoerg bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
5667330f729Sjoerg   return Kind == OMPC_threadprivate || Kind == OMPC_copyin;
5677330f729Sjoerg }
5687330f729Sjoerg 
isOpenMPTaskingDirective(OpenMPDirectiveKind Kind)5697330f729Sjoerg bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
5707330f729Sjoerg   return Kind == OMPD_task || isOpenMPTaskLoopDirective(Kind);
5717330f729Sjoerg }
5727330f729Sjoerg 
isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)5737330f729Sjoerg bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
5747330f729Sjoerg   return Kind == OMPD_distribute_parallel_for ||
5757330f729Sjoerg          Kind == OMPD_distribute_parallel_for_simd ||
5767330f729Sjoerg          Kind == OMPD_teams_distribute_parallel_for_simd ||
5777330f729Sjoerg          Kind == OMPD_teams_distribute_parallel_for ||
5787330f729Sjoerg          Kind == OMPD_target_teams_distribute_parallel_for ||
5797330f729Sjoerg          Kind == OMPD_target_teams_distribute_parallel_for_simd;
5807330f729Sjoerg }
5817330f729Sjoerg 
isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind)582*e038c9c4Sjoerg bool clang::isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind) {
583*e038c9c4Sjoerg   return DKind == OMPD_tile;
584*e038c9c4Sjoerg }
585*e038c9c4Sjoerg 
getOpenMPCaptureRegions(SmallVectorImpl<OpenMPDirectiveKind> & CaptureRegions,OpenMPDirectiveKind DKind)5867330f729Sjoerg void clang::getOpenMPCaptureRegions(
5877330f729Sjoerg     SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
5887330f729Sjoerg     OpenMPDirectiveKind DKind) {
589*e038c9c4Sjoerg   assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
5907330f729Sjoerg   switch (DKind) {
5917330f729Sjoerg   case OMPD_parallel:
5927330f729Sjoerg   case OMPD_parallel_for:
5937330f729Sjoerg   case OMPD_parallel_for_simd:
594*e038c9c4Sjoerg   case OMPD_parallel_master:
5957330f729Sjoerg   case OMPD_parallel_sections:
5967330f729Sjoerg   case OMPD_distribute_parallel_for:
5977330f729Sjoerg   case OMPD_distribute_parallel_for_simd:
5987330f729Sjoerg     CaptureRegions.push_back(OMPD_parallel);
5997330f729Sjoerg     break;
6007330f729Sjoerg   case OMPD_target_teams:
6017330f729Sjoerg   case OMPD_target_teams_distribute:
6027330f729Sjoerg   case OMPD_target_teams_distribute_simd:
6037330f729Sjoerg     CaptureRegions.push_back(OMPD_task);
6047330f729Sjoerg     CaptureRegions.push_back(OMPD_target);
6057330f729Sjoerg     CaptureRegions.push_back(OMPD_teams);
6067330f729Sjoerg     break;
6077330f729Sjoerg   case OMPD_teams:
6087330f729Sjoerg   case OMPD_teams_distribute:
6097330f729Sjoerg   case OMPD_teams_distribute_simd:
6107330f729Sjoerg     CaptureRegions.push_back(OMPD_teams);
6117330f729Sjoerg     break;
6127330f729Sjoerg   case OMPD_target:
6137330f729Sjoerg   case OMPD_target_simd:
6147330f729Sjoerg     CaptureRegions.push_back(OMPD_task);
6157330f729Sjoerg     CaptureRegions.push_back(OMPD_target);
6167330f729Sjoerg     break;
6177330f729Sjoerg   case OMPD_teams_distribute_parallel_for:
6187330f729Sjoerg   case OMPD_teams_distribute_parallel_for_simd:
6197330f729Sjoerg     CaptureRegions.push_back(OMPD_teams);
6207330f729Sjoerg     CaptureRegions.push_back(OMPD_parallel);
6217330f729Sjoerg     break;
6227330f729Sjoerg   case OMPD_target_parallel:
6237330f729Sjoerg   case OMPD_target_parallel_for:
6247330f729Sjoerg   case OMPD_target_parallel_for_simd:
6257330f729Sjoerg     CaptureRegions.push_back(OMPD_task);
6267330f729Sjoerg     CaptureRegions.push_back(OMPD_target);
6277330f729Sjoerg     CaptureRegions.push_back(OMPD_parallel);
6287330f729Sjoerg     break;
6297330f729Sjoerg   case OMPD_task:
6307330f729Sjoerg   case OMPD_target_enter_data:
6317330f729Sjoerg   case OMPD_target_exit_data:
6327330f729Sjoerg   case OMPD_target_update:
6337330f729Sjoerg     CaptureRegions.push_back(OMPD_task);
6347330f729Sjoerg     break;
6357330f729Sjoerg   case OMPD_taskloop:
6367330f729Sjoerg   case OMPD_taskloop_simd:
6377330f729Sjoerg   case OMPD_master_taskloop:
6387330f729Sjoerg   case OMPD_master_taskloop_simd:
6397330f729Sjoerg     CaptureRegions.push_back(OMPD_taskloop);
6407330f729Sjoerg     break;
6417330f729Sjoerg   case OMPD_parallel_master_taskloop:
642*e038c9c4Sjoerg   case OMPD_parallel_master_taskloop_simd:
6437330f729Sjoerg     CaptureRegions.push_back(OMPD_parallel);
6447330f729Sjoerg     CaptureRegions.push_back(OMPD_taskloop);
6457330f729Sjoerg     break;
6467330f729Sjoerg   case OMPD_target_teams_distribute_parallel_for:
6477330f729Sjoerg   case OMPD_target_teams_distribute_parallel_for_simd:
6487330f729Sjoerg     CaptureRegions.push_back(OMPD_task);
6497330f729Sjoerg     CaptureRegions.push_back(OMPD_target);
6507330f729Sjoerg     CaptureRegions.push_back(OMPD_teams);
6517330f729Sjoerg     CaptureRegions.push_back(OMPD_parallel);
6527330f729Sjoerg     break;
6537330f729Sjoerg   case OMPD_simd:
6547330f729Sjoerg   case OMPD_for:
6557330f729Sjoerg   case OMPD_for_simd:
6567330f729Sjoerg   case OMPD_sections:
6577330f729Sjoerg   case OMPD_section:
6587330f729Sjoerg   case OMPD_single:
6597330f729Sjoerg   case OMPD_master:
6607330f729Sjoerg   case OMPD_critical:
6617330f729Sjoerg   case OMPD_taskgroup:
6627330f729Sjoerg   case OMPD_distribute:
6637330f729Sjoerg   case OMPD_ordered:
6647330f729Sjoerg   case OMPD_atomic:
6657330f729Sjoerg   case OMPD_target_data:
6667330f729Sjoerg   case OMPD_distribute_simd:
667*e038c9c4Sjoerg   case OMPD_dispatch:
6687330f729Sjoerg     CaptureRegions.push_back(OMPD_unknown);
6697330f729Sjoerg     break;
670*e038c9c4Sjoerg   case OMPD_tile:
671*e038c9c4Sjoerg     // loop transformations do not introduce captures.
672*e038c9c4Sjoerg     break;
6737330f729Sjoerg   case OMPD_threadprivate:
6747330f729Sjoerg   case OMPD_allocate:
6757330f729Sjoerg   case OMPD_taskyield:
6767330f729Sjoerg   case OMPD_barrier:
6777330f729Sjoerg   case OMPD_taskwait:
6787330f729Sjoerg   case OMPD_cancellation_point:
6797330f729Sjoerg   case OMPD_cancel:
6807330f729Sjoerg   case OMPD_flush:
681*e038c9c4Sjoerg   case OMPD_depobj:
682*e038c9c4Sjoerg   case OMPD_scan:
6837330f729Sjoerg   case OMPD_declare_reduction:
6847330f729Sjoerg   case OMPD_declare_mapper:
6857330f729Sjoerg   case OMPD_declare_simd:
6867330f729Sjoerg   case OMPD_declare_target:
6877330f729Sjoerg   case OMPD_end_declare_target:
6887330f729Sjoerg   case OMPD_requires:
6897330f729Sjoerg   case OMPD_declare_variant:
690*e038c9c4Sjoerg   case OMPD_begin_declare_variant:
691*e038c9c4Sjoerg   case OMPD_end_declare_variant:
6927330f729Sjoerg     llvm_unreachable("OpenMP Directive is not allowed");
6937330f729Sjoerg   case OMPD_unknown:
694*e038c9c4Sjoerg   default:
6957330f729Sjoerg     llvm_unreachable("Unknown OpenMP directive");
6967330f729Sjoerg   }
6977330f729Sjoerg }
698