Coverage Report

Created: 2020-09-22 08:39

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/OpenMPKinds.cpp
Line
Count
Source (jump to first uncovered line)
1
//===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
/// \file
9
/// This file implements the OpenMP enum and support functions.
10
///
11
//===----------------------------------------------------------------------===//
12
13
#include "clang/Basic/OpenMPKinds.h"
14
#include "clang/Basic/IdentifierTable.h"
15
#include "llvm/ADT/StringRef.h"
16
#include "llvm/ADT/StringSwitch.h"
17
#include "llvm/Support/ErrorHandling.h"
18
#include <cassert>
19
20
using namespace clang;
21
using namespace llvm::omp;
22
23
unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, StringRef Str,
24
34.4k
                                          unsigned OpenMPVersion) {
25
34.4k
  switch (Kind) {
26
1.68k
  case OMPC_default:
27
1.68k
    return llvm::StringSwitch<unsigned>(Str)
28
6.74k
#define OMP_DEFAULT_KIND(Enum, Name) .Case(Name, unsigned(Enum))
29
1.68k
#include "llvm/Frontend/OpenMP/OMPKinds.def"
30
1.68k
        .Default(unsigned(llvm::omp::OMP_DEFAULT_unknown));
31
622
  case OMPC_proc_bind:
32
622
    return llvm::StringSwitch<unsigned>(Str)
33
3.11k
#define OMP_PROC_BIND_KIND(Enum, Name, Value) .Case(Name, Value)
34
622
#include "llvm/Frontend/OpenMP/OMPKinds.def"
35
622
        .Default(unsigned(llvm::omp::OMP_PROC_BIND_unknown));
36
3.03k
  case OMPC_schedule:
37
3.03k
    return llvm::StringSwitch<unsigned>(Str)
38
3.03k
#define OPENMP_SCHEDULE_KIND(Name)                                             \
39
15.1k
  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
40
3.03k
#define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
41
9.11k
  .Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
42
3.03k
#include "clang/Basic/OpenMPKinds.def"
43
3.03k
        .Default(OMPC_SCHEDULE_unknown);
44
4.20k
  case OMPC_depend:
45
4.20k
    return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
46
29.4k
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
47
4.20k
#include "clang/Basic/OpenMPKinds.def"
48
4.20k
        .Default(OMPC_DEPEND_unknown);
49
298
  case OMPC_linear:
50
298
    return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
51
894
#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
52
298
#include "clang/Basic/OpenMPKinds.def"
53
298
        .Default(OMPC_LINEAR_unknown);
54
16.7k
  case OMPC_map: {
55
16.7k
    unsigned Type = llvm::StringSwitch<unsigned>(Str)
56
16.7k
#define OPENMP_MAP_KIND(Name)                                                  \
57
100k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
58
16.7k
#define OPENMP_MAP_MODIFIER_KIND(Name)                                         \
59
67.0k
  .Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
60
16.7k
#include "clang/Basic/OpenMPKinds.def"
61
16.7k
        .Default(OMPC_MAP_unknown);
62
16.7k
    if (OpenMPVersion < 51 && 
Type == OMPC_MAP_MODIFIER_present14.7k
)
63
160
      return OMPC_MAP_MODIFIER_unknown;
64
16.5k
    return Type;
65
16.5k
  }
66
2.40k
  case OMPC_to:
67
2.40k
  case OMPC_from: {
68
2.40k
    unsigned Type = llvm::StringSwitch<unsigned>(Str)
69
2.40k
#define OPENMP_MOTION_MODIFIER_KIND(Name)                                      \
70
4.80k
  .Case(#Name, static_cast<unsigned>(OMPC_MOTION_MODIFIER_##Name))
71
2.40k
#include "clang/Basic/OpenMPKinds.def"
72
2.40k
        .Default(OMPC_MOTION_MODIFIER_unknown);
73
2.40k
    if (OpenMPVersion < 51 && 
Type == OMPC_MOTION_MODIFIER_present2.19k
)
74
36
      return OMPC_MOTION_MODIFIER_unknown;
75
2.36k
    return Type;
76
2.36k
  }
77
1.52k
  case OMPC_dist_schedule:
78
1.52k
    return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
79
1.52k
#define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
80
1.52k
#include "clang/Basic/OpenMPKinds.def"
81
1.52k
        .Default(OMPC_DIST_SCHEDULE_unknown);
82
2.81k
  case OMPC_defaultmap:
83
2.81k
    return llvm::StringSwitch<unsigned>(Str)
84
2.81k
#define OPENMP_DEFAULTMAP_KIND(Name)                                           \
85
8.45k
  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
86
2.81k
#define OPENMP_DEFAULTMAP_MODIFIER(Name)                                       \
87
19.7k
  .Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
88
2.81k
#include "clang/Basic/OpenMPKinds.def"
89
2.81k
        .Default(OMPC_DEFAULTMAP_unknown);
90
39
  case OMPC_atomic_default_mem_order:
91
39
     return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
92
39
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)       \
93
117
  .Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
94
39
#include "clang/Basic/OpenMPKinds.def"
95
39
        .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
96
74
  case OMPC_device_type:
97
74
    return llvm::StringSwitch<OpenMPDeviceType>(Str)
98
222
#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
99
74
#include "clang/Basic/OpenMPKinds.def"
100
74
        .Default(OMPC_DEVICE_TYPE_unknown);
101
92
  case OMPC_lastprivate:
102
92
    return llvm::StringSwitch<OpenMPLastprivateModifier>(Str)
103
92
#define OPENMP_LASTPRIVATE_KIND(Name) .Case(#Name, OMPC_LASTPRIVATE_##Name)
104
92
#include "clang/Basic/OpenMPKinds.def"
105
92
        .Default(OMPC_LASTPRIVATE_unknown);
106
375
  case OMPC_order:
107
375
    return llvm::StringSwitch<OpenMPOrderClauseKind>(Str)
108
375
#define OPENMP_ORDER_KIND(Name) .Case(#Name, OMPC_ORDER_##Name)
109
375
#include "clang/Basic/OpenMPKinds.def"
110
375
        .Default(OMPC_ORDER_unknown);
111
32
  case OMPC_update:
112
32
    return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
113
224
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
114
32
#include "clang/Basic/OpenMPKinds.def"
115
32
        .Default(OMPC_DEPEND_unknown);
116
22
  case OMPC_device:
117
22
    return llvm::StringSwitch<OpenMPDeviceClauseModifier>(Str)
118
44
#define OPENMP_DEVICE_MODIFIER(Name) .Case(#Name, OMPC_DEVICE_##Name)
119
22
#include "clang/Basic/OpenMPKinds.def"
120
22
        .Default(OMPC_DEVICE_unknown);
121
446
  case OMPC_reduction:
122
446
    return llvm::StringSwitch<OpenMPReductionClauseModifier>(Str)
123
1.33k
#define OPENMP_REDUCTION_MODIFIER(Name) .Case(#Name, OMPC_REDUCTION_##Name)
124
446
#include "clang/Basic/OpenMPKinds.def"
125
446
        .Default(OMPC_REDUCTION_unknown);
126
0
  case OMPC_unknown:
127
0
  case OMPC_threadprivate:
128
0
  case OMPC_if:
129
0
  case OMPC_final:
130
0
  case OMPC_num_threads:
131
0
  case OMPC_safelen:
132
0
  case OMPC_simdlen:
133
0
  case OMPC_allocator:
134
0
  case OMPC_allocate:
135
0
  case OMPC_collapse:
136
0
  case OMPC_private:
137
0
  case OMPC_firstprivate:
138
0
  case OMPC_shared:
139
0
  case OMPC_task_reduction:
140
0
  case OMPC_in_reduction:
141
0
  case OMPC_aligned:
142
0
  case OMPC_copyin:
143
0
  case OMPC_copyprivate:
144
0
  case OMPC_ordered:
145
0
  case OMPC_nowait:
146
0
  case OMPC_untied:
147
0
  case OMPC_mergeable:
148
0
  case OMPC_flush:
149
0
  case OMPC_depobj:
150
0
  case OMPC_read:
151
0
  case OMPC_write:
152
0
  case OMPC_capture:
153
0
  case OMPC_seq_cst:
154
0
  case OMPC_acq_rel:
155
0
  case OMPC_acquire:
156
0
  case OMPC_release:
157
0
  case OMPC_relaxed:
158
0
  case OMPC_threads:
159
0
  case OMPC_simd:
160
0
  case OMPC_num_teams:
161
0
  case OMPC_thread_limit:
162
0
  case OMPC_priority:
163
0
  case OMPC_grainsize:
164
0
  case OMPC_nogroup:
165
0
  case OMPC_num_tasks:
166
0
  case OMPC_hint:
167
0
  case OMPC_uniform:
168
0
  case OMPC_use_device_ptr:
169
0
  case OMPC_use_device_addr:
170
0
  case OMPC_is_device_ptr:
171
0
  case OMPC_unified_address:
172
0
  case OMPC_unified_shared_memory:
173
0
  case OMPC_reverse_offload:
174
0
  case OMPC_dynamic_allocators:
175
0
  case OMPC_match:
176
0
  case OMPC_nontemporal:
177
0
  case OMPC_destroy:
178
0
  case OMPC_detach:
179
0
  case OMPC_inclusive:
180
0
  case OMPC_exclusive:
181
0
  case OMPC_uses_allocators:
182
0
  case OMPC_affinity:
183
0
    break;
184
0
  default:
185
0
    break;
186
0
  }
187
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
188
0
}
189
190
const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
191
13.3k
                                                 unsigned Type) {
192
13.3k
  switch (Kind) {
193
1.49k
  case OMPC_default:
194
1.49k
    switch (llvm::omp::DefaultKind(Type)) {
195
0
#define OMP_DEFAULT_KIND(Enum, Name)                                           \
196
1.49k
  case Enum:                                                                   \
197
1.49k
    return Name;
198
0
#include "llvm/Frontend/OpenMP/OMPKinds.def"
199
1.49k
    }
200
1.49k
    
llvm_unreachable0
("Invalid OpenMP 'default' clause type");
201
556
  case OMPC_proc_bind:
202
556
    switch (Type) {
203
0
#define OMP_PROC_BIND_KIND(Enum, Name, Value)                                  \
204
556
  case Value:                                                                  \
205
556
    return Name;
206
0
#include "llvm/Frontend/OpenMP/OMPKinds.def"
207
556
    }
208
556
    
llvm_unreachable0
("Invalid OpenMP 'proc_bind' clause type");
209
1.77k
  case OMPC_schedule:
210
1.77k
    switch (Type) {
211
0
    case OMPC_SCHEDULE_unknown:
212
0
    case OMPC_SCHEDULE_MODIFIER_last:
213
0
      return "unknown";
214
0
#define OPENMP_SCHEDULE_KIND(Name)                                             \
215
1.17k
    case OMPC_SCHEDULE_##Name:                                                 \
216
1.17k
      return #Name;
217
0
#define OPENMP_SCHEDULE_MODIFIER(Name)                                         \
218
600
    case OMPC_SCHEDULE_MODIFIER_##Name:                                        \
219
600
      return #Name;
220
0
#include "clang/Basic/OpenMPKinds.def"
221
1.77k
    }
222
1.77k
    
llvm_unreachable0
("Invalid OpenMP 'schedule' clause type");
223
2.50k
  case OMPC_depend:
224
2.50k
    switch (Type) {
225
0
    case OMPC_DEPEND_unknown:
226
0
      return "unknown";
227
0
#define OPENMP_DEPEND_KIND(Name)                                             \
228
2.50k
  case OMPC_DEPEND_##Name:                                                   \
229
2.50k
    return #Name;
230
0
#include "clang/Basic/OpenMPKinds.def"
231
2.50k
    }
232
2.50k
    
llvm_unreachable0
("Invalid OpenMP 'depend' clause type");
233
128
  case OMPC_linear:
234
128
    switch (Type) {
235
0
    case OMPC_LINEAR_unknown:
236
0
      return "unknown";
237
0
#define OPENMP_LINEAR_KIND(Name)                                             \
238
128
  case OMPC_LINEAR_##Name:                                                   \
239
128
    return #Name;
240
0
#include "clang/Basic/OpenMPKinds.def"
241
128
    }
242
128
    
llvm_unreachable0
("Invalid OpenMP 'linear' clause type");
243
4.15k
  case OMPC_map:
244
4.15k
    switch (Type) {
245
0
    case OMPC_MAP_unknown:
246
0
    case OMPC_MAP_MODIFIER_last:
247
0
      return "unknown";
248
0
#define OPENMP_MAP_KIND(Name)                                                \
249
3.50k
  case OMPC_MAP_##Name:                                                      \
250
3.50k
    return #Name;
251
0
#define OPENMP_MAP_MODIFIER_KIND(Name)                                       \
252
644
  case OMPC_MAP_MODIFIER_##Name:                                             \
253
644
    return #Name;
254
0
#include "clang/Basic/OpenMPKinds.def"
255
0
    default:
256
0
      break;
257
0
    }
258
0
    llvm_unreachable("Invalid OpenMP 'map' clause type");
259
124
  case OMPC_to:
260
124
  case OMPC_from:
261
124
    switch (Type) {
262
0
    case OMPC_MOTION_MODIFIER_unknown:
263
0
      return "unknown";
264
0
#define OPENMP_MOTION_MODIFIER_KIND(Name)                                      \
265
124
  case OMPC_MOTION_MODIFIER_##Name:                                            \
266
124
    return #Name;
267
0
#include "clang/Basic/OpenMPKinds.def"
268
0
    default:
269
0
      break;
270
0
    }
271
0
    llvm_unreachable("Invalid OpenMP 'to' or 'from' clause type");
272
416
  case OMPC_dist_schedule:
273
416
    switch (Type) {
274
0
    case OMPC_DIST_SCHEDULE_unknown:
275
0
      return "unknown";
276
0
#define OPENMP_DIST_SCHEDULE_KIND(Name)                                      \
277
416
  case OMPC_DIST_SCHEDULE_##Name:                                            \
278
416
    return #Name;
279
0
#include "clang/Basic/OpenMPKinds.def"
280
416
    }
281
416
    
llvm_unreachable0
("Invalid OpenMP 'dist_schedule' clause type");
282
1.76k
  case OMPC_defaultmap:
283
1.76k
    switch (Type) {
284
0
    case OMPC_DEFAULTMAP_unknown:
285
0
    case OMPC_DEFAULTMAP_MODIFIER_last:
286
0
      return "unknown";
287
0
#define OPENMP_DEFAULTMAP_KIND(Name)                                         \
288
920
    case OMPC_DEFAULTMAP_##Name:                                             \
289
920
      return #Name;
290
0
#define OPENMP_DEFAULTMAP_MODIFIER(Name)                                     \
291
844
    case OMPC_DEFAULTMAP_MODIFIER_##Name:                                    \
292
844
      return #Name;
293
0
#include "clang/Basic/OpenMPKinds.def"
294
1.76k
    }
295
1.76k
    
llvm_unreachable0
("Invalid OpenMP 'schedule' clause type");
296
24
  case OMPC_atomic_default_mem_order:
297
24
    switch (Type) {
298
0
    case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
299
0
      return "unknown";
300
0
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)                           \
301
24
    case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name:                               \
302
24
      return #Name;
303
0
#include "clang/Basic/OpenMPKinds.def"
304
24
}
305
24
    
llvm_unreachable0
("Invalid OpenMP 'atomic_default_mem_order' clause type");
306
28
  case OMPC_device_type:
307
28
    switch (Type) {
308
0
    case OMPC_DEVICE_TYPE_unknown:
309
0
      return "unknown";
310
0
#define OPENMP_DEVICE_TYPE_KIND(Name)                                          \
311
28
    case OMPC_DEVICE_TYPE_##Name:                                              \
312
28
      return #Name;
313
0
#include "clang/Basic/OpenMPKinds.def"
314
28
    }
315
28
    
llvm_unreachable0
("Invalid OpenMP 'device_type' clause type");
316
44
  case OMPC_lastprivate:
317
44
    switch (Type) {
318
0
    case OMPC_LASTPRIVATE_unknown:
319
0
      return "unknown";
320
0
#define OPENMP_LASTPRIVATE_KIND(Name)                                          \
321
44
    case OMPC_LASTPRIVATE_##Name:                                              \
322
44
      return #Name;
323
0
#include "clang/Basic/OpenMPKinds.def"
324
44
    }
325
44
    
llvm_unreachable0
("Invalid OpenMP 'lastprivate' clause type");
326
174
  case OMPC_order:
327
174
    switch (Type) {
328
0
    case OMPC_ORDER_unknown:
329
0
      return "unknown";
330
0
#define OPENMP_ORDER_KIND(Name)                                                \
331
174
    case OMPC_ORDER_##Name:                                                    \
332
174
      return #Name;
333
0
#include "clang/Basic/OpenMPKinds.def"
334
174
    }
335
174
    
llvm_unreachable0
("Invalid OpenMP 'order' clause type");
336
12
  case OMPC_update:
337
12
    switch (Type) {
338
0
    case OMPC_DEPEND_unknown:
339
0
      return "unknown";
340
0
#define OPENMP_DEPEND_KIND(Name)                                               \
341
12
  case OMPC_DEPEND_##Name:                                                     \
342
12
    return #Name;
343
0
#include "clang/Basic/OpenMPKinds.def"
344
12
    }
345
12
    
llvm_unreachable0
("Invalid OpenMP 'depend' clause type");
346
28
  case OMPC_device:
347
28
    switch (Type) {
348
0
    case OMPC_DEVICE_unknown:
349
0
      return "unknown";
350
0
#define OPENMP_DEVICE_MODIFIER(Name)                                           \
351
28
  case OMPC_DEVICE_##Name:                                                     \
352
28
    return #Name;
353
0
#include "clang/Basic/OpenMPKinds.def"
354
28
    }
355
28
    
llvm_unreachable0
("Invalid OpenMP 'device' clause modifier");
356
115
  case OMPC_reduction:
357
115
    switch (Type) {
358
0
    case OMPC_REDUCTION_unknown:
359
0
      return "unknown";
360
0
#define OPENMP_REDUCTION_MODIFIER(Name)                                        \
361
115
  case OMPC_REDUCTION_##Name:                                                  \
362
115
    return #Name;
363
0
#include "clang/Basic/OpenMPKinds.def"
364
115
    }
365
115
    
llvm_unreachable0
("Invalid OpenMP 'reduction' clause modifier");
366
0
  case OMPC_unknown:
367
0
  case OMPC_threadprivate:
368
0
  case OMPC_if:
369
0
  case OMPC_final:
370
0
  case OMPC_num_threads:
371
0
  case OMPC_safelen:
372
0
  case OMPC_simdlen:
373
0
  case OMPC_allocator:
374
0
  case OMPC_allocate:
375
0
  case OMPC_collapse:
376
0
  case OMPC_private:
377
0
  case OMPC_firstprivate:
378
0
  case OMPC_shared:
379
0
  case OMPC_task_reduction:
380
0
  case OMPC_in_reduction:
381
0
  case OMPC_aligned:
382
0
  case OMPC_copyin:
383
0
  case OMPC_copyprivate:
384
0
  case OMPC_ordered:
385
0
  case OMPC_nowait:
386
0
  case OMPC_untied:
387
0
  case OMPC_mergeable:
388
0
  case OMPC_flush:
389
0
  case OMPC_depobj:
390
0
  case OMPC_read:
391
0
  case OMPC_write:
392
0
  case OMPC_capture:
393
0
  case OMPC_seq_cst:
394
0
  case OMPC_acq_rel:
395
0
  case OMPC_acquire:
396
0
  case OMPC_release:
397
0
  case OMPC_relaxed:
398
0
  case OMPC_threads:
399
0
  case OMPC_simd:
400
0
  case OMPC_num_teams:
401
0
  case OMPC_thread_limit:
402
0
  case OMPC_priority:
403
0
  case OMPC_grainsize:
404
0
  case OMPC_nogroup:
405
0
  case OMPC_num_tasks:
406
0
  case OMPC_hint:
407
0
  case OMPC_uniform:
408
0
  case OMPC_use_device_ptr:
409
0
  case OMPC_use_device_addr:
410
0
  case OMPC_is_device_ptr:
411
0
  case OMPC_unified_address:
412
0
  case OMPC_unified_shared_memory:
413
0
  case OMPC_reverse_offload:
414
0
  case OMPC_dynamic_allocators:
415
0
  case OMPC_match:
416
0
  case OMPC_nontemporal:
417
0
  case OMPC_destroy:
418
0
  case OMPC_detach:
419
0
  case OMPC_inclusive:
420
0
  case OMPC_exclusive:
421
0
  case OMPC_uses_allocators:
422
0
  case OMPC_affinity:
423
0
    break;
424
0
  default:
425
0
    break;
426
0
  }
