Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/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
22
483k
OpenMPDirectiveKind clang::getOpenMPDirectiveKind(StringRef Str) {
23
483k
  return llvm::StringSwitch<OpenMPDirectiveKind>(Str)
24
11.6M
#define OPENMP_DIRECTIVE(Name) .Case(#Name, OMPD_##Name)
25
14.9M
#define OPENMP_DIRECTIVE_EXT(Name, Str) .Case(Str, OMPD_##Name)
26
483k
#include "clang/Basic/OpenMPKinds.def"
27
483k
      .Default(OMPD_unknown);
28
483k
}
29
30
15.7k
const char *clang::getOpenMPDirectiveName(OpenMPDirectiveKind Kind) {
31
15.7k
  assert(Kind <= OMPD_unknown);
32
15.7k
  switch (Kind) {
33
15.7k
  case OMPD_unknown:
34
110
    return "unknown";
35
15.7k
#define OPENMP_DIRECTIVE(Name)                                                 \
36
15.7k
  case OMPD_##Name:                                                            \
37
6.47k
    return #Name;
38
15.7k
#define OPENMP_DIRECTIVE_EXT(Name, Str)                                        \
39
15.7k
  case OMPD_##Name:                                                            \
40
9.18k
    return Str;
41
15.7k
#include 
"clang/Basic/OpenMPKinds.def"110
42
15.7k
    
break0
;
43
0
  }
44
0
  llvm_unreachable("Invalid OpenMP directive kind");
45
0
}
46
47
83.6k
OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) {
48
83.6k
  // 'flush' clause cannot be specified explicitly, because this is an implicit
49
83.6k
  // clause for 'flush' directive. If the 'flush' clause is explicitly specified
50
83.6k
  // the Parser should generate a warning about extra tokens at the end of the
51
83.6k
  // directive.
52
83.6k
  if (Str == "flush")
53
8
    return OMPC_unknown;
54
83.6k
  return llvm::StringSwitch<OpenMPClauseKind>(Str)
55
4.59M
#define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name)
56
83.6k
#include "clang/Basic/OpenMPKinds.def"
57
83.6k
      .Case("uniform", OMPC_uniform)
58
83.6k
      .Default(OMPC_unknown);
59
83.6k
}
60
61
100k
const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) {
62
100k
  assert(Kind <= OMPC_unknown);
63
100k
  switch (Kind) {
64
100k
  case OMPC_unknown:
65
0
    return "unknown";
66
100k
#define OPENMP_CLAUSE(Name, Class)                                             \
67
100k
  case OMPC_##Name:                                                            \
68
97.6k
    return #Name;
69
100k
#include 
"clang/Basic/OpenMPKinds.def"0
70
100k
  case OMPC_uniform:
71
72
    return "uniform";
72
100k
  case OMPC_threadprivate:
73
2.48k
    return "threadprivate or thread local";
74
0
  }
75
0
  llvm_unreachable("Invalid OpenMP clause kind");
76
0
}
77
78
unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
79
15.8k
                                          StringRef Str) {
80
15.8k
  switch (Kind) {
81
15.8k
  case OMPC_default:
82
791
    return llvm::StringSwitch<OpenMPDefaultClauseKind>(Str)
83
1.58k
#define OPENMP_DEFAULT_KIND(Name) .Case(#Name, OMPC_DEFAULT_##Name)
84
791
#include "clang/Basic/OpenMPKinds.def"
85
791
        .Default(OMPC_DEFAULT_unknown);
86
15.8k
  case OMPC_proc_bind:
87
520
    return llvm::StringSwitch<OpenMPProcBindClauseKind>(Str)
88
1.56k
#define OPENMP_PROC_BIND_KIND(Name) .Case(#Name, OMPC_PROC_BIND_##Name)
89
520
#include "clang/Basic/OpenMPKinds.def"
90
520
        .Default(OMPC_PROC_BIND_unknown);
91
15.8k
  case OMPC_schedule:
92
2.38k
    return llvm::StringSwitch<unsigned>(Str)
93
2.38k
#define OPENMP_SCHEDULE_KIND(Name)                                             \
94
11.9k
  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
95
2.38k
#define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
96
7.15k
  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
97
2.38k
#include "clang/Basic/OpenMPKinds.def"
98
2.38k
        .Default(OMPC_SCHEDULE_unknown);
99
15.8k
  case OMPC_depend:
100
2.68k
    return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
101
16.0k
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
102
2.68k
#include "clang/Basic/OpenMPKinds.def"
103
2.68k
        .Default(OMPC_DEPEND_unknown);
104
15.8k
  case OMPC_linear:
105
184
    return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
106
552
#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
107
184
#include "clang/Basic/OpenMPKinds.def"
108
184
        .Default(OMPC_LINEAR_unknown);
109
15.8k
  case OMPC_map:
110
6.10k
    return llvm::StringSwitch<unsigned>(Str)
111
6.10k
#define OPENMP_MAP_KIND(Name)                                                  \
112
36.6k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
113
6.10k
#define OPENMP_MAP_MODIFIER_KIND(Name)                                         \
114
18.3k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
115
6.10k
#include "clang/Basic/OpenMPKinds.def"
116
6.10k
        .Default(OMPC_MAP_unknown);
117
15.8k
  case OMPC_to:
118
651
    return llvm::StringSwitch<unsigned>(Str)
119
651
#define OPENMP_TO_MODIFIER_KIND(Name)                                          \
120
651
  .Case(#Name, static_cast<unsigned>(OMPC_TO_MODIFIER_##Name))
121
651
#include "clang/Basic/OpenMPKinds.def"
122
651
        .Default(OMPC_TO_MODIFIER_unknown);
123
15.8k
  case OMPC_from:
124
364
    return llvm::StringSwitch<unsigned>(Str)
125
364
#define OPENMP_FROM_MODIFIER_KIND(Name)                                     \
126
364
  .Case(#Name, static_cast<unsigned>(OMPC_FROM_MODIFIER_##Name))
127
364
#include "clang/Basic/OpenMPKinds.def"
128
364
        .Default(OMPC_FROM_MODIFIER_unknown);
129
15.8k
  case OMPC_dist_schedule:
130
1.30k
    return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
131
1.30k
#define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
132
1.30k
#include "clang/Basic/OpenMPKinds.def"
133
1.30k
        .Default(OMPC_DIST_SCHEDULE_unknown);
134
15.8k
  case OMPC_defaultmap:
135
816
    return llvm::StringSwitch<unsigned>(Str)
136
816
#define OPENMP_DEFAULTMAP_KIND(Name)                                           \
137
816
  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
138
816
#define OPENMP_DEFAULTMAP_MODIFIER(Name)                                       \
139
816
  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
140
816
#include "clang/Basic/OpenMPKinds.def"
141
816
        .Default(OMPC_DEFAULTMAP_unknown);
142
15.8k
  case OMPC_atomic_default_mem_order:
143
23
     return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
144
23
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)       \
145
69
  .Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
146
23
#include "clang/Basic/OpenMPKinds.def"
147
23
        .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
148
15.8k
  case OMPC_unknown:
149
0
  case OMPC_threadprivate:
150
0
  case OMPC_if:
151
0
  case OMPC_final:
152
0
  case OMPC_num_threads:
153
0
  case OMPC_safelen:
154
0
  case OMPC_simdlen:
155
0
  case OMPC_allocator:
156
0
  case OMPC_allocate:
157
0
  case OMPC_collapse:
158
0
  case OMPC_private:
159
0
  case OMPC_firstprivate:
160
0
  case OMPC_lastprivate:
161
0
  case OMPC_shared:
162
0
  case OMPC_reduction:
163
0
  case OMPC_task_reduction:
164
0
  case OMPC_in_reduction:
165
0
  case OMPC_aligned:
166
0
  case OMPC_copyin:
167
0
  case OMPC_copyprivate:
168
0
  case OMPC_ordered:
169
0
  case OMPC_nowait:
170
0
  case OMPC_untied:
171
0
  case OMPC_mergeable:
172
0
  case OMPC_flush:
173
0
  case OMPC_read:
174
0
  case OMPC_write:
175
0
  case OMPC_update:
176
0
  case OMPC_capture:
177
0
  case OMPC_seq_cst:
178
0
  case OMPC_device:
179
0
  case OMPC_threads:
180
0
  case OMPC_simd:
181
0
  case OMPC_num_teams:
182
0
  case OMPC_thread_limit:
183
0
  case OMPC_priority:
184
0
  case OMPC_grainsize:
185
0
  case OMPC_nogroup:
186
0
  case OMPC_num_tasks:
187
0
  case OMPC_hint:
188
0
  case OMPC_uniform:
189
0
  case OMPC_use_device_ptr:
190
0
  case OMPC_is_device_ptr:
191
0
  case OMPC_unified_address:
192
0
  case OMPC_unified_shared_memory:
193
0
  case OMPC_reverse_offload:
194
0
  case OMPC_dynamic_allocators:
195
0
    break;
196
0
  }
197
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
198
0
}
199
200
const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
201
6.46k
                                                 unsigned Type) {
202
6.46k
  switch (Kind) {
203
6.46k
  case OMPC_default:
204
700
    switch (Type) {
205
700
    case OMPC_DEFAULT_unknown:
206
0
      return "unknown";
207
700
#define OPENMP_DEFAULT_KIND(Name)                                              \
208
700
  case OMPC_DEFAULT_##Name:                                                    \
209
700
    return #Name;
210
700
#include 
"clang/Basic/OpenMPKinds.def"458
211
700
    }
212
700
    
llvm_unreachable0
("Invalid OpenMP 'default' clause type");
213
700
  case OMPC_proc_bind:
214
482
    switch (Type) {
215
482
    case OMPC_PROC_BIND_unknown:
216
0
      return "unknown";
217
482
#define OPENMP_PROC_BIND_KIND(Name)                                            \
218
482
  case OMPC_PROC_BIND_##Name:                                                  \
219
482
    return #Name;
220
482
#include 
"clang/Basic/OpenMPKinds.def"178
221
482
    }
222
482
    
llvm_unreachable0
("Invalid OpenMP 'proc_bind' clause type");
223
1.29k
  case OMPC_schedule:
224
1.29k
    switch (Type) {
225
1.29k
    case OMPC_SCHEDULE_unknown:
226
0
    case OMPC_SCHEDULE_MODIFIER_last:
227
0
      return "unknown";
228
0
#define OPENMP_SCHEDULE_KIND(Name)                                             \
229
876
    case OMPC_SCHEDULE_##Name:                                                 \
230
876
      return #Name;
231
0
#define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
232
416
    case OMPC_SCHEDULE_MODIFIER_##Name:                                        \
233
416
      return #Name;
234
0
#include "clang/Basic/OpenMPKinds.def"
235
1.29k
    }
236
1.29k
    
llvm_unreachable0
("Invalid OpenMP 'schedule' clause type");
237
1.29k
  case OMPC_depend:
238
951
    switch (Type) {
239
951
    case OMPC_DEPEND_unknown:
240
0
      return "unknown";
241
951
#define OPENMP_DEPEND_KIND(Name)                                             \
242
951
  case OMPC_DEPEND_##Name:                                                   \
243
951
    return #Name;
244
951
#include 
"clang/Basic/OpenMPKinds.def"485
245
951
    }
246
951
    
llvm_unreachable0
("Invalid OpenMP 'depend' clause type");
247
951
  case OMPC_linear:
248
100
    switch (Type) {
249
100
    case OMPC_LINEAR_unknown:
250
0
      return "unknown";
251
100
#define OPENMP_LINEAR_KIND(Name)                                             \
252
100
  case OMPC_LINEAR_##Name:                                                   \
253
100
    return #Name;
254
100
#include 
"clang/Basic/OpenMPKinds.def"40
255
100
    }
256
100
    
llvm_unreachable0
("Invalid OpenMP 'linear' clause type");
257
2.14k
  case OMPC_map:
258
2.14k
    switch (Type) {
259
2.14k
    case OMPC_MAP_unknown:
260
0
    case OMPC_MAP_MODIFIER_last:
261
0
      return "unknown";
262
0
#define OPENMP_MAP_KIND(Name)                                                \
263
1.80k
  case OMPC_MAP_##Name:                                                      \
264
1.80k
    return #Name;
265
0
#define OPENMP_MAP_MODIFIER_KIND(Name)                                       \
266
336
  case OMPC_MAP_MODIFIER_##Name:                                             \
267
336
    return #Name;
268
0
#include "clang/Basic/OpenMPKinds.def"
269
0
    default:
270
0
      break;
271
0
    }
272
0
    llvm_unreachable("Invalid OpenMP 'map' clause type");
273
0
  case OMPC_to:
274
0
    switch (Type) {
275
0
    case OMPC_TO_MODIFIER_unknown:
276
0
      return "unknown";
277
0
#define OPENMP_TO_MODIFIER_KIND(Name)                                          \
278
0
  case OMPC_TO_MODIFIER_##Name:                                                \
279
0
    return #Name;
280
0
#include "clang/Basic/OpenMPKinds.def"
281
0
    default:
282
0
      break;
283
0
    }
284
0
    llvm_unreachable("Invalid OpenMP 'to' clause type");
285
0
  case OMPC_from:
286
0
    switch (Type) {
287
0
    case OMPC_FROM_MODIFIER_unknown:
288
0
      return "unknown";
289
0
#define OPENMP_FROM_MODIFIER_KIND(Name)                                        \
290
0
  case OMPC_FROM_MODIFIER_##Name:                                              \
291
0
    return #Name;
292
0
#include "clang/Basic/OpenMPKinds.def"
293
0
    default:
294
0
      break;
295
0
    }
296
0
    llvm_unreachable("Invalid OpenMP 'from' clause type");
297
312
  case OMPC_dist_schedule:
298
312
    switch (Type) {
299
312
    case OMPC_DIST_SCHEDULE_unknown:
300
0
      return "unknown";
301
312
#define OPENMP_DIST_SCHEDULE_KIND(Name)                                      \
302
312
  case OMPC_DIST_SCHEDULE_##Name:                                            \
303
312
    return #Name;
304
312
#include "clang/Basic/OpenMPKinds.def"
305
312
    }
306
312
    
llvm_unreachable0
("Invalid OpenMP 'dist_schedule' clause type");
307
464
  case OMPC_defaultmap:
308
464
    switch (Type) {
309
464
    case OMPC_DEFAULTMAP_unknown:
310
0
    case OMPC_DEFAULTMAP_MODIFIER_last:
311
0
      return "unknown";
312
0
#define OPENMP_DEFAULTMAP_KIND(Name)                                         \
313
272
    case OMPC_DEFAULTMAP_##Name:                                             \
314
272
      return #Name;
315
0
#define OPENMP_DEFAULTMAP_MODIFIER(Name)                                     \
316
192
    case OMPC_DEFAULTMAP_MODIFIER_##Name:                                    \
317
192
      return #Name;
318
0
#include "clang/Basic/OpenMPKinds.def"
319
464
    }
320
464
    
llvm_unreachable0
("Invalid OpenMP 'schedule' clause type");
321
464
  case OMPC_atomic_default_mem_order:
322
21
    switch (Type) {
323
21
    case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
324
0
      return "unknown";
325
21
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)                           \
326
21
    case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name:                               \
327
21
      return #Name;
328
21
#include 
"clang/Basic/OpenMPKinds.def"7
329
21
}
330
21
    
llvm_unreachable0
("Invalid OpenMP 'atomic_default_mem_order' clause type");
331
21
  case OMPC_unknown:
332
0
  case OMPC_threadprivate:
333
0
  case OMPC_if:
334
0
  case OMPC_final:
335
0
  case OMPC_num_threads:
336
0
  case OMPC_safelen:
337
0
  case OMPC_simdlen:
338
0
  case OMPC_allocator:
339
0
  case OMPC_allocate:
340
0
  case OMPC_collapse:
341
0
  case OMPC_private:
342
0
  case OMPC_firstprivate:
343
0
  case OMPC_lastprivate:
344
0
  case OMPC_shared:
345
0
  case OMPC_reduction:
346
0
  case OMPC_task_reduction:
347
0
  case OMPC_in_reduction:
348
0
  case OMPC_aligned:
349
0
  case OMPC_copyin:
350
0
  case OMPC_copyprivate:
351
0
  case OMPC_ordered:
352
0
  case OMPC_nowait:
353
0
  case OMPC_untied:
354
0
  case OMPC_mergeable:
355
0
  case OMPC_flush:
356
0
  case OMPC_read:
357
0
  case OMPC_write:
358
0
  case OMPC_update:
359
0
  case OMPC_capture:
360
0
  case OMPC_seq_cst:
361
0
  case OMPC_device:
362
0
  case OMPC_threads:
363
0
  case OMPC_simd:
364
0
  case OMPC_num_teams:
365
0
  case OMPC_thread_limit:
366
0
  case OMPC_priority:
367
0
  case OMPC_grainsize:
368
0
  case OMPC_nogroup:
369
0
  case OMPC_num_tasks:
370
0
  case OMPC_hint:
371
0
  case OMPC_uniform:
372
0
  case OMPC_use_device_ptr:
373
0
  case OMPC_is_device_ptr:
374
0
  case OMPC_unified_address:
375
0
  case OMPC_unified_shared_memory:
376
0
  case OMPC_reverse_offload:
377
0
  case OMPC_dynamic_allocators:
378
0
    break;
379
0
  }
