Coverage Report

Created: 2022-07-16 07:03

/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
43.0k
                                          const LangOptions &LangOpts) {
25
43.0k
  switch (Kind) {
26
1.96k
  case OMPC_default:
27
1.96k
    return llvm::StringSwitch<unsigned>(Str)
28
9.80k
#define OMP_DEFAULT_KIND(Enum, Name) .Case(Name, unsigned(Enum))
29
1.96k
#include "llvm/Frontend/OpenMP/OMPKinds.def"
30
1.96k
        .Default(unsigned(llvm::omp::OMP_DEFAULT_unknown));
31
705
  case OMPC_proc_bind:
32
705
    return llvm::StringSwitch<unsigned>(Str)
33
4.23k
#define OMP_PROC_BIND_KIND(Enum, Name, Value) .Case(Name, Value)
34
705
#include "llvm/Frontend/OpenMP/OMPKinds.def"
35
705
        .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.64k
  case OMPC_depend: {
45
5.64k
    unsigned Type = llvm::StringSwitch<unsigned>(Str)
46
56.4k
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
47
5.64k
#include "clang/Basic/OpenMPKinds.def"
48
5.64k
                        .Default(OMPC_DEPEND_unknown);
49
5.64k
    if (LangOpts.OpenMP < 51 && 
Type == OMPC_DEPEND_inoutset4.28k
)
50
0
      return OMPC_DEPEND_unknown;
51
5.64k
    return Type;
52
5.64k
  }
53
438
  case OMPC_linear:
54
438
    return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
55
1.31k
#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
56
438
#include "clang/Basic/OpenMPKinds.def"
57
438
        .Default(OMPC_LINEAR_unknown);
58
21.1k
  case OMPC_map: {
59
21.1k
    unsigned Type = llvm::StringSwitch<unsigned>(Str)
60
21.1k
#define OPENMP_MAP_KIND(Name)                                                  \
61
126k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
62
21.1k
#define OPENMP_MAP_MODIFIER_KIND(Name)                                         \
63
105k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
64
21.1k
#include "clang/Basic/OpenMPKinds.def"
65
21.1k
        .Default(OMPC_MAP_unknown);
66
21.1k
    if (LangOpts.OpenMP < 51 && 
Type == OMPC_MAP_MODIFIER_present17.8k
)
67
320
      return OMPC_MAP_MODIFIER_unknown;
68
20.8k
    if (!LangOpts.OpenMPExtensions && 
Type == OMPC_MAP_MODIFIER_ompx_hold6.16k
)
69
114
      return OMPC_MAP_MODIFIER_unknown;
70
20.6k
    return Type;
71
20.8k
  }
72
2.17k
  case OMPC_to:
73
3.05k
  case OMPC_from: {
74
3.05k
    unsigned Type = llvm::StringSwitch<unsigned>(Str)
75
3.05k
#define OPENMP_MOTION_MODIFIER_KIND(Name)                                      \
76
6.10k
  .Case(#Name, static_cast<unsigned>(OMPC_MOTION_MODIFIER_##Name))
77
3.05k
#include "clang/Basic/OpenMPKinds.def"
78
3.05k
        .Default(OMPC_MOTION_MODIFIER_unknown);
79
3.05k
    if (LangOpts.OpenMP < 51 && 
Type == OMPC_MOTION_MODIFIER_present2.50k
)
80
36
      return OMPC_MOTION_MODIFIER_unknown;
81
3.01k
    return Type;
82
3.05k
  }
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
182
  case OMPC_device_type:
103
182
    return llvm::StringSwitch<OpenMPDeviceType>(Str)
104
546
#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
105
182
#include "clang/Basic/OpenMPKinds.def"
106
182
        .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
420
  case OMPC_order:
113
420
    return llvm::StringSwitch<OpenMPOrderClauseKind>(Str)
114
420
#define OPENMP_ORDER_KIND(Name) .Case(#Name, OMPC_ORDER_##Name)
115
420
#include "clang/Basic/OpenMPKinds.def"
116
420
        .Default(OMPC_ORDER_unknown);
117
48
  case OMPC_update:
118
48
    return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
119
480
#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
495
  case OMPC_reduction:
128
495
    return llvm::StringSwitch<OpenMPReductionClauseModifier>(Str)
129
1.48k
#define OPENMP_REDUCTION_MODIFIER(Name) .Case(#Name, OMPC_REDUCTION_##Name)
130
495
#include "clang/Basic/OpenMPKinds.def"
131
495
        .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
43.0k
  }
210
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
211
0
}
212
213
const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
214
17.2k
                                                 unsigned Type) {
215
17.2k
  switch (Kind) {
216
1.97k
  case OMPC_default:
217
1.97k
    switch (llvm::omp::DefaultKind(Type)) {
218
0
#define OMP_DEFAULT_KIND(Enum, Name)                                           \
219
1.97k
  case Enum:                                                                   \
220
1.97k
    return Name;
221
1.97k
#include 
"llvm/Frontend/OpenMP/OMPKinds.def"0
222
1.97k
    }
223
0
    llvm_unreachable("Invalid OpenMP 'default' clause type");
224
708
  case OMPC_proc_bind:
225
708
    switch (Type) {
226
0
#define OMP_PROC_BIND_KIND(Enum, Name, Value)                                  \
227
708
  case Value:                                                                  \
228
708
    return Name;
229
708
#include 
"llvm/Frontend/OpenMP/OMPKinds.def"0
230
708
    }
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.70k
  case OMPC_depend:
247
3.70k
    switch (Type) {
248
0
    case OMPC_DEPEND_unknown:
249
0
      return "unknown";
250
0
#define OPENMP_DEPEND_KIND(Name)                                             \
251
3.70k
  case OMPC_DEPEND_##Name:                                                   \
252
3.70k
    return #Name;
253
3.70k
#include 
"clang/Basic/OpenMPKinds.def"0
254
3.70k
    }
255
0
    llvm_unreachable("Invalid OpenMP 'depend' clause type");
256
144
  case OMPC_linear:
257
144
    switch (Type) {
258
0
    case OMPC_LINEAR_unknown:
259
0
      return "unknown";
260
0
#define OPENMP_LINEAR_KIND(Name)                                             \
261
144
  case OMPC_LINEAR_##Name:                                                   \
262
144
    return #Name;
263
144
#include 
"clang/Basic/OpenMPKinds.def"0
264
144
    }
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
217
  case OMPC_order:
350
217
    switch (Type) {
351
0
    case OMPC_ORDER_unknown:
352
0
      return "unknown";
353
0
#define OPENMP_ORDER_KIND(Name)                                                \
354
217
    case OMPC_ORDER_##Name:                                                    \
355
217
      return #Name;
356
217
#include 
"clang/Basic/OpenMPKinds.def"0
357
217
    }
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
167
  case OMPC_reduction:
380
167
    switch (Type) {
381
0
    case OMPC_REDUCTION_unknown:
382
0
      return "unknown";
383
0
#define OPENMP_REDUCTION_MODIFIER(Name)                                        \
384
167
  case OMPC_REDUCTION_##Name:                                                  \
385
167
    return #Name;
386
167
#include 
"clang/Basic/OpenMPKinds.def"0
387
167
    }
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
17.2k
  }
477
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
478
0
}
479
480
5.73M
bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
481
5.73M
  return DKind == OMPD_simd || 
