]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/clang/include/clang/Basic/OpenMPKinds.h
Fix a memory leak in if_delgroups() introduced in r334118.
[FreeBSD/FreeBSD.git] / contrib / llvm-project / clang / include / clang / Basic / OpenMPKinds.h
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
19 namespace clang {
20
21 /// OpenMP directives.
22 enum OpenMPDirectiveKind {
23 #define OPENMP_DIRECTIVE(Name) \
24   OMPD_##Name,
25 #define OPENMP_DIRECTIVE_EXT(Name, Str) \
26   OMPD_##Name,
27 #include "clang/Basic/OpenMPKinds.def"
28   OMPD_unknown
29 };
30
31 /// OpenMP clauses.
32 enum OpenMPClauseKind {
33 #define OPENMP_CLAUSE(Name, Class) \
34   OMPC_##Name,
35 #include "clang/Basic/OpenMPKinds.def"
36   OMPC_threadprivate,
37   OMPC_uniform,
38   OMPC_unknown
39 };
40
41 /// OpenMP attributes for 'default' clause.
42 enum OpenMPDefaultClauseKind {
43 #define OPENMP_DEFAULT_KIND(Name) \
44   OMPC_DEFAULT_##Name,
45 #include "clang/Basic/OpenMPKinds.def"
46   OMPC_DEFAULT_unknown
47 };
48
49 /// OpenMP attributes for 'proc_bind' clause.
50 enum OpenMPProcBindClauseKind {
51 #define OPENMP_PROC_BIND_KIND(Name) \
52   OMPC_PROC_BIND_##Name,
53 #include "clang/Basic/OpenMPKinds.def"
54   OMPC_PROC_BIND_unknown
55 };
56
57 /// OpenMP attributes for 'schedule' clause.
58 enum OpenMPScheduleClauseKind {
59 #define OPENMP_SCHEDULE_KIND(Name) \
60   OMPC_SCHEDULE_##Name,
61 #include "clang/Basic/OpenMPKinds.def"
62   OMPC_SCHEDULE_unknown
63 };
64
65 /// OpenMP modifiers for 'schedule' clause.
66 enum OpenMPScheduleClauseModifier {
67   OMPC_SCHEDULE_MODIFIER_unknown = OMPC_SCHEDULE_unknown,
68 #define OPENMP_SCHEDULE_MODIFIER(Name) \
69   OMPC_SCHEDULE_MODIFIER_##Name,
70 #include "clang/Basic/OpenMPKinds.def"
71   OMPC_SCHEDULE_MODIFIER_last
72 };
73
74 /// OpenMP attributes for 'depend' clause.
75 enum OpenMPDependClauseKind {
76 #define OPENMP_DEPEND_KIND(Name) \
77   OMPC_DEPEND_##Name,
78 #include "clang/Basic/OpenMPKinds.def"
79   OMPC_DEPEND_unknown
80 };
81
82 /// OpenMP attributes for 'linear' clause.
83 enum OpenMPLinearClauseKind {
84 #define OPENMP_LINEAR_KIND(Name) \
85   OMPC_LINEAR_##Name,
86 #include "clang/Basic/OpenMPKinds.def"
87   OMPC_LINEAR_unknown
88 };
89
90 /// OpenMP mapping kind for 'map' clause.
91 enum OpenMPMapClauseKind {
92 #define OPENMP_MAP_KIND(Name) \
93   OMPC_MAP_##Name,
94 #include "clang/Basic/OpenMPKinds.def"
95   OMPC_MAP_unknown
96 };
97
98 /// OpenMP modifier kind for 'map' clause.
99 enum OpenMPMapModifierKind {
100   OMPC_MAP_MODIFIER_unknown = OMPC_MAP_unknown,
101 #define OPENMP_MAP_MODIFIER_KIND(Name) \
102   OMPC_MAP_MODIFIER_##Name,
103 #include "clang/Basic/OpenMPKinds.def"
104   OMPC_MAP_MODIFIER_last
105 };
106
107 /// OpenMP modifier kind for 'to' clause.
108 enum OpenMPToModifierKind {
109 #define OPENMP_TO_MODIFIER_KIND(Name) \
110   OMPC_TO_MODIFIER_##Name,
111 #include "clang/Basic/OpenMPKinds.def"
112   OMPC_TO_MODIFIER_unknown
113 };
114
115 /// OpenMP modifier kind for 'from' clause.
116 enum OpenMPFromModifierKind {
117 #define OPENMP_FROM_MODIFIER_KIND(Name) \
118   OMPC_FROM_MODIFIER_##Name,
119 #include "clang/Basic/OpenMPKinds.def"
120   OMPC_FROM_MODIFIER_unknown
121 };
122
123 /// OpenMP attributes for 'dist_schedule' clause.
124 enum OpenMPDistScheduleClauseKind {
125 #define OPENMP_DIST_SCHEDULE_KIND(Name) OMPC_DIST_SCHEDULE_##Name,
126 #include "clang/Basic/OpenMPKinds.def"
127   OMPC_DIST_SCHEDULE_unknown
128 };
129
130 /// OpenMP attributes for 'defaultmap' clause.
131 enum OpenMPDefaultmapClauseKind {
132 #define OPENMP_DEFAULTMAP_KIND(Name) \
133   OMPC_DEFAULTMAP_##Name,
134 #include "clang/Basic/OpenMPKinds.def"
135   OMPC_DEFAULTMAP_unknown
136 };
137
138 /// OpenMP modifiers for 'defaultmap' clause.
139 enum OpenMPDefaultmapClauseModifier {
140   OMPC_DEFAULTMAP_MODIFIER_unknown = OMPC_DEFAULTMAP_unknown,
141 #define OPENMP_DEFAULTMAP_MODIFIER(Name) \
142   OMPC_DEFAULTMAP_MODIFIER_##Name,
143 #include "clang/Basic/OpenMPKinds.def"
144   OMPC_DEFAULTMAP_MODIFIER_last
145 };
146
147 /// OpenMP attributes for 'atomic_default_mem_order' clause.
148 enum OpenMPAtomicDefaultMemOrderClauseKind {
149 #define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)  \
150   OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name,
151 #include "clang/Basic/OpenMPKinds.def"
152   OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
153 };
154
155 /// Scheduling data for loop-based OpenMP directives.
156 struct OpenMPScheduleTy final {
157   OpenMPScheduleClauseKind Schedule = OMPC_SCHEDULE_unknown;
158   OpenMPScheduleClauseModifier M1 = OMPC_SCHEDULE_MODIFIER_unknown;
159   OpenMPScheduleClauseModifier M2 = OMPC_SCHEDULE_MODIFIER_unknown;
160 };
161
162 OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str);
163 const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind);
164
165 OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str);
166 const char *getOpenMPClauseName(OpenMPClauseKind Kind);
167
168 unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str);
169 const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
170
171 bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
172                                  OpenMPClauseKind CKind);
173
174 /// Checks if the specified directive is a directive with an associated
175 /// loop construct.
176 /// \param DKind Specified directive.
177 /// \return true - the directive is a loop-associated directive like 'omp simd'
178 /// or 'omp for' directive, otherwise - false.
179 bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind);
180
181 /// Checks if the specified directive is a worksharing directive.
182 /// \param DKind Specified directive.
183 /// \return true - the directive is a worksharing directive like 'omp for',
184 /// otherwise - false.
185 bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind);
186
187 /// Checks if the specified directive is a taskloop directive.
188 /// \param DKind Specified directive.
189 /// \return true - the directive is a worksharing directive like 'omp taskloop',
190 /// otherwise - false.
191 bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind);
192
193 /// Checks if the specified directive is a parallel-kind directive.
194 /// \param DKind Specified directive.
195 /// \return true - the directive is a parallel-like directive like 'omp
196 /// parallel', otherwise - false.
197 bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind);
198
199 /// Checks if the specified directive is a target code offload directive.
200 /// \param DKind Specified directive.
201 /// \return true - the directive is a target code offload directive like
202 /// 'omp target', 'omp target parallel', 'omp target xxx'
203 /// otherwise - false.
204 bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind);
205
206 /// Checks if the specified directive is a target data offload directive.
207 /// \param DKind Specified directive.
208 /// \return true - the directive is a target data offload directive like
209 /// 'omp target data', 'omp target update', 'omp target enter data',
210 /// 'omp target exit data'
211 /// otherwise - false.
212 bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind);
213
214 /// Checks if the specified composite/combined directive constitutes a teams
215 /// directive in the outermost nest.  For example
216 /// 'omp teams distribute' or 'omp teams distribute parallel for'.
217 /// \param DKind Specified directive.
218 /// \return true - the directive has teams on the outermost nest, otherwise -
219 /// false.
220 bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind);
221
222 /// Checks if the specified directive is a teams-kind directive.  For example,
223 /// 'omp teams distribute' or 'omp target teams'.
224 /// \param DKind Specified directive.
225 /// \return true - the directive is a teams-like directive, otherwise - false.
226 bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind);
227
228 /// Checks if the specified directive is a simd directive.
229 /// \param DKind Specified directive.
230 /// \return true - the directive is a simd directive like 'omp simd',
231 /// otherwise - false.
232 bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);
233
234 /// Checks if the specified directive is a distribute directive.
235 /// \param DKind Specified directive.
236 /// \return true - the directive is a distribute-directive like 'omp
237 /// distribute',
238 /// otherwise - false.
239 bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind);
240
241 /// Checks if the specified composite/combined directive constitutes a
242 /// distribute directive in the outermost nest.  For example,
243 /// 'omp distribute parallel for' or 'omp distribute'.
244 /// \param DKind Specified directive.
245 /// \return true - the directive has distribute on the outermost nest.
246 /// otherwise - false.
247 bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind);
248
249 /// Checks if the specified clause is one of private clauses like
250 /// 'private', 'firstprivate', 'reduction' etc..
251 /// \param Kind Clause kind.
252 /// \return true - the clause is a private clause, otherwise - false.
253 bool isOpenMPPrivate(OpenMPClauseKind Kind);
254
255 /// Checks if the specified clause is one of threadprivate clauses like
256 /// 'threadprivate', 'copyin' or 'copyprivate'.
257 /// \param Kind Clause kind.
258 /// \return true - the clause is a threadprivate clause, otherwise - false.
259 bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);
260
261 /// Checks if the specified directive kind is one of tasking directives - task,
262 /// taskloop or taksloop simd.
263 bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind);
264
265 /// Checks if the specified directive kind is one of the composite or combined
266 /// directives that need loop bound sharing across loops outlined in nested
267 /// functions
268 bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind);
269
270 /// Return the captured regions of an OpenMP directive.
271 void getOpenMPCaptureRegions(
272     llvm::SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
273     OpenMPDirectiveKind DKind);
274 }
275
276 #endif
277