Coverage Report

Created: 2020-03-31 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
119k
OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) {
24
119k
  // 'flush' clause cannot be specified explicitly, because this is an implicit
25
119k
  // clause for 'flush' directive. If the 'flush' clause is explicitly specified
26
119k
  // the Parser should generate a warning about extra tokens at the end of the
27
119k
  // directive.
28
119k
  // 'depobj' clause cannot be specified explicitly, because this is an implicit
29
119k
  // clause for 'depobj' directive. If the 'depobj' clause is explicitly
30
119k
  // specified the Parser should generate a warning about extra tokens at the
31
119k
  // end of the directive.
32
119k
  if (llvm::StringSwitch<bool>(Str)
33
119k
          .Case("flush", true)
34
119k
          .Case("depobj", true)
35
119k
          .Default(false))
36
286
    return OMPC_unknown;
37
119k
  return llvm::StringSwitch<OpenMPClauseKind>(Str)
38
7.89M
#define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name)
39
119k
#include "clang/Basic/OpenMPKinds.def"
40
119k
      .Case("uniform", OMPC_uniform)
41
119k
      .Case("device_type", OMPC_device_type)
42
119k
      .Case("match", OMPC_match)
43
119k
      .Default(OMPC_unknown);
44
119k
}
45
46
142k
const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) {
47
142k
  assert(Kind <= OMPC_unknown);
48
142k
  switch (Kind) {
49
8
  case OMPC_unknown:
50
8
    return "unknown";
51
0
#define OPENMP_CLAUSE(Name, Class)                                             \
52
137k
  case OMPC_##Name:                                                            \
53
137k
    return #Name;
54
8
#include "clang/Basic/OpenMPKinds.def"
55
74
  case OMPC_uniform:
56
74
    return "uniform";
57
3.46k
  case OMPC_threadprivate:
58
3.46k
    return "threadprivate or thread local";
59
62
  case OMPC_device_type:
60
62
    return "device_type";
61
1.26k
  case OMPC_match:
62
1.26k
    return "match";
63
0
  }
64
0
  llvm_unreachable("Invalid OpenMP clause kind");
65
0
}
66
67
unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
68
23.9k
                                          StringRef Str) {
69
23.9k
  switch (Kind) {
70
1.05k
  case OMPC_default:
71
1.05k
    return llvm::StringSwitch<unsigned>(Str)
72
3.16k
#define OMP_DEFAULT_KIND(Enum, Name) .Case(Name, unsigned(Enum))
73
1.05k
#include "llvm/Frontend/OpenMP/OMPKinds.def"
74
1.05k
        .Default(unsigned(llvm::omp::OMP_DEFAULT_unknown));
75
582
  case OMPC_proc_bind:
76
582
    return llvm::StringSwitch<unsigned>(Str)
77
2.91k
#define OMP_PROC_BIND_KIND(Enum, Name, Value) .Case(Name, Value)
78
582
#include "llvm/Frontend/OpenMP/OMPKinds.def"
79
582
        .Default(unsigned(llvm::omp::OMP_PROC_BIND_unknown));
80
2.54k
  case OMPC_schedule:
81
2.54k
    return llvm::StringSwitch<unsigned>(Str)
82
2.54k
#define OPENMP_SCHEDULE_KIND(Name)                                             \
83
12.7k
  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
84
2.54k
#define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
85
7.64k
  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
86
2.54k
#include "clang/Basic/OpenMPKinds.def"
87
2.54k
        .Default(OMPC_SCHEDULE_unknown);
88
2.94k
  case OMPC_depend:
89
2.94k
    return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
90
20.6k
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
91
2.94k
#include "clang/Basic/OpenMPKinds.def"
92
2.94k
        .Default(OMPC_DEPEND_unknown);
93
298
  case OMPC_linear:
94
298
    return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
95
894
#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
96
298
#include "clang/Basic/OpenMPKinds.def"
97
298
        .Default(OMPC_LINEAR_unknown);
98
9.33k
  case OMPC_map:
99
9.33k
    return llvm::StringSwitch<unsigned>(Str)
100
9.33k
#define OPENMP_MAP_KIND(Name)                                                  \
101
56.0k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
102
9.33k
#define OPENMP_MAP_MODIFIER_KIND(Name)                                         \
103
28.0k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
104
9.33k
#include "clang/Basic/OpenMPKinds.def"
105
9.33k
        .Default(OMPC_MAP_unknown);
106
1.29k
  case OMPC_to:
107
1.29k
    return llvm::StringSwitch<unsigned>(Str)
108
1.29k
#define OPENMP_TO_MODIFIER_KIND(Name)                                          \
109
1.29k
  .Case(#Name, static_cast<unsigned>(OMPC_TO_MODIFIER_##Name))
110
1.29k
#include "clang/Basic/OpenMPKinds.def"
111
1.29k
        .Default(OMPC_TO_MODIFIER_unknown);
112
570
  case OMPC_from:
113
570
    return llvm::StringSwitch<unsigned>(Str)
114
570
#define OPENMP_FROM_MODIFIER_KIND(Name)                                     \
115
570
  .Case(#Name, static_cast<unsigned>(OMPC_FROM_MODIFIER_##Name))
116
570
#include "clang/Basic/OpenMPKinds.def"
117
570
        .Default(OMPC_FROM_MODIFIER_unknown);
118
1.44k
  case OMPC_dist_schedule:
119
1.44k
    return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
120
1.44k
#define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
121
1.44k
#include "clang/Basic/OpenMPKinds.def"
122
1.44k
        .Default(OMPC_DIST_SCHEDULE_unknown);
123
3.09k
  case OMPC_defaultmap:
124
3.09k
    return llvm::StringSwitch<unsigned>(Str)
125
3.09k
#define OPENMP_DEFAULTMAP_KIND(Name)                                           \
126
9.28k
  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
127
3.09k
#define OPENMP_DEFAULTMAP_MODIFIER(Name)                                       \
128
21.6k
  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
129
3.09k
#include "clang/Basic/OpenMPKinds.def"
130
3.09k
        .Default(OMPC_DEFAULTMAP_unknown);
131
39
  case OMPC_atomic_default_mem_order:
132
39
     return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
133
39
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)       \
134
117
  .Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
135
39
#include "clang/Basic/OpenMPKinds.def"
136
39
        .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
137
62
  case OMPC_device_type:
138
62
    return llvm::StringSwitch<OpenMPDeviceType>(Str)
139
186
#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
140
62
#include "clang/Basic/OpenMPKinds.def"
141
62
        .Default(OMPC_DEVICE_TYPE_unknown);
142
92
  case OMPC_lastprivate:
143
92
    return llvm::StringSwitch<OpenMPLastprivateModifier>(Str)
144
92
#define OPENMP_LASTPRIVATE_KIND(Name) .Case(#Name, OMPC_LASTPRIVATE_##Name)
145
92
#include "clang/Basic/OpenMPKinds.def"
146
92
        .Default(OMPC_LASTPRIVATE_unknown);
147
373
  case OMPC_order:
148
373
    return llvm::StringSwitch<OpenMPOrderClauseKind>(Str)
149
373
#define OPENMP_ORDER_KIND(Name) .Case(#Name, OMPC_ORDER_##Name)
150
373
#include "clang/Basic/OpenMPKinds.def"
151
373
        .Default(OMPC_ORDER_unknown);
152
32
  case OMPC_update:
153
32
    return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
154
224
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
155
32
#include "clang/Basic/OpenMPKinds.def"
156
32
        .Default(OMPC_DEPEND_unknown);
157
22
  case OMPC_device:
158
22
    return llvm::StringSwitch<OpenMPDeviceClauseModifier>(Str)
159
44
#define OPENMP_DEVICE_MODIFIER(Name) .Case(#Name, OMPC_DEVICE_##Name)
160
22
#include "clang/Basic/OpenMPKinds.def"
161
22
        .Default(OMPC_DEVICE_unknown);
162
116
  case OMPC_reduction:
163
116
    return llvm::StringSwitch<OpenMPReductionClauseModifier>(Str)
164
232
#define OPENMP_REDUCTION_MODIFIER(Name) .Case(#Name, OMPC_REDUCTION_##Name)
165
116
#include "clang/Basic/OpenMPKinds.def"
166
116
        .Default(OMPC_REDUCTION_unknown);
167
0
  case OMPC_unknown:
168
0
  case OMPC_threadprivate:
169
0
  case OMPC_if:
170
0
  case OMPC_final:
171
0
  case OMPC_num_threads:
172
0
  case OMPC_safelen:
173
0
  case OMPC_simdlen:
174
0
  case OMPC_allocator:
175
0
  case OMPC_allocate:
176
0
  case OMPC_collapse:
177
0
  case OMPC_private:
178
0
  case OMPC_firstprivate:
179
0
  case OMPC_shared:
180
0
  case OMPC_task_reduction:
181
0
  case OMPC_in_reduction:
182
0
  case OMPC_aligned:
183
0
  case OMPC_copyin:
184
0
  case OMPC_copyprivate:
185
0
  case OMPC_ordered:
186
0
  case OMPC_nowait:
187
0
  case OMPC_untied:
188
0
  case OMPC_mergeable:
189
0
  case OMPC_flush:
190
0
  case OMPC_depobj:
191
0
  case OMPC_read:
192
0
  case OMPC_write:
193
0
  case OMPC_capture:
194
0
  case OMPC_seq_cst:
195
0
  case OMPC_acq_rel:
196
0
  case OMPC_acquire:
197
0
  case OMPC_release:
198
0
  case OMPC_relaxed:
199
0
  case OMPC_threads:
200
0
  case OMPC_simd:
201
0
  case OMPC_num_teams:
202
0
  case OMPC_thread_limit:
203
0
  case OMPC_priority:
204
0
  case OMPC_grainsize:
205
0
  case OMPC_nogroup:
206
0
  case OMPC_num_tasks:
207
0
  case OMPC_hint:
208
0
  case OMPC_uniform:
209
0
  case OMPC_use_device_ptr:
210
0
  case OMPC_is_device_ptr:
211
0
  case OMPC_unified_address:
212
0
  case OMPC_unified_shared_memory:
213
0
  case OMPC_reverse_offload:
214
0
  case OMPC_dynamic_allocators:
215
0
  case OMPC_match:
216
0
  case OMPC_nontemporal:
217
0
  case OMPC_destroy:
218
0
  case OMPC_detach:
219
0
  case OMPC_inclusive:
220
0
  case OMPC_exclusive:
221
0
    break;
222
0
  }
223
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
224
0
}
225
226
const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
227
9.45k
                                                 unsigned Type) {
228
9.45k
  switch (Kind) {
229
988
  case OMPC_default:
230
988
    switch (llvm::omp::DefaultKind(Type)) {
231
0
#define OMP_DEFAULT_KIND(Enum, Name)                                           \
232
988
  case Enum:                                                                   \
233
988
    return Name;
234
0
#include "llvm/Frontend/OpenMP/OMPKinds.def"
235
988
    }
236
988
    
llvm_unreachable0
("Invalid OpenMP 'default' clause type");
237
988
  case OMPC_proc_bind:
238
556
    switch (Type) {
239
0
#define OMP_PROC_BIND_KIND(Enum, Name, Value)                                  \
240
556
  case Value:                                                                  \
241
556
    return Name;
242
0
#include "llvm/Frontend/OpenMP/OMPKinds.def"
243
556
    }
244
556
    
llvm_unreachable0
("Invalid OpenMP 'proc_bind' clause type");
245
1.39k
  case OMPC_schedule:
246
1.39k
    switch (Type) {
247
0
    case OMPC_SCHEDULE_unknown:
248
0
    case OMPC_SCHEDULE_MODIFIER_last:
249
0
      return "unknown";
250
0
#define OPENMP_SCHEDULE_KIND(Name)                                             \
251
972
    case OMPC_SCHEDULE_##Name:                                                 \
252
972
      return #Name;
253
0
#define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
254
420
    case OMPC_SCHEDULE_MODIFIER_##Name:                                        \
255
420
      return #Name;
256
0
#include "clang/Basic/OpenMPKinds.def"
257
1.39k
    }
258
1.39k
    
llvm_unreachable0
("Invalid OpenMP 'schedule' clause type");
259
1.39k
  case OMPC_depend:
260
1.25k
    switch (Type) {
261
0
    case OMPC_DEPEND_unknown:
262
0
      return "unknown";
263
0
#define OPENMP_DEPEND_KIND(Name)                                             \
264
1.25k
  case OMPC_DEPEND_##Name:                                                   \
265
1.25k
    return #Name;
266
0
#include "clang/Basic/OpenMPKinds.def"
267
1.25k
    }
268
1.25k
    
llvm_unreachable0
("Invalid OpenMP 'depend' clause type");
269
1.25k
  case OMPC_linear:
270
128
    switch (Type) {
271
0
    case OMPC_LINEAR_unknown:
272
0
      return "unknown";
273
0
#define OPENMP_LINEAR_KIND(Name)                                             \
274
128
  case OMPC_LINEAR_##Name:                                                   \
275
128
    return #Name;
276
0
#include "clang/Basic/OpenMPKinds.def"
277
128
    }
278
128
    
llvm_unreachable0
("Invalid OpenMP 'linear' clause type");
279
2.60k
  case OMPC_map:
280
2.60k
    switch (Type) {
281
0
    case OMPC_MAP_unknown:
282
0
    case OMPC_MAP_MODIFIER_last:
283
0
      return "unknown";
284
0
#define OPENMP_MAP_KIND(Name)                                                \
285
2.18k
  case OMPC_MAP_##Name:                                                      \
286
2.18k
    return #Name;
287
0
#define OPENMP_MAP_MODIFIER_KIND(Name)                                       \
288
424
  case OMPC_MAP_MODIFIER_##Name:                                             \
289
424
    return #Name;
290
0
#include "clang/Basic/OpenMPKinds.def"
291
0
    default:
292
0
      break;
293
0
    }
294
0
    llvm_unreachable("Invalid OpenMP 'map' clause type");
295
0
  case OMPC_to:
296
0
    switch (Type) {
297
0
    case OMPC_TO_MODIFIER_unknown:
298
0
      return "unknown";
299
0
#define OPENMP_TO_MODIFIER_KIND(Name)                                          \
300
0
  case OMPC_TO_MODIFIER_##Name:                                                \
301
0
    return #Name;
302
0
#include "clang/Basic/OpenMPKinds.def"
303
0
    default:
304
0
      break;
305
0
    }
306
0
    llvm_unreachable("Invalid OpenMP 'to' clause type");
307
0
  case OMPC_from:
308
0
    switch (Type) {
309
0
    case OMPC_FROM_MODIFIER_unknown:
310
0
      return "unknown";
311
0
#define OPENMP_FROM_MODIFIER_KIND(Name)                                        \
312
0
  case OMPC_FROM_MODIFIER_##Name:                                              \
313
0
    return #Name;
314
0
#include "clang/Basic/OpenMPKinds.def"
315
0
    default:
316
0
      break;
317
0
    }
318
0
    llvm_unreachable("Invalid OpenMP 'from' clause type");
319
416
  case OMPC_dist_schedule:
320
416
    switch (Type) {
321
0
    case OMPC_DIST_SCHEDULE_unknown:
322
0
      return "unknown";
323
0
#define OPENMP_DIST_SCHEDULE_KIND(Name)                                      \
324
416
  case OMPC_DIST_SCHEDULE_##Name:                                            \
325
416
    return #Name;
326
0
#include "clang/Basic/OpenMPKinds.def"
327
416
    }
328
416
    
llvm_unreachable0
("Invalid OpenMP 'dist_schedule' clause type");
329
1.76k
  case OMPC_defaultmap:
330
1.76k
    switch (Type) {
331
0
    case OMPC_DEFAULTMAP_unknown:
332
0
    case OMPC_DEFAULTMAP_MODIFIER_last:
333
0
      return "unknown";
334
0
#define OPENMP_DEFAULTMAP_KIND(Name)                                         \
335
920
    case OMPC_DEFAULTMAP_##Name:                                             \
336
920
      return #Name;
337
0
#define OPENMP_DEFAULTMAP_MODIFIER(Name)                                     \
338
840
    case OMPC_DEFAULTMAP_MODIFIER_##Name:                                    \
339
840
      return #Name;
340
0
#include "clang/Basic/OpenMPKinds.def"
341
1.76k
    }
342
1.76k
    
llvm_unreachable0
("Invalid OpenMP 'schedule' clause type");
343
1.76k
  case OMPC_atomic_default_mem_order:
344
24
    switch (Type) {
345
0
    case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
346
0
      return "unknown";
347
0
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)                           \
348
24
    case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name:                               \
349
24
      return #Name;
350
0
#include "clang/Basic/OpenMPKinds.def"
351
24
}
352
24
    
llvm_unreachable0
("Invalid OpenMP 'atomic_default_mem_order' clause type");
353
29
  case OMPC_device_type:
354
29
    switch (Type) {
355
0
    case OMPC_DEVICE_TYPE_unknown:
356
0
      return "unknown";
357
0
#define OPENMP_DEVICE_TYPE_KIND(Name)                                          \
358
29
    case OMPC_DEVICE_TYPE_##Name:                                              \
359
29
      return #Name;
360
0
#include "clang/Basic/OpenMPKinds.def"
361
29
    }
362
29
    
llvm_unreachable0
("Invalid OpenMP 'device_type' clause type");
363
44
  case OMPC_lastprivate:
364
44
    switch (Type) {
365
0
    case OMPC_LASTPRIVATE_unknown:
366
0
      return "unknown";
367
0
#define OPENMP_LASTPRIVATE_KIND(Name)                                          \
368
44
    case OMPC_LASTPRIVATE_##Name:                                              \
369
44
      return #Name;
370
0
#include "clang/Basic/OpenMPKinds.def"
371
44
    }
372
44
    
llvm_unreachable0
("Invalid OpenMP 'lastprivate' clause type");
373
174
  case OMPC_order:
374
174
    switch (Type) {
375
0
    case OMPC_ORDER_unknown:
376
0
      return "unknown";
377
0
#define OPENMP_ORDER_KIND(Name)                                                \
378
174
    case OMPC_ORDER_##Name:                                                    \
379
174
      return #Name;
380
0
#include "clang/Basic/OpenMPKinds.def"
381
174
    }
382
174
    
llvm_unreachable0
("Invalid OpenMP 'order' clause type");
383
174
  case OMPC_update:
384
12
    switch (Type) {
385
0
    case OMPC_DEPEND_unknown:
386
0
      return "unknown";
387
0
#define OPENMP_DEPEND_KIND(Name)                                               \
388
12
  case OMPC_DEPEND_##Name:                                                     \
389
12
    return #Name;
390
0
#include "clang/Basic/OpenMPKinds.def"
391
12
    }
392
12
    
llvm_unreachable0
("Invalid OpenMP 'depend' clause type");
393
28
  case OMPC_device:
394
28
    switch (Type) {
395
0
    case OMPC_DEVICE_unknown:
396
0
      return "unknown";
397
0
#define OPENMP_DEVICE_MODIFIER(Name)                                           \
398
28
  case OMPC_DEVICE_##Name:                                                     \
399
28
    return #Name;
400
0
#include "clang/Basic/OpenMPKinds.def"
401
28
    }
402
28
    
llvm_unreachable0
("Invalid OpenMP 'device' clause modifier");
403
34
  case OMPC_reduction:
404
34
    switch (Type) {
405
0
    case OMPC_REDUCTION_unknown:
406
0
      return "unknown";
407
0
#define OPENMP_REDUCTION_MODIFIER(Name)                                        \
408
34
  case OMPC_REDUCTION_##Name:                                                  \
409
34
    return #Name;
410
0
#include "clang/Basic/OpenMPKinds.def"
411
34
    }
412
34
    
llvm_unreachable0
("Invalid OpenMP 'reduction' clause modifier");
413
34
  case OMPC_unknown:
414
0
  case OMPC_threadprivate:
415
0
  case OMPC_if:
416
0
  case OMPC_final:
417
0
  case OMPC_num_threads:
418
0
  case OMPC_safelen:
419
0
  case OMPC_simdlen:
420
0
  case OMPC_allocator:
421
0
  case OMPC_allocate:
422
0
  case OMPC_collapse:
423
0
  case OMPC_private:
424
0
  case OMPC_firstprivate:
425
0
  case OMPC_shared:
426
0
  case OMPC_task_reduction:
427
0
  case OMPC_in_reduction:
428
0
  case OMPC_aligned:
429
0
  case OMPC_copyin:
430
0
  case OMPC_copyprivate:
431
0
  case OMPC_ordered:
432
0
  case OMPC_nowait:
433
0
  case OMPC_untied:
434
0
  case OMPC_mergeable:
435
0
  case OMPC_flush:
436
0
  case OMPC_depobj:
437
0
  case OMPC_read:
438
0
  case OMPC_write:
439
0
  case OMPC_capture:
440
0
  case OMPC_seq_cst:
441
0
  case OMPC_acq_rel:
442
0
  case OMPC_acquire:
443
0
  case OMPC_release:
444
0
  case OMPC_relaxed:
445
0
  case OMPC_threads:
446
0
  case OMPC_simd:
447
0
  case OMPC_num_teams:
448
0
  case OMPC_thread_limit:
449
0
  case OMPC_priority:
450
0
  case OMPC_grainsize:
451
0
  case OMPC_nogroup:
452
0
  case OMPC_num_tasks:
453
0
  case OMPC_hint:
454
0
  case OMPC_uniform:
455
0
  case OMPC_use_device_ptr:
456
0
  case OMPC_is_device_ptr:
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_inclusive:
466
0
  case OMPC_exclusive:
467
0
    break;
468
0
  }
