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;
|
|
|
|
|
|
|
|
OpenMPDirectiveKind clang::getOpenMPDirectiveKind(StringRef Str) {
|
|
|
|
return llvm::StringSwitch<OpenMPDirectiveKind>(Str)
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_DIRECTIVE(Name) .Case(#Name, OMPD_##Name)
|
2014-07-07 21:01:15 +08:00
|
|
|
#define OPENMP_DIRECTIVE_EXT(Name, Str) .Case(Str, OMPD_##Name)
|
2013-03-22 14:34:35 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
2014-06-18 15:08:49 +08:00
|
|
|
.Default(OMPD_unknown);
|
2013-03-22 14:34:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *clang::getOpenMPDirectiveName(OpenMPDirectiveKind Kind) {
|
2014-05-12 12:23:46 +08:00
|
|
|
assert(Kind <= OMPD_unknown);
|
2013-03-22 14:34:35 +08:00
|
|
|
switch (Kind) {
|
|
|
|
case OMPD_unknown:
|
2013-05-13 12:18:18 +08:00
|
|
|
return "unknown";
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_DIRECTIVE(Name) \
|
|
|
|
case OMPD_##Name: \
|
|
|
|
return #Name;
|
2014-07-07 21:01:15 +08:00
|
|
|
#define OPENMP_DIRECTIVE_EXT(Name, Str) \
|
|
|
|
case OMPD_##Name: \
|
|
|
|
return Str;
|
2013-03-22 14:34:35 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP directive kind");
|
|
|
|
}
|
2013-05-13 12:18:18 +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.
|
2014-07-21 19:26:11 +08:00
|
|
|
if (Str == "flush")
|
|
|
|
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)
|
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"
|
[clang][OpenMP] OMPFlushClause is synthetic, no such clause exists
Summary:
As discussed in https://reviews.llvm.org/D57112#inline-506781,
'flush' clause does not exist in the OpenMP spec, it can not be
specified, and `OMPFlushClause` class is just a helper class.
Therefore `OPENMP_CLAUSE()` in `clang/Basic/OpenMPKinds.def`
should not contain 'flush' "clause".
I have simply removed the `OPENMP_CLAUSE(flush, OMPFlushClause)`
from `clang/Basic/OpenMPKinds.def`, grepped for `OPENMP_CLAUSE`
and added `OPENMP_CLAUSE(flush, OMPFlushClause)` back to the **every**
place where `OPENMP_CLAUSE` is defined and `clang/Basic/OpenMPKinds.def`
is then included.
So as-is, this patch is a NFC. Possibly, some of these
`OPENMP_CLAUSE(flush, OMPFlushClause)` should be dropped,
i don't really know.
Test plan: `ninja check-clang`
Reviewers: ABataev
Reviewed By: ABataev
Subscribers: guansong, arphaman, cfe-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D57280
llvm-svn: 352390
2019-01-29 01:04:11 +08:00
|
|
|
case OMPC_flush:
|
|
|
|
return "flush";
|
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";
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP clause kind");
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
|
|
|
|
StringRef Str) {
|
|
|
|
switch (Kind) {
|
|
|
|
case OMPC_default:
|
|
|
|
return llvm::StringSwitch<OpenMPDefaultClauseKind>(Str)
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_DEFAULT_KIND(Name) .Case(#Name, OMPC_DEFAULT_##Name)
|
2013-07-19 11:13:43 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
2014-06-18 15:08:49 +08:00
|
|
|
.Default(OMPC_DEFAULT_unknown);
|
2014-05-06 14:04:14 +08:00
|
|
|
case OMPC_proc_bind:
|
|
|
|
return llvm::StringSwitch<OpenMPProcBindClauseKind>(Str)
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_PROC_BIND_KIND(Name) .Case(#Name, OMPC_PROC_BIND_##Name)
|
2014-05-06 14:04:14 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
2014-06-18 15:08:49 +08:00
|
|
|
.Default(OMPC_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);
|
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);
|
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:
|
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:
|
2014-06-04 21:06:39 +08:00
|
|
|
case OMPC_lastprivate:
|
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:
|
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:
|
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-05-27 01:49:04 +08:00
|
|
|
case OMPC_from:
|
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:
|
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:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DEFAULT_unknown:
|
|
|
|
return "unknown";
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_DEFAULT_KIND(Name) \
|
|
|
|
case OMPC_DEFAULT_##Name: \
|
|
|
|
return #Name;
|
2013-07-19 11:13:43 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'default' clause type");
|
2014-05-06 14:04:14 +08:00
|
|
|
case OMPC_proc_bind:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_PROC_BIND_unknown:
|
|
|
|
return "unknown";
|
2014-06-18 15:08:49 +08:00
|
|
|
#define OPENMP_PROC_BIND_KIND(Name) \
|
|
|
|
case OMPC_PROC_BIND_##Name: \
|
|
|
|
return #Name;
|
2014-05-06 14:04:14 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
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");
|
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");
|
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:
|
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:
|
2014-06-04 21:06:39 +08:00
|
|
|
case OMPC_lastprivate:
|
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:
|
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:
|
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-05-27 01:49:04 +08:00
|
|
|
case OMPC_from:
|
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:
|
2013-07-19 11:13:43 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP simple clause kind");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
|
|
|
|
OpenMPClauseKind CKind) {
|
2014-05-12 12:23:46 +08:00
|
|
|
assert(DKind <= OMPD_unknown);
|
|
|
|
assert(CKind <= OMPC_unknown);
|
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:
|
|
|
|
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:
|
|
|
|
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;
|
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:
|
|
|
|
return CKind == OMPC_flush;
|
|
|
|
break;
|
2014-07-22 18:10:35 +08:00
|
|
|
case OMPD_atomic:
|
|
|
|
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;
|
2016-03-30 18:43:55 +08:00
|
|
|
case OMPD_declare_simd:
|
|
|
|
break;
|
2015-09-18 16:07:34 +08:00
|
|
|
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;
|
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:
|
|
|
|
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:
|
|
|
|
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;
|
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:
|
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 ||
|
2016-06-27 22:55:37 +08:00
|
|
|
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) {
|
|
|
|
return DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd;
|
|
|
|
}
|
|
|
|
|
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 ||
|
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_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 ||
|
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:
|
|
|
|
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:
|
|
|
|
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:
|
|
|
|
case OMPD_taskyield:
|
|
|
|
case OMPD_barrier:
|
|
|
|
case OMPD_taskwait:
|
|
|
|
case OMPD_cancellation_point:
|
|
|
|
case OMPD_cancel:
|
|
|
|
case OMPD_flush:
|
|
|
|
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:
|
2017-01-19 02:18:53 +08:00
|
|
|
llvm_unreachable("OpenMP Directive is not allowed");
|
|
|
|
case OMPD_unknown:
|
|
|
|
llvm_unreachable("Unknown OpenMP directive");
|
|
|
|
}
|
|
|
|
}
|