CIRCT 24.0.0git
Loading...
Searching...
No Matches
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/AttrTypeSubElements.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 "mlir/Interfaces/MemorySlotInterfaces.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/ErrorHandling.h"
#include "circt/Dialect/HW/HWTypes.cpp.inc"
Include dependency graph for HWTypes.cpp:

Go to the source code of this file.

Namespaces

namespace  circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
namespace  circt::hw
namespace  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.
static void printHWElementType (AsmPrinter &printer, Type dim)
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 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 <>.
static void printPorts (AsmPrinter &p, ArrayRef< ModulePort > ports)
 Print out a list of named fields surrounded by <>.

Macro Definition Documentation

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

Definition at line 44 of file HWTypes.cpp.

◆ GET_TYPEDEF_LIST

#define GET_TYPEDEF_LIST

Function Documentation

◆ dirToStr()

StringRef dirToStr ( ModulePort::Direction dir)
static

Definition at line 1042 of file HWTypes.cpp.

References circt::hw::ModulePort::Input, and circt::hw::ModulePort::Output.

Referenced by printPorts().

◆ getFieldIDsStruct()

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

Definition at line 393 of file HWTypes.cpp.

References circt::hw::FieldIdImpl::getMaxFieldID().

◆ parseHWArray()

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

Definition at line 653 of file HWTypes.cpp.

References failure(), parseHWElementType(), and success().

◆ parseHWElementType()

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 274 of file HWTypes.cpp.

Referenced by parseHWArray().

◆ parsePorts()

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 1062 of file HWTypes.cpp.

References failure(), strToDir(), and success().

◆ printHWArray()

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

Definition at line 679 of file HWTypes.cpp.

References elementType, and printHWElementType().

◆ printHWElementType()

void printHWElementType ( AsmPrinter & printer,
Type dim )
static

Definition at line 296 of file HWTypes.cpp.

Referenced by printHWArray().

◆ printPorts()

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

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

Definition at line 1079 of file HWTypes.cpp.

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

◆ strToDir()

ModulePort::Direction strToDir ( StringRef str)
static

Definition at line 1052 of file HWTypes.cpp.

References circt::hw::ModulePort::Input, and circt::hw::ModulePort::Output.

Referenced by parsePorts().