Implement a simple IR verifier, including support for custom ops adding their
own requirements.
PiperOrigin-RevId: 203497491
diff --git a/include/mlir/IR/Module.h b/include/mlir/IR/Module.h
index 7d22efd..ec277d6 100644
--- a/include/mlir/IR/Module.h
+++ b/include/mlir/IR/Module.h
@@ -22,8 +22,8 @@
#ifndef MLIR_IR_MODULE_H
#define MLIR_IR_MODULE_H
-#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Function.h"
+#include <vector>
namespace mlir {
@@ -34,12 +34,17 @@
explicit Module();
// FIXME: wrong representation and API.
+ // TODO(someone): This should switch to llvm::iplist<Function>.
std::vector<Function*> functionList;
// FIXME: wrong representation and API.
// These affine maps are immutable
std::vector<const AffineMap *> affineMapList;
+ /// Perform (potentially expensive) checks of invariants, used to detect
+ /// compiler bugs. This aborts on failure.
+ void verify() const;
+
void print(raw_ostream &os) const;
void dump() const;
};