CIRCT 24.0.0git
Loading...
Searching...
No Matches
FIRRTLOps.cpp File Reference
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/AnnotationDetails.h"
#include "circt/Dialect/FIRRTL/CHIRRTLDialect.h"
#include "circt/Dialect/FIRRTL/FIRRTLAnnotations.h"
#include "circt/Dialect/FIRRTL/FIRRTLAttributes.h"
#include "circt/Dialect/FIRRTL/FIRRTLInstanceImplementation.h"
#include "circt/Dialect/FIRRTL/FIRRTLOpInterfaces.h"
#include "circt/Dialect/FIRRTL/FIRRTLTypes.h"
#include "circt/Dialect/FIRRTL/FIRRTLUtils.h"
#include "circt/Dialect/FIRRTL/FIRRTLVisitors.h"
#include "circt/Dialect/FIRRTL/FieldRefCache.h"
#include "circt/Dialect/FIRRTL/LayerSet.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/HWTypes.h"
#include "circt/Support/CustomDirectiveImpl.h"
#include "circt/Support/Utils.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/FormatVariadic.h"
#include "circt/Dialect/FIRRTL/FIRRTL.cpp.inc"
Include dependency graph for FIRRTLOps.cpp:

Go to the source code of this file.

Classes

struct  HasParameters< Properties, typename >
struct  HasParameters< Properties, std::void_t< decltype(std::declval< Properties >().parameters)> >

Macros

#define GET_OP_CLASSES

Functions

template<typename RetTy = FIRRTLType, typename... Args>
static RetTy emitInferRetTypeError (std::optional< Location > loc, const Twine &message, Args &&...args)
 Emit an error if optional location is non-null, return null of return type.
static MemOp::PortKind getMemPortKindFromType (FIRRTLType type)
 Return the kind of port this is given the port type from a 'mem' decl.
const char * toString (Flow flow)
void getAsmBlockArgumentNamesImpl (Operation *op, mlir::Region &region, OpAsmSetValueNameFn setNameFn)
 Get a special name to use when printing the entry block arguments of the region contained by an operation in this dialect.
static ParseResult parseNameKind (OpAsmParser &parser, firrtl::NameKindEnumAttr &result)
 A forward declaration for NameKind attribute parser.
static LayerSet getAmbientLayersAt (Operation *op)
 Get the ambient layers active at the given op.
static LayerSet getAmbientLayersFor (Value value)
 Get the ambient layer requirements at the definition site of the value.
static LayerSet getLayersFor (Value value)
 Get the effective layer requirements for the given value.
static bool isLayerCompatibleWith (mlir::SymbolRefAttr srcLayer, mlir::SymbolRefAttr dstLayer)
 Check that the source layer is compatible with the destination layer.
static bool isLayerCompatibleWith (SymbolRefAttr srcLayer, const LayerSet &dstLayers)
 Check that the source layer is present in the destination layers.
static bool isLayerSetCompatibleWith (const LayerSet &src, const LayerSet &dst, SmallVectorImpl< SymbolRefAttr > &missing)
 Check that the source layers are all present in the destination layers.
static LogicalResult checkLayerCompatibility (Operation *op, const LayerSet &src, const LayerSet &dst, const Twine &errorMsg, const Twine &noteMsg=Twine("missing layer requirements"))
static ParseResult parseCircuitOpAttrs (OpAsmParser &parser, NamedAttrList &resultAttrs)
static void printCircuitOpAttrs (OpAsmPrinter &p, Operation *op, DictionaryAttr attr)
static SmallVector< PortInfo > getPortImpl (FModuleLike module)
static hw::ModulePort::Direction dirFtoH (Direction dir)
static SmallVector< hw::PortInfo > getPortListImpl (FModuleLike module)
static hw::PortInfo getPortImpl (FModuleLike module, size_t idx)
static Attribute fixDomainInfoInsertions (MLIRContext *context, Attribute domainInfoAttr, ArrayRef< unsigned > indexMap)
 Return an updated domain info Attribute with domain indices updated based on port insertions.
static void insertPorts (FModuleLike op, ArrayRef< std::pair< unsigned, PortInfo > > ports)
 Inserts the given ports.
static ArrayAttr fixDomainInfoDeletions (MLIRContext *context, ArrayAttr domainInfoAttr, const llvm::BitVector &portIndices, bool supportsEmptyAttr)
static void erasePorts (FModuleLike op, const llvm::BitVector &portIndices)
 Erases the ports that have their corresponding bit set in portIndices.
