@@ -195,6 +195,8 @@ template <typename SourceOp>
195195class FIROpConversion : public ConvertFIRToLLVMPattern {
196196public:
197197 using OpAdaptor = typename SourceOp::Adaptor;
198+ using OneToNOpAdaptor = typename SourceOp::template GenericAdaptor<
199+ mlir::ArrayRef<mlir::ValueRange>>;
198200
199201 explicit FIROpConversion (const LLVMTypeConverter &typeConverter,
200202 const fir::FIRToLLVMPassOptions &options,
@@ -209,6 +211,12 @@ class FIROpConversion : public ConvertFIRToLLVMPattern {
209211 rewrite (mlir::cast<SourceOp>(op),
210212 OpAdaptor (operands, mlir::cast<SourceOp>(op)), rewriter);
211213 }
214+ void rewrite (mlir::Operation *op, mlir::ArrayRef<mlir::ValueRange> operands,
215+ mlir::ConversionPatternRewriter &rewriter) const final {
216+ auto sourceOp = llvm::cast<SourceOp>(op);
217+ rewrite (llvm::cast<SourceOp>(op), OneToNOpAdaptor (operands, sourceOp),
218+ rewriter);
219+ }
212220 llvm::LogicalResult match (mlir::Operation *op) const final {
213221 return match (mlir::cast<SourceOp>(op));
214222 }
@@ -219,7 +227,14 @@ class FIROpConversion : public ConvertFIRToLLVMPattern {
219227 OpAdaptor (operands, mlir::cast<SourceOp>(op)),
220228 rewriter);
221229 }
222-
230+ llvm::LogicalResult
231+ matchAndRewrite (mlir::Operation *op,
232+ mlir::ArrayRef<mlir::ValueRange> operands,
233+ mlir::ConversionPatternRewriter &rewriter) const final {
234+ auto sourceOp = mlir::cast<SourceOp>(op);
235+ return matchAndRewrite (sourceOp, OneToNOpAdaptor (operands, sourceOp),
236+ rewriter);
237+ }
223238 // / Rewrite and Match methods that operate on the SourceOp type. These must be
224239 // / overridden by the derived pattern class.
225240 virtual llvm::LogicalResult match (SourceOp op) const {
@@ -229,6 +244,12 @@ class FIROpConversion : public ConvertFIRToLLVMPattern {
229244 mlir::ConversionPatternRewriter &rewriter) const {
230245 llvm_unreachable (" must override rewrite or matchAndRewrite" );
231246 }
247+ virtual void rewrite (SourceOp op, OneToNOpAdaptor adaptor,
248+ mlir::ConversionPatternRewriter &rewriter) const {
249+ llvm::SmallVector<mlir::Value> oneToOneOperands =
250+ getOneToOneAdaptorOperands (adaptor.getOperands ());
251+ rewrite (op, OpAdaptor (oneToOneOperands, adaptor), rewriter);
252+ }
232253 virtual llvm::LogicalResult
233254 matchAndRewrite (SourceOp op, OpAdaptor adaptor,
234255 mlir::ConversionPatternRewriter &rewriter) const {
@@ -237,6 +258,13 @@ class FIROpConversion : public ConvertFIRToLLVMPattern {
237258 rewrite (op, adaptor, rewriter);
238259 return mlir::success ();
239260 }
261+ virtual llvm::LogicalResult
262+ matchAndRewrite (SourceOp op, OneToNOpAdaptor adaptor,
263+ mlir::ConversionPatternRewriter &rewriter) const {
264+ llvm::SmallVector<mlir::Value> oneToOneOperands =
265+ getOneToOneAdaptorOperands (adaptor.getOperands ());
266+ return matchAndRewrite (op, OpAdaptor (oneToOneOperands, adaptor), rewriter);
267+ }
240268
241269private:
242270 using ConvertFIRToLLVMPattern::matchAndRewrite;
0 commit comments