427
0
  llvm_unreachable("Invalid OpenMP simple clause kind");
428
0
}
429
430
4.91M
bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
431
4.91M
  return DKind == OMPD_simd || 
DKind == OMPD_for4.82M
||
DKind == OMPD_for_simd4.68M
||
432
4.58M
         DKind == OMPD_parallel_for || 
DKind == OMPD_parallel_for_simd4.50M
||
433
4.41M
         DKind == OMPD_taskloop || 
DKind == OMPD_taskloop_simd4.33M
||
434
4.25M
         DKind == OMPD_master_taskloop || 
DKind == OMPD_master_taskloop_simd4.19M
||
435
4.10M
         DKind == OMPD_parallel_master_taskloop ||
436
4.03M
         DKind == OMPD_parallel_master_taskloop_simd ||
437
3.93M
         DKind == OMPD_distribute || 
DKind == OMPD_target_parallel_for3.88M
||
438
3.66M
         DKind == OMPD_distribute_parallel_for ||
439
3.43M
         DKind == OMPD_distribute_parallel_for_simd ||
440
3.09M
         DKind == OMPD_distribute_simd ||
441
2.82M
         DKind == OMPD_target_parallel_for_simd || 
DKind == OMPD_target_simd2.53M
||
442
2.33M
         DKind == OMPD_teams_distribute ||
