15 #include "mlir/Pass/Pass.h"
16 #include "llvm/Support/raw_ostream.h"
20 #define GEN_PASS_DEF_PRINTNLATABLE
21 #include "circt/Dialect/FIRRTL/Passes.h.inc"
25 using namespace circt;
26 using namespace firrtl;
29 struct PrintNLATablePass
30 :
public circt::firrtl::impl::PrintNLATableBase<PrintNLATablePass> {
31 PrintNLATablePass(raw_ostream &os) : os(os) {}
32 void runOnOperation()
override {
33 auto circuitOp = getOperation();
34 auto &nlaTable = getAnalysis<NLATable>();
35 markAllAnalysesPreserved();
37 for (
auto &mop : *cast<CircuitOp>(circuitOp).
getBodyBlock()) {
38 auto mod = dyn_cast<FModuleLike>(mop);
41 os << mod.getModuleName() <<
": ";
42 for (
auto nla : nlaTable.lookup(mod))
43 os << nla.getSymName() <<
", ";
52 return std::make_unique<PrintNLATablePass>(llvm::errs());
static Block * getBodyBlock(FModuleLike mod)
std::unique_ptr< mlir::Pass > createPrintNLATablePass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.