summaryrefslogtreecommitdiff
path: root/mlir/lib/TableGen/Property.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/TableGen/Property.cpp')
-rw-r--r--mlir/lib/TableGen/Property.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/mlir/lib/TableGen/Property.cpp b/mlir/lib/TableGen/Property.cpp
index b86b87df91c6..13851167ddaf 100644
--- a/mlir/lib/TableGen/Property.cpp
+++ b/mlir/lib/TableGen/Property.cpp
@@ -14,6 +14,7 @@
#include "mlir/TableGen/Property.h"
#include "mlir/TableGen/Format.h"
#include "mlir/TableGen/Operator.h"
+#include "mlir/TableGen/Predicate.h"
#include "llvm/TableGen/Record.h"
using namespace mlir;
@@ -68,8 +69,8 @@ Property::Property(StringRef summary, StringRef description,
StringRef writeToMlirBytecodeCall,
StringRef hashPropertyCall, StringRef defaultValue,
StringRef storageTypeValueOverride)
- : summary(summary), description(description), storageType(storageType),
- interfaceType(interfaceType),
+ : def(nullptr), summary(summary), description(description),
+ storageType(storageType), interfaceType(interfaceType),
convertFromStorageCall(convertFromStorageCall),
assignToStorageCall(assignToStorageCall),
convertToAttributeCall(convertToAttributeCall),
@@ -91,6 +92,15 @@ StringRef Property::getPropertyDefName() const {
return def->getName();
}
+Pred Property::getPredicate() const {
+ if (!def)
+ return Pred();
+ const llvm::RecordVal *maybePred = def->getValue("predicate");
+ if (!maybePred || !maybePred->getValue())
+ return Pred();
+ return Pred(maybePred->getValue());
+}
+
Property Property::getBaseProperty() const {
if (const auto *defInit =
llvm::dyn_cast<llvm::DefInit>(def->getValueInit("baseProperty"))) {