Coverage Report

Created: 2022-01-18 06:27

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