CIRCT
20.0.0git
|
#include <CalyxLoweringUtils.h>
Public Member Functions | |
ComponentLoweringStateInterface (calyx::ComponentOp component) | |
~ComponentLoweringStateInterface () | |
calyx::ComponentOp | getComponentOp () |
Returns the calyx::ComponentOp associated with this lowering state. More... | |
void | addBlockArgReg (Block *block, calyx::RegisterOp reg, unsigned idx) |
Register reg as being the idx'th argument register for block. More... | |
const DenseMap< unsigned, calyx::RegisterOp > & | getBlockArgRegs (Block *block) |
Return a mapping of block argument indices to block argument registers. More... | |
void | addBlockArgGroup (Block *from, Block *to, calyx::GroupOp grp) |
Register 'grp' as a group which performs block argument register transfer when transitioning from basic block 'from' to 'to'. More... | |
ArrayRef< calyx::GroupOp > | getBlockArgGroups (Block *from, Block *to) |
Returns a list of groups to be evaluated to perform the block argument register assignments when transitioning from basic block 'from' to 'to'. More... | |
std::string | getUniqueName (StringRef prefix) |
Returns a unique name within compOp with the provided prefix. More... | |
StringRef | getUniqueName (Operation *op) |
Returns a unique name associated with a specific operation. More... | |
void | setUniqueName (Operation *op, StringRef prefix) |
Registers a unique name for a given operation using a provided prefix. More... | |
void | registerEvaluatingGroup (Value v, calyx::GroupInterface group) |
Register value v as being evaluated when scheduling group. More... | |
void | addReturnReg (calyx::RegisterOp reg, unsigned idx) |
Register reg as being the idx'th return value register. More... | |
calyx::RegisterOp | getReturnReg (unsigned idx) |
Returns the idx'th return value register. More... | |
void | registerMemoryInterface (Value memref, const calyx::MemoryInterface &memoryInterface) |
Registers a memory interface as being associated with a memory identified by 'memref'. More... | |
calyx::MemoryInterface | getMemoryInterface (Value memref) |
Returns the memory interface registered for the given memref. More... | |
std::optional< calyx::MemoryInterface > | isInputPortOfMemory (Value v) |
If v is an input to any memory registered within this component, returns the memory. More... | |
void | setFuncOpResultMapping (const DenseMap< unsigned, unsigned > &mapping) |
Assign a mapping between the source funcOp result indices and the corresponding output port indices of this componentOp. More... | |
unsigned | getFuncOpResultMapping (unsigned funcReturnIdx) |
Get the output port index of this component for which the funcReturnIdx of the original function maps to. More... | |
InstanceOp | getInstance (StringRef calleeName) |
The instance is obtained from the name of the callee. More... | |
void | addInstance (StringRef calleeName, InstanceOp instanceOp) |
Put the name of the callee and the instance of the call into map. More... | |
template<typename TGroupOp = calyx::GroupInterface> | |
TGroupOp | getEvaluatingGroup (Value v) |
Return the group which evaluates the value v. More... | |
template<typename TLibraryOp > | |
TLibraryOp | getNewLibraryOpInstance (OpBuilder &builder, Location loc, TypeRange resTypes) |
Private Attributes | |
calyx::ComponentOp | component |
The component which this lowering state is associated to. More... | |
DenseMap< Block *, DenseMap< unsigned, calyx::RegisterOp > > | blockArgRegs |
A mapping from blocks to block argument registers. More... | |
DenseMap< Block *, DenseMap< Block *, SmallVector< calyx::GroupOp > > > | blockArgGroups |
Block arg groups is a list of groups that should be sequentially executed when passing control from the source to destination block. More... | |
std::map< std::string, unsigned > | prefixIdMap |
A mapping of string prefixes and the current uniqueness counter for that prefix. More... | |
std::map< Operation *, std::string > | opNames |
A mapping from Operations and previously assigned unique name of the op. More... | |
DenseMap< Value, calyx::GroupInterface > | valueGroupAssigns |
A mapping between SSA values and the groups which assign them. More... | |
DenseMap< unsigned, calyx::RegisterOp > | returnRegs |
A mapping from return value indexes to return value registers. More... | |
DenseMap< Value, calyx::MemoryInterface > | memories |
A mapping from memref's to their corresponding Calyx memory interface. More... | |
DenseMap< unsigned, unsigned > | funcOpResultMapping |
A mapping between the source funcOp result indices and the corresponding output port indices of this componentOp. More... | |
llvm::StringMap< calyx::InstanceOp > | instanceMap |
A mapping between the callee and the instance. More... | |
Definition at line 336 of file CalyxLoweringUtils.h.
circt::calyx::ComponentLoweringStateInterface::ComponentLoweringStateInterface | ( | calyx::ComponentOp | component | ) |
Definition at line 317 of file CalyxLoweringUtils.cpp.
|
default |
void circt::calyx::ComponentLoweringStateInterface::addBlockArgGroup | ( | Block * | from, |
Block * | to, | ||
calyx::GroupOp | grp | ||
) |
Register 'grp' as a group which performs block argument register transfer when transitioning from basic block 'from' to 'to'.
Definition at line 340 of file CalyxLoweringUtils.cpp.
References blockArgGroups.
void circt::calyx::ComponentLoweringStateInterface::addBlockArgReg | ( | Block * | block, |
calyx::RegisterOp | reg, | ||
unsigned | idx | ||
) |
Register reg as being the idx'th argument register for block.
This is necessary for the BuildBBReg
pass.
Definition at line 327 of file CalyxLoweringUtils.cpp.
References assert(), blockArgRegs, and seq::reg().
void circt::calyx::ComponentLoweringStateInterface::addInstance | ( | StringRef | calleeName, |
InstanceOp | instanceOp | ||
) |
Put the name of the callee and the instance of the call into map.
Definition at line 432 of file CalyxLoweringUtils.cpp.
References instanceMap.
void circt::calyx::ComponentLoweringStateInterface::addReturnReg | ( | calyx::RegisterOp | reg, |
unsigned | idx | ||
) |
Register reg as being the idx'th return value register.
Definition at line 375 of file CalyxLoweringUtils.cpp.
References assert(), seq::reg(), and returnRegs.
ArrayRef< calyx::GroupOp > circt::calyx::ComponentLoweringStateInterface::getBlockArgGroups | ( | Block * | from, |
Block * | to | ||
) |
Returns a list of groups to be evaluated to perform the block argument register assignments when transitioning from basic block 'from' to 'to'.
Definition at line 346 of file CalyxLoweringUtils.cpp.
References blockArgGroups.
const DenseMap< unsigned, calyx::RegisterOp > & circt::calyx::ComponentLoweringStateInterface::getBlockArgRegs | ( | Block * | block | ) |
Return a mapping of block argument indices to block argument registers.
This is necessary for the BuildBBReg
pass.
Definition at line 336 of file CalyxLoweringUtils.cpp.
References blockArgRegs.
calyx::ComponentOp circt::calyx::ComponentLoweringStateInterface::getComponentOp | ( | ) |
Returns the calyx::ComponentOp associated with this lowering state.
Definition at line 323 of file CalyxLoweringUtils.cpp.
References component.
Referenced by circt::pipelinetocalyx::buildAllocOp(), and circt::scftocalyx::buildAllocOp().
|
inline |
Return the group which evaluates the value v.
Optionally, caller may specify the expected type of the group.
Definition at line 408 of file CalyxLoweringUtils.h.
References assert(), and valueGroupAssigns.
Referenced by circt::calyx::InlineCombGroups::recurseInlineCombGroups().
unsigned circt::calyx::ComponentLoweringStateInterface::getFuncOpResultMapping | ( | unsigned | funcReturnIdx | ) |
Get the output port index of this component for which the funcReturnIdx of the original function maps to.
Definition at line 419 of file CalyxLoweringUtils.cpp.
References assert(), and funcOpResultMapping.
InstanceOp circt::calyx::ComponentLoweringStateInterface::getInstance | ( | StringRef | calleeName | ) |
The instance is obtained from the name of the callee.
Definition at line 428 of file CalyxLoweringUtils.cpp.
References instanceMap.
calyx::MemoryInterface circt::calyx::ComponentLoweringStateInterface::getMemoryInterface | ( | Value | memref | ) |
Returns the memory interface registered for the given memref.
Definition at line 396 of file CalyxLoweringUtils.cpp.
|
inline |
Definition at line 421 of file CalyxLoweringUtils.h.
References component, and getUniqueName().
calyx::RegisterOp circt::calyx::ComponentLoweringStateInterface::getReturnReg | ( | unsigned | idx | ) |
Returns the idx'th return value register.
Definition at line 382 of file CalyxLoweringUtils.cpp.
References assert(), and returnRegs.
StringRef circt::calyx::ComponentLoweringStateInterface::getUniqueName | ( | Operation * | op | ) |
Returns a unique name associated with a specific operation.
Definition at line 357 of file CalyxLoweringUtils.cpp.
std::string circt::calyx::ComponentLoweringStateInterface::getUniqueName | ( | StringRef | prefix | ) |
Returns a unique name within compOp with the provided prefix.
Definition at line 350 of file CalyxLoweringUtils.cpp.
References prefixIdMap.
Referenced by circt::pipelinetocalyx::buildAllocOp(), circt::scftocalyx::buildAllocOp(), getNewLibraryOpInstance(), and setUniqueName().
std::optional< calyx::MemoryInterface > circt::calyx::ComponentLoweringStateInterface::isInputPortOfMemory | ( | Value | v | ) |
If v is an input to any memory registered within this component, returns the memory.
If not, returns null.
Definition at line 404 of file CalyxLoweringUtils.cpp.
References memories.
void circt::calyx::ComponentLoweringStateInterface::registerEvaluatingGroup | ( | Value | v, |
calyx::GroupInterface | group | ||
) |
Register value v as being evaluated when scheduling group.
Definition at line 370 of file CalyxLoweringUtils.cpp.
References valueGroupAssigns.
void circt::calyx::ComponentLoweringStateInterface::registerMemoryInterface | ( | Value | memref, |
const calyx::MemoryInterface & | memoryInterface | ||
) |
Registers a memory interface as being associated with a memory identified by 'memref'.
Definition at line 387 of file CalyxLoweringUtils.cpp.
References assert(), and memories.
Referenced by circt::pipelinetocalyx::buildAllocOp(), and circt::scftocalyx::buildAllocOp().
void circt::calyx::ComponentLoweringStateInterface::setFuncOpResultMapping | ( | const DenseMap< unsigned, unsigned > & | mapping | ) |
Assign a mapping between the source funcOp result indices and the corresponding output port indices of this componentOp.
Definition at line 414 of file CalyxLoweringUtils.cpp.
References funcOpResultMapping.
Referenced by circt::pipelinetocalyx::FuncOpConversion::partiallyLowerFuncToComp(), and circt::scftocalyx::FuncOpConversion::partiallyLowerFuncToComp().
void circt::calyx::ComponentLoweringStateInterface::setUniqueName | ( | Operation * | op, |
StringRef | prefix | ||
) |
Registers a unique name for a given operation using a provided prefix.
Definition at line 363 of file CalyxLoweringUtils.cpp.
References assert(), getUniqueName(), and opNames.
|
private |
Block arg groups is a list of groups that should be sequentially executed when passing control from the source to destination block.
Block arg groups are executed before blockScheduleables (akin to a phi-node).
Definition at line 442 of file CalyxLoweringUtils.h.
Referenced by addBlockArgGroup(), and getBlockArgGroups().
|
private |
A mapping from blocks to block argument registers.
Definition at line 435 of file CalyxLoweringUtils.h.
Referenced by addBlockArgReg(), and getBlockArgRegs().
|
private |
The component which this lowering state is associated to.
Definition at line 432 of file CalyxLoweringUtils.h.
Referenced by getComponentOp(), and getNewLibraryOpInstance().
|
private |
A mapping between the source funcOp result indices and the corresponding output port indices of this componentOp.
Definition at line 462 of file CalyxLoweringUtils.h.
Referenced by getFuncOpResultMapping(), and setFuncOpResultMapping().
|
private |
A mapping between the callee and the instance.
Definition at line 465 of file CalyxLoweringUtils.h.
Referenced by addInstance(), and getInstance().
|
private |
A mapping from memref's to their corresponding Calyx memory interface.
Definition at line 458 of file CalyxLoweringUtils.h.
Referenced by getMemoryInterface(), isInputPortOfMemory(), and registerMemoryInterface().
|
private |
A mapping from Operations and previously assigned unique name of the op.
Definition at line 449 of file CalyxLoweringUtils.h.
Referenced by getUniqueName(), and setUniqueName().
|
private |
A mapping of string prefixes and the current uniqueness counter for that prefix.
Used to generate unique names.
Definition at line 446 of file CalyxLoweringUtils.h.
Referenced by getUniqueName().
|
private |
A mapping from return value indexes to return value registers.
Definition at line 455 of file CalyxLoweringUtils.h.
Referenced by addReturnReg(), and getReturnReg().
|
private |
A mapping between SSA values and the groups which assign them.
Definition at line 452 of file CalyxLoweringUtils.h.
Referenced by getEvaluatingGroup(), and registerEvaluatingGroup().