clang API Documentation
00001 //===--- OpenMPKinds.h - OpenMP enums ---------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 /// 00010 /// \file 00011 /// \brief Defines some OpenMP-specific enums and functions. 00012 /// 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_CLANG_BASIC_OPENMPKINDS_H 00016 #define LLVM_CLANG_BASIC_OPENMPKINDS_H 00017 00018 #include "llvm/ADT/StringRef.h" 00019 00020 namespace clang { 00021 00022 /// \brief OpenMP directives. 00023 enum OpenMPDirectiveKind { 00024 #define OPENMP_DIRECTIVE(Name) \ 00025 OMPD_##Name, 00026 #define OPENMP_DIRECTIVE_EXT(Name, Str) \ 00027 OMPD_##Name, 00028 #include "clang/Basic/OpenMPKinds.def" 00029 OMPD_unknown 00030 }; 00031 00032 /// \brief OpenMP clauses. 00033 enum OpenMPClauseKind { 00034 #define OPENMP_CLAUSE(Name, Class) \ 00035 OMPC_##Name, 00036 #include "clang/Basic/OpenMPKinds.def" 00037 OMPC_threadprivate, 00038 OMPC_unknown 00039 }; 00040 00041 /// \brief OpenMP attributes for 'default' clause. 00042 enum OpenMPDefaultClauseKind { 00043 #define OPENMP_DEFAULT_KIND(Name) \ 00044 OMPC_DEFAULT_##Name, 00045 #include "clang/Basic/OpenMPKinds.def" 00046 OMPC_DEFAULT_unknown 00047 }; 00048 00049 /// \brief OpenMP attributes for 'proc_bind' clause. 00050 enum OpenMPProcBindClauseKind { 00051 #define OPENMP_PROC_BIND_KIND(Name) \ 00052 OMPC_PROC_BIND_##Name, 00053 #include "clang/Basic/OpenMPKinds.def" 00054 OMPC_PROC_BIND_unknown 00055 }; 00056 00057 /// \brief OpenMP attributes for 'schedule' clause. 00058 enum OpenMPScheduleClauseKind { 00059 #define OPENMP_SCHEDULE_KIND(Name) \ 00060 OMPC_SCHEDULE_##Name, 00061 #include "clang/Basic/OpenMPKinds.def" 00062 OMPC_SCHEDULE_unknown 00063 }; 00064 00065 OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str); 00066 const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind); 00067 00068 OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str); 00069 const char *getOpenMPClauseName(OpenMPClauseKind Kind); 00070 00071 unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str); 00072 const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type); 00073 00074 bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind, 00075 OpenMPClauseKind CKind); 00076 00077 /// \brief Checks if the specified directive is a directive with an associated 00078 /// loop construct. 00079 /// \param DKind Specified directive. 00080 /// \return true - the directive is a loop-associated directive like 'omp simd' 00081 /// or 'omp for' directive, otherwise - false. 00082 bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind); 00083 00084 /// \brief Checks if the specified directive is a worksharing directive. 00085 /// \param DKind Specified directive. 00086 /// \return true - the directive is a worksharing directive like 'omp for', 00087 /// otherwise - false. 00088 bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind); 00089 00090 /// \brief Checks if the specified directive is a parallel-kind directive. 00091 /// \param DKind Specified directive. 00092 /// \return true - the directive is a parallel-like directive like 'omp 00093 /// parallel', otherwise - false. 00094 bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind); 00095 00096 /// \brief Checks if the specified directive is a teams-kind directive. 00097 /// \param DKind Specified directive. 00098 /// \return true - the directive is a teams-like directive like 'omp teams', 00099 /// otherwise - false. 00100 bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind); 00101 00102 /// \brief Checks if the specified directive is a simd directive. 00103 /// \param DKind Specified directive. 00104 /// \return true - the directive is a simd directive like 'omp simd', 00105 /// otherwise - false. 00106 bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind); 00107 00108 /// \brief Checks if the specified clause is one of private clauses like 00109 /// 'private', 'firstprivate', 'reduction' etc.. 00110 /// \param Kind Clause kind. 00111 /// \return true - the clause is a private clause, otherwise - false. 00112 bool isOpenMPPrivate(OpenMPClauseKind Kind); 00113 00114 /// \brief Checks if the specified clause is one of threadprivate clauses like 00115 /// 'threadprivate', 'copyin' or 'copyprivate'. 00116 /// \param Kind Clause kind. 00117 /// \return true - the clause is a threadprivate clause, otherwise - false. 00118 bool isOpenMPThreadPrivate(OpenMPClauseKind Kind); 00119 00120 } 00121 00122 #endif 00123