380
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
381
0
}
382
383
bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
384
80.9k
                                        OpenMPClauseKind CKind) {
385
80.9k
  assert(DKind <= OMPD_unknown);
386
80.9k
  assert(CKind <= OMPC_unknown);
387
80.9k
  switch (DKind) {
388
80.9k
  case OMPD_parallel:
389
4.05k
    switch (CKind) {
390
4.05k
#define OPENMP_PARALLEL_CLAUSE(Name)                                           \
391
4.05k
  case OMPC_##Name:                                                            \
392
4.04k
    return true;
393
4.05k
#include "clang/Basic/OpenMPKinds.def"
394
4.05k
    default:
395
2
      break;
396
2
    }
397
2
    break;
398
2.18k
  case OMPD_simd:
399
2.18k
    switch (CKind) {
400
2.18k
#define OPENMP_SIMD_CLAUSE(Name)                                               \
401
2.18k
  case OMPC_##Name:                                                            \
402
2.16k
    return true;
403
2.18k
#include "clang/Basic/OpenMPKinds.def"
404
2.18k
    default:
405
16
      break;
406
16
    }
407
16
    break;
408
2.58k
  case OMPD_for:
409
2.58k
    switch (CKind) {
410
2.58k
#define OPENMP_FOR_CLAUSE(Name)                                                \
411
2.58k
  case OMPC_##Name:                                                            \
412
2.57k
    return true;
413
2.58k
#include "clang/Basic/OpenMPKinds.def"
414
2.58k
    default:
415
14
      break;
416
14
    }
417
14
    break;
418
2.21k
  case OMPD_for_simd:
419
2.21k
    switch (CKind) {
420
2.21k
#define OPENMP_FOR_SIMD_CLAUSE(Name)                                           \
421
2.21k
  case OMPC_##Name:                                                            \
422
2.20k
    return true;
423
2.21k
#include "clang/Basic/OpenMPKinds.def"
424
2.21k
    default:
425
4
      break;
426
4
    }
427
4
    break;
428
1.00k
  case OMPD_sections:
429
1.00k
    switch (CKind) {
430
1.00k
#define OPENMP_SECTIONS_CLAUSE(Name)                                           \
431
1.00k
  case OMPC_##Name:                                                            \
432
986
    return true;
433
1.00k
#include "clang/Basic/OpenMPKinds.def"
434
1.00k
    default:
435
14
      break;
436
14
    }
437
14
    break;
438
480
  case OMPD_single:
439
480
    switch (CKind) {
440
480
#define OPENMP_SINGLE_CLAUSE(Name)                                             \
441
480
  case OMPC_##Name:                                                            \
442
470
    return true;
443
480
#include "clang/Basic/OpenMPKinds.def"
444
480
    default:
445
10
      break;
446
10
    }
447
10
    break;
448
2.12k
  case OMPD_parallel_for:
449
2.12k
    switch (CKind) {
450
2.12k
#define OPENMP_PARALLEL_FOR_CLAUSE(Name)                                       \
451
2.12k
  case OMPC_##Name:                                                            \
452
2.11k
    return true;
453
2.12k
#include "clang/Basic/OpenMPKinds.def"
454
2.12k
    default:
455
8
      break;
456
8
    }
457
8
    break;
458
2.44k
  case OMPD_parallel_for_simd:
459
2.44k
    switch (CKind) {
460
2.44k
#define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name)                                  \
461
2.44k
  case OMPC_##Name:                                                            \
462
2.43k
    return true;
463
2.44k
#include "clang/Basic/OpenMPKinds.def"
464
2.44k
    default:
465
8
      break;
466
8
    }
467
8
    break;
468
1.19k
  case OMPD_parallel_sections:
469
1.19k
    switch (CKind) {
470
1.19k
#define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name)                                  \
471
1.19k
  case OMPC_##Name:                                                            \
472
1.18k
    return true;
473
1.19k
#include "clang/Basic/OpenMPKinds.def"
474
1.19k
    default:
475
14
      break;
476
14
    }
477
14
    break;
478
1.29k
  case OMPD_task:
479
1.29k
    switch (CKind) {
480
1.29k
#define OPENMP_TASK_CLAUSE(Name)                                               \
481
1.29k
  case OMPC_##Name:                                                            \
482
1.29k
    return true;
483
1.29k
#include "clang/Basic/OpenMPKinds.def"
484
1.29k
    default:
485
0
      break;
486
0
    }
487
0
    break;
488
50
  case OMPD_flush:
489
50
    return CKind == OMPC_flush;
490
0
    break;
491
1.58k
  case OMPD_atomic:
492
1.58k
    switch (CKind) {
493
1.58k
#define OPENMP_ATOMIC_CLAUSE(Name)                                             \
494
1.58k
  case OMPC_##Name:                                                            \
495
1.57k
    return true;
496
1.58k
#include "clang/Basic/OpenMPKinds.def"
497
1.58k
    default:
498
2
      break;
499
2
    }
500
2
    break;
501
3.87k
  case OMPD_target:
502
3.87k
    switch (CKind) {
503
3.87k
#define OPENMP_TARGET_CLAUSE(Name)                                             \
504
3.87k
  case OMPC_##Name:                                                            \
505
3.85k
    return true;
506
3.87k
#include "clang/Basic/OpenMPKinds.def"
507
3.87k
    default:
508
20
      break;
509
20
    }
510
20
    break;
511
87
  case OMPD_requires:
512
87
    switch (CKind) {
513
87
#define OPENMP_REQUIRES_CLAUSE(Name)                                             \
514
87
  case OMPC_##Name:                                                            \
515
85
    return true;
516
87
#include "clang/Basic/OpenMPKinds.def"
517
87
    default:
518
2
      break;
519
2
    }
520
2
    break;
521
1.22k
  case OMPD_target_data:
522
1.22k
    switch (CKind) {
523
1.22k
#define OPENMP_TARGET_DATA_CLAUSE(Name)                                        \
524
1.22k
  case OMPC_##Name:                                                            \
525
1.22k
    return true;
526
1.22k
#include "clang/Basic/OpenMPKinds.def"
527
1.22k
    default:
528
2
      break;
529
2
    }
530
2
    break;
531
1.40k
  case OMPD_target_enter_data:
532
1.40k
    switch (CKind) {
533
1.40k
#define OPENMP_TARGET_ENTER_DATA_CLAUSE(Name)                                  \
534
1.40k
  case OMPC_##Name:                                                            \
535
1.39k
    return true;
536
1.40k
#include "clang/Basic/OpenMPKinds.def"
537
1.40k
    default:
538
4
      break;
539
4
    }
540
4
    break;
541
1.35k
  case OMPD_target_exit_data:
542
1.35k
    switch (CKind) {
543
1.35k
#define OPENMP_TARGET_EXIT_DATA_CLAUSE(Name)                                   \
544
1.35k
  case OMPC_##Name:                                                            \
545
1.35k
    return true;
546
1.35k
#include "clang/Basic/OpenMPKinds.def"
547
1.35k
    default:
548
4
      break;
549
4
    }
550
4
    break;
551
2.44k
  case OMPD_target_parallel:
552
2.44k
    switch (CKind) {
553
2.44k
#define OPENMP_TARGET_PARALLEL_CLAUSE(Name)                                    \
554
2.44k
  case OMPC_##Name:                                                            \
555
2.43k
    return true;
556
2.44k
#include "clang/Basic/OpenMPKinds.def"
557
2.44k
    default:
558
2
      break;
559
2
    }
560
2
    break;
561
3.08k
  case OMPD_target_parallel_for:
562
3.08k
    switch (CKind) {
563
3.08k
#define OPENMP_TARGET_PARALLEL_FOR_CLAUSE(Name)                                \
564
3.08k
  case OMPC_##Name:                                                            \
565
3.07k
    return true;
566
3.08k
#include "clang/Basic/OpenMPKinds.def"
567
3.08k
    default:
568
6
      break;
569
6
    }
570
6
    break;
571
1.60k
  case OMPD_target_update:
572
1.60k
    switch (CKind) {
573
1.60k
#define OPENMP_TARGET_UPDATE_CLAUSE(Name)                                      \
574
1.60k
  case OMPC_##Name:                                                            \
575
1.60k
    return true;
576
1.60k
#include "clang/Basic/OpenMPKinds.def"
577
1.60k
    default:
578
2
      break;
579
2
    }
580
2
    break;
581
1.21k
  case OMPD_teams:
582
1.21k
    switch (CKind) {
583
1.21k
#define OPENMP_TEAMS_CLAUSE(Name)                                              \
584
1.21k
  case OMPC_##Name:                                                            \
585
1.21k
    return true;
586
1.21k
#include "clang/Basic/OpenMPKinds.def"
587
1.21k
    default:
588
0
      break;
589
0
    }
590
0
    break;
591
0
  case OMPD_declare_simd:
592
0
    break;
593
112
  case OMPD_cancel:
594
112
    switch (CKind) {
595
112
#define OPENMP_CANCEL_CLAUSE(Name)                                             \
596
112
  case OMPC_##Name:                                                            \
597
108
    return true;
598
112
#include "clang/Basic/OpenMPKinds.def"
599
112
    default:
600
4
      break;
601
4
    }
602
4
    break;
603
603
  case OMPD_ordered:
604
603
    switch (CKind) {
605
603
#define OPENMP_ORDERED_CLAUSE(Name)                                            \
606
603
  case OMPC_##Name:                                                            \
607
597
    return true;
608
603
#include "clang/Basic/OpenMPKinds.def"
609
603
    default:
610
6
      break;
611
6
    }
612
6
    break;
613
2.03k
  case OMPD_taskloop:
614
2.03k
    switch (CKind) {
615
2.03k
#define OPENMP_TASKLOOP_CLAUSE(Name)                                           \
616
2.03k
  case OMPC_##Name:                                                            \
617
2.02k
    return true;
618
2.03k
#include "clang/Basic/OpenMPKinds.def"
619
2.03k
    default:
620
8
      break;
621
8
    }
622
8
    break;
623
2.59k
  case OMPD_taskloop_simd:
624
2.59k
    switch (CKind) {
625
2.59k
#define OPENMP_TASKLOOP_SIMD_CLAUSE(Name)                                      \
626
2.59k
  case OMPC_##Name:                                                            \
627
2.59k
    return true;
628
2.59k
#include "clang/Basic/OpenMPKinds.def"
629
2.59k
    default:
630
0
      break;
631
0
    }
632
0
    break;
633
46
  case OMPD_critical:
634
46
    switch (CKind) {
635
46
#define OPENMP_CRITICAL_CLAUSE(Name)                                           \
636
46
  case OMPC_##Name:                                                            \
637
40
    return true;
638
46
#include "clang/Basic/OpenMPKinds.def"
639
46
    default:
640
6
      break;
641
6
    }
642
6
    break;
643
642
  case OMPD_distribute:
644
642
    switch (CKind) {
645
642
#define OPENMP_DISTRIBUTE_CLAUSE(Name)                                         \
646
642
  case OMPC_##Name:                                                            \
647
640
    return true;
648
642
#include "clang/Basic/OpenMPKinds.def"
649
642
    default:
650
2
      break;
651
2
    }
652
2
    break;
653
2.17k
  case OMPD_distribute_parallel_for:
654
2.17k
    switch (CKind) {
655
2.17k
#define OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name)                            \
656
2.17k
  case OMPC_##Name:                                                            \
657
2.16k
    return true;
658
2.17k
#include "clang/Basic/OpenMPKinds.def"
659
2.17k
    default:
660
10
      break;
661
10
    }
662
10
    break;
663
2.68k
  case OMPD_distribute_parallel_for_simd:
664
2.68k
    switch (CKind) {
665
2.68k
#define OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name)                       \
666
2.68k
  case OMPC_##Name:                                                            \
667
2.67k
    return true;
668
2.68k
#include "clang/Basic/OpenMPKinds.def"
669
2.68k
    default:
670
10
      break;
671
10
    }
672
10
    break;
673
2.04k
  case OMPD_distribute_simd:
674
2.04k
    switch (CKind) {
675
2.04k
#define OPENMP_DISTRIBUTE_SIMD_CLAUSE(Name)                                    \
676
2.04k
  case OMPC_##Name:                                                            \
677
2.03k
    return true;
678
2.04k
#include "clang/Basic/OpenMPKinds.def"
679
2.04k
    default:
680
6
      break;
681
6
    }
682
6
    break;
683
3.59k
  case OMPD_target_parallel_for_simd:
684
3.59k
    switch (CKind) {
685
3.59k
#define OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(Name)                           \
686
3.59k
  case OMPC_##Name:                                                            \
687
3.59k
    return true;
688
3.59k
#include "clang/Basic/OpenMPKinds.def"
689
3.59k
    default:
690
2
      break;
691
2
    }
692
2
    break;
693
2.88k
  case OMPD_target_simd:
694
2.88k
    switch (CKind) {
695
2.88k
#define OPENMP_TARGET_SIMD_CLAUSE(Name)                                        \
696
2.88k
  case OMPC_##Name:                                                            \
697
2.88k
    return true;
698
2.88k
#include "clang/Basic/OpenMPKinds.def"
699
2.88k
    default:
700
6
      break;
701
6
    }
702
6
    break;
703
1.46k
  case OMPD_teams_distribute:
704
1.46k
    switch (CKind) {
705
1.46k
#define OPENMP_TEAMS_DISTRIBUTE_CLAUSE(Name)                                   \
706
1.46k
  case OMPC_##Name:                                                            \
707
1.45k
    return true;
708
1.46k
#include "clang/Basic/OpenMPKinds.def"
709
1.46k
    default:
710
6
      break;
711
6
    }
712
6
    break;
713
2.00k
  case OMPD_teams_distribute_simd:
714
2.00k
    switch (CKind) {
715
2.00k
#define OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name)                              \
716
2.00k
  case OMPC_##Name:                                                            \
717
1.99k
    return true;
718
2.00k
#include "clang/Basic/OpenMPKinds.def"
719
2.00k
    default:
720
10
      break;
721
10
    }
722
10
    break;
723
2.41k
  case OMPD_teams_distribute_parallel_for_simd:
724
2.41k
    switch (CKind) {
725
2.41k
#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name)                 \
726
2.41k
  case OMPC_##Name:                                                            \
727
2.40k
    return true;
728
2.41k
#include "clang/Basic/OpenMPKinds.def"
729
2.41k
    default:
730
10
      break;
731
10
    }
732
10
    break;
733
1.87k
  case OMPD_teams_distribute_parallel_for:
734
1.87k
    switch (CKind) {
735
1.87k
#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name)                      \
736
1.87k
  case OMPC_##Name:                                                            \
737
1.86k
    return true;
738
1.87k
#include "clang/Basic/OpenMPKinds.def"
739
1.87k
    default:
740
10
      break;
741
10
    }
742
10
    break;
743
2.39k
  case OMPD_target_teams:
744
2.39k
    switch (CKind) {
745
2.39k
#define OPENMP_TARGET_TEAMS_CLAUSE(Name)                                       \
746
2.39k
  case OMPC_##Name:                                                            \
747
2.39k
    return true;
748
2.39k
#include "clang/Basic/OpenMPKinds.def"
749
2.39k
    default:
750
0
      break;
751
0
    }
752
0
    break;
753
2.40k
  case OMPD_target_teams_distribute:
754
2.40k
    switch (CKind) {
755
2.40k
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(Name)                            \
756
2.40k
  case OMPC_##Name:                                                            \
757
2.39k
    return true;
758
2.40k
#include "clang/Basic/OpenMPKinds.def"
759
2.40k
    default:
760
6
      break;
761
6
    }
762
6
    break;
763
3.04k
  case OMPD_target_teams_distribute_parallel_for:
764
3.04k
    switch (CKind) {
765
3.04k
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name)               \
766
3.04k
  case OMPC_##Name:                                                            \
767
3.03k
    return true;
768
3.04k
#include "clang/Basic/OpenMPKinds.def"
769
3.04k
    default:
770
8
      break;
771
8
    }
772
8
    break;
773
3.66k
  case OMPD_target_teams_distribute_parallel_for_simd:
774
3.66k
    switch (CKind) {
775
3.66k
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name)          \
776
3.66k
  case OMPC_##Name:                                                            \
777
3.66k
    return true;
778
3.66k
#include "clang/Basic/OpenMPKinds.def"
779
3.66k
    default:
780
6
      break;
781
6
    }
