My Project
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
mlir::Op< ConcreteType, Traits > Class Template Reference

#include <OpDefinition.h>

Inheritance diagram for mlir::Op< ConcreteType, Traits >:
Inheritance graph
[legend]
Collaboration diagram for mlir::Op< ConcreteType, Traits >:
Collaboration graph
[legend]

Public Types

using ConcreteOpType = ConcreteType
 
- Public Types inherited from mlir::OpState
using dialect_attr_iterator = Operation::dialect_attr_iterator
 A utility iterator that filters out non-dialect attributes. More...
 
using dialect_attr_range = Operation::dialect_attr_range
 

Public Member Functions

OperationgetOperation ()
 Return the operation that this refers to. More...
 
ConcreteType clone ()
 Create a deep copy of this operation. More...
 
ConcreteType cloneWithoutRegions ()
 
DialectgetDialect ()
 Return the dialect that this refers to. More...
 
RegiongetParentRegion ()
 Return the parent Region of this operation. More...
 
 Op ()
 This is a public constructor. Any op can be initialized to null. More...
 
 Op (std::nullptr_t)
 
 Op (Operation *state)
 
const void * getAsOpaquePointer () const
 Methods for supporting PointerLikeTypeTraits. More...
 
- Public Member Functions inherited from mlir::OpState
 operator bool ()
 Ops are pointer-like, so we allow implicit conversion to bool. More...
 
 operator Operation * () const
 This implicitly converts to Operation*. More...
 
OperationgetOperation ()
 Return the operation that this refers to. More...
 
OperationgetParentOp ()
 
template<typename OpTy >
OpTy getParentOfType ()
 Return the closest surrounding parent operation that is of type 'OpTy'. More...
 
MLIRContextgetContext ()
 Return the context this operation belongs to. More...
 
void print (raw_ostream &os, OpPrintingFlags flags=llvm::None)
 Print the operation to the given stream. More...
 
void dump ()
 Dump this operation. More...
 
Location getLoc ()
 The source location the operation was defined or derived from. More...
 
void setLoc (Location loc)
 
ArrayRef< NamedAttributegetAttrs ()
 Return all of the attributes on this operation. More...
 
dialect_attr_range getDialectAttrs ()
 Return a range corresponding to the dialect attributes for this operation. More...
 
dialect_attr_iterator dialect_attr_begin ()
 
dialect_attr_iterator dialect_attr_end ()
 
Attribute getAttr (StringRef name)
 Return an attribute with the specified name. More...
 
template<typename AttrClass >
AttrClass getAttrOfType (StringRef name)
 If the operation has an attribute of the specified type, return it. More...
 
void setAttr (Identifier name, Attribute value)
 
void setAttr (StringRef name, Attribute value)
 
void setAttrs (ArrayRef< NamedAttribute > attributes)
 Set the attributes held by this operation. More...
 
void setAttrs (NamedAttributeList newAttrs)
 
template<typename DialectAttrs >
void setDialectAttrs (DialectAttrs &&attrs)
 Set the dialect attributes for this operation, and preserve all dependent. More...
 
NamedAttributeList::RemoveResult removeAttr (Identifier name)
 
NamedAttributeList::RemoveResult removeAttr (StringRef name)
 
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={})
 
InFlightDiagnostic emitError (const Twine &message={})
 
InFlightDiagnostic emitWarning (const Twine &message={})
 
InFlightDiagnostic emitRemark (const Twine &message={})
 
template<typename FnT , typename RetT = detail::walkResultType<FnT>>
RetT walk (FnT &&callback)
 
- Public Member Functions inherited from mlir::FoldingHook< ConcreteType, llvm::is_one_of< OpTrait::OneResult< ConcreteType >, Traits< ConcreteType >... >::value >
LogicalResult fold (ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)
 

Static Public Member Functions

template<template< typename T > class Trait>
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 ParseResult parseAssembly (OpAsmParser &parser, OperationState &result)
 
static void printAssembly (Operation *op, OpAsmPrinter &p)
 
static LogicalResult verifyInvariants (Operation *op)
 
static AbstractOperation::OperationProperties getOperationProperties ()
 
static ConcreteOpType getFromOpaquePointer (const void *pointer)
 
- Static Public Member Functions inherited from mlir::OpState
static void getCanonicalizationPatterns (OwningRewritePatternList &results, MLIRContext *context)
 
- Static Public Member Functions inherited from mlir::FoldingHook< ConcreteType, llvm::is_one_of< OpTrait::OneResult< ConcreteType >, Traits< ConcreteType >... >::value >
static LogicalResult foldHook (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)
 

Additional Inherited Members

- Protected Member Functions inherited from mlir::OpState
LogicalResult verify ()
 
void print (OpAsmPrinter &p)
 
 OpState (Operation *state)
 
- Static Protected Member Functions inherited from mlir::OpState
static ParseResult parse (OpAsmParser &parser, OperationState &result)
 