469
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
470
0
}
471
472
bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
473
                                        OpenMPClauseKind CKind,
474
114k
                                        unsigned OpenMPVersion) {
475
114k
  assert(unsigned(DKind) <= unsigned(OMPD_unknown));
476
114k
  assert(CKind <= OMPC_unknown);
477
114k
  // Nontemporal clause is not supported in OpenMP < 5.0.
478
114k
  if (OpenMPVersion < 50 && 
CKind == OMPC_nontemporal91.8k
)
479
504
    return false;
480
114k
  // Order clause is not supported in OpenMP < 5.0.
481
114k
  if (OpenMPVersion < 50 && 
CKind == OMPC_order91.3k
)
482
180
    return false;
483
114k
  switch (DKind) {
484
4.75k
  case OMPD_parallel:
485
4.75k
    switch (CKind) {
486
0
#define OPENMP_PARALLEL_CLAUSE(Name)                                           \
487
4.75k
  case OMPC_##Name:                                                            \
488
4.75k
    return true;
489
0
#include "clang/Basic/OpenMPKinds.def"
490
2
    default:
491
2
      break;
492
2
    }
493
2
    break;
494
3.14k
  case OMPD_simd:
495
3.14k
    if (OpenMPVersion < 50 && 
CKind == OMPC_if2.28k
)
496
0
      return false;
497
3.14k
    switch (CKind) {
498
0
#define OPENMP_SIMD_CLAUSE(Name)                                               \
499
3.11k
  case OMPC_##Name:                                                            \
500
3.11k
    return true;
501
0
#include "clang/Basic/OpenMPKinds.def"
502
26
    default:
503
26
      break;
504
26
    }
505
26
    break;
506
3.26k
  case OMPD_for:
507
3.26k
    switch (CKind) {
508
0
#define OPENMP_FOR_CLAUSE(Name)                                                \
509
3.23k
  case OMPC_##Name:                                                            \
510
3.23k
    return true;
511
0
#include "clang/Basic/OpenMPKinds.def"
512
22
    default:
513
22
      break;
514
22
    }
515
22
    break;
516
3.04k
  case OMPD_for_simd:
517
3.04k
    if (OpenMPVersion < 50 && 
CKind == OMPC_if2.23k
)
518
0
      return false;
519
3.04k
    switch (CKind) {
520
0
#define OPENMP_FOR_SIMD_CLAUSE(Name)                                           \
521
3.04k
  case OMPC_##Name:                                                            \
522
3.04k
    return true;
523
0
#include "clang/Basic/OpenMPKinds.def"
524
4
    default:
525
4
      break;
526
4
    }
527
4
    break;
528
1.13k
  case OMPD_sections:
529
1.13k
    switch (CKind) {
530
0
#define OPENMP_SECTIONS_CLAUSE(Name)                                           \
531
1.12k
  case OMPC_##Name:                                                            \
532
1.12k
    return true;
533
0
#include "clang/Basic/OpenMPKinds.def"
534
18
    default:
535
18
      break;
536
18
    }
537
18
    break;
538
480
  case OMPD_single:
539
480
    switch (CKind) {
540
0
#define OPENMP_SINGLE_CLAUSE(Name)                                             \
541
470
  case OMPC_##Name:                                                            \
542
470
    return true;
543
0
#include "clang/Basic/OpenMPKinds.def"
544
10
    default:
545
10
      break;
546
10
    }
547
10
    break;
548
2.35k
  case OMPD_parallel_for:
549
2.35k
    switch (CKind) {
550
0
#define OPENMP_PARALLEL_FOR_CLAUSE(Name)                                       \
551
2.34k
  case OMPC_##Name:                                                            \
552
2.34k
    return true;
553
0
#include "clang/Basic/OpenMPKinds.def"
554
10
    default:
555
10
      break;
556
10
    }
557
10
    break;
558
3.20k
  case OMPD_parallel_for_simd:
559
3.20k
    switch (CKind) {
560
0
#define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name)                                  \
561
3.19k
  case OMPC_##Name:                                                            \
562
3.19k
    return true;
563
0
#include "clang/Basic/OpenMPKinds.def"
564
12
    default:
565
12
      break;
566
12
    }
567
12
    break;
568
1.24k
  case OMPD_parallel_master:
569
1.24k
    switch (CKind) {
570
0
#define OPENMP_PARALLEL_MASTER_CLAUSE(Name)                                    \
571
1.23k
    case OMPC_##Name:                                                          \
572
1.23k
      return true;
573
0
#include "clang/Basic/OpenMPKinds.def"
574
10
    default:
575
10
      break;
576
10
    }
577
10
    break;
578
1.31k
  case OMPD_parallel_sections:
579
1.31k
    switch (CKind) {
580
0
#define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name)                                  \
581
1.29k
  case OMPC_##Name:                                                            \
582
1.29k
    return true;
583
0
#include "clang/Basic/OpenMPKinds.def"
584
18
    default:
585
18
      break;
586
18
    }
587
18
    break;
588
1.68k
  case OMPD_task:
589
1.68k
    if (OpenMPVersion < 50 && 
CKind == OMPC_detach1.26k
)
590
54
      return false;
591
1.63k
    switch (CKind) {
592
0
#define OPENMP_TASK_CLAUSE(Name)                                               \
593
1.63k
  case OMPC_##Name:                                                            \
594
1.63k
    return true;
595
0
#include "clang/Basic/OpenMPKinds.def"
596
0
    default:
597
0
      break;
598
0
    }
599
0
    break;
600
200
  case OMPD_flush:
601
200
    if (CKind == OMPC_flush)
602
80
      return true;
603
120
    if (OpenMPVersion < 50)
604
30
      return false;
605
90
    switch (CKind) {
606
0
#define OPENMP_FLUSH_CLAUSE(Name)                                              \
607
78
  case OMPC_##Name:                                                            \
608
78
    return true;
609
0
#include "clang/Basic/OpenMPKinds.def"
610
12
    default:
611
12
      break;
612
12
    }
613
12
    break;
614
348
  case OMPD_depobj:
615
348
    if (OpenMPVersion < 50)
616
0
      return false;
617
348
    switch (CKind) {
618
0
#define OPENMP_DEPOBJ_CLAUSE(Name)                                             \
619
158
  case OMPC_##Name:                                                            \
620
158
    return true;
621
0
#include "clang/Basic/OpenMPKinds.def"
622
182
    case OMPC_depobj:
623
182
      return true;
624
8
    default:
625
8
      break;
626
8
    }
627
8
    break;
628
120
  case OMPD_scan:
629
120
    if (OpenMPVersion < 50)
630
0
      return false;
631
120
    switch (CKind) {
632
0
#define OPENMP_SCAN_CLAUSE(Name)                                               \
633
114
  case OMPC_##Name:                                                            \
634
114
    return true;
635
0
#include "clang/Basic/OpenMPKinds.def"
636
6
    default:
637
6
      break;
638
6
    }
639
6
    break;
640
2.93k
  case OMPD_atomic:
641
2.93k
    if (OpenMPVersion < 50 &&
642
2.93k
        
(830
CKind == OMPC_acq_rel830
||
CKind == OMPC_acquire818
||
643
830
         
CKind == OMPC_release806
||
CKind == OMPC_relaxed794
||
CKind == OMPC_hint782
))
644
62
      return false;
645
2.87k
    switch (CKind) {
646
0
#define OPENMP_ATOMIC_CLAUSE(Name)                                             \
647
2.86k
  case OMPC_##Name:                                                            \
648
2.86k
    return true;
649
0
#include "clang/Basic/OpenMPKinds.def"
650
4
    default:
651
4
      break;
652
4
    }
653
4
    break;
654
6.20k
  case OMPD_target:
655
6.20k
    switch (CKind) {
656
0
#define OPENMP_TARGET_CLAUSE(Name)                                             \
657
6.18k
  case OMPC_##Name:                                                            \
658
6.18k
    return true;
659
0
#include "clang/Basic/OpenMPKinds.def"
660
20
    default:
661
20
      break;
662
20
    }
663
20
    break;
664
103
  case OMPD_requires:
665
103
    switch (CKind) {
666
0
#define OPENMP_REQUIRES_CLAUSE(Name)                                             \
667
101
  case OMPC_##Name:                                                            \
668
101
    return true;
669
0
#include "clang/Basic/OpenMPKinds.def"
670
2
    default:
671
2
      break;
672
2
    }
673
2
    break;
674
1.94k
  case OMPD_target_data:
675
1.94k
    switch (CKind) {
676
0
#define OPENMP_TARGET_DATA_CLAUSE(Name)                                        \
677
1.94k
  case OMPC_##Name:                                                            \
678
1.94k
    return true;
679
0
#include "clang/Basic/OpenMPKinds.def"
680
2
    default:
681
2
      break;
682
2
    }
683
2
    break;
684
1.72k
  case OMPD_target_enter_data:
685
1.72k
    switch (CKind) {
686
0
#define OPENMP_TARGET_ENTER_DATA_CLAUSE(Name)                                  \
687
1.71k
  case OMPC_##Name:                                                            \
688
1.71k
    return true;
689
0
#include "clang/Basic/OpenMPKinds.def"
690
4
    default:
691
4
      break;
692
4
    }
693
4
    break;
694
1.67k
  case OMPD_target_exit_data:
695
1.67k
    switch (CKind) {
696
0
#define OPENMP_TARGET_EXIT_DATA_CLAUSE(Name)                                   \
697
1.66k
  case OMPC_##Name:                                                            \
698
1.66k
    return true;
699
0
#include "clang/Basic/OpenMPKinds.def"
700
4
    default:
701
4
      break;
702
4
    }
703
4
    break;
704
2.58k
  case OMPD_target_parallel:
705
2.58k
    switch (CKind) {
706
0
#define OPENMP_TARGET_PARALLEL_CLAUSE(Name)                                    \
707
2.57k
  case OMPC_##Name:                                                            \
708
2.57k
    return true;
709
0
#include "clang/Basic/OpenMPKinds.def"
710
2
    default:
711
2
      break;
712
2
    }
713
2
    break;
714
3.29k
  case OMPD_target_parallel_for:
715
3.29k
    switch (CKind) {
716
0
#define OPENMP_TARGET_PARALLEL_FOR_CLAUSE(Name)                                \
717
3.28k
  case OMPC_##Name:                                                            \
718
3.28k
    return true;
719
0
#include "clang/Basic/OpenMPKinds.def"
720
10
    default:
721
10
      break;
722
10
    }
723
10
    break;
724
2.95k
  case OMPD_target_update:
725
2.95k
    switch (CKind) {
726
0
#define OPENMP_TARGET_UPDATE_CLAUSE(Name)                                      \
727
2.94k
  case OMPC_##Name:                                                            \
728
2.94k
    return true;
729
0
#include "clang/Basic/OpenMPKinds.def"
730
2
    default:
731
2
      break;
732
2
    }
733
2
    break;
734
1.26k
  case OMPD_teams:
735
1.26k
    switch (CKind) {
736
0
#define OPENMP_TEAMS_CLAUSE(Name)                                              \
737
1.26k
  case OMPC_##Name:                                                            \
738
1.26k
    return true;
739
0
#include "clang/Basic/OpenMPKinds.def"
740
0
    default:
741
0
      break;
742
0
    }
743
0
    break;
744
116
  case OMPD_cancel:
745
116
    switch (CKind) {
746
0
#define OPENMP_CANCEL_CLAUSE(Name)                                             \
747
112
  case OMPC_##Name:                                                            \
748
112
    return true;
749
0
#include "clang/Basic/OpenMPKinds.def"
750
4
    default:
751
4
      break;
752
4
    }
753
4
    break;
754
629
  case OMPD_ordered:
755
629
    switch (CKind) {
756
0
#define OPENMP_ORDERED_CLAUSE(Name)                                            \
757
623
  case OMPC_##Name:                                                            \
758
623
    return true;
759
0
#include "clang/Basic/OpenMPKinds.def"
760
6
    default:
761
6
      break;
762
6
    }
763
6
    break;
764
2.16k
  case OMPD_taskloop:
765
2.16k
    switch (CKind) {
766
0
#define OPENMP_TASKLOOP_CLAUSE(Name)                                           \
767
2.15k
  case OMPC_##Name:                                                            \
768
2.15k
    return true;
769
0
#include "clang/Basic/OpenMPKinds.def"
770
12
    default:
771
12
      break;
772
12
    }
773
12
    break;
774
3.13k
  case OMPD_taskloop_simd:
775
3.13k
    switch (CKind) {
776
0
#define OPENMP_TASKLOOP_SIMD_CLAUSE(Name)                                      \
777
3.13k
  case OMPC_##Name:                                                            \
778
3.13k
    return true;
779
0
#include "clang/Basic/OpenMPKinds.def"
780
0
    default:
781
0
      break;
782
0
    }
783
0
    break;
784
2.15k
  case OMPD_master_taskloop:
785
2.15k
    switch (CKind) {
786
0
#define OPENMP_MASTER_TASKLOOP_CLAUSE(Name)                                    \
787
2.13k
  case OMPC_##Name:                                                            \
788
2.13k
    return true;
789
0
#include "clang/Basic/OpenMPKinds.def"
790
12
    default:
791
12
      break;
792
12
    }
793
12
    break;
794
3.11k
  case OMPD_master_taskloop_simd:
795
3.11k
    switch (CKind) {
796
0
#define OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(Name)                               \
797
3.11k
  case OMPC_##Name:                                                            \
798
3.11k
    return true;
799
0
#include "clang/Basic/OpenMPKinds.def"
800
0
    default:
801
0
      break;
802
0
    }
803
0
    break;
804
1.71k
  case OMPD_parallel_master_taskloop:
805
1.71k
    switch (CKind) {
806
0
#define OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(Name)                           \
807
1.70k
  case OMPC_##Name:                                                            \
808
1.70k
    return true;
809
0
#include "clang/Basic/OpenMPKinds.def"
810
14
    default:
811
14
      break;
812
14
    }
813
14
    break;
814
2.64k
  case OMPD_parallel_master_taskloop_simd:
815
2.64k
    switch (CKind) {
816
0
#define OPENMP_PARALLEL_MASTER_TASKLOOP_SIMD_CLAUSE(Name)                      \
817
2.63k
  case OMPC_##Name:                                                            \
818
2.63k
    return true;
819
0
#include "clang/Basic/OpenMPKinds.def"
820
8
    default:
821
8
      break;
822
8
    }
823
8
    break;
824
48
  case OMPD_critical:
825
48
    switch (CKind) {
826
0
#define OPENMP_CRITICAL_CLAUSE(Name)                                           \
827
42
  case OMPC_##Name:                                                            \
828
42
    return true;
829
0
#include "clang/Basic/OpenMPKinds.def"
830
6
    default:
831
6
      break;
832
6
    }
833
6
    break;
834
666
  case OMPD_distribute:
835
666
    switch (CKind) {
836
0
#define OPENMP_DISTRIBUTE_CLAUSE(Name)                                         \
837
664
  case OMPC_##Name:                                                            \
838
664
    return true;
839
0
#include "clang/Basic/OpenMPKinds.def"
840
2
    default:
841
2
      break;
842
2
    }
843
2
    break;
844
2.55k
  case OMPD_distribute_parallel_for:
845
2.55k
    switch (CKind) {
846
0
#define OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name)                            \
847
2.54k
  case OMPC_##Name:                                                            \
848
2.54k
    return true;
849
0
#include "clang/Basic/OpenMPKinds.def"
850
14
    default:
851
14
      break;
852
14
    }
853
14
    break;
854
3.37k
  case OMPD_distribute_parallel_for_simd:
855
3.37k
    switch (CKind) {
856
0
#define OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name)                       \
857
3.36k
  case OMPC_##Name:                                                            \
858
3.36k
    return true;
859
0
#include "clang/Basic/OpenMPKinds.def"
860
16
    default:
861
16
      break;
862
16
    }
863
16
    break;
864
2.98k
  case OMPD_distribute_simd:
865
2.98k
    if (OpenMPVersion < 50 && 
CKind == OMPC_if2.05k
)
866
0
      return false;
867
2.98k
    switch (CKind) {
868
0
#define OPENMP_DISTRIBUTE_SIMD_CLAUSE(Name)                                    \
869
2.98k
  case OMPC_##Name:                                                            \
870
2.98k
    return true;
871
0
#include "clang/Basic/OpenMPKinds.def"
872
8
    default:
873
8
      break;
874
8
    }
875
8
    break;
876
4.82k
  case OMPD_target_parallel_for_simd:
877
4.82k
    switch (CKind) {
878
0
#define OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(Name)                           \
879
4.82k
  case OMPC_##Name:                                                            \
880
4.82k
    return true;
881
0
#include "clang/Basic/OpenMPKinds.def"
882
2
    default:
883
2
      break;
884
2
    }
885
2
    break;
886
3.96k
  case OMPD_target_simd:
887
3.96k
    switch (CKind) {
888
0
#define OPENMP_TARGET_SIMD_CLAUSE(Name)                                        \
889
3.95k
  case OMPC_##Name:                                                            \
890
3.95k
    return true;
891
0
#include "clang/Basic/OpenMPKinds.def"
892
6
    default:
893
6
      break;
894
6
    }
895
6
    break;
896
1.59k
  case OMPD_teams_distribute:
897
1.59k
    switch (CKind) {
898
0
#define OPENMP_TEAMS_DISTRIBUTE_CLAUSE(Name)                                   \
899
1.58k
  case OMPC_##Name:                                                            \
900
1.58k
    return true;
901
0
#include "clang/Basic/OpenMPKinds.def"
902
12
    default:
903
12
      break;
904
12
    }
905
12
    break;
906
2.59k
  case OMPD_teams_distribute_simd:
907
2.59k
    if (OpenMPVersion < 50 && 
CKind == OMPC_if2.01k
)
908
0
      return false;
909
2.59k
    switch (CKind) {
910
0
#define OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name)                              \
911
2.57k
  case OMPC_##Name:                                                            \
912
2.57k
    return true;
913
0
#include "clang/Basic/OpenMPKinds.def"
914
20
    default:
915
20
      break;
916
20
    }
917
20
    break;
918
3.00k
  case OMPD_teams_distribute_parallel_for_simd:
919
3.00k
    switch (CKind) {
920
0
#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name)                 \
921
2.98k
  case OMPC_##Name:                                                            \
922
2.98k
    return true;
923
0
#include "clang/Basic/OpenMPKinds.def"
924
20
    default:
925
20
      break;
926
20
    }
927
20
    break;
928
2.01k
  case OMPD_teams_distribute_parallel_for:
929
2.01k
    switch (CKind) {
930
0
#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name)                      \
931
1.99k
  case OMPC_##Name:                                                            \
932
1.99k
    return true;
933
0
#include "clang/Basic/OpenMPKinds.def"
934
20
    default:
935
20
      break;
936
20
    }
937
20
    break;
938
3.22k
  case OMPD_target_teams:
939
3.22k
    switch (CKind) {
940
0
#define OPENMP_TARGET_TEAMS_CLAUSE(Name)                                       \
941
3.22k
  case OMPC_##Name:                                                            \
942
3.22k
    return true;
943
0
#include "clang/Basic/OpenMPKinds.def"
944
0
    default:
945
0
      break;
946
0
    }
947
0
    break;
948
2.57k
  case OMPD_target_teams_distribute:
949
2.57k
    switch (CKind) {
950
0
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(Name)                            \
951
2.56k
  case OMPC_##Name:                                                            \
952
2.56k
    return true;
953
0
#include "clang/Basic/OpenMPKinds.def"
954
8
    default:
955
8
      break;
956
8
    }
957
8
    break;
958
3.35k
  case OMPD_target_teams_distribute_parallel_for:
959
3.35k
    switch (CKind) {
960
0
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name)               \
961
3.34k
  case OMPC_##Name:                                                            \
962
3.34k
    return true;
963
0
#include "clang/Basic/OpenMPKinds.def"
964
16
    default:
965
16
      break;
966
16
    }
967
16
    break;
968
4.30k
  case OMPD_target_teams_distribute_parallel_for_simd:
969
4.30k
    switch (CKind) {
970
0
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name)          \
971
4.30k
  case OMPC_##Name:                                                            \
972
4.30k
    return true;
973
0
#include "clang/Basic/OpenMPKinds.def"
974
8
    default:
975
8
      break;
976
8
    }
