CIRCT 22.0.0git
|
Iterate through the operations of a source function and instantiate components or primitives based on the type of the operations. More...
Public Member Functions | |
BuildOpGroups (MLIRContext *context, LogicalResult &resRef, calyx::PatternApplicationState &patternState, DenseMap< mlir::func::FuncOp, calyx::ComponentOp > &map, calyx::CalyxLoweringState &state, mlir::Pass::Option< std::string > &writeJsonOpt) | |
LogicalResult | partiallyLowerFuncToComp (FuncOp funcOp, PatternRewriter &rewriter) const override |
![]() | |
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. | |
calyx::ComponentOp | getComponent () const |
Returns the component operation associated with the currently executing partial lowering. | |
template<typename T = ComponentLoweringStateInterface> | |
T & | getState () const |
CalyxLoweringState & | loweringState () const |
Return the calyx lowering state for this pattern. | |
virtual LogicalResult | partiallyLowerFuncToComp (mlir::func::FuncOp funcOp, PatternRewriter &rewriter) const =0 |
![]() | |
PartialLoweringPattern (MLIRContext *ctx, LogicalResult &resRef, PatternApplicationState &patternState) | |
LogicalResult | matchAndRewrite (mlir::func::FuncOp op, PatternRewriter &rewriter) const override |
Private Member Functions | |
LogicalResult | buildOp (PatternRewriter &rewriter, scf::YieldOp yieldOp) const |
Op builder specializations. | |
LogicalResult | buildOp (PatternRewriter &rewriter, BranchOpInterface brOp) const |
LogicalResult | buildOp (PatternRewriter &rewriter, arith::ConstantOp constOp) const |
LogicalResult | buildOp (PatternRewriter &rewriter, SelectOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, AddIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, SubIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, MulIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, DivUIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, DivSIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, RemUIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, RemSIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, AddFOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, SubFOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, MulFOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, CmpFOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, FPToSIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, SIToFPOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, DivFOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, math::SqrtOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, math::AbsFOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, ShRUIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, ShRSIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, ShLIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, AndIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, OrIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, XOrIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, CmpIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, TruncIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, ExtUIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, ExtSIOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, ReturnOp op) const |
For each return statement, we create a new group for assigning to the previously created return value registers. | |
LogicalResult | buildOp (PatternRewriter &rewriter, IndexCastOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, BitcastOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, memref::AllocOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, memref::AllocaOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, memref::GetGlobalOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, memref::LoadOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, memref::StoreOp op) const |
LogicalResult | buildOp (PatternRewriter &rewriter, scf::WhileOp whileOp) const |
LogicalResult | buildOp (PatternRewriter &rewriter, scf::ForOp forOp) const |
LogicalResult | buildOp (PatternRewriter &rewriter, scf::IfOp ifOp) const |
LogicalResult | buildOp (PatternRewriter &rewriter, scf::ReduceOp reduceOp) const |
LogicalResult | buildOp (PatternRewriter &rewriter, scf::ParallelOp parallelOp) const |
LogicalResult | buildOp (PatternRewriter &rewriter, scf::ExecuteRegionOp executeRegionOp) const |
LogicalResult | buildOp (PatternRewriter &rewriter, CallOp callOp) const |
template<typename TCalyxLibOp > | |
void | setupCmpIOp (PatternRewriter &rewriter, CmpIOp cmpIOp, Operation *group, calyx::RegisterOp &condReg, calyx::RegisterOp &resReg, TCalyxLibOp calyxOp) const |
template<typename CmpILibOp > | |
LogicalResult | buildCmpIOpHelper (PatternRewriter &rewriter, CmpIOp op) const |
template<typename TGroupOp , typename TCalyxLibOp , typename TSrcOp > | |
LogicalResult | buildLibraryOp (PatternRewriter &rewriter, TSrcOp op, TypeRange srcTypes, TypeRange dstTypes) const |
buildLibraryOp will build a TCalyxLibOp inside a TGroupOp based on the source operation TSrcOp. | |
template<typename TGroupOp , typename TCalyxLibOp , typename TSrcOp > | |
LogicalResult | buildLibraryOp (PatternRewriter &rewriter, TSrcOp op) const |
buildLibraryOp which provides in- and output types based on the operands and results of the op argument. | |
template<typename TGroupOp > | |
TGroupOp | createGroupForOp (PatternRewriter &rewriter, Operation *op) const |
Creates a group named by the basic block which the input op resides in. | |
template<typename TOpType , typename TSrcOp > | |
LogicalResult | buildLibraryBinaryPipeOp (PatternRewriter &rewriter, TSrcOp op, TOpType opPipe, Value out) const |
buildLibraryBinaryPipeOp will build a TCalyxLibBinaryPipeOp, to deal with MulIOp, DivUIOp and RemUIOp. | |
template<typename TCalyxLibOp , typename TSrcOp > | |
LogicalResult | buildFpIntTypeCastOp (PatternRewriter &rewriter, TSrcOp op, unsigned inputWidth, unsigned outputWidth, StringRef signedPort) const |
void | assignAddressPorts (PatternRewriter &rewriter, Location loc, calyx::GroupInterface group, calyx::MemoryInterface memoryInterface, Operation::operand_range addressValues) const |
Creates assignments within the provided group to the address ports of the memoryOp based on the provided addressValues. | |
calyx::RegisterOp | createSignalRegister (PatternRewriter &rewriter, Value signal, bool invert, StringRef nameSuffix, calyx::CompareFOpIEEE754 calyxCmpFOp, calyx::GroupOp group) const |
Private Attributes | |
mlir::Pass::Option< std::string > & | writeJson |
Additional Inherited Members | |
![]() | |
DenseMap< mlir::func::FuncOp, calyx::ComponentOp > & | functionMapping |
Iterate through the operations of a source function and instantiate components or primitives based on the type of the operations.
Definition at line 322 of file SCFToCalyx.cpp.
|
inline |
Definition at line 324 of file SCFToCalyx.cpp.
|
inlineprivate |
Creates assignments within the provided group to the address ports of the memoryOp based on the provided addressValues.
Definition at line 728 of file SCFToCalyx.cpp.
References circt::calyx::MemoryInterface::addrPorts(), assert(), and circt::calyx::FuncOpPartialLoweringPattern::getComponent().
|
inlineprivate |
Definition at line 513 of file SCFToCalyx.cpp.
References circt::calyx::parentIsSeqCell().
|
inlineprivate |
Definition at line 680 of file SCFToCalyx.cpp.
References circt::comb::createOrFoldNot(), getBodyBlock(), and circt::calyx::FuncOpPartialLoweringPattern::getComponent().
|
inlineprivate |
buildLibraryBinaryPipeOp will build a TCalyxLibBinaryPipeOp, to deal with MulIOp, DivUIOp and RemUIOp.
Definition at line 606 of file SCFToCalyx.cpp.
References circt::comb::createOrFoldNot(), and circt::calyx::FuncOpPartialLoweringPattern::getComponent().
|
inlineprivate |
buildLibraryOp which provides in- and output types based on the operands and results of the op argument.
Definition at line 587 of file SCFToCalyx.cpp.
|
inlineprivate |
buildLibraryOp will build a TCalyxLibOp inside a TGroupOp based on the source operation TSrcOp.
Create assignments to the inputs of the library op.
Replace the result values of the source operator with the new operator.
Definition at line 527 of file SCFToCalyx.cpp.
References assert(), circt::calyx::Input, circt::calyx::parentIsSeqCell(), setupCmpIOp(), and circt::calyx::toBitVector().
|
private |
Definition at line 977 of file SCFToCalyx.cpp.
|
private |
Definition at line 1621 of file SCFToCalyx.cpp.
|
private |
Definition at line 1641 of file SCFToCalyx.cpp.
|
private |
Move constant operations to the compOp body as hw::ConstantOp's.
Definition at line 1596 of file SCFToCalyx.cpp.
References getBodyBlock(), circt::calyx::FuncOpPartialLoweringPattern::getComponent(), and circt::calyx::matchConstantOp().
|
private |
Definition at line 1729 of file SCFToCalyx.cpp.
|
private |
Branch argument passing group creation Branch operands are passed through registers. In BuildBasicBlockRegs we created registers for all branch arguments of each block. We now create groups for assigning values to these registers.
Register the group as a block argument group, to be executed when entering the successor block from this block (srcBlock).
Definition at line 1538 of file SCFToCalyx.cpp.
References circt::calyx::CalyxLoweringState::blockName(), circt::calyx::buildAssignmentsForRegisterWrite(), circt::calyx::FuncOpPartialLoweringPattern::getComponent(), and circt::calyx::FuncOpPartialLoweringPattern::loweringState().
|
private |
Definition at line 1803 of file SCFToCalyx.cpp.
References circt::calyx::getInstanceName(), and circt::calyx::Output.
|
private |
Definition at line 1025 of file SCFToCalyx.cpp.
References circt::comb::createOrFoldNot(), createSignalRegister(), getBodyBlock(), circt::calyx::FuncOpPartialLoweringPattern::getComponent(), and circt::calyx::getPredicateInfo().
|
private |
Definition at line 1658 of file SCFToCalyx.cpp.
|
private |
Definition at line 1216 of file SCFToCalyx.cpp.
|
private |
Definition at line 938 of file SCFToCalyx.cpp.
|
private |
Definition at line 925 of file SCFToCalyx.cpp.
|
private |
Definition at line 1696 of file SCFToCalyx.cpp.
|
private |
Definition at line 1690 of file SCFToCalyx.cpp.
|
private |
Definition at line 1202 of file SCFToCalyx.cpp.
|
private |
Drop the index cast and replace uses of the target value with the source value.
pad/slice the source operand.
Definition at line 1702 of file SCFToCalyx.cpp.
References circt::calyx::normalizeType().
|
private |
Definition at line 1252 of file SCFToCalyx.cpp.
|
private |
Definition at line 1234 of file SCFToCalyx.cpp.
|
private |
Definition at line 1394 of file SCFToCalyx.cpp.
References circt::scftocalyx::buildAllocOp().
|
private |
Definition at line 1389 of file SCFToCalyx.cpp.
References circt::scftocalyx::buildAllocOp().
|
private |
Definition at line 1399 of file SCFToCalyx.cpp.
References circt::scftocalyx::buildAllocOp().
|
private |
Definition at line 782 of file SCFToCalyx.cpp.
References assignAddressPorts(), circt::calyx::createConstant(), circt::calyx::FuncOpPartialLoweringPattern::getComponent(), circt::calyx::noStoresToMemory(), and circt::calyx::singleLoadFromMemory().
|
private |
Definition at line 881 of file SCFToCalyx.cpp.
References assignAddressPorts(), and circt::calyx::FuncOpPartialLoweringPattern::getComponent().
|
private |
Definition at line 1009 of file SCFToCalyx.cpp.
|
private |
Definition at line 912 of file SCFToCalyx.cpp.
|
private |
Definition at line 1645 of file SCFToCalyx.cpp.
|
private |
Definition at line 964 of file SCFToCalyx.cpp.
|
private |
Definition at line 951 of file SCFToCalyx.cpp.
|
private |
For each return statement, we create a new group for assigning to the previously created return value registers.
Schedule group for execution for when executing the return op block.
Definition at line 1575 of file SCFToCalyx.cpp.
References circt::calyx::buildAssignmentsForRegisterWrite(), and circt::calyx::FuncOpPartialLoweringPattern::getComponent().
|
private |
Definition at line 1795 of file SCFToCalyx.cpp.
|
private |
Definition at line 1745 of file SCFToCalyx.cpp.
References circt::scftocalyx::ScfForOp::getBound(), and circt::calyx::RepeatOpInterface< T >::getOperation().
|
private |
Definition at line 1767 of file SCFToCalyx.cpp.
|
private |
Definition at line 1782 of file SCFToCalyx.cpp.
References circt::scftocalyx::unrolledParallelAttr.
|
private |
Definition at line 1774 of file SCFToCalyx.cpp.
|
private |
Definition at line 1735 of file SCFToCalyx.cpp.
|
private |
Op builder specializations.
Definition at line 1405 of file SCFToCalyx.cpp.
References circt::calyx::FuncOpPartialLoweringPattern::componentOp, circt::calyx::Input, and circt::calyx::Output.
Referenced by partiallyLowerFuncToComp().
|
private |
Definition at line 1653 of file SCFToCalyx.cpp.
|
private |
Definition at line 1637 of file SCFToCalyx.cpp.
|
private |
Definition at line 1633 of file SCFToCalyx.cpp.
|
private |
Definition at line 1629 of file SCFToCalyx.cpp.
|
private |
Definition at line 1209 of file SCFToCalyx.cpp.
|
private |
Definition at line 993 of file SCFToCalyx.cpp.
|
private |
Definition at line 1625 of file SCFToCalyx.cpp.
|
private |
Definition at line 1685 of file SCFToCalyx.cpp.
|
private |
Definition at line 1649 of file SCFToCalyx.cpp.
|
inlineprivate |
Creates a group named by the basic block which the input op resides in.
Definition at line 594 of file SCFToCalyx.cpp.
References circt::calyx::FuncOpPartialLoweringPattern::loweringState().
|
inlineprivate |
Definition at line 754 of file SCFToCalyx.cpp.
References circt::calyx::FuncOpPartialLoweringPattern::getComponent().
Referenced by buildOp().
|
inlineoverride |
We walk the operations of the funcOp to ensure that all def's have been visited before their uses.
SCF
memref
standard arithmetic
floating point
others
Skip: these special cases will be handled separately.
Definition at line 334 of file SCFToCalyx.cpp.
|
inlineprivate |
Definition at line 460 of file SCFToCalyx.cpp.
References assert(), circt::calyx::FuncOpPartialLoweringPattern::getComponent(), and circt::calyx::parentIsSeqCell().
Referenced by buildLibraryOp().
|
private |
Definition at line 402 of file SCFToCalyx.cpp.
Referenced by partiallyLowerFuncToComp().