Coverage Report

Created: 2022-05-21 09:15

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/OpenMPKinds.cpp
Line
Count
Source (jump to first uncovered line)
1
//===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
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
/// \file
9
/// This file implements the OpenMP enum and support functions.
10
///
11
//===----------------------------------------------------------------------===//
12
13
#include "clang/Basic/OpenMPKinds.h"
14
#include "clang/Basic/IdentifierTable.h"
15
#include "llvm/ADT/StringRef.h"
16
#include "llvm/ADT/StringSwitch.h"
17
#include "llvm/Support/ErrorHandling.h"
18
#include <cassert>
19
20
using namespace clang;
21
using namespace llvm::omp;
22
23
unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, StringRef Str,
24
42.2k
                                          const LangOptions &LangOpts) {
25
42.2k
  switch (Kind) {
26
1.82k
  case OMPC_default:
27
1.82k
    return llvm::StringSwitch<unsigned>(Str)
28
9.10k
#define OMP_DEFAULT_KIND(Enum, Name) .Case(Name, unsigned(Enum))
29
1.82k
#include "llvm/Frontend/OpenMP/OMPKinds.def"
30
1.82k
        .Default(unsigned(llvm::omp::OMP_DEFAULT_unknown));
31
671
  case OMPC_proc_bind:
32
671
    return llvm::StringSwitch<unsigned>(Str)
33
4.02k
#define OMP_PROC_BIND_KIND(Enum, Name, Value) .Case(Name, Value)
34
671
#include "llvm/Frontend/OpenMP/OMPKinds.def"
35
671
        .Default(unsigned(llvm::omp::OMP_PROC_BIND_unknown));
36
3.03k
  case OMPC_schedule:
37
3.03k
    return llvm::StringSwitch<unsigned>(Str)
38
3.03k
#define OPENMP_SCHEDULE_KIND(Name)                                             \
39
15.1k
  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
40
3.03k
#define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
41
9.11k
  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
42
3.03k
#include "clang/Basic/OpenMPKinds.def"
43
3.03k
        .Default(OMPC_SCHEDULE_unknown);
44
5.56k
  case OMPC_depend: {
45
5.56k
    unsigned Type = llvm::StringSwitch<unsigned>(Str)
46
44.5k
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
47
5.56k
#include "clang/Basic/OpenMPKinds.def"
48
5.56k
                        .Default(OMPC_DEPEND_unknown);
49
5.56k
    if (LangOpts.OpenMP < 51 && 
Type == OMPC_DEPEND_inoutset4.30k
)
50
0
      return OMPC_DEPEND_unknown;
51
5.56k
    return Type;
52
5.56k
  }
53
362
  case OMPC_linear:
54
362
    return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
55
1.08k
#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
56
362
#include "clang/Basic/OpenMPKinds.def"
57
362
        .Default(OMPC_LINEAR_unknown);
58
20.8k
  case OMPC_map: {
59
20.8k
    unsigned Type = llvm::StringSwitch<unsigned>(Str)
60
20.8k
#define OPENMP_MAP_KIND(Name)                                                  \
61
124k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
62
20.8k
#define OPENMP_MAP_MODIFIER_KIND(Name)                                         \
63
104k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
64
20.8k
#include "clang/Basic/OpenMPKinds.def"
65
20.8k
        .Default(OMPC_MAP_unknown);
66
20.8k
    if (LangOpts.OpenMP < 51 && 
Type == OMPC_MAP_MODIFIER_present17.5k
)
67
320
      return OMPC_MAP_MODIFIER_unknown;
68
20.4k
    if (!LangOpts.OpenMPExtensions && 
Type == OMPC_MAP_MODIFIER_ompx_hold4.50k
)
69
114
      return OMPC_MAP_MODIFIER_unknown;
70
20.3k
    return Type;
71
20.4k
  }
72
2.10k
  case OMPC_to:
73
2.98k
  case OMPC_from: {
74
2.98k
    unsigned Type = llvm::StringSwitch<unsigned>(Str)
75
2.98k
#define OPENMP_MOTION_MODIFIER_KIND(Name)                                      \
76
5.96k
  .Case(#Name, static_cast<unsigned>(OMPC_MOTION_MODIFIER_##Name))
77
2.98k
#include "clang/Basic/OpenMPKinds.def"
78
2.98k
        .Default(OMPC_MOTION_MODIFIER_unknown);
79
2.98k
    if (LangOpts.OpenMP < 51 && 
Type == OMPC_MOTION_MODIFIER_present2.43k
)
80
36
      return OMPC_MOTION_MODIFIER_unknown;
81
2.94k
    return Type;
82
2.98k
  }
83
1.49k
  case OMPC_dist_schedule:
84
1.49k
    return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
85
1.49k
#define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
86
1.49k
#include "clang/Basic/OpenMPKinds.def"
87
1.49k
        .Default(OMPC_DIST_SCHEDULE_unknown);
88
4.01k
  case OMPC_defaultmap:
89
4.01k
    return llvm::StringSwitch<unsigned>(Str)
90
4.01k
#define OPENMP_DEFAULTMAP_KIND(Name)                                           \
91
12.0k
  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
92
4.01k
#define OPENMP_DEFAULTMAP_MODIFIER(Name)                                       \
93
32.1k
  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
94
4.01k
#include "clang/Basic/OpenMPKinds.def"
95
4.01k
        .Default(OMPC_DEFAULTMAP_unknown);
96
53
  case OMPC_atomic_default_mem_order:
97
53
     return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
98
53
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)       \
99
159
  .Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
100
53
#include "clang/Basic/OpenMPKinds.def"
101
53
        .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
102
150
  case OMPC_device_type:
103
150
    return llvm::StringSwitch<OpenMPDeviceType>(Str)
104
450
#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
105
150
#include "clang/Basic/OpenMPKinds.def"
106
150
        .Default(OMPC_DEVICE_TYPE_unknown);
107
92
  case OMPC_lastprivate:
108
92
    return llvm::StringSwitch<OpenMPLastprivateModifier>(Str)
109
92
#define OPENMP_LASTPRIVATE_KIND(Name) .Case(#Name, OMPC_LASTPRIVATE_##Name)
110
92
#include "clang/Basic/OpenMPKinds.def"
111
92
        .Default(OMPC_LASTPRIVATE_unknown);
112
404
  case OMPC_order:
113
404
    return llvm::StringSwitch<OpenMPOrderClauseKind>(Str)
114
404
#define OPENMP_ORDER_KIND(Name) .Case(#Name, OMPC_ORDER_##Name)
115
404
#include "clang/Basic/OpenMPKinds.def"
116
404
        .Default(OMPC_ORDER_unknown);
117
48
  case OMPC_update:
118
48
    return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
119
384
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
120
48
#include "clang/Basic/OpenMPKinds.def"
121
48
        .Default(OMPC_DEPEND_unknown);
122
32
  case OMPC_device:
123
32
    return llvm::StringSwitch<OpenMPDeviceClauseModifier>(Str)
124
64
#define OPENMP_DEVICE_MODIFIER(Name) .Case(#Name, OMPC_DEVICE_##Name)
125
32
#include "clang/Basic/OpenMPKinds.def"
126
32
        .Default(OMPC_DEVICE_unknown);
127
463
  case OMPC_reduction:
128
463
    return llvm::StringSwitch<OpenMPReductionClauseModifier>(Str)
129
1.38k
#define OPENMP_REDUCTION_MODIFIER(Name) .Case(#Name, OMPC_REDUCTION_##Name)
130
463
#include "clang/Basic/OpenMPKinds.def"
131
463
        .Default(OMPC_REDUCTION_unknown);
132
54
  case OMPC_adjust_args:
133
54
    return llvm::StringSwitch<OpenMPAdjustArgsOpKind>(Str)
134
108
#define OPENMP_ADJUST_ARGS_KIND(Name) .Case(#Name, OMPC_ADJUST_ARGS_##Name)
135
54
#include "clang/Basic/OpenMPKinds.def"
136
54
        .Default(OMPC_ADJUST_ARGS_unknown);
137
155
  case OMPC_bind:
138
155
    return llvm::StringSwitch<unsigned>(Str)
139
465
#define OPENMP_BIND_KIND(Name) .Case(#Name, OMPC_BIND_##Name)
140
155
#include "clang/Basic/OpenMPKinds.def"
141
155
        .Default(OMPC_BIND_unknown);
142
0
  case OMPC_unknown:
143
0
  case OMPC_threadprivate:
144
0
  case OMPC_if:
145
0
  case OMPC_final:
146
0
  case OMPC_num_threads:
147
0
  case OMPC_safelen:
148
0
  case OMPC_simdlen:
149
0
  case OMPC_sizes:
150
0
  case OMPC_allocator:
151
0
  case OMPC_allocate:
152
0
  case OMPC_collapse:
153
0
  case OMPC_private:
154
0
  case OMPC_firstprivate:
155
0
  case OMPC_shared:
156
0
  case OMPC_task_reduction:
157
0
  case OMPC_in_reduction:
158
0
  case OMPC_aligned:
159
0
  case OMPC_copyin:
160
0
  case OMPC_copyprivate:
161
0
  case OMPC_ordered:
162
0
  case OMPC_nowait:
163
0
  case OMPC_untied:
164
0
  case OMPC_mergeable:
165
0
  case OMPC_flush:
166
0
  case OMPC_depobj:
167
0
  case OMPC_read:
168
0
  case OMPC_write:
169
0
  case OMPC_capture:
170
0
  case OMPC_compare:
171
0
  case OMPC_seq_cst:
172
0
  case OMPC_acq_rel:
173
0
  case OMPC_acquire:
174
0
  case OMPC_release:
175
0
  case OMPC_relaxed:
176
0
  case OMPC_threads:
177
0
  case OMPC_simd:
178
0
  case OMPC_num_teams:
179
0
  case OMPC_thread_limit:
180
0
  case OMPC_priority:
181
0
  case OMPC_grainsize:
182
0
  case OMPC_nogroup:
183
0
  case OMPC_num_tasks:
184
0
  case OMPC_hint:
185
0
  case OMPC_uniform:
186
0
  case OMPC_use_device_ptr:
187
0
  case OMPC_use_device_addr:
188
0
  case OMPC_is_device_ptr:
189
0
  case OMPC_has_device_addr:
190
0
  case OMPC_unified_address:
191
0
  case OMPC_unified_shared_memory:
192
0
  case OMPC_reverse_offload:
193
0
  case OMPC_dynamic_allocators:
194
0
  case OMPC_match:
195
0
  case OMPC_nontemporal:
196
0
  case OMPC_destroy:
197
0
  case OMPC_novariants:
198
0
  case OMPC_nocontext:
199
0
  case OMPC_detach:
200
0
  case OMPC_inclusive:
201
0
  case OMPC_exclusive:
202
0
  case OMPC_uses_allocators:
203
0
  case OMPC_affinity:
204
0
  case OMPC_when:
205
0
  case OMPC_append_args:
206
0
    break;
207
0
  default:
208
0
    break;
209
42.2k
  }
210
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
211
0
}
212
213
const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
214
16.9k
                                                 unsigned Type) {
215
16.9k
  switch (Kind) {
216
1.79k
  case OMPC_default:
217
1.79k
    switch (llvm::omp::DefaultKind(Type)) {
218
0
#define OMP_DEFAULT_KIND(Enum, Name)                                           \
219
1.79k
  case Enum:                                                                   \
220
1.79k
    return Name;
221
1.79k
#include 
"llvm/Frontend/OpenMP/OMPKinds.def"0
222
1.79k
    }
223
0
    llvm_unreachable("Invalid OpenMP 'default' clause type");
224
658
  case OMPC_proc_bind:
225
658
    switch (Type) {
226
0
#define OMP_PROC_BIND_KIND(Enum, Name, Value)                                  \
227
658
  case Value:                                                                  \
228
658
    return Name;
229
658
#include 
"llvm/Frontend/OpenMP/OMPKinds.def"0
230
658
    }
231
0
    llvm_unreachable("Invalid OpenMP 'proc_bind' clause type");
232
1.77k
  case OMPC_schedule:
233
1.77k
    switch (Type) {
234
0
    case OMPC_SCHEDULE_unknown:
235
0
    case OMPC_SCHEDULE_MODIFIER_last:
236
0
      return "unknown";
237
0
#define OPENMP_SCHEDULE_KIND(Name)                                             \
238
1.17k
    case OMPC_SCHEDULE_##Name:                                                 \
239
1.17k
      return #Name;
240
0
#define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
241
600
    case OMPC_SCHEDULE_MODIFIER_##Name:                                        \
242
600
      return #Name;
243
1.77k
#include 
"clang/Basic/OpenMPKinds.def"0
244
1.77k
    }
245
0
    llvm_unreachable("Invalid OpenMP 'schedule' clause type");
246
3.69k
  case OMPC_depend:
247
3.69k
    switch (Type) {
248
0
    case OMPC_DEPEND_unknown:
249
0
      return "unknown";
250
0
#define OPENMP_DEPEND_KIND(Name)                                             \
251
3.69k
  case OMPC_DEPEND_##Name:                                                   \
252
3.69k
    return #Name;
253
3.69k
#include 
"clang/Basic/OpenMPKinds.def"0
254
3.69k
    }
255
0
    llvm_unreachable("Invalid OpenMP 'depend' clause type");
256
128
  case OMPC_linear:
257
128
    switch (Type) {
258
0
    case OMPC_LINEAR_unknown:
259
0
      return "unknown";
260
0
#define OPENMP_LINEAR_KIND(Name)                                             \
261
128
  case OMPC_LINEAR_##Name:                                                   \
262
128
    return #Name;
263
128
#include 
"clang/Basic/OpenMPKinds.def"0
264
128
    }
265
0
    llvm_unreachable("Invalid OpenMP 'linear' clause type");
266
4.71k
  case OMPC_map:
267
4.71k
    switch (Type) {
268
0
    case OMPC_MAP_unknown:
269
0
    case OMPC_MAP_MODIFIER_last:
270
0
      return "unknown";
271
0
#define OPENMP_MAP_KIND(Name)                                                \
272
3.92k
  case OMPC_MAP_##Name:                                                      \
273
3.92k
    return #Name;
274
0
#define OPENMP_MAP_MODIFIER_KIND(Name)                                       \
275
788
  case OMPC_MAP_MODIFIER_##Name:                                             \
276
788
    return #Name;
277
0
#include "clang/Basic/OpenMPKinds.def"
278
0
    default:
279
0
      break;
280
4.71k
    }
281
0
    llvm_unreachable("Invalid OpenMP 'map' clause type");
282
64
  case OMPC_to:
283
124
  case OMPC_from:
284
124
    switch (Type) {
285
0
    case OMPC_MOTION_MODIFIER_unknown:
286
0
      return "unknown";
287
0
#define OPENMP_MOTION_MODIFIER_KIND(Name)                                      \
288
124
  case OMPC_MOTION_MODIFIER_##Name:                                            \
289
124
    return #Name;
290
0
#include "clang/Basic/OpenMPKinds.def"
291
0
    default:
292
0
      break;
293
124
    }
294
0
    llvm_unreachable("Invalid OpenMP 'to' or 'from' clause type");
295
416
  case OMPC_dist_schedule:
296
416
    switch (Type) {
297
0
    case OMPC_DIST_SCHEDULE_unknown:
298
0
      return "unknown";
299
0
#define OPENMP_DIST_SCHEDULE_KIND(Name)                                      \
300
416
  case OMPC_DIST_SCHEDULE_##Name:                                            \
301
416
    return #Name;
302
416
#include 
"clang/Basic/OpenMPKinds.def"0
303
416
    }
304
0
    llvm_unreachable("Invalid OpenMP 'dist_schedule' clause type");
305
3.11k
  case OMPC_defaultmap:
306
3.11k
    switch (Type) {
307
0
    case OMPC_DEFAULTMAP_unknown:
308
0
    case OMPC_DEFAULTMAP_MODIFIER_last:
309
0
      return "unknown";
310
0
#define OPENMP_DEFAULTMAP_KIND(Name)                                         \
311
1.59k
    case OMPC_DEFAULTMAP_##Name:                                             \
312
1.59k
      return #Name;
313
0
#define OPENMP_DEFAULTMAP_MODIFIER(Name)                                     \
314
1.52k
    case OMPC_DEFAULTMAP_MODIFIER_##Name:                                    \
315
1.52k
      return #Name;
316
3.11k
#include 
"clang/Basic/OpenMPKinds.def"0
317
3.11k
    }
318
0
    llvm_unreachable("Invalid OpenMP 'schedule' clause type");
319
37
  case OMPC_atomic_default_mem_order:
320
37
    switch (Type) {
321
0
    case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
322
0
      return "unknown";
323
0
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)                           \
324
37
    case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name:                               \
325
37
      return #Name;
326
37
#include 
"clang/Basic/OpenMPKinds.def"0
327
37
}
328
0
    llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type");
329
29
  case OMPC_device_type:
330
29
    switch (Type) {
331
0
    case OMPC_DEVICE_TYPE_unknown:
332
0
      return "unknown";
333
0
#define OPENMP_DEVICE_TYPE_KIND(Name)                                          \
334
29
    case OMPC_DEVICE_TYPE_##Name:                                              \
335
29
      return #Name;
336
29
#include 
"clang/Basic/OpenMPKinds.def"0
337
29
    }
338
0
    llvm_unreachable("Invalid OpenMP 'device_type' clause type");
339
44
  case OMPC_lastprivate:
340
44
    switch (Type) {
341
0
    case OMPC_LASTPRIVATE_unknown:
342
0
      return "unknown";
343
0
#define OPENMP_LASTPRIVATE_KIND(Name)                                          \
344
44
    case OMPC_LASTPRIVATE_##Name:                                              \
345
44
      return #Name;
346
44
#include 
"clang/Basic/OpenMPKinds.def"0
347
44
    }
348
0
    llvm_unreachable("Invalid OpenMP 'lastprivate' clause type");
349
201
  case OMPC_order:
350
201
    switch (Type) {
351
0
    case OMPC_ORDER_unknown:
352
0
      return "unknown";
353
0
#define OPENMP_ORDER_KIND(Name)                                                \
354
201
    case OMPC_ORDER_##Name:                                                    \
355
201
      return #Name;
356
201
#include 
"clang/Basic/OpenMPKinds.def"0
357
201
    }
358
0
    llvm_unreachable("Invalid OpenMP 'order' clause type");
359
12
  case OMPC_update:
360
12
    switch (Type) {
361
0
    case OMPC_DEPEND_unknown:
362
0
      return "unknown";
363
0
#define OPENMP_DEPEND_KIND(Name)                                               \
364
12
  case OMPC_DEPEND_##Name:                                                     \
365
12
    return #Name;
366
12
#include 
"clang/Basic/OpenMPKinds.def"0
367
12
    }
368
0
    llvm_unreachable("Invalid OpenMP 'depend' clause type");
369
40
  case OMPC_device:
370
40
    switch (Type) {
371
0
    case OMPC_DEVICE_unknown:
372
0
      return "unknown";
373
0
#define OPENMP_DEVICE_MODIFIER(Name)                                           \
374
40
  case OMPC_DEVICE_##Name:                                                     \
375
40
    return #Name;
376
40
#include 
"clang/Basic/OpenMPKinds.def"0
377
40
    }
378
0
    llvm_unreachable("Invalid OpenMP 'device' clause modifier");
379
143
  case OMPC_reduction:
380
143
    switch (Type) {
381
0
    case OMPC_REDUCTION_unknown:
382
0
      return "unknown";
383
0
#define OPENMP_REDUCTION_MODIFIER(Name)                                        \
384
143
  case OMPC_REDUCTION_##Name:                                                  \
385
143
    return #Name;
386
143
#include 
"clang/Basic/OpenMPKinds.def"0
387
143
    }
388
0
    llvm_unreachable("Invalid OpenMP 'reduction' clause modifier");
389
0
  case OMPC_adjust_args:
390
0
    switch (Type) {
391
0
    case OMPC_ADJUST_ARGS_unknown:
392
0
      return "unknown";
393
0
#define OPENMP_ADJUST_ARGS_KIND(Name)                                          \
394
0
  case OMPC_ADJUST_ARGS_##Name:                                                \
395
0
    return #Name;
396
0
#include "clang/Basic/OpenMPKinds.def"
397
0
    }
398
0
    llvm_unreachable("Invalid OpenMP 'adjust_args' clause kind");
399
65
  case OMPC_bind:
400
65
    switch (Type) {
401
0
    case OMPC_BIND_unknown:
402
0
      return "unknown";
403
0
#define OPENMP_BIND_KIND(Name)                                                 \
404
65
  case OMPC_BIND_##Name:                                                       \
405
65
    return #Name;
406
65
#include 
"clang/Basic/OpenMPKinds.def"0
407
65
    }
408
0
    llvm_unreachable("Invalid OpenMP 'bind' clause type");
409
0
  case OMPC_unknown:
410
0
  case OMPC_threadprivate:
411
0
  case OMPC_if:
412
0
  case OMPC_final:
413
0
  case OMPC_num_threads:
414
0
  case OMPC_safelen:
415
0
  case OMPC_simdlen:
416
0
  case OMPC_sizes:
417
0
  case OMPC_allocator:
418
0
  case OMPC_allocate:
419
0
  case OMPC_collapse:
420
0
  case OMPC_private:
421
0
  case OMPC_firstprivate:
422
0
  case OMPC_shared:
423
0
  case OMPC_task_reduction:
424
0
  case OMPC_in_reduction:
425
0
  case OMPC_aligned:
426
0
  case OMPC_copyin:
427
0
  case OMPC_copyprivate:
428
0
  case OMPC_ordered:
429
0
  case OMPC_nowait:
430
0
  case OMPC_untied:
431
0
  case OMPC_mergeable:
432
0
  case OMPC_flush:
433
0
  case OMPC_depobj:
434
0
  case OMPC_read:
435
0
  case OMPC_write:
436
0
  case OMPC_capture:
437
0
  case OMPC_compare:
438
0
  case OMPC_seq_cst:
439
0
  case OMPC_acq_rel:
440
0
  case OMPC_acquire:
441
0
  case OMPC_release:
442
0
  case OMPC_relaxed:
443
0
  case OMPC_threads:
444
0
  case OMPC_simd:
445
0
  case OMPC_num_teams:
446
0
  case OMPC_thread_limit:
447
0
  case OMPC_priority:
448
0
  case OMPC_grainsize:
449
0
  case OMPC_nogroup:
450
0
  case OMPC_num_tasks:
451
0
  case OMPC_hint:
452
0
  case OMPC_uniform:
453
0
  case OMPC_use_device_ptr:
454
0
  case OMPC_use_device_addr:
455
0
  case OMPC_is_device_ptr:
456
0
  case OMPC_has_device_addr:
457
0
  case OMPC_unified_address:
458
0
  case OMPC_unified_shared_memory:
459
0
  case OMPC_reverse_offload:
460
0
  case OMPC_dynamic_allocators:
461
0
  case OMPC_match:
462
0
  case OMPC_nontemporal:
463
0
  case OMPC_destroy:
464
0
  case OMPC_detach:
465
0
  case OMPC_novariants:
466
0
  case OMPC_nocontext:
467
0
  case OMPC_inclusive:
468
0
  case OMPC_exclusive:
469
0
  case OMPC_uses_allocators:
470
0
  case OMPC_affinity:
471
0
  case OMPC_when:
472
0
  case OMPC_append_args:
473
0
    break;
474
0
  default:
475
0
    break;
476
16.9k
  }
