[Mlir-commits] [mlir] a8c647d - [mlir][NFC] Provide accessor for TableGen record
Jeff Niu
llvmlistbot at llvm.org
Thu Sep 8 09:47:29 PDT 2022
Author: Mathieu Fehr
Date: 2022-09-08T09:47:20-07:00
New Revision: a8c647dbe603a0668e156010e358863bd64de1e4
URL: https://github.com/llvm/llvm-project/commit/a8c647dbe603a0668e156010e358863bd64de1e4
DIFF: https://github.com/llvm/llvm-project/commit/a8c647dbe603a0668e156010e358863bd64de1e4.diff
LOG: [mlir][NFC] Provide accessor for TableGen record
Constraint and Predicate classes did not expose their underlying
tablegen records. This means that for Constraints, it is not possible
to get the underlying base constraint of a variadic constraint.
For Predicate, it is not possible to get the predicates forming an
`Or` predicate for instance.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D133264
Added:
Modified:
mlir/include/mlir/TableGen/Constraint.h
mlir/include/mlir/TableGen/Predicate.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/TableGen/Constraint.h b/mlir/include/mlir/TableGen/Constraint.h
index 71bb7d20926a7..c0765739016e5 100644
--- a/mlir/include/mlir/TableGen/Constraint.h
+++ b/mlir/include/mlir/TableGen/Constraint.h
@@ -71,6 +71,9 @@ class Constraint {
Kind getKind() const { return kind; }
+ /// Return the underlying def.
+ const llvm::Record &getDef() const { return *def; }
+
protected:
// The TableGen definition of this constraint.
const llvm::Record *def;
diff --git a/mlir/include/mlir/TableGen/Predicate.h b/mlir/include/mlir/TableGen/Predicate.h
index 2e47afde0b27d..fd5a5a5dc99ae 100644
--- a/mlir/include/mlir/TableGen/Predicate.h
+++ b/mlir/include/mlir/TableGen/Predicate.h
@@ -67,6 +67,9 @@ class Pred {
return llvm::hash_value(pred.def);
}
+ /// Return the underlying def.
+ const llvm::Record &getDef() const { return *def; }
+
protected:
// The TableGen definition of this predicate.
const llvm::Record *def{nullptr};
More information about the Mlir-commits
mailing list