Detailed Description

template<typename ConcreteType, template< typename T > class... Traits>
class mlir::Op< ConcreteType, Traits >

This provides public APIs that all operations should have. The template argument 'ConcreteType' should be the concrete type by CRTP and the others are base classes by the policy pattern.

Member Typedef Documentation

◆ ConcreteOpType

template<typename ConcreteType, template< typename T > class... Traits>
using mlir::Op< ConcreteType, Traits >::ConcreteOpType = ConcreteType

Expose the type we are instantiated on to template machinery that may want to introspect traits on this operation.

Constructor & Destructor Documentation

◆ Op() [1/3]

template<typename ConcreteType, template< typename T > class... Traits>
mlir::Op< ConcreteType, Traits >::Op ( )
inlineexplicit

This is a public constructor. Any op can be initialized to null.

◆ Op() [2/3]

template<typename ConcreteType, template< typename T > class... Traits>
mlir::Op< ConcreteType, Traits >::Op ( std::nullptr_t  )
inline

◆ Op() [3/3]

template<typename ConcreteType, template< typename T > class... Traits>
mlir::Op< ConcreteType, Traits >::Op ( Operation state)
inlineexplicit

This is a public constructor to enable access via the llvm::cast family of methods. This should not be used directly.

Member Function Documentation

◆ classof()

template<typename ConcreteType, template< typename T > class... Traits>
static bool mlir::Op< ConcreteType, Traits >::classof ( Operation op)
inlinestatic

Return true if this "op class" can match against the specified operation.

◆ clone()

template<typename ConcreteType, template< typename T > class... Traits>
ConcreteType mlir::Op< ConcreteType, Traits >::clone ( )
inline

Create a deep copy of this operation.

◆ cloneWithoutRegions()

template<typename ConcreteType, template< typename T > class... Traits>
ConcreteType mlir::Op< ConcreteType, Traits >::cloneWithoutRegions ( )
inline

Create a partial copy of this operation without traversing into attached regions. The new operation will have the same number of regions as the original one, but they will be left empty.

◆ getAsOpaquePointer()

template<typename ConcreteType, template< typename T > class... Traits>
const void* mlir::Op< ConcreteType, Traits >::getAsOpaquePointer ( ) const
inline

Methods for supporting PointerLikeTypeTraits.

◆ getDialect()

template<typename ConcreteType, template< typename T > class... Traits>
Dialect* mlir::Op< ConcreteType, Traits >::getDialect ( )
inline

Return the dialect that this refers to.

◆ getFromOpaquePointer()

template<typename ConcreteType, template< typename T > class... Traits>
static ConcreteOpType mlir::Op< ConcreteType, Traits >::getFromOpaquePointer ( const void *  pointer)
inlinestatic

◆ getOperation()

template<typename ConcreteType, template< typename T > class... Traits>
Operation* mlir::Op< ConcreteType, Traits >::getOperation ( )
inline

Return the operation that this refers to.

◆ getOperationProperties()

template<typename ConcreteType, template< typename T > class... Traits>
static AbstractOperation::OperationProperties mlir::Op< ConcreteType, Traits >::getOperationProperties ( )
inlinestatic

◆ getParentRegion()

template<typename ConcreteType, template< typename T > class... Traits>
Region* mlir::Op< ConcreteType, Traits >::getParentRegion ( )
inline

Return the parent Region of this operation.

◆ hasTrait()

template<typename ConcreteType, template< typename T > class... Traits>
template<template< typename T > class Trait>
static constexpr bool mlir::Op< ConcreteType, Traits >::hasTrait ( )
inlinestatic

Return if this operation contains the provided trait.

◆ parseAssembly()

template<typename ConcreteType, template< typename T > class... Traits>
static ParseResult mlir::Op< ConcreteType, Traits >::parseAssembly ( OpAsmParser parser,
OperationState result 
)
inlinestatic

This is the hook used by the AsmParser to parse the custom form of this op from an .mlir file. Op implementations should provide a parse method, which returns failure. On success, they should return fill in result with the fields to use.

◆ printAssembly()

template<typename ConcreteType, template< typename T > class... Traits>
static void mlir::Op< ConcreteType, Traits >::printAssembly ( Operation op,
OpAsmPrinter p 
)
inlinestatic

This is the hook used by the AsmPrinter to emit this to the .mlir file. Op implementations should provide a print method.

◆ verifyInvariants()

template<typename ConcreteType, template< typename T > class... Traits>
static LogicalResult mlir::Op< ConcreteType, Traits >::verifyInvariants ( Operation op)
inlinestatic

This is the hook that checks whether or not this operation is well formed according to the invariants of its opcode. It delegates to the Traits for their policy implementations, and allows the user to specify their own verify() method.

On success this returns false; on failure it emits an error to the diagnostic subsystem and returns true.


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