DKind == OMPD_for5.63M
||
DKind == OMPD_for_simd5.48M
||
482
5.73M
         
DKind == OMPD_parallel_for5.37M
||
DKind == OMPD_parallel_for_simd5.28M
||
483
5.73M
         
DKind == OMPD_taskloop5.18M
||
DKind == OMPD_taskloop_simd5.09M
||
484
5.73M
         
DKind == OMPD_master_taskloop5.01M
||
DKind == OMPD_master_taskloop_simd4.94M
||
485
5.73M
         
DKind == OMPD_parallel_master_taskloop4.85M
||
486
5.73M
         
DKind == OMPD_parallel_master_taskloop_simd4.77M
||
487
5.73M
         
DKind == OMPD_masked_taskloop4.67M
||
DKind == OMPD_masked_taskloop_simd4.62M
||
488
5.73M
         
DKind == OMPD_parallel_masked_taskloop4.55M
||
DKind == OMPD_distribute4.48M
||
489
5.73M
         
DKind == OMPD_parallel_masked_taskloop_simd4.42M
||
490
5.73M
         
DKind == OMPD_target_parallel_for4.33M
||
491
5.73M
         
DKind == OMPD_distribute_parallel_for4.10M
||
492
5.73M
         
DKind == OMPD_distribute_parallel_for_simd3.85M
||
493
5.73M
         
