clang  10.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 
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Frontend/OpenMP/OMPConstants.h"
19 
20 namespace clang {
21 
22 /// OpenMP context selector sets.
24 #define OPENMP_CONTEXT_SELECTOR_SET(Name) OMP_CTX_SET_##Name,
25 #include "clang/Basic/OpenMPKinds.def"
27 };
28 
29 /// OpenMP context selectors.
31 #define OPENMP_CONTEXT_SELECTOR(Name) OMP_CTX_##Name,
32 #include "clang/Basic/OpenMPKinds.def"
34 };
35 
37 llvm::StringRef
41 
42 /// Struct to store the context selectors info.
43 template <typename VectorType, typename ScoreT> struct OpenMPCtxSelectorData {
46  ScoreT Score;
48  explicit OpenMPCtxSelectorData() = default;
51  const ScoreT &Score, VectorType &&Names)
52  : CtxSet(CtxSet), Ctx(Ctx), Score(Score), Names(Names) {}
53  template <typename U>
56  const ScoreT &Score, const U &Names)
57  : CtxSet(CtxSet), Ctx(Ctx), Score(Score),
58  Names(Names.begin(), Names.end()) {}
59 };
60 
61 /// OpenMP directives.
63 
64 /// OpenMP clauses.
66 #define OPENMP_CLAUSE(Name, Class) \
67  OMPC_##Name,
68 #include "clang/Basic/OpenMPKinds.def"
74 };
75 
76 /// OpenMP attributes for 'default' clause.
78 #define OPENMP_DEFAULT_KIND(Name) \
79  OMPC_DEFAULT_##Name,
80 #include "clang/Basic/OpenMPKinds.def"
82 };
83 
84 /// OpenMP attributes for 'schedule' clause.
86 #define OPENMP_SCHEDULE_KIND(Name) \
87  OMPC_SCHEDULE_##Name,
88 #include "clang/Basic/OpenMPKinds.def"
90 };
91 
92 /// OpenMP modifiers for 'schedule' clause.
95 #define OPENMP_SCHEDULE_MODIFIER(Name) \
96  OMPC_SCHEDULE_MODIFIER_##Name,
97 #include "clang/Basic/OpenMPKinds.def"
99 };
100 
101 /// OpenMP attributes for 'depend' clause.
103 #define OPENMP_DEPEND_KIND(Name) \
104  OMPC_DEPEND_##Name,
105 #include "clang/Basic/OpenMPKinds.def"
107 };
108 
109 /// OpenMP attributes for 'linear' clause.
111 #define OPENMP_LINEAR_KIND(Name) \
112  OMPC_LINEAR_##Name,
113 #include "clang/Basic/OpenMPKinds.def"
115 };
116 
117 /// OpenMP mapping kind for 'map' clause.
119 #define OPENMP_MAP_KIND(Name) \
120  OMPC_MAP_##Name,
121 #include "clang/Basic/OpenMPKinds.def"
123 };
124 
125 /// OpenMP modifier kind for 'map' clause.
128 #define OPENMP_MAP_MODIFIER_KIND(Name) \
129  OMPC_MAP_MODIFIER_##Name,
130 #include "clang/Basic/OpenMPKinds.def"
132 };
133 
134 /// OpenMP modifier kind for 'to' clause.
136 #define OPENMP_TO_MODIFIER_KIND(Name) \
137  OMPC_TO_MODIFIER_##Name,
138 #include "clang/Basic/OpenMPKinds.def"
140 };
141 
142 /// OpenMP modifier kind for 'from' clause.
144 #define OPENMP_FROM_MODIFIER_KIND(Name) \
145  OMPC_FROM_MODIFIER_##Name,
146 #include "clang/Basic/OpenMPKinds.def"
148 };
149 
150 /// OpenMP attributes for 'dist_schedule' clause.
152 #define OPENMP_DIST_SCHEDULE_KIND(Name) OMPC_DIST_SCHEDULE_##Name,
153 #include "clang/Basic/OpenMPKinds.def"
155 };
156 
157 /// OpenMP attributes for 'defaultmap' clause.
159 #define OPENMP_DEFAULTMAP_KIND(Name) \
160  OMPC_DEFAULTMAP_##Name,
161 #include "clang/Basic/OpenMPKinds.def"
163 };
164 
165 /// OpenMP modifiers for 'defaultmap' clause.
168 #define OPENMP_DEFAULTMAP_MODIFIER(Name) \
169  OMPC_DEFAULTMAP_MODIFIER_##Name,
170 #include "clang/Basic/OpenMPKinds.def"
172 };
173 
174 /// OpenMP attributes for 'atomic_default_mem_order' clause.
176 #define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
177  OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name,
178 #include "clang/Basic/OpenMPKinds.def"
180 };
181 
182 /// OpenMP device type for 'device_type' clause.
184 #define OPENMP_DEVICE_TYPE_KIND(Name) \
185  OMPC_DEVICE_TYPE_##Name,
186 #include "clang/Basic/OpenMPKinds.def"
188 };
189 
190 /// OpenMP 'lastprivate' clause modifier.
192 #define OPENMP_LASTPRIVATE_KIND(Name) OMPC_LASTPRIVATE_##Name,
193 #include "clang/Basic/OpenMPKinds.def"
195 };
196 
197 /// Scheduling data for loop-based OpenMP directives.
198 struct OpenMPScheduleTy final {
202 };
203 
204 OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str);
206 
207 unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str);
209 
211  OpenMPClauseKind CKind,
212  unsigned OpenMPVersion);
213 
214 /// Checks if the specified directive is a directive with an associated
215 /// loop construct.
216 /// \param DKind Specified directive.
217 /// \return true - the directive is a loop-associated directive like 'omp simd'
218 /// or 'omp for' directive, otherwise - false.
220 
221 /// Checks if the specified directive is a worksharing directive.
222 /// \param DKind Specified directive.
223 /// \return true - the directive is a worksharing directive like 'omp for',
224 /// otherwise - false.
226 
227 /// Checks if the specified directive is a taskloop directive.
228 /// \param DKind Specified directive.
229 /// \return true - the directive is a worksharing directive like 'omp taskloop',
230 /// otherwise - false.
232 
233 /// Checks if the specified directive is a parallel-kind directive.
234 /// \param DKind Specified directive.
235 /// \return true - the directive is a parallel-like directive like 'omp
236 /// parallel', otherwise - false.
238 
239 /// Checks if the specified directive is a target code offload directive.
240 /// \param DKind Specified directive.
241 /// \return true - the directive is a target code offload directive like
242 /// 'omp target', 'omp target parallel', 'omp target xxx'
243 /// otherwise - false.
245 
246 /// Checks if the specified directive is a target data offload directive.
247 /// \param DKind Specified directive.
248 /// \return true - the directive is a target data offload directive like
249 /// 'omp target data', 'omp target update', 'omp target enter data',
250 /// 'omp target exit data'
251 /// otherwise - false.
253 
254 /// Checks if the specified composite/combined directive constitutes a teams
255 /// directive in the outermost nest. For example
256 /// 'omp teams distribute' or 'omp teams distribute parallel for'.
257 /// \param DKind Specified directive.
258 /// \return true - the directive has teams on the outermost nest, otherwise -
259 /// false.
261 
262 /// Checks if the specified directive is a teams-kind directive. For example,
263 /// 'omp teams distribute' or 'omp target teams'.
264 /// \param DKind Specified directive.
265 /// \return true - the directive is a teams-like directive, otherwise - false.
267 
268 /// Checks if the specified directive is a simd directive.
269 /// \param DKind Specified directive.
270 /// \return true - the directive is a simd directive like 'omp simd',
271 /// otherwise - false.
273 
274 /// Checks if the specified directive is a distribute directive.
275 /// \param DKind Specified directive.
276 /// \return true - the directive is a distribute-directive like 'omp
277 /// distribute',
278 /// otherwise - false.
280 
281 /// Checks if the specified composite/combined directive constitutes a
282 /// distribute directive in the outermost nest. For example,
283 /// 'omp distribute parallel for' or 'omp distribute'.
284 /// \param DKind Specified directive.
285 /// \return true - the directive has distribute on the outermost nest.
286 /// otherwise - false.
288 
289 /// Checks if the specified clause is one of private clauses like
290 /// 'private', 'firstprivate', 'reduction' etc..
291 /// \param Kind Clause kind.
292 /// \return true - the clause is a private clause, otherwise - false.
294 
295 /// Checks if the specified clause is one of threadprivate clauses like
296 /// 'threadprivate', 'copyin' or 'copyprivate'.
297 /// \param Kind Clause kind.
298 /// \return true - the clause is a threadprivate clause, otherwise - false.
300 
301 /// Checks if the specified directive kind is one of tasking directives - task,
302 /// taskloop, taksloop simd, master taskloop, parallel master taskloop, master
303 /// taskloop simd, or parallel master taskloop simd.
305 
306 /// Checks if the specified directive kind is one of the composite or combined
307 /// directives that need loop bound sharing across loops outlined in nested
308 /// functions
310 
311 /// Return the captured regions of an OpenMP directive.
314  OpenMPDirectiveKind DKind);
315 }
316 
317 #endif
318 
OpenMPFromModifierKind
OpenMP modifier kind for &#39;from&#39; clause.
Definition: OpenMPKinds.h:143
OpenMPCtxSelectorData(OpenMPContextSelectorSetKind CtxSet, OpenMPContextSelectorKind Ctx, const ScoreT &Score, const U &Names)
Definition: OpenMPKinds.h:54
Scheduling data for loop-based OpenMP directives.
Definition: OpenMPKinds.h:198
Struct to store the context selectors info.
Definition: OpenMPKinds.h:43
OpenMPDefaultmapClauseKind
OpenMP attributes for &#39;defaultmap&#39; clause.
Definition: OpenMPKinds.h:158
OpenMPContextSelectorSetKind CtxSet
Definition: OpenMPKinds.h:44
bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a distribute directive in the outerm...
bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target data offload directive.
The base class of the type hierarchy.
Definition: Type.h:1450
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
OpenMPDefaultmapClauseModifier
OpenMP modifiers for &#39;defaultmap&#39; clause.
Definition: OpenMPKinds.h:166
OpenMPMapModifierKind
OpenMP modifier kind for &#39;map&#39; clause.
Definition: OpenMPKinds.h:126
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
Definition: OpenMPKinds.cpp:82
llvm::StringRef getOpenMPContextSelectorName(OpenMPContextSelectorKind Kind)
Definition: OpenMPKinds.cpp:53
bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of tasking directives - task, taskloop, taksloop simd, master taskloop, parallel master taskloop, master taskloop simd, or parallel master taskloop simd.
OpenMPLinearClauseKind
OpenMP attributes for &#39;linear&#39; clause.
Definition: OpenMPKinds.h:110
OpenMPContextSelectorKind
OpenMP context selectors.
Definition: OpenMPKinds.h:30
OpenMPDistScheduleClauseKind
OpenMP attributes for &#39;dist_schedule&#39; clause.
Definition: OpenMPKinds.h:151
OpenMPContextSelectorSetKind
OpenMP context selector sets.
Definition: OpenMPKinds.h:23
bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind, OpenMPClauseKind CKind, unsigned OpenMPVersion)
bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a teams-kind directive.
OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str)
OpenMPContextSelectorSetKind getOpenMPContextSelectorSet(llvm::StringRef Str)
Definition: OpenMPKinds.cpp:24
bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target code offload directive.
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:62
bool isOpenMPPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of private clauses like &#39;private&#39;, &#39;firstprivate&#39;, &#39;reduction&#39; etc.
OpenMPLastprivateModifier
OpenMP &#39;lastprivate&#39; clause modifier.
Definition: OpenMPKinds.h:191
bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a parallel-kind directive.
OpenMPClauseKind
OpenMP clauses.
Definition: OpenMPKinds.h:65
OpenMPDeviceType
OpenMP device type for &#39;device_type&#39; clause.
Definition: OpenMPKinds.h:183
llvm::StringRef getOpenMPContextSelectorSetName(OpenMPContextSelectorSetKind Kind)
Definition: OpenMPKinds.cpp:32
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
Represents a GCC generic vector type.
Definition: Type.h:3235
Kind
OpenMPDependClauseKind
OpenMP attributes for &#39;depend&#39; clause.
Definition: OpenMPKinds.h:102
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
OpenMPScheduleClauseModifier
OpenMP modifiers for &#39;schedule&#39; clause.
Definition: OpenMPKinds.h:93
Dataflow Directional Tag Classes.
OpenMPContextSelectorKind Ctx
Definition: OpenMPKinds.h:45
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for &#39;atomic_default_mem_order&#39; clause.
Definition: OpenMPKinds.h:175
bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a simd directive.
bool isOpenMPThreadPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of threadprivate clauses like &#39;threadprivate&#39;, &#39;copyin&#39; or &#39;copyprivate&#39;.
OpenMPToModifierKind
OpenMP modifier kind for &#39;to&#39; clause.
Definition: OpenMPKinds.h:135
void getOpenMPCaptureRegions(llvm::SmallVectorImpl< OpenMPDirectiveKind > &CaptureRegions, OpenMPDirectiveKind DKind)
Return the captured regions of an OpenMP directive.
unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str)
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
OpenMPScheduleClauseKind
OpenMP attributes for &#39;schedule&#39; clause.
Definition: OpenMPKinds.h:85
OpenMPDefaultClauseKind
OpenMP attributes for &#39;default&#39; clause.
Definition: OpenMPKinds.h:77
OpenMPCtxSelectorData(OpenMPContextSelectorSetKind CtxSet, OpenMPContextSelectorKind Ctx, const ScoreT &Score, VectorType &&Names)
Definition: OpenMPKinds.h:49
OpenMPMapClauseKind
OpenMP mapping kind for &#39;map&#39; clause.
Definition: OpenMPKinds.h:118
OpenMPContextSelectorKind getOpenMPContextSelector(llvm::StringRef Str)
Definition: OpenMPKinds.cpp:45
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
VerifyDiagnosticConsumer::Directive Directive
bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a teams directive in the outermost n...