977
8
    break;
978
4.59k
  case OMPD_target_teams_distribute_simd:
979
4.59k
    switch (CKind) {
980
0
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name)                       \
981
4.58k
  case OMPC_##Name:                                                            \
982
4.58k
    return true;
983
0
#include "clang/Basic/OpenMPKinds.def"
984
8
    default:
985
8
      break;
986
8
    }
987
8
    break;
988
1.47k
  case OMPD_taskgroup:
989
1.47k
    switch (CKind) {
990
0
#define OPENMP_TASKGROUP_CLAUSE(Name)                                          \
991
1.47k
  case OMPC_##Name:                                                            \
992
1.47k
    return true;
993
0
#include "clang/Basic/OpenMPKinds.def"
994
0
    default:
995
0
      break;
996
0
    }
997
0
    break;
998
210
  case OMPD_declare_mapper:
999
210
    switch (CKind) {
1000
0
#define OPENMP_DECLARE_MAPPER_CLAUSE(Name)                                     \
1001
200
  case OMPC_##Name:                                                            \
1002
200
    return true;
1003
0
#include "clang/Basic/OpenMPKinds.def"
1004
10
    default:
1005
10
      break;
1006
10
    }
1007
10
    break;
1008
214
  case OMPD_allocate:
1009
214
    switch (CKind) {
1010
0
#define OPENMP_ALLOCATE_CLAUSE(Name)                                           \
1011
212
  case OMPC_##Name:                                                            \
1012
212
    return true;
1013
0
#include "clang/Basic/OpenMPKinds.def"
1014
2
    default:
1015
2
      break;
1016
2
    }
