CIRCT  20.0.0git
Namespaces | Macros | Functions
FlattenIO.cpp File Reference
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HW/HWPasses.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/TypeSwitch.h"
#include "circt/Dialect/HW/Passes.h.inc"
Include dependency graph for FlattenIO.cpp:

Go to the source code of this file.

Namespaces

 circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
 
 circt::hw
 

Macros

#define GEN_PASS_DEF_FLATTENIO
 

Functions

static bool isStructType (Type type)
 
static hw::StructType getStructType (Type type)
 
static bool isLegalModLikeOp (hw::HWModuleLike moduleLikeOp)
 
static llvm::SmallVector< Type > getInnerTypes (hw::StructType t)
 
template<typename... TOp>
static void addSignatureConversion (DenseMap< Operation *, IOInfo > &ioMap, ConversionTarget &target, RewritePatternSet &patterns, FlattenIOTypeConverter &typeConverter)
 
template<typename T >
static bool hasUnconvertedOps (mlir::ModuleOp module)
 
template<typename T >
static DenseMap< Operation *, IOTypes > populateIOMap (mlir::ModuleOp module)
 
template<typename ModTy , typename T >
static llvm::SmallVector< Attribute > updateNameAttribute (ModTy op, StringRef attrName, DenseMap< unsigned, hw::StructType > &structMap, T oldNames, char joinChar)
 
template<typename ModTy >
static void updateModulePortNames (ModTy op, hw::ModuleType oldModType, char joinChar)
 
static llvm::SmallVector< Location > updateLocAttribute (DenseMap< unsigned, hw::StructType > &structMap, SmallVectorImpl< Location > &oldLocs)
 
static void updateBlockLocations (hw::HWModuleLike op, DenseMap< unsigned, hw::StructType > &structMap)
 The conversion framework seems to throw away block argument locations. More...
 
static void setIOInfo (hw::HWModuleLike op, IOInfo &ioInfo)
 
template<typename T >
static DenseMap< Operation *, IOInfo > populateIOInfoMap (mlir::ModuleOp module)
 
template<typename T >
static LogicalResult flattenOpsOfType (ModuleOp module, bool recursive, StringSet<> &externModules, char joinChar)
 
template<typename... TOps>
static bool flattenIO (ModuleOp module, bool recursive, StringSet<> &externModules, char joinChar)
 

Macro Definition Documentation

◆ GEN_PASS_DEF_FLATTENIO

#define GEN_PASS_DEF_FLATTENIO

Definition at line 17 of file FlattenIO.cpp.

Function Documentation

◆ addSignatureConversion()

template<typename... TOp>
static void addSignatureConversion ( DenseMap< Operation *, IOInfo > &  ioMap,
ConversionTarget &  target,
RewritePatternSet &  patterns,
FlattenIOTypeConverter &  typeConverter 
)
static

◆ flattenIO()

template<typename... TOps>
static bool flattenIO ( ModuleOp  module,
bool  recursive,
StringSet<> &  externModules,
char  joinChar 
)
static

Definition at line 525 of file FlattenIO.cpp.

◆ flattenOpsOfType()

template<typename T >
static LogicalResult flattenOpsOfType ( ModuleOp  module,
bool  recursive,
StringSet<> &  externModules,
char  joinChar 
)
static

◆ getInnerTypes()

static llvm::SmallVector<Type> getInnerTypes ( hw::StructType  t)
static

Definition at line 39 of file FlattenIO.cpp.

References circt::hw::getCanonicalType(), and circt::esi::innerType().

◆ getStructType()

static hw::StructType getStructType ( Type  type)
static

Definition at line 29 of file FlattenIO.cpp.

References circt::hw::getCanonicalType().

Referenced by setIOInfo(), and updateModulePortNames().

◆ hasUnconvertedOps()

template<typename T >
static bool hasUnconvertedOps ( mlir::ModuleOp  module)
static

Definition at line 287 of file FlattenIO.cpp.

◆ isLegalModLikeOp()

static bool isLegalModLikeOp ( hw::HWModuleLike  moduleLikeOp)
static

Definition at line 34 of file FlattenIO.cpp.

References isStructType().

Referenced by addSignatureConversion().

◆ isStructType()

static bool isStructType ( Type  type)
static

Definition at line 25 of file FlattenIO.cpp.

References circt::hw::getCanonicalType().

Referenced by isLegalModLikeOp().

◆ populateIOInfoMap()

template<typename T >
static DenseMap<Operation *, IOInfo> populateIOInfoMap ( mlir::ModuleOp  module)
static

Definition at line 394 of file FlattenIO.cpp.

References setIOInfo().

◆ populateIOMap()

template<typename T >
static DenseMap<Operation *, IOTypes> populateIOMap ( mlir::ModuleOp  module)
static

Definition at line 293 of file FlattenIO.cpp.

◆ setIOInfo()

static void setIOInfo ( hw::HWModuleLike  op,
IOInfo &  ioInfo 
)
static

Definition at line 380 of file FlattenIO.cpp.

References getStructType().

Referenced by flattenOpsOfType(), and populateIOInfoMap().

◆ updateBlockLocations()

static void updateBlockLocations ( hw::HWModuleLike  op,
DenseMap< unsigned, hw::StructType > &  structMap 
)
static

The conversion framework seems to throw away block argument locations.

We use this function to copy the location from the original argument to the set of flattened arguments.

Definition at line 371 of file FlattenIO.cpp.

Referenced by flattenOpsOfType().

◆ updateLocAttribute()

static llvm::SmallVector<Location> updateLocAttribute ( DenseMap< unsigned, hw::StructType > &  structMap,
SmallVectorImpl< Location > &  oldLocs 
)
static

Definition at line 348 of file FlattenIO.cpp.

Referenced by flattenOpsOfType().

◆ updateModulePortNames()

template<typename ModTy >
static void updateModulePortNames ( ModTy  op,
hw::ModuleType  oldModType,
char  joinChar 
)
static

Definition at line 326 of file FlattenIO.cpp.

References circt::calyx::direction::get(), and getStructType().

Referenced by flattenOpsOfType().

◆ updateNameAttribute()

template<typename ModTy , typename T >
static llvm::SmallVector<Attribute> updateNameAttribute ( ModTy  op,
StringRef  attrName,
DenseMap< unsigned, hw::StructType > &  structMap,
oldNames,
char  joinChar 
)
static

Definition at line 302 of file FlattenIO.cpp.

References circt::calyx::direction::get().

Referenced by flattenOpsOfType().