template<typename OpTy>
void buildModuleLike (OpBuilder &builder, OperationState &result, StringAttr name, ArrayRef< PortInfo > ports)
template<typename OpTy>
static void buildModule (OpBuilder &builder, OperationState &result, StringAttr name, ArrayRef< PortInfo > ports, ArrayAttr annotations, ArrayAttr layers)
template<typename OpTy>
static void buildClass (OpBuilder &builder, OperationState &result, StringAttr name, ArrayRef< PortInfo > ports)
static bool printModulePorts (OpAsmPrinter &p, Block *block, ArrayRef< bool > portDirections, ArrayRef< Attribute > portNames, ArrayRef< Attribute > portTypes, ArrayRef< Attribute > portAnnotations, ArrayRef< Attribute > portSyms, ArrayRef< Attribute > portLocs, ArrayRef< Attribute > domainInfo)
 Print a list of module ports in the following form: in x: !firrtl.uint<1> [{class = "DontTouch}], out "_port": !firrtl.uint<2>.
static ParseResult parseModulePorts (OpAsmParser &parser, bool hasSSAIdentifiers, bool supportsSymbols, bool supportsDomains, SmallVectorImpl< OpAsmParser::Argument > &entryArgs, SmallVectorImpl< Direction > &portDirections, SmallVectorImpl< Attribute > &portNames, SmallVectorImpl< Attribute > &portTypes, SmallVectorImpl< Attribute > &portAnnotations, SmallVectorImpl< Attribute > &portSyms, SmallVectorImpl< Attribute > &portLocs, SmallVectorImpl< Attribute > &domains)
 Parse a list of module ports.
static void printParameterList (OpAsmPrinter &p, Operation *op, ArrayAttr parameters)
 Print a paramter list for a module or instance.
template<typename ModuleTy>
static void printFModuleLikeOp (OpAsmPrinter &p, FModuleLike op)
static ParseResult parseOptionalParameters (OpAsmParser &parser, SmallVectorImpl< Attribute > &parameters)
 Parse an parameter list if present.
static ParseResult parseParameterList (OpAsmParser &parser, ArrayAttr &parameters)
 Shim to use with assemblyFormat, custom<ParameterList>.
template<typename OpTy>
static ParseResult parseFModuleLikeOp (OpAsmParser &parser, OperationState &result, bool hasSSAIdentifiers)
static LogicalResult verifyProbeType (RefType refType, Location loc, CircuitOp circuitOp, SymbolTableCollection &symbolTable, Twine start)
static LogicalResult verifyPortSymbolUses (FModuleLike module, SymbolTableCollection &symbolTable)
template<typename OpTy>
ParseResult parseClassLike (OpAsmParser &parser, OperationState &result, bool hasSSAIdentifiers)
template<typename ClassTy>
static void printClassLike (OpAsmPrinter &p, ClassLike op)
static void replaceUsesRespectingInsertedPorts (Operation *op1, Operation *op2, ArrayRef< std::pair< unsigned, PortInfo > > insertions)
static void replaceUsesRespectingErasedPorts (Operation *op1, Operation *op2, const llvm::BitVector &erasures)
static size_t getAddressWidth (size_t depth)
static void forceableAsmResultNames (Forceable op, StringRef name, OpAsmSetValueNameFn setNameFn)
 Helper for naming forceable declarations (and their optional ref result).
static LogicalResult verifyInitialAttr (Operation *op, FIRRTLBaseType regType, IntegerAttr initial)
 Verify that an optional initial time-zero value attribute is a constant of the correct ground type.
static LogicalResult verifyObjectSymbolUses (FObjectLike object, SymbolTableCollection &symbolTable)
static LogicalResult checkConnectFlow (Operation *connect)
 Check if the source and sink are of appropriate flow.
static bool isConstFieldDriven (FIRRTLBaseType type, bool isFlip=false, bool outerTypeIsConst=false)
 Checks if the type has any 'const' leaf elements .
static LogicalResult checkConnectConditionality (FConnectLike connect)
 Checks that connections to 'const' destinations are not dependent on non-'const' conditions in when blocks.
static LogicalResult checkSingleConnect (FConnectLike connect)
 Returns success if the given connect is the sole driver of its dest operand.
static FlatSymbolRefAttr getDomainTypeName (Value value)
static bool checkAggConstant (Operation *op, Attribute attr, FIRRTLBaseType type)
template<typename OpTy>
ParseResult parseSubfieldLikeOp (OpAsmParser &parser, OperationState &result)
template<typename OpTy>
static void printSubfieldLikeOp (OpTy op, ::mlir::OpAsmPrinter &printer)
template<typename OpTy>
static LogicalResult verifySubfieldLike (OpTy op)
static bool isSameIntTypeKind (Type lhs, Type rhs, int32_t &lhsWidth, int32_t &rhsWidth, bool &isConstResult, std::optional< Location > loc)
 If LHS and RHS are both UInt or SInt types, the return true and fill in the width of them if known.
static FIRRTLBaseType inferMuxReturnType (FIRRTLBaseType high, FIRRTLBaseType low, bool isConstCondition, std::optional< Location > loc)
 Infer the result type for a multiplexer given its two operand types, which may be aggregates.
static bool isTypeAllowedForDPI (Operation *op, Type type)
static ParseResult parseElideAnnotations (OpAsmParser &parser, NamedAttrList &resultAttrs)
 Parse an optional attribute dictionary, adding an empty 'annotations' attribute if not specified.
static void printElideAnnotations (OpAsmPrinter &p, Operation *op, DictionaryAttr attr, ArrayRef< StringRef > extraElides={})
static ParseResult parseElidePortAnnotations (OpAsmParser &parser, NamedAttrList &resultAttrs)
 Parse an optional attribute dictionary, adding empty 'annotations' and 'portAnnotations' attributes if not specified.
static void printElidePortAnnotations (OpAsmPrinter &p, Operation *op, DictionaryAttr attr, ArrayRef< StringRef > extraElides={})
static void printNameKind (OpAsmPrinter &p, Operation *op, firrtl::NameKindEnumAttr attr, ArrayRef< StringRef > extraElides={})
static ParseResult parseFIRRTLImplicitSSAName (OpAsmParser &parser, NamedAttrList &resultAttrs)
static void printFIRRTLImplicitSSAName (OpAsmPrinter &p, Operation *op, DictionaryAttr attrs)
static ParseResult parseFieldsFromDomain (OpAsmParser &parser, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &fieldValues, SmallVectorImpl< Type > &fieldTypes, Type &resultType)
static void printFieldsFromDomain (OpAsmPrinter &p, Operation *op, OperandRange fieldValues, TypeRange fieldTypes, Type resultType)
static ParseResult parseMemOp (OpAsmParser &parser, NamedAttrList &resultAttrs)
static void printMemOp (OpAsmPrinter &p, Operation *op, DictionaryAttr attr)
 Always elide "ruw" and elide "annotations" if it exists or if it is empty.
static ParseResult parseClassInterface (OpAsmParser &parser, Type &result)
static void printClassInterface (OpAsmPrinter &p, Operation *, ClassType type)
static ParseResult parseElideEmptyName (OpAsmParser &p, NamedAttrList &resultAttrs)
static void printElideEmptyName (OpAsmPrinter &p, Operation *op, DictionaryAttr attr, ArrayRef< StringRef > extraElides={})
static ParseResult parsePrintfAttrs (OpAsmParser &p, NamedAttrList &resultAttrs)
static void printPrintfAttrs (OpAsmPrinter &p, Operation *op, DictionaryAttr attr)
static ParseResult parseFPrintfAttrs (OpAsmParser &p, NamedAttrList &resultAttrs)
static void printFPrintfAttrs (OpAsmPrinter &p, Operation *op, DictionaryAttr attr)
static ParseResult parseStopAttrs (OpAsmParser &p, NamedAttrList &resultAttrs)
static void printStopAttrs (OpAsmPrinter &p, Operation *op, DictionaryAttr attr)
static ParseResult parseVerifAttrs (OpAsmParser &p, NamedAttrList &resultAttrs)
static void printVerifAttrs (OpAsmPrinter &p, Operation *op, DictionaryAttr attr)
static void genericAsmResultNames (Operation *op, OpAsmSetValueNameFn setNameFn)

Macro Definition Documentation

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 7573 of file FIRRTLOps.cpp.

Function Documentation

◆ buildClass()

template<typename OpTy>
void buildClass ( OpBuilder & builder,
OperationState & result,
StringAttr name,
ArrayRef< PortInfo > ports )
static

Definition at line 1090 of file FIRRTLOps.cpp.

References buildModuleLike().

◆ buildModule()

template<typename OpTy>
void buildModule ( OpBuilder & builder,
OperationState & result,
StringAttr name,
ArrayRef< PortInfo > ports,
ArrayAttr annotations,
ArrayAttr layers )
static

Definition at line 1062 of file FIRRTLOps.cpp.

References buildModuleLike().

◆ buildModuleLike()

template<typename OpTy>
void buildModuleLike ( OpBuilder & builder,
OperationState & result,
StringAttr name,
ArrayRef< PortInfo > ports )

Definition at line 1013 of file FIRRTLOps.cpp.

References circt::firrtl::direction::packAttribute().

Referenced by buildClass(), and buildModule().

◆ checkAggConstant()

bool checkAggConstant ( Operation * op,
Attribute attr,
FIRRTLBaseType type )
static

Definition at line 4914 of file FIRRTLOps.cpp.

References checkAggConstant(), and circt::firrtl::type_dyn_cast().

Referenced by checkAggConstant().

◆ checkConnectConditionality()

LogicalResult checkConnectConditionality ( FConnectLike connect)
static

Checks that connections to 'const' destinations are not dependent on non-'const' conditions in when blocks.

Looks up the value's defining op until the defining op is null or a declaration of the value. If a SubAccessOp is encountered with a 'const' input, originalFieldType is made 'const'.

Definition at line 4268 of file FIRRTLOps.cpp.

References failure(), circt::firrtl::isConst(), isConstFieldDriven(), success(), and circt::firrtl::type_dyn_cast().

◆ checkConnectFlow()

LogicalResult checkConnectFlow ( Operation * connect)
static

◆ checkLayerCompatibility()

LogicalResult checkLayerCompatibility ( Operation * op,
const LayerSet & src,
const LayerSet & dst,
const Twine & errorMsg,
const Twine & noteMsg = Twine("missing layer requirements") )
static

Definition at line 410 of file FIRRTLOps.cpp.

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

◆ checkSingleConnect()

LogicalResult checkSingleConnect ( FConnectLike connect)
static

Returns success if the given connect is the sole driver of its dest operand.

Returns failure if there are other connects driving the dest.

Definition at line 4362 of file FIRRTLOps.cpp.

References failure(), and success().

◆ dirFtoH()

◆ emitInferRetTypeError()

template<typename RetTy = FIRRTLType, typename... Args>
RetTy emitInferRetTypeError ( std::optional< Location > loc,
const Twine & message,
Args &&... args )
static

Emit an error if optional location is non-null, return null of return type.

Definition at line 57 of file FIRRTLOps.cpp.

Referenced by inferMuxReturnType().

◆ erasePorts()

void erasePorts ( FModuleLike op,
const llvm::BitVector & portIndices )
static

Erases the ports that have their corresponding bit set in portIndices.

Definition at line 918 of file FIRRTLOps.cpp.

References assert(), fixDomainInfoDeletions(), circt::firrtl::direction::packAttribute(), and circt::removeElementsAtIndices().

◆ fixDomainInfoDeletions()

ArrayAttr fixDomainInfoDeletions ( MLIRContext * context,
ArrayAttr domainInfoAttr,
const llvm::BitVector & portIndices,
bool supportsEmptyAttr )
static

Definition at line 851 of file FIRRTLOps.cpp.

References context.

Referenced by erasePorts().

◆ fixDomainInfoInsertions()

Attribute fixDomainInfoInsertions ( MLIRContext * context,
Attribute domainInfoAttr,
ArrayRef< unsigned > indexMap )
static

Return an updated domain info Attribute with domain indices updated based on port insertions.

Definition at line 718 of file FIRRTLOps.cpp.

References context.

Referenced by insertPorts().

◆ forceableAsmResultNames()

void forceableAsmResultNames ( Forceable op,
StringRef name,
OpAsmSetValueNameFn setNameFn )
static

Helper for naming forceable declarations (and their optional ref result).

Definition at line 3783 of file FIRRTLOps.cpp.

◆ genericAsmResultNames()

void genericAsmResultNames ( Operation * op,
OpAsmSetValueNameFn setNameFn )
static

Definition at line 6674 of file FIRRTLOps.cpp.

◆ getAddressWidth()

size_t getAddressWidth ( size_t depth)
static

Definition at line 3530 of file FIRRTLOps.cpp.

◆ getAmbientLayersAt()

LayerSet getAmbientLayersAt ( Operation * op)
static

Get the ambient layers active at the given op.

Definition at line 321 of file FIRRTLOps.cpp.

Referenced by getAmbientLayersFor().

◆ getAmbientLayersFor()

LayerSet getAmbientLayersFor ( Value value)
static

Get the ambient layer requirements at the definition site of the value.

Definition at line 340 of file FIRRTLOps.cpp.

References getAmbientLayersAt(), and circt::firrtl::getFieldRefFromValue().

Referenced by getLayersFor().

◆ getAsmBlockArgumentNamesImpl()

void getAsmBlockArgumentNamesImpl ( Operation * op,
mlir::Region & region,
OpAsmSetValueNameFn setNameFn )

Get a special name to use when printing the entry block arguments of the region contained by an operation in this dialect.

Definition at line 292 of file FIRRTLOps.cpp.

◆ getDomainTypeName()

FlatSymbolRefAttr getDomainTypeName ( Value value)
static

Definition at line 4492 of file FIRRTLOps.cpp.

◆ getLayersFor()

LayerSet getLayersFor ( Value value)
static

Get the effective layer requirements for the given value.

The effective layers for a value is the union of

  • the ambient layers for the cannonical storage location.
  • any explicit layer annotations in the value's type.

Definition at line 348 of file FIRRTLOps.cpp.

References getAmbientLayersFor().

◆ getMemPortKindFromType()

MemOp::PortKind getMemPortKindFromType ( FIRRTLType type)
static

◆ getPortImpl() [1/2]

SmallVector< PortInfo > getPortImpl ( FModuleLike module)
static

Definition at line 614 of file FIRRTLOps.cpp.

◆ getPortImpl() [2/2]

hw::PortInfo getPortImpl ( FModuleLike module,
size_t idx )
static

Definition at line 681 of file FIRRTLOps.cpp.

References attrs, and getBodyBlock().

◆ getPortListImpl()

SmallVector< hw::PortInfo > getPortListImpl ( FModuleLike module)
static

Definition at line 645 of file FIRRTLOps.cpp.

References circt::firrtl::getNumPorts().

◆ inferMuxReturnType()

FIRRTLBaseType inferMuxReturnType ( FIRRTLBaseType high,
FIRRTLBaseType low,
bool isConstCondition,
std::optional< Location > loc )
static

Infer the result type for a multiplexer given its two operand types, which may be aggregates.

This essentially performs a pairwise comparison of fields and elements, as follows:

  • Identical operands inferred to their common type
  • Integer operands inferred to the larger one if both have a known width, a widthless integer otherwise.
  • Vectors inferred based on the element type.
  • Bundles inferred in a pairwise fashion based on the field types.

Definition at line 6033 of file FIRRTLOps.cpp.

References emitInferRetTypeError(), circt::firrtl::FIRRTLBaseType::getAllConstDroppedType(), circt::firrtl::FIRRTLBaseType::getBitWidthOrSentinel(), circt::firrtl::FIRRTLBaseType::getConstType(), inferMuxReturnType(), circt::firrtl::FIRRTLBaseType::isConst(), numElements, circt::firrtl::type_dyn_cast(), and circt::firrtl::type_isa().

Referenced by inferMuxReturnType().

◆ insertPorts()

void insertPorts ( FModuleLike op,
ArrayRef< std::pair< unsigned, PortInfo > > ports )
static

Inserts the given ports.

The insertion indices are expected to be in order. Insertion occurs in-order, such that ports with the same insertion index appear in the module in the same order they appeared in the list.

Definition at line 743 of file FIRRTLOps.cpp.

References assert(), fixDomainInfoInsertions(), circt::firrtl::direction::packAttribute(), and circt::firrtl::direction::unGet().

◆ isConstFieldDriven()

bool isConstFieldDriven ( FIRRTLBaseType type,
bool isFlip = false,
bool outerTypeIsConst = false )
static

Checks if the type has any 'const' leaf elements .

If isFlip is true, the const leaf is not considered to be driven.

Definition at line 4244 of file FIRRTLOps.cpp.

References circt::firrtl::FIRRTLBaseType::isConst(), isConstFieldDriven(), circt::firrtl::FIRRTLBaseType::isPassive(), and circt::firrtl::type_dyn_cast().

Referenced by checkConnectConditionality(), and isConstFieldDriven().

◆ isLayerCompatibleWith() [1/2]

bool isLayerCompatibleWith ( mlir::SymbolRefAttr srcLayer,
mlir::SymbolRefAttr dstLayer )
static

Check that the source layer is compatible with the destination layer.

Either the source and destination are identical, or the source-layer is a parent of the destination. For example A is compatible with A.B.C, because any definition valid in A is also valid in A.B.C.

Definition at line 360 of file FIRRTLOps.cpp.

Referenced by isLayerCompatibleWith(), and isLayerSetCompatibleWith().

◆ isLayerCompatibleWith() [2/2]

bool isLayerCompatibleWith ( SymbolRefAttr srcLayer,
const LayerSet & dstLayers )
static

Check that the source layer is present in the destination layers.

Definition at line 384 of file FIRRTLOps.cpp.

References isLayerCompatibleWith().

◆ isLayerSetCompatibleWith()

bool isLayerSetCompatibleWith ( const LayerSet & src,
const LayerSet & dst,
SmallVectorImpl< SymbolRefAttr > & missing )
static

Check that the source layers are all present in the destination layers.

True if all source layers are present in the destination. Outputs the set of source layers that are missing in the destination.

Definition at line 400 of file FIRRTLOps.cpp.

References isLayerCompatibleWith().

Referenced by checkLayerCompatibility().

◆ isSameIntTypeKind()

bool isSameIntTypeKind ( Type lhs,
Type rhs,
int32_t & lhsWidth,
int32_t & rhsWidth,
bool & isConstResult,
std::optional< Location > loc )
static

If LHS and RHS are both UInt or SInt types, the return true and fill in the width of them if known.

If unknown, return -1 for the widths. The constness of the result is also returned, where if both lhs and rhs are const, then the result is const.

On failure, this reports and error and returns false. This function should not be used if you don't want an error reported.

Definition at line 5643 of file FIRRTLOps.cpp.

References circt::firrtl::type_dyn_cast().

◆ isTypeAllowedForDPI()

bool isTypeAllowedForDPI ( Operation * op,
Type type )
static

◆ parseCircuitOpAttrs()

ParseResult parseCircuitOpAttrs ( OpAsmParser & parser,
NamedAttrList & resultAttrs )
static

Definition at line 441 of file FIRRTLOps.cpp.

◆ parseClassInterface()

ParseResult parseClassInterface ( OpAsmParser & parser,
Type & result )
static

Definition at line 6596 of file FIRRTLOps.cpp.

References failure(), and success().

◆ parseClassLike()

template<typename OpTy>
ParseResult parseClassLike ( OpAsmParser & parser,
OperationState & result,
bool hasSSAIdentifiers )

◆ parseElideAnnotations()

ParseResult parseElideAnnotations ( OpAsmParser & parser,
NamedAttrList & resultAttrs )
static

Parse an optional attribute dictionary, adding an empty 'annotations' attribute if not specified.

Definition at line 6438 of file FIRRTLOps.cpp.

Referenced by parseElidePortAnnotations(), and parseFIRRTLImplicitSSAName().

◆ parseElideEmptyName()

ParseResult parseElideEmptyName ( OpAsmParser & p,
NamedAttrList & resultAttrs )
static

◆ parseElidePortAnnotations()

ParseResult parseElidePortAnnotations ( OpAsmParser & parser,
NamedAttrList & resultAttrs )
static

Parse an optional attribute dictionary, adding empty 'annotations' and 'portAnnotations' attributes if not specified.

Definition at line 6462 of file FIRRTLOps.cpp.

References parseElideAnnotations().

Referenced by parseMemOp().

◆ parseFieldsFromDomain()

ParseResult parseFieldsFromDomain ( OpAsmParser & parser,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > & fieldValues,
SmallVectorImpl< Type > & fieldTypes,
Type & resultType )
static

Definition at line 6540 of file FIRRTLOps.cpp.

References failure(), and success().

◆ parseFIRRTLImplicitSSAName()

ParseResult parseFIRRTLImplicitSSAName ( OpAsmParser & parser,
NamedAttrList & resultAttrs )
static

◆ parseFModuleLikeOp()

template<typename OpTy>
ParseResult parseFModuleLikeOp ( OpAsmParser & parser,
OperationState & result,
bool hasSSAIdentifiers )
static

◆ parseFPrintfAttrs()

ParseResult parseFPrintfAttrs ( OpAsmParser & p,
NamedAttrList & resultAttrs )
static

Definition at line 6641 of file FIRRTLOps.cpp.

References parseElideEmptyName().

◆ parseMemOp()

ParseResult parseMemOp ( OpAsmParser & parser,
NamedAttrList & resultAttrs )
static

Definition at line 6582 of file FIRRTLOps.cpp.

References parseElidePortAnnotations().

◆ parseModulePorts()

ParseResult parseModulePorts ( OpAsmParser & parser,
bool hasSSAIdentifiers,
bool supportsSymbols,
bool supportsDomains,
SmallVectorImpl< OpAsmParser::Argument > & entryArgs,
SmallVectorImpl< Direction > & portDirections,
SmallVectorImpl< Attribute > & portNames,
SmallVectorImpl< Attribute > & portTypes,
SmallVectorImpl< Attribute > & portAnnotations,
SmallVectorImpl< Attribute > & portSyms,
SmallVectorImpl< Attribute > & portLocs,
SmallVectorImpl< Attribute > & domains )
static

Parse a list of module ports.

If port names are SSA identifiers, then this will populate entryArgs.

Definition at line 1289 of file FIRRTLOps.cpp.

References assert(), context, failure(), circt::hw::InnerSymbolTable::getInnerSymbolAttrName(), isdigit, and success().

Referenced by parseClassLike(), and parseFModuleLikeOp().

◆ parseNameKind()

ParseResult parseNameKind ( OpAsmParser & parser,
firrtl::NameKindEnumAttr & result )
static

A forward declaration for NameKind attribute parser.

Definition at line 6491 of file FIRRTLOps.cpp.

References success().

◆ parseOptionalParameters()

ParseResult parseOptionalParameters ( OpAsmParser & parser,
SmallVectorImpl< Attribute > & parameters )
static

Parse an parameter list if present.

module-parameter-list ::= < parameter-decl (, parameter-decl)* > parameter-decl ::= identifier : type parameter-decl ::= identifier : type = attribute

Definition at line 1580 of file FIRRTLOps.cpp.

References failure(), and success().

Referenced by parseFModuleLikeOp(), and parseParameterList().

◆ parseParameterList()

ParseResult parseParameterList ( OpAsmParser & parser,
ArrayAttr & parameters )
static

Shim to use with assemblyFormat, custom<ParameterList>.

Definition at line 1606 of file FIRRTLOps.cpp.

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

◆ parsePrintfAttrs()

ParseResult parsePrintfAttrs ( OpAsmParser & p,
NamedAttrList & resultAttrs )
static

Definition at line 6631 of file FIRRTLOps.cpp.

References parseElideEmptyName().

◆ parseStopAttrs()

ParseResult parseStopAttrs ( OpAsmParser & p,
NamedAttrList & resultAttrs )
static

Definition at line 6652 of file FIRRTLOps.cpp.

References parseElideEmptyName().

◆ parseSubfieldLikeOp()

template<typename OpTy>
ParseResult parseSubfieldLikeOp ( OpAsmParser & parser,
OperationState & result )

Definition at line 5232 of file FIRRTLOps.cpp.

References context, failure(), success(), and circt::firrtl::type_dyn_cast().

◆ parseVerifAttrs()

ParseResult parseVerifAttrs ( OpAsmParser & p,
NamedAttrList & resultAttrs )
static

Definition at line 6661 of file FIRRTLOps.cpp.

References parseElideEmptyName().

◆ printCircuitOpAttrs()

void printCircuitOpAttrs ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attr )
static

Definition at line 450 of file FIRRTLOps.cpp.

◆ printClassInterface()

void printClassInterface ( OpAsmPrinter & p,
Operation * ,
ClassType type )
static

Definition at line 6604 of file FIRRTLOps.cpp.

◆ printClassLike()

template<typename ClassTy>
void printClassLike ( OpAsmPrinter & p,
ClassLike op )
static

Definition at line 2128 of file FIRRTLOps.cpp.

References printModulePorts().

◆ printElideAnnotations()

void printElideAnnotations ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attr,
ArrayRef< StringRef > extraElides = {} )
static

