CIRCT  19.0.0git
Namespaces | Macros | Functions
HWTypes.cpp File Reference
#include "circt/Dialect/HW/HWTypes.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/HWDialect.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HW/HWSymCache.h"
#include "circt/Support/LLVM.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/StorageUniquerSupport.h"
#include "mlir/IR/Types.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "circt/Dialect/HW/HWTypes.cpp.inc"
Include dependency graph for HWTypes.cpp:

Go to the source code of this file.

Namespaces

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

Macros

#define GET_TYPEDEF_CLASSES
 
#define GET_TYPEDEF_LIST
 

Functions

static ParseResult parseHWArray (AsmParser &parser, Attribute &dim, Type &elementType)
 
static void printHWArray (AsmPrinter &printer, Attribute dim, Type elementType)
 
static ParseResult parseHWElementType (AsmParser &p, Type &result)
 Parse and print nested HW types nicely. More...
 
static void printHWElementType (AsmPrinter &printer, Type dim)
 
bool circt::hw::detail::operator== (const FieldInfo &a, const FieldInfo &b)
 
llvm::hash_code circt::hw::detail::hash_value (const FieldInfo &fi)
 
static ParseResult parseFields (AsmParser &p, SmallVectorImpl< FieldInfo > &parameters)
 Parse a list of unique field names and types within <>. More...
 
static void printFields (AsmPrinter &p, ArrayRef< FieldInfo > fields)
 Print out a list of named fields surrounded by <>. More...
 
static std::pair< uint64_t, SmallVector< uint64_t > > getFieldIDsStruct (const StructType &st)
 
bool circt::hw::detail::operator== (const OffsetFieldInfo &a, const OffsetFieldInfo &b)
 
llvm::hash_code circt::hw::detail::hash_value (const OffsetFieldInfo &fi)
 
static Type computeCanonicalType (Type type)
 
static StringRef dirToStr (ModulePort::Direction dir)
 
static ModulePort::Direction strToDir (StringRef str)
 
static ParseResult parsePorts (AsmParser &p, SmallVectorImpl< ModulePort > &ports)
 Parse a list of field names and types within <>. More...
 
static void printPorts (AsmPrinter &p, ArrayRef< ModulePort > ports)
 Print out a list of named fields surrounded by <>. More...
 

Macro Definition Documentation

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

Definition at line 41 of file HWTypes.cpp.

◆ GET_TYPEDEF_LIST

#define GET_TYPEDEF_LIST

Function Documentation

◆ computeCanonicalType()

static Type computeCanonicalType ( Type  type)
static

Definition at line 706 of file HWTypes.cpp.

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

◆ dirToStr()

static StringRef dirToStr ( ModulePort::Direction  dir)
static

Definition at line 923 of file HWTypes.cpp.

References InOut, Input, and Output.

Referenced by printPorts().

◆ getFieldIDsStruct()

static std::pair<uint64_t, SmallVector<uint64_t> > getFieldIDsStruct ( const StructType &  st)
static

Definition at line 338 of file HWTypes.cpp.

◆ parseFields()

static ParseResult parseFields ( AsmParser &  p,
SmallVectorImpl< FieldInfo > &  parameters 
)
static

Parse a list of unique field names and types within <>.

E.g.: <foo: i7, bar: i8>

Definition at line 250 of file HWTypes.cpp.

◆ parseHWArray()

static ParseResult parseHWArray ( AsmParser &  parser,
Attribute &  dim,
Type &  elementType 
)
static

Definition at line 557 of file HWTypes.cpp.

◆ parseHWElementType()

static ParseResult parseHWElementType ( AsmParser &  p,
Type &  result 
)
static

Parse and print nested HW types nicely.

These helper methods allow eliding the "hw." prefix on array, inout, and other types when in a context that expects HW subelement types.

Definition at line 171 of file HWTypes.cpp.

◆ parsePorts()

static ParseResult parsePorts ( AsmParser &  p,
SmallVectorImpl< ModulePort > &  ports 
)
static

Parse a list of field names and types within <>.

E.g.: <input foo: i7, output bar: i8>

Definition at line 946 of file HWTypes.cpp.

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

◆ printFields()

static void printFields ( AsmPrinter &  p,
ArrayRef< FieldInfo fields 
)
static

Print out a list of named fields surrounded by <>.

Definition at line 282 of file HWTypes.cpp.

◆ printHWArray()

static void printHWArray ( AsmPrinter &  printer,
Attribute  dim,
Type  elementType 
)
static

Definition at line 577 of file HWTypes.cpp.

◆ printHWElementType()

static void printHWElementType ( AsmPrinter &  printer,
Type  dim 
)
static

Definition at line 191 of file HWTypes.cpp.

◆ printPorts()

static void printPorts ( AsmPrinter &  p,
ArrayRef< ModulePort ports 
)
static

Print out a list of named fields surrounded by <>.

Definition at line 963 of file HWTypes.cpp.

References circt::hw::ModulePort::dir, dirToStr(), circt::hw::ModulePort::name, and circt::hw::ModulePort::type.

◆ strToDir()

static ModulePort::Direction strToDir ( StringRef  str)
static

Definition at line 934 of file HWTypes.cpp.

References InOut, Input, and Output.

Referenced by parsePorts().