CIRCT
20.0.0git
|
Public Types | |
using | RenameMap = DenseMap< StringAttr, StringAttr > |
Public Member Functions | |
Deduper (InstanceGraph &instanceGraph, SymbolTable &symbolTable, NLATable *nlaTable, CircuitOp circuit) | |
void | dedup (FModuleLike toModule, FModuleLike fromModule) |
Remove the "fromModule", and replace all references to it with the "toModule". More... | |
void | record (FModuleLike module) |
Record the usages of any NLA's in this module, so that we may update the annotation if the parent module is deduped with another module. More... | |
Private Member Functions | |
hw::InnerSymbolNamespace & | getNamespace (Operation *module) |
Get a cached namespace for a module. More... | |
void | recordAnnotations (AnnoTarget target) |
For a specific annotation target, record all the unique NLAs which target it in the targetMap . More... | |
void | recordAnnotations (Operation *op) |
Record all targets which use an NLA. More... | |
void | replaceInstances (FModuleLike toModule, Operation *fromModule) |
This deletes and replaces all instances of the "fromModule" with instances of the "toModule". More... | |
SmallVector< FlatSymbolRefAttr > | createNLAs (Operation *fromModule, ArrayRef< Attribute > baseNamepath, SymbolTable::Visibility vis=SymbolTable::Visibility::Private) |
Look up the instantiations of the from module and create an NLA for each one, appending the baseNamepath to each NLA. More... | |
SmallVector< FlatSymbolRefAttr > | createNLAs (StringAttr toModuleName, FModuleLike fromModule, SymbolTable::Visibility vis=SymbolTable::Visibility::Private) |
Look up the instantiations of this module and create an NLA for each one. More... | |
void | cloneAnnotation (SmallVectorImpl< FlatSymbolRefAttr > &nlas, Annotation anno, ArrayRef< NamedAttribute > attributes, unsigned nonLocalIndex, SmallVectorImpl< Annotation > &newAnnotations) |
Clone the annotation for each NLA in a list. More... | |
void | eraseNLA (hw::HierPathOp nla) |
This erases the NLA op, and removes the NLA from every module's NLA map, but it does not delete the NLA reference from the target operation's annotations. More... | |
void | addAnnotationContext (RenameMap &renameMap, FModuleOp toModule, FModuleOp fromModule) |
Process all NLAs referencing the "from" module to point to the "to" module. More... | |
void | rewriteModuleNLAs (RenameMap &renameMap, FModuleOp toModule, FModuleOp fromModule) |
Process all the NLAs that the two modules participate in, replacing references to the "from" module with references to the "to" module, and adding more context if necessary. More... | |
void | rewriteExtModuleNLAs (RenameMap &renameMap, StringAttr toName, StringAttr fromName) |
bool | makeAnnotationNonLocal (StringAttr toModuleName, AnnoTarget to, FModuleLike fromModule, Annotation anno, SmallVectorImpl< Annotation > &newAnnotations) |
Take an annotation, and update it to be a non-local annotation. More... | |
void | copyAnnotations (FModuleLike toModule, AnnoTarget to, FModuleLike fromModule, AnnotationSet annos, SmallVectorImpl< Annotation > &newAnnotations, SmallPtrSetImpl< Attribute > &dontTouches) |
void | mergeAnnotations (FModuleLike toModule, AnnoTarget to, AnnotationSet toAnnos, FModuleLike fromModule, AnnoTarget from, AnnotationSet fromAnnos) |
Merge the annotations of a specific target, either a operation or a port on an operation. More... | |
void | mergeAnnotations (FModuleLike toModule, Operation *to, FModuleLike fromModule, Operation *from) |
Merge all annotations and port annotations on two operations. More... | |
void | recordSymRenames (RenameMap &renameMap, FModuleLike toModule, Operation *to, FModuleLike fromModule, Operation *from) |
void | mergeOps (RenameMap &renameMap, FModuleLike toModule, Operation *to, FModuleLike fromModule, Operation *from) |
Recursively merge two operations. More... | |
void | mergeBlocks (RenameMap &renameMap, FModuleLike toModule, Block &toBlock, FModuleLike fromModule, Block &fromBlock) |
Recursively merge two blocks. More... | |
void | mergeRegions (RenameMap &renameMap, FModuleLike toModule, Region &toRegion, FModuleLike fromModule, Region &fromRegion) |
Private Attributes | |
MLIRContext * | context |
InstanceGraph & | instanceGraph |
SymbolTable & | symbolTable |
NLATable * | nlaTable = nullptr |
Cached nla table analysis. More... | |
Block * | nlaBlock |
We insert all NLAs to the beginning of this block. More... | |
DenseMap< Attribute, llvm::SmallDenseSet< AnnoTarget > > | targetMap |
DenseMap< Attribute, Attribute > | nlaCache |
StringAttr | nonLocalString |
StringAttr | classString |
DenseMap< Operation *, hw::InnerSymbolNamespace > | moduleNamespaces |
A module namespace cache. More... | |
using Deduper::RenameMap = DenseMap<StringAttr, StringAttr> |
|
inline |
|
inlineprivate |
|
inlineprivate |
Clone the annotation for each NLA in a list.
The attribute list should have a placeholder for the "circt.nonlocal" field, and nonLocalIndex
should be the index of this field.
Definition at line 1095 of file Dedup.cpp.
References circt::firrtl::Annotation::setDict().
|
inlineprivate |
Definition at line 1243 of file Dedup.cpp.
References circt::firrtl::dontTouchAnnoClass.
|
inlineprivate |
Look up the instantiations of the from
module and create an NLA for each one, appending the baseNamepath to each NLA.
This is used to add more context to an already existing NLA. The fromModule
is used to indicate which module the annotation is coming from before the merge, and will be used to create the namepaths.
Definition at line 1050 of file Dedup.cpp.
References circt::calyx::direction::get(), and circt::firrtl::OpAnnoTarget::getNLAReference().
|
inlineprivate |
Look up the instantiations of this module and create an NLA for each one.
This returns an array of symbol references which can be used to reference the NLAs.
Definition at line 1087 of file Dedup.cpp.
References circt::calyx::direction::get().
|
inline |
Remove the "fromModule", and replace all references to it with the "toModule".
Modules should be deduplicated in a bottom-up order. Any module which is not deduplicated needs to be recorded with the record
call.
Definition at line 944 of file Dedup.cpp.
References circt::calyx::direction::get(), and mergeLoc().
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
Take an annotation, and update it to be a non-local annotation.
If the annotation is already non-local and has enough context, it will be skipped for now. Return true if the annotation was made non-local.
Definition at line 1201 of file Dedup.cpp.
References assert(), circt::firrtl::Annotation::begin(), and circt::firrtl::Annotation::end().
|
inlineprivate |
Merge the annotations of a specific target, either a operation or a port on an operation.
Definition at line 1272 of file Dedup.cpp.
References circt::firrtl::AnnoTarget::setAnnotations().
|
inlineprivate |
Merge all annotations and port annotations on two operations.
Definition at line 1295 of file Dedup.cpp.
References circt::firrtl::AnnotationSet::forPort(), and circt::firrtl::getNumPorts().
|
inlineprivate |
|
inlineprivate |
Recursively merge two operations.
Definition at line 1385 of file Dedup.cpp.
References mergeLoc(), and mergeRegions().
|
inlineprivate |
|
inline |
Record the usages of any NLA's in this module, so that we may update the annotation if the parent module is deduped with another module.
Definition at line 979 of file Dedup.cpp.
References circt::firrtl::getNumPorts().
|
inlineprivate |
For a specific annotation target, record all the unique NLAs which target it in the targetMap
.
Definition at line 998 of file Dedup.cpp.
References circt::firrtl::AnnoTarget::getAnnotations().
|
inlineprivate |
|
inlineprivate |
Definition at line 1323 of file Dedup.cpp.
References circt::calyx::direction::get(), circt::firrtl::getInnerSymName(), and circt::firrtl::getOrAddInnerSym().
|
inlineprivate |
This deletes and replaces all instances of the "fromModule" with instances of the "toModule".
Definition at line 1021 of file Dedup.cpp.
References circt::calyx::direction::get(), and circt::firrtl::detail::getInstanceTypeForClassLike().
|
inlineprivate |
|
inlineprivate |
|
private |
|
private |
|
private |
|
private |
|
private |