Definition at line 6447 of file FIRRTLOps.cpp.

Referenced by printFIRRTLImplicitSSAName().

◆ printElideEmptyName()

void printElideEmptyName ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attr,
ArrayRef< StringRef > extraElides = {} )
static

◆ printElidePortAnnotations()

void printElidePortAnnotations ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attr,
ArrayRef< StringRef > extraElides = {} )
static

Definition at line 6476 of file FIRRTLOps.cpp.

Referenced by printMemOp().

◆ printFieldsFromDomain()

void printFieldsFromDomain ( OpAsmPrinter & p,
Operation * op,
OperandRange fieldValues,
TypeRange fieldTypes,
Type resultType )
static

Definition at line 6572 of file FIRRTLOps.cpp.

◆ printFIRRTLImplicitSSAName()

void printFIRRTLImplicitSSAName ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attrs )
static

◆ printFModuleLikeOp()

template<typename ModuleTy>
void printFModuleLikeOp ( OpAsmPrinter & p,
FModuleLike op )
static

Definition at line 1481 of file FIRRTLOps.cpp.

References printModulePorts(), and printParameterList().

◆ printFPrintfAttrs()

void printFPrintfAttrs ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attr )
static

Definition at line 6646 of file FIRRTLOps.cpp.

References printElideEmptyName().

