forked from OSchip/llvm-project
parent
c7dab559ba
commit
4be7e8627f
|
@ -52,9 +52,6 @@ public:
|
|||
explicit Attribute(const llvm::Record *record);
|
||||
explicit Attribute(const llvm::DefInit *init);
|
||||
|
||||
// Returns true if this attribute has storage type set.
|
||||
bool hasStorageType() const;
|
||||
|
||||
// Returns the storage type if set. Returns the default storage type
|
||||
// ("Attribute") otherwise.
|
||||
StringRef getStorageType() const;
|
||||
|
@ -154,9 +151,6 @@ public:
|
|||
explicit EnumAttr(const llvm::Record &record);
|
||||
explicit EnumAttr(const llvm::DefInit *init);
|
||||
|
||||
// Returns true if this EnumAttr is backed by a StringAttr.
|
||||
bool isStrEnum() const;
|
||||
|
||||
// Returns the enum class name.
|
||||
StringRef getEnumClassName() const;
|
||||
|
||||
|
|
|
@ -59,9 +59,6 @@ public:
|
|||
// format if its dialect name is not empty.
|
||||
std::string getOperationName() const;
|
||||
|
||||
// Returns this op's C++ namespaces.
|
||||
StringRef getCppNamespaces() const;
|
||||
|
||||
// Returns this op's C++ class name.
|
||||
StringRef getCppClassName() const;
|
||||
|
||||
|
@ -106,13 +103,9 @@ public:
|
|||
llvm::iterator_range<attribute_iterator> getAttributes() const;
|
||||
|
||||
int getNumAttributes() const { return attributes.size(); }
|
||||
// Returns the total number of native attributes.
|
||||
int getNumNativeAttributes() const;
|
||||
int getNumDerivedAttributes() const;
|
||||
|
||||
// Op attribute accessors.
|
||||
NamedAttribute &getAttribute(int index) { return attributes[index]; }
|
||||
const NamedAttribute &getAttribute(int index) const;
|
||||
|
||||
// Op operand iterators.
|
||||
value_iterator operand_begin();
|
||||
|
@ -135,19 +128,11 @@ public:
|
|||
Argument getArg(int index) const;
|
||||
StringRef getArgName(int index) const;
|
||||
|
||||
// Returns the number of `PredOpTrait` traits.
|
||||
int getNumPredOpTraits() const;
|
||||
|
||||
// Returns true if this op has the given MLIR C++ `trait`.
|
||||
// TODO: We should add a C++ wrapper class for TableGen OpTrait instead of
|
||||
// requiring the raw MLIR trait here.
|
||||
bool hasTrait(llvm::StringRef trait) const;
|
||||
|
||||
using const_region_iterator = const NamedRegion *;
|
||||
const_region_iterator region_begin() const;
|
||||
const_region_iterator region_end() const;
|
||||
llvm::iterator_range<const_region_iterator> getRegions() const;
|
||||
|
||||
// Returns the number of regions.
|
||||
unsigned getNumRegions() const;
|
||||
// Returns the `index`-th region.
|
||||
|
|
|
@ -46,22 +46,6 @@ public:
|
|||
bool isVariadic() const;
|
||||
};
|
||||
|
||||
// Wrapper class providing helper methods for accessing MLIR Type defined
|
||||
// in TableGen. This class should closely reflect what is defined as
|
||||
// class Type in TableGen.
|
||||
class Type : public TypeConstraint {
|
||||
public:
|
||||
explicit Type(const llvm::Record *record);
|
||||
explicit Type(const llvm::DefInit *init);
|
||||
|
||||
// Returns the TableGen def name for this type.
|
||||
StringRef getTableGenDefName() const;
|
||||
|
||||
// Gets the base type of this variadic type constraint.
|
||||
// Precondition: isVariadic() is true.
|
||||
Type getVariadicBaseType() const;
|
||||
};
|
||||
|
||||
} // end namespace tblgen
|
||||
} // end namespace mlir
|
||||
|
||||
|
|
|
@ -67,11 +67,6 @@ bool tblgen::Attribute::isEnumAttr() const {
|
|||
return def->isSubClassOf("EnumAttrInfo");
|
||||
}
|
||||
|
||||
bool tblgen::Attribute::hasStorageType() const {
|
||||
const auto *init = def->getValueInit("storageType");
|
||||
return !getValueAsString(init).empty();
|
||||
}
|
||||
|
||||
StringRef tblgen::Attribute::getStorageType() const {
|
||||
const auto *init = def->getValueInit("storageType");
|
||||
auto type = getValueAsString(init);
|
||||
|
@ -175,10 +170,6 @@ tblgen::EnumAttr::EnumAttr(const llvm::Record &record) : Attribute(&record) {}
|
|||
tblgen::EnumAttr::EnumAttr(const llvm::DefInit *init)
|
||||
: EnumAttr(init->getDef()) {}
|
||||
|
||||
bool tblgen::EnumAttr::isStrEnum() const {
|
||||
return def->isSubClassOf("StrEnumAttr");
|
||||
}
|
||||
|
||||
StringRef tblgen::EnumAttr::getEnumClassName() const {
|
||||
return def->getValueAsString("className");
|
||||
}
|
||||
|
|
|
@ -62,10 +62,6 @@ std::string tblgen::Operator::getOperationName() const {
|
|||
|
||||
StringRef tblgen::Operator::getDialectName() const { return dialect.getName(); }
|
||||
|
||||
StringRef tblgen::Operator::getCppNamespaces() const {
|
||||
return dialect.getCppNamespace();
|
||||
}
|
||||
|
||||
StringRef tblgen::Operator::getCppClassName() const { return cppClassName; }
|
||||
|
||||
std::string tblgen::Operator::getQualCppClassName() const {
|
||||
|
@ -124,18 +120,6 @@ unsigned tblgen::Operator::getNumVariadicResults() const {
|
|||
[](const NamedTypeConstraint &c) { return c.constraint.isVariadic(); });
|
||||
}
|
||||
|
||||
int tblgen::Operator::getNumNativeAttributes() const {
|
||||
return numNativeAttributes;
|
||||
}
|
||||
|
||||
int tblgen::Operator::getNumDerivedAttributes() const {
|
||||
return getNumAttributes() - getNumNativeAttributes();
|
||||
}
|
||||
|
||||
const tblgen::NamedAttribute &tblgen::Operator::getAttribute(int index) const {
|
||||
return attributes[index];
|
||||
}
|
||||
|
||||
unsigned tblgen::Operator::getNumVariadicOperands() const {
|
||||
return std::count_if(
|
||||
operands.begin(), operands.end(),
|
||||
|
@ -147,12 +131,6 @@ StringRef tblgen::Operator::getArgName(int index) const {
|
|||
return argumentValues->getArgName(index)->getValue();
|
||||
}
|
||||
|
||||
int tblgen::Operator::getNumPredOpTraits() const {
|
||||
return std::count_if(traits.begin(), traits.end(), [](const OpTrait &trait) {
|
||||
return isa<tblgen::PredOpTrait>(&trait);
|
||||
});
|
||||
}
|
||||
|
||||
bool tblgen::Operator::hasTrait(StringRef trait) const {
|
||||
for (auto t : getTraits()) {
|
||||
if (auto opTrait = dyn_cast<tblgen::NativeOpTrait>(&t)) {
|
||||
|
@ -166,19 +144,6 @@ bool tblgen::Operator::hasTrait(StringRef trait) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
tblgen::Operator::const_region_iterator tblgen::Operator::region_begin() const {
|
||||
return regions.begin();
|
||||
}
|
||||
|
||||
tblgen::Operator::const_region_iterator tblgen::Operator::region_end() const {
|
||||
return regions.end();
|
||||
}
|
||||
|
||||
llvm::iterator_range<tblgen::Operator::const_region_iterator>
|
||||
tblgen::Operator::getRegions() const {
|
||||
return {region_begin(), region_end()};
|
||||
}
|
||||
|
||||
unsigned tblgen::Operator::getNumRegions() const { return regions.size(); }
|
||||
|
||||
const tblgen::NamedRegion &tblgen::Operator::getRegion(unsigned index) const {
|
||||
|
|
|
@ -36,17 +36,3 @@ tblgen::TypeConstraint::TypeConstraint(const llvm::DefInit *init)
|
|||
bool tblgen::TypeConstraint::isVariadic() const {
|
||||
return def->isSubClassOf("Variadic");
|
||||
}
|
||||
|
||||
tblgen::Type::Type(const llvm::Record *record) : TypeConstraint(record) {
|
||||
assert(def->isSubClassOf("Type") &&
|
||||
"must be subclass of TableGen 'Type' class");
|
||||
}
|
||||
|
||||
tblgen::Type::Type(const llvm::DefInit *init) : Type(init->getDef()) {}
|
||||
|
||||
StringRef tblgen::Type::getTableGenDefName() const { return def->getName(); }
|
||||
|
||||
tblgen::Type tblgen::Type::getVariadicBaseType() const {
|
||||
assert(isVariadic() && "must be variadic type constraint");
|
||||
return Type(def->getValueAsDef("baseType"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue