LLVM 20.0.0git
Macros | Functions
OMPContext.cpp File Reference

This file implements helper functions and classes to deal with OpenMP contexts as used by [begin/end] declare variant and metadirective. More...

#include "llvm/Frontend/OpenMP/OMPContext.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Frontend/OpenMP/OMPKinds.def"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "openmp-ir-builder"
 
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
 
#define OMP_TRAIT_SET(Enum, Str)   .Case(Str, TraitSet::Enum)
 
#define OMP_TRAIT_SELECTOR(Enum, TraitSetEnum, Str, ReqProp)
 
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
 
#define OMP_TRAIT_SET(Enum, Str)
 
#define OMP_TRAIT_SELECTOR(Enum, TraitSetEnum, Str, ReqProp)    .Case(Str, TraitSelector::Enum)
 
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
 
#define OMP_TRAIT_SELECTOR(Enum, TraitSetEnum, Str, ReqProp)
 
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
 
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
 
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
 
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
 
#define OMP_TRAIT_SELECTOR(Enum, TraitSetEnum, Str, ReqProp)
 
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
 
#define OMP_TRAIT_SET(Enum, Str)
 
#define OMP_TRAIT_SELECTOR(Enum, TraitSetEnum, Str, ReqProp)
 
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
 

Functions

template<typename T >
static bool isSubset (ArrayRef< T > C0, ArrayRef< T > C1)
 Return true if C0 is a subset of C1.
 
template<typename T >
static bool isStrictSubset (ArrayRef< T > C0, ArrayRef< T > C1)
 Return true if C0 is a strict subset of C1.
 
static bool isStrictSubset (const VariantMatchInfo &VMI0, const VariantMatchInfo &VMI1)
 
static int isVariantApplicableInContextHelper (const VariantMatchInfo &VMI, const OMPContext &Ctx, SmallVectorImpl< unsigned > *ConstructMatches, bool DeviceSetOnly)
 
static APInt getVariantMatchScore (const VariantMatchInfo &VMI, const OMPContext &Ctx, SmallVectorImpl< unsigned > &ConstructMatches)
 

Detailed Description

This file implements helper functions and classes to deal with OpenMP contexts as used by [begin/end] declare variant and metadirective.

Definition in file OMPContext.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "openmp-ir-builder"

Definition at line 22 of file OMPContext.cpp.

◆ OMP_TRAIT_PROPERTY [1/9]

#define OMP_TRAIT_PROPERTY (   Enum,
  TraitSetEnum,
  TraitSelectorEnum,
  Str 
)
Value:
if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch) { \
if (TargetTriple.getArch() == TargetTriple.getArchTypeForLLVMName(Str)) \
ActiveTraits.set(unsigned(TraitProperty::Enum)); \
if (StringRef(Str) == "x86_64" && \
TargetTriple.getArch() == Triple::x86_64) \
ActiveTraits.set(unsigned(TraitProperty::Enum)); \
}
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50

◆ OMP_TRAIT_PROPERTY [2/9]

#define OMP_TRAIT_PROPERTY (   Enum,
  TraitSetEnum,
  TraitSelectorEnum,
  Str 
)
Value:
case TraitProperty::Enum: \
return TraitSet::TraitSetEnum;

◆ OMP_TRAIT_PROPERTY [3/9]

#define OMP_TRAIT_PROPERTY (   Enum,
  TraitSetEnum,
  TraitSelectorEnum,
  Str 
)
Value:
case TraitProperty::Enum: \
return TraitSelector::TraitSelectorEnum;

◆ OMP_TRAIT_PROPERTY [4/9]

#define OMP_TRAIT_PROPERTY (   Enum,
  TraitSetEnum,
  TraitSelectorEnum,
  Str 
)
Value:
if (Set == TraitSet::TraitSetEnum && Str == S) \
return TraitProperty::Enum;

◆ OMP_TRAIT_PROPERTY [5/9]

#define OMP_TRAIT_PROPERTY (   Enum,
  TraitSetEnum,
  TraitSelectorEnum,
  Str 
)
Value:
.Case(Str, Selector == TraitSelector::TraitSelectorEnum \
? TraitProperty::Enum \
: TraitProperty::invalid)

◆ OMP_TRAIT_PROPERTY [6/9]

#define OMP_TRAIT_PROPERTY (   Enum,
  TraitSetEnum,
  TraitSelectorEnum,
  Str 
)
Value:
case TraitProperty::Enum: \
return Str;

◆ OMP_TRAIT_PROPERTY [7/9]