◆ printMemOp()

void printMemOp ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attr )
static

Always elide "ruw" and elide "annotations" if it exists or if it is empty.

Definition at line 6587 of file FIRRTLOps.cpp.

References printElidePortAnnotations().

◆ printModulePorts()

bool printModulePorts ( OpAsmPrinter & p,
Block * block,
ArrayRef< bool > portDirections,
ArrayRef< Attribute > portNames,
ArrayRef< Attribute > portTypes,
ArrayRef< Attribute > portAnnotations,
ArrayRef< Attribute > portSyms,
ArrayRef< Attribute > portLocs,
ArrayRef< Attribute > domainInfo )
static

Print a list of module ports in the following form: in x: !firrtl.uint<1> [{class = "DontTouch}], out "_port": !firrtl.uint<2>.

When there is no block specified, the port names print as MLIR identifiers, wrapping in quotes if not legal to print as-is. When there is no block specified, this function always return false, indicating that there was no issue printing port names.

If there is a block specified, then port names will be printed as SSA values. If there is a reason the printed SSA values can't match the true port name, then this function will return true. When this happens, the caller should print the port names as a part of the attr-dict.

Definition at line 1184 of file FIRRTLOps.cpp.

References empty, and circt::firrtl::direction::get().

Referenced by printClassLike(), and printFModuleLikeOp().

◆ printNameKind()

void printNameKind ( OpAsmPrinter & p,
Operation * op,
firrtl::NameKindEnumAttr attr,
ArrayRef< StringRef > extraElides = {} )
static

Definition at line 6508 of file FIRRTLOps.cpp.

◆ printParameterList()

void printParameterList ( OpAsmPrinter & p,
Operation * op,
ArrayAttr parameters )
static

Print a paramter list for a module or instance.

Definition at line 1463 of file FIRRTLOps.cpp.

Referenced by printFModuleLikeOp().

◆ printPrintfAttrs()

void printPrintfAttrs ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attr )
static

Definition at line 6636 of file FIRRTLOps.cpp.

References printElideEmptyName().

◆ printStopAttrs()

void printStopAttrs ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attr )
static