443
2.20M
         DKind == OMPD_teams_distribute_simd ||
444
2.02M
         DKind == OMPD_teams_distribute_parallel_for_simd ||
445
1.77M
         DKind == OMPD_teams_distribute_parallel_for ||
446
1.59M
         DKind == OMPD_target_teams_distribute ||
447
1.39M
         DKind == OMPD_target_teams_distribute_parallel_for ||
448
1.17M
         DKind == OMPD_target_teams_distribute_parallel_for_simd ||
449
792k
         DKind == OMPD_target_teams_distribute_simd;
450
4.91M
}
451
452
4.66M
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
453
4.66M
  return DKind == OMPD_for || 
DKind == OMPD_for_simd4.46M
||
454
4.30M
         DKind == OMPD_sections || 
DKind == OMPD_section4.29M
||
455
4.29M
         DKind == OMPD_single || 
DKind == OMPD_parallel_for4.28M
||
456
4.17M
         DKind == OMPD_parallel_for_simd || 
DKind == OMPD_parallel_sections4.04M
||
457
4.03M
         DKind == OMPD_target_parallel_for ||
458
3.84M
         DKind == OMPD_distribute_parallel_for ||
459
3.77M
         DKind == OMPD_distribute_parallel_for_simd ||
460
3.68M
         DKind == OMPD_target_parallel_for_simd ||