1017
2
    break;
1018
2
  case OMPD_declare_variant:
1019
0
    switch (CKind) {
1020
0
#define OPENMP_DECLARE_VARIANT_CLAUSE(Name)                                    \
1021
0
  case OMPC_##Name:                                                            \
1022
0
    return true;
1023
0
#include "clang/Basic/OpenMPKinds.def"
1024
0
    default:
1025
0
      break;
1026
0
    }
1027
0
    break;
1028
32
  case OMPD_begin_declare_variant:
1029
32
  case OMPD_end_declare_variant:
1030
32
  case OMPD_declare_target:
1031
32
  case OMPD_end_declare_target:
1032
32
  case OMPD_unknown:
1033
32
  case OMPD_threadprivate:
1034
32
  case OMPD_section:
1035
32
  case OMPD_master:
1036
32
  case OMPD_taskyield:
1037
32
  case OMPD_barrier:
1038
32
  case OMPD_taskwait:
1039
32
  case OMPD_cancellation_point:
1040
32
  case OMPD_declare_reduction:
1041
32
  case OMPD_declare_simd:
1042
32
    break;
1043
474
  }
1044
474
  return false;
1045
474
}
1046
1047
4.02M
bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
1048
4.02M
  return DKind == OMPD_simd || 
DKind == OMPD_for3.93M
||
DKind == OMPD_for_simd3.82M
||
1049
4.02M
         
