14#include "llvm/TableGen/Error.h"
15#include "llvm/TableGen/Record.h"
22 for (StringRef dialect : def->getValueAsListOfStrings(
"dependentDialects"))
23 dependentDialects.push_back(dialect);
29 return def->getValueAsString(
"cppNamespace");
34 std::string cppName = def->getName().str();
35 llvm::erase(cppName,
'_');
40 StringRef fieldName) {
41 if (
auto *valueInit = record.getValueInit(fieldName)) {
42 if (llvm::isa<llvm::StringInit>(valueInit))
43 return record.getValueAsString(fieldName);
57 return dependentDialects;
61 auto value = def->getValueAsString(
"extraClassDeclaration");
62 return value.empty() ? std::optional<StringRef>() : value;
66 return def->getValueAsBit(
"useStrictPropertiesInAssemblyFormat");
70 return def->getValueAsBit(
"hasCanonicalizer");
74 return def->getValueAsBit(
"hasConstantMaterializer");
78 return def->getValueAsBit(
"hasNonDefaultDestructor");
82 return def->getValueAsBit(
"hasOperationAttrVerify");
86 return def->getValueAsBit(
"hasRegionArgAttrVerify");
90 return def->getValueAsBit(
"hasRegionResultAttrVerify");
94 return def->getValueAsBit(
"hasOperationInterfaceFallback");
98 return def->getValueAsBit(
"hasInitializer");
102 return def->getValueAsBit(
"useDefaultAttributeRegistration");
106 return def->getValueAsBit(
"useDefaultTypeRegistration");
110 return def->getValueAsBit(
"useDefaultOperationRegistration");
114 return def->getValueAsBit(
"useDefaultAttributePrinterParser");
118 return def->getValueAsBit(
"useDefaultTypePrinterParser");
122 return def->getValueAsBit(
"isExtensible");
126 return def->getValueAsDag(
"discardableAttrs");
130 return def == other.def;
static StringRef getAsStringOrEmpty(const llvm::Record &record, StringRef fieldName)
Dialect(StringRef name, MLIRContext *context, TypeID id)
The constructor takes a unique namespace for this dialect as well as the context to bind to.
bool useDefaultOperationRegistration() const
Returns true if the generated dialect constructor should register the operations of this dialect defi...
StringRef getDescription() const
bool useDefaultTypeRegistration() const
Returns true if the generated dialect constructor should register the types of this dialect defined i...
Dialect(const llvm::Record *def)
StringRef getSummary() const
std::optional< StringRef > getExtraClassDeclaration() const
ArrayRef< StringRef > getDependentDialects() const
bool useDefaultAttributeRegistration() const
Returns true if the generated dialect constructor should register the attributes of this dialect defi...
const llvm::DagInit * getDiscardableAttributes() const
bool hasRegionArgAttrVerify() const
Returns true if this dialect has a region argument attribute verifier.
bool hasNonDefaultDestructor() const
Returns true if the destructor definition is provided explicitly or false if a default should be gene...
StringRef getCppNamespace() const
bool useDefaultAttributePrinterParser() const
Returns true if this dialect should generate the default dispatch for attribute printing/parsing.
bool isExtensible() const
Returns true if this dialect can be extended at runtime with new operations or types.
StringRef getName() const
bool hasOperationInterfaceFallback() const
Returns true if this dialect has fallback interfaces for its operations.
bool hasInitializer() const
Returns true if this dialect has an initialize method that the generated dialect constructor calls.
bool hasCanonicalizer() const
Returns true if this dialect has a canonicalizer.
bool operator<(const Dialect &other) const
bool hasConstantMaterializer() const
Returns true if this dialect has a constant materializer.
std::string getCppClassName() const
bool hasRegionResultAttrVerify() const
Returns true if this dialect has a region result attribute verifier.
bool useDefaultTypePrinterParser() const
Returns true if this dialect should generate the default dispatch for type printing/parsing.
bool hasOperationAttrVerify() const
Returns true if this dialect has an operation attribute verifier.
bool operator==(const Dialect &other) const
bool useStrictPropertiesInAssemblyFormat() const
Returns true if this dialect uses strict properties in declarative assembly formats.
Include the generated interface declarations.