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
27static constexpr size_t Property_enumSize =
30
31enum class Modifier {
32#define GEN_OMP_MODIFIER_ENUMS
34#undef GEN_OMP_MODIFIER_ENUMS
35};
37static constexpr size_t Modifier_enumSize =
41enum class ModifierSet {
42#define GEN_OMP_MODIFIER_GROUP_ENUMS
43#define First_ FirstGroup_
44#define Last_ LastGroup_
46#undef Last_
47#undef First_
48#undef GEN_OMP_MODIFIER_GROUP_ENUMS
50#define GEN_OMP_MODIFIER_SET_ENUMS
51#define First_ FirstSet_
52#define Last_ LastSet_
54#undef Last_
55#undef First_
56#undef GEN_OMP_MODIFIER_SET_ENUMS
57 First_ = FirstGroup_,
58 Last_ = LastSet_,
59};
61static constexpr size_t ModifierSet_enumSize =
65constexpr inline bool isModifierGroup(ModifierSet S) {
66 return //
67 llvm::to_underlying(ModifierSet::FirstGroup_) <= llvm::to_underlying(S) &&
68 llvm::to_underlying(S) <= llvm::to_underlying(ModifierSet::LastGroup_);
77
78namespace descriptor {
79namespace details {
80struct Base {
82};
83
92struct Modifier : public Base {
94};
96struct ModifierSet : public Base {
99};
100} // namespace details
102template <typename DetailsTy> using DetailsMap = DenseMap<Version, DetailsTy>;
104template <typename DetailsTy> struct Descriptor {
105 Descriptor(const Descriptor &) = default;
106 Descriptor(Descriptor &&) = default;
110 StringRef getName() const { return Name; }
111 const DetailsMap<DetailsTy> &getDetails() const { return Details; }
122private:
125protected:
129struct Clause : public Descriptor<details::Clause> {
131 using Base::Base;
138struct Modifier : public Descriptor<details::Modifier> {
140 using Base::Base;
145struct ModifierSet : public Descriptor<details::ModifierSet> {
147 using Base::Base;
152} // namespace descriptor
154template <typename Enum, typename DescriptorTy>
157LLVM_ABI const descriptor::Clause &getDescriptor(llvm::omp::Clause C);
160
162} // namespace llvm::omp
163
164#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, Modifier_enumSize > Modifiers
LLVM_ABI const descriptor::Clause & getDescriptor(llvm::omp::Clause C)
constexpr bool isModifierGroup(ModifierSet S)
llvm::omp::ClauseSet Clauses
EnumSet< llvm::omp::Clause, llvm::omp::Clause_enumSize > ClauseSet
Definition OMP.h:153
LLVM_ABI ArrayRef< Version > getOpenMPVersions()
Definition OMP.cpp:211
static constexpr size_t Property_enumSize
static constexpr size_t Modifier_enumSize
static constexpr size_t ModifierSet_enumSize
EnumSet< Property, Property_enumSize > Properties
EnumSet< ModifierSet, ModifierSet_enumSize > ModifierSets
DenseMap< Enum, DescriptorTy > DescriptorMap
LLVM_ABI Properties getProperties(Clause C, Version V)
EnumSet< llvm::omp::Directive, llvm::omp::Directive_enumSize > DirectiveSet
Definition OMP.h:154
llvm::omp::DirectiveSet Directives
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:1917
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