MLIR
15.0.0git
|
#include "mlir/IR/OperationSupport.h"
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 > |
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< RegisteredOperationName > | getRegisteredInfo () 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 |
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... | |
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 | |
Impl * | impl |
The internal implementation of the operation name. More... | |
friend | MLIRContextImpl |
Allow access to the Impl struct. More... | |
Definition at line 63 of file OperationSupport.h.
using mlir::OperationName::FoldHookFn = llvm::unique_function<LogicalResult( Operation *, ArrayRef<Attribute>, SmallVectorImpl<OpFoldResult> &) const> |
Definition at line 68 of file OperationSupport.h.
using mlir::OperationName::GetCanonicalizationPatternsFn = llvm::unique_function<void(RewritePatternSet &, MLIRContext *) const> |
Definition at line 66 of file OperationSupport.h.
using mlir::OperationName::HasTraitFn = llvm::unique_function<bool(TypeID) const> |
Definition at line 69 of file OperationSupport.h.
using mlir::OperationName::ParseAssemblyFn = llvm::unique_function<ParseResult(OpAsmParser &, OperationState &) const> |
Definition at line 71 of file OperationSupport.h.
using mlir::OperationName::PrintAssemblyFn = llvm::unique_function<void(Operation *, OpAsmPrinter &, StringRef) const> |
Definition at line 73 of file OperationSupport.h.
using mlir::OperationName::VerifyInvariantsFn = llvm::unique_function<LogicalResult(Operation *) const> |
Definition at line 75 of file OperationSupport.h.
using mlir::OperationName::VerifyRegionInvariantsFn = llvm::unique_function<LogicalResult(Operation *) const> |
Definition at line 77 of file OperationSupport.h.
OperationName::OperationName | ( | StringRef | name, |
MLIRContext * | context | ||
) |
Definition at line 653 of file MLIRContext.cpp.
References mlir::MLIRContext::getImpl(), mlir::MLIRContext::isMultithreadingEnabled(), mlir::MLIRContextImpl::operationInfoMutex, mlir::MLIRContextImpl::operations, and mlir::MLIRContextImpl::registeredOperations.
|
inlineprotected |
Definition at line 214 of file OperationSupport.h.
void OperationName::dump | ( | ) | const |
Definition at line 56 of file AsmPrinter.cpp.
References print(), mlir::AsmParser::~AsmParser(), mlir::DialectAsmParser::~DialectAsmParser(), and mlir::OpAsmParser::~OpAsmParser().
|
inline |
Represent the operation name as an opaque pointer.
(Used to support PointerLikeTypeTraits).
Definition at line 204 of file OperationSupport.h.
Referenced by llvm::PointerLikeTypeTraits< mlir::OperationName >::getAsVoidPointer(), llvm::DenseMapInfo< mlir::OperationName >::getHashValue(), and mlir::hash_value().
|
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 183 of file OperationSupport.h.
Referenced by mlir::Operation::getDialect(), mlir::OpInterface< AffineMapAccessInterface, detail::AffineMapAccessInterfaceInterfaceTraits >::getInterfaceFor(), and mlir::OpState::parse().
StringRef OperationName::getDialectNamespace | ( | ) | const |
Return the name of the dialect this operation is registered to.
Definition at line 685 of file MLIRContext.cpp.
Referenced by mlir::ConversionTarget::markOpRecursivelyLegal().
|
inlinestatic |
|
inline |
Return the name of this operation as a StringAttr.
Definition at line 197 of file OperationSupport.h.
References print().
Referenced by cloneOpWithOperandsAndTypes(), reduceIfNeeded(), splatZero(), vectorizeOneOp(), and widenOp().
|
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 158 of file OperationSupport.h.
Referenced by mlir::transform::TransformEachOpTrait< OpTy >::verifyTrait(), mlir::transform::FunctionalStyleTransformOpTrait< OpTy >::verifyTrait(), and mlir::transform::NavigationTransformOpTrait< OpTy >::verifyTrait().
|
inline |
If this operation is registered, returns the registered information, None otherwise.
Definition at line 382 of file OperationSupport.h.
Referenced by mlir::detail::OpPassManagerImpl::canScheduleOn(), mlir::OpInterface< AffineMapAccessInterface, detail::AffineMapAccessInterfaceInterfaceTraits >::getInterfaceFor(), mlir::Operation::getRegisteredInfo(), inferOperationTypes(), and mayBeValidWithoutTerminator().
|
inline |
Return the name of this operation. This always succeeds.
Definition at line 194 of file OperationSupport.h.
Referenced by mlir::linalg::LinalgTransformationFilter::addOpNameFilter(), mlir::ExternalPass::canScheduleOn(), mlir::Op< AffineDmaStartOp, OpTrait::MemRefsNormalizable, OpTrait::VariadicOperands, OpTrait::ZeroResults, OpTrait::OpInvariants, AffineMapAccessInterface::Trait >::classof(), mlir::Operation::create(), mlir::linalg::generateLibraryCallName(), getLspDiagnoticFromDiag(), inlineCallsInSCC(), mlirLinalgFillBuiltinNamedOpRegion(), mlir::Diagnostic::operator<<(), mlir::OpState::parse(), mlir::AsmPrinter::Impl::printIntegerSet(), mlir::OpState::printOpName(), mlir::OpTrait::SingleBlockImplicitTerminator< TerminatorOpType >::Impl< ConcreteType >::verifyRegionTrait(), and visitInPrettyBlockOrder().
|
inline |
Returns true if this operation has the given interface registered to it.
Definition at line 163 of file OperationSupport.h.
Referenced by mlir::transform::detail::checkImplementsTransformInterface(), mlir::FrozenRewritePatternSet::FrozenRewritePatternSet(), verifyResultTypesAreInferrable(), and verifySwitchOp().
|
inline |
Definition at line 166 of file OperationSupport.h.
|
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 138 of file OperationSupport.h.
References mlir::op_definition_impl::hasTrait().
Referenced by mlir::Operation::create(), mlir::Operation::hasTrait(), and mlir::AsmParserState::Impl::PartialOpDef::PartialOpDef().
|
inline |
Definition at line 141 of file OperationSupport.h.
|
inline |
Return if this operation is registered.
Definition at line 129 of file OperationSupport.h.
Referenced by mlir::Operation::isRegistered().
|
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 174 of file OperationSupport.h.
Referenced by verifyResultTypesAreInferrable().
|
inline |
Definition at line 177 of file OperationSupport.h.
|
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 148 of file OperationSupport.h.
Referenced by mlir::Operation::mightHaveTrait().
|
inline |
Definition at line 151 of file OperationSupport.h.
|
inline |
Definition at line 211 of file OperationSupport.h.
|
inline |
Definition at line 210 of file OperationSupport.h.
void OperationName::print | ( | raw_ostream & | os | ) | const |
Definition at line 54 of file AsmPrinter.cpp.
Referenced by mlir::operator<<().
|
inline |
Return the operation name with dialect name stripped, if it has one.
Definition at line 191 of file OperationSupport.h.
Referenced by visitInPrettyBlockOrder().
|
protected |
The internal implementation of the operation name.
Definition at line 217 of file OperationSupport.h.
|
protected |
Allow access to the Impl struct.
Definition at line 220 of file OperationSupport.h.