MLIR  14.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:
Inheritance graph
[legend]
Collaboration diagram for mlir::OperationName:
Collaboration graph
[legend]

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 PrintAssemblyFn = llvm::unique_function< void(Operation *, OpAsmPrinter &, StringRef) const >
 
using VerifyInvariantsFn = 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
 
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
 
voidgetAsOpaquePointer () 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 65 of file OperationSupport.h.

Member Typedef Documentation

◆ FoldHookFn

Definition at line 70 of file OperationSupport.h.

◆ GetCanonicalizationPatternsFn

Definition at line 68 of file OperationSupport.h.

◆ HasTraitFn

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

Definition at line 71 of file OperationSupport.h.

◆ ParseAssemblyFn

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

Definition at line 73 of file OperationSupport.h.

◆ PrintAssemblyFn

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

Definition at line 75 of file OperationSupport.h.

◆ VerifyInvariantsFn

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

Definition at line 77 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 202 of file OperationSupport.h.

Member Function Documentation

◆ dump()

void OperationName::dump ( ) const

◆ getAsOpaquePointer()

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

Represent the operation name as an opaque pointer.

(Used to support PointerLikeTypeTraits).

Definition at line 192 of file OperationSupport.h.

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

Referenced by mlir::Operation::getDialect(), mlir::OpInterface< AffineMapAccessInterface, detail::AffineMapAccessInterfaceInterfaceTraits >::getInterfaceFor(), and mlir::OpState::parse().

◆ getDialectNamespace()

StringRef OperationName::getDialectNamespace ( ) const

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

Definition at line 679 of file MLIRContext.cpp.

Referenced by composeLegalityCallbacks().

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

References print().

Referenced by mlir::OpPassManager::getNesting(), mlir::PassManager::run(), and mlir::detail::OpToOpPassAdaptor::runOnOperation().

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

◆ getRegisteredInfo()

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

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

Referenced by mlir::FrozenRewritePatternSet::FrozenRewritePatternSet().

◆ hasInterface() [2/2]

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

Definition at line 165 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 137 of file OperationSupport.h.

References mlir::op_definition_impl::hasTrait().

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

◆ isRegistered()

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

Return if this operation is registered.

Definition at line 128 of file OperationSupport.h.

Referenced by mlir::Operation::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 147 of file OperationSupport.h.

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

◆ mightHaveTrait() [2/2]

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

Definition at line 150 of file OperationSupport.h.

◆ operator!=()

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

Definition at line 199 of file OperationSupport.h.

◆ operator==()

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

Definition at line 198 of file OperationSupport.h.

◆ print()

void OperationName::print ( raw_ostream &  os) const

Definition at line 49 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 179 of file OperationSupport.h.

Referenced by visitInPrettyBlockOrder().

Member Data Documentation

◆ impl

Impl* mlir::OperationName::impl
protected

The internal implementation of the operation name.

Definition at line 205 of file OperationSupport.h.

◆ MLIRContextImpl

friend mlir::OperationName::MLIRContextImpl
protected

Allow access to the Impl struct.

Definition at line 208 of file OperationSupport.h.


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