clang 20.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/Sequence.h"
19#include "llvm/ADT/StringRef.h"
20#include "llvm/Frontend/OpenMP/OMPConstants.h"
21
22namespace clang {
23
24/// OpenMP directives.
25using OpenMPDirectiveKind = llvm::omp::Directive;
26
27/// OpenMP clauses.
28using OpenMPClauseKind = llvm::omp::Clause;
29
30/// OpenMP attributes for 'schedule' clause.
32#define OPENMP_SCHEDULE_KIND(Name) \
33 OMPC_SCHEDULE_##Name,
34#include "clang/Basic/OpenMPKinds.def"
36};
37
38/// OpenMP modifiers for 'schedule' clause.
41#define OPENMP_SCHEDULE_MODIFIER(Name) \
42 OMPC_SCHEDULE_MODIFIER_##Name,
43#include "clang/Basic/OpenMPKinds.def"
45};
46
47/// OpenMP modifiers for 'device' clause.
49#define OPENMP_DEVICE_MODIFIER(Name) OMPC_DEVICE_##Name,
50#include "clang/Basic/OpenMPKinds.def"
52};
53
54/// OpenMP attributes for 'depend' clause.
56#define OPENMP_DEPEND_KIND(Name) \
57 OMPC_DEPEND_##Name,
58#include "clang/Basic/OpenMPKinds.def"
60};
61
62/// OpenMP attributes for 'linear' clause.
64#define OPENMP_LINEAR_KIND(Name) \
65 OMPC_LINEAR_##Name,
66#include "clang/Basic/OpenMPKinds.def"
68};
69
70/// OpenMP mapping kind for 'map' clause.
72#define OPENMP_MAP_KIND(Name) \
73 OMPC_MAP_##Name,
74#include "clang/Basic/OpenMPKinds.def"
76};
77
78/// OpenMP modifier kind for 'map' clause.
81#define OPENMP_MAP_MODIFIER_KIND(Name) \
82 OMPC_MAP_MODIFIER_##Name,
83#include "clang/Basic/OpenMPKinds.def"
85};
86
87/// Number of allowed map-type-modifiers.
88static constexpr unsigned NumberOfOMPMapClauseModifiers =
90
91/// OpenMP modifier kind for 'to' or 'from' clause.
93#define OPENMP_MOTION_MODIFIER_KIND(Name) \
94 OMPC_MOTION_MODIFIER_##Name,
95#include "clang/Basic/OpenMPKinds.def"
97};
98
99/// Number of allowed motion-modifiers.
100static constexpr unsigned NumberOfOMPMotionModifiers =
102
103/// OpenMP attributes for 'dist_schedule' clause.
105#define OPENMP_DIST_SCHEDULE_KIND(Name) OMPC_DIST_SCHEDULE_##Name,
106#include "clang/Basic/OpenMPKinds.def"
109
110/// OpenMP attributes for 'defaultmap' clause.
112#define OPENMP_DEFAULTMAP_KIND(Name) \
113 OMPC_DEFAULTMAP_##Name,
114#include "clang/Basic/OpenMPKinds.def"
117
118/// OpenMP modifiers for 'defaultmap' clause.
121#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
122 OMPC_DEFAULTMAP_MODIFIER_##Name,
123#include "clang/Basic/OpenMPKinds.def"
126
127/// OpenMP attributes for 'atomic_default_mem_order' clause.
129#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
130 OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name,
131#include "clang/Basic/OpenMPKinds.def"
134
135/// OpenMP attributes for 'at' clause.
137#define OPENMP_AT_KIND(Name) OMPC_AT_##Name,
138#include "clang/Basic/OpenMPKinds.def"
141
142/// OpenMP attributes for 'severity' clause.
144#define OPENMP_SEVERITY_KIND(Name) OMPC_SEVERITY_##Name,
145#include "clang/Basic/OpenMPKinds.def"
148
149/// OpenMP device type for 'device_type' clause.
151#define OPENMP_DEVICE_TYPE_KIND(Name) \
152 OMPC_DEVICE_TYPE_##Name,
153#include "clang/Basic/OpenMPKinds.def"
156
157/// OpenMP 'lastprivate' clause modifier.
159#define OPENMP_LASTPRIVATE_KIND(Name) OMPC_LASTPRIVATE_##Name,
160#include "clang/Basic/OpenMPKinds.def"
162};
163
164/// OpenMP attributes for 'order' clause.
166#define OPENMP_ORDER_KIND(Name) OMPC_ORDER_##Name,
167#include "clang/Basic/OpenMPKinds.def"
169};
170
171/// OpenMP modifiers for 'order' clause.
174#define OPENMP_ORDER_MODIFIER(Name) OMPC_ORDER_MODIFIER_##Name,
175#include "clang/Basic/OpenMPKinds.def"
178
179/// Scheduling data for loop-based OpenMP directives.
180struct OpenMPScheduleTy final {
184};
185
186/// OpenMP modifiers for 'reduction' clause.
188#define OPENMP_REDUCTION_MODIFIER(Name) OMPC_REDUCTION_##Name,
189#include "clang/Basic/OpenMPKinds.def"
191};
192
193/// OpenMP adjust-op kinds for 'adjust_args' clause.
195#define OPENMP_ADJUST_ARGS_KIND(Name) OMPC_ADJUST_ARGS_##Name,
196#include "clang/Basic/OpenMPKinds.def"
198};
199
200/// OpenMP bindings for the 'bind' clause.
202#define OPENMP_BIND_KIND(Name) OMPC_BIND_##Name,
203#include "clang/Basic/OpenMPKinds.def"
206
208#define OPENMP_GRAINSIZE_MODIFIER(Name) OMPC_GRAINSIZE_##Name,
209#include "clang/Basic/OpenMPKinds.def"
212
214#define OPENMP_NUMTASKS_MODIFIER(Name) OMPC_NUMTASKS_##Name,
215#include "clang/Basic/OpenMPKinds.def"
218
219/// OpenMP dependence types for 'doacross' clause.
221#define OPENMP_DOACROSS_MODIFIER(Name) OMPC_DOACROSS_##Name,
222#include "clang/Basic/OpenMPKinds.def"
225
226/// OpenMP modifiers for 'allocate' clause.
228#define OPENMP_ALLOCATE_MODIFIER(Name) OMPC_ALLOCATE_##Name,
229#include "clang/Basic/OpenMPKinds.def"
232
233/// Contains 'interop' data for 'append_args' and 'init' clauses.
234class Expr;
235struct OMPInteropInfo final {
236 OMPInteropInfo(bool IsTarget = false, bool IsTargetSync = false)
241};
242
243unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str,
244 const LangOptions &LangOpts);
246
247/// Checks if the specified directive is a directive with an associated
248/// loop construct.
249/// \param DKind Specified directive.
250/// \return true - the directive is a loop-associated directive like 'omp simd'
251/// or 'omp for' directive, otherwise - false.
253
254/// Checks if the specified directive is a worksharing directive.
255/// \param DKind Specified directive.
256/// \return true - the directive is a worksharing directive like 'omp for',
257/// otherwise - false.
259
260/// Checks if the specified directive is a taskloop directive.
261/// \param DKind Specified directive.
262/// \return true - the directive is a worksharing directive like 'omp taskloop',
263/// otherwise - false.
265
266/// Checks if the specified directive is a parallel-kind directive.
267/// \param DKind Specified directive.
268/// \return true - the directive is a parallel-like directive like 'omp
269/// parallel', otherwise - false.
271
272/// Checks if the specified directive is a target code offload directive.
273/// \param DKind Specified directive.
274/// \return true - the directive is a target code offload directive like
275/// 'omp target', 'omp target parallel', 'omp target xxx'
276/// otherwise - false.
278
279/// Checks if the specified directive is a target data offload directive.
280/// \param DKind Specified directive.
281/// \return true - the directive is a target data offload directive like
282/// 'omp target data', 'omp target update', 'omp target enter data',
283/// 'omp target exit data'
284/// otherwise - false.
286
287/// Checks if the specified composite/combined directive constitutes a teams
288/// directive in the outermost nest. For example
289/// 'omp teams distribute' or 'omp teams distribute parallel for'.
290/// \param DKind Specified directive.
291/// \return true - the directive has teams on the outermost nest, otherwise -
292/// false.
294
295/// Checks if the specified directive is a teams-kind directive. For example,
296/// 'omp teams distribute' or 'omp target teams'.
297/// \param DKind Specified directive.
298/// \return true - the directive is a teams-like directive, otherwise - false.
300
301/// Checks if the specified directive is a simd directive.
302/// \param DKind Specified directive.
303/// \return true - the directive is a simd directive like 'omp simd',
304/// otherwise - false.
306
307/// Checks if the specified directive is a distribute directive.
308/// \param DKind Specified directive.
309/// \return true - the directive is a distribute-directive like 'omp
310/// distribute',
311/// otherwise - false.
313
314/// Checks if the specified composite/combined directive constitutes a
315/// distribute directive in the outermost nest. For example,
316/// 'omp distribute parallel for' or 'omp distribute'.
317/// \param DKind Specified directive.
318/// \return true - the directive has distribute on the outermost nest.
319/// otherwise - false.
321
322/// Checks if the specified directive constitutes a 'loop' directive in the
323/// outermost nest. For example, 'omp teams loop' or 'omp loop'.
324/// \param DKind Specified directive.
325/// \return true - the directive has loop on the outermost nest.
326/// otherwise - false.
328
329/// Checks if the specified clause is one of private clauses like
330/// 'private', 'firstprivate', 'reduction' etc..
331/// \param Kind Clause kind.
332/// \return true - the clause is a private clause, otherwise - false.
334
335/// Checks if the specified clause is one of threadprivate clauses like
336/// 'threadprivate', 'copyin' or 'copyprivate'.
337/// \param Kind Clause kind.
338/// \return true - the clause is a threadprivate clause, otherwise - false.
340
341/// Checks if the specified directive kind is one of tasking directives - task,
342/// taskloop, taksloop simd, master taskloop, parallel master taskloop, master
343/// taskloop simd, or parallel master taskloop simd.
345
346/// Checks if the specified directive kind is one of the composite or combined
347/// directives that need loop bound sharing across loops outlined in nested
348/// functions
350
351/// Checks if the specified directive is a loop transformation directive.
352/// \param DKind Specified directive.
353/// \return True iff the directive is a loop transformation.
355
356/// Return the captured regions of an OpenMP directive.
359 OpenMPDirectiveKind DKind);
360
361/// Checks if the specified directive is a combined construct for which
362/// the first construct is a parallel construct.
363/// \param DKind Specified directive.
364/// \return true - if the above condition is met for this directive
365/// otherwise - false.
367
368/// Checks if the specified target directive, combined or not, needs task based
369/// thread_limit
370/// \param DKind Specified directive.
371/// \return true - if the above condition is met for this directive
372/// otherwise - false.
374
375/// Checks if the parameter to the fail clause in "#pragma atomic compare fail"
376/// is restricted only to memory order clauses of "OMPC_acquire",
377/// "OMPC_relaxed" and "OMPC_seq_cst".
378bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter);
379
380/// Checks if the specified directive is considered as "executable". This
381/// combines the OpenMP categories of "executable" and "subsidiary", plus
382/// any other directives that should be treated as executable.
383/// \param DKind Specified directive.
384/// \return true - if the above condition is met for this directive
385/// otherwise - false.
387
388/// Checks if the specified directive is considered as "informational".
389/// \param DKind Specified directive.
390/// \return true if it is an informational directive, false otherwise.
392
393/// Checks if the specified directive can capture variables.
394/// \param DKind Specified directive.
395/// \return true - if the above condition is met for this directive
396/// otherwise - false.
398}
399
400template <>
401struct llvm::enum_iteration_traits<clang::OpenMPDefaultmapClauseKind> {
402 static constexpr bool is_iterable = true;
403};
404#endif
405
enum clang::sema::@1712::IndirectLocalPathEntry::EntryKind Kind
Defines the clang::LangOptions interface.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:499
The base class of the type hierarchy.
Definition: Type.h:1828
The JSON file list parser is used to communicate input to InstallAPI.
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
bool needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind)
Checks if the specified target directive, combined or not, needs task based thread_limit.
bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a teams directive in the outermost n...
bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter)
Checks if the parameter to the fail clause in "#pragma atomic compare fail" is restricted only to mem...
bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target data offload directive.
bool isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a loop transformation directive.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:25
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
Definition: OpenMPKinds.h:119
@ OMPC_DEFAULTMAP_MODIFIER_last
Definition: OpenMPKinds.h:124
@ OMPC_DEFAULTMAP_MODIFIER_unknown
Definition: OpenMPKinds.h:120
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
Definition: OpenMPKinds.h:172
@ OMPC_ORDER_MODIFIER_unknown
Definition: OpenMPKinds.h:173
@ OMPC_ORDER_MODIFIER_last
Definition: OpenMPKinds.h:176
OpenMPAdjustArgsOpKind
OpenMP adjust-op kinds for 'adjust_args' clause.
Definition: OpenMPKinds.h:194
@ OMPC_ADJUST_ARGS_unknown
Definition: OpenMPKinds.h:197
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
Definition: OpenMPKinds.h:136
@ OMPC_AT_unknown
Definition: OpenMPKinds.h:139
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
Definition: OpenMPKinds.h:187
@ OMPC_REDUCTION_unknown
Definition: OpenMPKinds.h:190
OpenMPDeviceType
OpenMP device type for 'device_type' clause.
Definition: OpenMPKinds.h:150
@ OMPC_DEVICE_TYPE_unknown
Definition: OpenMPKinds.h:154
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition: OpenMPKinds.h:39
@ OMPC_SCHEDULE_MODIFIER_last
Definition: OpenMPKinds.h:44
@ OMPC_SCHEDULE_MODIFIER_unknown
Definition: OpenMPKinds.h:40
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Definition: OpenMPKinds.h:28
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a parallel-kind directive.
bool isOpenMPPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of private clauses like 'private', 'firstprivate',...
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
Definition: OpenMPKinds.h:104
@ OMPC_DIST_SCHEDULE_unknown
Definition: OpenMPKinds.h:107
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
Definition: OpenMPKinds.h:220
@ OMPC_DOACROSS_unknown
Definition: OpenMPKinds.h:223
bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of tasking directives - task, taskloop,...
static constexpr unsigned NumberOfOMPMapClauseModifiers
Number of allowed map-type-modifiers.
Definition: OpenMPKinds.h:88
bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a target code offload directive.
bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a teams-kind directive.
bool isOpenMPGenericLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive constitutes a 'loop' directive in the outermost nest.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
Definition: OpenMPKinds.h:201
@ OMPC_BIND_unknown
Definition: OpenMPKinds.h:204
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
Definition: OpenMPKinds.h:158
@ OMPC_LASTPRIVATE_unknown
Definition: OpenMPKinds.h:161
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition: OpenMPKinds.h:55
@ OMPC_DEPEND_unknown
Definition: OpenMPKinds.h:59
OpenMPGrainsizeClauseModifier
Definition: OpenMPKinds.h:207
@ OMPC_GRAINSIZE_unknown
Definition: OpenMPKinds.h:210
unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str, const LangOptions &LangOpts)
OpenMPNumTasksClauseModifier
Definition: OpenMPKinds.h:213
@ OMPC_NUMTASKS_unknown
Definition: OpenMPKinds.h:216
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
bool isOpenMPCapturingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive can capture variables.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
Definition: OpenMPKinds.h:143
@ OMPC_SEVERITY_unknown
Definition: OpenMPKinds.h:146
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
static constexpr unsigned NumberOfOMPMotionModifiers
Number of allowed motion-modifiers.
Definition: OpenMPKinds.h:100
OpenMPMotionModifierKind
OpenMP modifier kind for 'to' or 'from' clause.
Definition: OpenMPKinds.h:92
@ OMPC_MOTION_MODIFIER_unknown
Definition: OpenMPKinds.h:96
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
Definition: OpenMPKinds.h:111
@ OMPC_DEFAULTMAP_unknown
Definition: OpenMPKinds.h:115
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
Definition: OpenMPKinds.h:227
@ OMPC_ALLOCATE_unknown
Definition: OpenMPKinds.h:230
bool isOpenMPThreadPrivate(OpenMPClauseKind Kind)
Checks if the specified clause is one of threadprivate clauses like 'threadprivate',...
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition: OpenMPKinds.h:63
@ OMPC_LINEAR_unknown
Definition: OpenMPKinds.h:67
bool isOpenMPExecutableDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is considered as "executable".
bool isOpenMPInformationalDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is considered as "informational".
bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a simd directive.
void getOpenMPCaptureRegions(llvm::SmallVectorImpl< OpenMPDirectiveKind > &CaptureRegions, OpenMPDirectiveKind DKind)
Return the captured regions of an OpenMP directive.
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
Definition: OpenMPKinds.h:128
@ OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
Definition: OpenMPKinds.h:132
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
Definition: OpenMPKinds.h:48
@ OMPC_DEVICE_unknown
Definition: OpenMPKinds.h:51
OpenMPMapModifierKind
OpenMP modifier kind for 'map' clause.
Definition: OpenMPKinds.h:79
@ OMPC_MAP_MODIFIER_last
Definition: OpenMPKinds.h:84
@ OMPC_MAP_MODIFIER_unknown
Definition: OpenMPKinds.h:80
bool isOpenMPCombinedParallelADirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a combined construct for which the first construct is a parallel...
bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a distribute directive in the outerm...
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
Definition: OpenMPKinds.h:165
@ OMPC_ORDER_unknown
Definition: OpenMPKinds.h:168
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition: OpenMPKinds.h:31
@ OMPC_SCHEDULE_unknown
Definition: OpenMPKinds.h:35
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition: OpenMPKinds.h:71
@ OMPC_MAP_unknown
Definition: OpenMPKinds.h:75
OMPInteropInfo(bool IsTarget=false, bool IsTargetSync=false)
Definition: OpenMPKinds.h:236
llvm::SmallVector< Expr *, 4 > PreferTypes
Definition: OpenMPKinds.h:240
Scheduling data for loop-based OpenMP directives.
Definition: OpenMPKinds.h:180
OpenMPScheduleClauseModifier M2
Definition: OpenMPKinds.h:183
OpenMPScheduleClauseModifier M1
Definition: OpenMPKinds.h:182
OpenMPScheduleClauseKind Schedule
Definition: OpenMPKinds.h:181