Coverage Report

Created: 2020-02-11 07:41

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Basic/OpenMPKinds.h
Line
Count
Source
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.
23
enum OpenMPContextSelectorSetKind {
24
#define OPENMP_CONTEXT_SELECTOR_SET(Name) OMP_CTX_SET_##Name,
25
#include "clang/Basic/OpenMPKinds.def"
26
  OMP_CTX_SET_unknown,
27
};
28
29
/// OpenMP context selectors.
30
enum OpenMPContextSelectorKind {
31
#define OPENMP_CONTEXT_SELECTOR(Name) OMP_CTX_##Name,
32
#include "clang/Basic/OpenMPKinds.def"
33
  OMP_CTX_unknown,
34
};
35
36
OpenMPContextSelectorSetKind getOpenMPContextSelectorSet(llvm::StringRef Str);
37
llvm::StringRef
38
getOpenMPContextSelectorSetName(OpenMPContextSelectorSetKind Kind);
39
OpenMPContextSelectorKind getOpenMPContextSelector(llvm::StringRef Str);
40
llvm::StringRef getOpenMPContextSelectorName(OpenMPContextSelectorKind Kind);
41
42
/// Struct to store the context selectors info.
43
template <typename VectorType, typename ScoreT> struct OpenMPCtxSelectorData {
44
  OpenMPContextSelectorSetKind CtxSet = OMP_CTX_SET_unknown;
45
  OpenMPContextSelectorKind Ctx = OMP_CTX_unknown;
46
  ScoreT Score;
47
  VectorType Names;
48
1.18k
  explicit OpenMPCtxSelectorData() = default;
49
  explicit OpenMPCtxSelectorData(OpenMPContextSelectorSetKind CtxSet,
50
                                 OpenMPContextSelectorKind Ctx,
51
                                 const ScoreT &Score, VectorType &&Names)
52
      : CtxSet(CtxSet), Ctx(Ctx), Score(Score), Names(Names) {}
53
  template <typename U>
54
  explicit OpenMPCtxSelectorData(OpenMPContextSelectorSetKind CtxSet,
55
                                 OpenMPContextSelectorKind Ctx,
56
                                 const ScoreT &Score, const U &Names)
57
      : CtxSet(CtxSet), Ctx(Ctx), Score(Score),
58
869
        Names(Names.begin(), Names.end()) {}
clang::OpenMPCtxSelectorData<llvm::SmallVector<llvm::SmallString<8u>, 4u>, clang::ActionResult<clang::Expr*, true> >::OpenMPCtxSelectorData<llvm::UniqueVector<llvm::SmallString<8u> > >(clang::OpenMPContextSelectorSetKind, clang::OpenMPContextSelectorKind, clang::ActionResult<clang::Expr*, true> const&, llvm::UniqueVector<llvm::SmallString<8u> > const&)
Line
Count
Source
58
839
        Names(Names.begin(), Names.end()) {}
clang::OpenMPCtxSelectorData<llvm::SmallVector<llvm::SmallString<8u>, 4u>, clang::ActionResult<clang::Expr*, true> >::OpenMPCtxSelectorData<llvm::iterator_range<llvm::StringRef*> >(clang::OpenMPContextSelectorSetKind, clang::OpenMPContextSelectorKind, clang::ActionResult<clang::Expr*, true> const&, llvm::iterator_range<llvm::StringRef*> const&)
Line
Count
Source
58
30
        Names(Names.begin(), Names.end()) {}
59
};
60
61
/// OpenMP directives.
62
using OpenMPDirectiveKind = llvm::omp::Directive;
63
64
/// OpenMP clauses.
65
enum OpenMPClauseKind {
66
#define OPENMP_CLAUSE(Name, Class) \
67
  OMPC_##Name,
68
#include "clang/Basic/OpenMPKinds.def"
69
  OMPC_threadprivate,
70
  OMPC_uniform,
71
  OMPC_device_type,
72
  OMPC_match,
73
  OMPC_unknown
74
};
75
76
/// OpenMP attributes for 'default' clause.
77
enum OpenMPDefaultClauseKind {
78
#define OPENMP_DEFAULT_KIND(Name) \
79
  OMPC_DEFAULT_##Name,
80
#include "clang/Basic/OpenMPKinds.def"
81
  OMPC_DEFAULT_unknown
82
};
83
84
/// OpenMP attributes for 'schedule' clause.
85
enum OpenMPScheduleClauseKind {
86
#define OPENMP_SCHEDULE_KIND(Name) \
87
  OMPC_SCHEDULE_##Name,
88
#include "clang/Basic/OpenMPKinds.def"
89
  OMPC_SCHEDULE_unknown
90
};
91
92
/// OpenMP modifiers for 'schedule' clause.
93
enum OpenMPScheduleClauseModifier {
94
  OMPC_SCHEDULE_MODIFIER_unknown = OMPC_SCHEDULE_unknown,
95
#define OPENMP_SCHEDULE_MODIFIER(Name) \
96
  OMPC_SCHEDULE_MODIFIER_##Name,
97
#include "clang/Basic/OpenMPKinds.def"
98
  OMPC_SCHEDULE_MODIFIER_last
99
};
100
101
/// OpenMP attributes for 'depend' clause.
102
enum OpenMPDependClauseKind {
103
#define OPENMP_DEPEND_KIND(Name) \
104
  OMPC_DEPEND_##Name,
105
#include "clang/Basic/OpenMPKinds.def"
106
  OMPC_DEPEND_unknown
107
};
108
109
/// OpenMP attributes for 'linear' clause.
110
enum OpenMPLinearClauseKind {
111
#define OPENMP_LINEAR_KIND(Name) \
112
  OMPC_LINEAR_##Name,
113
#include "clang/Basic/OpenMPKinds.def"
114
  OMPC_LINEAR_unknown
115
};
116
117
/// OpenMP mapping kind for 'map' clause.
118
enum OpenMPMapClauseKind {
119
#define OPENMP_MAP_KIND(Name) \
120
  OMPC_MAP_##Name,
121
#include "clang/Basic/OpenMPKinds.def"
122
  OMPC_MAP_unknown
123
};
124
125
/// OpenMP modifier kind for 'map' clause.
126
enum OpenMPMapModifierKind {
127
  OMPC_MAP_MODIFIER_unknown = OMPC_MAP_unknown,
128
#define OPENMP_MAP_MODIFIER_KIND(Name) \
129
  OMPC_MAP_MODIFIER_##Name,
130
#include "clang/Basic/OpenMPKinds.def"
131
  OMPC_MAP_MODIFIER_last
132
};
133
134
/// OpenMP modifier kind for 'to' clause.
135
enum OpenMPToModifierKind {
136
#define OPENMP_TO_MODIFIER_KIND(Name) \
137
  OMPC_TO_MODIFIER_##Name,
138
#include "clang/Basic/OpenMPKinds.def"
139
  OMPC_TO_MODIFIER_unknown
140
};
141
142
/// OpenMP modifier kind for 'from' clause.
143
enum OpenMPFromModifierKind {
144
#define OPENMP_FROM_MODIFIER_KIND(Name) \
145
  OMPC_FROM_MODIFIER_##Name,
146
#include "clang/Basic/OpenMPKinds.def"
147
  OMPC_FROM_MODIFIER_unknown
148
};
149
150
/// OpenMP attributes for 'dist_schedule' clause.
151
enum OpenMPDistScheduleClauseKind {
152
#define OPENMP_DIST_SCHEDULE_KIND(Name) OMPC_DIST_SCHEDULE_##Name,
153
#include "clang/Basic/OpenMPKinds.def"
154
  OMPC_DIST_SCHEDULE_unknown
155
};
156
157
/// OpenMP attributes for 'defaultmap' clause.
158
enum OpenMPDefaultmapClauseKind {
159
#define OPENMP_DEFAULTMAP_KIND(Name) \
160
  OMPC_DEFAULTMAP_##Name,
161
#include "clang/Basic/OpenMPKinds.def"
162
  OMPC_DEFAULTMAP_unknown
163
};
164
165
/// OpenMP modifiers for 'defaultmap' clause.
166
enum OpenMPDefaultmapClauseModifier {
167
  OMPC_DEFAULTMAP_MODIFIER_unknown = OMPC_DEFAULTMAP_unknown,
168
#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
169
  OMPC_DEFAULTMAP_MODIFIER_##Name,
170
#include "clang/Basic/OpenMPKinds.def"
171
  OMPC_DEFAULTMAP_MODIFIER_last
172
};
173
174
/// OpenMP attributes for 'atomic_default_mem_order' clause.
175
enum OpenMPAtomicDefaultMemOrderClauseKind {
176
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)  \
177
  OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name,