DKind == OMPD_parallel_for3.72M
||
DKind == OMPD_parallel_for_simd3.66M
||
1050
4.02M
         
DKind == OMPD_taskloop3.57M
||
DKind == OMPD_taskloop_simd3.50M
||
1051
4.02M
         
DKind == OMPD_master_taskloop3.42M
||
DKind == OMPD_master_taskloop_simd3.36M
||
1052
4.02M
         
DKind == OMPD_parallel_master_taskloop3.29M
||
1053
4.02M
         
DKind == OMPD_parallel_master_taskloop_simd3.22M
||
1054
4.02M
         
DKind == OMPD_distribute3.13M
||
DKind == OMPD_target_parallel_for3.08M
||
1055
4.02M
         
DKind == OMPD_distribute_parallel_for2.93M
||
1056
4.02M
         
DKind == OMPD_distribute_parallel_for_simd2.74M
||
1057
4.02M
         
DKind == OMPD_distribute_simd2.44M
||
1058
4.02M
         
DKind == OMPD_target_parallel_for_simd2.20M
||
DKind == OMPD_target_simd1.98M
||
1059
4.02M
         
DKind == OMPD_teams_distribute1.83M
||
1060
4.02M
         
DKind == OMPD_teams_distribute_simd1.72M
||
1061
4.02M
         