461
3.49M
         DKind == OMPD_teams_distribute_parallel_for_simd ||
462
3.40M
         DKind == OMPD_teams_distribute_parallel_for ||
463
3.33M
         DKind == OMPD_target_teams_distribute_parallel_for ||
464
3.22M
         DKind == OMPD_target_teams_distribute_parallel_for_simd;
465
4.66M
}
466
467
9.64M
bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
468
9.64M
  return DKind == OMPD_taskloop || 
DKind == OMPD_taskloop_simd9.27M
||
469
9.06M
         DKind == OMPD_master_taskloop || 
DKind == OMPD_master_taskloop_simd8.91M
||
470
8.70M
         DKind == OMPD_parallel_master_taskloop ||
471
8.57M
         DKind == OMPD_parallel_master_taskloop_simd;
472
9.64M
}
473
474
11.8M
bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
475
11.8M
  return DKind == OMPD_parallel || 
DKind == OMPD_parallel_for11.1M
||
476
11.0M
         DKind == OMPD_parallel_for_simd || 
DKind == OMPD_parallel_sections11.0M
||
477
10.9M
         DKind == OMPD_target_parallel || 
DKind == OMPD_target_parallel_for10.8M
||
478
10.7M
         DKind == OMPD_distribute_parallel_for ||