477
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
478
0
}
479
480
5.35M
bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
481
5.35M
  return DKind == OMPD_simd || 
DKind == OMPD_for5.26M
||
DKind == OMPD_for_simd5.11M
||
482
5.35M
         
DKind == OMPD_parallel_for5.00M
||
DKind == OMPD_parallel_for_simd4.91M
||
483
5.35M
         
DKind == OMPD_taskloop4.81M
||
DKind == OMPD_taskloop_simd4.73M
||
484
5.35M
         
DKind == OMPD_master_taskloop4.64M
||
DKind == OMPD_master_taskloop_simd4.57M
||
485
5.35M
         
DKind == OMPD_parallel_master_taskloop4.49M
||
486
5.35M
         
DKind == OMPD_parallel_master_taskloop_simd4.41M
||
487
5.35M
         
DKind == OMPD_distribute4.31M
||
DKind == OMPD_target_parallel_for4.26M
||
488
5.35M
         
DKind == OMPD_distribute_parallel_for4.02M
||
489
5.35M
         
DKind == OMPD_distribute_parallel_for_simd3.78M
||
490
5.35M
         
DKind == OMPD_distribute_simd3.44M
||
491
5.35M
         
DKind == OMPD_target_parallel_for_simd3.16M
||
DKind == OMPD_target_simd2.85M
||
492
5.35M
         
