@@ -531,82 +531,14 @@ class TypeConverter {
531531// Conversion Patterns
532532// ===----------------------------------------------------------------------===//
533533
534- namespace detail {
535- // / Helper class that derives from a ConversionRewritePattern class and
536- // / provides separate `match` and `rewrite` entry points instead of a combined
537- // / `matchAndRewrite`.
538- template <typename PatternT>
539- class ConversionSplitMatchAndRewriteImpl : public PatternT {
540- using PatternT::PatternT;
541-
542- // / Attempt to match against IR rooted at the specified operation, which is
543- // / the same operation kind as getRootKind().
544- // /
545- // / Note: This function must not modify the IR.
546- virtual LogicalResult match (typename PatternT::OperationT op) const = 0;
547-
548- // / Rewrite the IR rooted at the specified operation with the result of
549- // / this pattern, generating any new operations with the specified
550- // / rewriter.
551- virtual void rewrite (typename PatternT::OperationT op,
552- typename PatternT::OpAdaptor adaptor,
553- ConversionPatternRewriter &rewriter) const {
554- // One of the two `rewrite` functions must be implemented.
555- llvm_unreachable (" rewrite is not implemented" );
556- }
557-
558- virtual void rewrite (typename PatternT::OperationT op,
559- typename PatternT::OneToNOpAdaptor adaptor,
560- ConversionPatternRewriter &rewriter) const {
561- if constexpr (std::is_same<typename PatternT::OpAdaptor,
562- ArrayRef<Value>>::value) {
563- rewrite (op, PatternT::getOneToOneAdaptorOperands (adaptor), rewriter);
564- } else {
565- SmallVector<Value> oneToOneOperands =
566- PatternT::getOneToOneAdaptorOperands (adaptor.getOperands ());
567- rewrite (op, typename PatternT::OpAdaptor (oneToOneOperands, adaptor),
568- rewriter);
569- }
570- }
571-
572- LogicalResult
573- matchAndRewrite (typename PatternT::OperationT op,
574- typename PatternT::OneToNOpAdaptor adaptor,
575- ConversionPatternRewriter &rewriter) const final {
576- if (succeeded (match (op))) {
577- rewrite (op, adaptor, rewriter);
578- return success ();
579- }
580- return failure ();
581- }
582-
583- LogicalResult
584- matchAndRewrite (typename PatternT::OperationT op,
585- typename PatternT::OpAdaptor adaptor,
586- ConversionPatternRewriter &rewriter) const final {
587- // Users would normally override this function in conversion patterns to
588- // implement a 1:1 pattern. Patterns that are derived from this class have
589- // separate `match` and `rewrite` functions, so this `matchAndRewrite`
590- // overload is obsolete.
591- llvm_unreachable (" this function is unreachable" );
592- }
593- };
594- } // namespace detail
595-
596534// / Base class for the conversion patterns. This pattern class enables type
597535// / conversions, and other uses specific to the conversion framework. As such,
598536// / patterns of this type can only be used with the 'apply*' methods below.
599537class ConversionPattern : public RewritePattern {
600538public:
601- using OperationT = Operation *;
602539 using OpAdaptor = ArrayRef<Value>;
603540 using OneToNOpAdaptor = ArrayRef<ValueRange>;
604541
605- // / `SplitMatchAndRewrite` is deprecated. Use `matchAndRewrite` instead of
606- // / separate `match` and `rewrite`.
607- using SplitMatchAndRewrite =
608- detail::ConversionSplitMatchAndRewriteImpl<ConversionPattern>;
609-
610542 // / Hook for derived classes to implement combined matching and rewriting.
611543 // / This overload supports only 1:1 replacements. The 1:N overload is called
612544 // / by the driver. By default, it calls this 1:1 overload or reports a fatal
@@ -671,16 +603,10 @@ class ConversionPattern : public RewritePattern {
671603template <typename SourceOp>
672604class OpConversionPattern : public ConversionPattern {
673605public:
674- using OperationT = SourceOp;
675606 using OpAdaptor = typename SourceOp::Adaptor;
676607 using OneToNOpAdaptor =
677608 typename SourceOp::template GenericAdaptor<ArrayRef<ValueRange>>;
678609
679- // / `SplitMatchAndRewrite` is deprecated. Use `matchAndRewrite` instead of
680- // / separate `match` and `rewrite`.
681- using SplitMatchAndRewrite =
682- detail::ConversionSplitMatchAndRewriteImpl<OpConversionPattern<SourceOp>>;
683-
684610 OpConversionPattern (MLIRContext *context, PatternBenefit benefit = 1 )
685611 : ConversionPattern(SourceOp::getOperationName(), benefit, context) {}
686612 OpConversionPattern (const TypeConverter &typeConverter, MLIRContext *context,
0 commit comments