1 //===- OMPConstants.h - OpenMP related constants and helpers ------ C++ -*-===// 2 // 3 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 /// \file 9 /// 10 /// This file defines constans and helpers used when dealing with OpenMP. 11 /// 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_FRONTEND_OPENMP_OMPCONSTANTS_H 15 #define LLVM_FRONTEND_OPENMP_OMPCONSTANTS_H 16 17 #include "llvm/ADT/BitmaskEnum.h" 18 19 #include "llvm/ADT/StringRef.h" 20 #include "llvm/Frontend/OpenMP/OMP.h.inc" 21 22 namespace llvm { 23 namespace omp { 24 LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); 25 26 /// IDs for all Internal Control Variables (ICVs). 27 enum class InternalControlVar { 28 #define ICV_DATA_ENV(Enum, ...) Enum, 29 #include "llvm/Frontend/OpenMP/OMPKinds.def" 30 }; 31 32 #define ICV_DATA_ENV(Enum, ...) \ 33 constexpr auto Enum = omp::InternalControlVar::Enum; 34 #include "llvm/Frontend/OpenMP/OMPKinds.def" 35 36 enum class ICVInitValue { 37 #define ICV_INIT_VALUE(Enum, Name) Enum, 38 #include "llvm/Frontend/OpenMP/OMPKinds.def" 39 }; 40 41 #define ICV_INIT_VALUE(Enum, Name) \ 42 constexpr auto Enum = omp::ICVInitValue::Enum; 43 #include "llvm/Frontend/OpenMP/OMPKinds.def" 44 45 /// IDs for all omp runtime library (RTL) functions. 46 enum class RuntimeFunction { 47 #define OMP_RTL(Enum, ...) Enum, 48 #include "llvm/Frontend/OpenMP/OMPKinds.def" 49 }; 50 51 #define OMP_RTL(Enum, ...) constexpr auto Enum = omp::RuntimeFunction::Enum; 52 #include "llvm/Frontend/OpenMP/OMPKinds.def" 53 54 /// IDs for the different default kinds. 55 enum class DefaultKind { 56 #define OMP_DEFAULT_KIND(Enum, Str) Enum, 57 #include "llvm/Frontend/OpenMP/OMPKinds.def" 58 }; 59 60 #define OMP_DEFAULT_KIND(Enum, ...) \ 61 constexpr auto Enum = omp::DefaultKind::Enum; 62 #include "llvm/Frontend/OpenMP/OMPKinds.def" 63 64 /// IDs for all omp runtime library ident_t flag encodings (see 65 /// their defintion in openmp/runtime/src/kmp.h). 66 enum class IdentFlag { 67 #define OMP_IDENT_FLAG(Enum, Str, Value) Enum = Value, 68 #include "llvm/Frontend/OpenMP/OMPKinds.def" 69 LLVM_MARK_AS_BITMASK_ENUM(0x7FFFFFFF) 70 }; 71 72 #define OMP_IDENT_FLAG(Enum, ...) constexpr auto Enum = omp::IdentFlag::Enum; 73 #include "llvm/Frontend/OpenMP/OMPKinds.def" 74 75 /// \note This needs to be kept in sync with kmp.h enum sched_type. 76 /// Todo: Update kmp.h to include this file, and remove the enums in kmp.h 77 /// To complete this, more enum values will need to be moved here. 78 enum class OMPScheduleType { 79 StaticChunked = 33, 80 Static = 34, // static unspecialized 81 DistributeChunked = 91, 82 Distribute = 92, 83 DynamicChunked = 35, 84 GuidedChunked = 36, // guided unspecialized 85 Runtime = 37, 86 Auto = 38, // auto 87 88 StaticBalancedChunked = 45, // static with chunk adjustment (e.g., simd) 89 GuidedSimd = 46, // guided with chunk adjustment 90 RuntimeSimd = 47, // runtime with chunk adjustment 91 92 ModifierMonotonic = 93 (1 << 29), // Set if the monotonic schedule modifier was present 94 ModifierNonmonotonic = 95 (1 << 30), // Set if the nonmonotonic schedule modifier was present 96 ModifierMask = ModifierMonotonic | ModifierNonmonotonic, 97 LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue */ ModifierMask) 98 }; 99 100 enum OMPTgtExecModeFlags : int8_t { 101 OMP_TGT_EXEC_MODE_GENERIC = 1 << 0, 102 OMP_TGT_EXEC_MODE_SPMD = 1 << 1, 103 OMP_TGT_EXEC_MODE_GENERIC_SPMD = 104 OMP_TGT_EXEC_MODE_GENERIC | OMP_TGT_EXEC_MODE_SPMD, 105 LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue */ OMP_TGT_EXEC_MODE_GENERIC_SPMD) 106 }; 107 108 enum class AddressSpace : unsigned { 109 Generic = 0, 110 Global = 1, 111 Shared = 3, 112 Constant = 4, 113 Local = 5, 114 }; 115 116 /// \note This needs to be kept in sync with interop.h enum kmp_interop_type_t.: 117 enum class OMPInteropType { Unknown, Target, TargetSync }; 118 119 } // end namespace omp 120 121 } // end namespace llvm 122 123 #endif // LLVM_FRONTEND_OPENMP_OMPCONSTANTS_H 124