782
6
    break;
783
3.30k
  case OMPD_target_teams_distribute_simd:
784
3.30k
    switch (CKind) {
785
3.30k
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name)                       \
786
3.30k
  case OMPC_##Name:                                                            \
787
3.29k
    return true;
788
3.30k
#include "clang/Basic/OpenMPKinds.def"
789
3.30k
    default:
790
8
      break;
791
8
    }
792
8
    break;
793
1.04k
  case OMPD_taskgroup:
794
1.04k
    switch (CKind) {
795
1.04k
#define OPENMP_TASKGROUP_CLAUSE(Name)                                          \
796
1.04k
  case OMPC_##Name:                                                            \
797
1.04k
    return true;
798
1.04k
#include "clang/Basic/OpenMPKinds.def"
799
1.04k
    default:
800
0
      break;
801
0
    }
802
0
    break;
803
202
  case OMPD_declare_mapper:
804
202
    switch (CKind) {
805
202
#define OPENMP_DECLARE_MAPPER_CLAUSE(Name)                                     \
806
202
  case OMPC_##Name:                                                            \
807
192
    return true;
808
202
#include "clang/Basic/OpenMPKinds.def"
809
202
    default:
810
10
      break;
811
10
    }
812
10
    break;
813
214
  case OMPD_allocate:
