17 #define GEN_PASS_DEF_UBTOSPIRVCONVERSIONPASS
18 #include "mlir/Conversion/Passes.h.inc"
29 matchAndRewrite(ub::PoisonOp op, OpAdaptor,
31 Type origType = op.getType();
34 diag <<
"unsupported type " << origType;
37 Type resType = getTypeConverter()->convertType(origType);
40 diag <<
"failed to convert result type " << origType;
55 struct UBToSPIRVConversionPass final
56 : impl::UBToSPIRVConversionPassBase<UBToSPIRVConversionPass> {
59 void runOnOperation()
override {
62 std::unique_ptr<SPIRVConversionTarget> target =
static MLIRContext * getContext(OpFoldResult val)
static std::string diag(const llvm::Value &value)
static llvm::ManagedStatic< PassManagerOptions > options
This class implements a pattern rewriter for use with ConversionPatterns.
This class contains all of the information necessary to report a diagnostic to the DiagnosticEngine.
OpConversionPattern is a wrapper around ConversionPattern that allows for matching and rewriting agai...
OpConversionPattern(MLIRContext *context, PatternBenefit benefit=1)
Operation is the basic unit of execution within MLIR.
std::enable_if_t<!std::is_convertible< CallbackT, Twine >::value, LogicalResult > notifyMatchFailure(Location loc, CallbackT &&reasonCallback)
Used to notify the listener that the IR failed to be rewritten because of a match failure,...
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
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.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
bool isIntOrIndexOrFloat() const
Return true if this is an integer (of any signedness), index, or float type.
An attribute that specifies the target version, allowed extensions and capabilities,...
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
LogicalResult applyPartialConversion(ArrayRef< Operation * > ops, const ConversionTarget &target, const FrozenRewritePatternSet &patterns, ConversionConfig config=ConversionConfig())
Below we define several entry points for operation conversion.