479
10.6M
         DKind == OMPD_distribute_parallel_for_simd ||
480
10.4M
         DKind == OMPD_target_parallel_for_simd ||
481
10.2M
         DKind == OMPD_teams_distribute_parallel_for ||
482
10.1M
         DKind == OMPD_teams_distribute_parallel_for_simd ||
483
10.0M
         DKind == OMPD_target_teams_distribute_parallel_for ||
484
9.82M
         DKind == OMPD_target_teams_distribute_parallel_for_simd ||
485
9.49M
         DKind == OMPD_parallel_master ||
486
9.48M
         DKind == OMPD_parallel_master_taskloop ||
487
9.41M
         DKind == OMPD_parallel_master_taskloop_simd;
488
11.8M
}
489
490
10.0M
bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
491
10.0M
  return DKind == OMPD_target || 
DKind == OMPD_target_parallel8.41M
||
492
8.25M
         DKind == OMPD_target_parallel_for ||
493
7.98M
         DKind == OMPD_target_parallel_for_simd || 
DKind == OMPD_target_simd7.63M
||
494
7.33M
         DKind == OMPD_target_teams || 
DKind == OMPD_target_teams_distribute7.18M
||
495
6.94M
         DKind == OMPD_target_teams_distribute_parallel_for ||
496
6.65M
         DKind == OMPD_target_teams_distribute_parallel_for_simd ||