DKind == OMPD_teams_distribute2.64M
||
493
5.35M
         
DKind == OMPD_teams_distribute_simd2.50M
||
494
5.35M
         
DKind == OMPD_teams_distribute_parallel_for_simd2.32M
||
495
5.35M
         
DKind == OMPD_teams_distribute_parallel_for2.06M
||
496
5.35M
         
DKind == OMPD_target_teams_distribute1.87M
||
497
5.35M
         
DKind == OMPD_target_teams_distribute_parallel_for1.66M
||
498
5.35M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd1.42M
||
499
5.35M
         
DKind == OMPD_target_teams_distribute_simd1.03M
||
DKind == OMPD_tile720k
||
500
5.35M
         
DKind == OMPD_unroll720k
||
DKind == OMPD_loop718k
||
501
5.35M
         
DKind == OMPD_teams_loop717k
||
DKind == OMPD_target_teams_loop715k
||
502
5.35M
         
DKind == OMPD_parallel_loop713k
||
DKind == OMPD_target_parallel_loop711k
;
503
5.35M
}
504
505
5.47M
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
506
5.47M
  return DKind == OMPD_for || 
DKind == OMPD_for_simd5.25M
||
507
5.47M
         
DKind == OMPD_sections5.07M
||
DKind == OMPD_section5.05M
||
508
5.47M
         
