14#ifndef CIRCT_DIALECT_HW_TYPES_H 
   15#define CIRCT_DIALECT_HW_TYPES_H 
   19#include "mlir/Interfaces/MemorySlotInterfaces.h" 
   22#include "mlir/IR/BuiltinTypes.h" 
   23#include "mlir/IR/Types.h" 
   39  return llvm::hash_combine(port.
dir, port.
name, port.
type);
 
 
   46  using KeyTy = ArrayRef<ModulePort>;
 
   50    return std::equal(key.begin(), key.end(), 
ports.begin(), 
ports.end());
 
 
   55    return llvm::hash_combine_range(key.begin(), key.end());
 
 
 
   86ModuleType 
fnToMod(Operation *op, ArrayRef<Attribute> inputNames,
 
   87                   ArrayRef<Attribute> outputNames);
 
   88ModuleType 
fnToMod(FunctionType fn, ArrayRef<Attribute> inputNames,
 
   89                   ArrayRef<Attribute> outputNames);
 
  107#define GET_TYPEDEF_CLASSES 
  108#include "circt/Dialect/HW/HWTypes.h.inc" 
  141template <
typename... BaseTy>
 
  144  if (isa<BaseTy...>(type))
 
  148  if (
auto alias = dyn_cast<TypeAliasType>(type))
 
  149    return type_isa<BaseTy...>(alias.getInnerType());
 
 
  155template <
typename... BaseTy>
 
  162template <
typename BaseTy>
 
  164  assert(type_isa<BaseTy>(type) && 
"type must convert to requested type");
 
  167  if (isa<BaseTy>(type))
 
  168    return cast<BaseTy>(type);
 
  171  return type_cast<BaseTy>(cast<TypeAliasType>(type).getInnerType());
 
 
  174template <
typename BaseTy>
 
  176  if (!type_isa<BaseTy>(type))
 
  179  return type_cast<BaseTy>(type);
 
 
  185template <
typename... Types>
 
  190                             mlir::TypeStorage>::Base::Base;
 
 
  197template <
typename BaseTy>
 
  202                             mlir::TypeStorage>::Base::Base;
 
  206  static bool classof(Type other) { 
return type_isa<BaseTy>(other); }
 
  209  operator BaseTy()
 const { 
return type_cast<BaseTy>(*
this); }
 
 
assert(baseType &&"element must be base type")
This stores lookup tables to make manipulating and working with the IR more efficient.
static bool classof(Type other)
Utility type that wraps a type that may be one of several possible Types.
static bool classof(Type other)
ModuleType fnToMod(Operation *op, ArrayRef< Attribute > inputNames, ArrayRef< Attribute > outputNames)
BaseTy type_cast(Type type)
bool isHWIntegerType(mlir::Type type)
Return true if the specified type is a value HW Integer type.
bool type_isa_and_nonnull(Type type)
BaseTy type_dyn_cast(Type type)
bool isHWValueType(mlir::Type type)
Return true if the specified type can be used as an HW value type, that is the set of types that can ...
static bool operator==(const ModulePort &a, const ModulePort &b)
static llvm::hash_code hash_value(const ModulePort &port)
int64_t getBitWidth(mlir::Type type)
Return the hardware bit width of a type.
bool isHWEnumType(mlir::Type type)
Return true if the specified type is a HW Enum type.
mlir::Type getCanonicalType(mlir::Type type)
bool hasHWInOutType(mlir::Type type)
Return true if the specified type contains known marker types like InOutType.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Struct defining a field. Used in structs.
SmallVector< ModulePort > ports
The parametric data held by the storage class.
static llvm::hash_code hashKey(const KeyTy &key)
Define a hash function for the key type.
SmallVector< size_t > absToInput
bool operator==(const KeyTy &key) const
Define the comparison function for the key type.
SmallVector< size_t > outputToAbs
SmallVector< size_t > inputToAbs
ArrayRef< ModulePort > KeyTy
static ModuleTypeStorage * construct(mlir::TypeStorageAllocator &allocator, const KeyTy &key)
Define a construction method for creating a new instance of this storage.
ArrayRef< ModulePort > getPorts() const
KeyTy getAsKey() const
Construct an instance of the key from this storage class.
SmallVector< size_t > absToOutput
Struct defining a field with an offset. Used in unions.