814
214
    switch (CKind) {
815
214
#define OPENMP_ALLOCATE_CLAUSE(Name)                                           \
816
214
  case OMPC_##Name:                                                            \
817
212
    return true;
818
214
#include "clang/Basic/OpenMPKinds.def"
819
214
    default:
820
2
      break;
821
2
    }
822
2
    break;
823
32
  case OMPD_declare_target:
824
32
  case OMPD_end_declare_target:
825
32
  case OMPD_unknown:
826
32
  case OMPD_threadprivate:
827
32
  case OMPD_section:
828
32
  case OMPD_master:
829
32
  case OMPD_taskyield:
830
32
  case OMPD_barrier:
831
32
  case OMPD_taskwait:
832
32
  case OMPD_cancellation_point:
833
32
  case OMPD_declare_reduction:
834
32
    break;
835
302
  }
836
302
  return false;
837
302
}
838
839
1.15M
bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
840
1.15M
  return DKind == OMPD_simd || 
DKind == OMPD_for1.13M
||
DKind == OMPD_for_simd1.09M
||
841
1.15M
         
DKind == OMPD_parallel_for1.07M
||
DKind == OMPD_parallel_for_simd1.04M
||
842
1.15M
         
DKind == OMPD_taskloop1.02M
||
DKind == OMPD_taskloop_simd1.00M
||
843
1.15M
         