DKind == OMPD_single5.05M
||
DKind == OMPD_parallel_for5.04M
||
509
5.47M
         
DKind == OMPD_parallel_for_simd4.91M
||
DKind == OMPD_parallel_sections4.76M
||
510
5.47M
         
DKind == OMPD_target_parallel_for4.75M
||
511
5.47M
         
DKind == OMPD_distribute_parallel_for4.54M
||
512
5.47M
         
DKind == OMPD_distribute_parallel_for_simd4.45M
||
513
5.47M
         
DKind == OMPD_target_parallel_for_simd4.34M
||
514
5.47M
         
DKind == OMPD_teams_distribute_parallel_for_simd4.13M
||
515
5.47M
         
DKind == OMPD_teams_distribute_parallel_for4.03M
||
516
5.47M
         
DKind == OMPD_target_teams_distribute_parallel_for3.95M
||
517
5.47M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd3.82M
;
518
5.47M
}
519
520
11.9M
bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
521
11.9M
  return DKind == OMPD_taskloop || 
DKind == OMPD_taskloop_simd11.5M
||
522
11.9M
         
DKind == OMPD_master_taskloop11.3M
||
DKind == OMPD_master_taskloop_simd11.2M
||
523
11.9M
         
DKind == OMPD_parallel_master_taskloop11.0M
||
524
11.9M
         