#define OMP_TRAIT_PROPERTY (   Enum,
  TraitSetEnum,
  TraitSelectorEnum,
  Str 
)
Value:
case TraitProperty::Enum: \
return "(" #TraitSetEnum "," #TraitSelectorEnum "," Str ")";

◆ OMP_TRAIT_PROPERTY [8/9]

#define OMP_TRAIT_PROPERTY (   Enum,
  TraitSetEnum,
  TraitSelectorEnum,
  Str 
)
Value:
case TraitProperty::Enum: \
return Set == TraitSet::TraitSetEnum && \
Selector == TraitSelector::TraitSelectorEnum;

◆ OMP_TRAIT_PROPERTY [9/9]

#define OMP_TRAIT_PROPERTY (   Enum,
  TraitSetEnum,
  TraitSelectorEnum,
  Str 
)
Value:
if (TraitSet::TraitSetEnum == Set && \
TraitSelector::TraitSelectorEnum == Selector && \
StringRef(Str) != "invalid") \
S.append("'").append(Str).append("'").append(" ");

◆ OMP_TRAIT_SELECTOR [1/5]

#define OMP_TRAIT_SELECTOR (   Enum,
  TraitSetEnum,
  Str,
  ReqProp 
)
Value:
case TraitSelector::Enum: \
return TraitSet::TraitSetEnum;

◆ OMP_TRAIT_SELECTOR [2/5]

#define OMP_TRAIT_SELECTOR (   Enum,
  TraitSetEnum,
  Str,
  ReqProp 
)     .Case(Str, TraitSelector::Enum)

◆ OMP_TRAIT_SELECTOR [3/5]

#define OMP_TRAIT_SELECTOR (   Enum,
  TraitSetEnum,
  Str,
  ReqProp 
)
Value:
case TraitSelector::Enum: \
return Str;

◆ OMP_TRAIT_SELECTOR [4/5]

#define OMP_TRAIT_SELECTOR (   Enum,
  TraitSetEnum,
  Str,
  ReqProp 
)
Value:
case TraitSelector::Enum: \
RequiresProperty = ReqProp; \
return Set == TraitSet::TraitSetEnum;

◆ OMP_TRAIT_SELECTOR [5/5]

#define OMP_TRAIT_SELECTOR (   Enum,
  TraitSetEnum,
  Str,
  ReqProp 
)
Value:
if (TraitSet::TraitSetEnum == Set && StringRef(Str) != "Invalid") \
S.append("'").append(Str).append("'").append(" ");

◆ OMP_TRAIT_SET [1/3]

#define OMP_TRAIT_SET (   Enum,
  Str 
)    .Case(Str, TraitSet::Enum)

◆ OMP_TRAIT_SET [2/3]

#define OMP_TRAIT_SET (   Enum,
  Str 
)
Value:
case TraitSet::Enum: \
return Str;

◆ OMP_TRAIT_SET [3/3]

#define OMP_TRAIT_SET (   Enum,
  Str 
)
Value:
if (StringRef(Str) != "invalid") \
S.append("'").append(Str).append("'").append(" ");

Function Documentation

◆ getVariantMatchScore()

static APInt getVariantMatchScore ( const VariantMatchInfo VMI,
const OMPContext Ctx,
SmallVectorImpl< unsigned > &  ConstructMatches 
)
static

◆ isStrictSubset() [1/2]

template<typename T >
static bool isStrictSubset ( ArrayRef< T C0,
ArrayRef< T C1 
)
static

Return true if C0 is a strict subset of C1.

Note that both arrays are expected to be sorted.

Definition at line 124 of file OMPContext.cpp.

References llvm::ArrayRef< T >::size().

Referenced by llvm::omp::getBestVariantMatchForContext().

◆ isStrictSubset() [2/2]

static bool isStrictSubset ( const VariantMatchInfo VMI0,
const VariantMatchInfo VMI1 
)
static

◆ isSubset()

template<typename T >
static bool isSubset ( ArrayRef< T C0,
ArrayRef< T C1 
)
static

Return true if C0 is a subset of C1.

Note that both arrays are expected to be sorted.

Definition at line 99 of file OMPContext.cpp.

References assert(), llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::end(), llvm::is_sorted(), and llvm::ArrayRef< T >::size().

◆ isVariantApplicableInContextHelper()

static int isVariantApplicableInContextHelper ( const VariantMatchInfo VMI,
const OMPContext Ctx,
SmallVectorImpl< unsigned > *  ConstructMatches,
bool  DeviceSetOnly 
)
static