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
20namespace clang {
21
22/// \brief OpenMP directives.
23enum 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.
33enum 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.
42enum 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.
50enum 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.
58enum OpenMPScheduleClauseKind {
59#define OPENMP_SCHEDULE_KIND(Name) \
60  OMPC_SCHEDULE_##Name,
61#include "clang/Basic/OpenMPKinds.def"
62  OMPC_SCHEDULE_unknown
63};
64
65OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str);
66const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind);
67
68OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str);
69const char *getOpenMPClauseName(OpenMPClauseKind Kind);
70
71unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str);
72const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
73
74bool 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.
82bool 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.
88bool 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.
94bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind);
95
96/// \brief Checks if the specified directive is a simd directive.
97/// \param DKind Specified directive.
98/// \return true - the directive is a simd directive like 'omp simd',
99/// otherwise - false.
100bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);
101
102/// \brief Checks if the specified clause is one of private clauses like
103/// 'private', 'firstprivate', 'reduction' etc..
104/// \param Kind Clause kind.
105/// \return true - the clause is a private clause, otherwise - false.
106bool isOpenMPPrivate(OpenMPClauseKind Kind);
107
108/// \brief Checks if the specified clause is one of threadprivate clauses like
109/// 'threadprivate', 'copyin' or 'copyprivate'.
110/// \param Kind Clause kind.
111/// \return true - the clause is a threadprivate clause, otherwise - false.
112bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);
113
114}
115
116#endif
117
118