Loading [MathJax]/jax/output/HTML-CSS/config.js
CIRCT 21.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
15#include "mlir/Pass/Pass.h"
16#include "llvm/Support/GraphWriter.h"
17#include "llvm/Support/raw_ostream.h"
18
19namespace circt {
20namespace hw {
21#define GEN_PASS_DEF_PRINTINSTANCEGRAPH
22#include "circt/Dialect/HW/Passes.h.inc"
23} // namespace hw
24} // namespace circt
25
26using namespace circt;
27using namespace hw;
28
29namespace {
30struct PrintInstanceGraphPass
31 : public circt::hw::impl::PrintInstanceGraphBase<PrintInstanceGraphPass> {
32 PrintInstanceGraphPass(raw_ostream &os) : os(os) {}
33 void runOnOperation() override {
34 InstanceGraph &instanceGraph = getAnalysis<InstanceGraph>();
35 llvm::WriteGraph(os, &instanceGraph, /*ShortNames=*/false);
36 markAllAnalysesPreserved();
37 }
38 raw_ostream &os;
39};
40} // end anonymous namespace
41
42std::unique_ptr<mlir::Pass> circt::hw::createPrintInstanceGraphPass() {
43 return std::make_unique<PrintInstanceGraphPass>(llvm::errs());
44}
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 hw.py:1