31 matchAndRewrite(CallOp op, OpAdaptor adaptor,
38 if (!adaptor.getOperandMapping().hasNonIdentityConversion() &&
44 adaptor.getFlatOperands());
47 rewriter.
replaceOp(op, newOp->getResults(), resultMapping);
57 matchAndRewrite(FuncOp op, OpAdaptor adaptor,
59 auto *typeConverter = getTypeConverter<OneToNTypeConverter>();
63 if (
failed(typeConverter->computeTypeMapping(op.getArgumentTypes(),
75 if (!argumentMapping.hasNonIdentityConversion() &&
76 !funcResultMapping.hasNonIdentityConversion())
81 argumentMapping.getConvertedTypes(),
82 funcResultMapping.getConvertedTypes());
86 if (!op.isExternal()) {
87 Region *region = &op.getBody();
101 matchAndRewrite(ReturnOp op, OpAdaptor adaptor,
104 if (!adaptor.getOperandMapping().hasNonIdentityConversion())
109 op, [&] { op->
setOperands(adaptor.getFlatOperands()); });
123 ConvertTypesInFuncCallOp,
124 ConvertTypesInFuncFuncOp,
125 ConvertTypesInFuncReturnOp
Block represents an ordered list of Operations.
MLIRContext * getContext() const
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class is a wrapper around OneToNConversionPattern for matching against instances of a particular...
Specialization of PatternRewriter that OneToNConversionPatterns use.
Block * applySignatureConversion(Block *block, OneToNTypeMapping &argumentConversion)
Applies the given argument conversion to the given block.
void replaceOp(Operation *op, ValueRange newValues, const OneToNTypeMapping &resultMapping)
Replaces the results of the operation with the specified list of values mapped back to the original t...
Stores a 1:N mapping of types and provides several useful accessors.
TypeRange getConvertedTypes(unsigned originalTypeNo) const
Returns the list of types that corresponds to the original type at the given index.
bool hasNonIdentityConversion() const
Returns true iff at least one type conversion maps an input type to a type that is different from its...
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
void setAttrs(DictionaryAttr newAttrs)
Set the attributes from a dictionary on this operation.
Location getLoc()
The source location the operation was defined or derived from.
ArrayRef< NamedAttribute > getAttrs()
Return all of the attributes on this operation.
result_type_range getResultTypes()
void setOperands(ValueRange operands)
Replace the current operands of this operation with the ones provided in 'operands'.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
MLIRContext * getContext() const
RewritePatternSet & add(ConstructorArg &&arg, ConstructorArgs &&...args)
Add an instance of each of the pattern types 'Ts' to the pattern list with the given arguments.
void modifyOpInPlace(Operation *root, CallableT &&callable)
This method is a utility wrapper around an in-place modification of an operation.
Include the generated interface declarations.
LogicalResult failure(bool isFailure=true)
Utility function to generate a LogicalResult.
void populateFuncTypeConversionPatterns(TypeConverter &typeConverter, RewritePatternSet &patterns)
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.
This class represents an efficient way to signal success or failure.