CIRCT  20.0.0git
HWInstanceGraph.h
Go to the documentation of this file.
1 //===- InstanceGraph.h - 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 //
9 // This file defines the HW InstanceGraph, which is similar to a CallGraph.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef CIRCT_DIALECT_HW_HWINSTANCEGRAPH_H
14 #define CIRCT_DIALECT_HW_HWINSTANCEGRAPH_H
15 
18 
19 namespace circt {
20 namespace hw {
21 
22 /// HW-specific instance graph with a virtual entry node linking to
23 /// all publicly visible modules.
25 public:
26  InstanceGraph(Operation *operation);
27 
28  /// Return the entry node linking to all public modules.
30 
31  /// Adds a module, updating links to entry.
32  igraph::InstanceGraphNode *addHWModule(HWModuleLike module);
33 
34  /// Erases a module, updating links to entry.
35  void erase(igraph::InstanceGraphNode *node) override;
36 
37 private:
40 };
41 
42 } // namespace hw
43 } // namespace circt
44 
45 // Specialisation for the HW instance graph.
46 template <>
47 struct llvm::GraphTraits<circt::hw::InstanceGraph *>
48  : public llvm::GraphTraits<circt::igraph::InstanceGraph *> {};
49 
50 template <>
51 struct llvm::DOTGraphTraits<circt::hw::InstanceGraph *>
52  : public llvm::DOTGraphTraits<circt::igraph::InstanceGraph *> {
53  using llvm::DOTGraphTraits<circt::igraph::InstanceGraph *>::DOTGraphTraits;
54 };
55 
56 #endif // CIRCT_DIALECT_HW_HWINSTANCEGRAPH_H
HW-specific instance graph with a virtual entry node linking to all publicly visible modules.
igraph::InstanceGraphNode * addHWModule(HWModuleLike module)
Adds a module, updating links to entry.
void erase(igraph::InstanceGraphNode *node) override
Erases a module, updating links to entry.
igraph::InstanceGraphNode * getTopLevelNode() override
Return the entry node linking to all public modules.
InstanceGraph(Operation *operation)
igraph::InstanceGraphNode entry
This is a Node in the InstanceGraph.
This graph tracks modules and where they are instantiated.
virtual InstanceGraphNode * addModule(ModuleOpInterface module)
Add a newly created module to the instance graph.
std::map< std::string, std::set< std::string > > InstanceGraph
Iterates over the handshake::FuncOp's in the program to build an instance graph.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: hw.py:1