13 #ifndef CIRCT_DIALECT_FIRRTL_OPS_H
14 #define CIRCT_DIALECT_FIRRTL_OPS_H
23 #include "mlir/IR/Builders.h"
24 #include "mlir/IR/OpImplementation.h"
25 #include "mlir/IR/RegionKindInterface.h"
26 #include "mlir/IR/SymbolTable.h"
27 #include "mlir/Interfaces/FunctionInterfaces.h"
28 #include "mlir/Interfaces/InferTypeOpInterface.h"
29 #include "mlir/Interfaces/SideEffectInterfaces.h"
34 class StrictConnectOp;
96 inline MemDirAttr
operator|(MemDirAttr lhs, MemDirAttr rhs) {
97 return static_cast<MemDirAttr
>(
98 static_cast<std::underlying_type<MemDirAttr>::type
>(lhs) |
99 static_cast<std::underlying_type<MemDirAttr>::type
>(rhs));
102 inline MemDirAttr &
operator|=(MemDirAttr &lhs, MemDirAttr rhs) {
109 auto s = op->getAttrOfType<hw::InnerSymAttr>(
112 return s.getSymName();
144 MLIRContext *context, std::optional<Location> loc, ValueRange operands,
145 DictionaryAttr attrs, mlir::OpaqueProperties properties,
146 mlir::RegionRange regions, SmallVectorImpl<Type> &results,
147 llvm::function_ref<
FIRRTLType(ValueRange, ArrayRef<NamedAttribute>,
148 std::optional<Location>)>
153 std::optional<Location> loc);
155 std::optional<Location> loc);
157 std::optional<Location> loc);
159 std::optional<Location> loc);
164 ArrayRef<NamedAttribute> attrs,
167 ArrayRef<NamedAttribute> attrs,
170 ArrayRef<NamedAttribute> attrs,
175 template <
typename ConcreteOp>
209 Operation *
op =
nullptr;
212 return std::make_tuple(
244 #define GET_OP_CLASSES
245 #include "circt/Dialect/FIRRTL/FIRRTL.h.inc"
253 struct DenseMapInfo<
circt::firrtl::FModuleOp> {
257 return FModuleOp::getFromOpaquePointer(
258 DenseMapInfo<Operation *>::getEmptyKey());
261 return FModuleOp::getFromOpaquePointer(
262 DenseMapInfo<Operation *>::getTombstoneKey());
265 return DenseMapInfo<Operation *>::getHashValue(val);
A binary operation where the operands have the same integer kind.
static LogicalResult verifyTrait(Operation *op)
static StringRef getInnerSymbolAttrName()
Return the name of the attribute used for inner symbol names.
LogicalResult validateBinaryOpArguments(ValueRange operands, ArrayRef< NamedAttribute > attrs, Location loc)
FIRRTLType inferElementwiseResult(FIRRTLType lhs, FIRRTLType rhs, std::optional< Location > loc)
LogicalResult inferReturnTypes(MLIRContext *context, std::optional< Location > loc, ValueRange operands, DictionaryAttr attrs, mlir::OpaqueProperties properties, mlir::RegionRange regions, SmallVectorImpl< Type > &results, llvm::function_ref< FIRRTLType(ValueRange, ArrayRef< NamedAttribute >, std::optional< Location >)> callback)
LogicalResult validateUnaryOpArguments(ValueRange operands, ArrayRef< NamedAttribute > attrs, Location loc)
FIRRTLType inferBitwiseResult(FIRRTLType lhs, FIRRTLType rhs, std::optional< Location > loc)
FIRRTLType inferAddSubResult(FIRRTLType lhs, FIRRTLType rhs, std::optional< Location > loc)
FIRRTLType inferComparisonResult(FIRRTLType lhs, FIRRTLType rhs, std::optional< Location > loc)
FIRRTLType inferReductionResult(FIRRTLType arg, std::optional< Location > loc)
LogicalResult validateOneOperandOneConst(ValueRange operands, ArrayRef< NamedAttribute > attrs, Location loc)
LogicalResult verifySameOperandsIntTypeKind(Operation *op)
Flow swapFlow(Flow flow)
Get a flow's reverse.
bool isConstant(Operation *op)
Return true if the specified operation has a constant value.
constexpr bool isValidDst(Flow flow)
Flow foldFlow(Value val, Flow accumulatedFlow=Flow::Source)
Compute the flow for a Value, val, as determined by the FIRRTL specification.
bool hasDontTouch(Value value)
Check whether a block argument ("port") or the operation defining a value has a DontTouch annotation,...
size_t getNumPorts(Operation *op)
Return the number of ports in a module-like thing (modules, memories, etc)
bool isDuplexValue(Value val)
Returns true if the value results from an expression with duplex flow.
bool hasDroppableName(Operation *op)
Return true if the name is droppable.
constexpr bool isValidSrc(Flow flow)
MemDirAttr operator|(MemDirAttr lhs, MemDirAttr rhs)
Allow 'or'ing MemDirAttr.
bool isExpression(Operation *op)
Return true if the specified operation is a firrtl expression.
StrictConnectOp getSingleConnectUserOf(Value value)
Scan all the uses of the specified value, checking to see if there is exactly one connect that has th...
bool isUselessName(circt::StringRef name)
Return true if this is a useless temporary name produced by FIRRTL.
DeclKind getDeclarationKind(Value val)
StringAttr getInnerSymName(Operation *op)
Return the StringAttr for the inner_sym name, if it exists.
MemDirAttr & operator|=(MemDirAttr &lhs, MemDirAttr rhs)
This file defines an intermediate representation for circuits acting as an abstraction for constraint...
bool isSeqMem() const
Check whether the memory is a seq mem.
bool operator==(const FirMemory &rhs) const
StringAttr getFirMemoryName() const
bool operator<(const FirMemory &rhs) const
SmallVector< int32_t > writeClockIDs
static FModuleOp getTombstoneKey()
static unsigned getHashValue(const FModuleOp &val)
static FModuleOp getEmptyKey()
circt::firrtl::FModuleOp FModuleOp
mlir::Operation Operation
static bool isEqual(const FModuleOp &lhs, const FModuleOp &rhs)