MLIR  17.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
mlir::RegisteredOperationName Class Reference

This is a "type erased" representation of a registered operation. More...

#include "mlir/IR/OperationSupport.h"

+ Inheritance diagram for mlir::RegisteredOperationName:
+ Collaboration diagram for mlir::RegisteredOperationName:

Classes

struct  Model
 Implementation of the InterfaceConcept for operation APIs that forwarded to a concrete op implementation. More...
 

Public Member Functions

DialectgetDialect () 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< RegisteredOperationNamegetRegisteredInfo () 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 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
 
DialectgetDialect () 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...
 
MLIRContextgetContext ()
 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< RegisteredOperationNamelookup (StringRef name, 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)
 
ImplgetImpl () const
 
void setImpl (Impl *rhs)
 

Detailed Description

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 381 of file OperationSupport.h.

Member Function Documentation

◆ getDialect()

Dialect& mlir::RegisteredOperationName::getDialect ( ) const
inline

Return the dialect this operation is registered to.

Definition at line 436 of file OperationSupport.h.

References mlir::OperationName::Impl::getDialect(), and mlir::OperationName::getImpl().

◆ getFromOpaquePointer()

static RegisteredOperationName mlir::RegisteredOperationName::getFromOpaquePointer ( const void *  pointer)
inlinestatic

◆ insert() [1/2]

template<typename T >
static void mlir::RegisteredOperationName::insert ( Dialect dialect)
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 427 of file OperationSupport.h.

Referenced by mlir::ExtensibleDialect::registerDynamicOp().

◆ insert() [2/2]

static void mlir::RegisteredOperationName::insert ( std::unique_ptr< OperationName::Impl ownedImpl,
ArrayRef< StringRef >  attrNames 
)
static

The use of this method is in general discouraged in favor of 'insert<CustomOp>(dialect)'.

◆ lookup()

std::optional< RegisteredOperationName > RegisteredOperationName::lookup ( StringRef  name,
MLIRContext ctx 
)
static

◆ parseAssembly()

ParseResult mlir::RegisteredOperationName::parseAssembly ( OpAsmParser parser,
OperationState result 
) const

Use the specified object to parse this ops custom assembly format.


The documentation for this class was generated from the following files: