Class OperatorOp

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 OperatorOp in the custom assembly syntax consumed by parse.

The symbol name is printed first, followed by optional inputs(...) and outputs(...) clauses. Input port names come from the body region’s block arguments for concrete operators, or use synthetic argN names for external declarations. Output port names are always synthetic argN because outputs are not block arguments — they are produced by OutputOp inside the body and therefore have no region argument to source names from. The body region is printed only for concrete operators; sym_name and function_type are always elided from the attribute dictionary.

::llvm::LogicalResult verifyInvariantsImpl()
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult verify()

Verifies that the OperatorOp body 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 that OperatorOp does not support.

void getAsmBlockArgumentNames(::mlir::Region &region, ::mlir::OpAsmSetValueNameFn setNameFn)

Names the block arguments of the OperatorOp body region.

Input port arguments are named in0, in1, … in declaration order. Note that OperatorOp only exposes input ports as block arguments; output values are produced by OutputOp inside the body rather than received as arguments, so the else branch that would emit outN names 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 OperatorOp with 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 via OutputOp instead.

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 OperatorOp from 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::parse with one key difference: only the inputs argument list is forwarded as block arguments to the body region. The outputs list is used solely to reconstruct the FunctionType attribute; output values are produced inside the body by OutputOp, 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 InstantiateOp in the enclosing module, mirroring the dead-process elimination applied to ProcessOp.

static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)