MLIR
20.0.0git
|
This is a "type erased" representation of a registered operation. More...
#include "mlir/IR/OperationSupport.h"
Classes | |
struct | Model |
Implementation of the InterfaceConcept for operation APIs that forwarded to a concrete op implementation. More... | |
Public Member Functions | |
Dialect & | getDialect () const |
Return the dialect this operation is registered to. More... | |
ParseResult | parseAssembly (OpAsmParser &parser, OperationState &result) const |
Use the specified object to parse this ops custom assembly format. More... | |
Public Member Functions inherited from mlir::OperationName | |
OperationName (StringRef name, MLIRContext *context) | |
bool | isRegistered () const |
Return if this operation is registered. More... | |
TypeID | getTypeID () const |
Return the unique identifier of the derived Op class, or null if not registered. More... | |
std::optional< RegisteredOperationName > | getRegisteredInfo () const |
If this operation is registered, returns the registered information, std::nullopt otherwise. More... | |
LogicalResult | foldHook (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results) const |
This hook implements a generalized folder for this operation. More... | |
void | getCanonicalizationPatterns (RewritePatternSet &results, MLIRContext *context) const |
This hook returns any canonicalization pattern rewrites that the operation supports, for use by the canonicalization pass. More... | |
template<template< typename T > class Trait> | |
bool | hasTrait () const |
Returns true if the operation was registered with a particular trait, e.g. More... | |
bool | hasTrait (TypeID traitID) const |
template<template< typename T > class Trait> | |
bool | mightHaveTrait () const |
Returns true if the operation might have the provided trait. More... | |
bool | mightHaveTrait (TypeID traitID) const |
ParseAssemblyFn | getParseAssemblyFn () const |
Return the static hook for parsing this operation assembly. More... | |
void | populateDefaultAttrs (NamedAttrList &attrs) const |
This hook implements the method to populate defaults attributes that are unset. More... | |
void | printAssembly (Operation *op, OpAsmPrinter &p, StringRef defaultDialect) const |
This hook implements the AsmPrinter for this operation. More... | |
LogicalResult | verifyInvariants (Operation *op) const |
These hooks implement the verifiers for this operation. More... | |
LogicalResult | verifyRegionInvariants (Operation *op) const |
ArrayRef< StringAttr > | getAttributeNames () const |
Return the list of cached attribute names registered to this operation. More... | |
template<typename T > | |
T::Concept * | getInterface () const |
Returns an instance of the concept object for the given interface if it was registered to this operation, null otherwise. More... | |
template<typename... Models> | |
void | attachInterface () |
Attach the given models as implementations of the corresponding interfaces for the concrete operation. More... | |
template<typename InterfaceT > | |
bool | hasPromiseOrImplementsInterface () const |
Returns true if InterfaceT has been promised by the dialect or implemented. More... | |
template<typename T > | |
bool | hasInterface () const |
Returns true if this operation has the given interface registered to it. More... | |
bool | hasInterface (TypeID interfaceID) const |
template<typename T > | |
bool | mightHaveInterface () const |
Returns true if the operation might have the provided interface. More... | |
bool | mightHaveInterface (TypeID interfaceID) const |
std::optional< Attribute > | getInherentAttr (Operation *op, StringRef name) const |
Lookup an inherent attribute by name, this method isn't recommended and may be removed in the future. More... | |
void | setInherentAttr (Operation *op, StringAttr name, Attribute value) const |
void | populateInherentAttrs (Operation *op, NamedAttrList &attrs) const |
LogicalResult | verifyInherentAttrs (NamedAttrList &attributes, function_ref< InFlightDiagnostic()> emitError) const |
This method exists for backward compatibility purpose when using properties to store inherent attributes, it enables validating the attributes when parsed from the older generic syntax pre-Properties. More... | |
int | getOpPropertyByteSize () const |
This hooks return the number of bytes to allocate for the op properties. More... | |
void | destroyOpProperties (OpaqueProperties properties) const |
This hooks destroy the op properties. More... | |
void | initOpProperties (OpaqueProperties storage, OpaqueProperties init) const |
Initialize the op properties. More... | |
void | populateDefaultProperties (OpaqueProperties properties) const |
Set the default values on the ODS attribute in the properties. More... | |
Attribute | getOpPropertiesAsAttribute (Operation *op) const |
Return the op properties converted to an Attribute. More... | |
LogicalResult | setOpPropertiesFromAttribute (OperationName opName, OpaqueProperties properties, Attribute attr, function_ref< InFlightDiagnostic()> emitError) const |
Define the op properties from the provided Attribute. More... | |
void | copyOpProperties (OpaqueProperties lhs, OpaqueProperties rhs) const |
bool | compareOpProperties (OpaqueProperties lhs, OpaqueProperties rhs) const |
llvm::hash_code | hashOpProperties (OpaqueProperties properties) const |
Dialect * | getDialect () const |
Return the dialect this operation is registered to if the dialect is loaded in the context, or nullptr if the dialect isn't loaded. More... | |
StringRef | getDialectNamespace () const |
Return the name of the dialect this operation is registered to. More... | |
StringRef | stripDialect () const |
Return the operation name with dialect name stripped, if it has one. More... | |
MLIRContext * | getContext () |
Return the context this operation is associated with. More... | |
StringRef | getStringRef () const |
Return the name of this operation. This always succeeds. More... | |
StringAttr | getIdentifier () const |
Return the name of this operation as a StringAttr. More... | |
void | print (raw_ostream &os) const |
void | dump () const |
void * | getAsOpaquePointer () const |
Represent the operation name as an opaque pointer. More... | |
bool | operator== (const OperationName &rhs) const |
bool | operator!= (const OperationName &rhs) const |
Static Public Member Functions | |
static std::optional< RegisteredOperationName > | lookup (StringRef name, MLIRContext *ctx) |
Lookup the registered operation information for the given operation. More... | |
static std::optional< RegisteredOperationName > | lookup (TypeID typeID, MLIRContext *ctx) |
Lookup the registered operation information for the given operation. More... | |
template<typename T > | |
static void | insert (Dialect &dialect) |
Register a new operation in a Dialect object. More... | |
static void | insert (std::unique_ptr< OperationName::Impl > ownedImpl, ArrayRef< StringRef > attrNames) |
The use of this method is in general discouraged in favor of 'insert<CustomOp>(dialect)'. More... | |
static RegisteredOperationName | getFromOpaquePointer (const void *pointer) |
Represent the operation name as an opaque pointer. More... | |
Static Public Member Functions inherited from mlir::OperationName | |
static OperationName | getFromOpaquePointer (const void *pointer) |
Additional Inherited Members | |
Public Types inherited from mlir::OperationName | |
using | FoldHookFn = llvm::unique_function< LogicalResult(Operation *, ArrayRef< Attribute >, SmallVectorImpl< OpFoldResult > &) const > |
using | HasTraitFn = llvm::unique_function< bool(TypeID) const > |
using | ParseAssemblyFn = llvm::unique_function< ParseResult(OpAsmParser &, OperationState &)> |
using | PopulateDefaultAttrsFn = llvm::unique_function< void(const OperationName &, NamedAttrList &) const > |
using | PrintAssemblyFn = llvm::unique_function< void(Operation *, OpAsmPrinter &, StringRef) const > |
using | VerifyInvariantsFn = llvm::unique_function< LogicalResult(Operation *) const > |
using | VerifyRegionInvariantsFn = llvm::unique_function< LogicalResult(Operation *) const > |
Protected Member Functions inherited from mlir::OperationName | |
OperationName (Impl *impl) | |
Impl * | getImpl () const |
void | setImpl (Impl *rhs) |
This is a "type erased" representation of a registered operation.
This should only be used by things like the AsmPrinter and other things that need to be parameterized by generic operation hooks. Most user code should use the concrete operation types.
Definition at line 527 of file OperationSupport.h.
|
inline |
Return the dialect this operation is registered to.
Definition at line 696 of file OperationSupport.h.
References mlir::OperationName::Impl::getDialect(), and mlir::OperationName::getImpl().
|
inlinestatic |
Represent the operation name as an opaque pointer.
(Used to support PointerLikeTypeTraits).
Definition at line 703 of file OperationSupport.h.
Referenced by llvm::DenseMapInfo< mlir::RegisteredOperationName >::getEmptyKey(), llvm::PointerLikeTypeTraits< mlir::RegisteredOperationName >::getFromVoidPointer(), and llvm::DenseMapInfo< mlir::RegisteredOperationName >::getTombstoneKey().
|
inlinestatic |
Register a new operation in a Dialect object.
This constructor is used by Dialect objects when they register the list of operations they contain.
Definition at line 687 of file OperationSupport.h.
Referenced by mlir::ExtensibleDialect::registerDynamicOp().
|
static |
The use of this method is in general discouraged in favor of 'insert<CustomOp>(dialect)'.
|
static |
Lookup the registered operation information for the given operation.
Returns std::nullopt if the operation isn't registered.
Definition at line 958 of file MLIRContext.cpp.
References mlir::MLIRContext::getImpl().
Referenced by mlir::Op< ConcreteType, Traits >::attachInterface(), mlir::transform::detail::checkImplementsTransformOpInterface(), mlir::MLIRContext::isOperationRegistered(), mlirOperationImplementsInterfaceStatic(), and verifyResultTypesAreInferrable().
|
static |
Lookup the registered operation information for the given operation.
Returns std::nullopt if the operation isn't registered.
Definition at line 949 of file MLIRContext.cpp.
References mlir::MLIRContext::getImpl().
ParseResult mlir::RegisteredOperationName::parseAssembly | ( | OpAsmParser & | parser, |
OperationState & | result | ||
) | const |
Use the specified object to parse this ops custom assembly format.