DKind == OMPD_parallel_master_taskloop_simd10.8M
;
525
11.9M
}
526
527
15.2M
bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
528
15.2M
  return DKind == OMPD_parallel || 
DKind == OMPD_parallel_for14.4M
||
529
15.2M
         
DKind == OMPD_parallel_for_simd14.3M
||
DKind == OMPD_parallel_sections14.3M
||
530
15.2M
         
DKind == OMPD_target_parallel14.3M
||
DKind == OMPD_target_parallel_for14.1M
||
531
15.2M
         
DKind == OMPD_distribute_parallel_for13.9M
||
532
15.2M
         
DKind == OMPD_distribute_parallel_for_simd13.8M
||
533
15.2M
         
DKind == OMPD_target_parallel_for_simd13.7M
||
534
15.2M
         
DKind == OMPD_teams_distribute_parallel_for13.4M
||
535
15.2M
         
DKind == OMPD_teams_distribute_parallel_for_simd13.3M
||
536
15.2M
         
DKind == OMPD_target_teams_distribute_parallel_for13.2M
||
537
15.2M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd13.0M
||
538
15.2M
         
DKind == OMPD_parallel_master12.6M
||
539
15.2M
         
DKind == OMPD_parallel_master_taskloop12.6M
||
540
15.2M
         
