9 #ifndef MLIR_CONVERSION_SPIRVCOMMON_PATTERN_H 10 #define MLIR_CONVERSION_SPIRVCOMMON_PATTERN_H 20 template <
typename Op,
typename SPIRVOp>
28 assert(adaptor.getOperands().size() <= 3);
32 if (SPIRVOp::template hasTrait<OpTrait::spirv::UnsignedOp>() &&
33 !op.getType().isIndex() && dstType != op.getType()) {
35 "bitwidth emulation is not implemented yet on unsigned op");
37 rewriter.template replaceOpWithNewOp<SPIRVOp>(op, dstType,
38 adaptor.getOperands());
46 #endif // MLIR_CONVERSION_SPIRVCOMMON_PATTERN_H Include the generated interface declarations.
TypeConverter * getTypeConverter() const
Return the type converter held by this pattern, or nullptr if the pattern does not require type conve...
LogicalResult convertType(Type t, SmallVectorImpl< Type > &results)
Convert the given type.
Converts elementwise unary, binary and ternary standard operations to SPIR-V operations.
LogicalResult matchAndRewrite(Op op, typename Op::Adaptor adaptor, ConversionPatternRewriter &rewriter) const override
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.
InFlightDiagnostic emitError(const Twine &message={})
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers tha...
OpConversionPattern is a wrapper around ConversionPattern that allows for matching and rewriting agai...
This class implements a pattern rewriter for use with ConversionPatterns.
This provides public APIs that all operations should have.