DKind == OMPD_distribute975k
||
DKind == OMPD_target_parallel_for958k
||
844
1.15M
         
DKind == OMPD_distribute_parallel_for903k
||
845
1.15M
         
DKind == OMPD_distribute_parallel_for_simd842k
||
846
1.15M
         
DKind == OMPD_distribute_simd757k
||
847
1.15M
         
DKind == OMPD_target_parallel_for_simd698k
||
DKind == OMPD_target_simd635k
||
848
1.15M
         
DKind == OMPD_teams_distribute593k
||
849
1.15M
         
DKind == OMPD_teams_distribute_simd563k
||
850
1.15M
         
DKind == OMPD_teams_distribute_parallel_for_simd521k
||
851
1.15M
         
DKind == OMPD_teams_distribute_parallel_for461k
||
852
1.15M
         
DKind == OMPD_target_teams_distribute417k
||
853
1.15M
         
DKind == OMPD_target_teams_distribute_parallel_for371k
||
854
1.15M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd313k
||
855
1.15M
         
DKind == OMPD_target_teams_distribute_simd232k
;
856
1.15M
}
857
858
1.05M
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
859
1.05M
  return DKind == OMPD_for || 
DKind == OMPD_for_simd1.00M
||
860
1.05M
         
DKind == OMPD_sections957k
||
DKind == OMPD_section953k
||
861
1.05M
         