497
6.17M
         DKind == OMPD_target_teams_distribute_simd;
498
10.0M
}
499
500
1.01M
bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
501
1.01M
  return DKind == OMPD_target_data || 
DKind == OMPD_target_enter_data1.00M
||
502
997k
         DKind == OMPD_target_exit_data || 
DKind == OMPD_target_update991k
;
503
1.01M
}
504
505
8.13M
bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
506
8.13M
  return DKind == OMPD_teams || 
DKind == OMPD_teams_distribute7.70M
||
507
7.66M
         DKind == OMPD_teams_distribute_simd ||
508
7.60M
         DKind == OMPD_teams_distribute_parallel_for_simd ||
509
7.59M
         DKind == OMPD_teams_distribute_parallel_for;
510
8.13M
}
511
512
7.92M
bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
513
7.92M
  return isOpenMPNestingTeamsDirective(DKind) ||
514
7.41M
         DKind == OMPD_target_teams || 
DKind == OMPD_target_teams_distribute7.38M
||
515
7.33M
         DKind == OMPD_target_teams_distribute_parallel_for ||
516
7.32M
         DKind == OMPD_target_teams_distribute_parallel_for_simd ||
517
7.32M
         DKind == OMPD_target_teams_distribute_simd;
518
7.92M
}
519
520
2.73M
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
521
2.73M
  return DKind == OMPD_simd || 