178
#include "clang/Basic/OpenMPKinds.def"
179
  OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
180
};
181
182
/// OpenMP device type for 'device_type' clause.
183
enum OpenMPDeviceType {
184
#define OPENMP_DEVICE_TYPE_KIND(Name) \
185
  OMPC_DEVICE_TYPE_##Name,
186
#include "clang/Basic/OpenMPKinds.def"
187
  OMPC_DEVICE_TYPE_unknown
188
};
189
190
/// OpenMP 'lastprivate' clause modifier.
191
enum OpenMPLastprivateModifier {
192
#define OPENMP_LASTPRIVATE_KIND(Name) OMPC_LASTPRIVATE_##Name,
193
#include "clang/Basic/OpenMPKinds.def"
194
  OMPC_LASTPRIVATE_unknown,
195
};
196
197
/// OpenMP attributes for 'order' clause.
198
enum OpenMPOrderClauseKind {
199
#define OPENMP_ORDER_KIND(Name) OMPC_ORDER_##Name,
200
#include "clang/Basic/OpenMPKinds.def"
201
  OMPC_ORDER_unknown,
202
};
203
204
/// Scheduling data for loop-based OpenMP directives.
205
struct OpenMPScheduleTy final {
206
  OpenMPScheduleClauseKind Schedule = OMPC_SCHEDULE_unknown;
207
  OpenMPScheduleClauseModifier M1 = OMPC_SCHEDULE_MODIFIER_unknown;
208
  OpenMPScheduleClauseModifier M2 = OMPC_SCHEDULE_MODIFIER_unknown;
209
};
210
211
OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str);
212
const char *getOpenMPClauseName(OpenMPClauseKind Kind);
213
214
unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str);
215
const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
216
217
bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
218
                                 OpenMPClauseKind CKind,