DKind == OMPD_parallel_master_taskloop_simd12.5M
||
541
15.2M
         
DKind == OMPD_parallel_loop12.4M
||
DKind == OMPD_target_parallel_loop12.4M
;
542
15.2M
}
543
544
12.8M
bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
545
12.8M
  return DKind == OMPD_target || 
DKind == OMPD_target_parallel10.9M
||
546
12.8M
         
DKind == OMPD_target_parallel_for10.7M
||
547
12.8M
         
DKind == OMPD_target_parallel_for_simd10.5M
||
DKind == OMPD_target_simd10.1M
||
548
12.8M
         
DKind == OMPD_target_teams9.79M
||
DKind == OMPD_target_teams_distribute9.62M
||
549
12.8M
         
DKind == OMPD_target_teams_distribute_parallel_for9.36M
||
550
12.8M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd9.05M
||
551
12.8M
         
DKind == OMPD_target_teams_distribute_simd8.55M
||
552
12.8M
         
DKind == OMPD_target_teams_loop8.15M
||
DKind == OMPD_target_parallel_loop8.15M
;
553
12.8M
}
554
555
1.05M
bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
556
1.05M
  return DKind == OMPD_target_data || 
DKind == OMPD_target_enter_data1.03M
||
557
1.05M
         
DKind == OMPD_target_exit_data1.02M
||
DKind == OMPD_target_update1.02M
;
558
1.05M
}
559
560
11.4M
bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
561
11.4M
  return DKind == OMPD_teams || 
DKind == OMPD_teams_distribute11.0M
||
562
11.4M
         
DKind == OMPD_teams_distribute_simd10.9M
||
563
11.4M
         
DKind == OMPD_teams_distribute_parallel_for_simd10.9M
||
564
11.4M
         
DKind == OMPD_teams_distribute_parallel_for10.8M
||
565
11.4M
         
DKind == OMPD_teams_loop10.8M
;
566
11.4M
}
567
568
11.2M
bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
569
11.2M
  return isOpenMPNestingTeamsDirective(DKind) || 
DKind == OMPD_target_teams10.6M
||
570
11.2M
         
DKind == OMPD_target_teams_distribute10.6M
||
571
11.2M
         
DKind == OMPD_target_teams_distribute_parallel_for10.5M
||
572
11.2M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd10.5M
||
573
11.2M
         
