17 #include "llvm/TableGen/Record.h"
25 using llvm::StringInit;
30 if (
const auto *str = dyn_cast<StringInit>(init))
31 return str->getValue().trim();
54 assert((def->isSubClassOf(
"Property") || def->isSubClassOf(
"Attr")) &&
55 "must be subclass of TableGen 'Property' class");
58 Property::Property(
const DefInit *init) :
Property(init->getDef()) {}
60 Property::Property(StringRef summary, StringRef description,
61 StringRef storageType, StringRef interfaceType,
62 StringRef convertFromStorageCall,
63 StringRef assignToStorageCall,
64 StringRef convertToAttributeCall,
65 StringRef convertFromAttributeCall, StringRef parserCall,
66 StringRef optionalParserCall, StringRef printerCall,
67 StringRef readFromMlirBytecodeCall,
68 StringRef writeToMlirBytecodeCall,
69 StringRef hashPropertyCall, StringRef defaultValue,
70 StringRef storageTypeValueOverride)
71 : summary(summary), description(description), storageType(storageType),
72 interfaceType(interfaceType),
73 convertFromStorageCall(convertFromStorageCall),
74 assignToStorageCall(assignToStorageCall),
75 convertToAttributeCall(convertToAttributeCall),
76 convertFromAttributeCall(convertFromAttributeCall),
77 parserCall(parserCall), optionalParserCall(optionalParserCall),
78 printerCall(printerCall),
79 readFromMlirBytecodeCall(readFromMlirBytecodeCall),
80 writeToMlirBytecodeCall(writeToMlirBytecodeCall),
81 hashPropertyCall(hashPropertyCall), defaultValue(defaultValue),
82 storageTypeValueOverride(storageTypeValueOverride) {
83 if (storageType.empty())
84 storageType =
"Property";
88 if (def->isAnonymous()) {
91 return def->getName();
95 if (
const auto *defInit =
96 llvm::dyn_cast<llvm::DefInit>(def->getValueInit(
"baseProperty"))) {
97 return Property(defInit).getBaseProperty();
static StringRef getValueAsString(const Init *init)
StringRef getPropertyDefName() const
Property(const llvm::Record *record)
Property getBaseProperty() const
Include the generated interface declarations.