DKind == OMPD_distribute_simd3.51M
||
494
5.73M
         
DKind == OMPD_target_parallel_for_simd3.23M
||
DKind == OMPD_target_simd2.93M
||
495
5.73M
         
DKind == OMPD_teams_distribute2.71M
||
496
5.73M
         
DKind == OMPD_teams_distribute_simd2.57M
||
497
5.73M
         
DKind == OMPD_teams_distribute_parallel_for_simd2.38M
||
498
5.73M
         
DKind == OMPD_teams_distribute_parallel_for2.12M
||
499
5.73M
         
DKind == OMPD_target_teams_distribute1.93M
||
500
5.73M
         
DKind == OMPD_target_teams_distribute_parallel_for1.72M
||
501
5.73M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd1.48M
||
502
5.73M
         
DKind == OMPD_target_teams_distribute_simd1.08M
||
DKind == OMPD_tile773k
||
503
5.73M
         
DKind == OMPD_unroll772k
||
DKind == OMPD_loop771k
||
504
5.73M
         
DKind == OMPD_teams_loop769k
||
DKind == OMPD_target_teams_loop768k
||
505
5.73M
         
DKind == OMPD_parallel_loop765k
||
DKind == OMPD_target_parallel_loop764k
;
506
5.73M
}
507
508
5.94M
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
509
5.94M
  return DKind == OMPD_for || 
DKind == OMPD_for_simd5.71M
||
510
5.94M
         
DKind == OMPD_sections5.53M
||
DKind == OMPD_section5.51M
||
511
5.94M
         
DKind == OMPD_single5.50M
||
DKind == OMPD_parallel_for5.49M
||
512
5.94M
         
DKind == OMPD_parallel_for_simd5.36M
||
DKind == OMPD_parallel_sections5.21M
||
513
5.94M
         
DKind == OMPD_target_parallel_for5.19M
||
514
5.94M
         
DKind == OMPD_distribute_parallel_for4.98M
||
515
5.94M
         
DKind == OMPD_distribute_parallel_for_simd4.89M
||
516
5.94M
         
DKind == OMPD_target_parallel_for_simd4.78M
||
517
5.94M
         
DKind == OMPD_teams_distribute_parallel_for_simd4.57M
||
518
5.94M
         
DKind == OMPD_teams_distribute_parallel_for4.47M
||
519
5.94M
         
DKind == OMPD_target_teams_distribute_parallel_for4.38M
||
520
5.94M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd4.25M
;
521
5.94M
}
522
523
29.1M
bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
524
29.1M
  return DKind == OMPD_taskloop || 
DKind == OMPD_taskloop_simd28.5M
||
525
29.1M
         
DKind == OMPD_master_taskloop28.2M
||
DKind == OMPD_master_taskloop_simd28.0M
||
526
29.1M
         
DKind == OMPD_parallel_master_taskloop27.8M
||
527
29.1M
         
