CIRCT  19.0.0git
PrintFSMGraph.cpp
Go to the documentation of this file.
1 //===- FSMPrintFSMGraph.cpp - Print the instance graph ------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
8 //
9 // Print the module hierarchy.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "PassDetails.h"
17 #include "llvm/Support/GraphWriter.h"
18 #include "llvm/Support/raw_ostream.h"
19 
20 using namespace circt;
21 using namespace fsm;
22 
23 namespace {
24 struct PrintFSMGraphPass : public PrintFSMGraphBase<PrintFSMGraphPass> {
25  PrintFSMGraphPass(raw_ostream &os) : os(os) {}
26  void runOnOperation() override {
27  getOperation().walk([&](fsm::MachineOp machine) {
28  auto fsmGraph = fsm::FSMGraph(machine);
29  llvm::WriteGraph(os, &fsmGraph, /*ShortNames=*/false);
30  });
31  }
32  raw_ostream &os;
33 };
34 } // end anonymous namespace
35 
36 std::unique_ptr<mlir::Pass> circt::fsm::createPrintFSMGraphPass() {
37  return std::make_unique<PrintFSMGraphPass>(llvm::errs());
38 }
std::unique_ptr< mlir::Pass > createPrintFSMGraphPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: fsm.py:1