CIRCT
20.0.0git
|
#include <CalyxLoweringUtils.h>
Classes | |
struct | IsFloatingPoint |
struct | IsFloatingPoint< T, std::void_t< decltype(std::declval< T >().getFloatingPointStandard())> > |
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) |
llvm::json::Value & | getExtMemData () |
const llvm::json::Value & | getExtMemData () const |
void | setDataField (StringRef name, llvm::json::Array data) |
void | setFormat (StringRef name, std::string numType, bool isSigned, unsigned width) |
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... | |
llvm::json::Value | extMemData |
A json file to store external global memory data. More... | |
Definition at line 338 of file CalyxLoweringUtils.h.
circt::calyx::ComponentLoweringStateInterface::ComponentLoweringStateInterface | ( | calyx::ComponentOp | component | ) |
Definition at line 319 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 342 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 329 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 434 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 377 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 348 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 338 of file CalyxLoweringUtils.cpp.
References blockArgRegs.
calyx::ComponentOp circt::calyx::ComponentLoweringStateInterface::getComponentOp | ( | ) |
Returns the calyx::ComponentOp associated with this lowering state.
Definition at line 325 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 410 of file CalyxLoweringUtils.h.
References assert(), and valueGroupAssigns.
Referenced by circt::calyx::ConvertIndexTypes::FuncOpPartialLoweringPattern().
|
inline |
Definition at line 455 of file CalyxLoweringUtils.h.
References extMemData.
|
inline |
Definition at line 457 of file CalyxLoweringUtils.h.
References extMemData.
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 421 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 430 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 398 of file CalyxLoweringUtils.cpp.
|
inline |
Definition at line 432 of file CalyxLoweringUtils.h.
References assert(), component, getUniqueName(), and circt::calyx::IEEE754.
calyx::RegisterOp circt::calyx::ComponentLoweringStateInterface::getReturnReg | ( | unsigned | idx | ) |
Returns the idx'th return value register.
Definition at line 384 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 359 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 352 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 406 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 372 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 389 of file CalyxLoweringUtils.cpp.
References assert(), and memories.
Referenced by circt::pipelinetocalyx::buildAllocOp(), and circt::scftocalyx::buildAllocOp().
|
inline |
Definition at line 459 of file CalyxLoweringUtils.h.
References assert(), and extMemData.
Referenced by circt::scftocalyx::buildAllocOp().
|
inline |
Definition at line 472 of file CalyxLoweringUtils.h.
References assert(), and extMemData.
Referenced by 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 416 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 365 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 499 of file CalyxLoweringUtils.h.
Referenced by addBlockArgGroup(), and getBlockArgGroups().
|
private |
A mapping from blocks to block argument registers.
Definition at line 492 of file CalyxLoweringUtils.h.
Referenced by addBlockArgReg(), and getBlockArgRegs().
|
private |
The component which this lowering state is associated to.
Definition at line 489 of file CalyxLoweringUtils.h.
Referenced by getComponentOp(), and getNewLibraryOpInstance().
|
private |
A json file to store external global memory data.
See https://docs.calyxir.org/lang/data-format.html?highlight=json#the-data-format
Definition at line 526 of file CalyxLoweringUtils.h.
Referenced by getExtMemData(), setDataField(), and setFormat().
|
private |
A mapping between the source funcOp result indices and the corresponding output port indices of this componentOp.
Definition at line 519 of file CalyxLoweringUtils.h.
Referenced by getFuncOpResultMapping(), and setFuncOpResultMapping().
|
private |
A mapping between the callee and the instance.
Definition at line 522 of file CalyxLoweringUtils.h.
Referenced by addInstance(), and getInstance().
|
private |
A mapping from memref's to their corresponding Calyx memory interface.
Definition at line 515 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 506 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 503 of file CalyxLoweringUtils.h.
Referenced by getUniqueName().
|
private |
A mapping from return value indexes to return value registers.
Definition at line 512 of file CalyxLoweringUtils.h.
Referenced by addReturnReg(), and getReturnReg().
|
private |
A mapping between SSA values and the groups which assign them.
Definition at line 509 of file CalyxLoweringUtils.h.
Referenced by getEvaluatingGroup(), and registerEvaluatingGroup().