CIRCT  20.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 
16 #include "circt/Dialect/HW/HWOps.h"
18 #include "mlir/Pass/Pass.h"
19 
20 /// VerifyInnerRefNamespace pass until have container operation.
21 
22 namespace circt {
23 namespace hw {
24 #define GEN_PASS_DEF_VERIFYINNERREFNAMESPACE
25 #include "circt/Dialect/HW/Passes.h.inc"
26 } // namespace hw
27 } // namespace circt
28 
29 namespace {
30 
31 class VerifyInnerRefNamespacePass
32  : public circt::hw::impl::VerifyInnerRefNamespaceBase<
33  VerifyInnerRefNamespacePass> {
34 public:
35  void runOnOperation() override {
36  auto *irnLike = getOperation();
37  if (!irnLike->hasTrait<mlir::OpTrait::InnerRefNamespace>())
38  if (failed(circt::hw::detail::verifyInnerRefNamespace(irnLike)))
39  return signalPassFailure();
40 
41  return markAllAnalysesPreserved();
42  };
43  bool canScheduleOn(mlir::RegisteredOperationName opInfo) const override {
44  return llvm::isa<circt::hw::InnerRefNamespaceLike>(opInfo);
45  }
46 };
47 
48 } // namespace
49 
50 std::unique_ptr<mlir::Pass> circt::hw::createVerifyInnerRefNamespacePass() {
51  return std::make_unique<VerifyInnerRefNamespacePass>();
52 }
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()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: hw.py:1