MLIR 22.0.0git
mlir::ConvertOpToLLVMPattern< SourceOp > Class Template Reference

Utility class for operation conversions targeting the LLVM dialect that match exactly one source operation. More...

#include "mlir/Conversion/LLVMCommon/Pattern.h"

Inheritance diagram for mlir::ConvertOpToLLVMPattern< SourceOp >:

Public Types

using OpAdaptor = typename SourceOp::Adaptor
using OneToNOpAdaptor

Public Member Functions

 ConvertOpToLLVMPattern (const LLVMTypeConverter &typeConverter, PatternBenefit benefit=1)
LogicalResult matchAndRewrite (Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const final
 Wrappers around the RewritePattern methods that pass the derived op type.
LogicalResult matchAndRewrite (Operation *op, ArrayRef< ValueRange > operands, ConversionPatternRewriter &rewriter) const final
virtual LogicalResult matchAndRewrite (SourceOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const
 Methods that operate on the SourceOp type.
virtual LogicalResult matchAndRewrite (SourceOp op, OneToNOpAdaptor adaptor, ConversionPatternRewriter &rewriter) const
Public Member Functions inherited from mlir::ConvertToLLVMPattern
 ConvertToLLVMPattern (StringRef rootOpName, MLIRContext *context, const LLVMTypeConverter &typeConverter, PatternBenefit benefit=1)

Additional Inherited Members

Protected Member Functions inherited from mlir::ConvertToLLVMPattern
LLVM::LLVMDialect & getDialect () const
 Returns the LLVM dialect.
const LLVMTypeConvertergetTypeConverter () const
Type getIndexType () const
 Gets the MLIR type wrapping the LLVM integer type whose bit width is defined by the used type converter.
Type getIntPtrType (unsigned addressSpace=0) const
 Gets the MLIR type wrapping the LLVM integer type whose bit width corresponds to that of a LLVM pointer type.
Type getVoidType () const
 Gets the MLIR type wrapping the LLVM void type.
Type getVoidPtrType () const
 Get the MLIR type wrapping the LLVM i8* type.
Type getPtrType (unsigned addressSpace=0) const
 Get the MLIR type wrapping the LLVM ptr type.
Value getStridedElementPtr (ConversionPatternRewriter &rewriter, Location loc, MemRefType type, Value memRefDesc, ValueRange indices, LLVM::GEPNoWrapFlags noWrapFlags=LLVM::GEPNoWrapFlags::none) const
 Convenience wrapper for the corresponding helper utility.
bool isConvertibleAndHasIdentityMaps (MemRefType type) const
 Returns if the given memref type is convertible to LLVM and has an identity layout map.
Type getElementPtrType (MemRefType type) const
 Returns the type of a pointer to an element of the memref.
void getMemRefDescriptorSizes (Location loc, MemRefType memRefType, ValueRange dynamicSizes, ConversionPatternRewriter &rewriter, SmallVectorImpl< Value > &sizes, SmallVectorImpl< Value > &strides, Value &size, bool sizeInBytes=true) const
 Computes sizes, strides and buffer size of memRefType with identity layout.
Value getSizeInBytes (Location loc, Type type, ConversionPatternRewriter &rewriter) const
 Computes the size of type in bytes.
Value getNumElements (Location loc, MemRefType memRefType, ValueRange dynamicSizes, ConversionPatternRewriter &rewriter) const
 Computes total number of elements for the given MemRef and dynamicSizes.
MemRefDescriptor createMemRefDescriptor (Location loc, MemRefType memRefType, Value allocatedPtr, Value alignedPtr, ArrayRef< Value > sizes, ArrayRef< Value > strides, ConversionPatternRewriter &rewriter) const
 Creates and populates a canonical memref descriptor struct.
Value copyUnrankedDescriptor (OpBuilder &builder, Location loc, UnrankedMemRefType memRefType, Value operand, bool toDynamic) const
 Copies the given unranked memory descriptor to heap-allocated memory (if toDynamic is true) or to stack-allocated memory (otherwise) and returns the new descriptor.
LogicalResult copyUnrankedDescriptors (OpBuilder &builder, Location loc, TypeRange origTypes, SmallVectorImpl< Value > &operands, bool toDynamic) const
 Copies the memory descriptor for any operands that were unranked descriptors originally to heap-allocated memory (if toDynamic is true) or to stack-allocated memory (otherwise).
Static Protected Member Functions inherited from mlir::ConvertToLLVMPattern
static Value createIndexAttrConstant (OpBuilder &builder, Location loc, Type resultType, int64_t value)
 Create a constant Op producing a value of resultType from an index-typed integer attribute.

Detailed Description

template<typename SourceOp>
class mlir::ConvertOpToLLVMPattern< SourceOp >

Utility class for operation conversions targeting the LLVM dialect that match exactly one source operation.

Definition at line 207 of file Pattern.h.

Member Typedef Documentation

◆ OneToNOpAdaptor

template<typename SourceOp>
using mlir::ConvertOpToLLVMPattern< SourceOp >::OneToNOpAdaptor
Initial value:
typename SourceOp::template GenericAdaptor<ArrayRef<ValueRange>>

Definition at line 210 of file Pattern.h.

◆ OpAdaptor

template<typename SourceOp>
using mlir::ConvertOpToLLVMPattern< SourceOp >::OpAdaptor = typename SourceOp::Adaptor

Definition at line 209 of file Pattern.h.

Constructor & Destructor Documentation

◆ ConvertOpToLLVMPattern()

template<typename SourceOp>
mlir::ConvertOpToLLVMPattern< SourceOp >::ConvertOpToLLVMPattern ( const LLVMTypeConverter & typeConverter,
PatternBenefit benefit = 1 )
inlineexplicit

Member Function Documentation

◆ matchAndRewrite() [1/4]

template<typename SourceOp>
LogicalResult mlir::ConvertOpToLLVMPattern< SourceOp >::matchAndRewrite ( Operation * op,
ArrayRef< Value > operands,
ConversionPatternRewriter & rewriter ) const
inlinefinal

Wrappers around the RewritePattern methods that pass the derived op type.

Definition at line 221 of file Pattern.h.

Referenced by mlir::OneToNOpAdaptor< SelectOp >::matchAndRewrite(), and mlir::OneToNOpAdaptor< SelectOp >::matchAndRewrite().

◆ matchAndRewrite() [2/4]

template<typename SourceOp>
LogicalResult mlir::ConvertOpToLLVMPattern< SourceOp >::matchAndRewrite ( Operation * op,
ArrayRef< ValueRange > operands,
ConversionPatternRewriter & rewriter ) const
inlinefinal

Definition at line 227 of file Pattern.h.

◆ matchAndRewrite() [3/4]

template<typename SourceOp>
virtual LogicalResult mlir::ConvertOpToLLVMPattern< SourceOp >::matchAndRewrite ( SourceOp op,
OneToNOpAdaptor adaptor,
ConversionPatternRewriter & rewriter ) const
inlinevirtual

Definition at line 242 of file Pattern.h.

◆ matchAndRewrite() [4/4]

template<typename SourceOp>
virtual LogicalResult mlir::ConvertOpToLLVMPattern< SourceOp >::matchAndRewrite ( SourceOp op,
OpAdaptor adaptor,
ConversionPatternRewriter & rewriter ) const
inlinevirtual

Methods that operate on the SourceOp type.

One of these must be overridden by the derived pattern class.

Reimplemented in mlir::OneToOneConvertToLLVMPattern< SourceOp, TargetOp >, mlir::OpToFuncCallLowering< SourceOp >, mlir::ScalarizeVectorOpLowering< SourceOp >, and mlir::VectorConvertToLLVMPattern< SourceOp, TargetOp, AttrConvert, FailOnUnsupportedFP >.

Definition at line 237 of file Pattern.h.


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