CIRCT  20.0.0git
Classes | Private Member Functions | Private Attributes | List of all members
LowerXMRPass Class Reference
Inheritance diagram for LowerXMRPass:
Inheritance graph
[legend]
Collaboration diagram for LowerXMRPass:
Collaboration graph
[legend]

Classes

struct  ValueComparator
 llvm::EquivalenceClasses wants comparable elements. More...
 

Private Member Functions

void runOnOperation () override
 
void getRefABIPrefix (FModuleLike mod, SmallVectorImpl< char > &prefix)
 Generate the ABI ref_<module> prefix string into prefix. More...
 
StringAttr getRefABIMacroForPort (FModuleLike mod, size_t portIndex, const Twine &prefix, bool backTick=false)
 Get full macro name as StringAttr for the specified ref port. More...
 
LogicalResult resolveReferencePath (mlir::TypedValue< RefType > refVal, ImplicitLocOpBuilder builder, mlir::FlatSymbolRefAttr &ref, SmallString< 128 > &stringLeaf)
 
LogicalResult resolveReference (mlir::TypedValue< RefType > refVal, ImplicitLocOpBuilder &builder, FlatSymbolRefAttr &ref, StringAttr &xmrAttr)
 
LogicalResult handleForceReleaseOp (Operation *op)
 
LogicalResult handleRefResolve (RefResolveOp resolve)
 
void setPortToRemove (Operation *op, size_t index, size_t numPorts)
 
LogicalResult handleInstanceOp (InstanceOp inst, InstanceGraph &instanceGraph)
 
LogicalResult handlePublicModuleRefPorts (FModuleOp module)
 
hw::InnerSymbolNamespace & getModuleNamespace (FModuleLike module)
 Get the cached namespace for a module. More...
 
InnerRefAttr getInnerRefTo (Value val)
 
InnerRefAttr getInnerRefTo (Operation *op)
 
void markForRemoval (Operation *op)
 
std::optional< size_t > getRemoteRefSend (Value val, bool errorIfNotFound=true)
 
size_t addReachingSendsEntry (Value atRefVal, XMRNode::SymOrIndexOp info, std::optional< size_t > continueFrom=std::nullopt)
 
void garbageCollect ()
 
bool isZeroWidth (FIRRTLBaseType t)
 
hw::HierPathOp getOrCreatePath (ArrayAttr pathArray, ImplicitLocOpBuilder &builder)
 Return a HierPathOp for the provided pathArray. More...
 

Private Attributes

DenseMap< Operation *, hw::InnerSymbolNamespace > moduleNamespaces
 Cached module namespaces. More...
 
DenseSet< Operation * > visitedModules
 
DenseMap< Value, size_t > dataflowAt
 Map of a reference value to an entry into refSendPathList. More...
 
SmallVector< XMRNode > refSendPathList
 refSendPathList is used to construct a path to the RefSendOp. More...
 
llvm::EquivalenceClasses< Value, ValueComparator > * dataFlowClasses
 
DenseMap< Operation *, llvm::BitVector > refPortsToRemoveMap
 
SmallVector< Operation * > opsToRemove
 RefResolve, RefSend, and Connects involving them that will be removed. More...
 
DenseMap< size_t, SmallString< 128 > > xmrPathSuffix
 Record the internal path to an external module or a memory. More...
 
CircuitNamespacecircuitNamespace
 
DenseMap< Attribute, hw::HierPathOp > pathCache
 A cache of already created HierPathOps. More...
 
OpBuilder::InsertPoint pathInsertPoint = {}
 The insertion point where the pass inserts HierPathOps. More...
 

Detailed Description

Definition at line 82 of file LowerXMR.cpp.

Member Function Documentation

◆ addReachingSendsEntry()

size_t LowerXMRPass::addReachingSendsEntry ( Value  atRefVal,
XMRNode::SymOrIndexOp  info,
std::optional< size_t >  continueFrom = std::nullopt 
)
inlineprivate

Definition at line 717 of file LowerXMR.cpp.

◆ garbageCollect()

void LowerXMRPass::garbageCollect ( )
inlineprivate

Definition at line 726 of file LowerXMR.cpp.

◆ getInnerRefTo() [1/2]

InnerRefAttr LowerXMRPass::getInnerRefTo ( Operation *  op)
inlineprivate

Definition at line 684 of file LowerXMR.cpp.

References circt::firrtl::getInnerRefTo().

◆ getInnerRefTo() [2/2]

InnerRefAttr LowerXMRPass::getInnerRefTo ( Value  val)
inlineprivate

Definition at line 673 of file LowerXMR.cpp.

References circt::firrtl::getInnerRefTo().

◆ getModuleNamespace()

hw::InnerSymbolNamespace& LowerXMRPass::getModuleNamespace ( FModuleLike  module)
inlineprivate

Get the cached namespace for a module.

Definition at line 669 of file LowerXMR.cpp.

◆ getOrCreatePath()

hw::HierPathOp LowerXMRPass::getOrCreatePath ( ArrayAttr  pathArray,
ImplicitLocOpBuilder &  builder 
)
inlineprivate

Return a HierPathOp for the provided pathArray.

This will either return an existing HierPathOp or it will create and return a new one.

Definition at line 777 of file LowerXMR.cpp.

References assert(), and getBodyBlock().

◆ getRefABIMacroForPort()

StringAttr LowerXMRPass::getRefABIMacroForPort ( FModuleLike  mod,
size_t  portIndex,
const Twine &  prefix,
bool  backTick = false 
)
inlineprivate

Get full macro name as StringAttr for the specified ref port.

Uses existing 'prefix', optionally preprends the backtick character.

Definition at line 376 of file LowerXMR.cpp.

References circt::calyx::direction::get().

