13#include "mlir/IR/BuiltinTypes.h"
14#include "mlir/Pass/Pass.h"
18#define GEN_PASS_DEF_VERIFYESICONNECTIONS
19#include "circt/Dialect/ESI/ESIPasses.h.inc"
27struct ESIVerifyConnectionsPass
28 :
public impl::VerifyESIConnectionsBase<ESIVerifyConnectionsPass> {
29 void runOnOperation()
override;
33void ESIVerifyConnectionsPass::runOnOperation() {
35 getOperation()->walk([
this](Operation *op) {
36 for (
const OpResult &v : op->getResults())
37 if (isa<ChannelBundleType>(v.getType())) {
40 mlir::InFlightDiagnostic error =
41 op->emitError(
"bundles must have exactly one use");
42 for (Operation *user : v.getUsers())
43 error.attachNote(user->getLoc()) <<
"bundle used here";
46 }
else if (
auto cv = dyn_cast<mlir::TypedValue<ChannelType>>(v)) {
47 if (failed(ChannelType::verifyChannel(cv)))
54 return std::make_unique<ESIVerifyConnectionsPass>();
std::unique_ptr< OperationPass<> > createESIVerifyConnectionsPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.