13 #ifndef MLIR_DIALECT_TOSA_IR_TARGETENV_H
14 #define MLIR_DIALECT_TOSA_IR_TARGETENV_H
18 #include "llvm/ADT/SmallSet.h"
30 enabledProfiles.insert_range(profiles);
32 enabledExtensions.insert_range(extensions);
35 void addProfile(Profile p) { enabledProfiles.insert(p); }
43 bool allows(Profile prof)
const {
return enabledProfiles.count(prof) != 0; }
46 const auto *chosen = llvm::find_if(
47 profs, [
this](tosa::Profile prof) {
return allows(prof); });
48 return chosen != profs.end() ? true :
false;
52 bool is_allowed =
true;
54 [&](tosa::Profile prof) { is_allowed &=
allows(prof); });
59 bool allows(Extension ext)
const {
return enabledExtensions.count(ext) != 0; }
62 const auto *chosen = llvm::find_if(
63 exts, [
this](tosa::Extension ext) {
return allows(ext); });
64 return chosen != exts.end() ? true :
false;
68 bool is_allowed =
true;
70 [&](tosa::Extension ext) { is_allowed &=
allows(ext); });
75 llvm::SmallSet<Profile, 3> enabledProfiles;
76 llvm::SmallSet<Extension, 8> enabledExtensions;
This class represents the capability enabled in the target implementation such as profile,...
void addExtension(Extension e)
bool allowsAllOf(ArrayRef< Extension > exts) const
TargetEnv(const SmallVectorImpl< Profile > &profiles, const SmallVectorImpl< Extension > &extensions)
void addProfile(Profile p)
bool allowsAllOf(ArrayRef< Profile > profs) const
bool allows(Profile prof) const
bool allows(Extension ext) const
bool allowsAnyOf(ArrayRef< Profile > profs) const
bool allowsAnyOf(ArrayRef< Extension > exts) const
Include the generated interface declarations.