CIRCT  20.0.0git
Public Member Functions | List of all members
circt::scftocalyx::FuncOpConversion Struct Reference

Creates a new Calyx component for each FuncOp in the program. More...

Inheritance diagram for circt::scftocalyx::FuncOpConversion:
Inheritance graph
[legend]
Collaboration diagram for circt::scftocalyx::FuncOpConversion:
Collaboration graph
[legend]

Public Member Functions

LogicalResult partiallyLowerFuncToComp (FuncOp funcOp, PatternRewriter &rewriter) const override
 
- Public Member Functions inherited from circt::calyx::FuncOpPartialLoweringPattern
 FuncOpPartialLoweringPattern (MLIRContext *context, LogicalResult &resRef, PatternApplicationState &patternState, DenseMap< mlir::func::FuncOp, calyx::ComponentOp > &map, calyx::CalyxLoweringState &state)
 
LogicalResult partiallyLower (mlir::func::FuncOp funcOp, PatternRewriter &rewriter) const override final
 Entry point to initialize the state of this class and conduct the partial lowering. More...
 
calyx::ComponentOp getComponent () const
 Returns the component operation associated with the currently executing partial lowering. More...
 
template<typename T = ComponentLoweringStateInterface>
T & getState () const
 
CalyxLoweringStateloweringState () const
 Return the calyx lowering state for this pattern. More...
 
virtual LogicalResult partiallyLowerFuncToComp (mlir::func::FuncOp funcOp, PatternRewriter &rewriter) const =0
 
- Public Member Functions inherited from circt::calyx::PartialLoweringPattern< mlir::func::FuncOp >
 PartialLoweringPattern (MLIRContext *ctx, LogicalResult &resRef, PatternApplicationState &patternState)
 
LogicalResult matchAndRewrite (mlir::func::FuncOp op, PatternRewriter &rewriter) const override
 

Additional Inherited Members

- Protected Attributes inherited from circt::calyx::FuncOpPartialLoweringPattern
DenseMap< mlir::func::FuncOp, calyx::ComponentOp > & functionMapping
 

Detailed Description

Creates a new Calyx component for each FuncOp in the program.

Definition at line 1541 of file SCFToCalyx.cpp.

Member Function Documentation

◆ partiallyLowerFuncToComp()

LogicalResult circt::scftocalyx::FuncOpConversion::partiallyLowerFuncToComp ( FuncOp  funcOp,
PatternRewriter &  rewriter 
) const
inlineoverride

Maintain a mapping between funcOp input arguments and the port index which the argument will eventually map to.

Maintain a mapping between funcOp output indexes and the component output port index which the return value will eventually map to.

Maintain a mapping between an external memory argument (identified by a memref) and eventual component input- and output port indices that will map to the memory ports. The pair denotes the start index of the memory ports in the in- and output ports of the component. Ports are expected to be ordered in the same manner as they are added by calyx::appendPortsForExternalMemref.

Create I/O ports. Maintain separate in/out port vectors to determine which port index each function argument will eventually map to.

Single-port arguments

We've now recorded all necessary indices. Merge in- and output ports and add the required mandatory component ports.

Create a calyx::ComponentOp corresponding to the to-be-lowered function.

Mark this component as the toplevel if it's the top-level function of the module.

Store the function-to-component mapping.

Rewrite funcOp SSA argument values to the CompOp arguments.

Definition at line 1545 of file SCFToCalyx.cpp.

References circt::calyx::addMandatoryComponentPorts(), circt::calyx::convIndexType(), circt::calyx::direction::get(), circt::calyx::handleZeroWidth(), Input, loweringState, Output, circt::calyx::ComponentLoweringStateInterface::setFuncOpResultMapping(), and circt::scfToCalyx::sPortNameAttr.


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