DKind == OMPD_single953k
||
DKind == OMPD_parallel_for951k
||
862
1.05M
         
DKind == OMPD_parallel_for_simd910k
||
DKind == OMPD_parallel_sections863k
||
863
1.05M
         
DKind == OMPD_target_parallel_for861k
||
864
1.05M
         
DKind == OMPD_distribute_parallel_for799k
||
865
1.05M
         
DKind == OMPD_distribute_parallel_for_simd777k
||
866
1.05M
         
DKind == OMPD_target_parallel_for_simd748k
||
867
1.05M
         
DKind == OMPD_teams_distribute_parallel_for_simd681k
||
868
1.05M
         
DKind == OMPD_teams_distribute_parallel_for655k
||
869
1.05M
         
DKind == OMPD_target_teams_distribute_parallel_for634k
||
870
1.05M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd606k
;
871
1.05M
}
872
873
2.18M
bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
874
2.18M
  return DKind == OMPD_taskloop || 
DKind == OMPD_taskloop_simd2.13M
;
875
2.18M
}
876
877
4.12M
bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
878
4.12M
  return DKind == OMPD_parallel || 
DKind == OMPD_parallel_for3.91M
||
879
4.12M
         
DKind == OMPD_parallel_for_simd3.90M
||
DKind == OMPD_parallel_sections3.88M
||
880
4.12M
         
