1 //===--- OpenMPKinds.h - OpenMP enums ---------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 /// 10 /// \file 11 /// \brief Defines some OpenMP-specific enums and functions. 12 /// 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_CLANG_BASIC_OPENMPKINDS_H 16 #define LLVM_CLANG_BASIC_OPENMPKINDS_H 17 18 #include "llvm/ADT/StringRef.h" 19 20 namespace clang { 21 22 /// \brief OpenMP directives. 23 enum OpenMPDirectiveKind { 24 #define OPENMP_DIRECTIVE(Name) \ 25 OMPD_##Name, 26 #define OPENMP_DIRECTIVE_EXT(Name, Str) \ 27 OMPD_##Name, 28 #include "clang/Basic/OpenMPKinds.def" 29 OMPD_unknown 30 }; 31 32 /// \brief OpenMP clauses. 33 enum OpenMPClauseKind { 34 #define OPENMP_CLAUSE(Name, Class) \ 35 OMPC_##Name, 36 #include "clang/Basic/OpenMPKinds.def" 37 OMPC_threadprivate, 38 OMPC_unknown 39 }; 40 41 /// \brief OpenMP attributes for 'default' clause. 42 enum OpenMPDefaultClauseKind { 43 #define OPENMP_DEFAULT_KIND(Name) \ 44 OMPC_DEFAULT_##Name, 45 #include "clang/Basic/OpenMPKinds.def" 46 OMPC_DEFAULT_unknown 47 }; 48 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 55 }; 56 57 /// \brief OpenMP attributes for 'schedule' clause. 58 enum OpenMPScheduleClauseKind { 59 #define OPENMP_SCHEDULE_KIND(Name) \ 60 OMPC_SCHEDULE_##Name, 61 #include "clang/Basic/OpenMPKinds.def" 62 OMPC_SCHEDULE_unknown 63 }; 64 65 OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str); 66 const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind); 67 68 OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str); 69 const char *getOpenMPClauseName(OpenMPClauseKind Kind); 70 71 unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str); 72 const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type); 73 74 bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind, 75 OpenMPClauseKind CKind); 76 77 /// \brief Checks if the specified directive is a directive with an associated 78 /// loop construct. 79 /// \param DKind Specified directive. 80 /// \return true - the directive is a loop-associated directive like 'omp simd' 81 /// or 'omp for' directive, otherwise - false. 82 bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind); 83 84 /// \brief Checks if the specified directive is a worksharing directive. 85 /// \param DKind Specified directive. 86 /// \return true - the directive is a worksharing directive like 'omp for', 87 /// otherwise - false. 88 bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind); 89 90 /// \brief Checks if the specified directive is a parallel-kind directive. 91 /// \param DKind Specified directive. 92 /// \return true - the directive is a parallel-like directive like 'omp 93 /// parallel', otherwise - false. 94 bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind); 95 96 /// \brief Checks if the specified directive is a teams-kind directive. 97 /// \param DKind Specified directive. 98 /// \return true - the directive is a teams-like directive like 'omp teams', 99 /// otherwise - false. 100 bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind); 101 102 /// \brief Checks if the specified directive is a simd directive. 103 /// \param DKind Specified directive. 104 /// \return true - the directive is a simd directive like 'omp simd', 105 /// otherwise - false. 106 bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind); 107 108 /// \brief Checks if the specified clause is one of private clauses like 109 /// 'private', 'firstprivate', 'reduction' etc.. 110 /// \param Kind Clause kind. 111 /// \return true - the clause is a private clause, otherwise - false. 112 bool isOpenMPPrivate(OpenMPClauseKind Kind); 113 114 /// \brief Checks if the specified clause is one of threadprivate clauses like 115 /// 'threadprivate', 'copyin' or 'copyprivate'. 116 /// \param Kind Clause kind. 117 /// \return true - the clause is a threadprivate clause, otherwise - false. 118 bool isOpenMPThreadPrivate(OpenMPClauseKind Kind); 119 120 } 121 122 #endif 123 124