CIRCT  19.0.0git
HWPrintInstanceGraph.cpp
Go to the documentation of this file.
1 //===- HWPrintInstanceGraph.cpp - Print the instance graph ------*- C++ -*-===//
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 // Print the module hierarchy.
9 //
10 //===----------------------------------------------------------------------===//
11 
12 #include "PassDetails.h"
15 #include "llvm/Support/GraphWriter.h"
16 #include "llvm/Support/raw_ostream.h"
17 
18 using namespace circt;
19 using namespace hw;
20 
21 namespace {
22 struct PrintInstanceGraphPass
23  : public PrintInstanceGraphBase<PrintInstanceGraphPass> {
24  PrintInstanceGraphPass(raw_ostream &os) : os(os) {}
25  void runOnOperation() override {
26  InstanceGraph &instanceGraph = getAnalysis<InstanceGraph>();
27  llvm::WriteGraph(os, &instanceGraph, /*ShortNames=*/false);
28  markAllAnalysesPreserved();
29  }
30  raw_ostream &os;
31 };
32 } // end anonymous namespace
33 
34 std::unique_ptr<mlir::Pass> circt::hw::createPrintInstanceGraphPass() {
35  return std::make_unique<PrintInstanceGraphPass>(llvm::errs());
36 }
HW-specific instance graph with a virtual entry node linking to all publicly visible modules.
std::unique_ptr< mlir::Pass > createPrintInstanceGraphPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: hw.py:1