DKind == OMPD_target_parallel3.88M
||
DKind == OMPD_target_parallel_for3.86M
||
881
4.12M
         
DKind == OMPD_distribute_parallel_for3.83M
||
882
4.12M
         
DKind == OMPD_distribute_parallel_for_simd3.78M
||
883
4.12M
         
DKind == OMPD_target_parallel_for_simd3.69M
||
884
4.12M
         
DKind == OMPD_teams_distribute_parallel_for3.65M
||
885
4.12M
         
DKind == OMPD_teams_distribute_parallel_for_simd3.61M
||
886
4.12M
         
DKind == OMPD_target_teams_distribute_parallel_for3.56M
||
887
4.12M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd3.52M
;
888
4.12M
}
889
890
3.40M
bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
891
3.40M
  return DKind == OMPD_target || 
DKind == OMPD_target_parallel2.80M
||
892
3.40M
         
DKind == OMPD_target_parallel_for2.76M
||
893
3.40M
         
DKind == OMPD_target_parallel_for_simd2.67M
||
DKind == OMPD_target_simd2.56M
||
894
3.40M
         
DKind == OMPD_target_teams2.46M
||
DKind == OMPD_target_teams_distribute2.42M
||
895
3.40M
         
DKind == OMPD_target_teams_distribute_parallel_for2.34M
||
896
3.40M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd2.24M
||
897
3.40M
         
DKind == OMPD_target_teams_distribute_simd2.10M
;
898
3.40M
}
899
900
555k
bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
901
555k
  return DKind == OMPD_target_data || 
DKind == OMPD_target_enter_data550k
||
902
555k
         
DKind == OMPD_target_exit_data547k
||
DKind == OMPD_target_update544k
;
903
555k
}
904
905
3.58M
bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
906
3.58M
  return DKind == OMPD_teams || 
DKind == OMPD_teams_distribute3.29M
||
907
3.58M
         
DKind == OMPD_teams_distribute_simd3.26M
||
908
3.58M
         
DKind == OMPD_teams_distribute_parallel_for_simd3.22M
||
909
3.58M
         
DKind == OMPD_teams_distribute_parallel_for3.21M
;
910
3.58M
}
911
912
3.47M
bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
913
3.47M
  return isOpenMPNestingTeamsDirective(DKind) ||
914
3.47M
         
DKind == OMPD_target_teams3.12M
||
DKind == OMPD_target_teams_distribute3.10M
||
915
3.47M
         
DKind == OMPD_target_teams_distribute_parallel_for3.08M
||
916
3.47M
         
DKind == OMPD_target_teams_distribute_parallel_for_simd3.08M
||
917
3.47M
         
DKind == OMPD_target_teams_distribute_simd3.08M
;
918
3.47M
}
919
920
721k
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
921
721k
  return DKind == OMPD_simd || 
DKind == OMPD_for_simd708k
||
922
721k
         
DKind == OMPD_parallel_for_simd686k
||
DKind == OMPD_taskloop_simd665k
||
923
721k
         
DKind == OMPD_distribute_parallel_for_simd653k
||
924
721k
         
DKind == OMPD_distribute_simd617k
||
DKind == OMPD_target_simd598k
||
925
721k
         
DKind == OMPD_teams_distribute_simd577k
||
926
721k
         
DKind == OMPD_teams_distribute_parallel_for_simd561k
||
927
721k
         
DKind == OMPD_target_teams_distribute_parallel_for_simd532k
||
928
721k
         
DKind == OMPD_target_teams_distribute_simd483k
||
929
721k
         
DKind == OMPD_target_parallel_for_simd451k
;
930
721k
}
931
932
398k
bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
933
398k
  return Kind == OMPD_distribute || 
Kind == OMPD_distribute_parallel_for381k
||
934
398k
         
Kind == OMPD_distribute_parallel_for_simd378k
||
935
398k
         
Kind == OMPD_distribute_simd374k
;
936
398k
  // TODO add next directives.
937
398k
}
938
939
361k
bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
940
361k
  return isOpenMPNestingDistributeDirective(Kind) ||
941
361k
         
Kind == OMPD_teams_distribute304k
||
Kind == OMPD_teams_distribute_simd274k
||
942
361k
         
Kind == OMPD_teams_distribute_parallel_for_simd237k
||
943
361k
         
Kind == OMPD_teams_distribute_parallel_for235k
||
944
361k
         
Kind == OMPD_target_teams_distribute235k
||
945
361k
         
Kind == OMPD_target_teams_distribute_parallel_for186k
||
946
361k
         
Kind == OMPD_target_teams_distribute_parallel_for_simd185k
||
947
361k
         
