]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Basic/OpenMPKinds.h
Merge ^/head r313896 through r314128.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Basic / OpenMPKinds.h
1 //===--- OpenMPKinds.h - OpenMP enums ---------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief Defines some OpenMP-specific enums and functions.
12 ///
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CLANG_BASIC_OPENMPKINDS_H
16 #define LLVM_CLANG_BASIC_OPENMPKINDS_H
17
18 #include "llvm/ADT/StringRef.h"
19
20 namespace clang {
21
22 /// \brief OpenMP directives.
23 enum OpenMPDirectiveKind {
24 #define OPENMP_DIRECTIVE(Name) \
25   OMPD_##Name,
26 #define OPENMP_DIRECTIVE_EXT(Name, Str) \
27   OMPD_##Name,
28 #include "clang/Basic/OpenMPKinds.def"
29   OMPD_unknown
30 };
31
32 /// \brief OpenMP clauses.
33 enum OpenMPClauseKind {
34 #define OPENMP_CLAUSE(Name, Class) \
35   OMPC_##Name,
36 #include "clang/Basic/OpenMPKinds.def"
37   OMPC_threadprivate,
38   OMPC_uniform,
39   OMPC_unknown
40 };
41
42 /// \brief OpenMP attributes for 'default' clause.
43 enum OpenMPDefaultClauseKind {
44 #define OPENMP_DEFAULT_KIND(Name) \
45   OMPC_DEFAULT_##Name,
46 #include "clang/Basic/OpenMPKinds.def"
47   OMPC_DEFAULT_unknown
48 };
49
50 /// \brief OpenMP attributes for 'proc_bind' clause.
51 enum OpenMPProcBindClauseKind {
52 #define OPENMP_PROC_BIND_KIND(Name) \
53   OMPC_PROC_BIND_##Name,
54 #include "clang/Basic/OpenMPKinds.def"
55   OMPC_PROC_BIND_unknown
56 };
57
58 /// \brief OpenMP attributes for 'schedule' clause.
59 enum OpenMPScheduleClauseKind {
60 #define OPENMP_SCHEDULE_KIND(Name) \
61   OMPC_SCHEDULE_##Name,
62 #include "clang/Basic/OpenMPKinds.def"
63   OMPC_SCHEDULE_unknown
64 };
65
66 /// \brief OpenMP modifiers for 'schedule' clause.
67 enum OpenMPScheduleClauseModifier {
68   OMPC_SCHEDULE_MODIFIER_unknown = OMPC_SCHEDULE_unknown,
69 #define OPENMP_SCHEDULE_MODIFIER(Name) \
70   OMPC_SCHEDULE_MODIFIER_##Name,
71 #include "clang/Basic/OpenMPKinds.def"
72   OMPC_SCHEDULE_MODIFIER_last
73 };
74
75 /// \brief OpenMP attributes for 'depend' clause.
76 enum OpenMPDependClauseKind {
77 #define OPENMP_DEPEND_KIND(Name) \
78   OMPC_DEPEND_##Name,
79 #include "clang/Basic/OpenMPKinds.def"
80   OMPC_DEPEND_unknown
81 };
82
83 /// \brief OpenMP attributes for 'linear' clause.
84 enum OpenMPLinearClauseKind {
85 #define OPENMP_LINEAR_KIND(Name) \
86   OMPC_LINEAR_##Name,
87 #include "clang/Basic/OpenMPKinds.def"
88   OMPC_LINEAR_unknown
89 };
90
91 /// \brief OpenMP mapping kind for 'map' clause.
92 enum OpenMPMapClauseKind {
93 #define OPENMP_MAP_KIND(Name) \
94   OMPC_MAP_##Name,
95 #include "clang/Basic/OpenMPKinds.def"
96   OMPC_MAP_unknown
97 };
98
99 /// \brief OpenMP attributes for 'dist_schedule' clause.
100 enum OpenMPDistScheduleClauseKind {
101 #define OPENMP_DIST_SCHEDULE_KIND(Name) OMPC_DIST_SCHEDULE_##Name,
102 #include "clang/Basic/OpenMPKinds.def"
103   OMPC_DIST_SCHEDULE_unknown
104 };
105
106 /// \brief OpenMP attributes for 'defaultmap' clause.
107 enum OpenMPDefaultmapClauseKind {
108 #define OPENMP_DEFAULTMAP_KIND(Name) \
109   OMPC_DEFAULTMAP_##Name,
110 #include "clang/Basic/OpenMPKinds.def"
111   OMPC_DEFAULTMAP_unknown
112 };
113
114 /// \brief OpenMP modifiers for 'defaultmap' clause.
115 enum OpenMPDefaultmapClauseModifier {
116   OMPC_DEFAULTMAP_MODIFIER_unknown = OMPC_DEFAULTMAP_unknown,
117 #define OPENMP_DEFAULTMAP_MODIFIER(Name) \
118   OMPC_DEFAULTMAP_MODIFIER_##Name,
119 #include "clang/Basic/OpenMPKinds.def"
120   OMPC_DEFAULTMAP_MODIFIER_last
121 };
122
123 /// Scheduling data for loop-based OpenMP directives.
124 struct OpenMPScheduleTy final {
125   OpenMPScheduleClauseKind Schedule = OMPC_SCHEDULE_unknown;
126   OpenMPScheduleClauseModifier M1 = OMPC_SCHEDULE_MODIFIER_unknown;
127   OpenMPScheduleClauseModifier M2 = OMPC_SCHEDULE_MODIFIER_unknown;
128 };
129
130 OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str);
131 const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind);
132
133 OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str);
134 const char *getOpenMPClauseName(OpenMPClauseKind Kind);
135
136 unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str);
137 const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
138
139 bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
140                                  OpenMPClauseKind CKind);
141
142 /// \brief Checks if the specified directive is a directive with an associated
143 /// loop construct.
144 /// \param DKind Specified directive.
145 /// \return true - the directive is a loop-associated directive like 'omp simd'
146 /// or 'omp for' directive, otherwise - false.
147 bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind);
148
149 /// \brief Checks if the specified directive is a worksharing directive.
150 /// \param DKind Specified directive.
151 /// \return true - the directive is a worksharing directive like 'omp for',
152 /// otherwise - false.
153 bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind);
154
155 /// \brief Checks if the specified directive is a taskloop directive.
156 /// \param DKind Specified directive.
157 /// \return true - the directive is a worksharing directive like 'omp taskloop',
158 /// otherwise - false.
159 bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind);
160
161 /// \brief Checks if the specified directive is a parallel-kind directive.
162 /// \param DKind Specified directive.
163 /// \return true - the directive is a parallel-like directive like 'omp
164 /// parallel', otherwise - false.
165 bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind);
166
167 /// \brief Checks if the specified directive is a target code offload directive.
168 /// \param DKind Specified directive.
169 /// \return true - the directive is a target code offload directive like
170 /// 'omp target', 'omp target parallel', 'omp target xxx'
171 /// otherwise - false.
172 bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind);
173
174 /// \brief Checks if the specified directive is a target data offload directive.
175 /// \param DKind Specified directive.
176 /// \return true - the directive is a target data offload directive like
177 /// 'omp target data', 'omp target update', 'omp target enter data',
178 /// 'omp target exit data'
179 /// otherwise - false.
180 bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind);
181
182 /// Checks if the specified composite/combined directive constitutes a teams
183 /// directive in the outermost nest.  For example
184 /// 'omp teams distribute' or 'omp teams distribute parallel for'.
185 /// \param DKind Specified directive.
186 /// \return true - the directive has teams on the outermost nest, otherwise -
187 /// false.
188 bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind);
189
190 /// Checks if the specified directive is a teams-kind directive.  For example,
191 /// 'omp teams distribute' or 'omp target teams'.
192 /// \param DKind Specified directive.
193 /// \return true - the directive is a teams-like directive, otherwise - false.
194 bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind);
195
196 /// \brief Checks if the specified directive is a simd directive.
197 /// \param DKind Specified directive.
198 /// \return true - the directive is a simd directive like 'omp simd',
199 /// otherwise - false.
200 bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);
201
202 /// \brief Checks if the specified directive is a distribute directive.
203 /// \param DKind Specified directive.
204 /// \return true - the directive is a distribute-directive like 'omp
205 /// distribute',
206 /// otherwise - false.
207 bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind);
208
209 /// Checks if the specified composite/combined directive constitutes a
210 /// distribute directive in the outermost nest.  For example,
211 /// 'omp distribute parallel for' or 'omp distribute'.
212 /// \param DKind Specified directive.
213 /// \return true - the directive has distribute on the outermost nest.
214 /// otherwise - false.
215 bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind);
216
217 /// \brief Checks if the specified clause is one of private clauses like
218 /// 'private', 'firstprivate', 'reduction' etc..
219 /// \param Kind Clause kind.
220 /// \return true - the clause is a private clause, otherwise - false.
221 bool isOpenMPPrivate(OpenMPClauseKind Kind);
222
223 /// \brief Checks if the specified clause is one of threadprivate clauses like
224 /// 'threadprivate', 'copyin' or 'copyprivate'.
225 /// \param Kind Clause kind.
226 /// \return true - the clause is a threadprivate clause, otherwise - false.
227 bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);
228
229 /// Checks if the specified directive kind is one of tasking directives - task,
230 /// taskloop or taksloop simd.
231 bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind);
232
233 /// Checks if the specified directive kind is one of the composite or combined
234 /// directives that need loop bound sharing across loops outlined in nested
235 /// functions
236 bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind);
237 }
238
239 #endif
240