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

Private Member Functions

hw::OutputFileAttr getOutputFile (SymbolRefAttr layerName)
 
hw::OutputFileAttr outputFileForLayer (StringRef circuitName, SymbolRefAttr layerName)
 
FModuleOp buildNewModule (OpBuilder &builder, LayerBlockOp layerBlock, SmallVectorImpl< PortInfo > &ports)
 Safely build a new module with a given namehint. More...
 
InnerRefMap runOnModuleLike (FModuleLike moduleLike)
 Strip layer colors from the module's interface. More...
 
void runOnModuleBody (FModuleOp moduleOp, InnerRefMap &innerRefMap)
 Extract layerblocks and strip probe colors from all ops under the module. More...
 
void removeLayersFromPorts (FModuleLike moduleLike)
 Update the module's port types to remove any explicit layer requirements from any probe types. More...
 
void removeLayersFromValue (Value value)
 Update the value's type to remove any layers from any probe types. More...
 
void removeLayersFromRefCast (RefCastOp cast)
 Remove any layers from the result of the cast. More...
 
void lowerInlineLayerBlock (LayerOp layer, LayerBlockOp layerBlock)
 Lower an inline layerblock to an ifdef block. More...
 
void createMacroDecls (CircuitNamespace &ns, OpBuilder &b, LayerOp layer, SmallVector< StringAttr > &stack)
 Create macro declarations for a given layer, and its child layers. More...
 
void createMacroDecls (CircuitNamespace &ns, LayerOp layer)
 
void runOnOperation () override
 Entry point for the function. More...
 

Private Attributes

llvm::sys::SmartMutex< true > * circuitMutex
 Indicates exclusive access to modify the circuitNamespace and the circuit. More...
 
DenseMap< LayerBlockOp, StringRef > moduleNames
 A map of layer blocks to module name that should be created for it. More...
 
DenseMap< LayerOp, FlatSymbolRefAttr > macroNames
 A map from inline layers to their macro names. More...
 

Detailed Description

Definition at line 137 of file LowerLayers.cpp.

Member Function Documentation

◆ buildNewModule()

FModuleOp LowerLayersPass::buildNewModule ( OpBuilder &  builder,
LayerBlockOp  layerBlock,
SmallVectorImpl< PortInfo > &  ports 
)
private

Safely build a new module with a given namehint.

Multi-process safe function to build a module in the circuit and return it.

This handles geting a lock to modify the top-level circuit.

The name provided is only a namehint for the module—a unique name will be generated if there are conflicts with the namehint in the circuit-level namespace.

Definition at line 206 of file LowerLayers.cpp.

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

◆ createMacroDecls() [1/2]

void LowerLayersPass::createMacroDecls ( CircuitNamespace ns,
LayerOp  layer 
)
private

Definition at line 684 of file LowerLayers.cpp.

◆ createMacroDecls() [2/2]

void LowerLayersPass::createMacroDecls ( CircuitNamespace ns,
OpBuilder &  b,
LayerOp  layer,
SmallVector< StringAttr > &  stack 
)
private

Create macro declarations for a given layer, and its child layers.

Definition at line 661 of file LowerLayers.cpp.

References circt::calyx::direction::get(), macroNameForLayer(), and circt::Namespace::newName().

◆ getOutputFile()

hw::OutputFileAttr LowerLayersPass::getOutputFile ( SymbolRefAttr  layerName)
inlineprivate

Definition at line 139 of file LowerLayers.cpp.

◆ lowerInlineLayerBlock()

void LowerLayersPass::lowerInlineLayerBlock ( LayerOp  layer,
LayerBlockOp  layerBlock 
)
private

Lower an inline layerblock to an ifdef block.

Definition at line 299 of file LowerLayers.cpp.

◆ outputFileForLayer()

hw::OutputFileAttr LowerLayersPass::outputFileForLayer ( StringRef  circuitName,
SymbolRefAttr  layerName 
)
inlineprivate

Definition at line 147 of file LowerLayers.cpp.

References fileNameForLayer(), and getOutputFile().

◆ removeLayersFromPorts()

void LowerLayersPass::removeLayersFromPorts ( FModuleLike  moduleLike)
private

Update the module's port types to remove any explicit layer requirements from any probe types.

Definition at line 247 of file LowerLayers.cpp.

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

◆ removeLayersFromRefCast()

void LowerLayersPass::removeLayersFromRefCast ( RefCastOp  cast)
private

Remove any layers from the result of the cast.

If the cast becomes a nop, remove the cast itself from the IR.

Definition at line 231 of file LowerLayers.cpp.

◆ removeLayersFromValue()

void LowerLayersPass::removeLayersFromValue ( Value  value)
private

Update the value's type to remove any layers from any probe types.

Definition at line 224 of file LowerLayers.cpp.

◆ runOnModuleBody()

void LowerLayersPass::runOnModuleBody ( FModuleOp  moduleOp,
InnerRefMap innerRefMap 
)
private

Extract layerblocks and strip probe colors from all ops under the module.

Definition at line 308 of file LowerLayers.cpp.

References assert(), Python.support::connect(), circt::calyx::direction::get(), circt::firrtl::getFieldName(), circt::firrtl::In, instanceNameForLayer(), isAncestor(), and circt::firrtl::Out.

◆ runOnModuleLike()

InnerRefMap LowerLayersPass::runOnModuleLike ( FModuleLike  moduleLike)
private

Strip layer colors from the module's interface.

Definition at line 275 of file LowerLayers.cpp.

References assert().

◆ runOnOperation()

void LowerLayersPass::runOnOperation ( )
overrideprivate

Entry point for the function.

Process a circuit to remove all layer blocks in each module and top-level layer definition.

Definition at line 692 of file LowerLayers.cpp.

References empty, circt::calyx::direction::get(), moduleNameForLayer(), circt::Namespace::newName(), and circt::firrtl::transformReduce().

Member Data Documentation

◆ circuitMutex

llvm::sys::SmartMutex<true>* LowerLayersPass::circuitMutex
private

Indicates exclusive access to modify the circuitNamespace and the circuit.

Definition at line 193 of file LowerLayers.cpp.

◆ macroNames

DenseMap<LayerOp, FlatSymbolRefAttr> LowerLayersPass::macroNames
private

A map from inline layers to their macro names.

Definition at line 199 of file LowerLayers.cpp.

◆ moduleNames

DenseMap<LayerBlockOp, StringRef> LowerLayersPass::moduleNames
private

A map of layer blocks to module name that should be created for it.

Definition at line 196 of file LowerLayers.cpp.


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