17#define GEN_PASS_DEF_UBTOSPIRVCONVERSIONPASS
18#include "mlir/Conversion/Passes.h.inc"
25struct PoisonOpLowering final : OpConversionPattern<ub::PoisonOp> {
29 matchAndRewrite(ub::PoisonOp op, OpAdaptor,
30 ConversionPatternRewriter &rewriter)
const override {
31 Type origType = op.getType();
32 Type resType = getTypeConverter()->convertType(origType);
34 return rewriter.notifyMatchFailure(op, [&](Diagnostic &
diag) {
35 diag <<
"failed to convert result type " << origType;
38 rewriter.replaceOpWithNewOp<spirv::UndefOp>(op, resType);
50struct UBToSPIRVConversionPass final
54 void runOnOperation()
override {
55 Operation *op = getOperation();
57 std::unique_ptr<SPIRVConversionTarget>
target =
61 SPIRVTypeConverter typeConverter(targetAttr,
options);
static std::string diag(const llvm::Value &value)
static llvm::ManagedStatic< PassManagerOptions > options
static std::unique_ptr< SPIRVConversionTarget > get(spirv::TargetEnvAttr targetAttr)
Creates a SPIR-V conversion target for the given target environment.
Type conversion from builtin types to SPIR-V types for shader interface.
TargetEnvAttr lookupTargetEnvOrDefault(Operation *op)
Queries the target environment recursively from enclosing symbol table ops containing the given op or...
void populateUBToSPIRVConversionPatterns(const SPIRVTypeConverter &converter, RewritePatternSet &patterns)
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns