1 //===- OMPConstants.h - OpenMP related constants and helpers ------ C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 ///
10 /// This file defines constans and helpers used when dealing with OpenMP.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_OPENMP_CONSTANTS_H
15 #define LLVM_OPENMP_CONSTANTS_H
16 
17 #include "llvm/ADT/BitmaskEnum.h"
18 
19 #include "llvm/Frontend/OpenMP/OMP.h.inc"
20 
21 namespace llvm {
22 class Type;
23 class Module;
24 class ArrayType;
25 class StructType;
26 class PointerType;
27 class StringRef;
28 class FunctionType;
29 
30 namespace omp {
31 LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
32 
33 /// IDs for all Internal Control Variables (ICVs).
34 enum class InternalControlVar {
35 #define ICV_DATA_ENV(Enum, ...) Enum,
36 #include "llvm/Frontend/OpenMP/OMPKinds.def"
37 };
38 
39 #define ICV_DATA_ENV(Enum, ...)                                                \
40   constexpr auto Enum = omp::InternalControlVar::Enum;
41 #include "llvm/Frontend/OpenMP/OMPKinds.def"
42 
43 enum class ICVInitValue {
44 #define ICV_DATA_ENV(Enum, Name, EnvVar, Init) Init,
45 #include "llvm/Frontend/OpenMP/OMPKinds.def"
46 };
47 
48 #define ICV_DATA_ENV(Enum, Name, EnvVar, Init)                                 \
49   constexpr auto Init = omp::ICVInitValue::Init;
50 #include "llvm/Frontend/OpenMP/OMPKinds.def"
51 
52 /// IDs for all omp runtime library (RTL) functions.
53 enum class RuntimeFunction {
54 #define OMP_RTL(Enum, ...) Enum,
55 #include "llvm/Frontend/OpenMP/OMPKinds.def"
56 };
57 
58 #define OMP_RTL(Enum, ...) constexpr auto Enum = omp::RuntimeFunction::Enum;
59 #include "llvm/Frontend/OpenMP/OMPKinds.def"
60 
61 /// IDs for the different default kinds.
62 enum class DefaultKind {
63 #define OMP_DEFAULT_KIND(Enum, Str) Enum,
64 #include "llvm/Frontend/OpenMP/OMPKinds.def"
65 };
66 
67 #define OMP_DEFAULT_KIND(Enum, ...)                                            \
68   constexpr auto Enum = omp::DefaultKind::Enum;
69 #include "llvm/Frontend/OpenMP/OMPKinds.def"
70 
71 /// IDs for the different proc bind kinds.
72 enum class ProcBindKind {
73 #define OMP_PROC_BIND_KIND(Enum, Str, Value) Enum = Value,
74 #include "llvm/Frontend/OpenMP/OMPKinds.def"
75 };
76 
77 #define OMP_PROC_BIND_KIND(Enum, ...)                                          \
78   constexpr auto Enum = omp::ProcBindKind::Enum;
79 #include "llvm/Frontend/OpenMP/OMPKinds.def"
80 
81 /// IDs for all omp runtime library ident_t flag encodings (see
82 /// their defintion in openmp/runtime/src/kmp.h).
83 enum class IdentFlag {
84 #define OMP_IDENT_FLAG(Enum, Str, Value) Enum = Value,
85 #include "llvm/Frontend/OpenMP/OMPKinds.def"
86   LLVM_MARK_AS_BITMASK_ENUM(0x7FFFFFFF)
87 };
88 
89 #define OMP_IDENT_FLAG(Enum, ...) constexpr auto Enum = omp::IdentFlag::Enum;
90 #include "llvm/Frontend/OpenMP/OMPKinds.def"
91 
92 } // end namespace omp
93 
94 } // end namespace llvm
95 
96 #endif // LLVM_OPENMP_CONSTANTS_H
97