MLIR
17.0.0git
|
This provides public APIs that all operations should have. More...
#include "mlir/IR/OpDefinition.h"
Public Types | |
using | ConcreteOpType = ConcreteType |
Expose the type we are instantiated on to template machinery that may want to introspect traits on this operation. More... | |
Public Member Functions | |
ConcreteType | clone () |
Create a deep copy of this operation. More... | |
ConcreteType | cloneWithoutRegions () |
Create a partial copy of this operation without traversing into attached regions. More... | |
Op () | |
This is a public constructor. Any op can be initialized to null. More... | |
Op (std::nullptr_t) | |
Op (Operation *state) | |
This is a public constructor to enable access via the llvm::cast family of methods. More... | |
const void * | getAsOpaquePointer () const |
Methods for supporting PointerLikeTypeTraits. More... | |
Operation * | getOperation () |
Inherit getOperation from OpState . More... | |
LogicalResult | verify () |
If the concrete type didn't implement a custom verifier hook, just fall back to this one which accepts everything. More... | |
LogicalResult | verifyRegions () |
![]() | |
operator bool () | |
Ops are pointer-like, so we allow conversion to bool. More... | |
operator Operation * () const | |
This implicitly converts to Operation*. More... | |
Operation * | operator-> () const |
Shortcut of -> to access a member of Operation. More... | |
Operation * | getOperation () |
Return the operation that this refers to. More... | |
MLIRContext * | getContext () |
Return the context this operation belongs to. More... | |
void | print (raw_ostream &os, OpPrintingFlags flags=std::nullopt) |
Print the operation to the given stream. More... | |
void | print (raw_ostream &os, AsmState &asmState) |
void | dump () |
Dump this operation. More... | |
Location | getLoc () |
The source location the operation was defined or derived from. More... | |
bool | use_empty () |
Return true if there are no users of any results of this operation. More... | |
void | erase () |
Remove this operation from its parent block and delete it. More... | |
InFlightDiagnostic | emitOpError (const Twine &message={}) |
Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers. More... | |
InFlightDiagnostic | emitError (const Twine &message={}) |
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers that may be listening. More... | |
InFlightDiagnostic | emitWarning (const Twine &message={}) |
Emit a warning about this operation, reporting up to any diagnostic handlers that may be listening. More... | |
InFlightDiagnostic | emitRemark (const Twine &message={}) |
Emit a remark about this operation, reporting up to any diagnostic handlers that may be listening. More... | |
template<WalkOrder Order = WalkOrder::PostOrder, typename FnT , typename RetT = detail::walkResultType<FnT>> | |
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==1, RetT > | walk (FnT &&callback) |
Walk the operation by calling the callback for each nested operation (including this one), block or region, depending on the callback provided. More... | |
template<typename FnT , typename RetT = detail::walkResultType<FnT>> | |
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==2, RetT > | walk (FnT &&callback) |
Generic walker with a stage aware callback. More... | |
Static Public Member Functions | |
template<template< typename T > class Trait> | |
static constexpr bool | hasTrait () |
Return if this operation contains the provided trait. More... | |
static bool | classof (Operation *op) |
Return true if this "op class" can match against the specified operation. More... | |
template<typename T > | |
static std::enable_if_t< std::is_base_of< OpState, T >::value, bool > | classof (const T *op) |
Provide classof support for other OpBase derived classes, such as Interfaces. More... | |
static ConcreteOpType | getFromOpaquePointer (const void *pointer) |
template<typename... Models> | |
static void | attachInterface (MLIRContext &context) |
Attach the given models as implementations of the corresponding interfaces for the concrete operation. More... | |
![]() | |
static void | getCanonicalizationPatterns (RewritePatternSet &results, MLIRContext *context) |
This hook returns any canonicalization pattern rewrites that the operation supports, for use by the canonicalization pass. More... | |
static void | populateDefaultAttrs (const OperationName &, NamedAttrList &) |
This hook populates any unset default attrs. More... | |
Additional Inherited Members | |
![]() | |
LogicalResult | verify () |
If the concrete type didn't implement a custom verifier hook, just fall back to this one which accepts everything. More... | |
LogicalResult | verifyRegions () |
OpState (Operation *state) | |
Mutability management is handled by the OpWrapper/OpConstWrapper classes, so we can cast it away here. More... | |
![]() | |
static ParseResult | parse (OpAsmParser &parser, OperationState &result) |
Parse the custom form of an operation. More... | |
static void | print (Operation *op, OpAsmPrinter &p, StringRef defaultDialect) |
Print the operation. More... | |
static void | printOpName (Operation *op, OpAsmPrinter &p, StringRef defaultDialect) |
Print an operation name, eliding the dialect prefix if necessary. More... | |
This provides public APIs that all operations should have.
The template argument 'ConcreteType' should be the concrete type by CRTP and the others are base classes by the policy pattern.
Definition at line 1608 of file OpDefinition.h.
using mlir::Op< ConcreteType, Traits >::ConcreteOpType = ConcreteType |
Expose the type we are instantiated on to template machinery that may want to introspect traits on this operation.
Definition at line 1653 of file OpDefinition.h.
|
inlineexplicit |
This is a public constructor. Any op can be initialized to null.
Definition at line 1656 of file OpDefinition.h.
|
inline |
Definition at line 1657 of file OpDefinition.h.
|
inlineexplicit |
This is a public constructor to enable access via the llvm::cast family of methods.
This should not be used directly.
Definition at line 1661 of file OpDefinition.h.
|
inlinestatic |
Attach the given models as implementations of the corresponding interfaces for the concrete operation.
Definition at line 1675 of file OpDefinition.h.
References mlir::RegisteredOperationName::lookup().
|
inlinestatic |
Provide classof
support for other OpBase derived classes, such as Interfaces.
Definition at line 1647 of file OpDefinition.h.
References mlir::Op< ConcreteType, Traits >::classof(), and mlir::Op< ConcreteType, Traits >::getOperation().
|
inlinestatic |
Return true if this "op class" can match against the specified operation.
Definition at line 1632 of file OpDefinition.h.
References mlir::Operation::getName(), mlir::Operation::getRegisteredInfo(), and mlir::OperationName::getStringRef().
Referenced by mlir::Op< ConcreteType, Traits >::classof().
|
inline |
Create a deep copy of this operation.
Definition at line 1622 of file OpDefinition.h.
References mlir::Op< ConcreteType, Traits >::clone(), and mlir::Op< ConcreteType, Traits >::getOperation().
Referenced by mlir::Op< ConcreteType, Traits >::clone().
|
inline |
Create a partial copy of this operation without traversing into attached regions.
The new operation will have the same number of regions as the original one, but they will be left empty.
Definition at line 1627 of file OpDefinition.h.
References mlir::Op< ConcreteType, Traits >::getOperation().
|
inline |
Methods for supporting PointerLikeTypeTraits.
Definition at line 1664 of file OpDefinition.h.
|
inlinestatic |
Definition at line 1667 of file OpDefinition.h.
|
inline |
Inherit getOperation from OpState
.
Definition at line 92 of file OpDefinition.h.
Referenced by mlir::Op< ConcreteType, Traits >::classof(), mlir::Op< ConcreteType, Traits >::clone(), mlir::Op< ConcreteType, Traits >::cloneWithoutRegions(), and generateCopy().
|
inlinestaticconstexpr |
Return if this operation contains the provided trait.
Definition at line 1617 of file OpDefinition.h.
|
inline |
If the concrete type didn't implement a custom verifier hook, just fall back to this one which accepts everything.
Definition at line 192 of file OpDefinition.h.
|
inline |
Definition at line 193 of file OpDefinition.h.