MLIR  20.0.0git
Classes | Namespaces | Typedefs | Functions
OpDefinition.h File Reference
#include "mlir/IR/Dialect.h"
#include "mlir/IR/ODSSupport.h"
#include "mlir/IR/Operation.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
#include <optional>
#include <type_traits>

Go to the source code of this file.

Classes

class  mlir::OptionalParseResult
 This class implements Optional functionality for ParseResult. More...
 
struct  mlir::EmptyProperties
 Structure used by default as a "marker" when no "Properties" are set on an Operation. More...
 
struct  mlir::PropertiesSelector< Op, class >
 Traits to detect whether an Operation defined a Properties type, otherwise it'll default to EmptyProperties. More...
 
struct  mlir::PropertiesSelector< Op, std::void_t< typename Op::Properties > >
 
class  mlir::OpState
 This is the concrete base class that holds the operation pointer and has non-generic methods that only depend on State (to avoid having them instantiated on template types that don't affect them. More...
 
class  mlir::OpFoldResult
 This class represents a single result from folding an operation. More...
 
struct  llvm::CastInfo< To, mlir::OpFoldResult >
 
struct  llvm::CastInfo< To, const mlir::OpFoldResult >
 
class  mlir::OpTrait::TraitBase< ConcreteType, TraitType >
 Helper class for implementing traits. More...
 
struct  mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >
 Utility trait base that provides accessors for derived traits that have multiple operands. More...
 
class  mlir::OpTrait::OpInvariants< ConcreteType >
 verifyInvariantsImpl verifies the invariants like the types, attrs, .etc. More...
 
class  mlir::OpTrait::ZeroOperands< ConcreteType >
 This class provides the API for ops that are known to have no SSA operand. More...
 
class  mlir::OpTrait::OneOperand< ConcreteType >
 This class provides the API for ops that are known to have exactly one SSA operand. More...
 
class  mlir::OpTrait::NOperands< N >
 This class provides the API for ops that are known to have a specified number of operands. More...
 
class  mlir::OpTrait::NOperands< N >::Impl< ConcreteType >
 
class  mlir::OpTrait::AtLeastNOperands< N >
 This class provides the API for ops that are known to have a at least a specified number of operands. More...
 
class  mlir::OpTrait::AtLeastNOperands< N >::Impl< ConcreteType >
 
class  mlir::OpTrait::VariadicOperands< ConcreteType >
 This class provides the API for ops which have an unknown number of SSA operands. More...
 
class  mlir::OpTrait::ZeroRegions< ConcreteType >
 This class provides verification for ops that are known to have zero regions. More...
 
struct  mlir::OpTrait::detail::MultiRegionTraitBase< ConcreteType, TraitType >
 Utility trait base that provides accessors for derived traits that have multiple regions. More...
 
class  mlir::OpTrait::OneRegion< ConcreteType >
 This class provides APIs for ops that are known to have a single region. More...
 
class  mlir::OpTrait::NRegions< N >
 This class provides the API for ops that are known to have a specified number of regions. More...
 
class  mlir::OpTrait::NRegions< N >::Impl< ConcreteType >
 
class  mlir::OpTrait::AtLeastNRegions< N >
 This class provides APIs for ops that are known to have at least a specified number of regions. More...
 
class  mlir::OpTrait::AtLeastNRegions< N >::Impl< ConcreteType >
 
class  mlir::OpTrait::VariadicRegions< ConcreteType >
 This class provides the API for ops which have an unknown number of regions. More...
 
class  mlir::OpTrait::ZeroResults< ConcreteType >
 This class provides return value APIs for ops that are known to have zero results. More...
 
struct  mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >
 Utility trait base that provides accessors for derived traits that have multiple results. More...
 
class  mlir::OpTrait::OneResult< ConcreteType >
 This class provides return value APIs for ops that are known to have a single result. More...
 
class  mlir::OpTrait::OneTypedResult< ResultType >
 This trait is used for return value APIs for ops that are known to have a specific type other than Type. More...
 
class  mlir::OpTrait::OneTypedResult< ResultType >::Impl< ConcreteType >
 This class provides return value APIs for ops that are known to have a single result. More...
 
class  mlir::OpTrait::NResults< N >
 This class provides the API for ops that are known to have a specified number of results. More...
 
class  mlir::OpTrait::NResults< N >::Impl< ConcreteType >
 
class  mlir::OpTrait::AtLeastNResults< N >
 This class provides the API for ops that are known to have at least a specified number of results. More...
 
class  mlir::OpTrait::AtLeastNResults< N >::Impl< ConcreteType >
 
class  mlir::OpTrait::VariadicResults< ConcreteType >
 This class provides the API for ops which have an unknown number of results. More...
 
class  mlir::OpTrait::NoTerminator< ConcreteType >
 This class indicates that the regions associated with this op don't have terminators. More...
 
class  mlir::OpTrait::IsTerminator< ConcreteType >
 This class provides the API for ops that are known to be terminators. More...
 
class  mlir::OpTrait::ZeroSuccessors< ConcreteType >
 This class provides verification for ops that are known to have zero successors. More...
 
struct  mlir::OpTrait::detail::MultiSuccessorTraitBase< ConcreteType, TraitType >
 Utility trait base that provides accessors for derived traits that have multiple successors. More...
 
class  mlir::OpTrait::OneSuccessor< ConcreteType >
 This class provides APIs for ops that are known to have a single successor. More...
 
class  mlir::OpTrait::NSuccessors< N >
 This class provides the API for ops that are known to have a specified number of successors. More...
 
class  mlir::OpTrait::NSuccessors< N >::Impl< ConcreteType >
 
class  mlir::OpTrait::AtLeastNSuccessors< N >
 This class provides APIs for ops that are known to have at least a specified number of successors. More...
 
class  mlir::OpTrait::AtLeastNSuccessors< N >::Impl< ConcreteType >
 
class  mlir::OpTrait::VariadicSuccessors< ConcreteType >
 This class provides the API for ops which have an unknown number of successors. More...
 
struct  mlir::OpTrait::SingleBlock< ConcreteType >
 This class provides APIs and verifiers for ops with regions having a single block. More...
 
struct  mlir::OpTrait::SingleBlockImplicitTerminator< TerminatorOpType >
 This class provides APIs and verifiers for ops with regions having a single block that must terminate with TerminatorOpType. More...
 
class  mlir::OpTrait::SingleBlockImplicitTerminator< TerminatorOpType >::Impl< ConcreteType >
 
struct  mlir::OpTrait::hasSingleBlockImplicitTerminator< Op, hasTerminator >
 Support to check if an operation has the SingleBlockImplicitTerminator trait. More...
 
struct  mlir::OpTrait::hasSingleBlockImplicitTerminator< Op, false >
 
class  mlir::OpTrait::SameOperandsShape< ConcreteType >
 This class provides verification for ops that are known to have the same operand shape: all operands are scalars, vectors/tensors of the same shape. More...
 
class  mlir::OpTrait::SameOperandsAndResultShape< ConcreteType >
 This class provides verification for ops that are known to have the same operand and result shape: both are scalars, vectors/tensors of the same shape. More...
 
class  mlir::OpTrait::SameOperandsElementType< ConcreteType >
 This class provides verification for ops that are known to have the same operand element type (or the type itself if it is scalar). More...
 
class  mlir::OpTrait::SameOperandsAndResultElementType< ConcreteType >
 This class provides verification for ops that are known to have the same operand and result element type (or the type itself if it is scalar). More...
 
class  mlir::OpTrait::SameOperandsAndResultType< ConcreteType >
 This class provides verification for ops that are known to have the same operand and result type. More...
 
class  mlir::OpTrait::SameOperandsAndResultRank< ConcreteType >
 This class verifies that op has same ranks for all operands and results types, if known. More...
 
class  mlir::OpTrait::ResultsAreBoolLike< ConcreteType >
 This class verifies that any results of the specified op have a boolean type, a vector thereof, or a tensor thereof. More...
 
class  mlir::OpTrait::ResultsAreFloatLike< ConcreteType >
 This class verifies that any results of the specified op have a floating point type, a vector thereof, or a tensor thereof. More...
 
class  mlir::OpTrait::ResultsAreSignlessIntegerLike< ConcreteType >
 This class verifies that any results of the specified op have a signless integer or index type, a vector thereof, or a tensor thereof. More...
 
class  mlir::OpTrait::IsCommutative< ConcreteType >
 This class adds property that the operation is commutative. More...
 
class  mlir::OpTrait::IsInvolution< ConcreteType >
 This class adds property that the operation is an involution. More...
 
class  mlir::OpTrait::IsIdempotent< ConcreteType >
 This class adds property that the operation is idempotent. More...
 
class  mlir::OpTrait::OperandsAreFloatLike< ConcreteType >
 This class verifies that all operands of the specified op have a float type, a vector thereof, or a tensor thereof. More...
 
class  mlir::OpTrait::OperandsAreSignlessIntegerLike< ConcreteType >
 This class verifies that all operands of the specified op have a signless integer or index type, a vector thereof, or a tensor thereof. More...
 
class  mlir::OpTrait::SameTypeOperands< ConcreteType >
 This class verifies that all operands of the specified op have the same type. More...
 
class  mlir::OpTrait::ConstantLike< ConcreteType >
 This class provides the API for a sub-set of ops that are known to be constant-like. More...
 
class  mlir::OpTrait::IsIsolatedFromAbove< ConcreteType >
 This class provides the API for ops that are known to be isolated from above. More...
 
class  mlir::OpTrait::AffineScope< ConcreteType >
 A trait of region holding operations that defines a new scope for polyhedral optimization purposes. More...
 
class  mlir::OpTrait::AutomaticAllocationScope< ConcreteType >
 A trait of region holding operations that define a new scope for automatic allocations, i.e., allocations that are freed when control is transferred back from the operation's region. More...
 
struct  mlir::OpTrait::HasParent< ParentOpTypes >
 This class provides a verifier for ops that are expecting their parent to be one of the given parent ops. More...
 
class  mlir::OpTrait::HasParent< ParentOpTypes >::Impl< ConcreteType >
 
class  mlir::OpTrait::AttrSizedOperandSegments< ConcreteType >
 A trait for operations that have an attribute specifying operand segments. More...
 
class  mlir::OpTrait::AttrSizedResultSegments< ConcreteType >
 Similar to AttrSizedOperandSegments but used for results. More...
 
struct  mlir::OpTrait::NoRegionArguments< ConcrentType >
 This trait provides a verifier for ops that are expecting their regions to not have any arguments. More...
 
struct  mlir::OpTrait::MemRefsNormalizable< ConcrentType >
 
struct  mlir::OpTrait::Elementwise< ConcreteType >
 This trait tags element-wise ops on vectors or tensors. More...
 
struct  mlir::OpTrait::Scalarizable< ConcreteType >
 This trait tags Elementwise operatons that can be systematically scalarized. More...
 
struct  mlir::OpTrait::Vectorizable< ConcreteType >
 This trait tags Elementwise operatons that can be systematically vectorized. More...
 
struct  mlir::OpTrait::Tensorizable< ConcreteType >
 This trait tags Elementwise operatons that can be systematically tensorized. More...
 
class  mlir::Op< ConcreteType, Traits >
 This provides public APIs that all operations should have. More...
 
class  mlir::OpInterface< ConcreteType, Traits >
 This class represents the base of an operation interface. More...
 
struct  llvm::DenseMapInfo< T, std::enable_if_t< std::is_base_of< mlir::OpState, T >::value &&!mlir::detail::IsInterface< T >::value > >
 

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::impl
 Attribute collections provide a dictionary-like interface.
 
 llvm
 The OpAsmOpInterface, see OpAsmInterface.td for more details.
 
 mlir::OpTrait
 
 mlir::OpTrait::impl
 
 mlir::OpTrait::detail
 
 mlir::op_definition_impl
 

Typedefs

template<class T >
using mlir::OpTrait::has_implicit_terminator_t = typename T::ImplicitTerminatorOpT
 Check is an op defines the ImplicitTerminatorOpT member. More...
 
template<typename T , typename... Args>
using mlir::op_definition_impl::has_single_result_fold_trait = decltype(T::foldTrait(std::declval< Operation * >(), std::declval< ArrayRef< Attribute > >()))
 Trait to check if T provides a 'foldTrait' method for single result operations. More...
 
template<typename T >
using mlir::op_definition_impl::detect_has_single_result_fold_trait = llvm::is_detected< has_single_result_fold_trait, T >
 
template<typename T , typename... Args>
using mlir::op_definition_impl::has_fold_trait = decltype(T::foldTrait(std::declval< Operation * >(), std::declval< ArrayRef< Attribute > >(), std::declval< SmallVectorImpl< OpFoldResult > & >()))
 Trait to check if T provides a general 'foldTrait' method. More...
 
template<typename T >
using mlir::op_definition_impl::detect_has_fold_trait = llvm::is_detected< has_fold_trait, T >
 
template<typename T >
using mlir::op_definition_impl::detect_has_any_fold_trait = std::disjunction< detect_has_fold_trait< T >, detect_has_single_result_fold_trait< T > >
 Trait to check if T provides any foldTrait method. More...
 
template<typename T , typename... Args>
using mlir::op_definition_impl::has_verify_trait = decltype(T::verifyTrait(std::declval< Operation * >()))
 Trait to check if T provides a verifyTrait method. More...
 
template<typename T >
using mlir::op_definition_impl::detect_has_verify_trait = llvm::is_detected< has_verify_trait, T >
 
template<typename T , typename... Args>
using mlir::op_definition_impl::has_verify_region_trait = decltype(T::verifyRegionTrait(std::declval< Operation * >()))
 Trait to check if T provides a verifyTrait method. More...
 
template<typename T >
using mlir::op_definition_impl::detect_has_verify_region_trait = llvm::is_detected< has_verify_region_trait, T >
 

Functions

void mlir::impl::ensureRegionTerminator (Region &region, OpBuilder &builder, Location loc, function_ref< Operation *(OpBuilder &, Location)> buildTerminatorOp)
 Insert an operation, generated by buildTerminatorOp, at the end of the region's only block if it does not have a terminator already. More...
 
void mlir::impl::ensureRegionTerminator (Region &region, Builder &builder, Location loc, function_ref< Operation *(OpBuilder &, Location)> buildTerminatorOp)
 Create a simple OpBuilder and forward to the OpBuilder version of this function. More...
 
bool mlir::operator== (OpState lhs, OpState rhs)
 
bool mlir::operator!= (OpState lhs, OpState rhs)
 
raw_ostream & mlir::operator<< (raw_ostream &os, OpFoldResult ofr)
 Allow printing to a stream. More...
 
raw_ostream & mlir::operator<< (raw_ostream &os, OpState op)
 Allow printing to a stream. More...
 
LogicalResult mlir::OpTrait::impl::foldCommutative (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)
 
OpFoldResult mlir::OpTrait::impl::foldIdempotent (Operation *op)
 
OpFoldResult mlir::OpTrait::impl::foldInvolution (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyZeroOperands (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyOneOperand (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyNOperands (Operation *op, unsigned numOperands)
 
LogicalResult mlir::OpTrait::impl::verifyIsIdempotent (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyIsInvolution (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyAtLeastNOperands (Operation *op, unsigned numOperands)
 
LogicalResult mlir::OpTrait::impl::verifyOperandsAreFloatLike (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyOperandsAreSignlessIntegerLike (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifySameTypeOperands (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyZeroRegions (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyOneRegion (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyNRegions (Operation *op, unsigned numRegions)
 
LogicalResult mlir::OpTrait::impl::verifyAtLeastNRegions (Operation *op, unsigned numRegions)
 
LogicalResult mlir::OpTrait::impl::verifyZeroResults (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyOneResult (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyNResults (Operation *op, unsigned numOperands)
 
LogicalResult mlir::OpTrait::impl::verifyAtLeastNResults (Operation *op, unsigned numOperands)
 
LogicalResult mlir::OpTrait::impl::verifySameOperandsShape (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifySameOperandsAndResultShape (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifySameOperandsElementType (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifySameOperandsAndResultElementType (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifySameOperandsAndResultType (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifySameOperandsAndResultRank (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyResultsAreBoolLike (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyResultsAreFloatLike (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyResultsAreSignlessIntegerLike (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyIsTerminator (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyZeroSuccessors (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyOneSuccessor (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyNSuccessors (Operation *op, unsigned numSuccessors)
 
LogicalResult mlir::OpTrait::impl::verifyAtLeastNSuccessors (Operation *op, unsigned numSuccessors)
 
LogicalResult mlir::OpTrait::impl::verifyValueSizeAttr (Operation *op, StringRef attrName, StringRef valueGroupName, size_t expectedCount)
 
LogicalResult mlir::OpTrait::impl::verifyOperandSizeAttr (Operation *op, StringRef sizeAttrName)
 
LogicalResult mlir::OpTrait::impl::verifyResultSizeAttr (Operation *op, StringRef sizeAttrName)
 
LogicalResult mlir::OpTrait::impl::verifyNoRegionArguments (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyElementwise (Operation *op)
 
LogicalResult mlir::OpTrait::impl::verifyIsIsolatedFromAbove (Operation *op)
 Check for any values used by operations regions attached to the specified "IsIsolatedFromAbove" operation defined outside of it. More...
 
bool mlir::OpTrait::hasElementwiseMappableTraits (Operation *op)
 Together, Elementwise, Scalarizable, Vectorizable, and Tensorizable provide an easy way for scalar operations to conveniently generalize their behavior to vectors/tensors, and systematize conversion between these forms. More...
 
template<template< typename T > class... Traits>
bool mlir::op_definition_impl::hasTrait (TypeID traitID)
 Returns true if this given Trait ID matches the IDs of any of the provided trait types Traits. More...
 
template<>
bool mlir::op_definition_impl::hasTrait (TypeID traitID)
 
template<typename Trait >
static std::enable_if_t< detect_has_single_result_fold_trait< Trait >::value, LogicalResult > mlir::op_definition_impl::foldTrait (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)
 Returns the result of folding a trait that implements a foldTrait function that is specialized for operations that have a single result. More...
 
template<typename Trait >
static std::enable_if_t< detect_has_fold_trait< Trait >::value, LogicalResult > mlir::op_definition_impl::foldTrait (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)
 Returns the result of folding a trait that implements a generalized foldTrait function that is supports any operation type. More...
 
template<typename Trait >
static std::enable_if_t<!detect_has_any_fold_trait< Trait >::value, LogicalResult > mlir::op_definition_impl::foldTrait (Operation *, ArrayRef< Attribute >, SmallVectorImpl< OpFoldResult > &)
 
template<typename... Ts>
static LogicalResult mlir::op_definition_impl::foldTraits (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)
 Given a tuple type containing a set of traits, return the result of folding the given operation. More...
 
template<typename T >
std::enable_if_t< detect_has_verify_trait< T >::value, LogicalResult > mlir::op_definition_impl::verifyTrait (Operation *op)
 Verify the given trait if it provides a verifier. More...
 
template<typename T >
std::enable_if_t<!detect_has_verify_trait< T >::value, LogicalResult > mlir::op_definition_impl::verifyTrait (Operation *)
 
template<typename... Ts>
LogicalResult mlir::op_definition_impl::verifyTraits (Operation *op)
 Given a set of traits, return the result of verifying the given operation. More...
 
template<typename T >
std::enable_if_t< detect_has_verify_region_trait< T >::value, LogicalResult > mlir::op_definition_impl::verifyRegionTrait (Operation *op)
 Verify the given trait if it provides a region verifier. More...
 
template<typename T >
std::enable_if_t<!detect_has_verify_region_trait< T >::value, LogicalResult > mlir::op_definition_impl::verifyRegionTrait (Operation *)
 
template<typename... Ts>
LogicalResult mlir::op_definition_impl::verifyRegionTraits (Operation *op)
 Given a set of traits, return the result of verifying the regions of the given operation. More...