Implement a simple IR verifier, including support for custom ops adding their
own requirements.
PiperOrigin-RevId: 203497491
diff --git a/lib/IR/MLIRContext.cpp b/lib/IR/MLIRContext.cpp
index 697cae3..761f804 100644
--- a/lib/IR/MLIRContext.cpp
+++ b/lib/IR/MLIRContext.cpp
@@ -232,6 +232,14 @@
return context->getImpl().operationSet;
}
+/// If this operation has a registered operation description in the
+/// OperationSet, return it. Otherwise return null.
+/// TODO: Shouldn't have to pass a Context here.
+const AbstractOperation *
+Operation::getAbstractOperation(MLIRContext *context) const {
+ return OperationSet::get(context).lookup(getName().str());
+}
+
//===----------------------------------------------------------------------===//
// Identifier uniquing
//===----------------------------------------------------------------------===//