Definition at line 6656 of file FIRRTLOps.cpp.

References printElideEmptyName().

◆ printSubfieldLikeOp()

template<typename OpTy>
void printSubfieldLikeOp ( OpTy op,
::mlir::OpAsmPrinter & printer )
static

Definition at line 5317 of file FIRRTLOps.cpp.

◆ printVerifAttrs()

void printVerifAttrs ( OpAsmPrinter & p,
Operation * op,
DictionaryAttr attr )
static

Definition at line 6665 of file FIRRTLOps.cpp.

References printElideEmptyName().

◆ replaceUsesRespectingErasedPorts()

void replaceUsesRespectingErasedPorts ( Operation * op1,
Operation * op2,
const llvm::BitVector & erasures )
static

Definition at line 2576 of file FIRRTLOps.cpp.

References assert().

◆ replaceUsesRespectingInsertedPorts()

void replaceUsesRespectingInsertedPorts ( Operation * op1,
Operation * op2,
ArrayRef< std::pair< unsigned, PortInfo > > insertions )
static

Definition at line 2557 of file FIRRTLOps.cpp.

References assert().

◆ toString()

const char * toString ( Flow flow)

Definition at line 159 of file FIRRTLOps.cpp.

Referenced by checkConnectFlow().

◆ verifyInitialAttr()