DKind == OMPD_teams_distribute_parallel_for_simd1.57M
||
1062
4.02M
         
DKind == OMPD_teams_distribute_parallel_for1.34M
||
1063
4.02M
         
DKind == OMPD_target_teams_distribute1.20M
||
1064
4.02M
         
DKind == OMPD_target_teams_distribute_parallel_for1.06M
||
1065
4.02M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd895k
||
1066
4.02M
         
DKind == OMPD_target_teams_distribute_simd619k
;
1067
4.02M
}
1068
1069
2.80M
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
1070
2.80M
  return DKind == OMPD_for || 
DKind == OMPD_for_simd2.66M
||
1071
2.80M
         
DKind == OMPD_sections2.54M
||
DKind == OMPD_section2.53M
||
1072
2.80M
         
DKind == OMPD_single2.53M
||
DKind == OMPD_parallel_for2.53M
||
1073
2.80M
         
DKind == OMPD_parallel_for_simd2.42M
||
DKind == OMPD_parallel_sections2.30M
||
1074
2.80M
         
DKind == OMPD_target_parallel_for2.29M
||
1075
2.80M
         
DKind == OMPD_distribute_parallel_for2.15M
||
1076
2.80M
         
DKind == OMPD_distribute_parallel_for_simd2.08M
||
1077
2.80M
         