DKind == OMPD_target_teams_distribute_simd10.5M
||
574
11.2M
         
DKind == OMPD_target_teams_loop10.4M
;
575
11.2M
}
576
577
3.49M
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
578
3.49M
  return DKind == OMPD_simd || 
DKind == OMPD_for_simd3.45M
||
579
3.49M
         
DKind == OMPD_parallel_for_simd3.37M
||
DKind == OMPD_taskloop_simd3.29M
||
580
3.49M
         
DKind == OMPD_master_taskloop_simd3.26M
||
581
3.49M
         
DKind == OMPD_parallel_master_taskloop_simd3.22M
||
582
3.49M
         
DKind == OMPD_distribute_parallel_for_simd3.16M
||
583
3.49M
         
DKind == OMPD_distribute_simd3.04M
||
DKind == OMPD_target_simd2.98M
||
584
3.49M
         
DKind == OMPD_teams_distribute_simd2.91M
||
585
3.49M
         
DKind == OMPD_teams_distribute_parallel_for_simd2.86M
||
586
3.49M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd2.73M
||
587
3.49M
         
DKind == OMPD_target_teams_distribute_simd2.37M
||
588
3.49M
         
DKind == OMPD_target_parallel_for_simd2.26M
;
589
3.49M
}
590
591
1.04M
bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
592
1.04M
  return Kind == OMPD_distribute || 
Kind == OMPD_distribute_parallel_for1.00M
||
593
1.04M
         
Kind == OMPD_distribute_parallel_for_simd997k
||
594
1.04M
         
Kind == OMPD_distribute_simd989k
;
595
  // TODO add next directives.
596
1.04M
}
597
598
972k
bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
599
972k
  return isOpenMPNestingDistributeDirective(Kind) ||
600
972k
         
Kind == OMPD_teams_distribute820k
||
Kind == OMPD_teams_distribute_simd731k
||
601
972k
         
Kind == OMPD_teams_distribute_parallel_for_simd627k
||
602
972k
         
Kind == OMPD_teams_distribute_parallel_for625k
||
603
972k
         
Kind == OMPD_target_teams_distribute623k
||
604
972k
         
Kind == OMPD_target_teams_distribute_parallel_for465k
||
605
972k
         
Kind == OMPD_target_teams_distribute_parallel_for_simd461k
||
606
972k
         
Kind == OMPD_target_teams_distribute_simd455k
;
607
972k
}
608
609
1.07M
bool clang::isOpenMPGenericLoopDirective(OpenMPDirectiveKind Kind) {
610
1.07M
  return Kind == OMPD_loop || 
Kind == OMPD_teams_loop1.07M
||
611
1.07M
         
Kind == OMPD_target_teams_loop1.07M
||
Kind == OMPD_parallel_loop1.06M
||
612
1.07M
         
Kind == OMPD_target_parallel_loop1.06M
;
613
1.07M
}
614
615
663k
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
616
663k
  return Kind == OMPC_private || 
Kind == OMPC_firstprivate633k
||
617
663k
         
Kind == OMPC_lastprivate552k
||
Kind == OMPC_linear523k
||
618
663k
         
Kind == OMPC_reduction478k
||
Kind == OMPC_task_reduction392k
||
619
663k
         
Kind == OMPC_in_reduction388k
; // TODO add next clauses like 'reduction'.
620
663k
}
621
622
3.01M
bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
623
3.01M
  return Kind == OMPC_threadprivate || 
Kind == OMPC_copyin2.99M
;
624
3.01M
}
625
626
13.1M
bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
627
13.1M
  return Kind == OMPD_task || 
isOpenMPTaskLoopDirective(Kind)10.2M
;
628
13.1M
}
629
630
2.57M
bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
631
2.57M
  return Kind == OMPD_distribute_parallel_for ||
632
2.57M
         
Kind == OMPD_distribute_parallel_for_simd2.42M
||
633
2.57M
         
Kind == OMPD_teams_distribute_parallel_for_simd2.25M
||
634
2.57M
         
Kind == OMPD_teams_distribute_parallel_for2.10M
||
635
2.57M
         
Kind == OMPD_target_teams_distribute_parallel_for1.96M
||
636
2.57M
         
