Skip to content

Commit c1a2292

Browse files
authored
[MLIR][NFC] Retire let constructor for passes in Conversion directory (part1) (llvm#127403)
`let constructor` is deprecated since the table gen backend emits most of the glue logic to build a pass. This PR retires the td method for most (I need another pass) passes in the Conversion directory.
1 parent e0e67a6 commit c1a2292

File tree

68 files changed

+165
-440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+165
-440
lines changed

flang/include/flang/Optimizer/Support/InitFIR.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ inline void registerMLIRPassesForFortranTools() {
112112
mlir::affine::registerAffineLoopTilingPass();
113113
mlir::affine::registerAffineDataCopyGenerationPass();
114114

115-
mlir::registerConvertAffineToStandardPass();
115+
mlir::registerLowerAffinePass();
116116
}
117117

118118
/// Register the interfaces needed to lower to LLVM IR.

flang/lib/Optimizer/Passes/Pipelines.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void createDefaultFIROptimizerPassPipeline(mlir::PassManager &pm,
205205
pm, fir::createStackReclaim);
206206
// convert control flow to CFG form
207207
fir::addCfgConversionPass(pm, pc);
208-
pm.addPass(mlir::createConvertSCFToCFPass());
208+
pm.addPass(mlir::createSCFToControlFlowPass());
209209

210210
pm.addPass(mlir::createCanonicalizerPass(config));
211211
pm.addPass(fir::createSimplifyRegionLite());

mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class LLVMTypeConverter;
1818
class RewritePatternSet;
1919
class Pass;
2020

21-
#define GEN_PASS_DECL_CONVERTAMDGPUTOROCDL
21+
#define GEN_PASS_DECL_CONVERTAMDGPUTOROCDLPASS
2222
#include "mlir/Conversion/Passes.h.inc"
2323

2424
/// Note: The ROCDL target does not support the LLVM bfloat type at this time
@@ -28,8 +28,6 @@ void populateAMDGPUToROCDLConversionPatterns(const LLVMTypeConverter &converter,
2828
RewritePatternSet &patterns,
2929
amdgpu::Chipset chipset);
3030

31-
std::unique_ptr<Pass> createConvertAMDGPUToROCDLPass();
32-
3331
} // namespace mlir
3432

3533
#endif // MLIR_CONVERSION_AMDGPUTOROCDL_AMDGPUTOROCDL_H_

mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace affine {
2424
class AffineForOp;
2525
} // namespace affine
2626

27-
#define GEN_PASS_DECL_CONVERTAFFINETOSTANDARD
27+
#define GEN_PASS_DECL_LOWERAFFINEPASS
2828
#include "mlir/Conversion/Passes.h.inc"
2929

3030
/// Collect a set of patterns to convert from the Affine dialect to the Standard
@@ -44,11 +44,6 @@ Value lowerAffineLowerBound(affine::AffineForOp op, OpBuilder &builder);
4444
/// standard arithmetic operations.
4545
Value lowerAffineUpperBound(affine::AffineForOp op, OpBuilder &builder);
4646

47-
/// Lowers affine control flow operations (ForStmt, IfStmt and AffineApplyOp)
48-
/// to equivalent lower-level constructs (flow of basic blocks and arithmetic
49-
/// primitives).
50-
std::unique_ptr<Pass> createLowerAffinePass();
51-
5247
} // namespace mlir
5348

5449
#endif // MLIR_CONVERSION_AFFINETOSTANDARD_AFFINETOSTANDARD_H

mlir/include/mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SPIRVTypeConverter;
1818
class RewritePatternSet;
1919
class Pass;
2020

21-
#define GEN_PASS_DECL_CONVERTARITHTOSPIRV
21+
#define GEN_PASS_DECL_CONVERTARITHTOSPIRVPASS
2222
#include "mlir/Conversion/Passes.h.inc"
2323

