1 //===--- OpenMPKinds.h - OpenMP enums ---------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief Defines some OpenMP-specific enums and functions.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_BASIC_OPENMPKINDS_H
16 #define LLVM_CLANG_BASIC_OPENMPKINDS_H
18 #include "llvm/ADT/StringRef.h"
22 /// \brief OpenMP directives.
23 enum OpenMPDirectiveKind {
24 #define OPENMP_DIRECTIVE(Name) \
26 #define OPENMP_DIRECTIVE_EXT(Name, Str) \
28 #include "clang/Basic/OpenMPKinds.def"
32 /// \brief OpenMP clauses.
33 enum OpenMPClauseKind {
34 #define OPENMP_CLAUSE(Name, Class) \
36 #include "clang/Basic/OpenMPKinds.def"
41 /// \brief OpenMP attributes for 'default' clause.
42 enum OpenMPDefaultClauseKind {
43 #define OPENMP_DEFAULT_KIND(Name) \
45 #include "clang/Basic/OpenMPKinds.def"
49 /// \brief OpenMP attributes for 'proc_bind' clause.
50 enum OpenMPProcBindClauseKind {
51 #define OPENMP_PROC_BIND_KIND(Name) \
52 OMPC_PROC_BIND_##Name,
53 #include "clang/Basic/OpenMPKinds.def"
54 OMPC_PROC_BIND_unknown
57 /// \brief OpenMP attributes for 'schedule' clause.
58 enum OpenMPScheduleClauseKind {
59 #define OPENMP_SCHEDULE_KIND(Name) \
61 #include "clang/Basic/OpenMPKinds.def"
65 /// \brief OpenMP attributes for 'depend' clause.
66 enum OpenMPDependClauseKind {
67 #define OPENMP_DEPEND_KIND(Name) \
69 #include "clang/Basic/OpenMPKinds.def"
73 OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str);
74 const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind);
76 OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str);
77 const char *getOpenMPClauseName(OpenMPClauseKind Kind);
79 unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str);
80 const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
82 bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
83 OpenMPClauseKind CKind);
85 /// \brief Checks if the specified directive is a directive with an associated
87 /// \param DKind Specified directive.
88 /// \return true - the directive is a loop-associated directive like 'omp simd'
89 /// or 'omp for' directive, otherwise - false.
90 bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind);
92 /// \brief Checks if the specified directive is a worksharing directive.
93 /// \param DKind Specified directive.
94 /// \return true - the directive is a worksharing directive like 'omp for',
95 /// otherwise - false.
96 bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind);
98 /// \brief Checks if the specified directive is a parallel-kind directive.
99 /// \param DKind Specified directive.
100 /// \return true - the directive is a parallel-like directive like 'omp
101 /// parallel', otherwise - false.
102 bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind);
104 /// \brief Checks if the specified directive is a teams-kind directive.
105 /// \param DKind Specified directive.
106 /// \return true - the directive is a teams-like directive like 'omp teams',
107 /// otherwise - false.
108 bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind);
110 /// \brief Checks if the specified directive is a simd directive.
111 /// \param DKind Specified directive.
112 /// \return true - the directive is a simd directive like 'omp simd',
113 /// otherwise - false.
114 bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);
116 /// \brief Checks if the specified clause is one of private clauses like
117 /// 'private', 'firstprivate', 'reduction' etc..
118 /// \param Kind Clause kind.
119 /// \return true - the clause is a private clause, otherwise - false.
120 bool isOpenMPPrivate(OpenMPClauseKind Kind);
122 /// \brief Checks if the specified clause is one of threadprivate clauses like
123 /// 'threadprivate', 'copyin' or 'copyprivate'.
124 /// \param Kind Clause kind.
125 /// \return true - the clause is a threadprivate clause, otherwise - false.
126 bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);