9 #ifndef MLIR_CONVERSION_LLVMCOMMON_PATTERN_H 10 #define MLIR_CONVERSION_LLVMCOMMON_PATTERN_H 42 LLVM::LLVMDialect &getDialect()
const;
48 Type getIndexType()
const;
52 Type getIntPtrType(
unsigned addressSpace = 0)
const;
55 Type getVoidType()
const;
58 Type getVoidPtrType()
const;
67 uint64_t value)
const;
77 bool isConvertibleAndHasIdentityMaps(MemRefType type)
const;
97 void getMemRefDescriptorSizes(
Location loc, MemRefType memRefType,
102 Value &sizeBytes)
const;
114 createMemRefDescriptor(
Location loc, MemRefType memRefType,
126 bool toDynamic)
const;
131 template <
typename SourceOp>
139 &typeConverter.getContext(), typeConverter,
149 return match(cast<SourceOp>(op));
154 return matchAndRewrite(cast<SourceOp>(op),
155 OpAdaptor(operands, op->getAttrDictionary()),
162 llvm_unreachable(
"must override match or matchAndRewrite");
166 llvm_unreachable(
"must override rewrite or matchAndRewrite");
173 rewrite(op, adaptor, rewriter);
187 template <
typename SourceOp,
typename TargetOp>
199 adaptor.getOperands(),
200 *this->getTypeConverter(), rewriter);
206 #endif // MLIR_CONVERSION_LLVMCOMMON_PATTERN_H Include the generated interface declarations.
Utility class for operation conversions targeting the LLVM dialect that match exactly one source oper...
void rewrite(Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const final
Wrappers around the RewritePattern methods that pass the derived op type.
virtual LogicalResult match(SourceOp op) const
Rewrite and Match methods that operate on the SourceOp type.
typename cf::AssertOp ::Adaptor OpAdaptor
Operation is a basic unit of execution within MLIR.
Generic implementation of one-to-one conversion from "SourceOp" to "TargetOp" where the latter belong...
ConvertOpToLLVMPattern(LLVMTypeConverter &typeConverter, PatternBenefit benefit=1)
Base class for the conversion patterns.
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value...
static Value createIndexAttrConstant(OpBuilder &builder, Location loc, Type resultType, int64_t value)
LogicalResult matchAndRewrite(SourceOp op, typename SourceOp::Adaptor adaptor, ConversionPatternRewriter &rewriter) const override
Converts the type of the result to an LLVM type, pass operands as is, preserve attributes.
virtual LogicalResult match(Operation *op) const
Attempt to match against code rooted at the specified operation, which is the same operation code as ...
static constexpr const bool value
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
This class represents an efficient way to signal success or failure.
LogicalResult failure(bool isFailure=true)
Utility function to generate a LogicalResult.
virtual void rewrite(SourceOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const
Helper class to produce LLVM dialect operations extracting or inserting elements of a MemRef descript...
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
static llvm::Value * getSizeInBytes(llvm::IRBuilderBase &builder, llvm::Value *basePtr)
Computes the size of type in bytes.
This class provides an abstraction over the various different ranges of value types.
static void rewrite(SCCPAnalysis &analysis, MLIRContext *context, MutableArrayRef< Region > initialRegions)
Rewrite the given regions using the computing analysis.
static Type getElementPtrType(Type type, ValueRange indices, Location baseLoc)
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
virtual LogicalResult matchAndRewrite(SourceOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const
virtual LogicalResult matchAndRewrite(Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const
Hook for derived classes to implement combined matching and rewriting.
static int64_t getNumElements(ShapedType type)
Conversion from types to the LLVM IR dialect.
MLIRContext is the top-level object for a collection of MLIR operations.
This class implements a pattern rewriter for use with ConversionPatterns.
LogicalResult match(Operation *op) const final
Attempt to match against code rooted at the specified operation, which is the same operation code as ...
LogicalResult oneToOneRewrite(Operation *op, StringRef targetOp, ValueRange operands, LLVMTypeConverter &typeConverter, ConversionPatternRewriter &rewriter)
Replaces the given operation "op" with a new operation of type "targetOp" and given operands...
Base class for operation conversions targeting the LLVM IR dialect.
LogicalResult matchAndRewrite(Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const final
Hook for derived classes to implement combined matching and rewriting.
This class helps build Operations.
This class provides an abstraction over the different types of ranges over Values.