CIRCT  19.0.0git
Typedefs | Functions
HandshakeToHW.cpp File Reference
#include "circt/Conversion/HandshakeToHW.h"
#include "../PassDetail.h"
#include "circt/Dialect/Comb/CombOps.h"
#include "circt/Dialect/ESI/ESIOps.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HW/HWTypes.h"
#include "circt/Dialect/Handshake/HandshakeOps.h"
#include "circt/Dialect/Handshake/HandshakePasses.h"
#include "circt/Dialect/Handshake/Visitor.h"
#include "circt/Dialect/Seq/SeqOps.h"
#include "circt/Support/BackedgeBuilder.h"
#include "circt/Support/ValueMapper.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/MathExtras.h"
#include <optional>
Include dependency graph for HandshakeToHW.cpp:

Go to the source code of this file.

Typedefs

using NameUniquer = std::function< std::string(Operation *)>
 
using DiscriminatingTypes = std::pair< SmallVector< Type >, SmallVector< Type > >
 Returns a set of types which may uniquely identify the provided op. More...
 

Functions

static std::string getBareSubModuleName (Operation *oldOp)
 Returns a submodule name resulting from an operation, without discriminating type information. More...
 
static std::string getCallName (Operation *op)
 
static Type getOperandDataType (Value op)
 Extracts the type of the data-carrying type of opType. More...
 
static SmallVector< Type > filterNoneTypes (ArrayRef< Type > input)
 Filters NoneType's from the input. More...
 
static DiscriminatingTypes getHandshakeDiscriminatingTypes (Operation *op)
 
static std::string getTypeName (Location loc, Type type)
 Get type name. More...
 
static std::string getSubModuleName (Operation *oldOp)
 Construct a name for creating HW sub-module. More...
 
static HWModuleLike checkSubModuleOp (mlir::ModuleOp parentModule, StringRef modName)
 Check whether a submodule with the same name has been created elsewhere in the top level module. More...
 
static HWModuleLike checkSubModuleOp (mlir::ModuleOp parentModule, Operation *oldOp)
 
static ModulePortInfo getPortInfoForOp (Operation *op)
 Returns a vector of PortInfo's which defines the HW interface of the to-be-converted op. More...
 
static llvm::SmallVector< hw::detail::FieldInfoportToFieldInfo (llvm::ArrayRef< hw::PortInfo > portInfo)
 
static LogicalResult convertExtMemoryOps (HWModuleOp mod)
 
static LogicalResult convertFuncOp (ESITypeConverter &typeConverter, ConversionTarget &target, handshake::FuncOp op, OpBuilder &moduleBuilder)
 

Typedef Documentation

◆ DiscriminatingTypes

using DiscriminatingTypes = std::pair<SmallVector<Type>, SmallVector<Type> >

Returns a set of types which may uniquely identify the provided op.

Return value is <inputTypes, outputTypes>.

Definition at line 120 of file HandshakeToHW.cpp.

◆ NameUniquer

using NameUniquer = std::function<std::string(Operation *)>

Definition at line 39 of file HandshakeToHW.cpp.

Function Documentation

◆ checkSubModuleOp() [1/2]

static HWModuleLike checkSubModuleOp ( mlir::ModuleOp  parentModule,
Operation *  oldOp 
)
static

Definition at line 260 of file HandshakeToHW.cpp.

References assert(), checkSubModuleOp(), and getSubModuleName().

◆ checkSubModuleOp() [2/2]

static HWModuleLike checkSubModuleOp ( mlir::ModuleOp  parentModule,
StringRef  modName 
)
static

Check whether a submodule with the same name has been created elsewhere in the top level module.

Return the matched module operation if true, otherwise return nullptr.

Definition at line 251 of file HandshakeToHW.cpp.

Referenced by checkSubModuleOp().

◆ convertExtMemoryOps()

static LogicalResult convertExtMemoryOps ( HWModuleOp  mod)
static

◆ convertFuncOp()

static LogicalResult convertFuncOp ( ESITypeConverter &  typeConverter,
ConversionTarget &  target,
handshake::FuncOp  op,
OpBuilder &  moduleBuilder 
)
static

Definition at line 1848 of file HandshakeToHW.cpp.

References getCallName().

◆ filterNoneTypes()

static SmallVector<Type> filterNoneTypes ( ArrayRef< Type >  input)
static

Filters NoneType's from the input.

Definition at line 111 of file HandshakeToHW.cpp.

Referenced by getHandshakeDiscriminatingTypes().

◆ getBareSubModuleName()

static std::string getBareSubModuleName ( Operation *  oldOp)
static

Returns a submodule name resulting from an operation, without discriminating type information.

Definition at line 86 of file HandshakeToHW.cpp.

Referenced by getCallName(), and getSubModuleName().

◆ getCallName()

static std::string getCallName ( Operation *  op)
static

Definition at line 95 of file HandshakeToHW.cpp.

References getBareSubModuleName().

Referenced by convertFuncOp().

◆ getHandshakeDiscriminatingTypes()

static DiscriminatingTypes getHandshakeDiscriminatingTypes ( Operation *  op)
static

Definition at line 121 of file HandshakeToHW.cpp.

References filterNoneTypes(), and getOperandDataType().

Referenced by getSubModuleName().

◆ getOperandDataType()

static Type getOperandDataType ( Value  op)
static

Extracts the type of the data-carrying type of opType.

If opType is an ESI channel, getHandshakeBundleDataType extracts the data-carrying type, else, assume that opType itself is the data-carrying type.

Definition at line 103 of file HandshakeToHW.cpp.

Referenced by getHandshakeDiscriminatingTypes().

◆ getPortInfoForOp()

static ModulePortInfo getPortInfoForOp ( Operation *  op)
static

Returns a vector of PortInfo's which defines the HW interface of the to-be-converted op.

Definition at line 277 of file HandshakeToHW.cpp.

References circt::handshake::getPortInfoForOpTypes().

◆ getSubModuleName()

static std::string getSubModuleName ( Operation *  oldOp)
static

Construct a name for creating HW sub-module.

Definition at line 169 of file HandshakeToHW.cpp.

References assert(), getBareSubModuleName(), getHandshakeDiscriminatingTypes(), getInt(), and getTypeName().

Referenced by checkSubModuleOp().

◆ getTypeName()

static std::string getTypeName ( Location  loc,
Type  type 
)
static

Get type name.

Currently we only support integer or index types. The emitted type aligns with the getFIRRTLType() method. Thus all integers other than signed integers will be emitted as unsigned.

Definition at line 144 of file HandshakeToHW.cpp.

References elementType.

Referenced by getSubModuleName().

◆ portToFieldInfo()

static llvm::SmallVector<hw::detail::FieldInfo> portToFieldInfo ( llvm::ArrayRef< hw::PortInfo >  portInfo)
static

Definition at line 282 of file HandshakeToHW.cpp.

Referenced by convertExtMemoryOps().