CIRCT 24.0.0git
Loading...
Searching...
No Matches
circt::hw::InstanceGraph Class Reference

HW-specific instance graph with a virtual entry node linking to all publicly visible modules. More...

#include <HWInstanceGraph.h>

Inheritance diagram for circt::hw::InstanceGraph:
Collaboration diagram for circt::hw::InstanceGraph:

Public Member Functions

 InstanceGraph (Operation *operation)
igraph::InstanceGraphNode * getTopLevelNode () override
 Return the entry node linking to all public 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.
Public Member Functions inherited from circt::igraph::InstanceGraph
 InstanceGraph (Operation *parent)
 Create a new module graph of a circuit.
 InstanceGraph (const InstanceGraph &)=delete
virtual ~InstanceGraph ()=default
InstanceGraphNode * lookupOrNull (StringAttr name)
 Lookup an module by name.
InstanceGraphNode * lookupOrNull (ModuleOpInterface op)
 Look up an InstanceGraphNode for a module.
InstanceGraphNode * lookup (ModuleOpInterface op)
 Look up an InstanceGraphNode for a module.
InstanceGraphNode * lookup (StringAttr name)
 Lookup an module by name. Aborts if the module does not exist.
InstanceGraphNode * operator[] (ModuleOpInterface op)
 Lookup an InstanceGraphNode for a module.
bool isAncestor (ModuleOpInterface child, ModuleOpInterface parent, llvm::function_ref< bool(InstanceRecord *)> skipInstance=[](InstanceRecord *_) { return false;})
 Check if child is instantiated by a parent.
FailureOr< llvm::ArrayRef< InstanceGraphNode * > > getInferredTopLevelNodes ()
 Get the nodes corresponding to the inferred top-level modules of a circuit.
Operation * getParent ()
 Return the parent under which all nodes are nested.
iterator begin ()
iterator end ()
template<typename Fn>
decltype(auto) walkPostOrder (Fn &&fn)
 Perform a post-order walk across the modules.
template<typename Fn>
decltype(auto) walkInversePostOrder (Fn &&fn)
 Perform an inverse-post-order walk across the modules.
virtual void replaceInstance (InstanceOpInterface inst, InstanceOpInterface newInst)
 Replaces an instance of a module with another instance.

Private Member Functions

virtual InstanceGraphNode * addModule (ModuleOpInterface module)
 Add a newly created module to the instance graph.

Private Attributes

igraph::InstanceGraphNode entry

Additional Inherited Members

Public Types inherited from circt::igraph::InstanceGraph
using iterator = detail::AddressIterator<NodeList::iterator>
 Iterate through all modules.
Static Public Member Functions inherited from circt::igraph::InstanceGraph
static NodeList InstanceGraph::* getSublistAccess (Operation *)
 Returns pointer to member of operation list.
Protected Member Functions inherited from circt::igraph::InstanceGraph
ModuleOpInterface getReferencedModuleImpl (InstanceOpInterface op)
InstanceGraphNode * getOrAddNode (StringAttr name)
 Get the node corresponding to the module.
Protected Attributes inherited from circt::igraph::InstanceGraph
Operation * parent
 The node under which all modules are nested.
NodeList nodes
 The storage for graph nodes, with deterministic iteration.
llvm::DenseMap< Attribute, InstanceGraphNode * > nodeMap
 This maps each operation to its graph node.
llvm::SmallVector< InstanceGraphNode * > inferredTopLevelNodes
 A caching of the inferred top level module(s).

Detailed Description

HW-specific instance graph with a virtual entry node linking to all publicly visible modules.

Definition at line 24 of file HWInstanceGraph.h.

Constructor & Destructor Documentation

◆ InstanceGraph()

InstanceGraph::InstanceGraph ( Operation * operation)

Definition at line 14 of file HWInstanceGraph.cpp.

References entry, InstanceGraph(), and circt::igraph::InstanceGraph::nodes.

Referenced by InstanceGraph().

Member Function Documentation

◆ addHWModule()

igraph::InstanceGraphNode * InstanceGraph::addHWModule ( HWModuleLike module)

Adds a module, updating links to entry.

Definition at line 29 of file HWInstanceGraph.cpp.

References circt::igraph::InstanceGraph::addModule(), and entry.

◆ addModule()

InstanceGraphNode * InstanceGraph::addModule ( ModuleOpInterface module)
privatevirtual

Add a newly created module to the instance graph.

Reimplemented from circt::igraph::InstanceGraph.

Definition at line 295 of file InstanceGraph.cpp.

◆ erase()

void InstanceGraph::erase ( igraph::InstanceGraphNode * node)
overridevirtual

Erases a module, updating links to entry.

Reimplemented from circt::igraph::InstanceGraph.

Definition at line 37 of file HWInstanceGraph.cpp.

References entry, and circt::igraph::InstanceGraph::erase().

◆ getTopLevelNode()

igraph::InstanceGraphNode * circt::hw::InstanceGraph::getTopLevelNode ( )
inlineoverridevirtual

Return the entry node linking to all public modules.

Reimplemented from circt::igraph::InstanceGraph.

Definition at line 29 of file HWInstanceGraph.h.

References entry.

Member Data Documentation

◆ entry

igraph::InstanceGraphNode circt::hw::InstanceGraph::entry
private

Definition at line 39 of file HWInstanceGraph.h.

Referenced by addHWModule(), erase(), getTopLevelNode(), and InstanceGraph().


The documentation for this class was generated from the following files: