13 #ifndef CIRCT_DIALECT_FIRRTL_OPS_H
14 #define CIRCT_DIALECT_FIRRTL_OPS_H
26 #include "mlir/IR/Builders.h"
27 #include "mlir/IR/OpImplementation.h"
28 #include "mlir/IR/RegionKindInterface.h"
29 #include "mlir/IR/SymbolTable.h"
30 #include "mlir/Interfaces/FunctionInterfaces.h"
31 #include "mlir/Interfaces/InferTypeOpInterface.h"
32 #include "mlir/Interfaces/SideEffectInterfaces.h"
37 class MatchingConnectOp;
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 std::optional<Location> loc);
146 std::optional<Location> loc);
148 std::optional<Location> loc);
150 std::optional<Location> loc);
155 template <
typename ConcreteOp>
189 Operation *
op =
nullptr;
192 return std::make_tuple(
224 #define GET_OP_CLASSES
225 #include "circt/Dialect/FIRRTL/FIRRTL.h.inc"
237 return FModuleOp::getFromOpaquePointer(
241 return FModuleOp::getFromOpaquePointer(
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.
FIRRTLType inferElementwiseResult(FIRRTLType lhs, FIRRTLType rhs, std::optional< 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 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)
MatchingConnectOp getSingleConnectUserOf(Value value)
Scan all the uses of the specified value, checking to see if there is exactly one connect that has th...
MemDirAttr operator|(MemDirAttr lhs, MemDirAttr rhs)
Allow 'or'ing MemDirAttr.
bool isExpression(Operation *op)
Return true if the specified operation is a firrtl expression.
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)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
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)