DKind == OMPD_target_parallel_for_simd2.00M
||
1078
2.80M
         
DKind == OMPD_teams_distribute_parallel_for_simd1.84M
||
1079
2.80M
         
DKind == OMPD_teams_distribute_parallel_for1.77M
||
1080
2.80M
         
DKind == OMPD_target_teams_distribute_parallel_for1.70M
||
1081
2.80M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd1.62M
;
1082
2.80M
}
1083
1084
8.38M
bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
1085
8.38M
  return DKind == OMPD_taskloop || 
DKind == OMPD_taskloop_simd8.02M
||
1086
8.38M
         
DKind == OMPD_master_taskloop7.81M
||
DKind == OMPD_master_taskloop_simd7.68M
||
1087
8.38M
         
DKind == OMPD_parallel_master_taskloop7.48M
||
1088
8.38M
         
DKind == OMPD_parallel_master_taskloop_simd7.36M
;
1089
8.38M
}
1090
1091
7.81M
bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
1092
7.81M
  return DKind == OMPD_parallel || 
DKind == OMPD_parallel_for7.34M
||
1093
7.81M
         
DKind == OMPD_parallel_for_simd7.32M
||
DKind == OMPD_parallel_sections7.30M
||
1094
7.81M
         
DKind == OMPD_target_parallel7.30M
||
DKind == OMPD_target_parallel_for7.27M
||
1095
7.81M
         
DKind == OMPD_distribute_parallel_for7.23M
||
1096
7.81M
         
DKind == OMPD_distribute_parallel_for_simd7.17M
||
1097
7.81M
         
DKind == OMPD_target_parallel_for_simd7.07M
||
1098
7.81M
         
DKind == OMPD_teams_distribute_parallel_for7.01M
||
1099
7.81M
         
DKind == OMPD_teams_distribute_parallel_for_simd6.96M
||
1100
7.81M
         
DKind == OMPD_target_teams_distribute_parallel_for6.89M
||
1101
7.81M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd6.84M
||
1102
7.81M
         
DKind == OMPD_parallel_master6.75M
||
1103
7.81M
         
DKind == OMPD_parallel_master_taskloop6.75M
||
1104
7.81M
         
DKind == OMPD_parallel_master_taskloop_simd6.70M
;
1105
7.81M
}
1106
1107
6.07M
bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
1108
6.07M
  return DKind == OMPD_target || 
DKind == OMPD_target_parallel5.23M
||
1109
6.07M
         
DKind == OMPD_target_parallel_for5.17M
||
1110
6.07M
         
DKind == OMPD_target_parallel_for_simd5.06M
||
DKind == OMPD_target_simd4.91M
||
1111
6.07M
         
DKind == OMPD_target_teams4.76M
||
DKind == OMPD_target_teams_distribute4.70M
||
1112
6.07M
         
DKind == OMPD_target_teams_distribute_parallel_for4.61M
||
1113
6.07M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd4.47M
||
1114
6.07M
         
DKind == OMPD_target_teams_distribute_simd4.28M
;
1115
6.07M
}
1116
1117
848k
bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
1118
848k
  return DKind == OMPD_target_data || 
DKind == OMPD_target_enter_data838k
||
1119
848k
         
DKind == OMPD_target_exit_data834k
||
DKind == OMPD_target_update830k
;
1120
848k
}
1121
1122
6.85M
bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
1123
6.85M
  return DKind == OMPD_teams || 
DKind == OMPD_teams_distribute6.45M
||
1124
6.85M
         
DKind == OMPD_teams_distribute_simd6.41M
||
1125
6.85M
         
DKind == OMPD_teams_distribute_parallel_for_simd6.36M
||
1126
6.85M
         
DKind == OMPD_teams_distribute_parallel_for6.35M
;
1127
6.85M
}
1128
1129
6.69M
bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
1130
6.69M
  return isOpenMPNestingTeamsDirective(DKind) ||
1131
6.69M
         
DKind == OMPD_target_teams6.20M
||
DKind == OMPD_target_teams_distribute6.17M
||
1132
6.69M
         
DKind == OMPD_target_teams_distribute_parallel_for6.14M
||
1133
6.69M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd6.14M
||
1134
6.69M
         
DKind == OMPD_target_teams_distribute_simd6.14M
;
1135
6.69M
}
1136
1137
1.22M
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
1138
1.22M
  return DKind == OMPD_simd || 
DKind == OMPD_for_simd1.19M
||
1139
1.22M
         
DKind == OMPD_parallel_for_simd1.16M
||
DKind == OMPD_taskloop_simd1.12M
||
1140
1.22M
         
DKind == OMPD_master_taskloop_simd1.10M
||
1141
1.22M
         
DKind == OMPD_parallel_master_taskloop_simd1.08M
||
1142
1.22M
         
DKind == OMPD_distribute_parallel_for_simd1.06M
||
1143
1.22M
         
DKind == OMPD_distribute_simd1.00M
||
DKind == OMPD_target_simd962k
||
1144
1.22M
         
DKind == OMPD_teams_distribute_simd922k
||
1145
1.22M
         
DKind == OMPD_teams_distribute_parallel_for_simd892k
||
1146
1.22M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd840k
||
1147
1.22M
         
DKind == OMPD_target_teams_distribute_simd754k
||
1148
1.22M
         
DKind == OMPD_target_parallel_for_simd695k
;
1149
1.22M
}
1150
1151
906k
bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
1152
906k
  return Kind == OMPD_distribute || 
Kind == OMPD_distribute_parallel_for858k
||
1153
906k
         
Kind == OMPD_distribute_parallel_for_simd854k
||
1154
906k
         
Kind == OMPD_distribute_simd849k
;
1155
906k
  // TODO add next directives.
1156
906k
}
1157
1158
846k
bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
1159
846k
  return isOpenMPNestingDistributeDirective(Kind) ||