DKind == OMPD_masked_taskloop27.6M
||
DKind == OMPD_masked_taskloop_simd27.4M
||
528
29.1M
         
DKind == OMPD_parallel_masked_taskloop27.2M
||
529
29.1M
         
DKind == OMPD_parallel_masked_taskloop_simd27.0M
||
530
29.1M
         
DKind == OMPD_parallel_master_taskloop_simd26.7M
;
531
29.1M
}
532
533
94.8M
bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
534
94.8M
  return DKind == OMPD_parallel || 
DKind == OMPD_parallel_for91.9M
||
535
94.8M
         
DKind == OMPD_parallel_for_simd91.8M
||
DKind == OMPD_parallel_sections91.6M
||
536
94.8M
         
DKind == OMPD_target_parallel91.6M
||
DKind == OMPD_target_parallel_for91.4M
||
537
94.8M
         
DKind == OMPD_distribute_parallel_for90.9M
||
538
94.8M
         
DKind == OMPD_distribute_parallel_for_simd90.7M
||
539
94.8M
         
DKind == OMPD_target_parallel_for_simd90.2M
||
540
94.8M
         
DKind == OMPD_teams_distribute_parallel_for89.7M
||
541
94.8M
         
DKind == OMPD_teams_distribute_parallel_for_simd89.4M
||
542
94.8M
         
DKind == OMPD_target_teams_distribute_parallel_for89.0M
||
543
94.8M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd88.6M
||
544
94.8M
         
DKind == OMPD_parallel_master87.8M
||
DKind == OMPD_parallel_masked87.7M
||
545
94.8M
         
DKind == OMPD_parallel_master_taskloop87.7M
||
546
94.8M
         
DKind == OMPD_parallel_master_taskloop_simd87.6M
||
547
94.8M
         
DKind == OMPD_parallel_masked_taskloop87.3M
||
548
94.8M
         
DKind == OMPD_parallel_masked_taskloop_simd87.2M
||
549
94.8M
         
DKind == OMPD_parallel_loop87.0M
||
DKind == OMPD_target_parallel_loop87.0M
;
550
94.8M
}
551
552
23.5M
bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
553
23.5M
  return DKind == OMPD_target || 
DKind == OMPD_target_parallel20.5M
||
554
23.5M
         
DKind == OMPD_target_parallel_for20.4M
||
555
23.5M
         
DKind == OMPD_target_parallel_for_simd20.1M
||
DKind == OMPD_target_simd19.7M
||
556
23.5M
         
DKind == OMPD_target_teams19.2M
||
DKind == OMPD_target_teams_distribute19.1M
||
557
23.5M
         
DKind == OMPD_target_teams_distribute_parallel_for18.8M
||
558
23.5M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd18.5M
||
559
23.5M
         
DKind == OMPD_target_teams_distribute_simd18.0M
||
560
23.5M
         
DKind == OMPD_target_teams_loop17.6M
||
DKind == OMPD_target_parallel_loop17.6M
;
561
23.5M
}
562
563
1.21M
bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
564
1.21M
  return DKind == OMPD_target_data || 
DKind == OMPD_target_enter_data1.19M
||
565
1.21M
         
DKind == OMPD_target_exit_data1.18M
||
DKind == OMPD_target_update1.17M
;
566
1.21M
}
567
568
86.3M
bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
569
86.3M
  return DKind == OMPD_teams || 
DKind == OMPD_teams_distribute84.4M
||
570
86.3M
         
DKind == OMPD_teams_distribute_simd84.3M
||
571
86.3M
         
DKind == OMPD_teams_distribute_parallel_for_simd84.1M
||
572
86.3M
         
DKind == OMPD_teams_distribute_parallel_for84.0M
||
573
86.3M
         
DKind == OMPD_teams_loop84.0M
;
574
86.3M
}
575
576
86.0M
bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
577
86.0M
  return isOpenMPNestingTeamsDirective(DKind) || 
