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(
"hasCanonicalizer");
70 return def->getValueAsBit(
"hasConstantMaterializer");
74 return def->getValueAsBit(
"hasNonDefaultDestructor");
78 return def->getValueAsBit(
"hasOperationAttrVerify");
82 return def->getValueAsBit(
"hasRegionArgAttrVerify");
86 return def->getValueAsBit(
"hasRegionResultAttrVerify");
90 return def->getValueAsBit(
"hasOperationInterfaceFallback");
94 return def->getValueAsBit(
"useDefaultAttributePrinterParser");
98 return def->getValueAsBit(
"useDefaultTypePrinterParser");
102 return def->getValueAsBit(
"isExtensible");
106 return def->getValueAsBit(
"usePropertiesForAttributes");
110 return def->getValueAsDag(
"discardableAttrs");
114 return def == other.def;
static StringRef getAsStringOrEmpty(const llvm::Record &record, StringRef fieldName)
StringRef getDescription() const
Dialect(const llvm::Record *def)
StringRef getSummary() const
std::optional< StringRef > getExtraClassDeclaration() const
ArrayRef< StringRef > getDependentDialects() const
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 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 usePropertiesForAttributes() const
Default to use properties for storing Attributes for operations in this dialect.
Include the generated interface declarations.