Class OperatorOp
Defined in File DFGOps.h.inc
Inheritance Relationships
Base Type
public mlir::Op< OperatorOp, ::mlir::OpTrait::OneRegion, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::HasParent< ModuleOp >::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator< OutputOp >::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::dfg::NodeInterface::Trait, ::mlir::OpTrait::AffineScope, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::OpAsmOpInterface::Trait >
Class Documentation
-
class OperatorOp : public mlir::Op<OperatorOp, ::mlir::OpTrait::OneRegion, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::HasParent<ModuleOp>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator<OutputOp>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::dfg::NodeInterface::Trait, ::mlir::OpTrait::AffineScope, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::OpAsmOpInterface::Trait>
Public Types
-
using Adaptor = OperatorOpAdaptor
-
template<typename RangeT>
using GenericAdaptor = OperatorOpGenericAdaptor<RangeT>
-
using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>
-
using Properties = FoldAdaptor::Properties
Public Functions
-
inline ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames()
-
inline ::mlir::StringAttr getFunctionTypeAttrName()
-
inline ::mlir::StringAttr getSymNameAttrName()
-
inline std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index)
-
inline ::mlir::Operation::operand_range getODSOperands(unsigned index)
-
inline std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index)
-
inline ::mlir::Operation::result_range getODSResults(unsigned index)
-
inline ::mlir::Region &getBody()
-
void writeProperties(::mlir::DialectBytecodeWriter &writer)
-
inline ::mlir::StringAttr getSymNameAttr()
-
::llvm::StringRef getSymName()
-
inline ::mlir::TypeAttr getFunctionTypeAttr()
-
::mlir::FunctionType getFunctionType()
-
inline void setSymNameAttr(::mlir::StringAttr attr)
-
void setSymName(::llvm::StringRef attrValue)
-
inline void setFunctionTypeAttr(::mlir::TypeAttr attr)
-
void setFunctionType(::mlir::FunctionType attrValue)
-
void print(::mlir::OpAsmPrinter &p)
Prints an
OperatorOpin the custom assembly syntax consumed byparse.The symbol name is printed first, followed by optional
inputs(...)andoutputs(...)clauses. Input port names come from the body region’s block arguments for concrete operators, or use syntheticargNnames for external declarations. Output port names are always syntheticargNbecause outputs are not block arguments — they are produced byOutputOpinside the body and therefore have no region argument to source names from. The body region is printed only for concrete operators;sym_nameandfunction_typeare always elided from the attribute dictionary.
-
::llvm::LogicalResult verifyInvariantsImpl()
-
::llvm::LogicalResult verifyInvariants()
-
::llvm::LogicalResult verify()
Verifies that the
OperatorOpbody contains only permitted ops.The body may contain arbitrary non-DFG operations (e.g. arithmetic, memory accesses), but the only DFG-dialect operation allowed inside is
OutputOp, which terminates the operator by writing computed values to the output channels. Any other DFG op found inside the body is rejected because it would imply dataflow nesting thatOperatorOpdoes not support.
-
void getAsmBlockArgumentNames(::mlir::Region ®ion, ::mlir::OpAsmSetValueNameFn setNameFn)
Names the block arguments of the
OperatorOpbody region.Input port arguments are named
in0,in1, … in declaration order. Note thatOperatorOponly exposes input ports as block arguments; output values are produced byOutputOpinside the body rather than received as arguments, so theelsebranch that would emitoutNnames is never reached in practice.
-
inline std::string getNodeName()
-
inline unsigned getNumInputPorts()
-
inline Value getInputPort(unsigned index)
-
inline SmallVector<Type> getInputPortTypes()
-
inline SmallVector<Value> getInputPorts()
-
inline unsigned getNumOutputPorts()
-
inline Value getOutputPort(unsigned index)
-
inline SmallVector<Type> getOutputPortTypes()
-
inline SmallVector<Value> getOutputPorts()
-
inline FunctionType getBaseFunctionType()
-
inline bool isDeclaration()
-
inline bool isExternal()
Returns whether the operator is externally defined.
Public Static Functions
-
static inline ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name)
-
static inline ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name)
-
static inline constexpr ::llvm::StringLiteral getOperationName()
-
static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
-
static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
-
static llvm::hash_code computePropertiesHash(const Properties &prop)
-
static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
-
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
-
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
-
static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
-
static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
-
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, FunctionType functionType, function_ref<void(OpBuilder&, Location, ValueRange)> bodyBuilder = nullptr)
Builds an
OperatorOpwith the given name, port types, and body.Unlike
ProcessOp::build, the function type is stored as-is without DFG-type wrapping, so callers are responsible for supplying well-formed types. Only the input port types become block arguments in the entry block; output ports are not represented as arguments because the body yields them viaOutputOpinstead.- Parameters:
name – Symbol name of the operator (must be unique in the module).
functionType – Port signature; types are used verbatim without wrapping.
bodyBuilder – Optional callback invoked with the builder positioned at the entry block; may be null for external declarations.
-
static OperatorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef name, FunctionType functionType, function_ref<void(OpBuilder&, Location, ValueRange)> bodyBuilder = nullptr)
-
static OperatorOp create(::mlir::ImplicitLocOpBuilder &builder, StringRef name, FunctionType functionType, function_ref<void(OpBuilder&, Location, ValueRange)> bodyBuilder = nullptr)
-
static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Parses an
OperatorOpfrom its custom assembly syntax.The expected syntax is:
`dfg.operator` @name (`inputs` `(` arg-list `)`)? (`outputs` `(` arg-list `)`)? (`attributes` attr-dict)? region?
The structure mirrors
ProcessOp::parsewith one key difference: only theinputsargument list is forwarded as block arguments to the body region. Theoutputslist is used solely to reconstruct theFunctionTypeattribute; output values are produced inside the body byOutputOp, not received as arguments. An absent region denotes an external (declaration-only) operator.
-
static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context)
Canonicalization patterns for
OperatorOp.EliminateDeadOperator: Erases an operator that is never referenced by any
InstantiateOpin the enclosing module, mirroring the dead-process elimination applied toProcessOp.
-
static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
-
using Adaptor = OperatorOpAdaptor