LLVM 24.0.0git
OMPDescriptors.h
Go to the documentation of this file.
1//===-- OMPDescriptors.h - OpenMP descriptors --------------------- 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//
9// This file contains definitions and declarations of OpenMP elements.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_FRONTEND_OPENMP_OMPDESCRIPTORS_H
14#define LLVM_FRONTEND_OPENMP_OMPDESCRIPTORS_H
15
16#include "llvm/ADT/DenseMap.h"
17#include "llvm/ADT/STLExtras.h"
19
20namespace llvm::omp {
21enum class Property {
22#define GEN_OMP_PROPERTY_ENUMS
24#undef GEN_OMP_PROPERTY_ENUMS
25};
26
27enum class Modifier {
28#define GEN_OMP_MODIFIER_ENUMS
30#undef GEN_OMP_MODIFIER_ENUMS
31};
32
33enum class ModifierSet {
34#define GEN_OMP_MODIFIER_GROUP_ENUMS
35#define First_ FirstGroup_
36#define Last_ LastGroup_
38#undef Last_
39#undef First_
40#undef GEN_OMP_MODIFIER_GROUP_ENUMS
42#define GEN_OMP_MODIFIER_SET_ENUMS
43#define First_ FirstSet_
44#define Last_ LastSet_
46#undef Last_
47#undef First_
48#undef GEN_OMP_MODIFIER_SET_ENUMS
49 First_ = FirstGroup_,
50 Last_ = LastSet_,
51};
53constexpr inline bool isModifierGroup(ModifierSet S) {
54 return //
55 llvm::to_underlying(ModifierSet::FirstGroup_) <= llvm::to_underlying(S) &&
56 llvm::to_underlying(S) <= llvm::to_underlying(ModifierSet::LastGroup_);
63namespace descriptor {
64namespace details {
65struct Base {
67};
69struct Clause : public Base {
72 SourceLanguage Langs;
75};
77struct Modifier : public Base {
79};
80
85} // namespace details
87template <typename DetailsTy> using DetailsMap = DenseMap<Version, DetailsTy>;
89template <typename DetailsTy> struct Descriptor {
90 Descriptor(const Descriptor &) = default;
91 Descriptor(Descriptor &&) = default;
95 StringRef getName() const { return Name; }
96 const DetailsMap<DetailsTy> &getDetails() const { return Details; }
101 if (auto F = Details.find(V); F != Details.end())
104 return Vs;
107private:
110protected:
114struct Clause : public Descriptor<details::Clause> {
116 using Base::Base;
123struct Modifier : public Descriptor<details::Modifier> {
125 using Base::Base;
130struct ModifierSet : public Descriptor<details::ModifierSet> {
132 using Base::Base;
137} // namespace descriptor
139template <typename Enum, typename DescriptorTy>
147} // namespace llvm::omp
149#endif // LLVM_FRONTEND_OPENMP_OMPDESCRIPTORS_H
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_ABI
Definition Compiler.h:215
This file defines the DenseMap class.
#define F(x, y, z)
Definition MD5.cpp:54
This file contains some templates that are useful if you are working with the STL at all.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
DenseMap< Version, DetailsTy > DetailsMap
EnumSet< Modifier > Modifiers
LLVM_ABI const descriptor::Clause & getDescriptor(Clause C)
EnumSet< Directive > Directives
Definition OMP.h:159
constexpr bool isModifierGroup(ModifierSet S)
EnumSet< Clause > Clauses
Definition OMP.h:158
EnumSet< ModifierSet > ModifierSets
LLVM_ABI ArrayRef< Version > getOpenMPVersions()
Definition OMP.cpp:211
DenseMap< Enum, DescriptorTy > DescriptorMap
LLVM_ABI Properties getProperties(Clause C, Version V)
EnumSet< Property > Properties
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1933
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:878
#define N
LLVM_ABI Modifiers getModifiers(Version V) const
Descriptor< details::Clause > Base
LLVM_ABI ModifierSets getModifierSets(Version V) const
LLVM_ABI Directives getDirectives(Version V) const
LLVM_ABI Properties getProperties(Version V) const
SmallVector< Version > getVersions() const
const DetailsMap< DetailsTy > & getDetails() const
DetailsMap< DetailsTy > Details
Descriptor(StringRef N, DetailsMap< DetailsTy > &&D)
Descriptor(const Descriptor &)=default
Descriptor(Descriptor &&)=default
LLVM_ABI Clauses getClauses(Version V) const
Descriptor< details::ModifierSet > Base
LLVM_ABI Modifiers getModifiers(Version V) const
LLVM_ABI Properties getProperties(Version V) const
LLVM_ABI Clauses getClauses(Version V) const
Descriptor< details::Modifier > Base
LLVM_ABI Properties getProperties(Version V) const