CIRCT  19.0.0git
VerifyInnerRefNamespace.cpp
Go to the documentation of this file.
1 //===- VerifyInnerRefNamespace.cpp - InnerRefNamespace verification Pass --===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements a simple pass to drive verification of operations
10 // that want to be InnerRefNamespace's but don't have the trait to verify
11 // themselves.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "PassDetails.h"
18 
19 /// VerifyInnerRefNamespace pass until have container operation.
20 
21 namespace {
22 
23 class VerifyInnerRefNamespacePass
24  : public circt::hw::VerifyInnerRefNamespaceBase<
25  VerifyInnerRefNamespacePass> {
26 public:
27  void runOnOperation() override {
28  auto *irnLike = getOperation();
29  if (!irnLike->hasTrait<mlir::OpTrait::InnerRefNamespace>())
30  if (failed(circt::hw::detail::verifyInnerRefNamespace(irnLike)))
31  return signalPassFailure();
32 
33  return markAllAnalysesPreserved();
34  };
35  bool canScheduleOn(mlir::RegisteredOperationName opInfo) const override {
36  return llvm::isa<circt::hw::InnerRefNamespaceLike>(opInfo);
37  }
38 };
39 
40 } // namespace
41 
42 std::unique_ptr<mlir::Pass> circt::hw::createVerifyInnerRefNamespacePass() {
43  return std::make_unique<VerifyInnerRefNamespacePass>();
44 }
This trait is for operations that define a scope for resolving InnerRef's, and provides verification ...
LogicalResult verifyInnerRefNamespace(Operation *op)
std::unique_ptr< mlir::Pass > createVerifyInnerRefNamespacePass()