CIRCT 20.0.0git
Loading...
Searching...
No Matches
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
17#include "mlir/Pass/Pass.h"
18#include "llvm/Support/GraphWriter.h"
19#include "llvm/Support/raw_ostream.h"
20
21namespace circt {
22namespace fsm {
23#define GEN_PASS_DEF_PRINTFSMGRAPH
24#include "circt/Dialect/FSM/Passes.h.inc"
25} // namespace fsm
26} // namespace circt
27
28using namespace circt;
29using namespace fsm;
30
31namespace {
32struct PrintFSMGraphPass
33 : public circt::fsm::impl::PrintFSMGraphBase<PrintFSMGraphPass> {
34 PrintFSMGraphPass(raw_ostream &os) : os(os) {}
35 void runOnOperation() override {
36 getOperation().walk([&](fsm::MachineOp machine) {
37 auto fsmGraph = fsm::FSMGraph(machine);
38 llvm::WriteGraph(os, &fsmGraph, /*ShortNames=*/false);
39 });
40 }
41 raw_ostream &os;
42};
43} // end anonymous namespace
44
45std::unique_ptr<mlir::Pass> circt::fsm::createPrintFSMGraphPass() {
46 return std::make_unique<PrintFSMGraphPass>(llvm::errs());
47}
std::unique_ptr< mlir::Pass > createPrintFSMGraphPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition fsm.py:1