clang  16.0.0git
OpenMPKinds.h
Go to the documentation of this file.
1 //===--- OpenMPKinds.h - OpenMP enums ---------------------------*- 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 ///
9 /// \file
10 /// Defines some OpenMP-specific enums and functions.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_BASIC_OPENMPKINDS_H
15 #define LLVM_CLANG_BASIC_OPENMPKINDS_H
16 
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/Frontend/OpenMP/OMPConstants.h"
20 
21 namespace clang {
22 
23 /// OpenMP directives.
25 
26 /// OpenMP clauses.
27 using OpenMPClauseKind = llvm::omp::Clause;
28 
29 /// OpenMP attributes for 'schedule' clause.
31 #define OPENMP_SCHEDULE_KIND(Name) \
32  OMPC_SCHEDULE_##Name,
33 #include "clang/Basic/OpenMPKinds.def"
35 };
36 
37 /// OpenMP modifiers for 'schedule' clause.
40 #define OPENMP_SCHEDULE_MODIFIER(Name) \
41  OMPC_SCHEDULE_MODIFIER_##Name,
42 #include "clang/Basic/OpenMPKinds.def"
44 };
45 
46 /// OpenMP modifiers for 'device' clause.
48 #define OPENMP_DEVICE_MODIFIER(Name) OMPC_DEVICE_##Name,
49 #include "clang/Basic/OpenMPKinds.def"
51 };
52 
53 /// OpenMP attributes for 'depend' clause.
55 #define OPENMP_DEPEND_KIND(Name) \
56  OMPC_DEPEND_##Name,
57 #include "clang/Basic/OpenMPKinds.def"
59 };
60 
61 /// OpenMP attributes for 'linear' clause.
63 #define OPENMP_LINEAR_KIND(Name) \
64  OMPC_LINEAR_##Name,
65 #include "clang/Basic/OpenMPKinds.def"
67 };
68 
69 /// OpenMP mapping kind for 'map' clause.
71 #define OPENMP_MAP_KIND(Name) \
72  OMPC_MAP_##Name,
73 #include "clang/Basic/OpenMPKinds.def"
75 };
76 
77 /// OpenMP modifier kind for 'map' clause.
80 #define OPENMP_MAP_MODIFIER_KIND(Name) \
81  OMPC_MAP_MODIFIER_##Name,
82 #include "clang/Basic/OpenMPKinds.def"
84 };
85 
86  /// Number of allowed map-type-modifiers.
87 static constexpr unsigned NumberOfOMPMapClauseModifiers =
89 
90 /// OpenMP modifier kind for 'to' or 'from' clause.
92 #define OPENMP_MOTION_MODIFIER_KIND(Name) \
93  OMPC_MOTION_MODIFIER_##Name,
94 #include "clang/Basic/OpenMPKinds.def"
96 };
97 
98 /// Number of allowed motion-modifiers.
99 static constexpr unsigned NumberOfOMPMotionModifiers =
101 
102 /// OpenMP attributes for 'dist_schedule' clause.
104 #define OPENMP_DIST_SCHEDULE_KIND(Name) OMPC_DIST_SCHEDULE_##Name,
105 #include "clang/Basic/OpenMPKinds.def"
107 };
108 
109 /// OpenMP attributes for 'defaultmap' clause.
111 #define OPENMP_DEFAULTMAP_KIND(Name) \
112  OMPC_DEFAULTMAP_##Name,
113 #include "clang/Basic/OpenMPKinds.def"
115 };
116 
117 /// OpenMP modifiers for 'defaultmap' clause.
120 #define OPENMP_DEFAULTMAP_MODIFIER(Name) \
121  OMPC_DEFAULTMAP_MODIFIER_##Name,
122 #include "clang/Basic/OpenMPKinds.def"
124 };
125 
126 /// OpenMP attributes for 'atomic_default_mem_order' clause.
128 #define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
129  OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name,
130 #include "clang/Basic/OpenMPKinds.def"
132 };
133 
134 /// OpenMP device type for 'device_type' clause.
136 #define OPENMP_DEVICE_TYPE_KIND(Name) \
137  OMPC_DEVICE_TYPE_##Name,
138 #include "clang/Basic/OpenMPKinds.def"
140 };
141 
142 /// OpenMP 'lastprivate' clause modifier.
144 #define OPENMP_LASTPRIVATE_KIND(Name) OMPC_LASTPRIVATE_##Name,
145 #include "clang/Basic/OpenMPKinds.def"
147 };
148 
149 /// OpenMP attributes for 'order' clause.
151 #define OPENMP_ORDER_KIND(Name) OMPC_ORDER_##Name,
152 #include "clang/Basic/OpenMPKinds.def"
154 };
155 
156 /// Scheduling data for loop-based OpenMP directives.
157 struct OpenMPScheduleTy final {
161 };
162 
163 /// OpenMP modifiers for 'reduction' clause.
165 #define OPENMP_REDUCTION_MODIFIER(Name) OMPC_REDUCTION_##Name,
166 #include "clang/Basic/OpenMPKinds.def"
168 };
169 
170 /// OpenMP adjust-op kinds for 'adjust_args' clause.
172 #define OPENMP_ADJUST_ARGS_KIND(Name) OMPC_ADJUST_ARGS_##Name,
173 #include "clang/Basic/OpenMPKinds.def"
175 };
176 
177 /// OpenMP bindings for the 'bind' clause.
179 #define OPENMP_BIND_KIND(Name) OMPC_BIND_##Name,
180 #include "clang/Basic/OpenMPKinds.def"
182 };
183 
184 /// Contains 'interop' data for 'append_args' and 'init' clauses.
185 class Expr;
186 struct OMPInteropInfo final {
187  OMPInteropInfo(bool IsTarget = false, bool IsTargetSync = false)
189  bool IsTarget;
192 };
193 
194 unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str,
195  const LangOptions &LangOpts);
197 
198 /// Checks if the specified directive is a directive with an associated
199 /// loop construct.
200 /// \param DKind Specified directive.
201 /// \return true - the directive is a loop-associated directive like 'omp simd'
202 /// or 'omp for' directive, otherwise - false.
204 
205 /// Checks if the specified directive is a worksharing directive.
206 /// \param DKind Specified directive.
207 /// \return true - the directive is a worksharing directive like 'omp for',
208 /// otherwise - false.
210 
211 /// Checks if the specified directive is a taskloop directive.
212 /// \param DKind Specified directive.
213 /// \return true - the directive is a worksharing directive like 'omp taskloop',
214 /// otherwise - false.
216 
217 /// Checks if the specified directive is a parallel-kind directive.
218 /// \param DKind Specified directive.
219 /// \return true - the directive is a parallel-like directive like 'omp
220 /// parallel', otherwise - false.
222 
223 /// Checks if the specified directive is a target code offload directive.
224 /// \param DKind Specified directive.
225 /// \return true - the directive is a target code offload directive like
226 /// 'omp target', 'omp target parallel', 'omp target xxx'
227 /// otherwise - false.
229 
230 /// Checks if the specified directive is a target data offload directive.
231 /// \param DKind Specified directive.
232 /// \return true - the directive is a target data offload directive like
233 /// 'omp target data', 'omp target update', 'omp target enter data',
234 /// 'omp target exit data'
235 /// otherwise - false.
237 
238 /// Checks if the specified composite/combined directive constitutes a teams
239 /// directive in the outermost nest. For example
240 /// 'omp teams distribute' or 'omp teams distribute parallel for'.
241 /// \param DKind Specified directive.
242 /// \return true - the directive has teams on the outermost nest, otherwise -
243 /// false.
245 
246 /// Checks if the specified directive is a teams-kind directive. For example,
247 /// 'omp teams distribute' or 'omp target teams'.
248 /// \param DKind Specified directive.
249 /// \return true - the directive is a teams-like directive, otherwise - false.
251 
252 /// Checks if the specified directive is a simd directive.
253 /// \param DKind Specified directive.
254 /// \return true - the directive is a simd directive like 'omp simd',
255 /// otherwise - false.
257 
258 /// Checks if the specified directive is a distribute directive.
259 /// \param DKind Specified directive.
260 /// \return true - the directive is a distribute-directive like 'omp
261 /// distribute',
262 /// otherwise - false.
264 
265 /// Checks if the specified composite/combined directive constitutes a
266 /// distribute directive in the outermost nest. For example,
267 /// 'omp distribute parallel for' or 'omp distribute'.
268 /// \param DKind Specified directive.
269 /// \return true - the directive has distribute on the outermost nest.
270 /// otherwise - false.
272 
273 /// Checks if the specified directive constitutes a 'loop' directive in the
274 /// outermost nest. For example, 'omp teams loop' or 'omp loop'.
275 /// \param DKind Specified directive.
276 /// \return true - the directive has loop on the outermost nest.
277 /// otherwise - false.
279 
280 /// Checks if the specified clause is one of private clauses like
281 /// 'private', 'firstprivate', 'reduction' etc..
282 /// \param Kind Clause kind.
283 /// \return true - the clause is a private clause, otherwise - false.
285 
286 /// Checks if the specified clause is one of threadprivate clauses like
287 /// 'threadprivate', 'copyin' or 'copyprivate'.
288 /// \param Kind Clause kind.
289 /// \return true - the clause is a threadprivate clause, otherwise - false.
291 
292 /// Checks if the specified directive kind is one of tasking directives - task,
293 /// taskloop, taksloop simd, master taskloop, parallel master taskloop, master
294 /// taskloop simd, or parallel master taskloop simd.
296 
297 /// Checks if the specified directive kind is one of the composite or combined
298 /// directives that need loop bound sharing across loops outlined in nested
299 /// functions
301 
302 /// Checks if the specified directive is a loop transformation directive.
303 /// \param DKind Specified directive.
304 /// \return True iff the directive is a loop transformation.
306 
307 /// Return the captured regions of an OpenMP directive.
310  OpenMPDirectiveKind DKind);
311 }
312 
313 #endif
314 
clang::OpenMPDeviceClauseModifier
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
Definition: OpenMPKinds.h:47
clang::isOpenMPTargetDataManagementDirective
bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target data offload directive.
Definition: OpenMPKinds.cpp:563
clang::OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
@ OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
Definition: OpenMPKinds.h:131
clang::isOpenMPNestingTeamsDirective
bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a teams directive in the outermost n...
Definition: OpenMPKinds.cpp:568
clang::isOpenMPParallelDirective
bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a parallel-kind directive.
Definition: OpenMPKinds.cpp:533
llvm::SmallVector
Definition: LLVM.h:38
clang::OMPC_DEPEND_unknown
@ OMPC_DEPEND_unknown
Definition: OpenMPKinds.h:58
clang::isOpenMPThreadPrivate
bool isOpenMPThreadPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of threadprivate clauses like 'threadprivate',...
Definition: OpenMPKinds.cpp:632
clang::NumberOfOMPMotionModifiers
static constexpr unsigned NumberOfOMPMotionModifiers
Number of allowed motion-modifiers.
Definition: OpenMPKinds.h:99
clang::OpenMPReductionClauseModifier
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
Definition: OpenMPKinds.h:164
clang::isOpenMPLoopDirective
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
Definition: OpenMPKinds.cpp:480
clang::OpenMPScheduleTy::Schedule
OpenMPScheduleClauseKind Schedule
Definition: OpenMPKinds.h:158
clang::OpenMPMapClauseKind
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition: OpenMPKinds.h:70
clang::OMPC_LASTPRIVATE_unknown
@ OMPC_LASTPRIVATE_unknown
Definition: OpenMPKinds.h:146
clang::OMPC_REDUCTION_unknown
@ OMPC_REDUCTION_unknown
Definition: OpenMPKinds.h:167
clang::OMPC_BIND_unknown
@ OMPC_BIND_unknown
Definition: OpenMPKinds.h:181
clang::OpenMPMapModifierKind
OpenMPMapModifierKind
OpenMP modifier kind for 'map' clause.
Definition: OpenMPKinds.h:78
clang::OMPInteropInfo
Definition: OpenMPKinds.h:186
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1565
clang::NumberOfOMPMapClauseModifiers
static constexpr unsigned NumberOfOMPMapClauseModifiers
Number of allowed map-type-modifiers.
Definition: OpenMPKinds.h:87
clang::OpenMPLastprivateModifier
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
Definition: OpenMPKinds.h:143
clang::isOpenMPDistributeDirective
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
Definition: OpenMPKinds.cpp:608
clang::OpenMPBindClauseKind
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
Definition: OpenMPKinds.h:178
clang::isOpenMPLoopTransformationDirective
bool isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a loop transformation directive.
Definition: OpenMPKinds.cpp:649
clang::OpenMPMotionModifierKind
OpenMPMotionModifierKind
OpenMP modifier kind for 'to' or 'from' clause.
Definition: OpenMPKinds.h:91
clang::OMPC_SCHEDULE_MODIFIER_unknown
@ OMPC_SCHEDULE_MODIFIER_unknown
Definition: OpenMPKinds.h:39
clang::OMPC_LINEAR_unknown
@ OMPC_LINEAR_unknown
Definition: OpenMPKinds.h:66
clang::OMPInteropInfo::PreferTypes
llvm::SmallVector< Expr *, 4 > PreferTypes
Definition: OpenMPKinds.h:191
clang::OpenMPLinearClauseKind
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition: OpenMPKinds.h:62
clang::OpenMPDeviceType
OpenMPDeviceType
OpenMP device type for 'device_type' clause.
Definition: OpenMPKinds.h:135
clang::OMPInteropInfo::OMPInteropInfo
OMPInteropInfo(bool IsTarget=false, bool IsTargetSync=false)
Definition: OpenMPKinds.h:187
clang::OpenMPDefaultmapClauseKind
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
Definition: OpenMPKinds.h:110
clang::getOpenMPCaptureRegions
void getOpenMPCaptureRegions(llvm::SmallVectorImpl< OpenMPDirectiveKind > &CaptureRegions, OpenMPDirectiveKind DKind)
Return the captured regions of an OpenMP directive.
Definition: OpenMPKinds.cpp:653
LangOptions.h
clang::OpenMPOrderClauseKind
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
Definition: OpenMPKinds.h:150
clang::OpenMPClauseKind
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Definition: OpenMPKinds.h:27
clang::OMPC_MOTION_MODIFIER_unknown
@ OMPC_MOTION_MODIFIER_unknown
Definition: OpenMPKinds.h:95
clang::OMPC_DEVICE_unknown
@ OMPC_DEVICE_unknown
Definition: OpenMPKinds.h:50
clang::OMPC_DEVICE_TYPE_unknown
@ OMPC_DEVICE_TYPE_unknown
Definition: OpenMPKinds.h:139
clang::isOpenMPGenericLoopDirective
bool isOpenMPGenericLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive constitutes a 'loop' directive in the outermost nest.
Definition: OpenMPKinds.cpp:619
clang::OpenMPDependClauseKind
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition: OpenMPKinds.h:54
clang::OMPC_SCHEDULE_unknown
@ OMPC_SCHEDULE_unknown
Definition: OpenMPKinds.h:34
clang::isOpenMPPrivate
bool isOpenMPPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of private clauses like 'private', 'firstprivate',...
Definition: OpenMPKinds.cpp:625
clang::OpenMPAdjustArgsOpKind
OpenMPAdjustArgsOpKind
OpenMP adjust-op kinds for 'adjust_args' clause.
Definition: OpenMPKinds.h:171
clang::OMPC_MAP_unknown
@ OMPC_MAP_unknown
Definition: OpenMPKinds.h:74
clang::isOpenMPTeamsDirective
bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a teams-kind directive.
Definition: OpenMPKinds.cpp:576
clang::getOpenMPSimpleClauseTypeName
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
Definition: OpenMPKinds.cpp:213
clang::OMPInteropInfo::IsTargetSync
bool IsTargetSync
Definition: OpenMPKinds.h:190
clang::OMPC_DEFAULTMAP_MODIFIER_unknown
@ OMPC_DEFAULTMAP_MODIFIER_unknown
Definition: OpenMPKinds.h:119
clang::OMPC_DEFAULTMAP_MODIFIER_last
@ OMPC_DEFAULTMAP_MODIFIER_last
Definition: OpenMPKinds.h:123
Directive
VerifyDiagnosticConsumer::Directive Directive
Definition: VerifyDiagnosticConsumer.cpp:49
clang::OMPC_MAP_MODIFIER_last
@ OMPC_MAP_MODIFIER_last
Definition: OpenMPKinds.h:83
clang::OMPC_SCHEDULE_MODIFIER_last
@ OMPC_SCHEDULE_MODIFIER_last
Definition: OpenMPKinds.h:43
clang::isOpenMPTaskLoopDirective
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
Definition: OpenMPKinds.cpp:523
clang::OpenMPDefaultmapClauseModifier
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
Definition: OpenMPKinds.h:118
clang::OpenMPScheduleTy::M2
OpenMPScheduleClauseModifier M2
Definition: OpenMPKinds.h:160
clang::OpenMPAtomicDefaultMemOrderClauseKind
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
Definition: OpenMPKinds.h:127
clang::getOpenMPSimpleClauseType
unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str, const LangOptions &LangOpts)
clang::isOpenMPNestingDistributeDirective
bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a distribute directive in the outerm...
Definition: OpenMPKinds.cpp:601
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:78
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::isOpenMPLoopBoundSharingDirective
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
Definition: OpenMPKinds.cpp:640
clang::isOpenMPWorksharingDirective
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
Definition: OpenMPKinds.cpp:508
clang::isOpenMPTaskingDirective
bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of tasking directives - task, taskloop,...
Definition: OpenMPKinds.cpp:636
clang
Definition: CalledOnceCheck.h:17
clang::OMPC_MAP_MODIFIER_unknown
@ OMPC_MAP_MODIFIER_unknown
Definition: OpenMPKinds.h:79
clang::OpenMPDistScheduleClauseKind
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
Definition: OpenMPKinds.h:103
clang::OMPC_DIST_SCHEDULE_unknown
@ OMPC_DIST_SCHEDULE_unknown
Definition: OpenMPKinds.h:106
clang::OpenMPScheduleClauseModifier
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition: OpenMPKinds.h:38
clang::OMPC_ORDER_unknown
@ OMPC_ORDER_unknown
Definition: OpenMPKinds.h:153
clang::OpenMPDirectiveKind
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:24
clang::OpenMPScheduleTy::M1
OpenMPScheduleClauseModifier M1
Definition: OpenMPKinds.h:159
clang::isOpenMPTargetExecutionDirective
bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target code offload directive.
Definition: OpenMPKinds.cpp:552
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::OpenMPScheduleClauseKind
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition: OpenMPKinds.h:30
clang::OMPC_DEFAULTMAP_unknown
@ OMPC_DEFAULTMAP_unknown
Definition: OpenMPKinds.h:114
clang::OMPC_ADJUST_ARGS_unknown
@ OMPC_ADJUST_ARGS_unknown
Definition: OpenMPKinds.h:174
clang::isOpenMPSimdDirective
bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a simd directive.
Definition: OpenMPKinds.cpp:585
clang::OpenMPScheduleTy
Scheduling data for loop-based OpenMP directives.
Definition: OpenMPKinds.h:157
clang::OMPInteropInfo::IsTarget
bool IsTarget
Definition: OpenMPKinds.h:189