Lines Matching +full:bool +full:- +full:property

1 //===- OMPContext.cpp ------ Collection of helpers for OpenMP contexts ----===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
22 #define DEBUG_TYPE "openmp-ir-builder"
27 OMPContext::OMPContext(bool IsDeviceCompilation, Triple TargetTriple) {
90 TraitProperty Property = TraitProperty(Bit);
91 dbgs() << "\t " << getOpenMPContextTraitPropertyFullName(Property)
99 template <typename T> static bool isSubset(ArrayRef<T> C0, ArrayRef<T> C1) {
124 static bool isStrictSubset(ArrayRef<T> C0, ArrayRef<T> C1) {
130 static bool isStrictSubset(const VariantMatchInfo &VMI0,
147 SmallVectorImpl<unsigned> *ConstructMatches, bool DeviceSetOnly) {
163 // Helper to deal with a single property that was (not) found in the OpenMP
166 auto HandleTrait = [MK](TraitProperty Property,
167 bool WasFound) -> std::optional<bool> /* Result */ {
168 // For kind "any" a single match is enough but we ignore non-matched
176 // In "all" or "none" mode we accept a matching or non-matching property
181 // We missed a property, provide some debug output and indicate failure.
184 dbgs() << "[" << DEBUG_TYPE << "] Property "
185 << getOpenMPContextTraitPropertyName(Property, "")
188 dbgs() << "[" << DEBUG_TYPE << "] Property "
189 << getOpenMPContextTraitPropertyName(Property, "")
196 TraitProperty Property = TraitProperty(Bit);
198 getOpenMPContextTraitSetForProperty(Property) != TraitSet::device)
203 if (getOpenMPContextTraitSelectorForProperty(Property) ==
207 bool IsActiveTrait = Ctx.ActiveTraits.test(unsigned(Property));
211 if (Property == TraitProperty::device_isa___ANY)
216 if (std::optional<bool> Result = HandleTrait(Property, IsActiveTrait))
224 for (TraitProperty Property : VMI.ConstructTraits) {
225 assert(getOpenMPContextTraitSetForProperty(Property) ==
227 "Variant context is ill-formed!");
230 bool FoundInOrder = false;
232 FoundInOrder = (Ctx.ConstructTraits[ConstructIdx++] == Property);
234 ConstructMatches->push_back(ConstructIdx - 1);
236 if (std::optional<bool> Result = HandleTrait(Property, FoundInOrder))
240 LLVM_DEBUG(dbgs() << "[" << DEBUG_TYPE << "] Construct property "
241 << getOpenMPContextTraitPropertyName(Property, "")
263 bool llvm::omp::isVariantApplicableInContext(const VariantMatchInfo &VMI,
265 bool DeviceSetOnly) {
277 TraitProperty Property = TraitProperty(Bit);
279 if (VMI.ScoreMap.count(Property)) {
280 const APInt &UserScore = VMI.ScoreMap.lookup(Property);
281 assert(UserScore.uge(0) && "Expect non-negative user scores!");
286 switch (getOpenMPContextTraitSetForProperty(Property)) {
305 if (Property == TraitProperty::device_kind_any)
308 switch (getOpenMPContextTraitSelectorForProperty(Property)) {
326 for (TraitProperty Property : VMI.ConstructTraits) {
327 assert(getOpenMPContextTraitSetForProperty(Property) ==
329 "Ill-formed variant match info!");
330 (void)Property;
331 // ConstructMatches is the position p - 1 and we need 2^(p-1).
344 int BestVMIIdx = -1;
395 llvm::omp::getOpenMPContextTraitSetForProperty(TraitProperty Property) {
396 switch (Property) {
422 llvm::omp::getOpenMPContextTraitSelectorForProperty(TraitProperty Property) {
423 switch (Property) {
474 llvm_unreachable("Unknown trait property!");
483 llvm_unreachable("Unknown trait property!");
486 bool llvm::omp::isValidTraitSelectorForTraitSet(TraitSelector Selector,
488 bool &AllowsTraitScore,
489 bool &RequiresProperty) {
501 bool llvm::omp::isValidTraitPropertyForTraitSetAndSelector(
502 TraitProperty Property, TraitSelector Selector, TraitSet Set) {
503 switch (Property) {
510 llvm_unreachable("Unknown trait property!");