LLVM  16.0.0git
OMPConstants.h
Go to the documentation of this file.
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 {
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 enum class OMPScheduleType {
78  // For typed comparisons, not a valid schedule
79  None = 0,
80 
81  // Schedule algorithms
83  BaseStatic = 2,
86  BaseRuntime = 5,
87  BaseAuto = 6,
88  BaseTrapezoidal = 7,
89  BaseGreedy = 8,
90  BaseBalanced = 9,
93  BaseSteal = 12,
94 
95  // with chunk adjustment (e.g., simd)
97  BaseGuidedSimd = 14,
98  BaseRuntimeSimd = 15,
99 
100  // static schedules algorithims for distribute
102  BaseDistribute = 28,
103 
104  // Modifier flags to be combined with schedule algorithms
105  ModifierUnordered = (1 << 5),
106  ModifierOrdered = (1 << 6),
107  ModifierNomerge = (1 << 7),
108  ModifierMonotonic = (1 << 29),
109  ModifierNonmonotonic = (1 << 30),
110 
111  // Masks combining multiple flags
115 
116  // valid schedule type values, without monotonicity flags
131 
136 
144 
147 
171 
184 
185  LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue */ ModifierMask)
186 };
187 
188 enum OMPTgtExecModeFlags : int8_t {
194 };
195 
196 enum class AddressSpace : unsigned {
197  Generic = 0,
198  Global = 1,
199  Shared = 3,
200  Constant = 4,
201  Local = 5,
202 };
203 
204 /// \note This needs to be kept in sync with interop.h enum kmp_interop_type_t.:
206 
207 /// Atomic compare operations. Currently OpenMP only supports ==, >, and <.
208 enum class OMPAtomicCompareOp : unsigned { EQ, MIN, MAX };
209 
210 /// Fields ids in kmp_depend_info record.
212 
213 /// Dependence kind for RTL.
215  DepUnknown = 0x0,
216  DepIn = 0x01,
217  DepInOut = 0x3,
218  DepMutexInOutSet = 0x4,
219  DepInOutSet = 0x8,
220  DepOmpAllMem = 0x80,
221 };
222 
223 } // end namespace omp
224 
225 } // end namespace llvm
226 
227 #endif // LLVM_FRONTEND_OPENMP_OMPCONSTANTS_H
llvm::omp::OMPScheduleType::NomergeOrderedStatic
@ NomergeOrderedStatic
llvm::omp::OMPInteropType::Target
@ Target
llvm::omp::OMPScheduleType::BaseGuidedChunked
@ BaseGuidedChunked
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::omp::OMPScheduleType::NomergeOrderedRuntime
@ NomergeOrderedRuntime
llvm::omp::OMPScheduleType::NomergeUnorderedGuidedChunked
@ NomergeUnorderedGuidedChunked
LLVM_MARK_AS_BITMASK_ENUM
#define LLVM_MARK_AS_BITMASK_ENUM(LargestValue)
LLVM_MARK_AS_BITMASK_ENUM lets you opt in an individual enum type so you can perform bitwise operatio...
Definition: BitmaskEnum.h:41
StringRef.h
llvm::omp::OMPScheduleType::BaseGuidedAnalyticalChunked
@ BaseGuidedAnalyticalChunked
llvm::omp::OMPScheduleType::UnorderedDynamicChunked
@ UnorderedDynamicChunked
llvm::omp::OMPScheduleType::BaseTrapezoidal
@ BaseTrapezoidal
llvm::omp::OMPTgtExecModeFlags
OMPTgtExecModeFlags
Definition: OMPConstants.h:188
llvm::omp::OMPScheduleType::NomergeUnorderedSteal
@ NomergeUnorderedSteal
llvm::omp::OMPScheduleType::BaseDistribute
@ BaseDistribute
llvm::omp::OMPScheduleType::OrderdTrapezoidal
@ OrderdTrapezoidal
llvm::omp::OMPScheduleType::NomergeUnorderedRuntime
@ NomergeUnorderedRuntime
llvm::omp::RTLDependInfoFields
RTLDependInfoFields
Fields ids in kmp_depend_info record.
Definition: OMPConstants.h:211
llvm::omp::OMPScheduleType::NomergeUnorderedBalanced
@ NomergeUnorderedBalanced
llvm::omp::OMPScheduleType::NomergeOrderedTrapezoidal
@ NomergeOrderedTrapezoidal
llvm::omp::OMPScheduleType::UnorderedGreedy
@ UnorderedGreedy
llvm::omp::OMPScheduleType::BaseGreedy
@ BaseGreedy
llvm::omp::OMPScheduleType::UnorderedRuntimeSimd
@ UnorderedRuntimeSimd
llvm::omp::AddressSpace::Global
@ Global
llvm::omp::OMPScheduleType::UnorderedGuidedAnalyticalChunked
@ UnorderedGuidedAnalyticalChunked
llvm::omp::OMPScheduleType::BaseRuntimeSimd
@ BaseRuntimeSimd
llvm::omp::OMPScheduleType::ModifierNonmonotonic
@ ModifierNonmonotonic
llvm::omp::RTLDependenceKindTy::DepInOutSet
@ DepInOutSet
llvm::omp::OMPScheduleType::UnorderedSteal
@ UnorderedSteal
llvm::omp::OMPInteropType::TargetSync
@ TargetSync
llvm::omp::RTLDependenceKindTy::DepUnknown
@ DepUnknown
llvm::omp::OMPScheduleType::UnorderedGuidedChunked
@ UnorderedGuidedChunked
llvm::omp::OMPInteropType
OMPInteropType
Definition: OMPConstants.h:205
llvm::omp::OMPScheduleType::UnorderedAuto
@ UnorderedAuto
llvm::omp::OMPScheduleType::OrderedDistribute
@ OrderedDistribute
llvm::omp::OMP_TGT_EXEC_MODE_GENERIC
@ OMP_TGT_EXEC_MODE_GENERIC
Definition: OMPConstants.h:189
llvm::omp::OMPScheduleType::UnorderedRuntime
@ UnorderedRuntime
llvm::omp::LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
llvm::omp::OMPInteropType::Unknown
@ Unknown
llvm::omp::RTLDependInfoFields::BaseAddr
@ BaseAddr
llvm::omp::OMPScheduleType::ModifierMonotonic
@ ModifierMonotonic
llvm::omp::OMPScheduleType::NomergeUnorderedAuto
@ NomergeUnorderedAuto
llvm::omp::OMPAtomicCompareOp::EQ
@ EQ
llvm::omp::OMPScheduleType::BaseBalanced
@ BaseBalanced
llvm::omp::IdentFlag
IdentFlag
IDs for all omp runtime library ident_t flag encodings (see their defintion in openmp/runtime/src/kmp...
Definition: OMPConstants.h:66
llvm::omp::OMPScheduleType::NomergeUnorderedStatic
@ NomergeUnorderedStatic
llvm::omp::OMPAtomicCompareOp::MAX
@ MAX
llvm::omp::RTLDependInfoFields::Len
@ Len
llvm::omp::InternalControlVar
InternalControlVar
IDs for all Internal Control Variables (ICVs).
Definition: OMPConstants.h:27
llvm::omp::OMPScheduleType::NomergeOrderedGuidedChunked
@ NomergeOrderedGuidedChunked
llvm::omp::RuntimeFunction
RuntimeFunction
IDs for all omp runtime library (RTL) functions.
Definition: OMPConstants.h:46
llvm::omp::OMPScheduleType::BaseDistributeChunked
@ BaseDistributeChunked
llvm::omp::OMPScheduleType::OrderingMask
@ OrderingMask
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::omp::OMPScheduleType::NomergeOrderedAuto
@ NomergeOrderedAuto
llvm::omp::OMP_TGT_EXEC_MODE_GENERIC_SPMD
@ OMP_TGT_EXEC_MODE_GENERIC_SPMD
Definition: OMPConstants.h:191
llvm::omp::OMPScheduleType::OrderedGuidedChunked
@ OrderedGuidedChunked
llvm::omp::AddressSpace::Shared
@ Shared
llvm::omp::OMPScheduleType::MonotonicityMask
@ MonotonicityMask
llvm::omp::OMPScheduleType::BaseRuntime
@ BaseRuntime
llvm::omp::OMPScheduleType::UnorderedStatic
@ UnorderedStatic
llvm::omp::OMPScheduleType::None
@ None
llvm::omp::ICVInitValue
ICVInitValue
Definition: OMPConstants.h:36
llvm::omp::OMPScheduleType::UnorderedTrapezoidal
@ UnorderedTrapezoidal
llvm::omp::DefaultKind
DefaultKind
IDs for the different default kinds.
Definition: OMPConstants.h:55
llvm::omp::OMPScheduleType::ModifierOrdered
@ ModifierOrdered
llvm::omp::OMPScheduleType::OrderedDynamicChunked
@ OrderedDynamicChunked
llvm::omp::OMPScheduleType::NomergeUnorderedDynamicChunked
@ NomergeUnorderedDynamicChunked
llvm::omp::OMPAtomicCompareOp
OMPAtomicCompareOp
Atomic compare operations. Currently OpenMP only supports ==, >, and <.
Definition: OMPConstants.h:208
llvm::omp::OMPScheduleType::NomergeUnorderedGuidedIterativeChunked
@ NomergeUnorderedGuidedIterativeChunked
llvm::omp::OMPScheduleType::NomergeUnorderedGreedy
@ NomergeUnorderedGreedy
llvm::omp::OMPScheduleType::NomergeUnorderedStaticChunked
@ NomergeUnorderedStaticChunked
llvm::omp::OMPScheduleType::NomergeOrderedDynamicChunked
@ NomergeOrderedDynamicChunked
BitmaskEnum.h
llvm::omp::RTLDependenceKindTy::DepIn
@ DepIn
llvm::omp::OMPScheduleType::BaseDynamicChunked
@ BaseDynamicChunked
llvm::omp::OMPScheduleType::UnorderedStaticBalancedChunked
@ UnorderedStaticBalancedChunked
llvm::omp::RTLDependenceKindTy::DepOmpAllMem
@ DepOmpAllMem
llvm::omp::OMPScheduleType::BaseStaticChunked
@ BaseStaticChunked
llvm::omp::AddressSpace::Generic
@ Generic
llvm::omp::OMPScheduleType::BaseSteal
@ BaseSteal
llvm::omp::OMPScheduleType::ModifierNomerge
@ ModifierNomerge
llvm::omp::OMPScheduleType::UnorderedGuidedIterativeChunked
@ UnorderedGuidedIterativeChunked
llvm::omp::OMPAtomicCompareOp::MIN
@ MIN
llvm::omp::AddressSpace
AddressSpace
Definition: OMPConstants.h:196
llvm::omp::OMP_TGT_EXEC_MODE_SPMD
@ OMP_TGT_EXEC_MODE_SPMD
Definition: OMPConstants.h:190
llvm::omp::OMPScheduleType::OrderedRuntime
@ OrderedRuntime
llvm::omp::OMPScheduleType::BaseGuidedIterativeChunked
@ BaseGuidedIterativeChunked
llvm::omp::OMPScheduleType::OrderedStaticChunked
@ OrderedStaticChunked
llvm::omp::OMPScheduleType::UnorderedBalanced
@ UnorderedBalanced
llvm::omp::OMPScheduleType::BaseStaticBalancedChunked
@ BaseStaticBalancedChunked
llvm::omp::OMPScheduleType::ModifierUnordered
@ ModifierUnordered
llvm::omp::RTLDependenceKindTy::DepInOut
@ DepInOut
llvm::omp::OMPScheduleType::ModifierMask
@ ModifierMask
llvm::omp::OMPScheduleType::NomergeUnorderedGuidedAnalyticalChunked
@ NomergeUnorderedGuidedAnalyticalChunked
llvm::omp::OMPScheduleType::BaseGuidedSimd
@ BaseGuidedSimd
llvm::omp::OMPScheduleType::OrderedAuto
@ OrderedAuto
llvm::omp::AddressSpace::Local
@ Local
llvm::omp::OMPScheduleType::OrderedStatic
@ OrderedStatic
llvm::omp::OMPScheduleType::BaseStatic
@ BaseStatic
llvm::omp::OMPScheduleType::BaseAuto
@ BaseAuto
llvm::omp::RTLDependInfoFields::Flags
@ Flags
llvm::omp::OMPScheduleType::OrderedDistributeChunked
@ OrderedDistributeChunked
llvm::omp::RTLDependenceKindTy::DepMutexInOutSet
@ DepMutexInOutSet
llvm::omp::OMPScheduleType::UnorderedGuidedSimd
@ UnorderedGuidedSimd
llvm::omp::OMPScheduleType
OMPScheduleType
Definition: OMPConstants.h:77
llvm::omp::RTLDependenceKindTy
RTLDependenceKindTy
Dependence kind for RTL.
Definition: OMPConstants.h:214
llvm::omp::OMPScheduleType::UnorderedStaticChunked
@ UnorderedStaticChunked
llvm::omp::OMPScheduleType::NomergeUnorderedTrapezoidal
@ NomergeUnorderedTrapezoidal
llvm::omp::OMPScheduleType::NomergeOrderedStaticChunked
@ NomergeOrderedStaticChunked