2013-03-22 14:34:35 +08:00
|
|
|
//===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// \file
|
|
|
|
/// \brief This file implements the OpenMP enum and support functions.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#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"
|
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"
|
|
|
|
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:
|
|
|
|
return llvm::StringSwitch<OpenMPScheduleClauseKind>(Str)
|
|
|
|
#define OPENMP_SCHEDULE_KIND(Name) .Case(#Name, OMPC_SCHEDULE_##Name)
|
|
|
|
#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);
|
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:
|
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:
|
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:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_SCHEDULE_KIND(Name) \
|
|
|
|
case OMPC_SCHEDULE_##Name: \
|
|
|
|
return #Name;
|
2015-06-23 22:25:19 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'schedule' 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");
|
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:
|
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:
|
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;
|
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;
|
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) {
|
|
|
|
#define OPENMP_ORDERED_CLAUSE(Name) \
|
|
|
|
case OMPC_##Name: \
|
|
|
|
return true;
|
2014-07-22 18:10:35 +08:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
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-21 17:42:05 +08:00
|
|
|
case OMPD_critical:
|
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-06-18 20:14:09 +08:00
|
|
|
case OMPD_taskgroup:
|
2015-07-01 14:57:41 +08:00
|
|
|
case OMPD_cancellation_point:
|
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 ||
|
2014-09-18 13:12:34 +08:00
|
|
|
DKind == OMPD_parallel_for ||
|
2014-09-23 17:33:00 +08:00
|
|
|
DKind == OMPD_parallel_for_simd; // TODO add next directives.
|
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 ||
|
2014-09-23 17:33:00 +08:00
|
|
|
DKind == OMPD_parallel_for_simd ||
|
|
|
|
DKind == OMPD_parallel_sections; // TODO add next directives.
|
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 ||
|
2014-09-23 17:33:00 +08:00
|
|
|
DKind == OMPD_parallel_for_simd ||
|
2014-07-08 16:12:03 +08:00
|
|
|
DKind == OMPD_parallel_sections; // TODO add next directives.
|
2014-06-18 12:14:57 +08:00
|
|
|
}
|
|
|
|
|
2014-10-09 12:18:56 +08:00
|
|
|
bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
|
|
|
|
return DKind == OMPD_teams; // TODO add next directives.
|
|
|
|
}
|
|
|
|
|
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 ||
|
|
|
|
DKind == OMPD_parallel_for_simd; // TODO add next directives.
|
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 ||
|
|
|
|
Kind == OMPC_reduction; // TODO add next clauses like 'reduction'.
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|