Kind == OMPD_target_teams_distribute_simd182k
;
948
361k
}
949
950
359k
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
951
359k
  return Kind == OMPC_private || 
Kind == OMPC_firstprivate342k
||
952
359k
         
Kind == OMPC_lastprivate289k
||
Kind == OMPC_linear274k
||
953
359k
         
Kind == OMPC_reduction252k
||
Kind == OMPC_task_reduction214k
||
954
359k
         
Kind == OMPC_in_reduction212k
; // TODO add next clauses like 'reduction'.
955
359k
}
956
957
989k
bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
958
989k
  return Kind == OMPC_threadprivate || 
Kind == OMPC_copyin983k
;
959
989k
}
960
961
2.79M
bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
962
2.79M
  return Kind == OMPD_task || 
isOpenMPTaskLoopDirective(Kind)1.76M
;
963
2.79M
}
964
965
964k
bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
966
964k
  return Kind == OMPD_distribute_parallel_for ||
967
964k
         
Kind == OMPD_distribute_parallel_for_simd923k
||
968
964k
         
Kind == OMPD_teams_distribute_parallel_for_simd872k
||
969
964k
         
Kind == OMPD_teams_distribute_parallel_for825k
||
970
964k
         
Kind == OMPD_target_teams_distribute_parallel_for787k
||
971
964k
         
Kind == OMPD_target_teams_distribute_parallel_for_simd731k
;
972
964k
}
973
974
void clang::getOpenMPCaptureRegions(
975
    SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
976
818k
    OpenMPDirectiveKind DKind) {
977
818k
  assert(DKind <= OMPD_unknown);
978
818k
  switch (DKind) {
979
818k
  case OMPD_parallel:
980
128k
  case OMPD_parallel_for:
981
128k
  case OMPD_parallel_for_simd:
982
128k
  case OMPD_parallel_sections:
983
128k
  case OMPD_distribute_parallel_for:
984
128k
  case OMPD_distribute_parallel_for_simd:
985
128k
    CaptureRegions.push_back(OMPD_parallel);
986
128k
    break;
987
128k
  case OMPD_target_teams:
988
72.6k
  case OMPD_target_teams_distribute:
989
72.6k
  case OMPD_target_teams_distribute_simd:
990
72.6k
    CaptureRegions.push_back(OMPD_task);
991
72.6k
    CaptureRegions.push_back(OMPD_target);
992
72.6k
    CaptureRegions.push_back(OMPD_teams);
993
72.6k
    break;
994
90.2k
  case OMPD_teams:
995
90.2k
  case OMPD_teams_distribute:
996
90.2k
  case OMPD_teams_distribute_simd:
997
90.2k
    CaptureRegions.push_back(OMPD_teams);
998
90.2k
    break;
999
200k
  case OMPD_target:
1000
200k
  case OMPD_target_simd:
1001
200k
    CaptureRegions.push_back(OMPD_task);
1002
200k
    CaptureRegions.push_back(OMPD_target);
1003
200k
    break;
1004
200k
  case OMPD_teams_distribute_parallel_for:
1005
39.0k
  case OMPD_teams_distribute_parallel_for_simd:
1006
39.0k
    CaptureRegions.push_back(OMPD_teams);
1007
39.0k
    CaptureRegions.push_back(OMPD_parallel);
1008
39.0k
    break;
1009
76.8k
  case OMPD_target_parallel:
1010
76.8k
  case OMPD_target_parallel_for:
1011
76.8k
  case OMPD_target_parallel_for_simd:
1012
76.8k
    CaptureRegions.push_back(OMPD_task);
1013
76.8k
    CaptureRegions.push_back(OMPD_target);
1014
76.8k
    CaptureRegions.push_back(OMPD_parallel);
1015
76.8k
    break;
1016
76.8k
  case OMPD_task:
1017
17.6k
  case OMPD_target_enter_data:
1018
17.6k
  case OMPD_target_exit_data:
1019
17.6k
  case OMPD_target_update:
1020
17.6k
    CaptureRegions.push_back(OMPD_task);
1021
17.6k
    break;
1022
22.7k
  case OMPD_taskloop:
1023
22.7k
  case OMPD_taskloop_simd:
1024
22.7k
    CaptureRegions.push_back(OMPD_taskloop);
1025
22.7k
    break;
1026
59.2k
  case OMPD_target_teams_distribute_parallel_for:
1027
59.2k
  case OMPD_target_teams_distribute_parallel_for_simd:
1028
59.2k
    CaptureRegions.push_back(OMPD_task);
1029
59.2k
    CaptureRegions.push_back(OMPD_target);
1030
59.2k
    CaptureRegions.push_back(OMPD_teams);
1031
59.2k
    CaptureRegions.push_back(OMPD_parallel);
1032
59.2k
    break;
1033
110k
  case OMPD_simd:
1034
110k
  case OMPD_for:
1035
110k
  case OMPD_for_simd:
1036
110k
  case OMPD_sections:
1037
110k
  case OMPD_section:
1038
110k
  case OMPD_single:
1039
110k
  case OMPD_master:
1040
110k
  case OMPD_critical:
1041
110k
  case OMPD_taskgroup:
1042
110k
  case OMPD_distribute:
1043
110k
  case OMPD_ordered:
1044
110k
  case OMPD_atomic:
1045
110k
  case OMPD_target_data:
1046
110k
  case OMPD_distribute_simd:
1047
110k
    CaptureRegions.push_back(OMPD_unknown);
1048
110k
    break;
1049
110k
  case OMPD_threadprivate:
1050
0
  case OMPD_allocate:
1051
0
  case OMPD_taskyield:
1052
0
  case OMPD_barrier:
1053
0
  case OMPD_taskwait:
1054
0
  case OMPD_cancellation_point:
1055
0
  case OMPD_cancel:
1056
0
  case OMPD_flush:
1057
0
  case OMPD_declare_reduction:
1058
0
  case OMPD_declare_mapper:
1059
0
  case OMPD_declare_simd:
1060
0
  case OMPD_declare_target:
1061
0
  case OMPD_end_declare_target:
1062
0
  case OMPD_requires:
1063
0
    llvm_unreachable("OpenMP Directive is not allowed");
1064
0
  case OMPD_unknown:
1065
0
    llvm_unreachable("Unknown OpenMP directive");
1066
818k
  }
1067
818k
}