MLIR  16.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mlir::OperationName Class Reference

#include "mlir/IR/OperationSupport.h"

+ Inheritance diagram for mlir::OperationName:
+ Collaboration diagram for mlir::OperationName:

Classes

struct  Impl
 This class represents a type erased version of an operation. More...
 

Public Types

using GetCanonicalizationPatternsFn = llvm::unique_function< void(RewritePatternSet &, MLIRContext *) const >
 
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 &) const >
 
using PopulateDefaultAttrsFn = llvm::unique_function< void(const RegisteredOperationName &, 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 >
 

Public Member Functions

 OperationName (StringRef name, MLIRContext *context)
 
bool isRegistered () const
 Return if this operation is registered. More...
 
Optional< RegisteredOperationNamegetRegisteredInfo () const
 If this operation is registered, returns the registered information, None otherwise. 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
 
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 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...
 
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 OperationName getFromOpaquePointer (const void *pointer)
 

Protected Member Functions

 OperationName (Impl *impl)
 

Protected Attributes

Implimpl
 The internal implementation of the operation name. More...
 
friend MLIRContextImpl
 Allow access to the Impl struct. More...
 

Detailed Description

Definition at line 64 of file OperationSupport.h.

Member Typedef Documentation

◆ FoldHookFn

Definition at line 68 of file OperationSupport.h.

◆ GetCanonicalizationPatternsFn

using mlir::OperationName::GetCanonicalizationPatternsFn = llvm::unique_function<void(RewritePatternSet &, MLIRContext *) const>

Definition at line 66 of file OperationSupport.h.

◆ HasTraitFn

using mlir::OperationName::HasTraitFn = llvm::unique_function<bool(TypeID) const>

Definition at line 70 of file OperationSupport.h.

◆ ParseAssemblyFn

using mlir::OperationName::ParseAssemblyFn = llvm::unique_function<ParseResult(OpAsmParser &, OperationState &) const>

Definition at line 71 of file OperationSupport.h.

◆ PopulateDefaultAttrsFn

using mlir::OperationName::PopulateDefaultAttrsFn = llvm::unique_function<void( const RegisteredOperationName &, NamedAttrList &) const>

Definition at line 75 of file OperationSupport.h.

◆ PrintAssemblyFn

using mlir::OperationName::PrintAssemblyFn = llvm::unique_function<void(Operation *, OpAsmPrinter &, StringRef) const>

Definition at line 77 of file OperationSupport.h.

◆ VerifyInvariantsFn

using mlir::OperationName::VerifyInvariantsFn = llvm::unique_function<LogicalResult(Operation *) const>

Definition at line 79 of file OperationSupport.h.

◆ VerifyRegionInvariantsFn

Definition at line 81 of file OperationSupport.h.

Constructor & Destructor Documentation

◆ OperationName() [1/2]

OperationName::OperationName ( StringRef  name,
MLIRContext context 
)

◆ OperationName() [2/2]

mlir::OperationName::OperationName ( Impl impl)
inlineprotected

Definition at line 224 of file OperationSupport.h.

Member Function Documentation

◆ dump()

void OperationName::dump ( ) const

Definition at line 57 of file AsmPrinter.cpp.

References print().

◆ getAsOpaquePointer()

void* mlir::OperationName::getAsOpaquePointer ( ) const
inline

Represent the operation name as an opaque pointer.

(Used to support PointerLikeTypeTraits).

Definition at line 214 of file OperationSupport.h.

References impl.

Referenced by llvm::PointerLikeTypeTraits< mlir::OperationName >::getAsVoidPointer(), llvm::DenseMapInfo< mlir::OperationName >::getHashValue(), and mlir::hash_value().

◆ getDialect()

Dialect* mlir::OperationName::getDialect ( ) const
inline

Return the dialect this operation is registered to if the dialect is loaded in the context, or nullptr if the dialect isn't loaded.

Definition at line 193 of file OperationSupport.h.

References isRegistered().

Referenced by mlir::Operation::getDialect(), getDialectNamespace(), mlir::OpInterface< ConcreteType, Traits >::getInterfaceFor(), and mlir::OpState::parse().

◆ getDialectNamespace()

StringRef OperationName::getDialectNamespace ( ) const

Return the name of the dialect this operation is registered to.

Definition at line 740 of file MLIRContext.cpp.

References getDialect(), and getStringRef().

◆ getFromOpaquePointer()

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

◆ getIdentifier()

StringAttr mlir::OperationName::getIdentifier ( ) const
inline

Return the name of this operation as a StringAttr.

Definition at line 207 of file OperationSupport.h.

Referenced by cloneOpWithOperandsAndTypes(), getStringRef(), mlir::impl::scalarizeVectorOp(), vectorizeOneOp(), and widenOp().

◆ getInterface()

template<typename T >
T::Concept* mlir::OperationName::getInterface ( ) const
inline

Returns an instance of the concept object for the given interface if it was registered to this operation, null otherwise.

This should not be used directly.

Definition at line 167 of file OperationSupport.h.

Referenced by mlir::transform::TransformEachOpTrait< OpTy >::verifyTrait(), mlir::transform::FunctionalStyleTransformOpTrait< OpTy >::verifyTrait(), and mlir::transform::NavigationTransformOpTrait< OpTy >::verifyTrait().

◆ getRegisteredInfo()

Optional< RegisteredOperationName > mlir::OperationName::getRegisteredInfo ( ) const
inline

If this operation is registered, returns the registered information, None otherwise.

Definition at line 399 of file OperationSupport.h.

References isRegistered().

Referenced by mlir::Operation::create(), mlir::OpInterface< ConcreteType, Traits >::getInterfaceFor(), mlir::Operation::getRegisteredInfo(), and inferOperationTypes().

◆ getStringRef()

StringRef mlir::OperationName::getStringRef ( ) const
inline

◆ hasInterface() [1/2]

template<typename T >
bool mlir::OperationName::hasInterface ( ) const
inline

Returns true if this operation has the given interface registered to it.

Definition at line 173 of file OperationSupport.h.

Referenced by mlir::transform::detail::checkImplementsTransformOpInterface(), mlir::FrozenRewritePatternSet::FrozenRewritePatternSet(), and mightHaveInterface().

◆ hasInterface() [2/2]

bool mlir::OperationName::hasInterface ( TypeID  interfaceID) const
inline

Definition at line 176 of file OperationSupport.h.

◆ hasTrait() [1/2]

template<template< typename T > class Trait>
bool mlir::OperationName::hasTrait ( ) const
inline

Returns true if the operation was registered with a particular trait, e.g.

hasTrait<OperandsAreSignlessIntegerLike>(). Returns false if the operation is unregistered.

Definition at line 145 of file OperationSupport.h.

Referenced by mlir::Operation::create(), mlir::Operation::hasTrait(), and mlir::AsmParserState::Impl::PartialOpDef::PartialOpDef().

◆ hasTrait() [2/2]

bool mlir::OperationName::hasTrait ( TypeID  traitID) const
inline

Definition at line 148 of file OperationSupport.h.

References isRegistered().

◆ isRegistered()

bool mlir::OperationName::isRegistered ( ) const
inline

Return if this operation is registered.

Definition at line 135 of file OperationSupport.h.

Referenced by getDialect(), getRegisteredInfo(), hasTrait(), mlir::Operation::isRegistered(), mightHaveInterface(), and mightHaveTrait().

◆ mightHaveInterface() [1/2]

template<typename T >
bool mlir::OperationName::mightHaveInterface ( ) const
inline

Returns true if the operation might have the provided interface.

This means that either the operation is unregistered, or it was registered with the provide interface.

Definition at line 184 of file OperationSupport.h.

◆ mightHaveInterface() [2/2]

bool mlir::OperationName::mightHaveInterface ( TypeID  interfaceID) const
inline

Definition at line 187 of file OperationSupport.h.

References hasInterface(), and isRegistered().

◆ mightHaveTrait() [1/2]

template<template< typename T > class Trait>
bool mlir::OperationName::mightHaveTrait ( ) const
inline

Returns true if the operation might have the provided trait.

This means that either the operation is unregistered, or it was registered with the provide trait.

Definition at line 156 of file OperationSupport.h.

Referenced by mlir::Operation::mightHaveTrait().

◆ mightHaveTrait() [2/2]

bool mlir::OperationName::mightHaveTrait ( TypeID  traitID) const
inline

Definition at line 159 of file OperationSupport.h.

References isRegistered().

◆ operator!=()

bool mlir::OperationName::operator!= ( const OperationName rhs) const
inline

Definition at line 221 of file OperationSupport.h.

◆ operator==()

bool mlir::OperationName::operator== ( const OperationName rhs) const
inline

Definition at line 220 of file OperationSupport.h.

◆ print()

void OperationName::print ( raw_ostream &  os) const

Definition at line 55 of file AsmPrinter.cpp.

Referenced by mlir::operator<<().

◆ stripDialect()

StringRef mlir::OperationName::stripDialect ( ) const
inline

Return the operation name with dialect name stripped, if it has one.

Definition at line 201 of file OperationSupport.h.

References getStringRef().

Member Data Documentation

◆ impl

Impl* mlir::OperationName::impl
protected

The internal implementation of the operation name.

Definition at line 227 of file OperationSupport.h.

Referenced by getAsOpaquePointer().

◆ MLIRContextImpl

friend mlir::OperationName::MLIRContextImpl
protected

Allow access to the Impl struct.

Definition at line 230 of file OperationSupport.h.


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