CIRCT 20.0.0git
Loading...
Searching...
No Matches
Private Member Functions | List of all members
circt::pipelinetocalyx::BuildOpGroups Class Reference

Iterate through the operations of a source function and instantiate components or primitives based on the type of the operations. More...

Inheritance diagram for circt::pipelinetocalyx::BuildOpGroups:
Inheritance graph
[legend]
Collaboration diagram for circt::pipelinetocalyx::BuildOpGroups:
Collaboration graph
[legend]

Private Member Functions

LogicalResult partiallyLowerFuncToComp (FuncOp funcOp, PatternRewriter &rewriter) const override
 
LogicalResult buildOp (PatternRewriter &rewriter, BranchOpInterface brOp) const
 Op builder specializations.
 
LogicalResult buildOp (PatternRewriter &rewriter, arith::ConstantOp constOp) 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, RemUIOp 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, 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, memref::AllocOp op) const
 
LogicalResult buildOp (PatternRewriter &rewriter, memref::AllocaOp op) const
 
LogicalResult buildOp (PatternRewriter &rewriter, memref::LoadOp op) const
 
LogicalResult buildOp (PatternRewriter &rewriter, memref::StoreOp op) const
 
LogicalResult buildOp (PatternRewriter &rewriter, LoopScheduleTerminatorOp 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.
 
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.
 

Additional Inherited Members

- 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.
 
calyx::ComponentOp getComponent () const
 Returns the component operation associated with the currently executing partial lowering.
 
template<typename T = ComponentLoweringStateInterface>
T & getState () const
 
CalyxLoweringStateloweringState () const
 Return the calyx lowering state for this pattern.
 
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
 
- Protected Attributes inherited from circt::calyx::FuncOpPartialLoweringPattern
DenseMap< mlir::func::FuncOp, calyx::ComponentOp > & functionMapping
 

Detailed Description

Iterate through the operations of a source function and instantiate components or primitives based on the type of the operations.

Definition at line 222 of file LoopScheduleToCalyx.cpp.

Member Function Documentation

◆ assignAddressPorts()

void circt::pipelinetocalyx::BuildOpGroups::assignAddressPorts ( PatternRewriter &  rewriter,
Location  loc,
calyx::GroupInterface  group,
calyx::MemoryInterface  memoryInterface,
Operation::operand_range  addressValues 
) const
inlineprivate

Creates assignments within the provided group to the address ports of the memoryOp based on the provided addressValues.

Definition at line 403 of file LoopScheduleToCalyx.cpp.

References circt::calyx::MemoryInterface::addrPorts(), assert(), and circt::calyx::FuncOpPartialLoweringPattern::getComponent().

Referenced by buildOp(), and buildOp().

◆ buildLibraryBinaryPipeOp()

template<typename TOpType , typename TSrcOp >
LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildLibraryBinaryPipeOp ( PatternRewriter &  rewriter,
TSrcOp  op,
TOpType  opPipe,
Value  out 
) const
inlineprivate

buildLibraryBinaryPipeOp will build a TCalyxLibBinaryPipeOp, to deal with MulIOp, DivUIOp and RemUIOp.

Definition at line 363 of file LoopScheduleToCalyx.cpp.

References circt::calyx::FuncOpPartialLoweringPattern::getComponent().

◆ buildLibraryOp() [1/2]

template<typename TGroupOp , typename TCalyxLibOp , typename TSrcOp >
LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildLibraryOp ( PatternRewriter &  rewriter,
TSrcOp  op 
) const
inlineprivate

buildLibraryOp which provides in- and output types based on the operands and results of the op argument.

Definition at line 344 of file LoopScheduleToCalyx.cpp.

◆ buildLibraryOp() [2/2]

template<typename TGroupOp , typename TCalyxLibOp , typename TSrcOp >
LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildLibraryOp ( PatternRewriter &  rewriter,
TSrcOp  op,
TypeRange  srcTypes,
TypeRange  dstTypes 
) const
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 295 of file LoopScheduleToCalyx.cpp.

References assert(), and circt::calyx::Input.

◆ buildOp() [1/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
AddIOp  op 
) const
private

Definition at line 677 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [2/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
AndIOp  op 
) const
private

Definition at line 697 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [3/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
arith::ConstantOp  constOp 
) const
private

Move constant operations to the compOp body as hw::ConstantOp's.

Definition at line 666 of file LoopScheduleToCalyx.cpp.

References circt::calyx::FuncOpPartialLoweringPattern::getComponent(), and circt::calyx::matchConstantOp().

◆ buildOp() [4/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
BranchOpInterface  brOp 
) const
private

Op builder specializations.

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 608 of file LoopScheduleToCalyx.cpp.

References circt::calyx::CalyxLoweringState::blockName(), circt::calyx::buildAssignmentsForRegisterWrite(), circt::calyx::FuncOpPartialLoweringPattern::getComponent(), and circt::calyx::FuncOpPartialLoweringPattern::loweringState().

Referenced by partiallyLowerFuncToComp().

◆ buildOp() [5/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
CmpIOp  op 
) const
private

Definition at line 710 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [6/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
DivUIOp  op 
) const
private

Definition at line 529 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [7/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
ExtUIOp  op 
) const
private

Definition at line 741 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [8/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
IndexCastOp  op 
) const
private

Drop the index cast and replace uses of the target value with the source value.

pad/slice the source operand.

Definition at line 747 of file LoopScheduleToCalyx.cpp.

References circt::calyx::normalizeType().

◆ buildOp() [9/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
LoopScheduleTerminatorOp  op 
) const
private

Definition at line 595 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [10/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
memref::AllocaOp  op 
) const
private

Definition at line 590 of file LoopScheduleToCalyx.cpp.

References circt::pipelinetocalyx::buildAllocOp().

◆ buildOp() [11/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
memref::AllocOp  op 
) const
private

Definition at line 585 of file LoopScheduleToCalyx.cpp.

References circt::pipelinetocalyx::buildAllocOp().

◆ buildOp() [12/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
memref::LoadOp  op 
) const
private

◆ buildOp() [13/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
memref::StoreOp  op 
) const
private

◆ buildOp() [14/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
MulIOp  op 
) const
private

Definition at line 516 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [15/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
OrIOp  op 
) const
private

Definition at line 701 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [16/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
RemUIOp  op 
) const
private

Definition at line 542 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [17/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
ReturnOp  op 
) const
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 645 of file LoopScheduleToCalyx.cpp.

References circt::calyx::buildAssignmentsForRegisterWrite(), and circt::calyx::FuncOpPartialLoweringPattern::getComponent().

◆ buildOp() [18/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
ShLIOp  op 
) const
private

Definition at line 693 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [19/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
ShRSIOp  op 
) const
private

Definition at line 689 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [20/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
ShRUIOp  op 
) const
private

Definition at line 685 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [21/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
SubIOp  op 
) const
private

Definition at line 681 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [22/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
TruncIOp  op 
) const
private

Definition at line 736 of file LoopScheduleToCalyx.cpp.

◆ buildOp() [23/23]

LogicalResult circt::pipelinetocalyx::BuildOpGroups::buildOp ( PatternRewriter &  rewriter,
XOrIOp  op 
) const
private

Definition at line 705 of file LoopScheduleToCalyx.cpp.

◆ createGroupForOp()

template<typename TGroupOp >
TGroupOp circt::pipelinetocalyx::BuildOpGroups::createGroupForOp ( PatternRewriter &  rewriter,
Operation *  op 
) const
inlineprivate

Creates a group named by the basic block which the input op resides in.

Definition at line 351 of file LoopScheduleToCalyx.cpp.

References circt::calyx::FuncOpPartialLoweringPattern::loweringState().

◆ partiallyLowerFuncToComp()

LogicalResult circt::pipelinetocalyx::BuildOpGroups::partiallyLowerFuncToComp ( FuncOp  funcOp,
PatternRewriter &  rewriter 
) const
inlineoverrideprivate

We walk the operations of the funcOp to ensure that all def's have been visited before their uses.

memref

standard arithmetic

static logic

Skip: these special cases will be handled separately.

Definition at line 226 of file LoopScheduleToCalyx.cpp.

References buildOp().


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