DKind == OMPD_for_simd2.71M
||
522
2.64M
         DKind == OMPD_parallel_for_simd || 
DKind == OMPD_taskloop_simd2.57M
||
523
2.55M
         DKind == OMPD_master_taskloop_simd ||
524
2.53M
         DKind == OMPD_parallel_master_taskloop_simd ||
525
2.47M
         DKind == OMPD_distribute_parallel_for_simd ||
526
2.36M
         DKind == OMPD_distribute_simd || 
DKind == OMPD_target_simd2.32M
||
527
2.26M
         DKind == OMPD_teams_distribute_simd ||
528
2.23M
         DKind == OMPD_teams_distribute_parallel_for_simd ||
529
2.12M
         DKind == OMPD_target_teams_distribute_parallel_for_simd ||
530
1.78M
         DKind == OMPD_target_teams_distribute_simd ||
531
1.69M
         DKind == OMPD_target_parallel_for_simd;
532
2.73M
}
533
534
1.01M
bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
535
1.01M
  return Kind == OMPD_distribute || 
Kind == OMPD_distribute_parallel_for978k
||
536
973k
         Kind == OMPD_distribute_parallel_for_simd ||
537
967k
         Kind == OMPD_distribute_simd;
538
  // TODO add next directives.
539
1.01M
}
540
541
949k
bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
542
949k
  return isOpenMPNestingDistributeDirective(Kind) ||
543
799k
         Kind == OMPD_teams_distribute || 
Kind == OMPD_teams_distribute_simd710k
||
544
607k
         Kind == OMPD_teams_distribute_parallel_for_simd ||
545
605k
         Kind == OMPD_teams_distribute_parallel_for ||
546
603k
         Kind == OMPD_target_teams_distribute ||
547
451k
         Kind == OMPD_target_teams_distribute_parallel_for ||
548
449k
         Kind == OMPD_target_teams_distribute_parallel_for_simd ||
549
444k
         Kind == OMPD_target_teams_distribute_simd;
550
949k
}
551
552
635k
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
553
635k
  return Kind == OMPC_private || 
Kind == OMPC_firstprivate606k
||
554
523k
         Kind == OMPC_lastprivate || 
Kind == OMPC_linear494k
||
555
449k
         Kind == OMPC_reduction || 
Kind == OMPC_task_reduction362k
||
556
359k
         Kind == OMPC_in_reduction; // TODO add next clauses like 'reduction'.
557
635k
}
558
559
2.92M
bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
560
2.92M
  return Kind == OMPC_threadprivate || 
Kind == OMPC_copyin2.90M
;
561
2.92M
}
562
563
10.3M
bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
564
10.3M
  return Kind == OMPD_task || 
isOpenMPTaskLoopDirective(Kind)7.92M
;
565
10.3M
}
566
567
2.51M
bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
568
2.51M
  return Kind == OMPD_distribute_parallel_for ||
569
2.37M
         Kind == OMPD_distribute_parallel_for_simd ||
570
2.21M
         Kind == OMPD_teams_distribute_parallel_for_simd ||
571
2.06M
         Kind == OMPD_teams_distribute_parallel_for ||
572
1.93M
         Kind == OMPD_target_teams_distribute_parallel_for ||
573
1.72M
         Kind == OMPD_target_teams_distribute_parallel_for_simd;
