OMPConstants.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- OMPConstants.h - OpenMP related constants and helpers ------ C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. /// \file
  14. ///
  15. /// This file defines constans and helpers used when dealing with OpenMP.
  16. ///
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_FRONTEND_OPENMP_OMPCONSTANTS_H
  19. #define LLVM_FRONTEND_OPENMP_OMPCONSTANTS_H
  20. #include "llvm/ADT/BitmaskEnum.h"
  21. #include "llvm/ADT/StringRef.h"
  22. #include "llvm/Frontend/OpenMP/OMP.h.inc"
  23. namespace llvm {
  24. namespace omp {
  25. LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
  26. /// IDs for all Internal Control Variables (ICVs).
  27. enum class InternalControlVar {
  28. #define ICV_DATA_ENV(Enum, ...) Enum,
  29. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  30. };
  31. #define ICV_DATA_ENV(Enum, ...) \
  32. constexpr auto Enum = omp::InternalControlVar::Enum;
  33. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  34. enum class ICVInitValue {
  35. #define ICV_INIT_VALUE(Enum, Name) Enum,
  36. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  37. };
  38. #define ICV_INIT_VALUE(Enum, Name) \
  39. constexpr auto Enum = omp::ICVInitValue::Enum;
  40. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  41. /// IDs for all omp runtime library (RTL) functions.
  42. enum class RuntimeFunction {
  43. #define OMP_RTL(Enum, ...) Enum,
  44. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  45. };
  46. #define OMP_RTL(Enum, ...) constexpr auto Enum = omp::RuntimeFunction::Enum;
  47. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  48. /// IDs for the different default kinds.
  49. enum class DefaultKind {
  50. #define OMP_DEFAULT_KIND(Enum, Str) Enum,
  51. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  52. };
  53. #define OMP_DEFAULT_KIND(Enum, ...) \
  54. constexpr auto Enum = omp::DefaultKind::Enum;
  55. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  56. /// IDs for all omp runtime library ident_t flag encodings (see
  57. /// their defintion in openmp/runtime/src/kmp.h).
  58. enum class IdentFlag {
  59. #define OMP_IDENT_FLAG(Enum, Str, Value) Enum = Value,
  60. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  61. LLVM_MARK_AS_BITMASK_ENUM(0x7FFFFFFF)
  62. };
  63. #define OMP_IDENT_FLAG(Enum, ...) constexpr auto Enum = omp::IdentFlag::Enum;
  64. #include "llvm/Frontend/OpenMP/OMPKinds.def"
  65. /// \note This needs to be kept in sync with kmp.h enum sched_type.
  66. /// Todo: Update kmp.h to include this file, and remove the enums in kmp.h
  67. /// To complete this, more enum values will need to be moved here.
  68. enum class OMPScheduleType {
  69. StaticChunked = 33,
  70. Static = 34, // static unspecialized
  71. DistributeChunked = 91,
  72. Distribute = 92,
  73. DynamicChunked = 35,
  74. GuidedChunked = 36, // guided unspecialized
  75. Runtime = 37,
  76. Auto = 38, // auto
  77. StaticBalancedChunked = 45, // static with chunk adjustment (e.g., simd)
  78. GuidedSimd = 46, // guided with chunk adjustment
  79. RuntimeSimd = 47, // runtime with chunk adjustment
  80. ModifierMonotonic =
  81. (1 << 29), // Set if the monotonic schedule modifier was present
  82. ModifierNonmonotonic =
  83. (1 << 30), // Set if the nonmonotonic schedule modifier was present
  84. ModifierMask = ModifierMonotonic | ModifierNonmonotonic,
  85. LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue */ ModifierMask)
  86. };
  87. enum OMPTgtExecModeFlags : int8_t {
  88. OMP_TGT_EXEC_MODE_GENERIC = 1 << 0,
  89. OMP_TGT_EXEC_MODE_SPMD = 1 << 1,
  90. OMP_TGT_EXEC_MODE_GENERIC_SPMD =
  91. OMP_TGT_EXEC_MODE_GENERIC | OMP_TGT_EXEC_MODE_SPMD,
  92. LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue */ OMP_TGT_EXEC_MODE_GENERIC_SPMD)
  93. };
  94. enum class AddressSpace : unsigned {
  95. Generic = 0,
  96. Global = 1,
  97. Shared = 3,
  98. Constant = 4,
  99. Local = 5,
  100. };
  101. /// \note This needs to be kept in sync with interop.h enum kmp_interop_type_t.:
  102. enum class OMPInteropType { Unknown, Target, TargetSync };
  103. } // end namespace omp
  104. } // end namespace llvm
  105. #endif // LLVM_FRONTEND_OPENMP_OMPCONSTANTS_H
  106. #ifdef __GNUC__
  107. #pragma GCC diagnostic pop
  108. #endif