13 #ifndef MLIR_TRANSFORMS_DIALECTCONVERSION_H_
14 #define MLIR_TRANSFORMS_DIALECTCONVERSION_H_
17 #include "llvm/ADT/MapVector.h"
18 #include "llvm/ADT/StringMap.h"
19 #include <type_traits>
26 class ConversionPatternRewriter;
45 : remappedInputs(numOrigInputs) {}
59 return remappedInputs[input];
81 void remapInput(
unsigned origInputNo,
unsigned newInputNo,
82 unsigned newInputCount = 1);
111 llvm::PointerIntPair<Attribute, 2>
impl;
114 static constexpr
unsigned naTag = 0;
115 static constexpr
unsigned resultTag = 1;
116 static constexpr
unsigned abortTag = 2;
144 template <
typename FnT,
typename T =
typename llvm::function_traits<
145 std::decay_t<FnT>>::template arg_t<0>>
147 registerConversion(wrapCallback<T>(std::forward<FnT>(callback)));
164 template <
typename FnT,
typename T =
typename llvm::function_traits<
165 std::decay_t<FnT>>::template arg_t<1>>
167 argumentMaterializations.emplace_back(
168 wrapMaterialization<T>(std::forward<FnT>(callback)));
173 template <
typename FnT,
typename T =
typename llvm::function_traits<
174 std::decay_t<FnT>>::template arg_t<1>>
176 sourceMaterializations.emplace_back(
177 wrapMaterialization<T>(std::forward<FnT>(callback)));
181 template <
typename FnT,
typename T =
typename llvm::function_traits<
182 std::decay_t<FnT>>::template arg_t<1>>
184 targetMaterializations.emplace_back(
185 wrapMaterialization<T>(std::forward<FnT>(callback)));
208 typename llvm::function_traits<std::decay_t<FnT>>::template arg_t<0>,
210 typename llvm::function_traits<std::decay_t<FnT>>::template arg_t<1>>
212 registerTypeAttributeConversion(
213 wrapTypeAttributeConversion<T, A>(std::forward<FnT>(callback)));
235 template <
typename RangeT>
236 std::enable_if_t<!std::is_convertible<RangeT, Type>::value &&
237 !std::is_convertible<RangeT, Operation *>::value,
240 return llvm::all_of(range, [
this](
Type type) {
return isLegal(type); });
256 SignatureConversion &result);
258 SignatureConversion &result,
259 unsigned origInputOffset = 0);
272 return materializeConversion(argumentMaterializations, builder, loc,
277 return materializeConversion(sourceMaterializations, builder, loc,
282 return materializeConversion(targetMaterializations, builder, loc,
296 using ConversionCallbackFn = std::function<std::optional<LogicalResult>(
300 using MaterializationCallbackFn = std::function<std::optional<Value>(
304 using TypeAttributeConversionCallbackFn =
309 Value materializeConversion(
316 template <
typename T,
typename FnT>
317 std::enable_if_t<std::is_invocable_v<FnT, T>, ConversionCallbackFn>
318 wrapCallback(FnT &&callback) {
319 return wrapCallback<T>(
320 [callback = std::forward<FnT>(callback)](
322 if (std::optional<Type> resultOpt = callback(type)) {
323 bool wasSuccess =
static_cast<bool>(*resultOpt);
325 results.push_back(*resultOpt);
326 return std::optional<LogicalResult>(
success(wasSuccess));
328 return std::optional<LogicalResult>();
333 template <
typename T,
typename FnT>
334 std::enable_if_t<std::is_invocable_v<FnT, T, SmallVectorImpl<Type> &>,
335 ConversionCallbackFn>
336 wrapCallback(FnT &&callback) {
337 return wrapCallback<T>(
338 [callback = std::forward<FnT>(callback)](
339 T type, SmallVectorImpl<Type> &results, ArrayRef<Type>) {
340 return callback(type, results);
345 template <
typename T,
typename FnT>
347 std::is_invocable_v<FnT, T, SmallVectorImpl<Type> &, ArrayRef<Type>>,
348 ConversionCallbackFn>
349 wrapCallback(FnT &&callback) {
350 return [callback = std::forward<FnT>(callback)](
351 Type type, SmallVectorImpl<Type> &results,
352 ArrayRef<Type> callStack) -> std::optional<LogicalResult> {
353 T derivedType = type.dyn_cast<T>();
356 return callback(derivedType, results, callStack);
361 void registerConversion(ConversionCallbackFn callback) {
362 conversions.emplace_back(std::move(callback));
363 cachedDirectConversions.clear();
364 cachedMultiConversions.clear();
370 template <
typename T,
typename FnT>
371 MaterializationCallbackFn wrapMaterialization(FnT &&callback) {
372 return [callback = std::forward<FnT>(callback)](
373 OpBuilder &builder,
Type resultType, ValueRange inputs,
374 Location loc) -> std::optional<Value> {
375 if (T derivedType = resultType.dyn_cast<T>())
376 return callback(builder, derivedType, inputs, loc);
385 template <
typename T,
typename A,
typename FnT>
386 TypeAttributeConversionCallbackFn
387 wrapTypeAttributeConversion(FnT &&callback) {
388 return [callback = std::forward<FnT>(callback)](
389 Type type, Attribute attr) -> AttributeConversionResult {
390 if (T derivedType = type.dyn_cast<T>()) {
391 if (A derivedAttr = attr.dyn_cast_or_null<A>())
392 return callback(derivedType, derivedAttr);
400 registerTypeAttributeConversion(TypeAttributeConversionCallbackFn callback) {
401 typeAttributeConversions.emplace_back(std::move(callback));
403 cachedDirectConversions.clear();
404 cachedMultiConversions.clear();
408 SmallVector<ConversionCallbackFn, 4> conversions;
411 SmallVector<MaterializationCallbackFn, 2> argumentMaterializations;
412 SmallVector<MaterializationCallbackFn, 2> sourceMaterializations;
413 SmallVector<MaterializationCallbackFn, 2> targetMaterializations;
416 SmallVector<TypeAttributeConversionCallbackFn, 2> typeAttributeConversions;
421 DenseMap<Type, Type> cachedDirectConversions;
423 DenseMap<Type, SmallVector<Type, 2>> cachedMultiConversions;
427 SmallVector<Type, 2> conversionCallStack;
446 llvm_unreachable(
"unimplemented rewrite");
455 rewrite(op, operands, rewriter);
467 template <
typename ConverterTy>
468 std::enable_if_t<std::is_base_of<TypeConverter, ConverterTy>::value,
477 using RewritePattern::RewritePattern;
480 template <
typename... Args>
496 template <
typename SourceOp>
511 return match(cast<SourceOp>(op));
522 OpAdaptor(operands, op->getAttrDictionary()),
529 llvm_unreachable(
"must override match or matchAndRewrite");
533 llvm_unreachable(
"must override matchAndRewrite or a rewrite method");
540 rewrite(op, adaptor, rewriter);
551 template <
typename SourceOp>
556 SourceOp::getInterfaceID(), benefit, context) {}
560 SourceOp::getInterfaceID(), benefit, context) {}
566 rewrite(cast<SourceOp>(op), operands, rewriter);
578 llvm_unreachable(
"must override matchAndRewrite or a rewrite method");
585 rewrite(op, operands, rewriter);
597 StringRef functionLikeOpName, RewritePatternSet &patterns,
598 TypeConverter &converter);
600 template <
typename FuncOpT>
604 patterns, converter);
608 RewritePatternSet &patterns, TypeConverter &converter);
615 struct ConversionPatternRewriterImpl;
684 llvm::unique_function<
bool(
OpOperand &)
const> functor)
override;
707 ValueRange argValues = std::nullopt)
override;
751 std::unique_ptr<detail::ConversionPatternRewriterImpl>
impl;
787 std::function<std::optional<bool>(
Operation *)>;
798 template <
typename OpT>
807 template <
typename OpT>
811 template <
typename OpT,
typename OpT2,
typename... OpTs>
822 setLegalityCallback(op, callback);
824 template <
typename OpT>
829 template <
typename OpT,
typename OpT2,
typename... OpTs>
831 addDynamicallyLegalOp<OpT>(callback);
834 template <
typename OpT,
class Callable>
835 std::enable_if_t<!std::is_invocable_v<Callable, Operation *>>
837 addDynamicallyLegalOp<OpT>(
838 [=](
Operation *op) {
return callback(cast<OpT>(op)); });
846 template <
typename OpT>
850 template <
typename OpT,
typename OpT2,
typename... OpTs>
863 template <
typename OpT>
868 template <
typename OpT,
typename OpT2,
typename... OpTs>
870 markOpRecursivelyLegal<OpT>(callback);
873 template <
typename OpT,
class Callable>
874 std::enable_if_t<!std::is_invocable_v<Callable, Operation *>>
876 markOpRecursivelyLegal<OpT>(
877 [=](
Operation *op) {
return callback(cast<OpT>(op)); });
885 template <
typename... Names>
890 template <
typename... Args>
898 template <
typename... Names>
900 StringRef name, Names... names) {
903 setLegalityCallback(dialectNames, callback);
905 template <
typename... Args>
908 Args::getDialectNamespace()...);
915 setLegalityCallback(fn);
920 template <
typename... Names>
925 template <
typename... Args>
967 struct LegalizationInfo {
972 bool isRecursivelyLegal =
false;
979 std::optional<LegalizationInfo> getOpInfo(OperationName op)
const;
983 llvm::MapVector<OperationName, LegalizationInfo> legalOperations;
987 DenseMap<OperationName, DynamicLegalityCallbackFn> opRecursiveLegalityFns;
991 llvm::StringMap<LegalizationAction> legalDialects;
994 llvm::StringMap<DynamicLegalityCallbackFn> dialectLegalityFns;
1052 const FrozenRewritePatternSet &patterns,
1053 DenseSet<Operation *> *unconvertedOps =
nullptr);
1056 const FrozenRewritePatternSet &patterns,
1057 DenseSet<Operation *> *unconvertedOps =
nullptr);
1064 ConversionTarget &target,
1065 const FrozenRewritePatternSet &patterns);
1067 const FrozenRewritePatternSet &patterns);
1081 ArrayRef<Operation *> ops, ConversionTarget &target,
1082 const FrozenRewritePatternSet &patterns,
1083 DenseSet<Operation *> &convertedOps,
1084 function_ref<
void(Diagnostic &)> notifyCallback =
nullptr);
1086 Operation *op, ConversionTarget &target,
1087 const FrozenRewritePatternSet &patterns,
1088 DenseSet<Operation *> &convertedOps,
1089 function_ref<
void(Diagnostic &)> notifyCallback =
nullptr);
Attributes are known-constant values of operations.
This class represents an argument of a Block.
Block represents an ordered list of Operations.
OpListType::iterator iterator
This class implements a pattern rewriter for use with ConversionPatterns.
Block * applySignatureConversion(Region *region, TypeConverter::SignatureConversion &conversion, TypeConverter *converter=nullptr)
Apply a signature conversion to the entry block of the given region.
void replaceOp(Operation *op, ValueRange newValues) override
PatternRewriter hook for replacing the results of an operation.
LogicalResult convertNonEntryRegionTypes(Region *region, TypeConverter &converter, ArrayRef< TypeConverter::SignatureConversion > blockConversions)
Convert the types of block arguments within the given region except for the entry region.
LogicalResult getRemappedValues(ValueRange keys, SmallVectorImpl< Value > &results)
Return the converted values that replace 'keys' with types defined by the type converter of the curre...
void inlineBlockBefore(Block *source, Block *dest, Block::iterator before, ValueRange argValues=std::nullopt) override
PatternRewriter hook for inlining the ops of a block into another block.
LogicalResult notifyMatchFailure(Location loc, function_ref< void(Diagnostic &)> reasonCallback) override
PatternRewriter hook for notifying match failure reasons.
void inlineRegionBefore(Region ®ion, Region &parent, Region::iterator before) override
PatternRewriter hook for moving blocks out of a region.
void finalizeRootUpdate(Operation *op) override
PatternRewriter hook for updating the root operation in-place.
void eraseOp(Operation *op) override
PatternRewriter hook for erasing a dead operation.
void replaceOpWithIf(Operation *op, ValueRange newValues, bool *allUsesReplaced, llvm::unique_function< bool(OpOperand &) const > functor) override
PatternRewriter hook for replacing the results of an operation when the given functor returns true.
void notifyBlockCreated(Block *block) override
PatternRewriter hook creating a new block.
FailureOr< Block * > convertRegionTypes(Region *region, TypeConverter &converter, TypeConverter::SignatureConversion *entryConversion=nullptr)
Convert the types of block arguments within the given region.
Block * splitBlock(Block *block, Block::iterator before) override
PatternRewriter hook for splitting a block into two parts.
detail::ConversionPatternRewriterImpl & getImpl()
Return a reference to the internal implementation.
ConversionPatternRewriter(MLIRContext *ctx)
void notifyOperationInserted(Operation *op) override
PatternRewriter hook for inserting a new operation.
void cancelRootUpdate(Operation *op) override
PatternRewriter hook for updating the root operation in-place.
void eraseBlock(Block *block) override
PatternRewriter hook for erase all operations in a block.
bool canRecoverFromRewriteFailure() const override
Indicate that the conversion rewriter can recover from rewrite failure.
Value getRemappedValue(Value key)
Return the converted value of 'key' with a type defined by the type converter of the currently execut...
void replaceUsesOfBlockArgument(BlockArgument from, Value to)
Replace all the uses of the block argument from with value to.
void startRootUpdate(Operation *op) override
PatternRewriter hook for updating the root operation in-place.
~ConversionPatternRewriter() override
void cloneRegionBefore(Region ®ion, Region &parent, Region::iterator before, IRMapping &mapping) override
PatternRewriter hook for cloning blocks of one region into another.
Base class for the conversion patterns.
std::enable_if_t< std::is_base_of< TypeConverter, ConverterTy >::value, ConverterTy * > getTypeConverter() const
TypeConverter * typeConverter
An optional type converter for use by this pattern.
TypeConverter * getTypeConverter() const
Return the type converter held by this pattern, or nullptr if the pattern does not require type conve...
ConversionPattern(TypeConverter &typeConverter, Args &&...args)
Construct a conversion pattern with the given converter, and forward the remaining arguments to Rewri...
virtual void rewrite(Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const
Hook for derived classes to implement rewriting.
virtual LogicalResult matchAndRewrite(Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const
Hook for derived classes to implement combined matching and rewriting.
This class describes a specific conversion target.
void setDialectAction(ArrayRef< StringRef > dialectNames, LegalizationAction action)
Register a legality action for the given dialects.
void setOpAction(LegalizationAction action)
void addLegalOp(OperationName op)
Register the given operations as legal.
void addDynamicallyLegalDialect(DynamicLegalityCallbackFn callback)
void setOpAction(OperationName op, LegalizationAction action)
Register a legality action for the given operation.
void addDynamicallyLegalDialect(const DynamicLegalityCallbackFn &callback, StringRef name, Names... names)
Register the operations of the given dialects as dynamically legal, i.e.
void addDynamicallyLegalOp(const DynamicLegalityCallbackFn &callback)
void addLegalDialect(StringRef name, Names... names)
Register the operations of the given dialects as legal.
std::optional< LegalOpDetails > isLegal(Operation *op) const
If the given operation instance is legal on this target, a structure containing legality information ...
std::enable_if_t<!std::is_invocable_v< Callable, Operation * > > markOpRecursivelyLegal(Callable &&callback)
void markUnknownOpDynamicallyLegal(const DynamicLegalityCallbackFn &fn)
Register unknown operations as dynamically legal.
std::optional< LegalizationAction > getOpAction(OperationName op) const
Get the legality action for the given operation.
void addDynamicallyLegalOp(OperationName op, const DynamicLegalityCallbackFn &callback)
Register the given operation as dynamically legal and set the dynamic legalization callback to the on...
void addIllegalDialect(StringRef name, Names... names)
Register the operations of the given dialects as illegal, i.e.
std::enable_if_t<!std::is_invocable_v< Callable, Operation * > > addDynamicallyLegalOp(Callable &&callback)
void addDynamicallyLegalOp(const DynamicLegalityCallbackFn &callback)
void markOpRecursivelyLegal(const DynamicLegalityCallbackFn &callback={})
void addIllegalOp(OperationName op)
Register the given operation as illegal, i.e.
LegalizationAction
This enumeration corresponds to the specific action to take when considering an operation legal for t...
@ Illegal
The target explicitly does not support this operation.
@ Dynamic
This operation has dynamic legalization constraints that must be checked by the target.
@ Legal
The target supports this operation.
ConversionTarget(MLIRContext &ctx)
void markOpRecursivelyLegal(OperationName name, const DynamicLegalityCallbackFn &callback)
Mark an operation, that must have either been set as Legal or DynamicallyLegal, as being recursively ...
void markOpRecursivelyLegal(const DynamicLegalityCallbackFn &callback={})
std::function< std::optional< bool >(Operation *)> DynamicLegalityCallbackFn
The signature of the callback used to determine if an operation is dynamically legal on the target.
bool isIllegal(Operation *op) const
Returns true is operation instance is illegal on this target.
virtual ~ConversionTarget()=default
This class contains all of the information necessary to report a diagnostic to the DiagnosticEngine.
This class provides support for representing a failure result, or a valid value of type T.
This is a utility class for mapping one set of IR entities to another.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
MLIRContext is the top-level object for a collection of MLIR operations.
This class helps build Operations.
void setListener(Listener *newListener)
Sets the listener of this builder to the one provided.
Listener * getListener() const
Returns the current listener of this builder, or nullptr if this builder doesn't have a listener.
OpConversionPattern is a wrapper around ConversionPattern that allows for matching and rewriting agai...
void rewrite(Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const final
Hook for derived classes to implement rewriting.
LogicalResult match(Operation *op) const final
Wrappers around the ConversionPattern methods that pass the derived op type.
typename SourceOp::Adaptor OpAdaptor
OpConversionPattern(MLIRContext *context, PatternBenefit benefit=1)
virtual LogicalResult match(SourceOp op) const
Rewrite and Match methods that operate on the SourceOp type.
OpConversionPattern(TypeConverter &typeConverter, MLIRContext *context, PatternBenefit benefit=1)
virtual LogicalResult matchAndRewrite(SourceOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const
virtual void rewrite(SourceOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const
LogicalResult matchAndRewrite(Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const final
Hook for derived classes to implement combined matching and rewriting.
OpInterfaceConversionPattern is a wrapper around ConversionPattern that allows for matching and rewri...
void rewrite(Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const final
Wrappers around the ConversionPattern methods that pass the derived op type.
LogicalResult matchAndRewrite(Operation *op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const final
Hook for derived classes to implement combined matching and rewriting.
OpInterfaceConversionPattern(MLIRContext *context, PatternBenefit benefit=1)
OpInterfaceConversionPattern(TypeConverter &typeConverter, MLIRContext *context, PatternBenefit benefit=1)
virtual void rewrite(SourceOp op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const
Rewrite and Match methods that operate on the SourceOp type.
virtual LogicalResult matchAndRewrite(SourceOp op, ArrayRef< Value > operands, ConversionPatternRewriter &rewriter) const
This class represents an operand of an operation.
Operation is the basic unit of execution within MLIR.
A PDL configuration that is used to supported dialect conversion functionality.
void notifyRewriteEnd(PatternRewriter &rewriter) final
void notifyRewriteBegin(PatternRewriter &rewriter) final
Hooks that are invoked at the beginning and end of a rewrite of a matched pattern.
PDLConversionConfig(TypeConverter *converter)
TypeConverter * getTypeConverter() const
Return the type converter used by this configuration, which may be nullptr if no type conversions are...
~PDLConversionConfig() final=default
This class provides a base class for users implementing a type of pattern configuration.
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
This class contains all of the data related to a pattern, but does not contain any methods or logic f...
This class contains a list of basic blocks and a link to the parent operation it is attached to.
BlockListType::iterator iterator
RewritePattern is the common base class for all DAG to DAG replacements.
virtual LogicalResult match(Operation *op) const
Attempt to match against code rooted at the specified operation, which is the same operation code as ...
virtual void rewrite(Operation *op, PatternRewriter &rewriter) const
Rewrite the IR rooted at the specified operation with the result of this pattern, generating any new ...
std::enable_if_t<!std::is_convertible< CallbackT, Twine >::value, LogicalResult > notifyMatchFailure(Location loc, CallbackT &&reasonCallback)
Used to notify the rewriter that the IR failed to be rewritten because of a match failure,...
virtual void cloneRegionBefore(Region ®ion, Region &parent, Region::iterator before, IRMapping &mapping)
Clone the blocks that belong to "region" before the given position in another region "parent".
virtual void replaceOp(Operation *op, ValueRange newValues)
This method replaces the results of the operation with the specified list of values.
virtual void inlineRegionBefore(Region ®ion, Region &parent, Region::iterator before)
Move the blocks that belong to "region" before the given position in another region "parent".
virtual void inlineBlockBefore(Block *source, Block *dest, Block::iterator before, ValueRange argValues=std::nullopt)
Inline the operations of block 'source' into block 'dest' before the given position.
The general result of a type attribute conversion callback, allowing for early termination.
Attribute getResult() const
constexpr AttributeConversionResult()
static AttributeConversionResult abort()
static AttributeConversionResult na()
AttributeConversionResult(Attribute attr)
static AttributeConversionResult result(Attribute attr)
This class provides all of the information necessary to convert a type signature.
void addInputs(unsigned origInputNo, ArrayRef< Type > types)
Remap an input of the original signature with a new set of types.
std::optional< InputMapping > getInputMapping(unsigned input) const
Get the input mapping for the given argument.
ArrayRef< Type > getConvertedTypes() const
Return the argument types for the new signature.
void remapInput(unsigned origInputNo, Value replacement)
Remap an input of the original signature to another replacement value.
SignatureConversion(unsigned numOrigInputs)
std::enable_if_t<!std::is_convertible< RangeT, Type >::value &&!std::is_convertible< RangeT, Operation * >::value, bool > isLegal(RangeT &&range)
Return true if all of the given types are legal for this type converter.
void addConversion(FnT &&callback)
Register a conversion function.
bool isSignatureLegal(FunctionType ty)
Return true if the inputs and outputs of the given function type are legal.
LogicalResult convertSignatureArg(unsigned inputNo, Type type, SignatureConversion &result)
This method allows for converting a specific argument of a signature.
void addArgumentMaterialization(FnT &&callback)
Register a materialization function, which must be convertible to the following form: std::optional<V...
LogicalResult convertTypes(TypeRange types, SmallVectorImpl< Type > &results)
Convert the given set of types, filling 'results' as necessary.
LogicalResult convertSignatureArgs(TypeRange types, SignatureConversion &result, unsigned origInputOffset=0)
std::optional< Attribute > convertTypeAttribute(Type type, Attribute attr)
Convert an attribute present attr from within the type type using the registered conversion functions...
bool isLegal(Type type)
Return true if the given type is legal for this type converter, i.e.
LogicalResult convertType(Type t, SmallVectorImpl< Type > &results)
Convert the given type.
std::optional< SignatureConversion > convertBlockSignature(Block *block)
This function converts the type signature of the given block, by invoking 'convertSignatureArg' for e...
void addSourceMaterialization(FnT &&callback)
This method registers a materialization that will be called when converting a legal type to an illega...
Value materializeArgumentConversion(OpBuilder &builder, Location loc, Type resultType, ValueRange inputs)
Materialize a conversion from a set of types into one result type by generating a cast sequence of so...
void addTypeAttributeConversion(FnT &&callback)
Register a conversion function for attributes within types.
void addTargetMaterialization(FnT &&callback)
This method registers a materialization that will be called when converting type from an illegal,...
Value materializeSourceConversion(OpBuilder &builder, Location loc, Type resultType, ValueRange inputs)
Value materializeTargetConversion(OpBuilder &builder, Location loc, Type resultType, ValueRange inputs)
This class provides an abstraction over the various different ranges of value types.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
@ Type
An inlay hint that for a type annotation.
This header declares functions that assit transformations in the MemRef dialect.
LogicalResult failure(bool isFailure=true)
Utility function to generate a LogicalResult.
llvm::function_ref< Fn > function_ref
void populateFunctionOpInterfaceTypeConversionPattern(StringRef functionLikeOpName, RewritePatternSet &patterns, TypeConverter &converter)
Add a pattern to the given pattern list to convert the signature of a FunctionOpInterface op with the...
LogicalResult applyPartialConversion(ArrayRef< Operation * > ops, ConversionTarget &target, const FrozenRewritePatternSet &patterns, DenseSet< Operation * > *unconvertedOps=nullptr)
Below we define several entry points for operation conversion.
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
LogicalResult applyFullConversion(ArrayRef< Operation * > ops, ConversionTarget &target, const FrozenRewritePatternSet &patterns)
Apply a complete conversion on the given operations, and all nested operations.
void populateAnyFunctionOpInterfaceTypeConversionPattern(RewritePatternSet &patterns, TypeConverter &converter)
void registerConversionPDLFunctions(RewritePatternSet &patterns)
Register the dialect conversion PDL functions with the given pattern set.
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.
LogicalResult applyAnalysisConversion(ArrayRef< Operation * > ops, ConversionTarget &target, const FrozenRewritePatternSet &patterns, DenseSet< Operation * > &convertedOps, function_ref< void(Diagnostic &)> notifyCallback=nullptr)
Apply an analysis conversion on the given operations, and all nested operations.
A structure containing additional information describing a specific legal operation instance.
bool isRecursivelyLegal
A flag that indicates if this operation is 'recursively' legal.
This class represents an efficient way to signal success or failure.
This class acts as a special tag that makes the desire to match any operation that implements a given...