574
2.51M
}
575
576
void clang::getOpenMPCaptureRegions(
577
    SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
578
3.01M
    OpenMPDirectiveKind DKind) {
579
3.01M
  assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
580
3.01M
  switch (DKind) {
581
345k
  case OMPD_parallel:
582
345k
  case OMPD_parallel_for:
583
345k
  case OMPD_parallel_for_simd:
584
345k
  case OMPD_parallel_master:
585
345k
  case OMPD_parallel_sections:
586
345k
  case OMPD_distribute_parallel_for:
587
345k
  case OMPD_distribute_parallel_for_simd:
588
345k
    CaptureRegions.push_back(OMPD_parallel);
589
345k
    break;
590
289k
  case OMPD_target_teams:
591
289k
  case OMPD_target_teams_distribute:
592
289k
  case OMPD_target_teams_distribute_simd:
593
289k
    CaptureRegions.push_back(OMPD_task);
594
289k
    CaptureRegions.push_back(OMPD_target);
595
289k
    CaptureRegions.push_back(OMPD_teams);
596
289k
    break;
597
259k
  case OMPD_teams:
598
259k
  case OMPD_teams_distribute:
599
259k
  case OMPD_teams_distribute_simd:
600
259k
    CaptureRegions.push_back(OMPD_teams);
601
259k
    break;
602
725k
  case OMPD_target:
603
725k
  case OMPD_target_simd:
604
725k
    CaptureRegions.push_back(OMPD_task);
605
725k
    CaptureRegions.push_back(OMPD_target);
606
725k
    break;
607
114k
  case OMPD_teams_distribute_parallel_for:
608
114k
  case OMPD_teams_distribute_parallel_for_simd:
609
114k
    CaptureRegions.push_back(OMPD_teams);
610
114k
    CaptureRegions.push_back(OMPD_parallel);
611
114k
    break;
612
290k
  case OMPD_target_parallel:
613
290k
  case OMPD_target_parallel_for:
614
290k
  case OMPD_target_parallel_for_simd:
615
290k
    CaptureRegions.push_back(OMPD_task);
616
290k
    CaptureRegions.push_back(OMPD_target);
617
290k
    CaptureRegions.push_back(OMPD_parallel);
618
290k
    break;
619
125k
  case OMPD_task:
620
125k
  case OMPD_target_enter_data:
621
125k
  case OMPD_target_exit_data:
622
125k
  case OMPD_target_update:
623
125k
    CaptureRegions.push_back(OMPD_task);
624
125k
    break;
625
205k
  case OMPD_taskloop:
626
205k
  case OMPD_taskloop_simd:
627
205k
  case OMPD_master_taskloop:
628
205k
  case OMPD_master_taskloop_simd:
629
205k
    CaptureRegions.push_back(OMPD_taskloop);
630
205k
    break;
631
152k
  case OMPD_parallel_master_taskloop:
632
152k
  case OMPD_parallel_master_taskloop_simd:
633
152k
    CaptureRegions.push_back(OMPD_parallel);
634
152k
    CaptureRegions.push_back(OMPD_taskloop);
635
152k
    break;
636
271k
  case OMPD_target_teams_distribute_parallel_for:
637
271k
  case OMPD_target_teams_distribute_parallel_for_simd:
638
271k
    CaptureRegions.push_back(OMPD_task);
639
271k
    CaptureRegions.push_back(OMPD_target);
640
271k
    CaptureRegions.push_back(OMPD_teams);
641
271k
    CaptureRegions.push_back(OMPD_parallel);
642
271k
    break;
643
239k
  case OMPD_simd:
644
239k
  case OMPD_for:
645
239k
  case OMPD_for_simd:
646
239k
  case OMPD_sections:
647
239k
  case OMPD_section:
648
239k
  case OMPD_single:
649
239k
  case OMPD_master:
650
239k
  case OMPD_critical:
651
239k
  case OMPD_taskgroup:
652
239k
  case OMPD_distribute:
653
239k
  case OMPD_ordered:
654
239k
  case OMPD_atomic:
655
239k
  case OMPD_target_data:
656
239k
  case OMPD_distribute_simd:
657
239k
    CaptureRegions.push_back(OMPD_unknown);
658
239k
    break;
659
0
  case OMPD_threadprivate:
660
0
  case OMPD_allocate:
661
0
  case OMPD_taskyield:
662
0
  case OMPD_barrier:
663
0
  case OMPD_taskwait:
664
0
  case OMPD_cancellation_point:
665
0
  case OMPD_cancel:
666
0
  case OMPD_flush:
667
0
  case OMPD_depobj:
668
0
  case OMPD_scan:
669
0
  case OMPD_declare_reduction:
670
0
  case OMPD_declare_mapper:
671
0
  case OMPD_declare_simd:
672
0
  case OMPD_declare_target:
673
0
  case OMPD_end_declare_target:
674
0
  case OMPD_requires:
675
0
  case OMPD_declare_variant:
676
0
  case OMPD_begin_declare_variant:
677
0
  case OMPD_end_declare_variant:
678
0
    llvm_unreachable("OpenMP Directive is not allowed");
679
0
  case OMPD_unknown:
680
0
  default:
681
0
    llvm_unreachable("Unknown OpenMP directive");
682
3.01M
  }
683
3.01M
}