15#ifndef LLVM_FRONTEND_OPENMP_OMPCONTEXT_H
16#define LLVM_FRONTEND_OPENMP_OMPCONTEXT_H
34#define OMP_TRAIT_SET(Enum, ...) Enum,
35#include "llvm/Frontend/OpenMP/OMPKinds.def"
40#define OMP_TRAIT_SELECTOR(Enum, ...) Enum,
41#include "llvm/Frontend/OpenMP/OMPKinds.def"
46#define OMP_TRAIT_PROPERTY(Enum, ...) Enum,
47#define OMP_LAST_TRAIT_PROPERTY(Enum) Last = Enum
48#include "llvm/Frontend/OpenMP/OMPKinds.def"
108 bool &AllowsTraitScore,
109 bool &RequiresProperty);
125 APInt *Score =
nullptr) {
134 APInt *Score =
nullptr) {
140 if (Property == TraitProperty::device_isa___ANY)
144 if (Set == TraitSet::construct)
166 if (Set == TraitSet::construct)
185 bool DeviceSetOnly =
false);
202 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.
std::string listOpenMPContextTraitSets()
Return a string listing all trait sets.
StringRef getOpenMPContextTraitPropertyFullName(TraitProperty Kind)
Return a textual representation of the trait property Kind with selector and set name included.
bool isValidTraitSelectorForTraitSet(TraitSelector Selector, TraitSet Set, bool &AllowsTraitScore, bool &RequiresProperty)
}
TraitSet getOpenMPContextTraitSetForSelector(TraitSelector Selector)
Return the trait set for which Selector is a selector.
TraitSet getOpenMPContextTraitSetForProperty(TraitProperty Property)
Return the trait set for which Property is a property.
int getBestVariantMatchForContext(const SmallVectorImpl< VariantMatchInfo > &VMIs, const OMPContext &Ctx)
Return the index (into VMIs) of the variant with the highest score from the ones applicble in Ctx.
StringRef getOpenMPContextTraitSetName(TraitSet Kind)
Return a textual representation of the trait set Kind.
StringRef getOpenMPContextTraitPropertyName(TraitProperty Kind, StringRef RawString)
Return a textual representation of the trait property Kind, which might be the raw string we parsed (...
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...
StringRef getOpenMPContextTraitSelectorName(TraitSelector Kind)
Return a textual representation of the trait selector Kind.
TraitSelector getOpenMPContextTraitSelectorKind(StringRef Str)
Parse Str and return the trait set it matches or TraitSelector::invalid.
std::string listOpenMPContextTraitSelectors(TraitSet Set)
Return a string listing all trait selectors for Set.
TraitSet
OpenMP Context related IDs and helpers.
TraitSelector getOpenMPContextTraitSelectorForProperty(TraitProperty Property)
Return the trait selector for which Property is a property.
TraitProperty getOpenMPContextTraitPropertyForSelector(TraitSelector Selector)
Return the trait property for a singleton selector Selector.
TraitSelector
IDs for all OpenMP context selector trait (device={kind/isa...}/...).
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/...)
bool isVariantApplicableInContext(const VariantMatchInfo &VMI, const OMPContext &Ctx, bool DeviceSetOnly=false)
Return true if VMI is applicable in Ctx, that is, all traits required by VMI are available in the Ope...
bool isValidTraitPropertyForTraitSetAndSelector(TraitProperty Property, TraitSelector Selector, TraitSet Set)
Return true if Property can be nested in Selector and Set.
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