Kind == OMPD_target_teams_distribute_parallel_for_simd1.75M
;
637
2.57M
}
638
639
821k
bool clang::isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind) {
640
821k
  return DKind == OMPD_tile || 
DKind == OMPD_unroll820k
;
641
821k
}
642
643
void clang::getOpenMPCaptureRegions(
644
    SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
645
2.96M
    OpenMPDirectiveKind DKind) {
646
2.96M
  assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
647
0
  switch (DKind) {
648
0
  case OMPD_metadirective:
649
0
    CaptureRegions.push_back(OMPD_metadirective);
650
0
    break;
651
165k
  case OMPD_parallel:
652
192k
  case OMPD_parallel_for:
653
224k
  case OMPD_parallel_for_simd:
654
233k
  case OMPD_parallel_master:
655
244k
  case OMPD_parallel_sections:
656
281k
  case OMPD_distribute_parallel_for:
657
330k
  case OMPD_distribute_parallel_for_simd:
658
330k
  case OMPD_parallel_loop:
659
330k
    CaptureRegions.push_back(OMPD_parallel);
660
330k
    break;
661
69.0k
  case OMPD_target_teams:
662
153k
  case OMPD_target_teams_distribute:
663
277k
  case OMPD_target_teams_distribute_simd:
664
278k
  case OMPD_target_teams_loop:
665
278k
    CaptureRegions.push_back(OMPD_task);
666
278k
    CaptureRegions.push_back(OMPD_target);
667
278k
    CaptureRegions.push_back(OMPD_teams);
668
278k
    break;
669
177k
  case OMPD_teams:
670
206k
  case OMPD_teams_distribute:
671
243k
  case OMPD_teams_distribute_simd:
672
243k
    CaptureRegions.push_back(OMPD_teams);
673
243k
    break;
674
644k
  case OMPD_target:
675
731k
  case OMPD_target_simd:
676
731k
    CaptureRegions.push_back(OMPD_task);
677
731k
    CaptureRegions.push_back(OMPD_target);
678
731k
    break;
679
46.1k
  case OMPD_teams_distribute_parallel_for:
680
107k
  case OMPD_teams_distribute_parallel_for_simd:
681
107k
    CaptureRegions.push_back(OMPD_teams);
682
107k
    CaptureRegions.push_back(OMPD_parallel);
683
107k
    break;
684
69.8k
  case OMPD_target_parallel:
685
168k
  case OMPD_target_parallel_for:
686
278k
  case OMPD_target_parallel_for_simd:
687
279k
  case OMPD_target_parallel_loop:
688
279k
    CaptureRegions.push_back(OMPD_task);
689
279k
    CaptureRegions.push_back(OMPD_target);
690
279k
    CaptureRegions.push_back(OMPD_parallel);
691
279k
    break;
692
121k
  case OMPD_task:
693
128k
  case OMPD_target_enter_data:
694
134k
  case OMPD_target_exit_data:
695
148k
  case OMPD_target_update:
696
148k
    CaptureRegions.push_back(OMPD_task);
697
148k
    break;
698
46.5k
  case OMPD_taskloop:
699
104k
  case OMPD_taskloop_simd:
700
141k
  case OMPD_master_taskloop:
701
199k
  case OMPD_master_taskloop_simd:
702
199k
    CaptureRegions.push_back(OMPD_taskloop);
703
199k
    break;
704
57.5k
  case OMPD_parallel_master_taskloop:
705
150k
  case OMPD_parallel_master_taskloop_simd:
706
150k
    CaptureRegions.push_back(OMPD_parallel);
707
150k
    CaptureRegions.push_back(OMPD_taskloop);
708
150k
    break;
709
95.0k
  case OMPD_target_teams_distribute_parallel_for:
710
253k
  case OMPD_target_teams_distribute_parallel_for_simd:
711
253k
    CaptureRegions.push_back(OMPD_task);
712
253k
    CaptureRegions.push_back(OMPD_target);
713
253k
    CaptureRegions.push_back(OMPD_teams);
714
253k
    CaptureRegions.push_back(OMPD_parallel);
715
253k
    break;
716
341
  case OMPD_teams_loop:
717
341
    CaptureRegions.push_back(OMPD_teams);
718
341
    break;
719
387
  case OMPD_loop:
720
    // TODO: 'loop' may require different capture regions depending on the bind
721
    // clause or the parent directive when there is no bind clause. Use
722
    // OMPD_unknown for now.
723
34.2k
  case OMPD_simd:
724
73.8k
  case OMPD_for:
725
106k
  case OMPD_for_simd:
726
120k
  case OMPD_sections:
727
120k
  case OMPD_section:
728
127k
  case OMPD_single:
729
127k
  case OMPD_master:
730
127k
  case OMPD_critical:
731
141k
  case OMPD_taskgroup:
732
152k
  case OMPD_distribute:
733
156k
  case OMPD_ordered:
734
156k
  case OMPD_atomic:
735
204k
  case OMPD_target_data:
736
241k
  case OMPD_distribute_simd:
737
242k
  case OMPD_dispatch:
738
242k
    CaptureRegions.push_back(OMPD_unknown);
739
242k
    break;
740
90
  case OMPD_tile:
741
194
  case OMPD_unroll:
742
    // loop transformations do not introduce captures.
743
194
    break;
744
0
  case OMPD_threadprivate:
745
0
  case OMPD_allocate:
746
0
  case OMPD_taskyield:
747
0
  case OMPD_barrier:
748
0
  case OMPD_taskwait:
749
0
  case OMPD_cancellation_point:
750
0
  case OMPD_cancel:
751
0
  case OMPD_flush:
752
0
  case OMPD_depobj:
753
0
  case OMPD_scan:
754
0
  case OMPD_declare_reduction:
755
0
  case OMPD_declare_mapper:
756
0
  case OMPD_declare_simd:
757
0
  case OMPD_declare_target:
758
0
  case OMPD_end_declare_target:
759
0
  case OMPD_requires:
760
0
  case OMPD_declare_variant:
761
0
  case OMPD_begin_declare_variant:
762
0
  case OMPD_end_declare_variant:
763
0
    llvm_unreachable("OpenMP Directive is not allowed");
764
0
  case OMPD_unknown:
765
0
  default:
766
0
    llvm_unreachable("Unknown OpenMP directive");
767
2.96M
  }
768
2.96M
}