LogicalResult verifyInitialAttr ( Operation * op,
FIRRTLBaseType regType,
IntegerAttr initial )
static

Verify that an optional initial time-zero value attribute is a constant of the correct ground type.

The attribute's bit width and signedness must match the register's declared ground type.

Definition at line 3836 of file FIRRTLOps.cpp.

References success(), circt::firrtl::type_cast(), and circt::firrtl::type_dyn_cast().

◆ verifyObjectSymbolUses()

LogicalResult verifyObjectSymbolUses ( FObjectLike object,
SymbolTableCollection & symbolTable )
static

Definition at line 4122 of file FIRRTLOps.cpp.

◆ verifyPortSymbolUses()

LogicalResult verifyPortSymbolUses ( FModuleLike module,
SymbolTableCollection & symbolTable )
static

◆ verifyProbeType()

LogicalResult verifyProbeType ( RefType refType,
Location loc,
CircuitOp circuitOp,
SymbolTableCollection & symbolTable,
Twine start )
static

Definition at line 1836 of file FIRRTLOps.cpp.

References success().

Referenced by verifyPortSymbolUses().

◆ verifySubfieldLike()

template<typename OpTy>
LogicalResult verifySubfieldLike ( OpTy op)
static

Definition at line 5344 of file FIRRTLOps.cpp.

References success(), and circt::firrtl::type_cast().