clang 17.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
21namespace clang {
22
23/// OpenMP directives.
24using OpenMPDirectiveKind = llvm::omp::Directive;
25
26/// OpenMP clauses.
27using 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.
87static 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.
99static 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"
108
109/// OpenMP attributes for 'defaultmap' clause.
111#define OPENMP_DEFAULTMAP_KIND(Name) \
112 OMPC_DEFAULTMAP_##Name,
113#include "clang/Basic/OpenMPKinds.def"
116
117/// OpenMP modifiers for 'defaultmap' clause.
120#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
121 OMPC_DEFAULTMAP_MODIFIER_##Name,
122#include "clang/Basic/OpenMPKinds.def"
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"
133
134/// OpenMP attributes for 'at' clause.
136#define OPENMP_AT_KIND(Name) OMPC_AT_##Name,
137#include "clang/Basic/OpenMPKinds.def"
140
141/// OpenMP attributes for 'severity' clause.
143#define OPENMP_SEVERITY_KIND(Name) OMPC_SEVERITY_##Name,
144#include "clang/Basic/OpenMPKinds.def"
147
148/// OpenMP device type for 'device_type' clause.
150#define OPENMP_DEVICE_TYPE_KIND(Name) \
151 OMPC_DEVICE_TYPE_##Name,
152#include "clang/Basic/OpenMPKinds.def"
155
156/// OpenMP 'lastprivate' clause modifier.
158#define OPENMP_LASTPRIVATE_KIND(Name) OMPC_LASTPRIVATE_##Name,
159#include "clang/Basic/OpenMPKinds.def"
161};
162
163/// OpenMP attributes for 'order' clause.
165#define OPENMP_ORDER_KIND(Name) OMPC_ORDER_##Name,
166#include "clang/Basic/OpenMPKinds.def"
168};
169
170/// OpenMP modifiers for 'order' clause.
173#define OPENMP_ORDER_MODIFIER(Name) OMPC_ORDER_MODIFIER_##Name,
174#include "clang/Basic/OpenMPKinds.def"
177
178/// Scheduling data for loop-based OpenMP directives.
179struct OpenMPScheduleTy final {
183};
184
185/// OpenMP modifiers for 'reduction' clause.
187#define OPENMP_REDUCTION_MODIFIER(Name) OMPC_REDUCTION_##Name,
188#include "clang/Basic/OpenMPKinds.def"
190};
191
192/// OpenMP adjust-op kinds for 'adjust_args' clause.
194#define OPENMP_ADJUST_ARGS_KIND(Name) OMPC_ADJUST_ARGS_##Name,
195#include "clang/Basic/OpenMPKinds.def"
197};
198
199/// OpenMP bindings for the 'bind' clause.
201#define OPENMP_BIND_KIND(Name) OMPC_BIND_##Name,
202#include "clang/Basic/OpenMPKinds.def"
205
207#define OPENMP_GRAINSIZE_MODIFIER(Name) OMPC_GRAINSIZE_##Name,
208#include "clang/Basic/OpenMPKinds.def"
211
213#define OPENMP_NUMTASKS_MODIFIER(Name) OMPC_NUMTASKS_##Name,
214#include "clang/Basic/OpenMPKinds.def"
217
218/// Contains 'interop' data for 'append_args' and 'init' clauses.
219class Expr;
220struct OMPInteropInfo final {
221 OMPInteropInfo(bool IsTarget = false, bool IsTargetSync = false)
226};
227
228unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str,
229 const LangOptions &LangOpts);
230const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
231
232/// Checks if the specified directive is a directive with an associated
233/// loop construct.
234/// \param DKind Specified directive.
235/// \return true - the directive is a loop-associated directive like 'omp simd'
236/// or 'omp for' directive, otherwise - false.
238
239/// Checks if the specified directive is a worksharing directive.
240/// \param DKind Specified directive.
241/// \return true - the directive is a worksharing directive like 'omp for',
242/// otherwise - false.
244
245/// Checks if the specified directive is a taskloop directive.
246/// \param DKind Specified directive.
247/// \return true - the directive is a worksharing directive like 'omp taskloop',
248/// otherwise - false.
250
251/// Checks if the specified directive is a parallel-kind directive.
252/// \param DKind Specified directive.
253/// \return true - the directive is a parallel-like directive like 'omp
254/// parallel', otherwise - false.
256
257/// Checks if the specified directive is a target code offload directive.
258/// \param DKind Specified directive.
259/// \return true - the directive is a target code offload directive like
260/// 'omp target', 'omp target parallel', 'omp target xxx'
261/// otherwise - false.
263
264/// Checks if the specified directive is a target data offload directive.
265/// \param DKind Specified directive.
266/// \return true - the directive is a target data offload directive like
267/// 'omp target data', 'omp target update', 'omp target enter data',
268/// 'omp target exit data'
269/// otherwise - false.
271
272/// Checks if the specified composite/combined directive constitutes a teams
273/// directive in the outermost nest. For example
274/// 'omp teams distribute' or 'omp teams distribute parallel for'.
275/// \param DKind Specified directive.
276/// \return true - the directive has teams on the outermost nest, otherwise -
277/// false.
279
280/// Checks if the specified directive is a teams-kind directive. For example,
281/// 'omp teams distribute' or 'omp target teams'.
282/// \param DKind Specified directive.
283/// \return true - the directive is a teams-like directive, otherwise - false.
285
286/// Checks if the specified directive is a simd directive.
287/// \param DKind Specified directive.
288/// \return true - the directive is a simd directive like 'omp simd',
289/// otherwise - false.
291
292/// Checks if the specified directive is a distribute directive.
293/// \param DKind Specified directive.
294/// \return true - the directive is a distribute-directive like 'omp
295/// distribute',
296/// otherwise - false.
298
299/// Checks if the specified composite/combined directive constitutes a
300/// distribute directive in the outermost nest. For example,
301/// 'omp distribute parallel for' or 'omp distribute'.
302/// \param DKind Specified directive.
303/// \return true - the directive has distribute on the outermost nest.
304/// otherwise - false.
306
307/// Checks if the specified directive constitutes a 'loop' directive in the
308/// outermost nest. For example, 'omp teams loop' or 'omp loop'.
309/// \param DKind Specified directive.
310/// \return true - the directive has loop on the outermost nest.
311/// otherwise - false.
313
314/// Checks if the specified clause is one of private clauses like
315/// 'private', 'firstprivate', 'reduction' etc..
316/// \param Kind Clause kind.
317/// \return true - the clause is a private clause, otherwise - false.
319
320/// Checks if the specified clause is one of threadprivate clauses like
321/// 'threadprivate', 'copyin' or 'copyprivate'.
322/// \param Kind Clause kind.
323/// \return true - the clause is a threadprivate clause, otherwise - false.
325
326/// Checks if the specified directive kind is one of tasking directives - task,
327/// taskloop, taksloop simd, master taskloop, parallel master taskloop, master
328/// taskloop simd, or parallel master taskloop simd.
330
331/// Checks if the specified directive kind is one of the composite or combined
332/// directives that need loop bound sharing across loops outlined in nested
333/// functions
335
336/// Checks if the specified directive is a loop transformation directive.
337/// \param DKind Specified directive.
338/// \return True iff the directive is a loop transformation.
340
341/// Return the captured regions of an OpenMP directive.
344 OpenMPDirectiveKind DKind);
345
346/// Checks if the specified directive is a combined construct for which
347/// the first construct is a parallel construct.
348/// \param DKind Specified directive.
349/// \return true - if the above condition is met for this directive
350/// otherwise - false.
352}
353
354#endif
355
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:82
The base class of the type hierarchy.
Definition: Type.h:1568
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind)
Checks if the specified composite/combined directive constitutes a teams directive in the outermost n...
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:24
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
Definition: OpenMPKinds.h:118
@ OMPC_DEFAULTMAP_MODIFIER_last
Definition: OpenMPKinds.h:123
@ OMPC_DEFAULTMAP_MODIFIER_unknown
Definition: OpenMPKinds.h:119
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
Definition: OpenMPKinds.h:171
@ OMPC_ORDER_MODIFIER_unknown
Definition: OpenMPKinds.h:172
@ OMPC_ORDER_MODIFIER_last
Definition: OpenMPKinds.h:175
OpenMPAdjustArgsOpKind
OpenMP adjust-op kinds for 'adjust_args' clause.
Definition: OpenMPKinds.h:193
@ OMPC_ADJUST_ARGS_unknown
Definition: OpenMPKinds.h:196
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
Definition: OpenMPKinds.h:135
@ OMPC_AT_unknown
Definition: OpenMPKinds.h:138
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
Definition: OpenMPKinds.h:186
@ OMPC_REDUCTION_unknown
Definition: OpenMPKinds.h:189
OpenMPDeviceType
OpenMP device type for 'device_type' clause.
Definition: OpenMPKinds.h:149
@ OMPC_DEVICE_TYPE_unknown
Definition: OpenMPKinds.h:153
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition: OpenMPKinds.h:38
@ OMPC_SCHEDULE_MODIFIER_last
Definition: OpenMPKinds.h:43
@ OMPC_SCHEDULE_MODIFIER_unknown
Definition: OpenMPKinds.h:39
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Definition: OpenMPKinds.h:27
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:103
@ OMPC_DIST_SCHEDULE_unknown
Definition: OpenMPKinds.h:106
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:87
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:200
@ OMPC_BIND_unknown
Definition: OpenMPKinds.h:203
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
Definition: OpenMPKinds.h:157
@ OMPC_LASTPRIVATE_unknown
Definition: OpenMPKinds.h:160
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition: OpenMPKinds.h:54
@ OMPC_DEPEND_unknown
Definition: OpenMPKinds.h:58
OpenMPGrainsizeClauseModifier
Definition: OpenMPKinds.h:206
@ OMPC_GRAINSIZE_unknown
Definition: OpenMPKinds.h:209
unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str, const LangOptions &LangOpts)
OpenMPNumTasksClauseModifier
Definition: OpenMPKinds.h:212
@ OMPC_NUMTASKS_unknown
Definition: OpenMPKinds.h:215
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
Definition: OpenMPKinds.h:142
@ OMPC_SEVERITY_unknown
Definition: OpenMPKinds.h:145
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:99
OpenMPMotionModifierKind
OpenMP modifier kind for 'to' or 'from' clause.
Definition: OpenMPKinds.h:91
@ OMPC_MOTION_MODIFIER_unknown
Definition: OpenMPKinds.h:95
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
Definition: OpenMPKinds.h:110
@ OMPC_DEFAULTMAP_unknown
Definition: OpenMPKinds.h:114
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:62
@ OMPC_LINEAR_unknown
Definition: OpenMPKinds.h:66
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:127
@ OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
Definition: OpenMPKinds.h:131
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
Definition: OpenMPKinds.h:47
@ OMPC_DEVICE_unknown
Definition: OpenMPKinds.h:50
OpenMPMapModifierKind
OpenMP modifier kind for 'map' clause.
Definition: OpenMPKinds.h:78
@ OMPC_MAP_MODIFIER_last
Definition: OpenMPKinds.h:83
@ OMPC_MAP_MODIFIER_unknown
Definition: OpenMPKinds.h:79
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:164
@ OMPC_ORDER_unknown
Definition: OpenMPKinds.h:167
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition: OpenMPKinds.h:30
@ OMPC_SCHEDULE_unknown
Definition: OpenMPKinds.h:34
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition: OpenMPKinds.h:70
@ OMPC_MAP_unknown
Definition: OpenMPKinds.h:74
OMPInteropInfo(bool IsTarget=false, bool IsTargetSync=false)
Definition: OpenMPKinds.h:221
llvm::SmallVector< Expr *, 4 > PreferTypes
Definition: OpenMPKinds.h:225
Scheduling data for loop-based OpenMP directives.
Definition: OpenMPKinds.h:179
OpenMPScheduleClauseModifier M2
Definition: OpenMPKinds.h:182
OpenMPScheduleClauseModifier M1
Definition: OpenMPKinds.h:181
OpenMPScheduleClauseKind Schedule
Definition: OpenMPKinds.h:180