2013-03-22 14:34:35 +08:00
|
|
|
//===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-03-22 14:34:35 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// \file
|
2018-05-09 09:00:01 +08:00
|
|
|
/// This file implements the OpenMP enum and support functions.
|
2013-03-22 14:34:35 +08:00
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/Basic/OpenMPKinds.h"
|
|
|
|
#include "clang/Basic/IdentifierTable.h"
|
2013-03-26 05:32:02 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2013-03-22 14:34:35 +08:00
|
|
|
#include "llvm/ADT/StringSwitch.h"
|
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
using namespace clang;
|
[OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.h
Summary:
The new OpenMPConstants.h is a location for all OpenMP related constants
(and helpers) to live.
This patch moves the directives there (the enum OpenMPDirectiveKind) and
rewires Clang to use the new location.
Initially part of D69785.
Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim
Subscribers: jholewinski, ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D69853
2019-11-05 12:00:49 +08:00
|
|
|
using namespace llvm::omp;
|
2013-03-22 14:34:35 +08:00
|
|
|
|
2013-07-19 11:13:43 +08:00
|
|
|
OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) {
|
2014-07-29 17:17:39 +08:00
|
|
|
// 'flush' clause cannot be specified explicitly, because this is an implicit
|
|
|
|
// clause for 'flush' directive. If the 'flush' clause is explicitly specified
|
|
|
|
// the Parser should generate a warning about extra tokens at the end of the
|
|
|
|
// directive.
|
2020-02-28 22:52:15 +08:00
|
|
|
// 'depobj' clause cannot be specified explicitly, because this is an implicit
|
|
|
|
// clause for 'depobj' directive. If the 'depobj' clause is explicitly
|
|
|
|
// specified the Parser should generate a warning about extra tokens at the
|
|
|
|
// end of the directive.
|
|
|
|
if (llvm::StringSwitch<bool>(Str)
|
|
|
|
.Case("flush", true)
|
|
|
|
.Case("depobj", true)
|
|
|
|
.Default(false))
|
2014-07-21 19:26:11 +08:00
|
|
|
return OMPC_unknown;
|
2013-07-19 11:13:43 +08:00
|
|
|
return llvm::StringSwitch<OpenMPClauseKind>(Str)
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name)
|
2013-07-19 11:13:43 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
2016-04-12 13:28:34 +08:00
|
|
|
.Case("uniform", OMPC_uniform)
|
2019-08-24 00:11:14 +08:00
|
|
|
.Case("device_type", OMPC_device_type)
|
2019-09-24 02:13:31 +08:00
|
|
|
.Case("match", OMPC_match)
|
2014-06-18 15:08:49 +08:00
|
|
|
.Default(OMPC_unknown);
|
2013-07-19 11:13:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) {
|
2014-05-12 12:23:46 +08:00
|
|
|
assert(Kind <= OMPC_unknown);
|
2013-07-19 11:13:43 +08:00
|
|
|
switch (Kind) {
|
|
|
|
case OMPC_unknown:
|
|
|
|
return "unknown";
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_CLAUSE(Name, Class) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return #Name;
|
2013-07-19 11:13:43 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
2016-04-12 13:28:34 +08:00
|
|
|
case OMPC_uniform:
|
|
|
|
return "uniform";
|
2013-07-19 11:13:43 +08:00
|
|
|
case OMPC_threadprivate:
|
|
|
|
return "threadprivate or thread local";
|
2019-08-24 00:11:14 +08:00
|
|
|
case OMPC_device_type:
|
|
|
|
return "device_type";
|
2019-09-24 02:13:31 +08:00
|
|
|
case OMPC_match:
|
|
|
|
return "match";
|
2013-07-19 11:13:43 +08:00
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP clause kind");
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
|
|
|
|
StringRef Str) {
|
|
|
|
switch (Kind) {
|
|
|
|
case OMPC_default:
|
2020-02-15 11:45:49 +08:00
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OMP_DEFAULT_KIND(Enum, Name) .Case(Name, unsigned(Enum))
|
|
|
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
|
|
|
.Default(unsigned(llvm::omp::OMP_DEFAULT_unknown));
|
2014-05-06 14:04:14 +08:00
|
|
|
case OMPC_proc_bind:
|
2019-12-26 08:15:36 +08:00
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OMP_PROC_BIND_KIND(Enum, Name, Value) .Case(Name, Value)
|
|
|
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
|
|
|
.Default(unsigned(llvm::omp::OMP_PROC_BIND_unknown));
|
2014-06-20 15:16:17 +08:00
|
|
|
case OMPC_schedule:
|
2015-12-28 15:25:51 +08:00
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_SCHEDULE_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
|
|
|
|
#define OPENMP_SCHEDULE_MODIFIER(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
|
2014-06-20 15:16:17 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_SCHEDULE_unknown);
|
2015-06-23 22:25:19 +08:00
|
|
|
case OMPC_depend:
|
|
|
|
return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
|
|
|
|
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DEPEND_unknown);
|
2015-08-20 18:54:39 +08:00
|
|
|
case OMPC_linear:
|
|
|
|
return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
|
|
|
|
#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_LINEAR_unknown);
|
2015-11-23 13:32:03 +08:00
|
|
|
case OMPC_map:
|
2018-12-19 06:18:41 +08:00
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_MAP_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
|
|
|
|
#define OPENMP_MAP_MODIFIER_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
|
2015-11-23 13:32:03 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_MAP_unknown);
|
2019-02-23 06:29:42 +08:00
|
|
|
case OMPC_to:
|
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_TO_MODIFIER_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_TO_MODIFIER_##Name))
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_TO_MODIFIER_unknown);
|
2019-02-26 04:34:15 +08:00
|
|
|
case OMPC_from:
|
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_FROM_MODIFIER_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_FROM_MODIFIER_##Name))
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_FROM_MODIFIER_unknown);
|
2016-01-16 02:50:31 +08:00
|
|
|
case OMPC_dist_schedule:
|
|
|
|
return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
|
|
|
|
#define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DIST_SCHEDULE_unknown);
|
2016-01-27 00:37:23 +08:00
|
|
|
case OMPC_defaultmap:
|
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_DEFAULTMAP_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
|
|
|
|
#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DEFAULTMAP_unknown);
|
2018-11-02 20:18:11 +08:00
|
|
|
case OMPC_atomic_default_mem_order:
|
|
|
|
return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
|
|
|
|
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
|
|
|
|
.Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
|
2019-08-24 00:11:14 +08:00
|
|
|
case OMPC_device_type:
|
|
|
|
return llvm::StringSwitch<OpenMPDeviceType>(Str)
|
|
|
|
#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DEVICE_TYPE_unknown);
|
2019-12-21 00:04:57 +08:00
|
|
|
case OMPC_lastprivate:
|
|
|
|
return llvm::StringSwitch<OpenMPLastprivateModifier>(Str)
|
|
|
|
#define OPENMP_LASTPRIVATE_KIND(Name) .Case(#Name, OMPC_LASTPRIVATE_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_LASTPRIVATE_unknown);
|
2020-02-01 05:09:26 +08:00
|
|
|
case OMPC_order:
|
|
|
|
return llvm::StringSwitch<OpenMPOrderClauseKind>(Str)
|
|
|
|
#define OPENMP_ORDER_KIND(Name) .Case(#Name, OMPC_ORDER_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_ORDER_unknown);
|
2013-07-19 11:13:43 +08:00
|
|
|
case OMPC_unknown:
|
|
|
|
case OMPC_threadprivate:
|
2014-02-13 13:29:23 +08:00
|
|
|
case OMPC_if:
|
2014-07-17 15:32:53 +08:00
|
|
|
case OMPC_final:
|
2014-03-06 14:15:19 +08:00
|
|
|
case OMPC_num_threads:
|
2014-03-21 12:51:18 +08:00
|
|
|
case OMPC_safelen:
|
2015-08-21 19:14:16 +08:00
|
|
|
case OMPC_simdlen:
|
2019-03-13 02:52:33 +08:00
|
|
|
case OMPC_allocator:
|
2019-03-27 22:14:31 +08:00
|
|
|
case OMPC_allocate:
|
2014-05-27 23:12:19 +08:00
|
|
|
case OMPC_collapse:
|
2013-07-19 11:13:43 +08:00
|
|
|
case OMPC_private:
|
2013-10-01 13:32:34 +08:00
|
|
|
case OMPC_firstprivate:
|
2013-09-07 04:58:25 +08:00
|
|
|
case OMPC_shared:
|
2014-06-16 15:08:35 +08:00
|
|
|
case OMPC_reduction:
|
2017-07-19 04:17:46 +08:00
|
|
|
case OMPC_task_reduction:
|
2017-07-22 02:48:21 +08:00
|
|
|
case OMPC_in_reduction:
|
2014-05-29 22:36:25 +08:00
|
|
|
case OMPC_aligned:
|
2014-03-31 11:36:38 +08:00
|
|
|
case OMPC_copyin:
|
2014-06-27 18:37:06 +08:00
|
|
|
case OMPC_copyprivate:
|
2014-06-20 17:44:06 +08:00
|
|
|
case OMPC_ordered:
|
2014-06-20 19:19:47 +08:00
|
|
|
case OMPC_nowait:
|
2014-07-17 20:19:31 +08:00
|
|
|
case OMPC_untied:
|
2014-07-17 20:47:03 +08:00
|
|
|
case OMPC_mergeable:
|
2014-07-21 19:26:11 +08:00
|
|
|
case OMPC_flush:
|
2020-02-28 22:52:15 +08:00
|
|
|
case OMPC_depobj:
|
2014-07-23 10:27:21 +08:00
|
|
|
case OMPC_read:
|
2014-07-23 15:46:59 +08:00
|
|
|
case OMPC_write:
|
2014-07-23 18:25:33 +08:00
|
|
|
case OMPC_update:
|
2014-07-24 14:46:57 +08:00
|
|
|
case OMPC_capture:
|
2014-07-24 16:55:34 +08:00
|
|
|
case OMPC_seq_cst:
|
2020-02-07 05:30:23 +08:00
|
|
|
case OMPC_acq_rel:
|
2020-02-11 03:30:39 +08:00
|
|
|
case OMPC_acquire:
|
2020-02-11 04:49:05 +08:00
|
|
|
case OMPC_release:
|
2020-02-12 00:10:43 +08:00
|
|
|
case OMPC_relaxed:
|
2015-08-08 00:16:36 +08:00
|
|
|
case OMPC_device:
|
2015-09-25 18:37:12 +08:00
|
|
|
case OMPC_threads:
|
2015-09-28 14:39:35 +08:00
|
|
|
case OMPC_simd:
|
2015-11-25 04:50:12 +08:00
|
|
|
case OMPC_num_teams:
|
2015-11-28 02:47:36 +08:00
|
|
|
case OMPC_thread_limit:
|
2015-12-01 18:17:31 +08:00
|
|
|
case OMPC_priority:
|
2015-12-07 20:52:51 +08:00
|
|
|
case OMPC_grainsize:
|
2015-12-07 18:51:44 +08:00
|
|
|
case OMPC_nogroup:
|
2015-12-08 20:06:20 +08:00
|
|
|
case OMPC_num_tasks:
|
2015-12-15 16:19:24 +08:00
|
|
|
case OMPC_hint:
|
2016-04-12 13:28:34 +08:00
|
|
|
case OMPC_uniform:
|
2016-07-13 23:37:16 +08:00
|
|
|
case OMPC_use_device_ptr:
|
2016-07-14 01:16:49 +08:00
|
|
|
case OMPC_is_device_ptr:
|
2018-09-26 12:28:39 +08:00
|
|
|
case OMPC_unified_address:
|
2018-10-01 21:47:43 +08:00
|
|
|
case OMPC_unified_shared_memory:
|
2018-10-04 04:07:58 +08:00
|
|
|
case OMPC_reverse_offload:
|
2018-10-11 22:41:10 +08:00
|
|
|
case OMPC_dynamic_allocators:
|
2019-09-24 02:13:31 +08:00
|
|
|
case OMPC_match:
|
2019-12-17 04:54:17 +08:00
|
|
|
case OMPC_nontemporal:
|
2020-03-03 03:21:20 +08:00
|
|
|
case OMPC_destroy:
|
2013-07-19 11:13:43 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP simple clause kind");
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
|
|
|
|
unsigned Type) {
|
|
|
|
switch (Kind) {
|
|
|
|
case OMPC_default:
|
2020-02-15 11:45:49 +08:00
|
|
|
switch (llvm::omp::DefaultKind(Type)) {
|
|
|
|
#define OMP_DEFAULT_KIND(Enum, Name) \
|
|
|
|
case Enum: \
|
|
|
|
return Name;
|
|
|
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
2013-07-19 11:13:43 +08:00
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'default' clause type");
|
2014-05-06 14:04:14 +08:00
|
|
|
case OMPC_proc_bind:
|
|
|
|
switch (Type) {
|
2019-12-26 08:15:36 +08:00
|
|
|
#define OMP_PROC_BIND_KIND(Enum, Name, Value) \
|
|
|
|
case Value: \
|
|
|
|
return Name;
|
|
|
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
2014-05-06 14:04:14 +08:00
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'proc_bind' clause type");
|
2014-06-20 15:16:17 +08:00
|
|
|
case OMPC_schedule:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_SCHEDULE_unknown:
|
2015-12-28 15:25:51 +08:00
|
|
|
case OMPC_SCHEDULE_MODIFIER_last:
|
2014-06-20 15:16:17 +08:00
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_SCHEDULE_KIND(Name) \
|
2015-12-28 15:25:51 +08:00
|
|
|
case OMPC_SCHEDULE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#define OPENMP_SCHEDULE_MODIFIER(Name) \
|
|
|
|
case OMPC_SCHEDULE_MODIFIER_##Name: \
|
|
|
|
return #Name;
|
2015-06-23 22:25:19 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
2015-12-28 15:25:51 +08:00
|
|
|
llvm_unreachable("Invalid OpenMP 'schedule' clause type");
|
2015-06-23 22:25:19 +08:00
|
|
|
case OMPC_depend:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DEPEND_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DEPEND_KIND(Name) \
|
|
|
|
case OMPC_DEPEND_##Name: \
|
|
|
|
return #Name;
|
2014-06-20 15:16:17 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
2015-12-28 15:25:51 +08:00
|
|
|
llvm_unreachable("Invalid OpenMP 'depend' clause type");
|
2015-08-20 18:54:39 +08:00
|
|
|
case OMPC_linear:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_LINEAR_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_LINEAR_KIND(Name) \
|
|
|
|
case OMPC_LINEAR_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'linear' clause type");
|
2015-11-23 13:32:03 +08:00
|
|
|
case OMPC_map:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_MAP_unknown:
|
2018-12-19 06:18:41 +08:00
|
|
|
case OMPC_MAP_MODIFIER_last:
|
2015-11-23 13:32:03 +08:00
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_MAP_KIND(Name) \
|
|
|
|
case OMPC_MAP_##Name: \
|
|
|
|
return #Name;
|
2018-12-19 06:18:41 +08:00
|
|
|
#define OPENMP_MAP_MODIFIER_KIND(Name) \
|
|
|
|
case OMPC_MAP_MODIFIER_##Name: \
|
|
|
|
return #Name;
|
2015-11-23 13:32:03 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'map' clause type");
|
2019-02-23 06:29:42 +08:00
|
|
|
case OMPC_to:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_TO_MODIFIER_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_TO_MODIFIER_KIND(Name) \
|
|
|
|
case OMPC_TO_MODIFIER_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'to' clause type");
|
2019-02-26 04:34:15 +08:00
|
|
|
case OMPC_from:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_FROM_MODIFIER_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_FROM_MODIFIER_KIND(Name) \
|
|
|
|
case OMPC_FROM_MODIFIER_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'from' clause type");
|
2016-01-16 02:50:31 +08:00
|
|
|
case OMPC_dist_schedule:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DIST_SCHEDULE_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DIST_SCHEDULE_KIND(Name) \
|
|
|
|
case OMPC_DIST_SCHEDULE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'dist_schedule' clause type");
|
2016-01-27 00:37:23 +08:00
|
|
|
case OMPC_defaultmap:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DEFAULTMAP_unknown:
|
|
|
|
case OMPC_DEFAULTMAP_MODIFIER_last:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DEFAULTMAP_KIND(Name) \
|
|
|
|
case OMPC_DEFAULTMAP_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
|
|
|
|
case OMPC_DEFAULTMAP_MODIFIER_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'schedule' clause type");
|
2018-11-02 20:18:11 +08:00
|
|
|
case OMPC_atomic_default_mem_order:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
|
|
|
|
case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type");
|
2019-08-24 00:11:14 +08:00
|
|
|
case OMPC_device_type:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DEVICE_TYPE_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DEVICE_TYPE_KIND(Name) \
|
|
|
|
case OMPC_DEVICE_TYPE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'device_type' clause type");
|
2019-12-21 00:04:57 +08:00
|
|
|
case OMPC_lastprivate:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_LASTPRIVATE_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_LASTPRIVATE_KIND(Name) \
|
|
|
|
case OMPC_LASTPRIVATE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'lastprivate' clause type");
|
2020-02-01 05:09:26 +08:00
|
|
|
case OMPC_order:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_ORDER_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_ORDER_KIND(Name) \
|
|
|
|
case OMPC_ORDER_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'order' clause type");
|
2013-07-19 11:13:43 +08:00
|
|
|
case OMPC_unknown:
|
|
|
|
case OMPC_threadprivate:
|
2014-02-13 13:29:23 +08:00
|
|
|
case OMPC_if:
|
2014-07-17 15:32:53 +08:00
|
|
|
case OMPC_final:
|
2014-03-06 14:15:19 +08:00
|
|
|
case OMPC_num_threads:
|
2014-03-21 12:51:18 +08:00
|
|
|
case OMPC_safelen:
|
2015-08-21 19:14:16 +08:00
|
|
|
case OMPC_simdlen:
|
2019-03-13 02:52:33 +08:00
|
|
|
case OMPC_allocator:
|
2019-03-27 22:14:31 +08:00
|
|
|
case OMPC_allocate:
|
2014-05-27 23:12:19 +08:00
|
|
|
case OMPC_collapse:
|
2013-07-19 11:13:43 +08:00
|
|
|
case OMPC_private:
|
2013-10-01 13:32:34 +08:00
|
|
|
case OMPC_firstprivate:
|
2013-09-07 04:58:25 +08:00
|
|
|
case OMPC_shared:
|
2014-06-16 15:08:35 +08:00
|
|
|
case OMPC_reduction:
|
2017-07-19 04:17:46 +08:00
|
|
|
case OMPC_task_reduction:
|
2017-07-22 02:48:21 +08:00
|
|
|
case OMPC_in_reduction:
|
2014-05-29 22:36:25 +08:00
|
|
|
case OMPC_aligned:
|
2014-03-31 11:36:38 +08:00
|
|
|
case OMPC_copyin:
|
2014-06-27 18:37:06 +08:00
|
|
|
case OMPC_copyprivate:
|
2014-06-20 17:44:06 +08:00
|
|
|
case OMPC_ordered:
|
2014-06-20 19:19:47 +08:00
|
|
|
case OMPC_nowait:
|
2014-07-17 20:19:31 +08:00
|
|
|
case OMPC_untied:
|
2014-07-17 20:47:03 +08:00
|
|
|
case OMPC_mergeable:
|
2014-07-21 19:26:11 +08:00
|
|
|
case OMPC_flush:
|
2020-02-28 22:52:15 +08:00
|
|
|
case OMPC_depobj:
|
2014-07-23 10:27:21 +08:00
|
|
|
case OMPC_read:
|
2014-07-23 15:46:59 +08:00
|
|
|
case OMPC_write:
|
2014-07-23 18:25:33 +08:00
|
|
|
case OMPC_update:
|
2014-07-24 14:46:57 +08:00
|
|
|
case OMPC_capture:
|
2014-07-24 16:55:34 +08:00
|
|
|
case OMPC_seq_cst:
|
2020-02-07 05:30:23 +08:00
|
|
|
case OMPC_acq_rel:
|
2020-02-11 03:30:39 +08:00
|
|
|
case OMPC_acquire:
|
2020-02-11 04:49:05 +08:00
|
|
|
case OMPC_release:
|
2020-02-12 00:10:43 +08:00
|
|
|
case OMPC_relaxed:
|
2015-08-08 00:16:36 +08:00
|
|
|
case OMPC_device:
|
2015-09-25 18:37:12 +08:00
|
|
|
case OMPC_threads:
|
2015-09-28 14:39:35 +08:00
|
|
|
case OMPC_simd:
|
2015-11-25 04:50:12 +08:00
|
|
|
case OMPC_num_teams:
|
2015-11-28 02:47:36 +08:00
|
|
|
case OMPC_thread_limit:
|
2015-12-01 18:17:31 +08:00
|
|
|
case OMPC_priority:
|
2015-12-07 20:52:51 +08:00
|
|
|
case OMPC_grainsize:
|
2015-12-07 18:51:44 +08:00
|
|
|
case OMPC_nogroup:
|
2015-12-08 20:06:20 +08:00
|
|
|
case OMPC_num_tasks:
|
2015-12-15 16:19:24 +08:00
|
|
|
case OMPC_hint:
|
2016-04-12 13:28:34 +08:00
|
|
|
case OMPC_uniform:
|
2016-07-13 23:37:16 +08:00
|
|
|
case OMPC_use_device_ptr:
|
2016-07-14 01:16:49 +08:00
|
|
|
case OMPC_is_device_ptr:
|
2018-09-26 12:28:39 +08:00
|
|
|
case OMPC_unified_address:
|
2018-10-01 21:47:43 +08:00
|
|
|
case OMPC_unified_shared_memory:
|
2018-10-04 04:07:58 +08:00
|
|
|
case OMPC_reverse_offload:
|
2018-10-11 22:41:10 +08:00
|
|
|
case OMPC_dynamic_allocators:
|
2019-09-24 02:13:31 +08:00
|
|
|
case OMPC_match:
|
2019-12-17 04:54:17 +08:00
|
|
|
case OMPC_nontemporal:
|
2020-03-03 03:21:20 +08:00
|
|
|
case OMPC_destroy:
|
2013-07-19 11:13:43 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP simple clause kind");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
|
2019-11-20 01:07:54 +08:00
|
|
|
OpenMPClauseKind CKind,
|
|
|
|
unsigned OpenMPVersion) {
|
[OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.h
Summary:
The new OpenMPConstants.h is a location for all OpenMP related constants
(and helpers) to live.
This patch moves the directives there (the enum OpenMPDirectiveKind) and
rewires Clang to use the new location.
Initially part of D69785.
Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim
Subscribers: jholewinski, ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D69853
2019-11-05 12:00:49 +08:00
|
|
|
assert(unsigned(DKind) <= unsigned(OMPD_unknown));
|
2014-05-12 12:23:46 +08:00
|
|
|
assert(CKind <= OMPC_unknown);
|
2019-12-17 04:54:17 +08:00
|
|
|
// Nontemporal clause is not supported in OpenMP < 5.0.
|
|
|
|
if (OpenMPVersion < 50 && CKind == OMPC_nontemporal)
|
|
|
|
return false;
|
2020-02-01 05:09:26 +08:00
|
|
|
// Order clause is not supported in OpenMP < 5.0.
|
|
|
|
if (OpenMPVersion < 50 && CKind == OMPC_order)
|
|
|
|
return false;
|
2013-07-19 11:13:43 +08:00
|
|
|
switch (DKind) {
|
|
|
|
case OMPD_parallel:
|
|
|
|
switch (CKind) {
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_PARALLEL_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-02-27 16:29:12 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_simd:
|
2019-11-20 01:07:54 +08:00
|
|
|
if (OpenMPVersion < 50 && CKind == OMPC_if)
|
|
|
|
return false;
|
2014-02-27 16:29:12 +08:00
|
|
|
switch (CKind) {
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-06-18 12:14:57 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_for:
|
|
|
|
switch (CKind) {
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_FOR_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-09-18 13:12:34 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_for_simd:
|
2019-11-21 04:59:03 +08:00
|
|
|
if (OpenMPVersion < 50 && CKind == OMPC_if)
|
|
|
|
return false;
|
2014-09-18 13:12:34 +08:00
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_FOR_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-06-25 19:44:49 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_sections:
|
|
|
|
switch (CKind) {
|
2014-06-27 18:37:06 +08:00
|
|
|
#define OPENMP_SECTIONS_CLAUSE(Name) \
|
2014-06-25 19:44:49 +08:00
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-06-26 20:05:45 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_single:
|
|
|
|
switch (CKind) {
|
2014-06-27 18:37:06 +08:00
|
|
|
#define OPENMP_SINGLE_CLAUSE(Name) \
|
2014-06-26 20:05:45 +08:00
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-07-07 21:01:15 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_parallel_for:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_PARALLEL_FOR_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-09-23 17:33:00 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_parallel_for_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2019-12-06 02:43:48 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_parallel_master:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_PARALLEL_MASTER_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-07-08 16:12:03 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_parallel_sections:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-07-11 19:25:16 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_task:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TASK_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2013-07-19 11:13:43 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2014-07-21 19:26:11 +08:00
|
|
|
case OMPD_flush:
|
2020-02-07 05:30:23 +08:00
|
|
|
if (CKind == OMPC_flush)
|
|
|
|
return true;
|
|
|
|
if (OpenMPVersion < 50)
|
|
|
|
return false;
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_FLUSH_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-07-21 19:26:11 +08:00
|
|
|
break;
|
2020-02-28 22:52:15 +08:00
|
|
|
case OMPD_depobj:
|
|
|
|
if (OpenMPVersion < 50)
|
|
|
|
return false;
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_DEPOBJ_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
case OMPC_depobj:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2014-07-22 18:10:35 +08:00
|
|
|
case OMPD_atomic:
|
2020-02-14 01:55:41 +08:00
|
|
|
if (OpenMPVersion < 50 &&
|
|
|
|
(CKind == OMPC_acq_rel || CKind == OMPC_acquire ||
|
|
|
|
CKind == OMPC_release || CKind == OMPC_relaxed || CKind == OMPC_hint))
|
2020-02-07 05:30:23 +08:00
|
|
|
return false;
|
2014-07-22 18:10:35 +08:00
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_ATOMIC_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-09-19 16:19:49 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2018-09-26 12:28:39 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_requires:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_REQUIRES_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2015-07-21 21:44:28 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_data:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_DATA_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-01-20 03:15:56 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_enter_data:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_ENTER_DATA_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-01-20 04:04:50 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_exit_data:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_EXIT_DATA_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-01-27 02:48:41 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_parallel:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_PARALLEL_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-02-03 23:46:42 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_parallel_for:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_PARALLEL_FOR_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-05-27 01:30:50 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_update:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_UPDATE_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-10-09 12:18:56 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_teams:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TEAMS_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2015-09-18 16:07:34 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_cancel:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_CANCEL_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2015-09-25 18:37:12 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_ordered:
|
|
|
|
switch (CKind) {
|
2015-12-03 17:40:15 +08:00
|
|
|
#define OPENMP_ORDERED_CLAUSE(Name) \
|
2015-09-25 18:37:12 +08:00
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2015-12-01 12:18:41 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_taskloop:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TASKLOOP_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2015-12-03 17:40:15 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_taskloop_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TASKLOOP_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2019-10-11 04:13:02 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_master_taskloop:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_MASTER_TASKLOOP_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2019-10-19 00:47:35 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_master_taskloop_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2019-10-15 01:17:41 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_parallel_master_taskloop:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2019-10-25 22:27:13 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_parallel_master_taskloop_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_PARALLEL_MASTER_TASKLOOP_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2015-12-15 16:19:24 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_critical:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_CRITICAL_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2015-12-14 22:51:25 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_distribute:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_DISTRIBUTE_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-06-27 22:55:37 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_distribute_parallel_for:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-07-05 13:00:15 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_distribute_parallel_for_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-07-06 12:45:38 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_distribute_simd:
|
2019-12-07 01:21:31 +08:00
|
|
|
if (OpenMPVersion < 50 && CKind == OMPC_if)
|
|
|
|
return false;
|
2016-07-06 12:45:38 +08:00
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_DISTRIBUTE_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-07-14 10:54:56 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_parallel_for_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-07-21 06:57:10 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-08-05 22:37:37 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_teams_distribute:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TEAMS_DISTRIBUTE_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-10-25 20:50:55 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_teams_distribute_simd:
|
2019-12-12 00:20:47 +08:00
|
|
|
if (OpenMPVersion < 50 && CKind == OMPC_if)
|
|
|
|
return false;
|
2016-10-25 20:50:55 +08:00
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-12-01 07:51:03 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_teams_distribute_parallel_for_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-12-09 11:24:30 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_teams_distribute_parallel_for:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-12-17 13:48:59 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_teams:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_TEAMS_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-12-25 12:52:54 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_teams_distribute:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2016-12-30 06:16:30 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_teams_distribute_parallel_for:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2017-01-03 13:23:48 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_teams_distribute_parallel_for_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2017-01-11 02:08:18 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_target_teams_distribute_simd:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2017-07-19 04:17:46 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_taskgroup:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_TASKGROUP_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2019-02-02 04:25:04 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_declare_mapper:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_DECLARE_MAPPER_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2019-03-13 02:52:33 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_allocate:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_ALLOCATE_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2019-09-24 02:13:31 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OMPD_declare_variant:
|
|
|
|
switch (CKind) {
|
|
|
|
#define OPENMP_DECLARE_VARIANT_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-07-22 18:10:35 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2016-04-06 19:38:59 +08:00
|
|
|
case OMPD_declare_target:
|
|
|
|
case OMPD_end_declare_target:
|
2013-07-19 11:13:43 +08:00
|
|
|
case OMPD_unknown:
|
|
|
|
case OMPD_threadprivate:
|
2014-06-26 16:21:58 +08:00
|
|
|
case OMPD_section:
|
2014-07-17 16:54:58 +08:00
|
|
|
case OMPD_master:
|
2014-07-18 15:47:19 +08:00
|
|
|
case OMPD_taskyield:
|
2014-07-18 17:11:51 +08:00
|
|
|
case OMPD_barrier:
|
2014-07-18 18:17:07 +08:00
|
|
|
case OMPD_taskwait:
|
2015-07-01 14:57:41 +08:00
|
|
|
case OMPD_cancellation_point:
|
2016-03-03 13:21:39 +08:00
|
|
|
case OMPD_declare_reduction:
|
2019-09-14 04:18:17 +08:00
|
|
|
case OMPD_declare_simd:
|
2013-07-19 11:13:43 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2014-06-18 12:14:57 +08:00
|
|
|
|
|
|
|
bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
|
2014-09-23 17:33:00 +08:00
|
|
|
return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
|
2015-12-01 12:18:41 +08:00
|
|
|
DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
|
2016-02-03 23:46:42 +08:00
|
|
|
DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
|
2019-10-19 00:47:35 +08:00
|
|
|
DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
|
2019-10-25 22:27:13 +08:00
|
|
|
DKind == OMPD_parallel_master_taskloop ||
|
|
|
|
DKind == OMPD_parallel_master_taskloop_simd ||
|
|
|
|
DKind == OMPD_distribute || DKind == OMPD_target_parallel_for ||
|
2016-07-05 13:00:15 +08:00
|
|
|
DKind == OMPD_distribute_parallel_for ||
|
2016-07-06 12:45:38 +08:00
|
|
|
DKind == OMPD_distribute_parallel_for_simd ||
|
2016-07-14 10:54:56 +08:00
|
|
|
DKind == OMPD_distribute_simd ||
|
2016-08-05 22:37:37 +08:00
|
|
|
DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
|
2016-12-01 07:51:03 +08:00
|
|
|
DKind == OMPD_teams_distribute ||
|
|
|
|
DKind == OMPD_teams_distribute_simd ||
|
2016-12-09 11:24:30 +08:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
2016-12-25 12:52:54 +08:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for ||
|
2016-12-30 06:16:30 +08:00
|
|
|
DKind == OMPD_target_teams_distribute ||
|
2017-01-03 13:23:48 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
2017-01-11 02:08:18 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
|
|
|
DKind == OMPD_target_teams_distribute_simd;
|
2014-06-18 12:14:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
|
2014-09-23 17:33:00 +08:00
|
|
|
return DKind == OMPD_for || DKind == OMPD_for_simd ||
|
|
|
|
DKind == OMPD_sections || DKind == OMPD_section ||
|
2014-07-08 16:12:03 +08:00
|
|
|
DKind == OMPD_single || DKind == OMPD_parallel_for ||
|
2016-02-03 23:46:42 +08:00
|
|
|
DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
|
2016-06-27 22:55:37 +08:00
|
|
|
DKind == OMPD_target_parallel_for ||
|
2016-07-05 13:00:15 +08:00
|
|
|
DKind == OMPD_distribute_parallel_for ||
|
2016-07-14 10:54:56 +08:00
|
|
|
DKind == OMPD_distribute_parallel_for_simd ||
|
2016-12-01 07:51:03 +08:00
|
|
|
DKind == OMPD_target_parallel_for_simd ||
|
2016-12-09 11:24:30 +08:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
2016-12-30 06:16:30 +08:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for ||
|
2017-01-03 13:23:48 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd;
|
2014-06-18 12:14:57 +08:00
|
|
|
}
|
|
|
|
|
2015-12-03 17:40:15 +08:00
|
|
|
bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
|
2019-10-11 04:13:02 +08:00
|
|
|
return DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
|
2019-10-19 00:47:35 +08:00
|
|
|
DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
|
2019-10-25 22:27:13 +08:00
|
|
|
DKind == OMPD_parallel_master_taskloop ||
|
|
|
|
DKind == OMPD_parallel_master_taskloop_simd;
|
2015-12-03 17:40:15 +08:00
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:57 +08:00
|
|
|
bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
|
2014-07-08 16:12:03 +08:00
|
|
|
return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
|
2016-02-03 23:46:42 +08:00
|
|
|
DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
|
2016-06-27 22:55:37 +08:00
|
|
|
DKind == OMPD_target_parallel || DKind == OMPD_target_parallel_for ||
|
2016-07-05 13:00:15 +08:00
|
|
|
DKind == OMPD_distribute_parallel_for ||
|
2016-07-14 10:54:56 +08:00
|
|
|
DKind == OMPD_distribute_parallel_for_simd ||
|
2016-12-09 11:24:30 +08:00
|
|
|
DKind == OMPD_target_parallel_for_simd ||
|
|
|
|
DKind == OMPD_teams_distribute_parallel_for ||
|
2016-12-30 06:16:30 +08:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
2017-01-03 13:23:48 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
2019-10-15 01:17:41 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
2019-12-06 02:43:48 +08:00
|
|
|
DKind == OMPD_parallel_master ||
|
2019-10-25 22:27:13 +08:00
|
|
|
DKind == OMPD_parallel_master_taskloop ||
|
|
|
|
DKind == OMPD_parallel_master_taskloop_simd;
|
2014-06-18 12:14:57 +08:00
|
|
|
}
|
|
|
|
|
2016-02-02 12:00:47 +08:00
|
|
|
bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
|
2016-02-03 23:46:42 +08:00
|
|
|
return DKind == OMPD_target || DKind == OMPD_target_parallel ||
|
2017-11-10 01:32:15 +08:00
|
|
|
DKind == OMPD_target_parallel_for ||
|
2016-12-17 13:48:59 +08:00
|
|
|
DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
|
2016-12-30 06:16:30 +08:00
|
|
|
DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
|
2017-01-03 13:23:48 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
2017-01-11 02:08:18 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
|
|
|
DKind == OMPD_target_teams_distribute_simd;
|
2016-02-02 12:00:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
|
|
|
|
return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
|
2016-05-27 01:30:50 +08:00
|
|
|
DKind == OMPD_target_exit_data || DKind == OMPD_target_update;
|
2015-10-03 01:14:03 +08:00
|
|
|
}
|
|
|
|
|
2016-12-17 13:48:59 +08:00
|
|
|
bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
|
2016-10-25 20:50:55 +08:00
|
|
|
return DKind == OMPD_teams || DKind == OMPD_teams_distribute ||
|
2016-12-01 07:51:03 +08:00
|
|
|
DKind == OMPD_teams_distribute_simd ||
|
2016-12-09 11:24:30 +08:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
|
|
|
DKind == OMPD_teams_distribute_parallel_for;
|
2016-12-17 13:48:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
|
|
|
|
return isOpenMPNestingTeamsDirective(DKind) ||
|
2016-12-30 06:16:30 +08:00
|
|
|
DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
|
2017-01-03 13:23:48 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
2017-01-11 02:08:18 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
|
|
|
DKind == OMPD_target_teams_distribute_simd;
|
2014-10-09 12:18:56 +08:00
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:57 +08:00
|
|
|
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
|
2014-09-23 17:33:00 +08:00
|
|
|
return DKind == OMPD_simd || DKind == OMPD_for_simd ||
|
2016-07-05 13:00:15 +08:00
|
|
|
DKind == OMPD_parallel_for_simd || DKind == OMPD_taskloop_simd ||
|
2019-10-19 00:47:35 +08:00
|
|
|
DKind == OMPD_master_taskloop_simd ||
|
2019-10-25 22:27:13 +08:00
|
|
|
DKind == OMPD_parallel_master_taskloop_simd ||
|
2016-07-06 12:45:38 +08:00
|
|
|
DKind == OMPD_distribute_parallel_for_simd ||
|
2016-10-25 20:50:55 +08:00
|
|
|
DKind == OMPD_distribute_simd || DKind == OMPD_target_simd ||
|
2016-12-01 07:51:03 +08:00
|
|
|
DKind == OMPD_teams_distribute_simd ||
|
2017-01-03 13:23:48 +08:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
2017-01-11 02:08:18 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
2017-11-10 01:01:35 +08:00
|
|
|
DKind == OMPD_target_teams_distribute_simd ||
|
|
|
|
DKind == OMPD_target_parallel_for_simd;
|
2014-06-18 12:14:57 +08:00
|
|
|
}
|
|
|
|
|
2016-08-05 22:37:37 +08:00
|
|
|
bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
|
2016-07-05 13:00:15 +08:00
|
|
|
return Kind == OMPD_distribute || Kind == OMPD_distribute_parallel_for ||
|
2016-07-06 12:45:38 +08:00
|
|
|
Kind == OMPD_distribute_parallel_for_simd ||
|
|
|
|
Kind == OMPD_distribute_simd;
|
2016-07-05 13:00:15 +08:00
|
|
|
// TODO add next directives.
|
2015-12-14 22:51:25 +08:00
|
|
|
}
|
|
|
|
|
2016-08-05 22:37:37 +08:00
|
|
|
bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
|
|
|
|
return isOpenMPNestingDistributeDirective(Kind) ||
|
2016-12-01 07:51:03 +08:00
|
|
|
Kind == OMPD_teams_distribute || Kind == OMPD_teams_distribute_simd ||
|
2016-12-09 11:24:30 +08:00
|
|
|
Kind == OMPD_teams_distribute_parallel_for_simd ||
|
2016-12-25 12:52:54 +08:00
|
|
|
Kind == OMPD_teams_distribute_parallel_for ||
|
2016-12-30 06:16:30 +08:00
|
|
|
Kind == OMPD_target_teams_distribute ||
|
2017-01-03 13:23:48 +08:00
|
|
|
Kind == OMPD_target_teams_distribute_parallel_for ||
|
2017-01-11 02:08:18 +08:00
|
|
|
Kind == OMPD_target_teams_distribute_parallel_for_simd ||
|
|
|
|
Kind == OMPD_target_teams_distribute_simd;
|
2016-08-05 22:37:37 +08:00
|
|
|
}
|
|
|
|
|
2014-06-18 12:14:57 +08:00
|
|
|
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
|
|
|
|
return Kind == OMPC_private || Kind == OMPC_firstprivate ||
|
|
|
|
Kind == OMPC_lastprivate || Kind == OMPC_linear ||
|
2017-07-22 02:48:21 +08:00
|
|
|
Kind == OMPC_reduction || Kind == OMPC_task_reduction ||
|
|
|
|
Kind == OMPC_in_reduction; // TODO add next clauses like 'reduction'.
|
2014-06-18 12:14:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
|
2015-04-16 13:39:01 +08:00
|
|
|
return Kind == OMPC_threadprivate || Kind == OMPC_copyin;
|
2014-06-18 12:14:57 +08:00
|
|
|
}
|
|
|
|
|
2016-04-13 21:36:48 +08:00
|
|
|
bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
|
|
|
|
return Kind == OMPD_task || isOpenMPTaskLoopDirective(Kind);
|
|
|
|
}
|
2016-06-27 22:55:37 +08:00
|
|
|
|
|
|
|
bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
|
2016-07-05 13:00:15 +08:00
|
|
|
return Kind == OMPD_distribute_parallel_for ||
|
2016-07-06 12:45:38 +08:00
|
|
|
Kind == OMPD_distribute_parallel_for_simd ||
|
2016-12-09 11:24:30 +08:00
|
|
|
Kind == OMPD_teams_distribute_parallel_for_simd ||
|
2016-12-25 12:52:54 +08:00
|
|
|
Kind == OMPD_teams_distribute_parallel_for ||
|
2017-01-03 13:23:48 +08:00
|
|
|
Kind == OMPD_target_teams_distribute_parallel_for ||
|
2017-04-20 08:39:39 +08:00
|
|
|
Kind == OMPD_target_teams_distribute_parallel_for_simd;
|
2016-06-27 22:55:37 +08:00
|
|
|
}
|
2017-01-19 02:18:53 +08:00
|
|
|
|
|
|
|
void clang::getOpenMPCaptureRegions(
|
|
|
|
SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
|
|
|
|
OpenMPDirectiveKind DKind) {
|
|
|
|
assert(DKind <= OMPD_unknown);
|
|
|
|
switch (DKind) {
|
|
|
|
case OMPD_parallel:
|
|
|
|
case OMPD_parallel_for:
|
|
|
|
case OMPD_parallel_for_simd:
|
2019-12-06 02:43:48 +08:00
|
|
|
case OMPD_parallel_master:
|
2017-01-19 02:18:53 +08:00
|
|
|
case OMPD_parallel_sections:
|
2017-02-18 05:29:13 +08:00
|
|
|
case OMPD_distribute_parallel_for:
|
2017-11-28 03:38:52 +08:00
|
|
|
case OMPD_distribute_parallel_for_simd:
|
2017-01-19 02:18:53 +08:00
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
break;
|
2017-01-25 09:45:59 +08:00
|
|
|
case OMPD_target_teams:
|
2017-12-08 23:03:50 +08:00
|
|
|
case OMPD_target_teams_distribute:
|
2017-12-14 03:45:06 +08:00
|
|
|
case OMPD_target_teams_distribute_simd:
|
2018-01-16 03:06:12 +08:00
|
|
|
CaptureRegions.push_back(OMPD_task);
|
2017-01-25 10:18:43 +08:00
|
|
|
CaptureRegions.push_back(OMPD_target);
|
|
|
|
CaptureRegions.push_back(OMPD_teams);
|
|
|
|
break;
|
2017-11-29 05:11:44 +08:00
|
|
|
case OMPD_teams:
|
2017-10-04 22:12:09 +08:00
|
|
|
case OMPD_teams_distribute:
|
2017-11-29 05:11:44 +08:00
|
|
|
case OMPD_teams_distribute_simd:
|
2017-10-04 22:12:09 +08:00
|
|
|
CaptureRegions.push_back(OMPD_teams);
|
|
|
|
break;
|
2017-11-29 05:11:44 +08:00
|
|
|
case OMPD_target:
|
2017-11-18 01:57:25 +08:00
|
|
|
case OMPD_target_simd:
|
2018-01-16 03:06:12 +08:00
|
|
|
CaptureRegions.push_back(OMPD_task);
|
2017-11-18 01:57:25 +08:00
|
|
|
CaptureRegions.push_back(OMPD_target);
|
|
|
|
break;
|
2017-11-21 04:46:39 +08:00
|
|
|
case OMPD_teams_distribute_parallel_for:
|
2017-12-05 04:57:19 +08:00
|
|
|
case OMPD_teams_distribute_parallel_for_simd:
|
2017-11-21 04:46:39 +08:00
|
|
|
CaptureRegions.push_back(OMPD_teams);
|
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
break;
|
2017-11-23 01:19:31 +08:00
|
|
|
case OMPD_target_parallel:
|
|
|
|
case OMPD_target_parallel_for:
|
|
|
|
case OMPD_target_parallel_for_simd:
|
2018-01-16 03:06:12 +08:00
|
|
|
CaptureRegions.push_back(OMPD_task);
|
2017-11-23 01:19:31 +08:00
|
|
|
CaptureRegions.push_back(OMPD_target);
|
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
break;
|
2017-11-29 05:11:44 +08:00
|
|
|
case OMPD_task:
|
2017-11-23 01:19:31 +08:00
|
|
|
case OMPD_target_enter_data:
|
|
|
|
case OMPD_target_exit_data:
|
|
|
|
case OMPD_target_update:
|
|
|
|
CaptureRegions.push_back(OMPD_task);
|
|
|
|
break;
|
2017-11-29 05:11:44 +08:00
|
|
|
case OMPD_taskloop:
|
|
|
|
case OMPD_taskloop_simd:
|
2019-10-11 04:13:02 +08:00
|
|
|
case OMPD_master_taskloop:
|
2019-10-19 00:47:35 +08:00
|
|
|
case OMPD_master_taskloop_simd:
|
2017-11-29 05:11:44 +08:00
|
|
|
CaptureRegions.push_back(OMPD_taskloop);
|
|
|
|
break;
|
2019-10-15 01:17:41 +08:00
|
|
|
case OMPD_parallel_master_taskloop:
|
2019-10-25 22:27:13 +08:00
|
|
|
case OMPD_parallel_master_taskloop_simd:
|
2019-10-15 01:17:41 +08:00
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
CaptureRegions.push_back(OMPD_taskloop);
|
|
|
|
break;
|
2018-01-04 05:12:44 +08:00
|
|
|
case OMPD_target_teams_distribute_parallel_for:
|
2018-01-16 04:59:40 +08:00
|
|
|
case OMPD_target_teams_distribute_parallel_for_simd:
|
2018-01-16 03:06:12 +08:00
|
|
|
CaptureRegions.push_back(OMPD_task);
|
2018-01-04 05:12:44 +08:00
|
|
|
CaptureRegions.push_back(OMPD_target);
|
|
|
|
CaptureRegions.push_back(OMPD_teams);
|
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
break;
|
2017-01-19 02:18:53 +08:00
|
|
|
case OMPD_simd:
|
|
|
|
case OMPD_for:
|
|
|
|
case OMPD_for_simd:
|
|
|
|
case OMPD_sections:
|
|
|
|
case OMPD_section:
|
|
|
|
case OMPD_single:
|
|
|
|
case OMPD_master:
|
|
|
|
case OMPD_critical:
|
|
|
|
case OMPD_taskgroup:
|
|
|
|
case OMPD_distribute:
|
|
|
|
case OMPD_ordered:
|
|
|
|
case OMPD_atomic:
|
|
|
|
case OMPD_target_data:
|
|
|
|
case OMPD_distribute_simd:
|
2017-11-29 05:11:44 +08:00
|
|
|
CaptureRegions.push_back(OMPD_unknown);
|
2017-01-19 02:18:53 +08:00
|
|
|
break;
|
|
|
|
case OMPD_threadprivate:
|
2019-03-08 01:54:44 +08:00
|
|
|
case OMPD_allocate:
|
2017-01-19 02:18:53 +08:00
|
|
|
case OMPD_taskyield:
|
|
|
|
case OMPD_barrier:
|
|
|
|
case OMPD_taskwait:
|
|
|
|
case OMPD_cancellation_point:
|
|
|
|
case OMPD_cancel:
|
|
|
|
case OMPD_flush:
|
2020-02-28 22:52:15 +08:00
|
|
|
case OMPD_depobj:
|
2017-01-19 02:18:53 +08:00
|
|
|
case OMPD_declare_reduction:
|
2019-02-02 04:25:04 +08:00
|
|
|
case OMPD_declare_mapper:
|
2017-01-19 02:18:53 +08:00
|
|
|
case OMPD_declare_simd:
|
|
|
|
case OMPD_declare_target:
|
|
|
|
case OMPD_end_declare_target:
|
2018-09-26 12:28:39 +08:00
|
|
|
case OMPD_requires:
|
2019-09-14 04:18:17 +08:00
|
|
|
case OMPD_declare_variant:
|
2017-01-19 02:18:53 +08:00
|
|
|
llvm_unreachable("OpenMP Directive is not allowed");
|
|
|
|
case OMPD_unknown:
|
|
|
|
llvm_unreachable("Unknown OpenMP directive");
|
|
|
|
}
|
|
|
|
}
|