219
                                 unsigned OpenMPVersion);
220
221
/// Checks if the specified directive is a directive with an associated
222
/// loop construct.
223
/// \param DKind Specified directive.
224
/// \return true - the directive is a loop-associated directive like 'omp simd'
225
/// or 'omp for' directive, otherwise - false.
226
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind);
227
228
/// Checks if the specified directive is a worksharing directive.
229
/// \param DKind Specified directive.
230
/// \return true - the directive is a worksharing directive like 'omp for',
231
/// otherwise - false.
232
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind);
233
234
/// Checks if the specified directive is a taskloop directive.
235
/// \param DKind Specified directive.
236
/// \return true - the directive is a worksharing directive like 'omp taskloop',
237
/// otherwise - false.
238
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind);
239
240
/// Checks if the specified directive is a parallel-kind directive.
241
/// \param DKind Specified directive.
242
/// \return true - the directive is a parallel-like directive like 'omp
243
/// parallel', otherwise - false.
244
bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind);
245
246
/// Checks if the specified directive is a target code offload directive.
247
/// \param DKind Specified directive.
248
/// \return true - the directive is a target code offload directive like
249
/// 'omp target', 'omp target parallel', 'omp target xxx'
250
/// otherwise - false.
251
bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind);
252
253
/// Checks if the specified directive is a target data offload directive.
254
/// \param DKind Specified directive.
255
/// \return true - the directive is a target data offload directive like
256
/// 'omp target data', 'omp target update', 'omp target enter data',
257
/// 'omp target exit data'
258
/// otherwise - false.
259
bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind);
260
261
/// Checks if the specified composite/combined directive constitutes a teams
262
/// directive in the outermost nest.  For example
263
/// 'omp teams distribute' or 'omp teams distribute parallel for'.
264
/// \param DKind Specified directive.
265
/// \return true - the directive has teams on the outermost nest, otherwise -
266
/// false.
267
bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind);
268
269
/// Checks if the specified directive is a teams-kind directive.  For example,
270
/// 'omp teams distribute' or 'omp target teams'.
271
/// \param DKind Specified directive.
272
/// \return true - the directive is a teams-like directive, otherwise - false.
273
bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind);
274
275
/// Checks if the specified directive is a simd directive.
276
/// \param DKind Specified directive.
277
/// \return true - the directive is a simd directive like 'omp simd',
278
/// otherwise - false.
279
bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);
280
281
/// Checks if the specified directive is a distribute directive.
282
/// \param DKind Specified directive.
283
/// \return true - the directive is a distribute-directive like 'omp
284
/// distribute',
285
/// otherwise - false.
286
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind);
287
288
/// Checks if the specified composite/combined directive constitutes a
289
/// distribute directive in the outermost nest.  For example,
290
/// 'omp distribute parallel for' or 'omp distribute'.
291
/// \param DKind Specified directive.
292
/// \return true - the directive has distribute on the outermost nest.
293
/// otherwise - false.
294
bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind);
295
296
/// Checks if the specified clause is one of private clauses like
297
/// 'private', 'firstprivate', 'reduction' etc..
298
/// \param Kind Clause kind.
299
/// \return true - the clause is a private clause, otherwise - false.
300
bool isOpenMPPrivate(OpenMPClauseKind Kind);
301
302
/// Checks if the specified clause is one of threadprivate clauses like
303
/// 'threadprivate', 'copyin' or 'copyprivate'.
304
/// \param Kind Clause kind.
305
/// \return true - the clause is a threadprivate clause, otherwise - false.
306
bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);
307
308
/// Checks if the specified directive kind is one of tasking directives - task,
309
/// taskloop, taksloop simd, master taskloop, parallel master taskloop, master
310
/// taskloop simd, or parallel master taskloop simd.
311
bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind);
312
313
/// Checks if the specified directive kind is one of the composite or combined
314
/// directives that need loop bound sharing across loops outlined in nested
315
/// functions
316
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind);
317
318
/// Return the captured regions of an OpenMP directive.
319
void getOpenMPCaptureRegions(
320
    llvm::SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
321
    OpenMPDirectiveKind DKind);
322
}
323
324
#endif
325