Go to the documentation of this file.
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));
210 #endif // LLVM_FRONTEND_OPENMP_OMPCONTEXT_H
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.
This is an optimization pass for GlobalISel generic memory operations.
static omp::TraitProperty getEmptyKey()
Variant match information describes the required traits and how they are scored (via the ScoresMap).
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TraitProperty getOpenMPContextTraitPropertyForSelector(TraitSelector Selector)
Return the trait property for a singleton selector Selector.
SmallDenseMap< TraitProperty, APInt > ScoreMap
Triple - Helper class for working with autoconf configuration names.
virtual bool matchesISATrait(StringRef) const
Hook for users to check if an ISA trait matches.
TraitSelector getOpenMPContextTraitSelectorKind(StringRef Str)
Parse Str and return the trait set it matches or TraitSelector::invalid.
static unsigned getHashValue(omp::TraitProperty val)
TraitSet
OpenMP Context related IDs and helpers.
An information struct used to provide DenseMap with the various necessary components for a given valu...
virtual ~OMPContext()=default
StringRef getOpenMPContextTraitSetName(TraitSet Kind)
Return a textual representation of the trait set Kind.
SmallVector< TraitProperty, 8 > ConstructTraits
OMPContext(bool IsDeviceCompilation, Triple TargetTriple)
std::string listOpenMPContextTraitProperties(TraitSet Set, TraitSelector Selector)
Return a string listing all trait properties for Set and Selector.
StringRef getOpenMPContextTraitSelectorName(TraitSelector Kind)
Return a textual representation of the trait selector Kind.
The initial backend is deliberately restricted to z10 We should add support for later architectures at some point If an asm ties an i32 r result to an i64 the input will be treated as an leaving the upper bits uninitialised For i64 store i32 val
std::string listOpenMPContextTraitSelectors(TraitSet Set)
Return a string listing all trait selectors for Set.
TraitSet getOpenMPContextTraitSetForSelector(TraitSelector Selector)
Return the trait set for which Selector is a selector.
std::string listOpenMPContextTraitSets()
Return a string listing all trait sets.
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...
SmallVector< TraitProperty, 8 > ConstructTraits
TraitProperty
IDs for all OpenMP context trait properties (host/gpu/bsc/llvm/...)
void addTrait(TraitSet Set, TraitProperty Property)
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...
Class for arbitrary precision integers.
The context for a source location is made up of active property traits, e.g., device={kind(host)},...
StringRef - Represent a constant reference to a string, i.e.
TraitSet getOpenMPContextTraitSetForProperty(TraitProperty Property)
Return the trait set for which Property is a property.
void addTrait(TraitProperty Property)
bool isValidTraitPropertyForTraitSetAndSelector(TraitProperty Property, TraitSelector Selector, TraitSet Set)
Return true if Property can be nested in Selector and Set.
void addTrait(TraitProperty Property, StringRef RawString, APInt *Score=nullptr)
Add the trait Property to the required trait set.
TraitSelector getOpenMPContextTraitSelectorForProperty(TraitProperty Property)
Return the trait selector for which Property is a property.
TraitSelector
IDs for all OpenMP context selector trait (device={kind/isa...}/...).
static bool isEqual(omp::TraitProperty LHS, omp::TraitProperty RHS)
StringRef getOpenMPContextTraitPropertyName(TraitProperty Kind, StringRef RawString)
Return a textual representation of the trait property Kind, which might be the raw string we parsed (...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool isValidTraitSelectorForTraitSet(TraitSelector Selector, TraitSet Set, bool &AllowsTraitScore, bool &RequiresProperty)
}
static omp::TraitProperty getTombstoneKey()
TraitSet getOpenMPContextTraitSetKind(StringRef Str)
Parse Str and return the trait set it matches or TraitSet::invalid.
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 getOpenMPContextTraitPropertyFullName(TraitProperty Kind)
Return a textual representation of the trait property Kind with selector and set name included.
SmallVector< StringRef, 8 > ISATraits