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
20#define Unassociated None
21
22namespace llvm::omp {
23enum class Property {
24#define GEN_OMP_PROPERTY_ENUMS
26#undef GEN_OMP_PROPERTY_ENUMS
27};
28
29enum class ClauseSet {
30#define GEN_OMP_CLAUSE_GROUP_ENUMS
31#define First_ FirstGroup_
32#define Last_ LastGroup_
34#undef Last_
35#undef First_
36#undef GEN_OMP_CLAUSE_GROUP_ENUMS
38#define GEN_OMP_CLAUSE_SET_ENUMS
39#define First_ FirstSet_
40#define Last_ LastSet_
42#undef Last_
43#undef First_
44#undef GEN_OMP_CLAUSE_SET_ENUMS
45 First_ = FirstGroup_,
46 Last_ = LastSet_,
47};
49constexpr inline bool isClauseGroup(ClauseSet S) {
50 return //
51 llvm::to_underlying(ClauseSet::FirstGroup_) <= llvm::to_underlying(S) &&
52 llvm::to_underlying(S) <= llvm::to_underlying(ClauseSet::LastGroup_);
55enum class Modifier {
56#define GEN_OMP_MODIFIER_ENUMS
58#undef GEN_OMP_MODIFIER_ENUMS
59};
61enum class ModifierSet {
62#define GEN_OMP_MODIFIER_GROUP_ENUMS
63#define First_ FirstGroup_
64#define Last_ LastGroup_
66#undef Last_
67#undef First_
68#undef GEN_OMP_MODIFIER_GROUP_ENUMS
70#define GEN_OMP_MODIFIER_SET_ENUMS
71#define First_ FirstSet_
72#define Last_ LastSet_
74#undef Last_
75#undef First_
76#undef GEN_OMP_MODIFIER_SET_ENUMS
77 First_ = FirstGroup_,
78 Last_ = LastSet_,
79};
81constexpr inline bool isModifierGroup(ModifierSet S) {
82 return //
83 llvm::to_underlying(ModifierSet::FirstGroup_) <= llvm::to_underlying(S) &&
84 llvm::to_underlying(S) <= llvm::to_underlying(ModifierSet::LastGroup_);
92namespace descriptor {
93namespace details {
94struct Base {
96};
98struct Clause : public Base {
101 SourceLanguage Langs;
106struct ClauseSet : public Base {
111struct Directive : public Base {
113 Association Assoc;
114 Category Cat;
119struct Modifier : public Base {
123struct ModifierSet : public Base {
127} // namespace details
129template <typename DetailsTy> using DetailsMap = DenseMap<Version, DetailsTy>;
131template <typename DetailsTy> struct Descriptor {
132 Descriptor(const Descriptor &) = default;
133 Descriptor(Descriptor &&) = default;
137 StringRef getName() const { return Name; }
138 const DetailsMap<DetailsTy> &getDetails() const { return Details; }
139
142 for (Version V : getOpenMPVersions()) {
143 if (auto F = Details.find(V); F != Details.end())
144 Vs.push_back(V);
145 }
146 return Vs;
147 }
148
149private:
150 StringRef Name;
151
152protected:
154};
155
156struct Clause : public Descriptor<details::Clause> {
158 using Base::Base;
163};
164
165struct ClauseSet : public Descriptor<details::ClauseSet> {
167 using Base::Base;
173struct Directive : public Descriptor<details::Directive> {
175 using Base::Base;
177 LLVM_ABI Association getAssociation(Version V) const;
178 LLVM_ABI Category getCategory(Version V) const;
181};
182
183struct Modifier : public Descriptor<details::Modifier> {
185 using Base::Base;
188};
189
190struct ModifierSet : public Descriptor<details::ModifierSet> {
192 using Base::Base;
196};
197} // namespace descriptor
198
199template <typename Enum, typename DescriptorTy>
201
207
209} // namespace llvm::omp
210
211#undef Unassociated
212#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:211
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< ClauseSet > ClauseSets
EnumSet< Clause > Clauses
Definition OMP.h:158
EnumSet< ModifierSet > ModifierSets
LLVM_ABI ArrayRef< Version > getOpenMPVersions()
Definition OMP.cpp:211
DenseMap< Enum, DescriptorTy > DescriptorMap
constexpr bool isClauseGroup(ClauseSet S)
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 Clauses getClauses(Version V) const
Descriptor< details::ClauseSet > Base
LLVM_ABI Directives getDirectives(Version V) const
LLVM_ABI Properties getProperties(Version V) const
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 Association getAssociation(Version V) const
LLVM_ABI Clauses getClauses(Version V) const
LLVM_ABI ClauseSets getClauseSets(Version V) const
LLVM_ABI Properties getProperties(Version V) const
LLVM_ABI Category getCategory(Version V) const
Descriptor< details::Directive > Base
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