MLIR  20.0.0git
Public Types | Static Protected Member Functions | Protected Attributes | List of all members
mlir::OpInterface< ConcreteType, Traits > Class Template Reference

This class represents the base of an operation interface. More...

#include "mlir/IR/OpDefinition.h"

+ Inheritance diagram for mlir::OpInterface< ConcreteType, Traits >:

Public Types

using Base = OpInterface< ConcreteType, Traits >
 
using InterfaceBase = detail::Interface< ConcreteType, Operation *, Traits, Op< ConcreteType >, OpTrait::TraitBase >
 
- Public Types inherited from mlir::detail::Interface< ConcreteType, Operation *, Traits, Op< ConcreteType >, OpTrait::TraitBase >
using Concept = typename Traits::Concept
 
using Model = typename Traits::template Model< T >
 
using FallbackModel = typename Traits::template FallbackModel< T >
 
using InterfaceBase = Interface< ConcreteType, Operation *, Traits, Op< ConcreteType >, OpTrait::TraitBase >
 
using ExternalModel = typename Traits::template ExternalModel< T, U >
 
using ValueType = Operation *
 
- Public Types inherited from mlir::Op< ConcreteType >
using ConcreteOpType = ConcreteType
 Expose the type we are instantiated on to template machinery that may want to introspect traits on this operation. More...
 
using InferredProperties = typename PropertiesSelector< T >::type
 

Static Protected Member Functions

static InterfaceBase::ConceptgetInterfaceFor (Operation *op)
 Returns the impl interface instance for the given operation. More...
 
- Static Protected Member Functions inherited from mlir::OpState
static ParseResult parse (OpAsmParser &parser, OperationState &result)
 Parse the custom form of an operation. More...
 
static void print (Operation *op, OpAsmPrinter &p, StringRef defaultDialect)
 Print the operation. More...
 
static ParseResult genericParseProperties (OpAsmParser &parser, Attribute &result)
 Parse properties as a Attribute. More...
 
static void genericPrintProperties (OpAsmPrinter &p, Attribute properties, ArrayRef< StringRef > elidedProps={})
 Print the properties as a Attribute with names not included within 'elidedProps'. More...
 
static void printOpName (Operation *op, OpAsmPrinter &p, StringRef defaultDialect)
 Print an operation name, eliding the dialect prefix if necessary. More...
 
static EmptyPropertiesgetEmptyProperties ()
 For all op which don't have properties, we keep a single instance of EmptyProperties to be used where a reference to a properties is needed: this allow to bind a pointer to the reference without triggering UB. More...
 

Protected Attributes

friend InterfaceBase
 Allow access to getInterfaceFor. More...
 

Additional Inherited Members

- Public Member Functions inherited from mlir::detail::Interface< ConcreteType, Operation *, Traits, Op< ConcreteType >, OpTrait::TraitBase >
 Interface (Operation * t=Operation *())
 Construct an interface from an instance of the value type. More...
 
 Interface (std::nullptr_t)
 
 Interface (T t)
 Construct an interface instance from a type that implements this interface's trait. More...
 
 Interface (Operation * t, const Concept *conceptImpl)
 Constructor for a known concept. More...
 
 Interface (Operation * t, std::nullptr_t)
 Constructor for DenseMapInfo's empty key and tombstone key. More...
 
- Public Member Functions inherited from mlir::Op< ConcreteType >
ConcreteType clone ()
 Create a deep copy of this operation. More...
 
ConcreteType cloneWithoutRegions ()
 Create a partial copy of this operation without traversing into attached regions. More...
 
 Op ()
 This is a public constructor. Any op can be initialized to null. More...
 
 Op (std::nullptr_t)
 
 Op (Operation *state)
 This is a public constructor to enable access via the llvm::cast family of methods. More...
 
const void * getAsOpaquePointer () const
 Methods for supporting PointerLikeTypeTraits. More...
 
InferredProperties< T > & getProperties ()
 
OperationgetOperation ()
 Inherit getOperation from OpState. More...
 
LogicalResult verify ()
 If the concrete type didn't implement a custom verifier hook, just fall back to this one which accepts everything. More...
 
LogicalResult verifyRegions ()
 
- Public Member Functions inherited from mlir::OpState
 operator bool ()
 Ops are pointer-like, so we allow conversion to bool. More...
 
 operator Operation * () const
 This implicitly converts to Operation*. More...
 
Operationoperator-> () const
 Shortcut of -> to access a member of Operation. More...
 
OperationgetOperation ()
 Return the operation that this refers to. More...
 
MLIRContextgetContext ()
 Return the context this operation belongs to. More...
 
void print (raw_ostream &os, OpPrintingFlags flags=std::nullopt)
 Print the operation to the given stream. More...
 
void print (raw_ostream &os, AsmState &asmState)
 
void dump ()
 Dump this operation. More...
 
Location getLoc ()
 The source location the operation was defined or derived from. More...
 
bool use_empty ()
 Return true if there are no users of any results of this operation. More...
 
void erase ()
 Remove this operation from its parent block and delete it. More...
 
InFlightDiagnostic emitOpError (const Twine &message={})
 Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers. More...
 
InFlightDiagnostic emitError (const Twine &message={})
 Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers that may be listening. More...
 