2424
namespace arith {

mlir/include/mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,13 @@ namespace mlir {
1515
class Pass;
1616
class RewritePatternSet;
1717

18-
#define GEN_PASS_DECL_CONVERTARMNEON2DTOINTR
18+
#define GEN_PASS_DECL_CONVERTARMNEON2DTOINTRPASS
1919
#include "mlir/Conversion/Passes.h.inc"
2020

2121
/// Populates patterns for the lowering of Arm NEON 2D ops to intrinsics.
2222
/// See createConvertArmNeon2dToIntrPass.
2323
void populateConvertArmNeon2dToIntrPatterns(RewritePatternSet &patterns);
2424

25-
/// Creates a pass to lower Arm NEON 2D ops to intrinsics, i.e.
26-
/// equivalent ops operating on flattened 1D vectors and mapping more
27-
/// directly to the corresponding Arm NEON instruction.
28-
std::unique_ptr<Pass> createConvertArmNeon2dToIntrPass();
29-
3025
} // namespace mlir
3126

3227
#endif // MLIR_CONVERSION_ARMNEON2DTOINTR_ARMNEON2DTOINTR_H_

mlir/include/mlir/Conversion/ArmSMEToSCF/ArmSMEToSCF.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@ namespace mlir {
1515
class Pass;
1616
class RewritePatternSet;
1717

18-
#define GEN_PASS_DECL_CONVERTARMSMETOSCF
18+
#define GEN_PASS_DECL_CONVERTARMSMETOSCFPASS
1919
#include "mlir/Conversion/Passes.h.inc"
2020

2121
/// Collect a set of patterns to convert from the ArmSME dialect to SCF.
2222
void populateArmSMEToSCFConversionPatterns(RewritePatternSet &patterns);
2323

24-
/// Create a pass to convert a subset of ArmSME ops to SCF.
25-
std::unique_ptr<Pass> createConvertArmSMEToSCFPass();
26-
2724
} // namespace mlir
2825

2926
#endif // MLIR_CONVERSION_ARMSMETOSCF_ARMSMETOSCF_H_

mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
namespace mlir {
1616
class ModuleOp;
1717

18-
#define GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREF
18+
#define GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREFPASS
1919
#include "mlir/Conversion/Passes.h.inc"
2020

21-
std::unique_ptr<Pass> createBufferizationToMemRefPass();
2221
} // namespace mlir
2322

2423
#endif // MLIR_CONVERSION_BUFFERIZATIONTOMEMREF_BUFFERIZATIONTOMEMREF_H

mlir/include/mlir/Conversion/ComplexToLibm/ComplexToLibm.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#ifndef MLIR_CONVERSION_COMPLEXTOLIBM_COMPLEXTOLIBM_H_
99
#define MLIR_CONVERSION_COMPLEXTOLIBM_COMPLEXTOLIBM_H_
1010

11+
#include "mlir/Pass/Pass.h"
1112
#include "mlir/Transforms/DialectConversion.h"
1213

1314
namespace mlir {
@@ -22,9 +23,6 @@ class OperationPass;
2223
void populateComplexToLibmConversionPatterns(RewritePatternSet &patterns,
2324
PatternBenefit benefit);
2425

25-
/// Create a pass to convert Complex operations to libm calls.
26-
std::unique_ptr<OperationPass<ModuleOp>> createConvertComplexToLibmPass();
27-
2826
} // namespace mlir
2927

3028
#endif // MLIR_CONVERSION_COMPLEXTOLIBM_COMPLEXTOLIBM_H_

mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace mlir {
1616
class RewritePatternSet;
1717
class Pass;
1818

19-
#define GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARD
19+
#define GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARDPASS
2020
#include "mlir/Conversion/Passes.h.inc"
2121

2222
/// Populate the given list with patterns that convert from Complex to Standard.
@@ -25,11 +25,6 @@ void populateComplexToStandardConversionPatterns(
2525
mlir::complex::ComplexRangeFlags complexRange =
2626
mlir::complex::ComplexRangeFlags::improved);
2727

28-
/// Create a pass to convert Complex operations to the Standard dialect.
29-
std::unique_ptr<Pass> createConvertComplexToStandardPass();
30-
std::unique_ptr<Pass>
31-
createConvertComplexToStandardPass(ConvertComplexToStandardOptions options);
32-
3328
} // namespace mlir
3429

3530
#endif // MLIR_CONVERSION_COMPLEXTOSTANDARD_COMPLEXTOSTANDARD_H_

mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
1818
namespace mlir {
1919
class ModuleOp;
2020

21-
#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOSPIRV
21+
#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOSPIRVPASS
2222
#include "mlir/Conversion/Passes.h.inc"
2323

24-
/// Creates a pass to convert ControlFlow ops to SPIR-V ops.
25-
std::unique_ptr<OperationPass<>> createConvertControlFlowToSPIRVPass();
26-
2724
} // namespace mlir
2825

2926
#endif // MLIR_CONVERSION_CONTROLFLOWTOSPIRV_CONTROLFLOWTOSPIRVPASS_H

mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMPass.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@
1313

1414
#include "mlir/Pass/Pass.h"
1515

16-
#define GEN_PASS_DECL_CONVERTTOLLVMPASS
17-
#include "mlir/Conversion/Passes.h.inc"
18-
1916
namespace mlir {
2017

21-
/// Create a pass that performs dialect conversion to LLVM for all dialects
22-
/// implementing `ConvertToLLVMPatternInterface`.
23-
std::unique_ptr<Pass> createConvertToLLVMPass();
18+
#define GEN_PASS_DECL_CONVERTTOLLVMPASS
19+
#include "mlir/Conversion/Passes.h.inc"
2420

2521
/// Register the extension that will load dependent dialects for LLVM
2622
/// conversion. This is useful to implement a pass similar to "convert-to-llvm".

mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
1818
namespace mlir {
1919
class ModuleOp;
2020

21-
#define GEN_PASS_DECL_CONVERTFUNCTOSPIRV
21+
#define GEN_PASS_DECL_CONVERTFUNCTOSPIRVPASS
2222
#include "mlir/Conversion/Passes.h.inc"
2323

24-
/// Creates a pass to convert Func ops to SPIR-V ops.
25-
std::unique_ptr<OperationPass<>> createConvertFuncToSPIRVPass();
26-
2724
} // namespace mlir
2825

2926
#endif // MLIR_CONVERSION_FUNCTOSPIRV_FUNCTOSPIRVPASS_H

mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
#define MLIR_CONVERSION_LINALGTOSTANDARD_LINALGTOSTANDARD_H_
1111

1212
#include "mlir/Dialect/Linalg/IR/Linalg.h"
13+
#include "mlir/Pass/Pass.h"
1314
#include "mlir/Transforms/DialectConversion.h"
1415

1516
namespace mlir {
1617
class ModuleOp;
1718
template <typename T>
1819
class OperationPass;
1920

20-
#define GEN_PASS_DECL_CONVERTLINALGTOSTANDARD
21+
#define GEN_PASS_DECL_CONVERTLINALGTOSTANDARDPASS
2122
#include "mlir/Conversion/Passes.h.inc"
2223

2324
namespace linalg {
@@ -46,10 +47,6 @@ class LinalgOpToLibraryCallRewrite
4647
void populateLinalgToStandardConversionPatterns(RewritePatternSet &patterns);
4748

4849
} // namespace linalg
49-
50-
/// Create a pass to convert Linalg operations to the Standard dialect.
51-
std::unique_ptr<OperationPass<ModuleOp>> createConvertLinalgToStandardPass();
52-
5350
} // namespace mlir
5451

5552
#endif // MLIR_CONVERSION_LINALGTOSTANDARD_LINALGTOSTANDARD_H_

mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,20 @@
99
#define MLIR_CONVERSION_MATHTOLIBM_MATHTOLIBM_H_
1010

1111
#include "mlir/IR/PatternMatch.h"
12+
#include "mlir/Pass/Pass.h"
1213

1314
namespace mlir {
1415
template <typename T>
1516
class OperationPass;
1617

17-
#define GEN_PASS_DECL_CONVERTMATHTOLIBM
18+
#define GEN_PASS_DECL_CONVERTMATHTOLIBMPASS
1819
#include "mlir/Conversion/Passes.h.inc"
1920

2021
/// Populate the given list with patterns that convert from Math to Libm calls.
2122
/// If log1pBenefit is present, use it instead of benefit for the Log1p op.
2223
void populateMathToLibmConversionPatterns(RewritePatternSet &patterns,
2324
PatternBenefit benefit = 1);
2425

25-
/// Create a pass to convert Math operations to libm calls.
26-
std::unique_ptr<OperationPass<ModuleOp>> createConvertMathToLibmPass();
27-
2826
} // namespace mlir
2927

3028
#endif // MLIR_CONVERSION_MATHTOLIBM_MATHTOLIBM_H_

mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
1818
namespace mlir {
1919
class ModuleOp;
2020

21-
#define GEN_PASS_DECL_CONVERTMATHTOSPIRV
21+
#define GEN_PASS_DECL_CONVERTMATHTOSPIRVPASS
2222
#include "mlir/Conversion/Passes.h.inc"
2323

24-
/// Creates a pass to convert Math ops to SPIR-V ops.
25-
std::unique_ptr<OperationPass<>> createConvertMathToSPIRVPass();
26-
2724
} // namespace mlir
2825

2926
#endif // MLIR_CONVERSION_MATHTOSPIRV_MATHTOSPIRVPASS_H

mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@ namespace mlir {
2020
class ModuleOp;
2121

2222
#define GEN_PASS_DECL_MAPMEMREFSTORAGECLASS
23-
#define GEN_PASS_DECL_CONVERTMEMREFTOSPIRV
23+
#define GEN_PASS_DECL_CONVERTMEMREFTOSPIRVPASS
2424
#include "mlir/Conversion/Passes.h.inc"
2525

2626
/// Creates a pass to map numeric MemRef memory spaces to symbolic SPIR-V
2727
/// storage classes. The mapping is read from the command-line option.
2828
std::unique_ptr<OperationPass<>> createMapMemRefStorageClassPass();
2929

30-
/// Creates a pass to convert MemRef ops to SPIR-V ops.
31-
std::unique_ptr<OperationPass<>> createConvertMemRefToSPIRVPass();
32-
3330
} // namespace mlir
3431

3532
#endif // MLIR_CONVERSION_MEMREFTOSPIRV_MEMREFTOSPIRVPASS_H

mlir/include/mlir/Conversion/MeshToMPI/MeshToMPI.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ class Pass;
1818
#define GEN_PASS_DECL_CONVERTMESHTOMPIPASS
1919
#include "mlir/Conversion/Passes.h.inc"
2020

21-
/// Lowers Mesh communication operations (updateHalo, AllGater, ...)
22-
/// to MPI primitives.
23-
std::unique_ptr<::mlir::Pass> createConvertMeshToMPIPass();
24-
2521
} // namespace mlir
2622

2723
#endif // MLIR_CONVERSION_MESHTOMPI_MESHTOMPI_H

mlir/include/mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#ifndef MLIR_CONVERSION_OPENACCTOSCF_CONVERTOPENACCTOSCF_H
99
#define MLIR_CONVERSION_OPENACCTOSCF_CONVERTOPENACCTOSCF_H
1010

11+
#include "mlir/Pass/Pass.h"
1112
#include <memory>
1213

1314
namespace mlir {
@@ -16,16 +17,13 @@ template <typename T>
1617
class OperationPass;
1718
class RewritePatternSet;
1819

19-
#define GEN_PASS_DECL_CONVERTOPENACCTOSCF
20+
#define GEN_PASS_DECL_CONVERTOPENACCTOSCFPASS
2021
#include "mlir/Conversion/Passes.h.inc"
2122

2223
/// Collect the patterns to convert from the OpenACC dialect to OpenACC with
2324
/// SCF dialect.
2425
void populateOpenACCToSCFConversionPatterns(RewritePatternSet &patterns);
2526

26-
/// Create a pass to convert the OpenACC dialect into the LLVMIR dialect.
27-
std::unique_ptr<OperationPass<ModuleOp>> createConvertOpenACCToSCFPass();
28-
2927
} // namespace mlir
3028

3129
#endif // MLIR_CONVERSION_OPENACCTOSCF_CONVERTOPENACCTOSCF_H

mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef MLIR_CONVERSION_PDLTOPDLINTERP_PDLTOPDLINTERP_H
1414
#define MLIR_CONVERSION_PDLTOPDLINTERP_PDLTOPDLINTERP_H
1515

16+
#include "mlir/Pass/Pass.h"
1617
#include "mlir/Support/LLVM.h"
1718

1819
namespace mlir {
@@ -22,16 +23,13 @@ template <typename OpT>
2223
class OperationPass;
2324
class PDLPatternConfigSet;
2425

25-
#define GEN_PASS_DECL_CONVERTPDLTOPDLINTERP
26+
#define GEN_PASS_DECL_CONVERTPDLTOPDLINTERPPASS
2627
#include "mlir/Conversion/Passes.h.inc"
2728

28-
/// Creates and returns a pass to convert PDL ops to PDL interpreter ops.
29-
std::unique_ptr<OperationPass<ModuleOp>> createPDLToPDLInterpPass();
30-
3129
/// Creates and returns a pass to convert PDL ops to PDL interpreter ops.
3230
/// `configMap` holds a map of the configurations for each pattern being
3331
/// compiled.
34-
std::unique_ptr<OperationPass<ModuleOp>> createPDLToPDLInterpPass(
32+
std::unique_ptr<OperationPass<ModuleOp>> createConvertPDLToPDLInterpPass(
3533
DenseMap<Operation *, PDLPatternConfigSet *> &configMap);
3634

3735
} // namespace mlir

0 commit comments

Comments
 (0)