CIRCT
20.0.0git
|
This is a Node in the InstanceGraph. More...
#include <InstanceGraph.h>
Classes | |
struct | UseIterator |
Iterator for module uses. More... | |
Public Types | |
using | iterator = detail::AddressIterator< InstanceList::iterator > |
Iterate the instance records in this module. More... | |
Public Member Functions | |
InstanceGraphNode () | |
template<typename TTarget = ModuleOpInterface> | |
auto | getModule () |
Get the module that this node is tracking. More... | |
iterator | begin () |
iterator | end () |
bool | noUses () |
Return true if there are no more instances of this module. More... | |
bool | hasOneUse () |
Return true if this module has exactly one use. More... | |
size_t | getNumUses () |
Get the number of direct instantiations of this module. More... | |
UseIterator | usesBegin () |
Iterate the instance records which instantiate this module. More... | |
UseIterator | usesEnd () |
llvm::iterator_range< UseIterator > | uses () |
InstanceRecord * | addInstance (InstanceOpInterface instance, InstanceGraphNode *target) |
Record a new instance op in the body of this module. More... | |
Private Types | |
using | InstanceList = llvm::iplist< InstanceRecord > |
Private Member Functions | |
InstanceGraphNode (const InstanceGraphNode &)=delete | |
void | recordUse (InstanceRecord *record) |
Record that a module instantiates this module. More... | |
Private Attributes | |
ModuleOpInterface | module |
The module. More... | |
InstanceList | instances |
List of instance operations in this module. More... | |
InstanceRecord * | firstUse = nullptr |
List of instances which instantiate this module. More... | |
Friends | |
class | InstanceRecord |
class | InstanceGraph |
Iterates over the handshake::FuncOp's in the program to build an instance graph. More... | |
This is a Node in the InstanceGraph.
Each node represents a Module in a Circuit. Both external modules and regular modules can be represented by this class. It is possible to efficiently iterate all modules instantiated by this module, as well as all instantiations of this module.
Definition at line 101 of file InstanceGraph.h.
|
private |
Definition at line 102 of file InstanceGraph.h.
using circt::igraph::InstanceGraphNode::iterator = detail::AddressIterator<InstanceList::iterator> |
Iterate the instance records in this module.
Definition at line 116 of file InstanceGraph.h.
|
inline |
Definition at line 105 of file InstanceGraph.h.
|
privatedelete |
InstanceRecord * InstanceGraphNode::addInstance | ( | InstanceOpInterface | instance, |
InstanceGraphNode * | target | ||
) |
Record a new instance op in the body of this module.
Returns a newly allocated InstanceRecord which will be owned by this node.
Definition at line 28 of file InstanceGraph.cpp.
References InstanceRecord, instances, and recordUse().
Referenced by circt::hw::InstanceGraph::addHWModule(), inlineInputOnly(), circt::hw::InstanceGraph::InstanceGraph(), and migrateOps().
|
inline |
Definition at line 117 of file InstanceGraph.h.
References instances.
Referenced by llvm::GraphTraits< circt::igraph::InstanceGraphNode * >::child_begin().
|
inline |
Definition at line 118 of file InstanceGraph.h.
References instances.
Referenced by llvm::GraphTraits< circt::igraph::InstanceGraphNode * >::child_end().
|
inline |
Get the module that this node is tracking.
Definition at line 109 of file InstanceGraph.h.
References module.
Referenced by circt::igraph::InstanceGraph::getInferredTopLevelNodes(), llvm::DOTGraphTraits< circt::igraph::InstanceGraph * >::getNodeLabel(), circt::igraph::InstanceGraph::isAncestor(), circt::firrtl::OwningModuleCache::lookup(), and circt::hw::PortConverterImpl::PortConverterImpl().
|
inline |
Get the number of direct instantiations of this module.
Definition at line 127 of file InstanceGraph.h.
References usesBegin(), and usesEnd().
|
inline |
Return true if this module has exactly one use.
Definition at line 124 of file InstanceGraph.h.
References uses().
|
inline |
Return true if there are no more instances of this module.
Definition at line 121 of file InstanceGraph.h.
References firstUse.
Referenced by inlineInputOnly().
|
private |
Record that a module instantiates this module.
Definition at line 36 of file InstanceGraph.cpp.
References firstUse, circt::igraph::InstanceRecord::nextUse, and circt::igraph::InstanceRecord::prevUse.
Referenced by addInstance().
|
inline |
Definition at line 154 of file InstanceGraph.h.
References usesBegin(), and usesEnd().
Referenced by circt::firrtl::addPortsToModule(), circt::igraph::InstancePathCache::getAbsolutePaths(), hasOneUse(), inlineInputOnly(), circt::igraph::InstanceGraph::isAncestor(), circt::igraph::InstanceGraph::replaceInstance(), and circt::hw::PortConverterImpl::run().
|
inline |
Iterate the instance records which instantiate this module.
Definition at line 152 of file InstanceGraph.h.
Referenced by llvm::GraphTraits< llvm::Inverse< circt::igraph::InstanceGraphNode * > >::child_begin(), getNumUses(), circt::firrtl::OwningModuleCache::lookup(), and uses().
|
inline |
Definition at line 153 of file InstanceGraph.h.
Referenced by llvm::GraphTraits< llvm::Inverse< circt::igraph::InstanceGraphNode * > >::child_end(), getNumUses(), circt::firrtl::OwningModuleCache::lookup(), and uses().
|
friend |
Iterates over the handshake::FuncOp's in the program to build an instance graph.
In doing so, we detect whether there are any cycles in this graph, as well as infer a top function for the design by performing a topological sort of the instance graph. The result of this sort is placed in sortedFuncs.
Definition at line 183 of file InstanceGraph.h.
|
friend |
Definition at line 164 of file InstanceGraph.h.
Referenced by addInstance().
|
private |
List of instances which instantiate this module.
Definition at line 180 of file InstanceGraph.h.
Referenced by circt::igraph::InstanceRecord::erase(), noUses(), and recordUse().
|
private |
List of instance operations in this module.
This member owns the InstanceRecords, which may be pointed to by other InstanceGraphNode's use lists.
Definition at line 177 of file InstanceGraph.h.
Referenced by addInstance(), begin(), end(), and circt::igraph::InstanceRecord::erase().
|
private |
The module.
Definition at line 172 of file InstanceGraph.h.
Referenced by hw.InstanceBuilder::create_default_value(), getModule(), om.Evaluator::instantiate(), hw.InstanceBuilder::operand_names(), and hw.InstanceBuilder::result_names().