1160
846k
         
Kind == OMPD_teams_distribute695k
||
Kind == OMPD_teams_distribute_simd613k
||
1161
846k
         
Kind == OMPD_teams_distribute_parallel_for_simd513k
||
1162
846k
         
Kind == OMPD_teams_distribute_parallel_for511k
||
1163
846k
         
Kind == OMPD_target_teams_distribute510k
||
1164
846k
         
Kind == OMPD_target_teams_distribute_parallel_for393k
||
1165
846k
         
Kind == OMPD_target_teams_distribute_parallel_for_simd392k
||
1166
846k
         
Kind == OMPD_target_teams_distribute_simd389k
;
1167
846k
}
1168
1169
514k
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
1170
514k
  return Kind == OMPC_private || 
Kind == OMPC_firstprivate490k
||
1171
514k
         
Kind == OMPC_lastprivate421k
||
Kind == OMPC_linear392k
||
1172
514k
         
Kind == OMPC_reduction356k
||
Kind == OMPC_task_reduction303k
||
1173
514k
         
Kind == OMPC_in_reduction299k
; // TODO add next clauses like 'reduction'.
1174
514k
}
1175
1176
2.46M
bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
1177
2.46M
  return Kind == OMPC_threadprivate || 
Kind == OMPC_copyin2.44M
;
1178
2.46M
}
1179
1180
8.67M
bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
1181
8.67M
  return Kind == OMPD_task || 
isOpenMPTaskLoopDirective(Kind)6.83M
;
1182
8.67M
}
1183
1184
2.23M
bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
1185
2.23M
  return Kind == OMPD_distribute_parallel_for ||
1186
2.23M
         
Kind == OMPD_distribute_parallel_for_simd2.11M
||
1187
2.23M
         
Kind == OMPD_teams_distribute_parallel_for_simd1.95M
||
1188
2.23M
         
Kind == OMPD_teams_distribute_parallel_for1.80M
||
1189
2.23M
         
Kind == OMPD_target_teams_distribute_parallel_for1.69M
||
1190
2.23M
         
Kind == OMPD_target_teams_distribute_parallel_for_simd1.52M
;
1191
2.23M
}
1192
1193
void clang::getOpenMPCaptureRegions(
1194
    SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
1195
2.54M
    OpenMPDirectiveKind DKind) {
1196
2.54M
  assert(DKind <= OMPD_unknown);
1197
2.54M
  switch (DKind) {
1198
295k
  case OMPD_parallel:
1199
295k
  case OMPD_parallel_for:
1200
295k
  case OMPD_parallel_for_simd:
1201
295k
  case OMPD_parallel_master:
1202
295k
  case OMPD_parallel_sections:
1203
295k
  case OMPD_distribute_parallel_for:
1204
295k
  case OMPD_distribute_parallel_for_simd:
1205
295k
    CaptureRegions.push_back(OMPD_parallel);
1206
295k
    break;
1207
295k
  case OMPD_target_teams:
1208
202k
  case OMPD_target_teams_distribute:
1209
202k
  case OMPD_target_teams_distribute_simd:
1210
202k
    CaptureRegions.push_back(OMPD_task);
1211
202k
    CaptureRegions.push_back(OMPD_target);
1212
202k
    CaptureRegions.push_back(OMPD_teams);
1213
202k
    break;
1214
233k
  case OMPD_teams:
1215
233k
  case OMPD_teams_distribute:
1216
233k
  case OMPD_teams_distribute_simd:
1217
233k
    CaptureRegions.push_back(OMPD_teams);
1218
233k
    break;
1219
609k
  case OMPD_target:
1220
609k
  case OMPD_target_simd:
1221
609k
    CaptureRegions.push_back(OMPD_task);
1222
609k
    CaptureRegions.push_back(OMPD_target);
1223
609k
    break;
1224
609k
  case OMPD_teams_distribute_parallel_for:
1225
101k
  case OMPD_teams_distribute_parallel_for_simd:
1226
101k
    CaptureRegions.push_back(OMPD_teams);
1227
101k
    CaptureRegions.push_back(OMPD_parallel);
1228
101k
    break;
1229
207k
  case OMPD_target_parallel:
1230
207k
  case OMPD_target_parallel_for:
1231
207k
  case OMPD_target_parallel_for_simd:
1232
207k
    CaptureRegions.push_back(OMPD_task);
1233
207k
    CaptureRegions.push_back(OMPD_target);
1234
207k
    CaptureRegions.push_back(OMPD_parallel);
1235
207k
    break;
1236
207k
  case OMPD_task:
1237
88.5k
  case OMPD_target_enter_data:
1238
88.5k
  case OMPD_target_exit_data:
1239
88.5k
  case OMPD_target_update:
1240
88.5k
    CaptureRegions.push_back(OMPD_task);
1241
88.5k
    break;
1242
197k
  case OMPD_taskloop:
1243
197k
  case OMPD_taskloop_simd:
1244
197k
  case OMPD_master_taskloop:
1245
197k
  case OMPD_master_taskloop_simd:
1246
197k
    CaptureRegions.push_back(OMPD_taskloop);
1247
197k
    break;
1248
197k
  case OMPD_parallel_master_taskloop:
1249
144k
  case OMPD_parallel_master_taskloop_simd:
1250
144k
    CaptureRegions.push_back(OMPD_parallel);
1251
144k
    CaptureRegions.push_back(OMPD_taskloop);
1252
144k
    break;
1253
208k
  case OMPD_target_teams_distribute_parallel_for:
1254
208k
  case OMPD_target_teams_distribute_parallel_for_simd:
1255
208k
    CaptureRegions.push_back(OMPD_task);
1256
208k
    CaptureRegions.push_back(OMPD_target);
1257
208k
    CaptureRegions.push_back(OMPD_teams);
1258
208k
    CaptureRegions.push_back(OMPD_parallel);
1259
208k
    break;
1260
256k
  case OMPD_simd:
1261
256k
  case OMPD_for:
1262
256k
  case OMPD_for_simd:
1263
256k
  case OMPD_sections:
1264
256k
  case OMPD_section:
1265
256k
  case OMPD_single:
1266
256k
  case OMPD_master:
1267
256k
  case OMPD_critical:
1268
256k
  case OMPD_taskgroup:
1269
256k
  case OMPD_distribute:
1270
256k
  case OMPD_ordered:
1271
256k
  case OMPD_atomic:
1272
256k
  case OMPD_target_data:
1273
256k
  case OMPD_distribute_simd:
1274
256k
    CaptureRegions.push_back(OMPD_unknown);
1275
256k
    break;
1276
256k
  case OMPD_threadprivate:
1277
0
  case OMPD_allocate:
1278
0
  case OMPD_taskyield:
1279
0
  case OMPD_barrier:
1280
0
  case OMPD_taskwait:
1281
0
  case OMPD_cancellation_point:
1282
0
  case OMPD_cancel:
1283
0
  case OMPD_flush:
1284
0
  case OMPD_depobj:
1285
0
  case OMPD_scan:
1286
0
  case OMPD_declare_reduction:
1287
0
  case OMPD_declare_mapper:
1288
0
  case OMPD_declare_simd:
1289
0
  case OMPD_declare_target:
1290
0
  case OMPD_end_declare_target:
1291
0
  case OMPD_requires:
1292
0
  case OMPD_declare_variant:
1293
0
  case OMPD_begin_declare_variant:
1294
0
  case OMPD_end_declare_variant:
1295
0
    llvm_unreachable("OpenMP Directive is not allowed");
1296
0
  case OMPD_unknown:
1297
0
    llvm_unreachable("Unknown OpenMP directive");
1298
2.54M
  }
1299
2.54M
}