15#ifndef LLVM_FRONTEND_OPENMP_OMPCONTEXT_H
16#define LLVM_FRONTEND_OPENMP_OMPCONTEXT_H
35#define OMP_TRAIT_SET(Enum, ...) Enum,
36#include "llvm/Frontend/OpenMP/OMPKinds.def"
41#define OMP_TRAIT_SELECTOR(Enum, ...) Enum,
42#include "llvm/Frontend/OpenMP/OMPKinds.def"
47#define OMP_TRAIT_PROPERTY(Enum, ...) Enum,
48#define OMP_LAST_TRAIT_PROPERTY(Enum) Last = Enum
49#include "llvm/Frontend/OpenMP/OMPKinds.def"
113 bool &AllowsTraitScore,
114 bool &RequiresProperty);
130 APInt *Score =
nullptr) {
139 APInt *Score =
nullptr) {
145 if (Property == TraitProperty::device_isa___ANY)
147 if (Property == TraitProperty::target_device_isa___ANY)
151 if (Set == TraitSet::construct)
166 Triple TargetOffloadTriple,
int DeviceNum);
174 if (Set == TraitSet::construct)
194 bool DeviceOrImplementationSetOnly =
false);
212 return std::hash<unsigned>{}(
unsigned(val));
This file implements a class to represent arbitrary precision integral constant values and operations...
This file implements the BitVector class.
This file defines DenseMapInfo traits for DenseMap.
This file defines the DenseMap class.
This file defines constans and helpers used when dealing with OpenMP.
Class for arbitrary precision integers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
LLVM_ABI std::string listOpenMPContextTraitSets()
Return a string listing all trait sets.
LLVM_ABI StringRef getOpenMPContextTraitPropertyFullName(TraitProperty Kind)
Return a textual representation of the trait property Kind with selector and set name included.
LLVM_ABI bool isValidTraitSelectorForTraitSet(TraitSelector Selector, TraitSet Set, bool &AllowsTraitScore, bool &RequiresProperty)
}
LLVM_ABI TraitSet getOpenMPContextTraitSetForSelector(TraitSelector Selector)
Return the trait set for which Selector is a selector.
LLVM_ABI TraitSelector getOpenMPContextTraitSelectorKind(StringRef Str, TraitSet Set)
Parse Str and return the trait set it matches or TraitSelector::invalid.
LLVM_ABI TraitSet getOpenMPContextTraitSetForProperty(TraitProperty Property)
Return the trait set for which Property is a property.
LLVM_ABI int getBestVariantMatchForContext(const SmallVectorImpl< VariantMatchInfo > &VMIs, const OMPContext &Ctx)
Return the index (into VMIs) of the variant with the highest score from the ones applicable in Ctx.
LLVM_ABI StringRef getOpenMPContextTraitSetName(TraitSet Kind)
Return a textual representation of the trait set Kind.
LLVM_ABI StringRef getOpenMPContextTraitPropertyName(TraitProperty Kind, StringRef RawString)
Return a textual representation of the trait property Kind, which might be the raw string we parsed (...
LLVM_ABI TraitProperty getOpenMPContextTraitPropertyKind(TraitSet Set, TraitSelector Selector, StringRef Str)
Parse Str and return the trait property it matches in the set Set and selector Selector or TraitPrope...
LLVM_ABI StringRef getOpenMPContextTraitSelectorName(TraitSelector Kind)
Return a textual representation of the trait selector Kind.
LLVM_ABI std::string listOpenMPContextTraitSelectors(TraitSet Set)
Return a string listing all trait selectors for Set.
TraitSet
OpenMP Context related IDs and helpers.
LLVM_ABI TraitSelector getOpenMPContextTraitSelectorForProperty(TraitProperty Property)
Return the trait selector for which Property is a property.
LLVM_ABI TraitProperty getOpenMPContextTraitPropertyForSelector(TraitSelector Selector)
Return the trait property for a singleton selector Selector.
TraitSelector
IDs for all OpenMP context selector trait (device={kind/isa...}/...).
LLVM_ABI bool isVariantApplicableInContext(const VariantMatchInfo &VMI, const OMPContext &Ctx, bool DeviceOrImplementationSetOnly=false)
Return true if VMI is applicable in Ctx, that is, all traits required by VMI are available in the Ope...
LLVM_ABI TraitSet getOpenMPContextTraitSetKind(StringRef Str)
Parse Str and return the trait set it matches or TraitSet::invalid.
TraitProperty
IDs for all OpenMP context trait properties (host/gpu/bsc/llvm/...)
LLVM_ABI bool isValidTraitPropertyForTraitSetAndSelector(TraitProperty Property, TraitSelector Selector, TraitSet Set)
Return true if Property can be nested in Selector and Set.
LLVM_ABI std::string listOpenMPContextTraitProperties(TraitSet Set, TraitSelector Selector)
Return a string listing all trait properties for Set and Selector.
This is an optimization pass for GlobalISel generic memory operations.
static unsigned getHashValue(omp::TraitProperty val)
static omp::TraitProperty getTombstoneKey()
static bool isEqual(omp::TraitProperty LHS, omp::TraitProperty RHS)
static omp::TraitProperty getEmptyKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
The context for a source location is made up of active property traits, e.g., device={kind(host)},...
virtual bool matchesISATrait(StringRef) const
Hook for users to check if an ISA trait matches.
virtual ~OMPContext()=default
void addTrait(TraitProperty Property)
SmallVector< TraitProperty, 8 > ConstructTraits
void addTrait(TraitSet Set, TraitProperty Property)
Variant match information describes the required traits and how they are scored (via the ScoresMap).
SmallVector< StringRef, 8 > ISATraits
void addTrait(TraitProperty Property, StringRef RawString, APInt *Score=nullptr)
Add the trait Property to the required trait set.
SmallVector< TraitProperty, 8 > ConstructTraits
void addTrait(TraitSet Set, TraitProperty Property, StringRef RawString, APInt *Score=nullptr)
Add the trait Property which is in set Set to the required trait set.
SmallDenseMap< TraitProperty, APInt > ScoreMap