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 =
47namespace descriptor {
48namespace details {
49struct Base {
51};
53struct Clause : public Base {
56 SourceLanguage Langs;
58};
60struct Modifier : public Base {
62};
63} // namespace details
65template <typename DetailsTy> using DetailsMap = DenseMap<unsigned, DetailsTy>;
67template <typename DetailsTy> struct Descriptor {
68 Descriptor(const Descriptor &) = default;
69 Descriptor(Descriptor &&) = default;
73 StringRef getName() const { return Name; }
74 const DetailsMap<DetailsTy> &getDetails() const { return Details; }
78 for (unsigned V : llvm::omp::getOpenMPVersions()) {
79 if (auto F = Details.find(V); F != Details.end())
80 Vs.push_back(V);
81 }
82 return Vs;
83 }
84
85private:
86 StringRef Name;
87
88protected:
90};
92struct Clause : public Descriptor<details::Clause> {
94 using Base::Base;
97 LLVM_ABI Modifiers getModifiers(unsigned V) const;
98};
100struct Modifier : public Descriptor<details::Modifier> {
102 using Base::Base;
104 LLVM_ABI Clauses getClauses(unsigned V) const;
106} // namespace descriptor
108template <typename Enum, typename DescriptorTy>
111LLVM_ABI const descriptor::Clause &getDescriptor(llvm::omp::Clause C);
115} // namespace llvm::omp
117#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< unsigned, DetailsTy > DetailsMap
LLVM_ABI ArrayRef< unsigned > getOpenMPVersions()
Definition OMP.cpp:212
EnumSet< Modifier, Modifier_enumSize > Modifiers
LLVM_ABI const descriptor::Clause & getDescriptor(llvm::omp::Clause C)
llvm::omp::ClauseSet Clauses
EnumSet< llvm::omp::Clause, llvm::omp::Clause_enumSize > ClauseSet
Definition OMP.h:150
static constexpr size_t Property_enumSize
static constexpr size_t Modifier_enumSize
EnumSet< Property, Property_enumSize > Properties
LLVM_ABI Properties getProperties(Clause C, unsigned Version)
DenseMap< Enum, DescriptorTy > DescriptorMap
EnumSet< llvm::omp::Directive, llvm::omp::Directive_enumSize > DirectiveSet
Definition OMP.h:151
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 Properties getProperties(unsigned V) const
Descriptor< details::Clause > Base
LLVM_ABI Modifiers getModifiers(unsigned V) const
LLVM_ABI Directives getDirectives(unsigned V) const
const DetailsMap< DetailsTy > & getDetails() const
DetailsMap< DetailsTy > Details
Descriptor(StringRef N, DetailsMap< DetailsTy > &&D)
SmallVector< unsigned > getVersions() const
Descriptor(const Descriptor &)=default
Descriptor(Descriptor &&)=default
LLVM_ABI Clauses getClauses(unsigned V) const
LLVM_ABI Properties getProperties(unsigned V) const
Descriptor< details::Modifier > Base