LLVM  14.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 class Type;
24 class Module;
25 class ArrayType;
26 class StructType;
27 class PointerType;
28 class StringRef;
29 class FunctionType;
30 
31 namespace omp {
33 
34 /// IDs for all Internal Control Variables (ICVs).
35 enum class InternalControlVar {
36 #define ICV_DATA_ENV(Enum, ...) Enum,
37 #include "llvm/Frontend/OpenMP/OMPKinds.def"
38 };
39 
40 #define ICV_DATA_ENV(Enum, ...) \
41  constexpr auto Enum = omp::InternalControlVar::Enum;
42 #include "llvm/Frontend/OpenMP/OMPKinds.def"
43 
44 enum class ICVInitValue {
45 #define ICV_INIT_VALUE(Enum, Name) Enum,
46 #include "llvm/Frontend/OpenMP/OMPKinds.def"
47 };
48 
49 #define ICV_INIT_VALUE(Enum, Name) \
50  constexpr auto Enum = omp::ICVInitValue::Enum;
51 #include "llvm/Frontend/OpenMP/OMPKinds.def"
52 
53 /// IDs for all omp runtime library (RTL) functions.
54 enum class RuntimeFunction {
55 #define OMP_RTL(Enum, ...) Enum,
56 #include "llvm/Frontend/OpenMP/OMPKinds.def"
57 };
58 
59 #define OMP_RTL(Enum, ...) constexpr auto Enum = omp::RuntimeFunction::Enum;
60 #include "llvm/Frontend/OpenMP/OMPKinds.def"
61 
62 /// IDs for the different default kinds.
63 enum class DefaultKind {
64 #define OMP_DEFAULT_KIND(Enum, Str) Enum,
65 #include "llvm/Frontend/OpenMP/OMPKinds.def"
66 };
67 
68 #define OMP_DEFAULT_KIND(Enum, ...) \
69  constexpr auto Enum = omp::DefaultKind::Enum;
70 #include "llvm/Frontend/OpenMP/OMPKinds.def"
71 
72 /// IDs for all omp runtime library ident_t flag encodings (see
73 /// their defintion in openmp/runtime/src/kmp.h).
74 enum class IdentFlag {
75 #define OMP_IDENT_FLAG(Enum, Str, Value) Enum = Value,
76 #include "llvm/Frontend/OpenMP/OMPKinds.def"
77  LLVM_MARK_AS_BITMASK_ENUM(0x7FFFFFFF)
78 };
79 
80 #define OMP_IDENT_FLAG(Enum, ...) constexpr auto Enum = omp::IdentFlag::Enum;
81 #include "llvm/Frontend/OpenMP/OMPKinds.def"
82 
83 /// Helper to describe assume clauses.
85  /// The identifier describing the (beginning of the) clause.
87  /// Flag to determine if the identifier is a full name or the start of a name.
88  bool StartsWith;
89  /// Flag to determine if a directive lists follows.
91  /// Flag to determine if an expression follows.
93 };
94 
95 /// All known assume clauses.
97 #define OMP_ASSUME_CLAUSE(Identifier, StartsWith, HasDirectiveList, \
98  HasExpression) \
99  {Identifier, StartsWith, HasDirectiveList, HasExpression},
100 #include "llvm/Frontend/OpenMP/OMPKinds.def"
101 };
102 
103 inline std::string getAllAssumeClauseOptions() {
104  std::string S;
106  S += (S.empty() ? "'" : "', '") + ACMI.Identifier.str();
107  return S + "'";
108 }
109 
110 /// \note This needs to be kept in sync with kmp.h enum sched_type.
111 /// Todo: Update kmp.h to include this file, and remove the enums in kmp.h
112 /// To complete this, more enum values will need to be moved here.
113 enum class OMPScheduleType {
114  StaticChunked = 33,
115  Static = 34, // static unspecialized
116  DistributeChunked = 91,
117  Distribute = 92,
118  DynamicChunked = 35,
119  GuidedChunked = 36, // guided unspecialized
120  Runtime = 37,
121  Auto = 38, // auto
122 
123  StaticBalancedChunked = 45, // static with chunk adjustment (e.g., simd)
124  GuidedSimd = 46, // guided with chunk adjustment
125  RuntimeSimd = 47, // runtime with chunk adjustment
126 
128  (1 << 29), // Set if the monotonic schedule modifier was present
130  (1 << 30), // Set if the nonmonotonic schedule modifier was present
132  LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue */ ModifierMask)
133 };
134 
135 enum OMPTgtExecModeFlags : int8_t {
141 };
142 
143 } // end namespace omp
144 
145 } // end namespace llvm
146 
147 #endif // LLVM_FRONTEND_OPENMP_OMPCONSTANTS_H
llvm::omp::OMPScheduleType::GuidedChunked
@ GuidedChunked
PointerType
Definition: ItaniumDemangle.h:594
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
FunctionType
Definition: ItaniumDemangle.h:779
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::OMPTgtExecModeFlags
OMPTgtExecModeFlags
Definition: OMPConstants.h:135
llvm::omp::OMPScheduleType::DistributeChunked
@ DistributeChunked
llvm::omp::AssumptionClauseMappingInfo
Helper to describe assume clauses.
Definition: OMPConstants.h:84
llvm::omp::OMPScheduleType::Auto
@ Auto
llvm::omp::OMPScheduleType::ModifierNonmonotonic
@ ModifierNonmonotonic
llvm::omp::OMPScheduleType::GuidedSimd
@ GuidedSimd
llvm::omp::getAllAssumeClauseOptions
std::string getAllAssumeClauseOptions()
Definition: OMPConstants.h:103
llvm::StringLiteral
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition: StringRef.h:890
llvm::omp::OMP_TGT_EXEC_MODE_GENERIC
@ OMP_TGT_EXEC_MODE_GENERIC
Definition: OMPConstants.h:136
llvm::omp::LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
llvm::omp::AssumptionClauseMappingInfo::HasExpression
bool HasExpression
Flag to determine if an expression follows.
Definition: OMPConstants.h:92
llvm::omp::AssumptionClauseMappings
static constexpr AssumptionClauseMappingInfo AssumptionClauseMappings[]
All known assume clauses.
Definition: OMPConstants.h:96
llvm::omp::OMPScheduleType::ModifierMonotonic
@ ModifierMonotonic
llvm::omp::OMPScheduleType::StaticBalancedChunked
@ StaticBalancedChunked
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:74
llvm::omp::InternalControlVar
InternalControlVar
IDs for all Internal Control Variables (ICVs).
Definition: OMPConstants.h:35
llvm::omp::RuntimeFunction
RuntimeFunction
IDs for all omp runtime library (RTL) functions.
Definition: OMPConstants.h:54
llvm::omp::OMPScheduleType::Distribute
@ Distribute
llvm::omp::OMP_TGT_EXEC_MODE_GENERIC_SPMD
@ OMP_TGT_EXEC_MODE_GENERIC_SPMD
Definition: OMPConstants.h:138
TemplateParamKind::Type
@ Type
llvm::omp::OMPScheduleType::Static
@ Static
llvm::omp::AssumptionClauseMappingInfo::StartsWith
bool StartsWith
Flag to determine if the identifier is a full name or the start of a name.
Definition: OMPConstants.h:88
llvm::omp::ICVInitValue
ICVInitValue
Definition: OMPConstants.h:44
llvm::omp::DefaultKind
DefaultKind
IDs for the different default kinds.
Definition: OMPConstants.h:63
BitmaskEnum.h
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::omp::OMPScheduleType::DynamicChunked
@ DynamicChunked
llvm::omp::OMP_TGT_EXEC_MODE_SPMD
@ OMP_TGT_EXEC_MODE_SPMD
Definition: OMPConstants.h:137
ArrayType
Definition: ItaniumDemangle.h:750
llvm::omp::OMPScheduleType::ModifierMask
@ ModifierMask
llvm::omp::OMPScheduleType::RuntimeSimd
@ RuntimeSimd
llvm::omp::AssumptionClauseMappingInfo::Identifier
llvm::StringLiteral Identifier
The identifier describing the (beginning of the) clause.
Definition: OMPConstants.h:86
llvm::omp::OMPScheduleType
OMPScheduleType
Definition: OMPConstants.h:113
llvm::omp::OMPScheduleType::StaticChunked
@ StaticChunked
llvm::omp::AssumptionClauseMappingInfo::HasDirectiveList
bool HasDirectiveList
Flag to determine if a directive lists follows.
Definition: OMPConstants.h:90
llvm::omp::OMPScheduleType::Runtime
@ Runtime