◆ getRefABIPrefix()

void LowerXMRPass::getRefABIPrefix ( FModuleLike  mod,
SmallVectorImpl< char > &  prefix 
)
inlineprivate

Generate the ABI ref_<module> prefix string into prefix.

Definition at line 364 of file LowerXMR.cpp.

References toVector().

◆ getRemoteRefSend()

std::optional<size_t> LowerXMRPass::getRemoteRefSend ( Value  val,
bool  errorIfNotFound = true 
)
inlineprivate

Definition at line 693 of file LowerXMR.cpp.

◆ handleForceReleaseOp()

LogicalResult LowerXMRPass::handleForceReleaseOp ( Operation *  op)
inlineprivate

Definition at line 470 of file LowerXMR.cpp.

◆ handleInstanceOp()

LogicalResult LowerXMRPass::handleInstanceOp ( InstanceOp  inst,
InstanceGraph instanceGraph 
)
inlineprivate

Get the resolution string for this ref-type port.

Definition at line 528 of file LowerXMR.cpp.

References circt::firrtl::getInnerRefTo(), and circt::firrtl::Out.

◆ handlePublicModuleRefPorts()

LogicalResult LowerXMRPass::handlePublicModuleRefPorts ( FModuleOp  module)
inlineprivate

Definition at line 614 of file LowerXMR.cpp.

References circt::calyx::direction::get(), and circt::firrtl::Out.

◆ handleRefResolve()

LogicalResult LowerXMRPass::handleRefResolve ( RefResolveOp  resolve)
inlineprivate

◆ isZeroWidth()

bool LowerXMRPass::isZeroWidth ( FIRRTLBaseType  t)
inlineprivate

◆ markForRemoval()

void LowerXMRPass::markForRemoval ( Operation *  op)
inlineprivate

Definition at line 691 of file LowerXMR.cpp.

◆ resolveReference()

LogicalResult LowerXMRPass::resolveReference ( mlir::TypedValue< RefType >  refVal,
ImplicitLocOpBuilder &  builder,
FlatSymbolRefAttr &  ref,
StringAttr &  xmrAttr 
)
inlineprivate

Definition at line 453 of file LowerXMR.cpp.

◆ resolveReferencePath()

LogicalResult LowerXMRPass::resolveReferencePath ( mlir::TypedValue< RefType >  refVal,
ImplicitLocOpBuilder  builder,
mlir::FlatSymbolRefAttr &  ref,
SmallString< 128 > &  stringLeaf 
)
inlineprivate

Definition at line 382 of file LowerXMR.cpp.

References assert(), circt::calyx::direction::get(), and toVector().

◆ runOnOperation()

void LowerXMRPass::runOnOperation ( )
inlineoverrideprivate

◆ setPortToRemove()

void LowerXMRPass::setPortToRemove ( Operation *  op,
size_t  index,
size_t  numPorts 
)
inlineprivate

Definition at line 521 of file LowerXMR.cpp.

Member Data Documentation

◆ circuitNamespace

CircuitNamespace* LowerXMRPass::circuitNamespace
private

Definition at line 850 of file LowerXMR.cpp.

◆ dataflowAt

DenseMap<Value, size_t> LowerXMRPass::dataflowAt
private

Map of a reference value to an entry into refSendPathList.

Each entry in refSendPathList represents the path to RefSend. The path is required since there can be multiple paths to the RefSend and we need to identify a unique path.

Definition at line 821 of file LowerXMR.cpp.

◆ dataFlowClasses

llvm::EquivalenceClasses<Value, ValueComparator>* LowerXMRPass::dataFlowClasses
private

Definition at line 840 of file LowerXMR.cpp.

◆ moduleNamespaces

DenseMap<Operation *, hw::InnerSymbolNamespace> LowerXMRPass::moduleNamespaces
private

Cached module namespaces.

Definition at line 814 of file LowerXMR.cpp.

◆ opsToRemove

SmallVector<Operation *> LowerXMRPass::opsToRemove
private

RefResolve, RefSend, and Connects involving them that will be removed.

Definition at line 845 of file LowerXMR.cpp.

◆ pathCache

DenseMap<Attribute, hw::HierPathOp> LowerXMRPass::pathCache
private

A cache of already created HierPathOps.

This is used to avoid repeatedly creating the same HierPathOp.

Definition at line 854 of file LowerXMR.cpp.

◆ pathInsertPoint

OpBuilder::InsertPoint LowerXMRPass::pathInsertPoint = {}
private

The insertion point where the pass inserts HierPathOps.

Definition at line 857 of file LowerXMR.cpp.

◆ refPortsToRemoveMap

DenseMap<Operation *, llvm::BitVector> LowerXMRPass::refPortsToRemoveMap
private

Definition at line 842 of file LowerXMR.cpp.

◆ refSendPathList

SmallVector<XMRNode> LowerXMRPass::refSendPathList
private

refSendPathList is used to construct a path to the RefSendOp.

Each entry is an XMRNode, with an InnerRefAttr or indexing op, and a pointer to the next node in the path. The InnerRefAttr can be to an InstanceOp or to the XMR defining op, the index op records narrowing along path. All the nodes representing an InstanceOp or indexing operation must have a valid NextNodeOnPath. Only the node representing the final XMR defining op has no NextNodeOnPath, which denotes a leaf node on the path.

Definition at line 830 of file LowerXMR.cpp.

◆ visitedModules

DenseSet<Operation *> LowerXMRPass::visitedModules
private

Definition at line 816 of file LowerXMR.cpp.

◆ xmrPathSuffix

DenseMap<size_t, SmallString<128> > LowerXMRPass::xmrPathSuffix
private

Record the internal path to an external module or a memory.

Definition at line 848 of file LowerXMR.cpp.


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