DKind == OMPD_target_teams83.8M
||
578
86.0M
         
DKind == OMPD_target_teams_distribute83.6M
||
579
86.0M
         
DKind == OMPD_target_teams_distribute_parallel_for83.3M
||
580
86.0M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd83.3M
||
581
86.0M
         
DKind == OMPD_target_teams_distribute_simd83.3M
||
582
86.0M
         
DKind == OMPD_target_teams_loop82.8M
;
583
86.0M
}
584
585
3.80M
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
586
3.80M
  return DKind == OMPD_simd || 
DKind == OMPD_for_simd3.76M
||
587
3.80M
         
DKind == OMPD_parallel_for_simd3.68M
||
DKind == OMPD_taskloop_simd3.59M
||
588
3.80M
         
DKind == OMPD_master_taskloop_simd3.56M
||
589
3.80M
         
DKind == OMPD_masked_taskloop_simd3.53M
||
590
3.80M
         
DKind == OMPD_parallel_master_taskloop_simd3.50M
||
591
3.80M
         
DKind == OMPD_parallel_masked_taskloop_simd3.44M
||
592
3.80M
         
DKind == OMPD_distribute_parallel_for_simd3.38M
||
593
3.80M
         
DKind == OMPD_distribute_simd3.26M
||
DKind == OMPD_target_simd3.20M
||
594
3.80M
         
DKind == OMPD_teams_distribute_simd3.13M
||
595
3.80M
         
DKind == OMPD_teams_distribute_parallel_for_simd3.08M
||
596
3.80M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd2.95M
||
597
3.80M
         
DKind == OMPD_target_teams_distribute_simd2.58M
||
598
3.80M
         
DKind == OMPD_target_parallel_for_simd2.48M
;
599
3.80M
}
600
601
1.08M
bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
602
1.08M
  return Kind == OMPD_distribute || 
Kind == OMPD_distribute_parallel_for1.04M
||
603
1.08M
         
Kind == OMPD_distribute_parallel_for_simd1.03M
||
604
1.08M
         
Kind == OMPD_distribute_simd1.02M
;
605
  // TODO add next directives.
606
1.08M
}
607
608
1.00M
bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
609
1.00M
  return isOpenMPNestingDistributeDirective(Kind) ||
610
1.00M
         
Kind == OMPD_teams_distribute851k
||
Kind == OMPD_teams_distribute_simd758k
||
611
1.00M
         
Kind == OMPD_teams_distribute_parallel_for_simd651k
||
612
1.00M
         
Kind == OMPD_teams_distribute_parallel_for648k
||
613
1.00M
         
Kind == OMPD_target_teams_distribute646k
||
614
1.00M
         
Kind == OMPD_target_teams_distribute_parallel_for485k
||
615
1.00M
         
Kind == OMPD_target_teams_distribute_parallel_for_simd481k
||
616
1.00M
         
Kind == OMPD_target_teams_distribute_simd475k
;
617
1.00M
}
618
619
1.21M
bool clang::isOpenMPGenericLoopDirective(OpenMPDirectiveKind Kind) {
620
1.21M
  return Kind == OMPD_loop || 
Kind == OMPD_teams_loop1.21M
||
621
1.21M
         
Kind == OMPD_target_teams_loop1.21M
||
Kind == OMPD_parallel_loop1.21M
||
622
1.21M
         
Kind == OMPD_target_parallel_loop1.21M
;
623
1.21M
}
624
625
5.67M
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
626
5.67M
  return Kind == OMPC_private || 
Kind == OMPC_firstprivate5.55M
||
627
5.67M
         
Kind == OMPC_lastprivate3.59M
||
Kind == OMPC_linear3.51M
||
628
5.67M
         
Kind == OMPC_reduction3.44M
||
Kind == OMPC_task_reduction3.25M
||
629
5.67M
         