InFlightDiagnostic emitWarning (const Twine &message={})
 Emit a warning about this operation, reporting up to any diagnostic handlers that may be listening. More...
 
InFlightDiagnostic emitRemark (const Twine &message={})
 Emit a remark about this operation, reporting up to any diagnostic handlers that may be listening. More...
 
template<WalkOrder Order = WalkOrder::PostOrder, typename Iterator = ForwardIterator, typename FnT , typename RetT = detail::walkResultType<FnT>>
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==1, RetT > walk (FnT &&callback)
 Walk the operation by calling the callback for each nested operation (including this one), block or region, depending on the callback provided. More...
 
template<typename FnT , typename RetT = detail::walkResultType<FnT>>
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==2, RetT > walk (FnT &&callback)
 Generic walker with a stage aware callback. More...
 
- Static Public Member Functions inherited from mlir::detail::Interface< ConcreteType, Operation *, Traits, Op< ConcreteType >, OpTrait::TraitBase >
static bool classof (Operation * t)
 Support 'classof' by checking if the given object defines the concrete interface. More...
 
static TypeID getInterfaceID ()
 Define an accessor for the ID of this interface. More...
 
- Static Public Member Functions inherited from mlir::Op< ConcreteType >
static constexpr bool hasTrait ()
 Return if this operation contains the provided trait. More...
 
static bool classof (Operation *op)
 Return true if this "op class" can match against the specified operation. More...
 
static std::enable_if_t< std::is_base_of< OpState, T >::value, bool > classof (const T *op)
 Provide classof support for other OpBase derived classes, such as Interfaces. More...
 
static ConcreteOpType getFromOpaquePointer (const void *pointer)
 
static void attachInterface (MLIRContext &context)
 Attach the given models as implementations of the corresponding interfaces for the concrete operation. More...
 
static LogicalResult setPropertiesFromAttr (PropertiesTy &prop, Attribute attr, function_ref< InFlightDiagnostic()> emitError)
 Convert the provided attribute to a property and assigned it to the provided properties. More...
 
static Attribute getPropertiesAsAttr (MLIRContext *ctx, const PropertiesTy &prop)
 Convert the provided properties to an attribute. More...
 
static llvm::hash_code computePropertiesHash (const PropertiesTy &prop)
 Hash the provided properties. More...
 
static constexpr bool hasProperties ()
 Returns true if this operation defines a Properties inner type. More...
 
static void populateDefaultProperties (OperationName opName, InferredProperties< T > &properties)
 This hook populates any unset default attrs when mapped to properties. More...
 
static void printProperties (MLIRContext *ctx, OpAsmPrinter &p, const T &properties, ArrayRef< StringRef > elidedProps={})
 Print the operation properties with names not included within 'elidedProps'. More...
 
static ParseResult parseProperties (OpAsmParser &parser, OperationState &result)
 Parses 'prop-dict' for the operation. More...
 
- Static Public Member Functions inherited from mlir::OpState
static void getCanonicalizationPatterns (RewritePatternSet &results, MLIRContext *context)
 This hook returns any canonicalization pattern rewrites that the operation supports, for use by the canonicalization pass. More...
 
static void populateDefaultAttrs (const OperationName &, NamedAttrList &)
 This hook populates any unset default attrs. More...
 
- Protected Member Functions inherited from mlir::detail::Interface< ConcreteType, Operation *, Traits, Op< ConcreteType >, OpTrait::TraitBase >
const ConceptgetImpl () const
 Get the raw concept in the correct derived concept type. More...
 
ConceptgetImpl ()
 
- Protected Member Functions inherited from mlir::OpState
LogicalResult verify ()
 If the concrete type didn't implement a custom verifier hook, just fall back to this one which accepts everything. More...
 
LogicalResult verifyRegions ()
 
 OpState (Operation *state)
 Mutability management is handled by the OpWrapper/OpConstWrapper classes, so we can cast it away here. More...
 

Detailed Description

template<typename ConcreteType, typename Traits>
class mlir::OpInterface< ConcreteType, Traits >

This class represents the base of an operation interface.

See the definition of detail::Interface for requirements on the Traits type.

Definition at line 2077 of file OpDefinition.h.

Member Typedef Documentation

◆ Base

template<typename ConcreteType , typename Traits >
using mlir::OpInterface< ConcreteType, Traits >::Base = OpInterface<ConcreteType, Traits>

Definition at line 2081 of file OpDefinition.h.

◆ InterfaceBase

template<typename ConcreteType , typename Traits >
using mlir::OpInterface< ConcreteType, Traits >::InterfaceBase = detail::Interface<ConcreteType, Operation *, Traits, Op<ConcreteType>, OpTrait::TraitBase>

Definition at line 2082 of file OpDefinition.h.

Member Function Documentation

◆ getInterfaceFor()

template<typename ConcreteType , typename Traits >
static InterfaceBase::Concept* mlir::OpInterface< ConcreteType, Traits >::getInterfaceFor ( Operation op)
inlinestaticprotected

Member Data Documentation

◆ InterfaceBase

template<typename ConcreteType , typename Traits >
friend mlir::OpInterface< ConcreteType, Traits >::InterfaceBase
protected

Allow access to getInterfaceFor.

Definition at line 2121 of file OpDefinition.h.


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