14 #include "../SPIRVCommon/Pattern.h"
21 #include "llvm/Support/Debug.h"
23 #define DEBUG_TYPE "func-to-spirv-pattern"
43 matchAndRewrite(func::ReturnOp returnOp, OpAdaptor adaptor,
45 if (returnOp.getNumOperands() > 1)
48 if (returnOp.getNumOperands() == 1) {
50 returnOp, adaptor.getOperands()[0]);
64 matchAndRewrite(func::CallOp callOp, OpAdaptor adaptor,
67 if (callOp.getNumResults() > 1)
69 if (callOp.getNumResults() == 1) {
71 getTypeConverter()->convertType(callOp.getResult(0).getType());
75 callOp, resultType, adaptor.getOperands(), callOp->getAttrs());
78 callOp,
TypeRange(), adaptor.getOperands(), callOp->getAttrs());
94 patterns.add<ReturnOpPattern, CallOpPattern>(typeConverter, context);
This class implements a pattern rewriter for use with ConversionPatterns.
MLIRContext is the top-level object for a collection of MLIR operations.
OpConversionPattern is a wrapper around ConversionPattern that allows for matching and rewriting agai...
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
Type conversion from builtin types to SPIR-V types for shader interface.
This class provides an abstraction over the various different ranges of value types.
Include the generated interface declarations.
void populateFuncToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns)
Appends to a pattern list additional patterns for translating Func ops to SPIR-V ops.
const FrozenRewritePatternSet & patterns