Kind == OMPC_in_reduction3.24M
; // TODO add next clauses like 'reduction'.
630
5.67M
}
631
632
3.16M
bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
633
3.16M
  return Kind == OMPC_threadprivate || 
Kind == OMPC_copyin3.14M
;
634
3.16M
}
635
636
85.0M
bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
637
85.0M
  return Kind == OMPD_task || 
isOpenMPTaskLoopDirective(Kind)24.9M
;
638
85.0M
}
639
640
2.78M
bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
641
2.78M
  return Kind == OMPD_distribute_parallel_for ||
642
2.78M
         
Kind == OMPD_distribute_parallel_for_simd2.63M
||
643
2.78M
         
Kind == OMPD_teams_distribute_parallel_for_simd2.46M
||
644
2.78M
         
Kind == OMPD_teams_distribute_parallel_for2.30M
||
645
2.78M
         
Kind == OMPD_target_teams_distribute_parallel_for2.16M
||
646
2.78M
         
Kind == OMPD_target_teams_distribute_parallel_for_simd1.94M
;
647
2.78M
}
648
649
897k
bool clang::isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind) {
650
897k
  return DKind == OMPD_tile || 
DKind == OMPD_unroll896k
;
651
897k
}
652
653
void clang::getOpenMPCaptureRegions(
654
    SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
655
3.25M
    OpenMPDirectiveKind DKind) {
656
3.25M
  assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
657
0
  switch (DKind) {
658
0
  case OMPD_metadirective:
659
0
    CaptureRegions.push_back(OMPD_metadirective);
660
0
    break;
661
198k
  case OMPD_parallel:
662
225k
  case OMPD_parallel_for:
663
259k
  case OMPD_parallel_for_simd:
664
269k
  case OMPD_parallel_master:
665
276k
  case OMPD_parallel_masked:
666
288k
  case OMPD_parallel_sections:
667
325k
  case OMPD_distribute_parallel_for:
668
375k
  case OMPD_distribute_parallel_for_simd:
669
375k
  case OMPD_parallel_loop:
670
375k
    CaptureRegions.push_back(OMPD_parallel);
671
375k
    break;
672
70.4k
  case OMPD_target_teams:
673
156k
  case OMPD_target_teams_distribute:
674
281k
  case OMPD_target_teams_distribute_simd:
675
281k
  case OMPD_target_teams_loop:
676
281k
    CaptureRegions.push_back(OMPD_task);
677
281k
    CaptureRegions.push_back(OMPD_target);
678
281k
    CaptureRegions.push_back(OMPD_teams);
679
281k
    break;
680
180k
  case OMPD_teams:
681
210k
  case OMPD_teams_distribute:
682
248k
  case OMPD_teams_distribute_simd:
683
248k
    CaptureRegions.push_back(OMPD_teams);
684
248k
    break;
685
651k
  case OMPD_target:
686
739k
  case OMPD_target_simd:
687
739k
    CaptureRegions.push_back(OMPD_task);
688
739k
    CaptureRegions.push_back(OMPD_target);
689
739k
    break;
690
47.0k
  case OMPD_teams_distribute_parallel_for:
691
109k
  case OMPD_teams_distribute_parallel_for_simd:
692
109k
    CaptureRegions.push_back(OMPD_teams);
693
109k
    CaptureRegions.push_back(OMPD_parallel);
694
109k
    break;
695
71.4k
  case OMPD_target_parallel:
696
170k
  case OMPD_target_parallel_for:
697
281k
  case OMPD_target_parallel_for_simd:
698
281k
  case OMPD_target_parallel_loop:
699
281k
    CaptureRegions.push_back(OMPD_task);
700
281k
    CaptureRegions.push_back(OMPD_target);
701
281k
    CaptureRegions.push_back(OMPD_parallel);
702
281k
    break;
703
123k
  case OMPD_task:
704
130k
  case OMPD_target_enter_data:
705
136k
  case OMPD_target_exit_data:
706
150k
  case OMPD_target_update:
707
150k
    CaptureRegions.push_back(OMPD_task);
708
150k
    break;
709
47.9k
  case OMPD_taskloop:
710
106k
  case OMPD_taskloop_simd:
711
143k
  case OMPD_master_taskloop:
712
203k
  case OMPD_master_taskloop_simd:
713
231k
  case OMPD_masked_taskloop:
714
278k
  case OMPD_masked_taskloop_simd:
715
278k
    CaptureRegions.push_back(OMPD_taskloop);
716
278k
    break;
717
49.9k
  case OMPD_parallel_masked_taskloop:
718
129k
  case OMPD_parallel_masked_taskloop_simd:
719
186k
  case OMPD_parallel_master_taskloop:
720
279k
  case OMPD_parallel_master_taskloop_simd:
721
279k
    CaptureRegions.push_back(OMPD_parallel);
722
279k
    CaptureRegions.push_back(OMPD_taskloop);
723
279k
    break;
724
96.2k
  case OMPD_target_teams_distribute_parallel_for:
725
256k
  case OMPD_target_teams_distribute_parallel_for_simd:
726
256k
    CaptureRegions.push_back(OMPD_task);
727
256k
    CaptureRegions.push_back(OMPD_target);
728
256k
    CaptureRegions.push_back(OMPD_teams);
729
256k
    CaptureRegions.push_back(OMPD_parallel);
730
256k
    break;
731
341
  case OMPD_teams_loop:
732
341
    CaptureRegions.push_back(OMPD_teams);
733
341
    break;
734
0
  case OMPD_nothing:
735
0
    CaptureRegions.push_back(OMPD_nothing);
736
0
    break;
737
387
  case OMPD_loop:
738
    // TODO: 'loop' may require different capture regions depending on the bind
739
    // clause or the parent directive when there is no bind clause. Use
740
    // OMPD_unknown for now.
741
34.9k
  case OMPD_simd:
742
75.5k
  case OMPD_for:
743
108k
  case OMPD_for_simd:
744
123k
  case OMPD_sections:
745
123k
  case OMPD_section:
746
131k
  case OMPD_single:
747
131k
  case OMPD_master:
748
131k
  case OMPD_critical:
749
150k
  case OMPD_taskgroup:
750
161k
  case OMPD_distribute:
751
166k
  case OMPD_ordered:
752
166k
  case OMPD_atomic:
753
214k
  case OMPD_target_data:
754
252k
  case OMPD_distribute_simd:
755
253k
  case OMPD_dispatch:
756
253k
    CaptureRegions.push_back(OMPD_unknown);
757
253k
    break;
758
90
  case OMPD_tile:
759
194
  case OMPD_unroll:
760
    // loop transformations do not introduce captures.
761
194
    break;
762
0
  case OMPD_threadprivate:
763
0
  case OMPD_allocate:
764
0
  case OMPD_taskyield:
765
0
  case OMPD_barrier:
766
0
  case OMPD_taskwait:
767
0
  case OMPD_cancellation_point:
768
0
  case OMPD_cancel:
769
0
  case OMPD_flush:
770
0
  case OMPD_depobj:
771
0
  case OMPD_scan:
772
0
  case OMPD_declare_reduction:
773
0
  case OMPD_declare_mapper:
774
0
  case OMPD_declare_simd:
775
0
  case OMPD_declare_target:
776
0
  case OMPD_end_declare_target:
777
0
  case OMPD_requires:
778
0
  case OMPD_declare_variant:
779
0
  case OMPD_begin_declare_variant:
780
0
  case OMPD_end_declare_variant:
781
0
    llvm_unreachable("OpenMP Directive is not allowed");
782
0
  case OMPD_unknown:
783
0
  default:
784
0
    llvm_unreachable("Unknown OpenMP directive");
785
3.25M
  }
786
3.25M
}