[MLIR] Update pass declarations to new autogenerated files
authorMichele Scuttari <michele.scuttari@outlook.com>
Tue, 30 Aug 2022 19:56:31 +0000 (21:56 +0200)
committerMichele Scuttari <michele.scuttari@outlook.com>
Tue, 30 Aug 2022 19:56:31 +0000 (21:56 +0200)
The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow dropping the old infrastructure.

Reviewed By: mehdi_amini, rriddle

Differential Review: https://reviews.llvm.org/D132838

301 files changed:
flang/include/flang/Optimizer/CodeGen/CGPasses.td
flang/include/flang/Optimizer/CodeGen/CodeGen.h
flang/include/flang/Optimizer/Transforms/Passes.h
flang/include/flang/Optimizer/Transforms/Passes.td
flang/include/flang/Tools/CLOptions.inc
flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
flang/lib/Optimizer/Transforms/AbstractResult.cpp
flang/lib/Optimizer/Transforms/AffineDemotion.cpp
flang/lib/Optimizer/Transforms/AffinePromotion.cpp
flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp
flang/lib/Optimizer/Transforms/AnnotateConstant.cpp
flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
flang/lib/Optimizer/Transforms/CharacterConversion.cpp
flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
flang/lib/Optimizer/Transforms/PassDetail.h [deleted file]
flang/lib/Optimizer/Transforms/RewriteLoop.cpp
flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
flang/lib/Optimizer/Transforms/SimplifyRegionLite.cpp
mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h
mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
mlir/include/mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h
mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h
mlir/include/mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h
mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h
mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h
mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
mlir/include/mlir/Conversion/ComplexToLibm/ComplexToLibm.h
mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h
mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h
mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h
mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h
mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h
mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h
mlir/include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h
mlir/include/mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h
mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h
mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h
mlir/include/mlir/Conversion/MathToFuncs/MathToFuncs.h
mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h
mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h
mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h
mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h
mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h
mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h
mlir/include/mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h
mlir/include/mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h
mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h
mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h
mlir/include/mlir/Conversion/Passes.td
mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h
mlir/include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h
mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h
mlir/include/mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h
mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h
mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
mlir/include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h
mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h
mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h
mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
mlir/include/mlir/Conversion/TosaToSCF/TosaToSCF.h
mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h
mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h
mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h
mlir/include/mlir/Dialect/Affine/Passes.h
mlir/include/mlir/Dialect/Affine/Passes.td
mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.h
mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td
mlir/include/mlir/Dialect/Async/Passes.h
mlir/include/mlir/Dialect/Async/Passes.td
mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
mlir/include/mlir/Dialect/Func/Transforms/Passes.h
mlir/include/mlir/Dialect/Func/Transforms/Passes.td
mlir/include/mlir/Dialect/GPU/Transforms/Passes.h
mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
mlir/include/mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h
mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h
mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
mlir/include/mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h
mlir/include/mlir/Dialect/Linalg/Passes.h
mlir/include/mlir/Dialect/Linalg/Passes.td
mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h
mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
mlir/include/mlir/Dialect/NVGPU/Passes.h
mlir/include/mlir/Dialect/NVGPU/Passes.td
mlir/include/mlir/Dialect/SCF/Transforms/Passes.h
mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h
mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td
mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
mlir/include/mlir/Dialect/Shape/Transforms/Passes.td
mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
mlir/include/mlir/Dialect/Tensor/Transforms/Passes.h
mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td
mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h [deleted file]
mlir/include/mlir/Dialect/Tosa/Transforms/Passes.h
mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td
mlir/include/mlir/Dialect/Transform/Transforms/Passes.h
mlir/include/mlir/Dialect/Transform/Transforms/Passes.td
mlir/include/mlir/Dialect/Vector/Transforms/Passes.h
mlir/include/mlir/Dialect/Vector/Transforms/Passes.td
mlir/include/mlir/Reducer/PassDetail.h [deleted file]
mlir/include/mlir/Reducer/Passes.h
mlir/include/mlir/Reducer/Passes.td
mlir/include/mlir/Transforms/LocationSnapshot.h
mlir/include/mlir/Transforms/Passes.h
mlir/include/mlir/Transforms/Passes.td
mlir/include/mlir/Transforms/ViewOpGraph.h
mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp
mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp
mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp
mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp
mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp
mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp
mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp
mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
mlir/lib/Conversion/PassDetail.h [deleted file]
mlir/lib/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.cpp
mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp
mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp
mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp
mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
mlir/lib/Conversion/TensorToLinalg/TensorToLinalgPass.cpp
mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp
mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp
mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp
mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
mlir/lib/Conversion/TosaToSCF/TosaToSCFPass.cpp
mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp
mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp
mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp
mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp
mlir/lib/Dialect/Affine/Transforms/LoopCoalescing.cpp
mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
mlir/lib/Dialect/Affine/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
mlir/lib/Dialect/Arithmetic/Transforms/Bufferize.cpp
mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp
mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/Arithmetic/Transforms/UnsignedWhenEquivalent.cpp
mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
mlir/lib/Dialect/Async/Transforms/PassDetail.h
mlir/lib/Dialect/Bufferization/Transforms/AllocTensorElimination.cpp
mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
mlir/lib/Dialect/Bufferization/Transforms/DropEquivalentBufferResults.cpp
mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp
mlir/lib/Dialect/Func/Transforms/FuncBufferize.cpp
mlir/lib/Dialect/Func/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp
mlir/lib/Dialect/GPU/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp
mlir/lib/Dialect/LLVMIR/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/LLVMIR/Transforms/RequestCWrappers.cpp
mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp
mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp
mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp
mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp
mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp
mlir/lib/Dialect/Linalg/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp
mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp
mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
mlir/lib/Dialect/MemRef/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp
mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
mlir/lib/Dialect/NVGPU/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp
mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp
mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp
mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp
mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
mlir/lib/Dialect/SCF/Transforms/ParallelLoopCollapsing.cpp
mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
mlir/lib/Dialect/SCF/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp
mlir/lib/Dialect/SPIRV/Transforms/DecorateCompositeTypeLayoutPass.cpp
mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
mlir/lib/Dialect/SPIRV/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp
mlir/lib/Dialect/Shape/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp
mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp
mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
mlir/lib/Dialect/Tensor/Transforms/PassDetail.h [deleted file]
mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp
mlir/lib/Dialect/Transform/Transforms/CheckUses.cpp
mlir/lib/Dialect/Vector/Transforms/Bufferize.cpp
mlir/lib/Dialect/Vector/Transforms/PassDetail.h [deleted file]
mlir/lib/Reducer/OptReductionPass.cpp
mlir/lib/Reducer/ReductionTreePass.cpp
mlir/lib/Transforms/CSE.cpp
mlir/lib/Transforms/Canonicalizer.cpp
mlir/lib/Transforms/ControlFlowSink.cpp
mlir/lib/Transforms/Inliner.cpp
mlir/lib/Transforms/LocationSnapshot.cpp
mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
mlir/lib/Transforms/OpStats.cpp
mlir/lib/Transforms/PassDetail.h [deleted file]
mlir/lib/Transforms/SCCP.cpp
mlir/lib/Transforms/StripDebugInfo.cpp
mlir/lib/Transforms/SymbolDCE.cpp
mlir/lib/Transforms/SymbolPrivatize.cpp
mlir/lib/Transforms/TopologicalSort.cpp
mlir/lib/Transforms/ViewOpGraph.cpp
mlir/test/CAPI/execution_engine.c
mlir/test/CAPI/pass.c
mlir/test/Pass/ir-printing.mlir
mlir/test/Pass/run-reproducer.mlir
mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp
mlir/tools/mlir-tblgen/PassCAPIGen.cpp
mlir/tools/mlir-tblgen/PassGen.cpp
mlir/unittests/ExecutionEngine/Invoke.cpp

index 71e130a..e9f60f0 100644 (file)
@@ -16,7 +16,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def FIRToLLVMLowering : Pass<"fir-to-llvm-ir", "mlir::ModuleOp"> {
+def FIRToLLVMLoweringPass : Pass<"fir-to-llvm-ir", "mlir::ModuleOp"> {
   let summary = "Convert FIR dialect to LLVM-IR dialect";
   let description = [{
     Convert the FIR dialect to the LLVM-IR dialect of MLIR. This conversion
@@ -30,7 +30,7 @@ def FIRToLLVMLowering : Pass<"fir-to-llvm-ir", "mlir::ModuleOp"> {
   ];
 }
 
-def CodeGenRewrite : Pass<"cg-rewrite", "mlir::ModuleOp"> {
+def CodeGenRewritePass : Pass<"cg-rewrite", "mlir::ModuleOp"> {
   let summary = "Rewrite some FIR ops into their code-gen forms.";
   let description = [{
     Fuse specific subgraphs into single Ops for code generation.
@@ -44,7 +44,7 @@ def CodeGenRewrite : Pass<"cg-rewrite", "mlir::ModuleOp"> {
   ];
 }
 
-def TargetRewrite : Pass<"target-rewrite", "mlir::ModuleOp"> {
+def TargetRewritePass : Pass<"target-rewrite", "mlir::ModuleOp"> {
   let summary = "Rewrite some FIR dialect into target specific forms.";
   let description = [{
       Certain abstractions in the FIR dialect need to be rewritten to reflect
index d89c613..08ba14f 100644 (file)
@@ -20,6 +20,12 @@ namespace fir {
 
 struct NameUniquer;
 
+#define GEN_PASS_DECL_FIRTOLLVMLOWERINGPASS
+#define GEN_PASS_DECL_CODEGENREWRITEPASS
+#define GEN_PASS_DECL_TARGETREWRITEPASS
+#define GEN_PASS_DECL_BOXEDPROCEDUREPASS
+#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
+
 /// Prerequiste pass for code gen. Perform intermediate rewrites to perform
 /// the code gen (to LLVM-IR dialect) conversion.
 std::unique_ptr<mlir::Pass> createFirCodeGenRewritePass();
index e44cba3..32e1a79 100644 (file)
@@ -28,6 +28,22 @@ namespace fir {
 // Passes defined in Passes.td
 //===----------------------------------------------------------------------===//
 
+#define GEN_PASS_DECL_ABSTRACTRESULTONFUNCOPTPASS
+#define GEN_PASS_DECL_ABSTRACTRESULTONGLOBALOPTPASS
+#define GEN_PASS_DECL_AFFINEDIALECTPROMOTIONPASS
+#define GEN_PASS_DECL_AFFINEDIALECTDEMOTIONPASS
+#define GEN_PASS_DECL_ANNOTATECONSTANTOPERANDSPASS
+#define GEN_PASS_DECL_ARRAYVALUECOPYPASS
+#define GEN_PASS_DECL_CHARACTERCONVERSIONPASS
+#define GEN_PASS_DECL_CFGCONVERSIONPASS
+#define GEN_PASS_DECL_EXTERNALNAMECONVERSIONPASS
+#define GEN_PASS_DECL_MEMREFDATAFLOWOPTPASS
+#define GEN_PASS_DECL_SIMPLIFYINTRINSICSPASS
+#define GEN_PASS_DECL_MEMORYALLOCATIONOPTPASS
+#define GEN_PASS_DECL_SIMPLIFYREGIONLITEPASS
+#define GEN_PASS_DECL_ALGEBRAICSIMPLIFICATIONPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+
 std::unique_ptr<mlir::Pass> createAbstractResultOnFuncOptPass();
 std::unique_ptr<mlir::Pass> createAbstractResultOnGlobalOptPass();
 std::unique_ptr<mlir::Pass> createAffineDemotionPass();
index b35aa82..a9fa0ce 100644 (file)
@@ -16,7 +16,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-class AbstractResultOptBase<string optExt, string operation> 
+class AbstractResultOptBase<string optExt, string operation>
   : Pass<"abstract-result-on-" # optExt # "-opt", operation> {
   let summary = "Convert fir.array, fir.box and fir.rec function result to "
                 "function argument";
@@ -35,15 +35,15 @@ class AbstractResultOptBase<string optExt, string operation>
   ];
 }
 
-def AbstractResultOnFuncOpt : AbstractResultOptBase<"func", "mlir::func::FuncOp"> {
+def AbstractResultOnFuncOptPass : AbstractResultOptBase<"func", "mlir::func::FuncOp"> {
   let constructor = "::fir::createAbstractResultOnFuncOptPass()";
 }
 
-def AbstractResultOnGlobalOpt : AbstractResultOptBase<"global", "fir::GlobalOp"> {
+def AbstractResultOnGlobalOptPass : AbstractResultOptBase<"global", "fir::GlobalOp"> {
   let constructor = "::fir::createAbstractResultOnGlobalOptPass()";
 }
 
-def AffineDialectPromotion : Pass<"promote-to-affine", "::mlir::func::FuncOp"> {
+def AffineDialectPromotionPass : Pass<"promote-to-affine", "::mlir::func::FuncOp"> {
   let summary = "Promotes `fir.{do_loop,if}` to `affine.{for,if}`.";
   let description = [{
     Convert fir operations which satisfy affine constraints to the affine
@@ -68,7 +68,7 @@ def AffineDialectPromotion : Pass<"promote-to-affine", "::mlir::func::FuncOp"> {
   ];
 }
 
-def AffineDialectDemotion : Pass<"demote-affine", "::mlir::func::FuncOp"> {
+def AffineDialectDemotionPass : Pass<"demote-affine", "::mlir::func::FuncOp"> {
   let summary = "Converts `affine.{load,store}` back to fir operations";
   let description = [{
     Affine dialect's default lowering for loads and stores is different from
@@ -82,7 +82,7 @@ def AffineDialectDemotion : Pass<"demote-affine", "::mlir::func::FuncOp"> {
   ];
 }
 
-def AnnotateConstantOperands : Pass<"annotate-constant"> {
+def AnnotateConstantOperandsPass : Pass<"annotate-constant"> {
   let summary = "Annotate constant operands to all FIR operations";
   let description = [{
     The MLIR canonicalizer makes a distinction between constants based on how
@@ -99,7 +99,7 @@ def AnnotateConstantOperands : Pass<"annotate-constant"> {
   let dependentDialects = [ "fir::FIROpsDialect" ];
 }
 
-def ArrayValueCopy : Pass<"array-value-copy", "::mlir::func::FuncOp"> {
+def ArrayValueCopyPass : Pass<"array-value-copy", "::mlir::func::FuncOp"> {
   let summary = "Convert array value operations to memory operations.";
   let description = [{
     Transform the set of array value primitives to a memory-based array
@@ -119,7 +119,7 @@ def ArrayValueCopy : Pass<"array-value-copy", "::mlir::func::FuncOp"> {
   let dependentDialects = [ "fir::FIROpsDialect" ];
 }
 
-def CharacterConversion : Pass<"character-conversion"> {
+def CharacterConversionPass : Pass<"character-conversion"> {
   let summary = "Convert CHARACTER entities with different KINDs";
   let description = [{
     Translates entities of one CHARACTER KIND to another.
@@ -137,7 +137,7 @@ def CharacterConversion : Pass<"character-conversion"> {
   ];
 }
 
-def CFGConversion : Pass<"cfg-conversion", "::mlir::func::FuncOp"> {
+def CFGConversionPass : Pass<"cfg-conversion", "::mlir::func::FuncOp"> {
   let summary = "Convert FIR structured control flow ops to CFG ops.";
   let description = [{
     Transform the `fir.do_loop`, `fir.if`, and `fir.iterate_while` ops into
@@ -157,7 +157,7 @@ def CFGConversion : Pass<"cfg-conversion", "::mlir::func::FuncOp"> {
   ];
 }
 
-def ExternalNameConversion : Pass<"external-name-interop", "mlir::ModuleOp"> {
+def ExternalNameConversionPass : Pass<"external-name-interop", "mlir::ModuleOp"> {
   let summary = "Convert name for external interoperability";
   let description = [{
     Demangle FIR internal name and mangle them for external interoperability.
@@ -165,7 +165,7 @@ def ExternalNameConversion : Pass<"external-name-interop", "mlir::ModuleOp"> {
   let constructor = "::fir::createExternalNameConversionPass()";
 }
 
-def MemRefDataFlowOpt : Pass<"fir-memref-dataflow-opt", "::mlir::func::FuncOp"> {
+def MemRefDataFlowOptPass : Pass<"fir-memref-dataflow-opt", "::mlir::func::FuncOp"> {
   let summary =
     "Perform store/load forwarding and potentially removing dead stores.";
   let description = [{
@@ -182,7 +182,7 @@ def MemRefDataFlowOpt : Pass<"fir-memref-dataflow-opt", "::mlir::func::FuncOp">
 // functions into the module, which is invalid if a finer grain mlir::Operation
 // is used as the pass specification says to not touch things outside hte scope
 // of the operation being processed.
-def SimplifyIntrinsics : Pass<"simplify-intrinsics", "mlir::ModuleOp"> {
+def SimplifyIntrinsicsPass : Pass<"simplify-intrinsics", "mlir::ModuleOp"> {
   let summary = "Intrinsics simplification";
   let description = [{
     Qualifying intrinsics calls are replaced with calls to a specialized and
@@ -198,7 +198,7 @@ def SimplifyIntrinsics : Pass<"simplify-intrinsics", "mlir::ModuleOp"> {
   ];
 }
 
-def MemoryAllocationOpt : Pass<"memory-allocation-opt", "mlir::func::FuncOp"> {
+def MemoryAllocationOptPass : Pass<"memory-allocation-opt", "mlir::func::FuncOp"> {
   let summary = "Convert stack to heap allocations and vice versa.";
   let description = [{
     Convert stack allocations to heap allocations and vice versa based on
@@ -216,7 +216,7 @@ def MemoryAllocationOpt : Pass<"memory-allocation-opt", "mlir::func::FuncOp"> {
   let constructor = "::fir::createMemoryAllocationPass()";
 }
 
-def SimplifyRegionLite : Pass<"simplify-region-lite", "mlir::ModuleOp"> {
+def SimplifyRegionLitePass : Pass<"simplify-region-lite", "mlir::ModuleOp"> {
   let summary = "Region simplification";
   let description = [{
     Run region DCE and erase unreachable blocks in regions.
@@ -224,7 +224,7 @@ def SimplifyRegionLite : Pass<"simplify-region-lite", "mlir::ModuleOp"> {
   let constructor = "::fir::createSimplifyRegionLitePass()";
 }
 
-def AlgebraicSimplification : Pass<"flang-algebraic-simplification"> {
+def AlgebraicSimplificationPass : Pass<"flang-algebraic-simplification"> {
   let summary = "";
   let description = [{
     Run algebraic simplifications for Math/Complex/etc. dialect operations.
index 2c77203..75b514c 100644 (file)
@@ -183,7 +183,7 @@ inline void createDefaultFIROptimizerPassPipeline(
 
   // convert control flow to CFG form
   fir::addCfgConversionPass(pm);
-  pm.addPass(mlir::createConvertSCFToCFPass());
+  pm.addPass(mlir::createConvertSCFToControlFlowPass());
 
   pm.addPass(mlir::createCanonicalizerPass(config));
   pm.addPass(fir::createSimplifyRegionLitePass());
index 61f1901..5abb9ab 100644 (file)
@@ -6,10 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "flang/Optimizer/CodeGen/CodeGen.h"
+
 #include "flang/Optimizer/Builder/FIRBuilder.h"
 #include "flang/Optimizer/Builder/LowLevelIntrinsics.h"
-#include "flang/Optimizer/CodeGen/CodeGen.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace fir {
+#define GEN_PASS_DEF_BOXEDPROCEDUREPASS
+#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-procedure-pointer"
 
 using namespace fir;
@@ -169,7 +174,8 @@ private:
 /// the frame pointer during execution. In LLVM IR, the frame pointer is
 /// designated with the `nest` attribute. The thunk's address will then be used
 /// as the call target instead of the original function's address directly.
-class BoxedProcedurePass : public BoxedProcedurePassBase<BoxedProcedurePass> {
+class BoxedProcedurePass
+    : public fir::impl::BoxedProcedurePassBase<BoxedProcedurePass> {
 public:
   BoxedProcedurePass() { options = {true}; }
   BoxedProcedurePass(bool useThunks) { options = {useThunks}; }
index 00cb71b..a1d7673 100644 (file)
@@ -11,8 +11,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "flang/Optimizer/CodeGen/CodeGen.h"
+
 #include "CGOps.h"
-#include "PassDetail.h"
 #include "flang/ISO_Fortran_binding.h"
 #include "flang/Optimizer/Dialect/FIRAttr.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
 #include "mlir/Conversion/MathToLibm/MathToLibm.h"
 #include "mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h"
+#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
+#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
 #include "mlir/IR/BuiltinTypes.h"
 #include "mlir/IR/Matchers.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Target/LLVMIR/ModuleTranslation.h"
 #include "llvm/ADT/ArrayRef.h"
 
+namespace fir {
+#define GEN_PASS_DEF_FIRTOLLVMLOWERINGPASS
+#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-codegen"
 
 // fir::LLVMTypeConverter for converting to LLVM IR dialect types.
@@ -3043,7 +3050,8 @@ struct IsPresentOpConversion : public FIROpConversion<fir::IsPresentOp> {
     auto ptr = adaptor.getOperands()[0];
 
     if (isPresent.getVal().getType().isa<fir::BoxCharType>()) {
-      [[maybe_unused]] auto structTy = ptr.getType().cast<mlir::LLVM::LLVMStructType>();
+      [[maybe_unused]] auto structTy =
+          ptr.getType().cast<mlir::LLVM::LLVMStructType>();
       assert(!structTy.isOpaque() && !structTy.getBody().empty());
 
       ptr = rewriter.create<mlir::LLVM::ExtractValueOp>(loc, ptr, 0);
@@ -3280,7 +3288,8 @@ namespace {
 ///
 /// This pass lowers all FIR dialect operations to LLVM IR dialect. An
 /// MLIR pass is used to lower residual Std dialect to LLVM IR dialect.
-class FIRToLLVMLowering : public fir::FIRToLLVMLoweringBase<FIRToLLVMLowering> {
+class FIRToLLVMLowering
+    : public fir::impl::FIRToLLVMLoweringPassBase<FIRToLLVMLowering> {
 public:
   FIRToLLVMLowering() = default;
   FIRToLLVMLowering(fir::FIRToLLVMPassOptions options) : options{options} {}
index 96b9e9b..c25ac23 100644 (file)
@@ -10,9 +10,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CGOps.h"
-#include "PassDetail.h"
 #include "flang/Optimizer/CodeGen/CodeGen.h"
+
+#include "CGOps.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
 
+namespace fir {
+#define GEN_PASS_DEF_CODEGENREWRITEPASS
+#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
+} // namespace fir
+
 //===----------------------------------------------------------------------===//
 // Codegen rewrite: rewriting of subgraphs of ops
 //===----------------------------------------------------------------------===//
@@ -258,7 +263,8 @@ public:
   }
 };
 
-class CodeGenRewrite : public fir::CodeGenRewriteBase<CodeGenRewrite> {
+class CodeGenRewrite
+    : public fir::impl::CodeGenRewritePassBase<CodeGenRewrite> {
 public:
   void runOn(mlir::Operation *op, mlir::Region &region) {
     auto &context = getContext();
index 1a67230..6868d32 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "flang/Optimizer/CodeGen/CodeGen.h"
+
 #include "Target.h"
 #include "flang/Optimizer/Builder/Character.h"
 #include "flang/Optimizer/Builder/FIRBuilder.h"
 #include "flang/Optimizer/Builder/Todo.h"
-#include "flang/Optimizer/CodeGen/CodeGen.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIROpsSupport.h"
 #include "llvm/ADT/TypeSwitch.h"
 #include "llvm/Support/Debug.h"
 
+namespace fir {
+#define GEN_PASS_DEF_TARGETREWRITEPASS
+#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-target-rewrite"
 
 namespace {
@@ -66,7 +71,7 @@ struct FixupTy {
 /// generation that traverses the FIR and modifies types and operations to a
 /// form that is appropriate for the specific target. LLVM IR has specific
 /// idioms that are used for distinct target processor and ABI combinations.
-class TargetRewrite : public fir::TargetRewriteBase<TargetRewrite> {
+class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
 public:
   TargetRewrite(const fir::TargetRewriteOptions &options) {
     noCharacterConversion = options.noCharacterConversion;
index 0ab65cf..e920149 100644 (file)
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Builder/Todo.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "mlir/Transforms/Passes.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace fir {
+#define GEN_PASS_DEF_ABSTRACTRESULTONFUNCOPTPASS
+#define GEN_PASS_DEF_ABSTRACTRESULTONGLOBALOPTPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-abstract-result-opt"
 
 namespace fir {
@@ -247,8 +252,8 @@ public:
 };
 
 class AbstractResultOnFuncOpt
-    : public AbstractResultOptTemplate<AbstractResultOnFuncOpt,
-                                       fir::AbstractResultOnFuncOptBase> {
+    : public AbstractResultOptTemplate<
+          AbstractResultOnFuncOpt, fir::impl::AbstractResultOnFuncOptPassBase> {
 public:
   void runOnSpecificOperation(mlir::func::FuncOp func, bool shouldBoxResult,
                               mlir::RewritePatternSet &patterns,
@@ -292,8 +297,9 @@ inline static bool containsFunctionTypeWithAbstractResult(mlir::Type type) {
 }
 
 class AbstractResultOnGlobalOpt
-    : public AbstractResultOptTemplate<AbstractResultOnGlobalOpt,
-                                       fir::AbstractResultOnGlobalOptBase> {
+    : public AbstractResultOptTemplate<
+          AbstractResultOnGlobalOpt,
+          fir::impl::AbstractResultOnGlobalOptPassBase> {
 public:
   void runOnSpecificOperation(fir::GlobalOp global, bool,
                               mlir::RewritePatternSet &,
index c535eba..61a331e 100644 (file)
@@ -16,7 +16,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 
+namespace fir {
+#define GEN_PASS_DEF_AFFINEDIALECTDEMOTIONPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-affine-demotion"
 
 using namespace fir;
@@ -137,7 +141,7 @@ public:
 };
 
 class AffineDialectDemotion
-    : public AffineDialectDemotionBase<AffineDialectDemotion> {
+    : public fir::impl::AffineDialectDemotionPassBase<AffineDialectDemotion> {
 public:
   void runOnOperation() override {
     auto *context = &getContext();
index 331d951..0621dbc 100644 (file)
@@ -15,7 +15,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/Debug.h"
 
+namespace fir {
+#define GEN_PASS_DEF_AFFINEDIALECTPROMOTIONPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-affine-promotion"
 
 using namespace fir;
@@ -579,7 +583,7 @@ public:
 /// Promote fir.do_loop and fir.if to affine.for and affine.if, in the cases
 /// where such a promotion is possible.
 class AffineDialectPromotion
-    : public AffineDialectPromotionBase<AffineDialectPromotion> {
+    : public fir::impl::AffineDialectPromotionPassBase<AffineDialectPromotion> {
 public:
   void runOnOperation() override {
 
index 607ba59..06eed66 100644 (file)
 // the parameters of the patterns for Fortran programs.
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Transforms/Passes.h"
+#include "mlir/Dialect/Math/IR/Math.h"
 #include "mlir/Dialect/Math/Transforms/Passes.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace fir {
+#define GEN_PASS_DEF_ALGEBRAICSIMPLIFICATIONPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 using namespace mlir;
 
 namespace {
 struct AlgebraicSimplification
-    : public fir::AlgebraicSimplificationBase<AlgebraicSimplification> {
+    : public fir::impl::AlgebraicSimplificationPassBase<
+          AlgebraicSimplification> {
   AlgebraicSimplification(const GreedyRewriteConfig &rewriteConfig) {
     config = rewriteConfig;
   }
index 0437883..750a5ba 100644 (file)
@@ -6,18 +6,24 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+// #include "PassDetail.h"
+#include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Transforms/Passes.h"
 #include "mlir/IR/BuiltinAttributes.h"
 
+namespace fir {
+#define GEN_PASS_DEF_ANNOTATECONSTANTOPERANDSPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-annotate-constant"
 
 using namespace fir;
 
 namespace {
 struct AnnotateConstantOperands
-    : AnnotateConstantOperandsBase<AnnotateConstantOperands> {
+    : impl::AnnotateConstantOperandsPassBase<AnnotateConstantOperands> {
   void runOnOperation() override {
     auto *context = &getContext();
     mlir::Dialect *firDialect = context->getLoadedDialect("fir");
index 65b7121..1041ce9 100644 (file)
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Builder/Array.h"
 #include "flang/Optimizer/Builder/BoxValue.h"
 #include "flang/Optimizer/Builder/FIRBuilder.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "llvm/Support/Debug.h"
 
+namespace fir {
+#define GEN_PASS_DEF_ARRAYVALUECOPYPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-array-value-copy"
 
 using namespace fir;
@@ -1326,7 +1330,7 @@ public:
 };
 
 class ArrayValueCopyConverter
-    : public ArrayValueCopyBase<ArrayValueCopyConverter> {
+    : public fir::impl::ArrayValueCopyPassBase<ArrayValueCopyConverter> {
 public:
   void runOnOperation() override {
     auto func = getOperation();
index 650b990..4e10478 100644 (file)
@@ -6,19 +6,24 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "flang/Optimizer/Support/FIRContext.h"
 #include "flang/Optimizer/Support/KindMapping.h"
 #include "flang/Optimizer/Transforms/Passes.h"
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/Diagnostics.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "llvm/Support/Debug.h"
 
+namespace fir {
+#define GEN_PASS_DEF_CHARACTERCONVERSIONPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-character-conversion"
 
 namespace {
@@ -95,7 +100,7 @@ public:
 /// Rewrite the `fir.char_convert` op into a loop. This pass must be run only on
 /// fir::CharConvertOp.
 class CharacterConversion
-    : public fir::CharacterConversionBase<CharacterConversion> {
+    : public fir::impl::CharacterConversionPassBase<CharacterConversion> {
 public:
   void runOnOperation() override {
     CharacterConversionOptions clOpts{useRuntimeCalls.getValue()};
index 42260ad..31b3ab0 100644 (file)
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Support/InternalNames.h"
 #include "flang/Optimizer/Transforms/Passes.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace fir {
+#define GEN_PASS_DEF_EXTERNALNAMECONVERSIONPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 using namespace mlir;
 
 //===----------------------------------------------------------------------===//
@@ -117,7 +122,8 @@ public:
 };
 
 class ExternalNameConversionPass
-    : public fir::ExternalNameConversionBase<ExternalNameConversionPass> {
+    : public fir::impl::ExternalNameConversionPassBase<
+          ExternalNameConversionPass> {
 public:
   mlir::ModuleOp getModule() { return getOperation(); }
   void runOnOperation() override;
index 6157201..83ce302 100644 (file)
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 
+namespace fir {
+#define GEN_PASS_DEF_MEMREFDATAFLOWOPTPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "fir-memref-dataflow-opt"
 
 using namespace mlir;
@@ -94,7 +98,8 @@ private:
   mlir::DominanceInfo *domInfo;
 };
 
-class MemDataFlowOpt : public fir::MemRefDataFlowOptBase<MemDataFlowOpt> {
+class MemDataFlowOpt
+    : public fir::impl::MemRefDataFlowOptPassBase<MemDataFlowOpt> {
 public:
   void runOnOperation() override {
     mlir::func::FuncOp f = getOperation();
index 373c8e4..a170786 100644 (file)
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "mlir/Transforms/Passes.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace fir {
+#define GEN_PASS_DEF_MEMORYALLOCATIONOPTPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-memory-allocation-opt"
 
 // Number of elements in an array does not determine where it is allocated.
@@ -151,7 +155,7 @@ private:
 ///   2. If a stack allocation is an array with a runtime evaluated size make
 ///      it a heap allocation.
 class MemoryAllocationOpt
-    : public fir::MemoryAllocationOptBase<MemoryAllocationOpt> {
+    : public fir::impl::MemoryAllocationOptPassBase<MemoryAllocationOpt> {
 public:
   MemoryAllocationOpt() {
     // Set options with default values. (See Passes.td.) Note that the
diff --git a/flang/lib/Optimizer/Transforms/PassDetail.h b/flang/lib/Optimizer/Transforms/PassDetail.h
deleted file mode 100644 (file)
index c3e0db9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-//===- PassDetail.h - Optimizer Transforms Pass class details ---*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef FORTRAN_OPTMIZER_TRANSFORMS_PASSDETAIL_H
-#define FORTRAN_OPTMIZER_TRANSFORMS_PASSDETAIL_H
-
-#include "flang/Optimizer/Dialect/FIRDialect.h"
-#include "flang/Optimizer/Dialect/FIROps.h"
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/Math/IR/Math.h"
-#include "mlir/Dialect/OpenACC/OpenACC.h"
-#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
-#include "mlir/Pass/Pass.h"
-#include "mlir/Pass/PassRegistry.h"
-
-namespace fir {
-
-#define GEN_PASS_CLASSES
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-
-} // namespace fir
-
-#endif // FORTRAN_OPTMIZER_TRANSFORMS_PASSDETAIL_H
index a28aecf..b081335 100644 (file)
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Transforms/Passes.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "llvm/Support/CommandLine.h"
 
+namespace fir {
+#define GEN_PASS_DEF_CFGCONVERSIONPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 using namespace fir;
 using namespace mlir;
 
@@ -297,7 +301,7 @@ public:
 };
 
 /// Convert FIR structured control flow ops to CFG ops.
-class CfgConversion : public CFGConversionBase<CfgConversion> {
+class CfgConversion : public fir::impl::CFGConversionPassBase<CfgConversion> {
 public:
   void runOnOperation() override {
     auto *context = &getContext();
index 9a9e066..3b31700 100644 (file)
@@ -22,7 +22,6 @@
 /// and small in size.
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Builder/BoxValue.h"
 #include "flang/Optimizer/Builder/FIRBuilder.h"
 #include "flang/Optimizer/Builder/Todo.h"
@@ -30,6 +29,7 @@
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "flang/Optimizer/Support/FIRContext.h"
 #include "flang/Optimizer/Transforms/Passes.h"
+#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/IR/Matchers.h"
 #include "mlir/IR/TypeUtilities.h"
 #include "mlir/Pass/Pass.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 
+namespace fir {
+#define GEN_PASS_DEF_SIMPLIFYINTRINSICSPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 #define DEBUG_TYPE "flang-simplify-intrinsics"
 
 namespace {
 
 class SimplifyIntrinsicsPass
-    : public fir::SimplifyIntrinsicsBase<SimplifyIntrinsicsPass> {
+    : public fir::impl::SimplifyIntrinsicsPassBase<SimplifyIntrinsicsPass> {
   using FunctionTypeGeneratorTy =
       std::function<mlir::FunctionType(fir::FirOpBuilder &)>;
   using FunctionBodyGeneratorTy =
index 369d7c8..281a4df 100644 (file)
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Transforms/Passes.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "mlir/Transforms/RegionUtils.h"
 
+namespace fir {
+#define GEN_PASS_DEF_SIMPLIFYREGIONLITEPASS
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+} // namespace fir
+
 namespace {
 
 class SimplifyRegionLitePass
-    : public fir::SimplifyRegionLiteBase<SimplifyRegionLitePass> {
+    : public fir::impl::SimplifyRegionLitePassBase<SimplifyRegionLitePass> {
 public:
   void runOnOperation() override;
 };
index 7906aba..041e550 100644 (file)
@@ -17,12 +17,13 @@ class LLVMTypeConverter;
 class RewritePatternSet;
 class Pass;
 
+#define GEN_PASS_DECL_CONVERTAMDGPUTOROCDLPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 void populateAMDGPUToROCDLConversionPatterns(LLVMTypeConverter &converter,
                                              RewritePatternSet &patterns,
                                              amdgpu::Chipset chipset);
 
-std::unique_ptr<Pass> createConvertAMDGPUToROCDLPass();
-
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_AMDGPUTOROCDL_AMDGPUTOROCDL_H_
index 2fb6955..d562679 100644 (file)
@@ -23,6 +23,9 @@ class ValueRange;
 
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTAFFINETOSTANDARDPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Collect a set of patterns to convert from the Affine dialect to the Standard
 /// dialect, in particular convert structured affine control flow into CFG
 /// branch-based control flow.
@@ -40,11 +43,6 @@ Value lowerAffineLowerBound(AffineForOp op, OpBuilder &builder);
 /// standard arithmetic operations.
 Value lowerAffineUpperBound(AffineForOp op, OpBuilder &builder);
 
-/// Lowers affine control flow operations (ForStmt, IfStmt and AffineApplyOp)
-/// to equivalent lower-level constructs (flow of basic blocks and arithmetic
-/// primitives).
-std::unique_ptr<Pass> createLowerAffinePass();
-
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_AFFINETOSTANDARD_AFFINETOSTANDARD_H
index aa18558..74ee117 100644 (file)
@@ -17,11 +17,13 @@ class LLVMTypeConverter;
 class RewritePatternSet;
 class Pass;
 
+#define GEN_PASS_DECL_CONVERTARITHMETICTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 namespace arith {
 void populateArithmeticToLLVMConversionPatterns(LLVMTypeConverter &converter,
                                                 RewritePatternSet &patterns);
 
-std::unique_ptr<Pass> createConvertArithmeticToLLVMPass();
 } // namespace arith
 } // namespace mlir
 
index dfc94a8..2a0e891 100644 (file)
@@ -18,12 +18,17 @@ class SPIRVTypeConverter;
 class RewritePatternSet;
 class Pass;
 
+#define GEN_PASS_DECL_CONVERTARITHMETICTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 namespace arith {
 void populateArithmeticToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
                                        RewritePatternSet &patterns);
 
-std::unique_ptr<OperationPass<>> createConvertArithmeticToSPIRVPass();
 } // namespace arith
+
+std::unique_ptr<OperationPass<>> createConvertArithmeticToSPIRVPass();
+
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_ARITHMETICTOSPIRV_ARITHMETICTOSPIRV_H
index 5250931..860880b 100644 (file)
@@ -9,18 +9,19 @@
 #ifndef MLIR_CONVERSION_ARMNEON2DTOINTR_ARMNEON2DTOINTR_H_
 #define MLIR_CONVERSION_ARMNEON2DTOINTR_ARMNEON2DTOINTR_H_
 
-#include "mlir/Pass/Pass.h"
+#include <memory>
 
 namespace mlir {
+class Pass;
+class RewritePatternSet;
+
+#define GEN_PASS_DECL_CONVERTARMNEON2DTOINTRPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Populates patterns for the lowering of Arm NEON 2D ops to intrinsics.
 /// See createConvertArmNeon2dToIntrPass.
 void populateConvertArmNeon2dToIntrPatterns(RewritePatternSet &patterns);
 
-/// Creates a pass to lower Arm NEON 2D ops to intrinsics, i.e.
-/// equivalent ops operating on flattened 1D vectors and mapping more
-/// directly to the corresponding Arm NEON instruction.
-std::unique_ptr<Pass> createConvertArmNeon2dToIntrPass();
-
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_ARMNEON2DTOINTR_ARMNEON2DTOINTR_H_
index 56db59d..4293766 100644 (file)
@@ -21,8 +21,8 @@ class MLIRContext;
 class TypeConverter;
 class RewritePatternSet;
 
-/// Create a pass to convert Async operations to the LLVM dialect.
-std::unique_ptr<OperationPass<ModuleOp>> createConvertAsyncToLLVMPass();
+#define GEN_PASS_DECL_CONVERTASYNCTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
 
 /// Populates patterns for async structural type conversions.
 ///
@@ -36,6 +36,9 @@ void populateAsyncStructuralTypeConversionsAndLegality(
     TypeConverter &typeConverter, RewritePatternSet &patterns,
     ConversionTarget &target);
 
+/// Create a pass to convert Async operations to the LLVM dialect.
+std::unique_ptr<OperationPass<ModuleOp>> createConvertAsyncToLLVMPass();
+
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_ASYNCTOLLVM_ASYNCTOLLVM_H
index d8cb152..3b16d6d 100644 (file)
@@ -15,12 +15,14 @@ namespace mlir {
 class Pass;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREFPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Collect a set of patterns to convert memory-related operations from the
 /// Bufferization dialect to the MemRef dialect.
 void populateBufferizationToMemRefConversionPatterns(
     RewritePatternSet &patterns);
 
-std::unique_ptr<Pass> createBufferizationToMemRefPass();
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_BUFFERIZATIONTOMEMREF_BUFFERIZATIONTOMEMREF_H
index 4869906..85ed7a1 100644 (file)
@@ -15,6 +15,9 @@ class LLVMTypeConverter;
 class Pass;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTCOMPLEXTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 class ComplexStructBuilder : public StructBuilder {
 public:
   /// Construct a helper for the given complex number value.
@@ -38,9 +41,6 @@ public:
 void populateComplexToLLVMConversionPatterns(LLVMTypeConverter &converter,
                                              RewritePatternSet &patterns);
 
-/// Create a pass to convert Complex operations to the LLVMIR dialect.
-std::unique_ptr<Pass> createConvertComplexToLLVMPass();
-
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_COMPLEXTOLLVM_COMPLEXTOLLVM_H_
index e86d8e2..d6c9d3c 100644 (file)
@@ -14,6 +14,9 @@ namespace mlir {
 template <typename T>
 class OperationPass;
 
+#define GEN_PASS_DECL_CONVERTCOMPLEXTOLIBMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Populate the given list with patterns that convert from Complex to Libm
 /// calls.
 void populateComplexToLibmConversionPatterns(RewritePatternSet &patterns,
index b0e69db..9e27cc8 100644 (file)
@@ -14,12 +14,12 @@ namespace mlir {
 class RewritePatternSet;
 class Pass;
 
+#define GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARDPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Populate the given list with patterns that convert from Complex to Standard.
 void populateComplexToStandardConversionPatterns(RewritePatternSet &patterns);
 
-/// Create a pass to convert Complex operations to the Standard dialect.
-std::unique_ptr<Pass> createConvertComplexToStandardPass();
-
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_COMPLEXTOSTANDARD_COMPLEXTOSTANDARD_H_
index 92608c7..f1aa7cd 100644 (file)
@@ -20,6 +20,9 @@ class LLVMTypeConverter;
 class RewritePatternSet;
 class Pass;
 
+#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 namespace cf {
 /// Collect the patterns to convert from the ControlFlow dialect to LLVM. The
 /// conversion patterns capture the LLVMTypeConverter by reference meaning the
@@ -27,8 +30,6 @@ namespace cf {
 void populateControlFlowToLLVMConversionPatterns(LLVMTypeConverter &converter,
                                                  RewritePatternSet &patterns);
 
-/// Creates a pass to convert the ControlFlow dialect into the LLVMIR dialect.
-std::unique_ptr<Pass> createConvertControlFlowToLLVMPass();
 } // namespace cf
 } // namespace mlir
 
index 9259626..3e82be7 100644 (file)
@@ -18,6 +18,9 @@
 namespace mlir {
 class ModuleOp;
 
+#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to convert ControlFlow ops to SPIR-V ops.
 std::unique_ptr<OperationPass<>> createConvertControlFlowToSPIRVPass();
 
index 399ca89..16b3a5f 100644 (file)
@@ -10,6 +10,7 @@
 #define MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVMPASS_H_
 
 #include <memory>
+#include <string>
 
 namespace mlir {
 class LowerToLLVMOptions;
@@ -18,6 +19,9 @@ template <typename T>
 class OperationPass;
 class Pass;
 
+#define GEN_PASS_DECL_CONVERTFUNCTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to convert the Func dialect into the LLVMIR dialect.
 std::unique_ptr<OperationPass<ModuleOp>> createConvertFuncToLLVMPass();
 std::unique_ptr<OperationPass<ModuleOp>>
index 8329a54..cc158b7 100644 (file)
@@ -18,6 +18,9 @@
 namespace mlir {
 class ModuleOp;
 
+#define GEN_PASS_DECL_CONVERTFUNCTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to convert Func ops to SPIR-V ops.
 std::unique_ptr<OperationPass<>> createConvertFuncToSPIRVPass();
 
index 79be00a..2282631 100644 (file)
@@ -38,12 +38,22 @@ namespace LLVM {
 class LLVMDialect;
 } // namespace LLVM
 
+#define GEN_PASS_DECL_CONVERTGPUTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 using OwnedBlob = std::unique_ptr<std::vector<char>>;
 using BlobGenerator =
     std::function<OwnedBlob(const std::string &, Location, StringRef)>;
 using LoweringCallback = std::function<std::unique_ptr<llvm::Module>(
     Operation *, llvm::LLVMContext &, StringRef)>;
 
+/// Collect a set of patterns to convert from the GPU dialect to LLVM and
+/// populate converter for gpu types.
+void populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter,
+                                         RewritePatternSet &patterns,
+                                         StringRef gpuBinaryAnnotation = {},
+                                         bool kernelBarePtrCallConv = false);
+
 /// Creates a pass to convert a GPU operations into a sequence of GPU runtime
 /// calls.
 ///
@@ -51,14 +61,7 @@ using LoweringCallback = std::function<std::unique_ptr<llvm::Module>(
 /// instead uses a small wrapper library that exports a stable and conveniently
 /// typed ABI on top of GPU runtimes such as CUDA or ROCm (HIP).
 std::unique_ptr<OperationPass<ModuleOp>>
-createGpuToLLVMConversionPass(bool kernelBarePtrCallConv = false);
-
-/// Collect a set of patterns to convert from the GPU dialect to LLVM and
-/// populate converter for gpu types.
-void populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter,
-                                         RewritePatternSet &patterns,
-                                         StringRef gpuBinaryAnnotation = {},
-                                         bool kernelBarePtrCallConv = false);
+createConvertGpuToLLVMPass(bool kernelBarePtrCallConv = false);
 
 } // namespace mlir
 
index 7d031f4..f0cf674 100644 (file)
@@ -25,6 +25,9 @@ class GPUModuleOp;
 class MMAMatrixType;
 } // namespace gpu
 
+#define GEN_PASS_DECL_CONVERTGPUTONVVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 LLVM::LLVMStructType convertMMAToLLVMType(gpu::MMAMatrixType type);
 
 /// Configure target to convert from the GPU dialect to NVVM.
@@ -41,7 +44,7 @@ void populateGpuWMMAToNVVMConversionPatterns(LLVMTypeConverter &converter,
 /// Creates a pass that lowers GPU dialect operations to NVVM counterparts. The
 /// index bitwidth used for the lowering of the device side index computations
 /// is configurable.
-std::unique_ptr<OperationPass<gpu::GPUModuleOp>> createLowerGpuOpsToNVVMOpsPass(
+std::unique_ptr<OperationPass<gpu::GPUModuleOp>> createConvertGpuToNVVMPass(
     unsigned indexBitwidth = kDeriveIndexBitwidthFromDataLayout);
 
 } // namespace mlir
index 8e45d74..4891c98 100644 (file)
@@ -24,6 +24,9 @@ namespace gpu {
 class GPUModuleOp;
 } // namespace gpu
 
+#define GEN_PASS_DECL_CONVERTGPUTOROCDLPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Collect a set of patterns to convert from the GPU dialect to ROCDL.
 /// If `runtime` is Unknown, gpu.printf will not be lowered
 /// The resulting pattern set should be run over a gpu.module op
@@ -37,8 +40,7 @@ void configureGpuToROCDLConversionLegality(ConversionTarget &target);
 /// Creates a pass that lowers GPU dialect operations to ROCDL counterparts. The
 /// index bitwidth used for the lowering of the device side index computations
 /// is configurable.
-std::unique_ptr<OperationPass<gpu::GPUModuleOp>>
-createLowerGpuOpsToROCDLOpsPass(
+std::unique_ptr<OperationPass<gpu::GPUModuleOp>> createConvertGpuToROCDLPass(
     const std::string &chipset = "gfx900",
     unsigned indexBitwidth = kDeriveIndexBitwidthFromDataLayout,
     bool useBarePtrCallConv = false,
index 8867c96..be5c91e 100644 (file)
@@ -21,6 +21,9 @@ class ModuleOp;
 template <typename T>
 class OperationPass;
 
+#define GEN_PASS_DECL_CONVERTGPUTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to convert GPU kernel ops to corresponding SPIR-V ops. For a
 /// gpu.func to be converted, it should have a spv.entry_point_abi attribute.
 /// If `mapMemorySpace` is true, performs MemRef memory space to SPIR-V mapping
index fe54388..7caf7ad 100644 (file)
@@ -24,6 +24,10 @@ class ModuleOp;
 template <typename T>
 class OperationPass;
 
+#define GEN_PASS_DECL_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS
+#define GEN_PASS_DECL_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNCPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 std::unique_ptr<OperationPass<ModuleOp>>
 createConvertVulkanLaunchFuncToVulkanCallsPass();
 
index 9973b38..abb4d0b 100644 (file)
@@ -18,6 +18,9 @@ template <typename T>
 class OperationPass;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTLINALGTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Populate the given list with patterns that convert from Linalg to LLVM.
 void populateLinalgToLLVMConversionPatterns(LLVMTypeConverter &converter,
                                             RewritePatternSet &patterns);
index f184fdf..64eb7fa 100644 (file)
 #ifndef MLIR_CONVERSION_LINALGTOSPIRV_LINALGTOSPIRVPASS_H
 #define MLIR_CONVERSION_LINALGTOSPIRV_LINALGTOSPIRVPASS_H
 
-#include "mlir/Pass/Pass.h"
+#include <memory>
 
 namespace mlir {
 class ModuleOp;
+template <typename T>
+class OperationPass;
+
+#define GEN_PASS_DECL_CONVERTLINALGTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
 
 /// Creates and returns a pass to convert Linalg ops to SPIR-V ops.
-std::unique_ptr<OperationPass<ModuleOp>> createLinalgToSPIRVPass();
+std::unique_ptr<OperationPass<ModuleOp>> createConvertLinalgToSPIRVPass();
 
 } // namespace mlir
 
index a891962..0b6e8e0 100644 (file)
@@ -17,6 +17,9 @@ class ModuleOp;
 template <typename T>
 class OperationPass;
 
+#define GEN_PASS_DECL_CONVERTLINALGTOSTANDARDPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 namespace linalg {
 
 //===----------------------------------------------------------------------===//
index f759500..de53d22 100644 (file)
@@ -14,9 +14,9 @@
 namespace mlir {
 class Pass;
 
-// Pass to convert some Math operations into calls of functions
-// containing software implementation of these operations.
-std::unique_ptr<Pass> createConvertMathToFuncsPass();
+#define GEN_PASS_DECL_CONVERTMATHTOFUNCSPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_MATHTOFUNCS_MATHTOFUNCS_H
index d03bc29..17ca901 100644 (file)
@@ -17,10 +17,12 @@ class LLVMTypeConverter;
 class RewritePatternSet;
 class Pass;
 
+#define GEN_PASS_DECL_CONVERTMATHTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 void populateMathToLLVMConversionPatterns(LLVMTypeConverter &converter,
                                           RewritePatternSet &patterns);
 
-std::unique_ptr<Pass> createConvertMathToLLVMPass();
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_MATHTOLLVM_MATHTOLLVM_H
index c07dcfd..0affcee 100644 (file)
@@ -14,6 +14,9 @@ namespace mlir {
 template <typename T>
 class OperationPass;
 
+#define GEN_PASS_DECL_CONVERTMATHTOLIBMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Populate the given list with patterns that convert from Math to Libm calls.
 /// If log1pBenefit is present, use it instead of benefit for the Log1p op.
 void populateMathToLibmConversionPatterns(
index 0281315..0ce27ef 100644 (file)
@@ -18,6 +18,9 @@
 namespace mlir {
 class ModuleOp;
 
+#define GEN_PASS_DECL_CONVERTMATHTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to convert Math ops to SPIR-V ops.
 std::unique_ptr<OperationPass<>> createConvertMathToSPIRVPass();
 
index 732f0bd..e02b48d 100644 (file)
@@ -16,12 +16,14 @@ class Pass;
 class LLVMTypeConverter;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTMEMREFTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Collect a set of patterns to convert memory-related operations from the
 /// MemRef dialect to the LLVM dialect.
 void populateMemRefToLLVMConversionPatterns(LLVMTypeConverter &converter,
                                             RewritePatternSet &patterns);
 
-std::unique_ptr<Pass> createMemRefToLLVMPass();
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_MEMREFTOLLVM_MEMREFTOLLVM_H
index bd449ea..97d7a13 100644 (file)
 namespace mlir {
 class ModuleOp;
 
+#define GEN_PASS_DECL_MAPMEMREFSTORAGECLASSPASS
+#define GEN_PASS_DECL_CONVERTMEMREFTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to map numeric MemRef memory spaces to symbolic SPIR-V
 /// storage classes. The mapping is read from the command-line option.
 std::unique_ptr<OperationPass<>> createMapMemRefStorageClassPass();
index 05dd975..a7d28c8 100644 (file)
@@ -16,11 +16,12 @@ class LLVMTypeConverter;
 class RewritePatternSet;
 class Pass;
 
+#define GEN_PASS_DECL_CONVERTNVGPUTONVVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 void populateNVGPUToNVVMConversionPatterns(LLVMTypeConverter &converter,
                                            RewritePatternSet &patterns);
 
-std::unique_ptr<Pass> createConvertNVGPUToNVVMPass();
-
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_NVGPUTONVVM_NVGPUTONVVMPASS_H_
index e6b682e..9ccf142 100644 (file)
@@ -18,6 +18,9 @@ template <typename T>
 class OperationPass;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTOPENACCTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 static constexpr unsigned kPtrBasePosInDataDescriptor = 0;
 static constexpr unsigned kPtrPosInDataDescriptor = 1;
 static constexpr unsigned kSizePosInDataDescriptor = 2;
index 50d6bd8..12d3037 100644 (file)
@@ -16,6 +16,9 @@ template <typename T>
 class OperationPass;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTOPENACCTOSCFPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Collect the patterns to convert from the OpenACC dialect to OpenACC with
 /// SCF dialect.
 void populateOpenACCToSCFConversionPatterns(RewritePatternSet &patterns);
index b27cd40..d597932 100644 (file)
@@ -19,6 +19,9 @@ template <typename T>
 class OperationPass;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTOOPENMPTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Configure dynamic conversion legality of regionless operations from OpenMP
 /// to LLVM.
 void configureOpenMPToLLVMConversionLegality(ConversionTarget &target,
index 4101300..2cd488c 100644 (file)
@@ -20,6 +20,9 @@ class ModuleOp;
 template <typename OpT>
 class OperationPass;
 
+#define GEN_PASS_DECL_CONVERTPDLTOPDLINTERPPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates and returns a pass to convert PDL ops to PDL interpreter ops.
 std::unique_ptr<OperationPass<ModuleOp>> createPDLToPDLInterpPass();
 
index 87946c9..5716a10 100644 (file)
@@ -15,7 +15,7 @@ include "mlir/Pass/PassBase.td"
 // AffineToStandard
 //===----------------------------------------------------------------------===//
 
-def ConvertAffineToStandard : Pass<"lower-affine"> {
+def ConvertAffineToStandardPass : Pass<"lower-affine"> {
   let summary = "Lower Affine operations to a combination of Standard and SCF "
                 "operations";
   let description = [{
@@ -65,7 +65,6 @@ def ConvertAffineToStandard : Pass<"lower-affine"> {
         if they do not depend on the loop iterator value or on the result of
         `affine.apply`.
   }];
-  let constructor = "mlir::createLowerAffinePass()";
   let dependentDialects = [
     "memref::MemRefDialect",
     "scf::SCFDialect",
@@ -77,12 +76,11 @@ def ConvertAffineToStandard : Pass<"lower-affine"> {
 // AMDGPUToROCDL
 //===----------------------------------------------------------------------===//
 
-def ConvertAMDGPUToROCDL : Pass<"convert-amdgpu-to-rocdl"> {
+def ConvertAMDGPUToROCDLPass : Pass<"convert-amdgpu-to-rocdl"> {
   let summary = "Convert AMDGPU dialect to ROCDL dialect";
   let description = [{
     This pass converts supported AMDGPU ops to ROCDL dialect intrinsics.
   }];
-  let constructor = "mlir::createConvertAMDGPUToROCDLPass()";
   let dependentDialects = [
     "LLVM::LLVMDialect",
     "ROCDL::ROCDLDialect",
@@ -96,12 +94,11 @@ def ConvertAMDGPUToROCDL : Pass<"convert-amdgpu-to-rocdl"> {
 // ArithmeticToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertArithmeticToLLVM : Pass<"convert-arith-to-llvm"> {
+def ConvertArithmeticToLLVMPass : Pass<"convert-arith-to-llvm"> {
   let summary = "Convert Arithmetic dialect to LLVM dialect";
   let description = [{
     This pass converts supported Arithmetic ops to LLVM dialect instructions.
   }];
-  let constructor = "mlir::arith::createConvertArithmeticToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];
   let options = [
     Option<"indexBitwidth", "index-bitwidth", "unsigned",
@@ -114,9 +111,9 @@ def ConvertArithmeticToLLVM : Pass<"convert-arith-to-llvm"> {
 // ArithmeticToSPIRV
 //===----------------------------------------------------------------------===//
 
-def ConvertArithmeticToSPIRV : Pass<"convert-arith-to-spirv"> {
+def ConvertArithmeticToSPIRVPass : Pass<"convert-arith-to-spirv"> {
   let summary = "Convert Arithmetic dialect to SPIR-V dialect";
-  let constructor = "mlir::arith::createConvertArithmeticToSPIRVPass()";
+  let constructor = "mlir::createConvertArithmeticToSPIRVPass()";
   let dependentDialects = ["spirv::SPIRVDialect"];
   let options = [
     Option<"emulateNon32BitScalarTypes", "emulate-non-32-bit-scalar-types",
@@ -130,9 +127,13 @@ def ConvertArithmeticToSPIRV : Pass<"convert-arith-to-spirv"> {
 // ArmNeon2dToIntr
 //===----------------------------------------------------------------------===//
 
-def ConvertArmNeon2dToIntr : Pass<"arm-neon-2d-to-intr"> {
+def ConvertArmNeon2dToIntrPass : Pass<"arm-neon-2d-to-intr"> {
   let summary = "Convert Arm NEON structured ops to intrinsics";
-  let constructor = "mlir::createConvertArmNeon2dToIntrPass()";
+  let description = [{
+      Lower Arm NEON 2D ops to intrinsics, i.e. equivalent ops operating on
+      flattened 1D vectors and mapping more directly to the corresponding Arm
+      NEON instruction.
+  }];
   let dependentDialects = ["arm_neon::ArmNeonDialect", "vector::VectorDialect"];
 }
 
@@ -140,7 +141,7 @@ def ConvertArmNeon2dToIntr : Pass<"arm-neon-2d-to-intr"> {
 // AsyncToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertAsyncToLLVM : Pass<"convert-async-to-llvm", "ModuleOp"> {
+def ConvertAsyncToLLVMPass : Pass<"convert-async-to-llvm", "ModuleOp"> {
   let summary = "Convert the operations from the async dialect into the LLVM "
                 "dialect";
   let description = [{
@@ -158,7 +159,7 @@ def ConvertAsyncToLLVM : Pass<"convert-async-to-llvm", "ModuleOp"> {
 // BufferizationToMemRef
 //===----------------------------------------------------------------------===//
 
-def ConvertBufferizationToMemRef : Pass<"convert-bufferization-to-memref"> {
+def ConvertBufferizationToMemRefPass : Pass<"convert-bufferization-to-memref"> {
   let summary = "Convert operations from the Bufferization dialect to the "
                 "MemRef dialect";
   let description = [{
@@ -185,7 +186,6 @@ def ConvertBufferizationToMemRef : Pass<"convert-bufferization-to-memref"> {
     and hence does not resolve any memory leaks.
 
   }];
-  let constructor = "mlir::createBufferizationToMemRefPass()";
   let dependentDialects = ["arith::ArithmeticDialect", "memref::MemRefDialect"];
 }
 
@@ -193,9 +193,8 @@ def ConvertBufferizationToMemRef : Pass<"convert-bufferization-to-memref"> {
 // ComplexToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertComplexToLLVM : Pass<"convert-complex-to-llvm"> {
+def ConvertComplexToLLVMPass : Pass<"convert-complex-to-llvm"> {
   let summary = "Convert Complex dialect to LLVM dialect";
-  let constructor = "mlir::createConvertComplexToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];
 }
 
@@ -203,7 +202,7 @@ def ConvertComplexToLLVM : Pass<"convert-complex-to-llvm"> {
 // ComplexToLibm
 //===----------------------------------------------------------------------===//
 
-def ConvertComplexToLibm : Pass<"convert-complex-to-libm", "ModuleOp"> {
+def ConvertComplexToLibmPass : Pass<"convert-complex-to-libm", "ModuleOp"> {
   let summary = "Convert Complex dialect to libm calls";
   let description = [{
     This pass converts supported Complex ops to libm calls.
@@ -218,9 +217,8 @@ def ConvertComplexToLibm : Pass<"convert-complex-to-libm", "ModuleOp"> {
 // ComplexToStandard
 //===----------------------------------------------------------------------===//
 
-def ConvertComplexToStandard : Pass<"convert-complex-to-standard"> {
+def ConvertComplexToStandardPass : Pass<"convert-complex-to-standard"> {
   let summary = "Convert Complex dialect to standard dialect";
-  let constructor = "mlir::createConvertComplexToStandardPass()";
   let dependentDialects = ["math::MathDialect"];
 }
 
@@ -228,7 +226,7 @@ def ConvertComplexToStandard : Pass<"convert-complex-to-standard"> {
 // ControlFlowToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertControlFlowToLLVM : Pass<"convert-cf-to-llvm", "ModuleOp"> {
+def ConvertControlFlowToLLVMPass : Pass<"convert-cf-to-llvm", "ModuleOp"> {
   let summary = "Convert ControlFlow operations to the LLVM dialect";
   let description = [{
     Convert ControlFlow operations into LLVM IR dialect operations.
@@ -237,7 +235,6 @@ def ConvertControlFlowToLLVM : Pass<"convert-cf-to-llvm", "ModuleOp"> {
     IR dialect operations, the pass will fail.  Any LLVM IR operations or types
     already present in the IR will be kept as is.
   }];
-  let constructor = "mlir::cf::createConvertControlFlowToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];
   let options = [
     Option<"indexBitwidth", "index-bitwidth", "unsigned",
@@ -250,7 +247,7 @@ def ConvertControlFlowToLLVM : Pass<"convert-cf-to-llvm", "ModuleOp"> {
 // ControlFlowToSPIRV
 //===----------------------------------------------------------------------===//
 
-def ConvertControlFlowToSPIRV : Pass<"convert-cf-to-spirv"> {
+def ConvertControlFlowToSPIRVPass : Pass<"convert-cf-to-spirv"> {
   let summary = "Convert ControlFlow dialect to SPIR-V dialect";
   let constructor = "mlir::createConvertControlFlowToSPIRVPass()";
   let dependentDialects = ["spirv::SPIRVDialect"];
@@ -266,7 +263,7 @@ def ConvertControlFlowToSPIRV : Pass<"convert-cf-to-spirv"> {
 // FuncToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertFuncToLLVM : Pass<"convert-func-to-llvm", "ModuleOp"> {
+def ConvertFuncToLLVMPass : Pass<"convert-func-to-llvm", "ModuleOp"> {
   let summary = "Convert from the Func dialect to the LLVM dialect";
   let description = [{
     Convert Func dialect operations into the LLVM IR dialect operations.
@@ -311,7 +308,7 @@ def ConvertFuncToLLVM : Pass<"convert-func-to-llvm", "ModuleOp"> {
 // FuncToSPIRV
 //===----------------------------------------------------------------------===//
 
-def ConvertFuncToSPIRV : Pass<"convert-func-to-spirv"> {
+def ConvertFuncToSPIRVPass : Pass<"convert-func-to-spirv"> {
   let summary = "Convert Func dialect to SPIR-V dialect";
   let constructor = "mlir::createConvertFuncToSPIRVPass()";
   let dependentDialects = ["spirv::SPIRVDialect"];
@@ -327,13 +324,13 @@ def ConvertFuncToSPIRV : Pass<"convert-func-to-spirv"> {
 // GPUCommon
 //===----------------------------------------------------------------------===//
 
-def GpuToLLVMConversionPass : Pass<"gpu-to-llvm", "ModuleOp"> {
+def ConvertGpuToLLVMPass : Pass<"gpu-to-llvm", "ModuleOp"> {
   let summary = "Convert GPU dialect to LLVM dialect with GPU runtime calls";
-  let constructor = "mlir::createGpuToLLVMConversionPass()";
+  let constructor = "mlir::createConvertGpuToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];
 }
 
-def LowerHostCodeToLLVM : Pass<"lower-host-to-llvm", "ModuleOp"> {
+def LowerHostCodeToLLVMPass : Pass<"lower-host-to-llvm", "ModuleOp"> {
   let summary = "Lowers the host module code and `gpu.launch_func` to LLVM";
   let constructor = "mlir::createLowerHostCodeToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];
@@ -343,9 +340,9 @@ def LowerHostCodeToLLVM : Pass<"lower-host-to-llvm", "ModuleOp"> {
 // GPUToNVVM
 //===----------------------------------------------------------------------===//
 
-def ConvertGpuOpsToNVVMOps : Pass<"convert-gpu-to-nvvm", "gpu::GPUModuleOp"> {
+def ConvertGpuToNVVMPass : Pass<"convert-gpu-to-nvvm", "gpu::GPUModuleOp"> {
   let summary = "Generate NVVM operations for gpu operations";
-  let constructor = "mlir::createLowerGpuOpsToNVVMOpsPass()";
+  let constructor = "mlir::createConvertGpuToNVVMPass()";
   let dependentDialects = [
     "cf::ControlFlowDialect",
     "memref::MemRefDialect",
@@ -362,9 +359,9 @@ def ConvertGpuOpsToNVVMOps : Pass<"convert-gpu-to-nvvm", "gpu::GPUModuleOp"> {
 // GPUToROCDL
 //===----------------------------------------------------------------------===//
 
-def ConvertGpuOpsToROCDLOps : Pass<"convert-gpu-to-rocdl", "gpu::GPUModuleOp"> {
+def ConvertGpuToROCDLPass : Pass<"convert-gpu-to-rocdl", "gpu::GPUModuleOp"> {
   let summary = "Generate ROCDL operations for gpu operations";
-  let constructor = "mlir::createLowerGpuOpsToROCDLOpsPass()";
+  let constructor = "mlir::createConvertGpuToROCDLPass()";
   let dependentDialects = ["ROCDL::ROCDLDialect"];
   let options = [
     Option<"chipset", "chipset", "std::string",
@@ -392,7 +389,7 @@ def ConvertGpuOpsToROCDLOps : Pass<"convert-gpu-to-rocdl", "gpu::GPUModuleOp"> {
 // GPUToSPIRV
 //===----------------------------------------------------------------------===//
 
-def ConvertGPUToSPIRV : Pass<"convert-gpu-to-spirv", "ModuleOp"> {
+def ConvertGPUToSPIRVPass : Pass<"convert-gpu-to-spirv", "ModuleOp"> {
   let summary = "Convert GPU dialect to SPIR-V dialect";
   let description = [{
     This pass converts supported GPU device ops to SPIR-V ops. It does not
@@ -414,7 +411,7 @@ def ConvertGPUToSPIRV : Pass<"convert-gpu-to-spirv", "ModuleOp"> {
 // GPUToVulkan
 //===----------------------------------------------------------------------===//
 
-def ConvertGpuLaunchFuncToVulkanLaunchFunc
+def ConvertGpuLaunchFuncToVulkanLaunchFuncPass
     : Pass<"convert-gpu-launch-to-vulkan-launch", "ModuleOp"> {
   let summary = "Convert gpu.launch_func to vulkanLaunch external call";
   let description = [{
@@ -424,7 +421,7 @@ def ConvertGpuLaunchFuncToVulkanLaunchFunc
   let dependentDialects = ["spirv::SPIRVDialect"];
 }
 
-def ConvertVulkanLaunchFuncToVulkanCalls
+def ConvertVulkanLaunchFuncToVulkanCallsPass
     : Pass<"launch-func-to-vulkan", "ModuleOp"> {
   let summary = "Convert vulkanLaunch external call to Vulkan runtime external "
                 "calls";
@@ -439,7 +436,7 @@ def ConvertVulkanLaunchFuncToVulkanCalls
 // LinalgToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertLinalgToLLVM : Pass<"convert-linalg-to-llvm", "ModuleOp"> {
+def ConvertLinalgToLLVMPass : Pass<"convert-linalg-to-llvm", "ModuleOp"> {
   let summary = "Convert the operations from the linalg dialect into the LLVM "
                 "dialect";
   let constructor = "mlir::createConvertLinalgToLLVMPass()";
@@ -450,7 +447,7 @@ def ConvertLinalgToLLVM : Pass<"convert-linalg-to-llvm", "ModuleOp"> {
 // LinalgToStandard
 //===----------------------------------------------------------------------===//
 
-def ConvertLinalgToStandard : Pass<"convert-linalg-to-std", "ModuleOp"> {
+def ConvertLinalgToStandardPass : Pass<"convert-linalg-to-std", "ModuleOp"> {
   let summary = "Convert the operations from the linalg dialect into the "
                 "Standard dialect";
   let constructor = "mlir::createConvertLinalgToStandardPass()";
@@ -461,13 +458,13 @@ def ConvertLinalgToStandard : Pass<"convert-linalg-to-std", "ModuleOp"> {
 // LinalgToSPIRV
 //===----------------------------------------------------------------------===//
 
-def ConvertLinalgToSPIRV : Pass<"convert-linalg-to-spirv", "ModuleOp"> {
+def ConvertLinalgToSPIRVPass : Pass<"convert-linalg-to-spirv", "ModuleOp"> {
   let summary = "Convert Linalg dialect to SPIR-V dialect";
   let description = [{
     This pass converts supported Linalg ops to SPIR-V ops. It's quite
     experimental and are expected to migrate to other proper conversions.
   }];
-  let constructor = "mlir::createLinalgToSPIRVPass()";
+  let constructor = "mlir::createConvertLinalgToSPIRVPass()";
   let dependentDialects = ["spirv::SPIRVDialect"];
 }
 
@@ -475,7 +472,7 @@ def ConvertLinalgToSPIRV : Pass<"convert-linalg-to-spirv", "ModuleOp"> {
 // MathToLibm
 //===----------------------------------------------------------------------===//
 
-def ConvertMathToLibm : Pass<"convert-math-to-libm", "ModuleOp"> {
+def ConvertMathToLibmPass : Pass<"convert-math-to-libm", "ModuleOp"> {
   let summary = "Convert Math dialect to libm calls";
   let description = [{
     This pass converts supported Math ops to libm calls.
@@ -492,12 +489,11 @@ def ConvertMathToLibm : Pass<"convert-math-to-libm", "ModuleOp"> {
 // MathToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertMathToLLVM : Pass<"convert-math-to-llvm"> {
+def ConvertMathToLLVMPass : Pass<"convert-math-to-llvm"> {
   let summary = "Convert Math dialect to LLVM dialect";
   let description = [{
     This pass converts supported Math ops to LLVM dialect intrinsics.
   }];
-  let constructor = "mlir::createConvertMathToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];
 }
 
@@ -505,7 +501,7 @@ def ConvertMathToLLVM : Pass<"convert-math-to-llvm"> {
 // MathToSPIRV
 //===----------------------------------------------------------------------===//
 
-def ConvertMathToSPIRV : Pass<"convert-math-to-spirv"> {
+def ConvertMathToSPIRVPass : Pass<"convert-math-to-spirv"> {
   let summary = "Convert Math dialect to SPIR-V dialect";
   let constructor = "mlir::createConvertMathToSPIRVPass()";
   let dependentDialects = ["spirv::SPIRVDialect"];
@@ -515,14 +511,13 @@ def ConvertMathToSPIRV : Pass<"convert-math-to-spirv"> {
 // MathToFuncs
 //===----------------------------------------------------------------------===//
 
-def ConvertMathToFuncs : Pass<"convert-math-to-funcs", "ModuleOp"> {
+def ConvertMathToFuncsPass : Pass<"convert-math-to-funcs", "ModuleOp"> {
   let summary = "Convert Math operations to calls of outlined implementations.";
   let description = [{
     This pass converts supported Math ops to calls of compiler generated
     functions implementing these operations in software.
     The LLVM dialect is used for LinkonceODR linkage of the generated functions.
   }];
-  let constructor = "mlir::createConvertMathToFuncsPass()";
   let dependentDialects = [
     "arith::ArithmeticDialect",
     "cf::ControlFlowDialect",
@@ -536,10 +531,9 @@ def ConvertMathToFuncs : Pass<"convert-math-to-funcs", "ModuleOp"> {
 // MemRefToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertMemRefToLLVM : Pass<"convert-memref-to-llvm", "ModuleOp"> {
+def ConvertMemRefToLLVMPass : Pass<"convert-memref-to-llvm", "ModuleOp"> {
   let summary = "Convert operations from the MemRef dialect to the LLVM "
                 "dialect";
-  let constructor = "mlir::createMemRefToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];
   let options = [
     Option<"useAlignedAlloc", "use-aligned-alloc", "bool", /*default=*/"false",
@@ -559,7 +553,7 @@ def ConvertMemRefToLLVM : Pass<"convert-memref-to-llvm", "ModuleOp"> {
 // MemRefToSPIRV
 //===----------------------------------------------------------------------===//
 
-def MapMemRefStorageClass : Pass<"map-memref-spirv-storage-class"> {
+def MapMemRefStorageClassPass : Pass<"map-memref-spirv-storage-class"> {
   let summary = "Map numeric MemRef memory spaces to SPIR-V storage classes";
   let constructor = "mlir::createMapMemRefStorageClassPass()";
   let dependentDialects = ["spirv::SPIRVDialect"];
@@ -569,7 +563,7 @@ def MapMemRefStorageClass : Pass<"map-memref-spirv-storage-class"> {
   ];
 }
 
-def ConvertMemRefToSPIRV : Pass<"convert-memref-to-spirv"> {
+def ConvertMemRefToSPIRVPass : Pass<"convert-memref-to-spirv"> {
   let summary = "Convert MemRef dialect to SPIR-V dialect";
   let constructor = "mlir::createConvertMemRefToSPIRVPass()";
   let dependentDialects = ["spirv::SPIRVDialect"];
@@ -584,12 +578,11 @@ def ConvertMemRefToSPIRV : Pass<"convert-memref-to-spirv"> {
 // NVGPUToNVVM
 //===----------------------------------------------------------------------===//
 
-def ConvertNVGPUToNVVM : Pass<"convert-nvgpu-to-nvvm"> {
+def ConvertNVGPUToNVVMPass : Pass<"convert-nvgpu-to-nvvm"> {
   let summary = "Convert NVGPU dialect to NVVM dialect";
   let description = [{
     This pass converts supported NVGPU ops to NVVM dialect intrinsics.
   }];
-  let constructor = "mlir::createConvertNVGPUToNVVMPass()";
   let dependentDialects = [
     "NVVM::NVVMDialect",
   ];
@@ -600,7 +593,7 @@ def ConvertNVGPUToNVVM : Pass<"convert-nvgpu-to-nvvm"> {
 // OpenACCToSCF
 //===----------------------------------------------------------------------===//
 
-def ConvertOpenACCToSCF : Pass<"convert-openacc-to-scf", "ModuleOp"> {
+def ConvertOpenACCToSCFPass : Pass<"convert-openacc-to-scf", "ModuleOp"> {
   let summary = "Convert the OpenACC ops to OpenACC with SCF dialect";
   let constructor = "mlir::createConvertOpenACCToSCFPass()";
   let dependentDialects = ["scf::SCFDialect", "acc::OpenACCDialect"];
@@ -610,7 +603,7 @@ def ConvertOpenACCToSCF : Pass<"convert-openacc-to-scf", "ModuleOp"> {
 // OpenACCToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertOpenACCToLLVM : Pass<"convert-openacc-to-llvm", "ModuleOp"> {
+def ConvertOpenACCToLLVMPass : Pass<"convert-openacc-to-llvm", "ModuleOp"> {
   let summary = "Convert the OpenACC ops to LLVM dialect";
   let constructor = "mlir::createConvertOpenACCToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];
@@ -620,7 +613,7 @@ def ConvertOpenACCToLLVM : Pass<"convert-openacc-to-llvm", "ModuleOp"> {
 // OpenMPToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertOpenMPToLLVM : Pass<"convert-openmp-to-llvm", "ModuleOp"> {
+def ConvertOpenMPToLLVMPass : Pass<"convert-openmp-to-llvm", "ModuleOp"> {
   let summary = "Convert the OpenMP ops to OpenMP ops with LLVM dialect";
   let constructor = "mlir::createConvertOpenMPToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];
@@ -630,7 +623,7 @@ def ConvertOpenMPToLLVM : Pass<"convert-openmp-to-llvm", "ModuleOp"> {
 // PDLToPDLInterp
 //===----------------------------------------------------------------------===//
 
-def ConvertPDLToPDLInterp : Pass<"convert-pdl-to-pdl-interp", "ModuleOp"> {
+def ConvertPDLToPDLInterpPass : Pass<"convert-pdl-to-pdl-interp", "ModuleOp"> {
   let summary = "Convert PDL ops to PDL interpreter ops";
   let constructor = "mlir::createPDLToPDLInterpPass()";
   let dependentDialects = ["pdl_interp::PDLInterpDialect"];
@@ -640,7 +633,7 @@ def ConvertPDLToPDLInterp : Pass<"convert-pdl-to-pdl-interp", "ModuleOp"> {
 // ReconcileUnrealizedCasts
 //===----------------------------------------------------------------------===//
 
-def ReconcileUnrealizedCasts : Pass<"reconcile-unrealized-casts"> {
+def ReconcileUnrealizedCastsPass : Pass<"reconcile-unrealized-casts"> {
   let summary = "Simplify and eliminate unrealized conversion casts";
   let description = [{
     Eliminate `unrealized_conversion_cast` operations, commonly introduced by
@@ -659,17 +652,15 @@ def ReconcileUnrealizedCasts : Pass<"reconcile-unrealized-casts"> {
     and the producer operation is converted by another pass, each of which
     produces an unrealized cast. This pass can be used to clean up the IR.
   }];
-  let constructor = "mlir::createReconcileUnrealizedCastsPass()";
 }
 
 //===----------------------------------------------------------------------===//
 // SCFToControlFlow
 //===----------------------------------------------------------------------===//
 
-def SCFToControlFlow : Pass<"convert-scf-to-cf"> {
+def ConvertSCFToControlFlowPass : Pass<"convert-scf-to-cf"> {
   let summary = "Convert SCF dialect to ControlFlow dialect, replacing structured"
                 " control flow with a CFG";
-  let constructor = "mlir::createConvertSCFToCFPass()";
   let dependentDialects = ["cf::ControlFlowDialect"];
 }
 
@@ -677,7 +668,7 @@ def SCFToControlFlow : Pass<"convert-scf-to-cf"> {
 // SCFToOpenMP
 //===----------------------------------------------------------------------===//
 
-def ConvertSCFToOpenMP : Pass<"convert-scf-to-openmp", "ModuleOp"> {
+def ConvertSCFToOpenMPPass : Pass<"convert-scf-to-openmp", "ModuleOp"> {
   let summary = "Convert SCF parallel loop to OpenMP parallel + workshare "
                 "constructs.";
   let constructor = "mlir::createConvertSCFToOpenMPPass()";
@@ -689,7 +680,7 @@ def ConvertSCFToOpenMP : Pass<"convert-scf-to-openmp", "ModuleOp"> {
 // SCFToSPIRV
 //===----------------------------------------------------------------------===//
 
-def SCFToSPIRV : Pass<"convert-scf-to-spirv"> {
+def ConvertSCFToSPIRVPass : Pass<"convert-scf-to-spirv"> {
   let summary = "Convert SCF dialect to SPIR-V dialect.";
   let description = [{
     This pass converts SCF ops into SPIR-V structured control flow ops.
@@ -706,7 +697,7 @@ def SCFToSPIRV : Pass<"convert-scf-to-spirv"> {
 // SCFToGPU
 //===----------------------------------------------------------------------===//
 
-def ConvertAffineForToGPU
+def ConvertAffineForToGPUPass
     : InterfacePass<"convert-affine-for-to-gpu", "FunctionOpInterface"> {
   let summary = "Convert top-level AffineFor Ops to GPU kernels";
   let constructor = "mlir::createAffineForToGPUPass()";
@@ -719,9 +710,14 @@ def ConvertAffineForToGPU
   ];
 }
 
-def ConvertParallelLoopToGpu : Pass<"convert-parallel-loops-to-gpu"> {
+def ConvertParallelLoopToGpuPass : Pass<"convert-parallel-loops-to-gpu"> {
   let summary = "Convert mapped scf.parallel ops to gpu launch operations";
-  let constructor = "mlir::createParallelLoopToGpuPass()";
+  let description = [{
+      Convert `scf.parallel` operations into a `gpu.launch` operation. The
+      mapping of loop dimensions to launch dimensions is derived from mapping
+      attributes. See `ParallelToGpuLaunchLowering::matchAndRewrite` for a
+      description of the used attributes.
+  }];
   let dependentDialects = ["AffineDialect", "gpu::GPUDialect"];
 }
 
@@ -729,7 +725,7 @@ def ConvertParallelLoopToGpu : Pass<"convert-parallel-loops-to-gpu"> {
 // ShapeToStandard
 //===----------------------------------------------------------------------===//
 
-def ConvertShapeToStandard : Pass<"convert-shape-to-std", "ModuleOp"> {
+def ConvertShapeToStandardPass : Pass<"convert-shape-to-std", "ModuleOp"> {
   let summary = "Convert operations from the shape dialect into the standard "
                 "dialect";
   let constructor = "mlir::createConvertShapeToStandardPass()";
@@ -738,7 +734,7 @@ def ConvertShapeToStandard : Pass<"convert-shape-to-std", "ModuleOp"> {
   ];
 }
 
-def ConvertShapeConstraints : Pass<"convert-shape-constraints"> {
+def ConvertShapeConstraintsPass : Pass<"convert-shape-constraints"> {
   let summary = "Convert shape constraint operations to the standard dialect";
   let description = [{
     This pass eliminates shape constraints from the program, converting them to
@@ -749,7 +745,6 @@ def ConvertShapeConstraints : Pass<"convert-shape-constraints"> {
     can happen at a different part of the program than general shape
     computation lowering.
   }];
-  let constructor = "mlir::createConvertShapeConstraintsPass()";
   let dependentDialects = ["cf::ControlFlowDialect", "scf::SCFDialect"];
 }
 
@@ -757,7 +752,7 @@ def ConvertShapeConstraints : Pass<"convert-shape-constraints"> {
 // SPIRVToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertSPIRVToLLVM : Pass<"convert-spirv-to-llvm", "ModuleOp"> {
+def ConvertSPIRVToLLVMPass : Pass<"convert-spirv-to-llvm", "ModuleOp"> {
   let summary = "Convert SPIR-V dialect to LLVM dialect";
   let description = [{
     See https://mlir.llvm.org/docs/SPIRVToLLVMDialectConversion/
@@ -771,7 +766,7 @@ def ConvertSPIRVToLLVM : Pass<"convert-spirv-to-llvm", "ModuleOp"> {
 // TensorToLinalg
 //===----------------------------------------------------------------------===//
 
-def ConvertTensorToLinalg : Pass<"convert-tensor-to-linalg", "ModuleOp"> {
+def ConvertTensorToLinalgPass : Pass<"convert-tensor-to-linalg", "ModuleOp"> {
   let summary = "Convert some Tensor dialect ops to Linalg dialect";
   let constructor = "mlir::createConvertTensorToLinalgPass()";
   let dependentDialects = [
@@ -780,12 +775,11 @@ def ConvertTensorToLinalg : Pass<"convert-tensor-to-linalg", "ModuleOp"> {
   ];
 }
 
-
 //===----------------------------------------------------------------------===//
 // TensorToSPIRV
 //===----------------------------------------------------------------------===//
 
-def ConvertTensorToSPIRV : Pass<"convert-tensor-to-spirv"> {
+def ConvertTensorToSPIRVPass : Pass<"convert-tensor-to-spirv"> {
   let summary = "Convert Tensor dialect to SPIR-V dialect";
   let constructor = "mlir::createConvertTensorToSPIRVPass()";
   let dependentDialects = ["spirv::SPIRVDialect"];
@@ -801,7 +795,7 @@ def ConvertTensorToSPIRV : Pass<"convert-tensor-to-spirv"> {
 // TosaToArith
 //===----------------------------------------------------------------------===//
 
-def TosaToArith : Pass<"tosa-to-arith"> {
+def ConvertTosaToArithPass : Pass<"tosa-to-arith"> {
   let summary = "Lower TOSA to the Arith dialect";
   let dependentDialects = [
     "arith::ArithmeticDialect",
@@ -820,60 +814,52 @@ def TosaToArith : Pass<"tosa-to-arith"> {
            "bool", /*default=*/"false",
            "Whether to prioritze lowering to 32-bit operations">
   ];
-
-  let constructor = "tosa::createTosaToArith()";
 }
 
 //===----------------------------------------------------------------------===//
 // TosaToLinalg
 //===----------------------------------------------------------------------===//
 
-def TosaToLinalg
+def ConvertTosaToLinalgPass
     : InterfacePass<"tosa-to-linalg", "FunctionOpInterface"> {
   let summary = "Lower TOSA to LinAlg on tensors";
   let description = [{
     Pass that converts TOSA operations to the equivalent operations using the
     tensor operations in LinAlg.
   }];
-
-  let constructor = "tosa::createTosaToLinalg()";
 }
 
 //===----------------------------------------------------------------------===//
 // TosaToLinalgNamed
 //===----------------------------------------------------------------------===//
 
-def TosaToLinalgNamed
+def ConvertTosaToLinalgNamedPass
     : InterfacePass<"tosa-to-linalg-named", "FunctionOpInterface"> {
   let summary = "Lower TOSA to LinAlg named operations";
   let description = [{
     Pass that converts TOSA operations to the equivalent operations using the
     Linalg named operations.
   }];
-
-  let constructor = "tosa::createTosaToLinalgNamed()";
 }
 
 //===----------------------------------------------------------------------===//
 // TosaToSCF
 //===----------------------------------------------------------------------===//
 
-def TosaToSCF : Pass<"tosa-to-scf"> {
+def ConvertTosaToSCFPass : Pass<"tosa-to-scf"> {
   let summary = "Lower TOSA to the SCF dialect";
   let dependentDialects = ["tensor::TensorDialect, scf::SCFDialect"];
   let description = [{
     Pass that converts TOSA's control flow operations to the equivalent SCF
     operations.
   }];
-
-  let constructor = "tosa::createTosaToSCF()";
 }
 
 //===----------------------------------------------------------------------===//
 // TosaToTensor
 //===----------------------------------------------------------------------===//
 
-def TosaToTensor : Pass<"tosa-to-tensor"> {
+def ConvertTosaToTensorPass : Pass<"tosa-to-tensor"> {
   let summary = "Lower TOSA to the Tensor dialect";
   let dependentDialects = [
     "tensor::TensorDialect",
@@ -882,15 +868,13 @@ def TosaToTensor : Pass<"tosa-to-tensor"> {
     Pass that converts TOSA operations to the equivalent operations using the
     operations in the Tensor dialect.
   }];
-
-  let constructor = "tosa::createTosaToTensor()";
 }
 
 //===----------------------------------------------------------------------===//
 // VectorToGPU
 //===----------------------------------------------------------------------===//
 
-def ConvertVectorToGPU : Pass<"convert-vector-to-gpu"> {
+def ConvertVectorToGPUPass : Pass<"convert-vector-to-gpu"> {
   let summary = "Lower the operations from the vector dialect into the GPU "
                 "dialect";
   let constructor = "mlir::createConvertVectorToGPUPass()";
@@ -909,7 +893,7 @@ def ConvertVectorToGPU : Pass<"convert-vector-to-gpu"> {
 // VectorToSCF
 //===----------------------------------------------------------------------===//
 
-def ConvertVectorToSCF : Pass<"convert-vector-to-scf"> {
+def ConvertVectorToSCFPass : Pass<"convert-vector-to-scf"> {
   let summary = "Lower the operations from the vector dialect into the SCF "
                 "dialect";
   let constructor = "mlir::createConvertVectorToSCFPass()";
@@ -935,7 +919,7 @@ def ConvertVectorToSCF : Pass<"convert-vector-to-scf"> {
 // VectorToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertVectorToLLVM : Pass<"convert-vector-to-llvm", "ModuleOp"> {
+def ConvertVectorToLLVMPass : Pass<"convert-vector-to-llvm", "ModuleOp"> {
   let summary = "Lower the operations from the vector dialect into the LLVM "
                 "dialect";
   let description = [{
@@ -982,7 +966,7 @@ def ConvertVectorToLLVM : Pass<"convert-vector-to-llvm", "ModuleOp"> {
 // VectorToSPIRV
 //===----------------------------------------------------------------------===//
 
-def ConvertVectorToSPIRV : Pass<"convert-vector-to-spirv"> {
+def ConvertVectorToSPIRVPass : Pass<"convert-vector-to-spirv"> {
   let summary = "Convert Vector dialect to SPIR-V dialect";
   let constructor = "mlir::createConvertVectorToSPIRVPass()";
   let dependentDialects = ["spirv::SPIRVDialect"];
index 5859e6e..92fc8b0 100644 (file)
@@ -15,13 +15,13 @@ namespace mlir {
 class Pass;
 class RewritePatternSet;
 
-/// Creates a pass that eliminates noop `unrealized_conversion_cast` operation
-/// sequences.
-std::unique_ptr<Pass> createReconcileUnrealizedCastsPass();
+#define GEN_PASS_DECL_RECONCILEUNREALIZEDCASTSPASS
+#include "mlir/Conversion/Passes.h.inc"
 
 /// Populates `patterns` with rewrite patterns that eliminate noop
 /// `unrealized_conversion_cast` operation sequences.
 void populateReconcileUnrealizedCastsPatterns(RewritePatternSet &patterns);
+
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_RECONCILEUNREALIZEDCASTS_RECONCILEUNREALIZEDCASTS_H_
index d26b0b2..fc54488 100644 (file)
@@ -15,14 +15,13 @@ namespace mlir {
 class Pass;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTSCFTOCONTROLFLOWPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Collect a set of patterns to convert SCF operations to CFG branch-based
 /// operations within the ControlFlow dialect.
 void populateSCFToControlFlowConversionPatterns(RewritePatternSet &patterns);
 
-/// Creates a pass to convert SCF operations to CFG branch-based operation in
-/// the ControlFlow dialect.
-std::unique_ptr<Pass> createConvertSCFToCFPass();
-
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_SCFTOCONTROLFLOW_SCFTOCONTROLFLOW_H_
index 08f34b9..39c7ba8 100644 (file)
@@ -18,6 +18,10 @@ template <typename T>
 class InterfacePass;
 class Pass;
 
+#define GEN_PASS_DECL_CONVERTAFFINEFORTOGPUPASS
+#define GEN_PASS_DECL_CONVERTPARALLELLOOPTOGPUPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Create a pass that converts loop nests into GPU kernels.  It considers
 /// top-level affine.for operations as roots of loop nests and converts them to
 /// the gpu.launch operations if possible.
@@ -30,12 +34,6 @@ std::unique_ptr<InterfacePass<FunctionOpInterface>>
 createAffineForToGPUPass(unsigned numBlockDims, unsigned numThreadDims);
 std::unique_ptr<InterfacePass<FunctionOpInterface>> createAffineForToGPUPass();
 
-/// Creates a pass that converts scf.parallel operations into a gpu.launch
-/// operation. The mapping of loop dimensions to launch dimensions is derived
-/// from mapping attributes. See ParallelToGpuLaunchLowering::matchAndRewrite
-/// for a description of the used attributes.
-std::unique_ptr<Pass> createParallelLoopToGpuPass();
-
 } // namespace mlir
 
 #endif // MLIR_CONVERSION_SCFTOGPU_SCFTOGPUPASS_H_
index 4000bc1..b984f8a 100644 (file)
@@ -16,6 +16,9 @@ class ModuleOp;
 template <typename T>
 class OperationPass;
 
+#define GEN_PASS_DECL_CONVERTSCFTOOPENMPPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 std::unique_ptr<OperationPass<ModuleOp>> createConvertSCFToOpenMPPass();
 
 } // namespace mlir
index 4299537..87b5868 100644 (file)
@@ -18,6 +18,9 @@
 namespace mlir {
 class ModuleOp;
 
+#define GEN_PASS_DECL_CONVERTSCFTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to convert SCF ops into SPIR-V ops.
 std::unique_ptr<OperationPass<>> createConvertSCFToSPIRVPass();
 
index 7204e64..2c1505d 100644 (file)
@@ -20,6 +20,10 @@ class ModuleOp;
 template <typename T>
 class OperationPass;
 
+#define GEN_PASS_DECL_LOWERHOSTCODETOLLVMPASS
+#define GEN_PASS_DECL_CONVERTSPIRVTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to emulate `gpu.launch_func` call in LLVM dialect and lower
 /// the host module code to LLVM.
 ///
index 607f968..997b702 100644 (file)
@@ -19,14 +19,16 @@ template <typename T>
 class OperationPass;
 class RewritePatternSet;
 
-void populateShapeToStandardConversionPatterns(RewritePatternSet &patterns);
+#define GEN_PASS_DECL_CONVERTSHAPECONSTRAINTSPASS
+#define GEN_PASS_DECL_CONVERTSHAPETOSTANDARDPASS
+#include "mlir/Conversion/Passes.h.inc"
 
-std::unique_ptr<OperationPass<ModuleOp>> createConvertShapeToStandardPass();
+void populateShapeToStandardConversionPatterns(RewritePatternSet &patterns);
 
 void populateConvertShapeConstraintsConversionPatterns(
     RewritePatternSet &patterns);
 
-std::unique_ptr<Pass> createConvertShapeConstraintsPass();
+std::unique_ptr<OperationPass<ModuleOp>> createConvertShapeToStandardPass();
 
 } // namespace mlir
 
index 2f32179..b70aa1d 100644 (file)
@@ -18,6 +18,9 @@
 namespace mlir {
 class ModuleOp;
 
+#define GEN_PASS_DECL_CONVERTTENSORTOLINALGPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to convert Tensor ops to Linalg ops.
 std::unique_ptr<OperationPass<ModuleOp>> createConvertTensorToLinalgPass();
 
index 5f9081f..2d37762 100644 (file)
@@ -18,6 +18,9 @@
 namespace mlir {
 class ModuleOp;
 
+#define GEN_PASS_DECL_CONVERTTENSORTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to convert Tensor ops to SPIR-V ops.
 std::unique_ptr<OperationPass<>> createConvertTensorToSPIRVPass();
 
index 62f5a0f..e6ad735 100644 (file)
 #include "mlir/Pass/Pass.h"
 
 namespace mlir {
-namespace tosa {
 
-std::unique_ptr<Pass> createTosaToArith();
+#define GEN_PASS_DECL_CONVERTTOSATOARITHPASS
+#include "mlir/Conversion/Passes.h.inc"
+
+namespace tosa {
 
 void populateTosaToArithConversionPatterns(RewritePatternSet *patterns);
 
index fc7fd37..73c1b99 100644 (file)
 #include "mlir/Pass/Pass.h"
 
 namespace mlir {
-namespace tosa {
 
-std::unique_ptr<Pass> createTosaToLinalg();
-std::unique_ptr<Pass> createTosaToLinalgNamed();
+#define GEN_PASS_DECL_CONVERTTOSATOLINALGPASS
+#define GEN_PASS_DECL_CONVERTTOSATOLINALGNAMEDPASS
+#include "mlir/Conversion/Passes.h.inc"
+
+namespace tosa {
 
 /// Populates passes to convert from TOSA to Linalg on buffers. At the end of
 /// the pass, the function will only contain linalg ops or standard ops if the
index e3b2e04..b2cd5f8 100644 (file)
 #include "mlir/Pass/Pass.h"
 
 namespace mlir {
-namespace tosa {
 
-std::unique_ptr<Pass> createTosaToSCF();
+#define GEN_PASS_DECL_CONVERTTOSATOSCFPASS
+#include "mlir/Conversion/Passes.h.inc"
+
+namespace tosa {
 
 void populateTosaToSCFConversionPatterns(RewritePatternSet *patterns);
 
index 3a686e5..dfe49c6 100644 (file)
 #include "mlir/Pass/Pass.h"
 
 namespace mlir {
-namespace tosa {
 
-std::unique_ptr<Pass> createTosaToTensor();
+#define GEN_PASS_DECL_CONVERTTOSATOTENSORPASS
+#include "mlir/Conversion/Passes.h.inc"
+
+namespace tosa {
 
 void populateTosaToTensorConversionPatterns(RewritePatternSet *patterns);
 
index 1ba5b3f..473917d 100644 (file)
@@ -16,6 +16,9 @@ class MLIRContext;
 class Pass;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTVECTORTOGPUPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Patterns to transform vector ops into a canonical form to convert to MMA
 /// matrix operations. If `useNvGpu` is true, then the patterns will populated
 /// will prepare for conversion to `nvgpu` mma operations rather than the `gpu`
index 80a6454..33aeec7 100644 (file)
@@ -16,6 +16,9 @@ class ModuleOp;
 template <typename T>
 class OperationPass;
 
+#define GEN_PASS_DECL_CONVERTVECTORTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Options to control Vector to LLVM lowering.
 ///
 /// This should kept in sync with VectorToLLVM options defined for the
index 1f649f3..492067d 100644 (file)
@@ -16,6 +16,9 @@ class MLIRContext;
 class Pass;
 class RewritePatternSet;
 
+#define GEN_PASS_DECL_CONVERTVECTORTOSCFPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// When lowering an N-d vector transfer op to an (N-1)-d vector transfer op,
 /// a temporary buffer is created through which individual (N-1)-d vector are
 /// staged. This pattern can be applied multiple time, until the transfer op
index 5335221..859adc0 100644 (file)
@@ -18,6 +18,9 @@
 namespace mlir {
 class ModuleOp;
 
+#define GEN_PASS_DECL_CONVERTVECTORTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+
 /// Creates a pass to convert Vector Ops to SPIR-V ops.
 std::unique_ptr<OperationPass<>> createConvertVectorToSPIRVPass();
 
index bab315e..a339294 100644 (file)
@@ -28,6 +28,22 @@ class AffineForOp;
 /// producer-consumer and sibling fusion.
 enum FusionMode { Greedy, ProducerConsumer, Sibling };
 
+#define GEN_PASS_DECL_AFFINEDATACOPYGENERATIONPASS
+#define GEN_PASS_DECL_AFFINELOOPFUSIONPASS
+#define GEN_PASS_DECL_AFFINELOOPINVARIANTCODEMOTIONPASS
+#define GEN_PASS_DECL_AFFINELOOPTILINGPASS
+#define GEN_PASS_DECL_AFFINELOOPUNROLLPASS
+#define GEN_PASS_DECL_AFFINELOOPUNROLLANDJAMPASS
+#define GEN_PASS_DECL_AFFINEPIPELINEDATATRANSFERPASS
+#define GEN_PASS_DECL_AFFINESCALARREPLACEMENTPASS
+#define GEN_PASS_DECL_AFFINEVECTORIZEPASS
+#define GEN_PASS_DECL_AFFINEPARALLELIZEPASS
+#define GEN_PASS_DECL_AFFINELOOPNORMALIZEPASS
+#define GEN_PASS_DECL_LOOPCOALESCINGPASS
+#define GEN_PASS_DECL_SIMPLIFYAFFINESTRUCTURESPASS
+#define GEN_PASS_DECL_AFFINEEXPANDINDEXOPSPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+
 /// Creates a simplification pass for affine structures (maps and sets). In
 /// addition, this pass also normalizes memrefs to have the trivial (identity)
 /// layout map.
index 1f31bcc..48c422b 100644 (file)
@@ -15,7 +15,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def AffineDataCopyGeneration : Pass<"affine-data-copy-generate", "func::FuncOp"> {
+def AffineDataCopyGenerationPass : Pass<"affine-data-copy-generate", "func::FuncOp"> {
   let summary = "Generate explicit copying for affine memory operations";
   let constructor = "mlir::createAffineDataCopyGenerationPass()";
   let dependentDialects = ["memref::MemRefDialect"];
@@ -43,7 +43,7 @@ def AffineDataCopyGeneration : Pass<"affine-data-copy-generate", "func::FuncOp">
   ];
 }
 
-def AffineLoopFusion : Pass<"affine-loop-fusion", "func::FuncOp"> {
+def AffineLoopFusionPass : Pass<"affine-loop-fusion", "func::FuncOp"> {
   let summary = "Fuse affine loop nests";
   let description = [{
     This pass performs fusion of loop nests using a slicing-based approach. It
@@ -175,13 +175,13 @@ def AffineLoopFusion : Pass<"affine-loop-fusion", "func::FuncOp"> {
   let dependentDialects = ["memref::MemRefDialect"];
 }
 
-def AffineLoopInvariantCodeMotion
+def AffineLoopInvariantCodeMotionPass
     : Pass<"affine-loop-invariant-code-motion", "func::FuncOp"> {
   let summary = "Hoist loop invariant instructions outside of affine loops";
   let constructor = "mlir::createAffineLoopInvariantCodeMotionPass()";
 }
 
-def AffineLoopTiling : Pass<"affine-loop-tile", "func::FuncOp"> {
+def AffineLoopTilingPass : Pass<"affine-loop-tile", "func::FuncOp"> {
   let summary = "Tile affine loop nests";
   let constructor = "mlir::createLoopTilingPass()";
   let options = [
@@ -197,7 +197,7 @@ def AffineLoopTiling : Pass<"affine-loop-tile", "func::FuncOp"> {
   ];
 }
 
-def AffineLoopUnroll : Pass<"affine-loop-unroll", "func::FuncOp"> {
+def AffineLoopUnrollPass : Pass<"affine-loop-unroll", "func::FuncOp"> {
   let summary = "Unroll affine loops";
   let constructor = "mlir::createLoopUnrollPass()";
   let options = [
@@ -217,7 +217,7 @@ def AffineLoopUnroll : Pass<"affine-loop-unroll", "func::FuncOp"> {
   ];
 }
 
-def AffineLoopUnrollAndJam : Pass<"affine-loop-unroll-jam", "func::FuncOp"> {
+def AffineLoopUnrollAndJamPass : Pass<"affine-loop-unroll-jam", "func::FuncOp"> {
   let summary = "Unroll and jam affine loops";
   let constructor = "mlir::createLoopUnrollAndJamPass()";
   let options = [
@@ -227,7 +227,7 @@ def AffineLoopUnrollAndJam : Pass<"affine-loop-unroll-jam", "func::FuncOp"> {
   ];
 }
 
-def AffinePipelineDataTransfer
+def AffinePipelineDataTransferPass
     : Pass<"affine-pipeline-data-transfer", "func::FuncOp"> {
   let summary = "Pipeline non-blocking data transfers between explicitly "
                 "managed levels of the memory hierarchy";
@@ -296,7 +296,7 @@ def AffinePipelineDataTransfer
   let constructor = "mlir::createPipelineDataTransferPass()";
 }
 
-def AffineScalarReplacement : Pass<"affine-scalrep", "func::FuncOp"> {
+def AffineScalarReplacementPass : Pass<"affine-scalrep", "func::FuncOp"> {
   let summary = "Replace affine memref acceses by scalars by forwarding stores "
                 "to loads and eliminating redundant loads";
   let description = [{
@@ -342,7 +342,7 @@ def AffineScalarReplacement : Pass<"affine-scalrep", "func::FuncOp"> {
   let constructor = "mlir::createAffineScalarReplacementPass()";
 }
 
-def AffineVectorize : Pass<"affine-super-vectorize", "func::FuncOp"> {
+def AffineVectorizePass : Pass<"affine-super-vectorize", "func::FuncOp"> {
   let summary = "Vectorize to a target independent n-D vector abstraction";
   let constructor = "mlir::createSuperVectorizePass()";
   let dependentDialects = ["vector::VectorDialect"];
@@ -366,7 +366,7 @@ def AffineVectorize : Pass<"affine-super-vectorize", "func::FuncOp"> {
   ];
 }
 
-def AffineParallelize : Pass<"affine-parallelize", "func::FuncOp"> {
+def AffineParallelizePass : Pass<"affine-parallelize", "func::FuncOp"> {
   let summary = "Convert affine.for ops into 1-D affine.parallel";
   let constructor = "mlir::createAffineParallelizePass()";
   let options = [
@@ -379,25 +379,25 @@ def AffineParallelize : Pass<"affine-parallelize", "func::FuncOp"> {
   ];
 }
 
-def AffineLoopNormalize : Pass<"affine-loop-normalize", "func::FuncOp"> {
+def AffineLoopNormalizePass : Pass<"affine-loop-normalize", "func::FuncOp"> {
   let summary = "Apply normalization transformations to affine loop-like ops";
   let constructor = "mlir::createAffineLoopNormalizePass()";
 }
 
-def LoopCoalescing : Pass<"affine-loop-coalescing", "func::FuncOp"> {
+def LoopCoalescingPass : Pass<"affine-loop-coalescing", "func::FuncOp"> {
   let summary = "Coalesce nested loops with independent bounds into a single "
                 "loop";
   let constructor = "mlir::createLoopCoalescingPass()";
   let dependentDialects = ["arith::ArithmeticDialect"];
 }
 
-def SimplifyAffineStructures : Pass<"affine-simplify-structures", "func::FuncOp"> {
+def SimplifyAffineStructuresPass : Pass<"affine-simplify-structures", "func::FuncOp"> {
   let summary = "Simplify affine expressions in maps/sets and normalize "
                 "memrefs";
   let constructor = "mlir::createSimplifyAffineStructuresPass()";
 }
 
-def AffineExpandIndexOps : Pass<"affine-expand-index-ops"> {
+def AffineExpandIndexOpsPass : Pass<"affine-expand-index-ops"> {
   let summary = "Lower affine operations operating on indices into more fundamental operations";
   let constructor = "mlir::createAffineExpandIndexOpsPass()";
 }
index 9b9331f..43ef369 100644 (file)
 namespace mlir {
 namespace arith {
 
+#define GEN_PASS_DECL_ARITHMETICBUFFERIZEPASS
+#define GEN_PASS_DECL_ARITHMETICEXPANDOPSPASS
+#define GEN_PASS_DECL_ARITHMETICUNSIGNEDWHENEQUIVALENTPASS
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
+
 /// Create a pass to bufferize Arithmetic ops.
 std::unique_ptr<Pass> createArithmeticBufferizePass();
 
index 752d715..abfa407 100644 (file)
@@ -11,7 +11,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def ArithmeticBufferize : Pass<"arith-bufferize", "ModuleOp"> {
+def ArithmeticBufferizePass : Pass<"arith-bufferize", "ModuleOp"> {
   let summary = "Bufferize Arithmetic dialect ops.";
   let description = [{
     This pass bufferizes arith dialect ops.
@@ -28,12 +28,12 @@ def ArithmeticBufferize : Pass<"arith-bufferize", "ModuleOp"> {
   ];
 }
 
-def ArithmeticExpandOps : Pass<"arith-expand"> {
+def ArithmeticExpandOpsPass : Pass<"arith-expand"> {
   let summary = "Legalize Arithmetic ops to be convertible to LLVM.";
   let constructor = "mlir::arith::createArithmeticExpandOpsPass()";
 }
 
-def ArithmeticUnsignedWhenEquivalent : Pass<"arith-unsigned-when-equivalent"> {
+def ArithmeticUnsignedWhenEquivalentPass : Pass<"arith-unsigned-when-equivalent"> {
   let summary = "Replace signed ops with unsigned ones where they are proven equivalent";
   let description = [{
     Replace signed ops with their unsigned equivalents when integer range analysis
index af0f228..a3569c7 100644 (file)
 namespace mlir {
 class ModuleOp;
 
+#define GEN_PASS_DECL_ASYNCPARALLELFORPASS
+#define GEN_PASS_DECL_ASYNCTOASYNCRUNTIMEPASS
+#define GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTINGPASS
+#define GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTINGOPTPASS
+#define GEN_PASS_DECL_ASYNCRUNTIMEPOLICYBASEDREFCOUNTINGPASS
+#include "mlir/Dialect/Async/Passes.h.inc"
+
 std::unique_ptr<Pass> createAsyncParallelForPass();
 
 std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch,
index 8eb1eef..d70f4ef 100644 (file)
@@ -11,7 +11,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def AsyncParallelFor : Pass<"async-parallel-for", "ModuleOp"> {
+def AsyncParallelForPass : Pass<"async-parallel-for", "ModuleOp"> {
   let summary = "Convert scf.parallel operations to multiple async compute ops "
                 "executed concurrently for non-overlapping iteration ranges";
   let constructor = "mlir::createAsyncParallelForPass()";
@@ -40,7 +40,7 @@ def AsyncParallelFor : Pass<"async-parallel-for", "ModuleOp"> {
   ];
 }
 
-def AsyncToAsyncRuntime : Pass<"async-to-async-runtime", "ModuleOp"> {
+def AsyncToAsyncRuntimePass : Pass<"async-to-async-runtime", "ModuleOp"> {
   let summary = "Lower high level async operations (e.g. async.execute) to the"
                 "explicit async.runtime and async.coro operations";
   let constructor = "mlir::createAsyncToAsyncRuntimePass()";
@@ -54,7 +54,7 @@ def AsyncToAsyncRuntime : Pass<"async-to-async-runtime", "ModuleOp"> {
   let dependentDialects = ["async::AsyncDialect"];
 }
 
-def AsyncRuntimeRefCounting : Pass<"async-runtime-ref-counting"> {
+def AsyncRuntimeRefCountingPass : Pass<"async-runtime-ref-counting"> {
   let summary = "Automatic reference counting for Async runtime operations";
   let description = [{
     This pass works at the async runtime abtraction level, after all
@@ -71,14 +71,14 @@ def AsyncRuntimeRefCounting : Pass<"async-runtime-ref-counting"> {
   let dependentDialects = ["async::AsyncDialect"];
 }
 
-def AsyncRuntimeRefCountingOpt : Pass<"async-runtime-ref-counting-opt"> {
+def AsyncRuntimeRefCountingOptPass : Pass<"async-runtime-ref-counting-opt"> {
   let summary = "Optimize automatic reference counting operations for the"
                 "Async runtime by removing redundant operations";
   let constructor = "mlir::createAsyncRuntimeRefCountingOptPass()";
   let dependentDialects = ["async::AsyncDialect"];
 }
 
-def AsyncRuntimePolicyBasedRefCounting
+def AsyncRuntimePolicyBasedRefCountingPass
     : Pass<"async-runtime-policy-based-ref-counting"> {
   let summary = "Policy based reference counting for Async runtime operations";
   let description = [{
index df49a0a..649784a 100644 (file)
@@ -17,6 +17,19 @@ struct OneShotBufferizationOptions;
 // Passes
 //===----------------------------------------------------------------------===//
 
+#define GEN_PASS_DECL_BUFFERDEALLOCATIONPASS
+#define GEN_PASS_DECL_BUFFERHOISTINGPASS
+#define GEN_PASS_DECL_BUFFERLOOPHOISTINGPASS
+#define GEN_PASS_DECL_BUFFERRESULTSTOOUTPARAMSPASS
+#define GEN_PASS_DECL_FINALIZINGBUFFERIZEPASS
+#define GEN_PASS_DECL_BUFFERIZATIONBUFFERIZEPASS
+#define GEN_PASS_DECL_DROPEQUIVALENTBUFFERRESULTSPASS
+#define GEN_PASS_DECL_ONESHOTBUFFERIZEPASS
+#define GEN_PASS_DECL_PROMOTEBUFFERSTOSTACKPASS
+#define GEN_PASS_DECL_TENSORCOPYINSERTIONPASS
+#define GEN_PASS_DECL_ALLOCTENSORELIMINATIONPASS
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+
 /// Creates an instance of the BufferDeallocation pass to free all allocated
 /// buffers.
 std::unique_ptr<Pass> createBufferDeallocationPass();
index 97684fb..47d6a85 100644 (file)
@@ -11,7 +11,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def BufferDeallocation : Pass<"buffer-deallocation", "func::FuncOp"> {
+def BufferDeallocationPass : Pass<"buffer-deallocation", "func::FuncOp"> {
   let summary = "Adds all required dealloc operations for all allocations in "
                 "the input program";
   let description = [{
@@ -88,7 +88,7 @@ def BufferDeallocation : Pass<"buffer-deallocation", "func::FuncOp"> {
   let constructor = "mlir::bufferization::createBufferDeallocationPass()";
 }
 
-def BufferHoisting : Pass<"buffer-hoisting", "func::FuncOp"> {
+def BufferHoistingPass : Pass<"buffer-hoisting", "func::FuncOp"> {
   let summary = "Optimizes placement of allocation operations by moving them "
                 "into common dominators and out of nested regions";
   let description = [{
@@ -98,7 +98,7 @@ def BufferHoisting : Pass<"buffer-hoisting", "func::FuncOp"> {
   let constructor = "mlir::bufferization::createBufferHoistingPass()";
 }
 
-def BufferLoopHoisting : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
+def BufferLoopHoistingPass : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
   let summary = "Optimizes placement of allocation operations by moving them "
                 "out of loop nests";
   let description = [{
@@ -108,7 +108,7 @@ def BufferLoopHoisting : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
   let constructor = "mlir::bufferization::createBufferLoopHoistingPass()";
 }
 
-def BufferResultsToOutParams : Pass<"buffer-results-to-out-params", "ModuleOp">  {
+def BufferResultsToOutParamsPass : Pass<"buffer-results-to-out-params", "ModuleOp">  {
   let summary = "Converts memref-typed function results to out-params";
   let description = [{
     Some calling conventions prefer to pass output memrefs as "out params". The
@@ -133,7 +133,7 @@ def BufferResultsToOutParams : Pass<"buffer-results-to-out-params", "ModuleOp">
   let dependentDialects = ["memref::MemRefDialect"];
 }
 
-def FinalizingBufferize : Pass<"finalizing-bufferize", "func::FuncOp"> {
+def FinalizingBufferizePass : Pass<"finalizing-bufferize", "func::FuncOp"> {
   let summary = "Finalize a partial bufferization";
   let description = [{
     A bufferize pass that finalizes a partial bufferization by removing
@@ -149,12 +149,12 @@ def FinalizingBufferize : Pass<"finalizing-bufferize", "func::FuncOp"> {
   let constructor = "mlir::bufferization::createFinalizingBufferizePass()";
 }
 
-def BufferizationBufferize : Pass<"bufferization-bufferize", "func::FuncOp"> {
+def BufferizationBufferizePass : Pass<"bufferization-bufferize", "func::FuncOp"> {
   let summary = "Bufferize the `bufferization` dialect";
   let constructor = "mlir::bufferization::createBufferizationBufferizePass()";
 }
 
-def DropEquivalentBufferResults : Pass<"drop-equivalent-buffer-results", "ModuleOp">  {
+def DropEquivalentBufferResultsPass : Pass<"drop-equivalent-buffer-results", "ModuleOp">  {
   let summary = "Remove MemRef return values that are equivalent to a bbArg";
   let description = [{
     This pass removes MemRef return values from functions if they are equivalent
@@ -168,7 +168,7 @@ def DropEquivalentBufferResults : Pass<"drop-equivalent-buffer-results", "Module
   let dependentDialects = ["memref::MemRefDialect"];
 }
 
-def OneShotBufferize : Pass<"one-shot-bufferize", "ModuleOp"> {
+def OneShotBufferizePass : Pass<"one-shot-bufferize", "ModuleOp"> {
   let summary = "One-Shot Bufferize";
   let description = [{
     This pass bufferizes all ops that implement `BufferizableOpInterface`. It
@@ -303,7 +303,7 @@ def OneShotBufferize : Pass<"one-shot-bufferize", "ModuleOp"> {
   let constructor = "mlir::bufferization::createOneShotBufferizePass()";
 }
 
-def PromoteBuffersToStack : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
+def PromoteBuffersToStackPass : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
   let summary = "Promotes heap-based allocations to automatically managed "
                 "stack-based allocations";
   let description = [{
@@ -324,7 +324,7 @@ def PromoteBuffersToStack : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
   ];
 }
 
-def TensorCopyInsertion : Pass<"tensor-copy-insertion"> {
+def TensorCopyInsertionPass : Pass<"tensor-copy-insertion"> {
   let summary = "Make all tensor IR inplaceable by inserting copies";
   let description = [{
     This pass runs One-Shot Analysis and inserts copies for all OpOperands that
@@ -355,7 +355,7 @@ def TensorCopyInsertion : Pass<"tensor-copy-insertion"> {
   let constructor = "mlir::bufferization::createTensorCopyInsertionPass()";
 }
 
-def AllocTensorElimination : Pass<"eliminate-alloc-tensors"> {
+def AllocTensorEliminationPass : Pass<"eliminate-alloc-tensors"> {
   let summary = "Try to eliminate all alloc_tensor ops.";
   let description = [{
     This pass tries to eliminate all insert_slice op-anchored alloc_tensor ops.
index 82dd886..3fa6fdc 100644 (file)
@@ -25,6 +25,10 @@ class BufferizeTypeConverter;
 class RewritePatternSet;
 
 namespace func {
+
+#define GEN_PASS_DECL_FUNCBUFFERIZEPASS
+#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
+
 /// Creates an instance of func bufferization pass.
 std::unique_ptr<Pass> createFuncBufferizePass();
 
index 54fe4fd..565d79c 100644 (file)
@@ -11,7 +11,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def FuncBufferize : Pass<"func-bufferize", "ModuleOp"> {
+def FuncBufferizePass : Pass<"func-bufferize", "ModuleOp"> {
   let summary = "Bufferize func/call/return ops";
   let description = [{
     A bufferize pass that bufferizes func.func and func.call ops.
index 0ef83bc..fd6af68 100644 (file)
@@ -27,6 +27,12 @@ namespace func {
 class FuncOp;
 } // namespace func
 
+#define GEN_PASS_DECL_GPULAUNCHSINKINDEXCOMPUTATIONSPASS
+#define GEN_PASS_DECL_GPUKERNELOUTLININGPASS
+#define GEN_PASS_DECL_GPUASYNCREGIONPASS
+#define GEN_PASS_DECL_GPUMAPPARALLELLOOPSPASS
+#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
+
 /// Pass that moves ops which are likely an index computation into gpu.launch
 /// body.
 std::unique_ptr<Pass> createGpuLauchSinkIndexComputationsPass();
index a144fa4..1ff089d 100644 (file)
 
 include "mlir/Pass/PassBase.td"
 
-def GpuLaunchSinkIndexComputations : Pass<"gpu-launch-sink-index-computations"> {
+def GpuLaunchSinkIndexComputationsPass : Pass<"gpu-launch-sink-index-computations"> {
   let summary = "Sink index computations into gpu.launch body";
   let constructor = "mlir::createGpuLauchSinkIndexComputationsPass()";
   let dependentDialects = ["mlir::gpu::GPUDialect"];
 }
 
-def GpuKernelOutlining : Pass<"gpu-kernel-outlining", "ModuleOp"> {
+def GpuKernelOutliningPass : Pass<"gpu-kernel-outlining", "ModuleOp"> {
   let summary = "Outline gpu.launch bodies to kernel functions";
   let constructor = "mlir::createGpuKernelOutliningPass()";
   let dependentDialects = ["mlir::DLTIDialect"];
index 0197706..353b100 100644 (file)
@@ -17,6 +17,9 @@ class Pass;
 
 namespace LLVM {
 
+#define GEN_PASS_DECL_LLVMLEGALIZEFOREXPORTPASS
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+
 /// Make argument-taking successors of each block distinct.  PHI nodes in LLVM
 /// IR use the predecessor ID to identify which value to take. They do not
 /// support different values coming from the same predecessor. If a block has
index af0c4ea..8889b60 100644 (file)
@@ -16,6 +16,9 @@ class Pass;
 
 namespace NVVM {
 
+#define GEN_PASS_DECL_NVVMOPTIMIZEFORTARGETPASS
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+
 /// Creates a pass that optimizes LLVM IR for the NVVM target.
 std::unique_ptr<Pass> createOptimizeForTargetPass();
 
index a22efd3..00cc7bc 100644 (file)
 
 include "mlir/Pass/PassBase.td"
 
-def LLVMLegalizeForExport : Pass<"llvm-legalize-for-export"> {
+def LLVMLegalizeForExportPass : Pass<"llvm-legalize-for-export"> {
   let summary = "Legalize LLVM dialect to be convertible to LLVM IR";
   let constructor = "::mlir::LLVM::createLegalizeForExportPass()";
 }
 
-def LLVMRequestCWrappers
+def LLVMRequestCWrappersPass
     : Pass<"llvm-request-c-wrappers", "::mlir::func::FuncOp"> {
   let summary = "Request C wrapper emission for all functions";
   let description = [{
@@ -29,7 +29,7 @@ def LLVMRequestCWrappers
   let constructor = "::mlir::LLVM::createRequestCWrappersPass()";
 }
 
-def NVVMOptimizeForTarget : Pass<"llvm-optimize-for-nvvm-target"> {
+def NVVMOptimizeForTargetPass : Pass<"llvm-optimize-for-nvvm-target"> {
   let summary = "Optimize NVVM IR";
   let constructor = "::mlir::NVVM::createOptimizeForTargetPass()";
 }
index 166ae6a..991405a 100644 (file)
@@ -15,6 +15,10 @@ namespace mlir {
 class Pass;
 
 namespace LLVM {
+
+#define GEN_PASS_DECL_LLVMREQUESTCWRAPPERSPASS
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+
 std::unique_ptr<Pass> createRequestCWrappersPass();
 } // namespace LLVM
 } // namespace mlir
index 543a531..2cc81e4 100644 (file)
@@ -26,6 +26,30 @@ namespace bufferization {
 struct OneShotBufferizationOptions;
 } // namespace bufferization
 
+#define GEN_PASS_DECL_CONVERTELEMENTWISETOLINALGPASS
+#define GEN_PASS_DECL_LINALGINITTENSORTOALLOCTENSORPASS
+#define GEN_PASS_DECL_LINALGFOLDUNITEXTENTDIMSPASS
+#define GEN_PASS_DECL_LINALGELEMENTWISEOPFUSIONPASS
+#define GEN_PASS_DECL_LINALGNAMEDOPCONVERSIONPASS
+#define GEN_PASS_DECL_LINALGINLINESCALAROPERANDSPASS
+#define GEN_PASS_DECL_LINALGLOWERTOAFFINELOOPSPASS
+#define GEN_PASS_DECL_LINALGLOWERTOLOOPSPASS
+#define GEN_PASS_DECL_LINALGLOWERTOPARALLELLOOPSPASS
+#define GEN_PASS_DECL_LINALGBUFFERIZEPASS
+#define GEN_PASS_DECL_LINALGTILINGPASS
+#define GEN_PASS_DECL_LINALGGENERALIZATIONPASS
+#define GEN_PASS_DECL_LINALGDETENSORIZEPASS
+#define GEN_PASS_DECL_LINALGSTRATEGYTILEANDFUSEPASS
+#define GEN_PASS_DECL_LINALGSTRATEGYTILEPASS
+#define GEN_PASS_DECL_LINALGSTRATEGYPADPASS
+#define GEN_PASS_DECL_LINALGSTRATEGYDECOMPOSEPASS
+#define GEN_PASS_DECL_LINALGSTRATEGYPEELPASS
+#define GEN_PASS_DECL_LINALGSTRATEGYVECTORIZEPASS
+#define GEN_PASS_DECL_LINALGSTRATEGYENABLEPASS
+#define GEN_PASS_DECL_LINALGSTRATEGYLOWERVECTORSPASS
+#define GEN_PASS_DECL_LINALGSTRATEGYREMOVEMARKERSPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+
 std::unique_ptr<Pass> createConvertElementwiseToLinalgPass();
 
 std::unique_ptr<Pass> createLinalgFoldUnitExtentDimsPass();
index 826d59f..cc4415d 100644 (file)
@@ -11,7 +11,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def ConvertElementwiseToLinalg : Pass<"convert-elementwise-to-linalg", ""> {
+def ConvertElementwiseToLinalgPass : Pass<"convert-elementwise-to-linalg", ""> {
   let summary = "Convert ElementwiseMappable ops to linalg";
   let description = [{
     Convert ops with the `ElementwiseMappable` trait to linalg parallel loops.
@@ -24,7 +24,7 @@ def ConvertElementwiseToLinalg : Pass<"convert-elementwise-to-linalg", ""> {
   let dependentDialects = ["linalg::LinalgDialect", "memref::MemRefDialect"];
 }
 
-def LinalgInitTensorToAllocTensor : Pass<"linalg-init-tensor-to-alloc-tensor"> {
+def LinalgInitTensorToAllocTensorPass : Pass<"linalg-init-tensor-to-alloc-tensor"> {
   let summary = "Replace all init_tensor ops by alloc_tensor ops.";
   let description = [{
     init_tensor ops return a tensor of unspecified contents who's only purpose
@@ -34,7 +34,7 @@ def LinalgInitTensorToAllocTensor : Pass<"linalg-init-tensor-to-alloc-tensor"> {
   let constructor = "mlir::createLinalgInitTensorToAllocTensorPass()";
 }
 
-def LinalgFoldUnitExtentDims : Pass<"linalg-fold-unit-extent-dims", ""> {
+def LinalgFoldUnitExtentDimsPass : Pass<"linalg-fold-unit-extent-dims", ""> {
   let summary = "Remove unit-extent dimension in Linalg ops on tensors";
   let constructor = "mlir::createLinalgFoldUnitExtentDimsPass()";
   let options = [
@@ -48,7 +48,7 @@ def LinalgFoldUnitExtentDims : Pass<"linalg-fold-unit-extent-dims", ""> {
   ];
 }
 
-def LinalgElementwiseOpFusion : Pass<"linalg-fuse-elementwise-ops"> {
+def LinalgElementwiseOpFusionPass : Pass<"linalg-fuse-elementwise-ops"> {
   let summary = "Fuse elementwise operations on tensors";
   let constructor = "mlir::createLinalgElementwiseOpFusionPass()";
   let dependentDialects = [
@@ -56,13 +56,13 @@ def LinalgElementwiseOpFusion : Pass<"linalg-fuse-elementwise-ops"> {
   ];
 }
 
-def LinalgNamedOpConversion: Pass<"linalg-named-op-conversion"> {
+def LinalgNamedOpConversionPass : Pass<"linalg-named-op-conversion"> {
   let summary = "Convert from one named linalg op to another.";
   let constructor = "mlir::createLinalgNamedOpConversionPass()";
   let dependentDialects = ["linalg::LinalgDialect", "tensor::TensorDialect"];
 }
 
-def LinalgInlineScalarOperands : Pass<"linalg-inline-scalar-operands", "func::FuncOp"> {
+def LinalgInlineScalarOperandsPass : Pass<"linalg-inline-scalar-operands", "func::FuncOp"> {
   let summary = "Inline scalar operands into linalg generic ops";
   let constructor = "mlir::createLinalgInlineScalarOperandsPass()";
   let dependentDialects = [
@@ -70,7 +70,7 @@ def LinalgInlineScalarOperands : Pass<"linalg-inline-scalar-operands", "func::Fu
   ];
 }
 
-def LinalgLowerToAffineLoops : Pass<"convert-linalg-to-affine-loops", "func::FuncOp"> {
+def LinalgLowerToAffineLoopsPass : Pass<"convert-linalg-to-affine-loops", "func::FuncOp"> {
   let summary = "Lower the operations from the linalg dialect into affine "
                 "loops";
   let constructor = "mlir::createConvertLinalgToAffineLoopsPass()";
@@ -78,7 +78,7 @@ def LinalgLowerToAffineLoops : Pass<"convert-linalg-to-affine-loops", "func::Fun
     "AffineDialect", "linalg::LinalgDialect", "memref::MemRefDialect"];
 }
 
-def LinalgLowerToLoops : Pass<"convert-linalg-to-loops", "func::FuncOp"> {
+def LinalgLowerToLoopsPass : Pass<"convert-linalg-to-loops", "func::FuncOp"> {
   let summary = "Lower the operations from the linalg dialect into loops";
   let constructor = "mlir::createConvertLinalgToLoopsPass()";
   let dependentDialects = [
@@ -88,7 +88,7 @@ def LinalgLowerToLoops : Pass<"convert-linalg-to-loops", "func::FuncOp"> {
   ];
 }
 
-def LinalgLowerToParallelLoops
+def LinalgLowerToParallelLoopsPass
     : Pass<"convert-linalg-to-parallel-loops", "func::FuncOp"> {
   let summary = "Lower the operations from the linalg dialect into parallel "
                 "loops";
@@ -101,7 +101,7 @@ def LinalgLowerToParallelLoops
   ];
 }
 
-def LinalgBufferize : Pass<"linalg-bufferize", "func::FuncOp"> {
+def LinalgBufferizePass : Pass<"linalg-bufferize", "func::FuncOp"> {
   let summary = "Bufferize the linalg dialect";
   let constructor = "mlir::createLinalgBufferizePass()";
   let dependentDialects = [
@@ -112,7 +112,7 @@ def LinalgBufferize : Pass<"linalg-bufferize", "func::FuncOp"> {
   ];
 }
 
-def LinalgTiling : Pass<"linalg-tile", "func::FuncOp"> {
+def LinalgTilingPass : Pass<"linalg-tile", "func::FuncOp"> {
   let summary = "Tile operations in the linalg dialect";
   let constructor = "mlir::createLinalgTilingPass()";
   let dependentDialects = [
@@ -128,13 +128,13 @@ def LinalgTiling : Pass<"linalg-tile", "func::FuncOp"> {
   ];
 }
 
-def LinalgGeneralization : Pass<"linalg-generalize-named-ops", "func::FuncOp"> {
+def LinalgGeneralizationPass : Pass<"linalg-generalize-named-ops", "func::FuncOp"> {
   let summary = "Convert named ops into generic ops";
   let constructor = "mlir::createLinalgGeneralizationPass()";
   let dependentDialects = ["linalg::LinalgDialect"];
 }
 
-def LinalgDetensorize : Pass<"linalg-detensorize", ""> {
+def LinalgDetensorizePass : Pass<"linalg-detensorize", ""> {
   let summary = "Detensorize linalg ops";
   let constructor = "mlir::createLinalgDetensorizePass()";
   let dependentDialects = [];
index 82c2b5b..1144ab2 100644 (file)
@@ -86,6 +86,13 @@ LogicalResult multiBuffer(memref::AllocOp allocOp, unsigned multiplier);
 // Passes
 //===----------------------------------------------------------------------===//
 
+#define GEN_PASS_DECL_EXPANDOPSPASS
+#define GEN_PASS_DECL_FOLDMEMREFALIASOPSPASS
+#define GEN_PASS_DECL_NORMALIZEMEMREFSPASS
+#define GEN_PASS_DECL_RESOLVERANKEDSHAPETYPERESULTDIMSPASS
+#define GEN_PASS_DECL_RESOLVESHAPEDTYPERESULTDIMSPASS
+#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
+
 /// Creates an instance of the ExpandOps pass that legalizes memref dialect ops
 /// to be convertible to LLVM. For example, `memref.reshape` gets converted to
 /// `memref_reinterpret_cast`.
index 5ac124a..5546f84 100644 (file)
 
 include "mlir/Pass/PassBase.td"
 
-def ExpandOps : Pass<"memref-expand"> {
+def ExpandOpsPass : Pass<"memref-expand"> {
   let summary = "Legalize memref operations to be convertible to LLVM.";
   let constructor = "mlir::memref::createExpandOpsPass()";
 }
 
-def FoldMemRefAliasOps : Pass<"fold-memref-alias-ops"> {
+def FoldMemRefAliasOpsPass : Pass<"fold-memref-alias-ops"> {
   let summary = "Fold memref alias ops into consumer load/store ops";
   let description = [{
     The pass folds loading/storing from/to memref aliasing ops to loading/storing
@@ -28,7 +28,7 @@ def FoldMemRefAliasOps : Pass<"fold-memref-alias-ops"> {
   ];
 }
 
-def NormalizeMemRefs : Pass<"normalize-memrefs", "ModuleOp"> {
+def NormalizeMemRefsPass : Pass<"normalize-memrefs", "ModuleOp"> {
   let summary = "Normalize memrefs";
    let description = [{
     This pass transforms memref types with a non-trivial
@@ -144,7 +144,7 @@ def NormalizeMemRefs : Pass<"normalize-memrefs", "ModuleOp"> {
   let dependentDialects = ["AffineDialect"];
 }
 
-def ResolveRankedShapeTypeResultDims :
+def ResolveRankedShapeTypeResultDimsPass :
     Pass<"resolve-ranked-shaped-type-result-dims"> {
   let summary = "Resolve memref.dim of result values of ranked shape type";
   let description = [{
@@ -159,7 +159,7 @@ def ResolveRankedShapeTypeResultDims :
   ];
 }
 
-def ResolveShapedTypeResultDims : Pass<"resolve-shaped-type-result-dims"> {
+def ResolveShapedTypeResultDimsPass : Pass<"resolve-shaped-type-result-dims"> {
   let summary = "Resolve memref.dim of result values";
   let description = [{
     The pass resolves memref.dim of result of operations that
index 3131984..05ea47e 100644 (file)
@@ -17,6 +17,9 @@
 namespace mlir {
 namespace nvgpu {
 
+#define GEN_PASS_DECL_OPTIMIZESHAREDMEMORYPASS
+#include "mlir/Dialect/NVGPU/Passes.h.inc"
+
 /// Create a pass to optimize shared memory reads and writes.
 std::unique_ptr<Pass> createOptimizeSharedMemoryPass();
 
index 87b7731..59a88c0 100644 (file)
@@ -11,7 +11,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def OptimizeSharedMemory : Pass<"nvgpu-optimize-shared-memory"> {
+def OptimizeSharedMemoryPass : Pass<"nvgpu-optimize-shared-memory"> {
   let summary = "Optimizes accesses to shard memory memrefs in order to reduce bank conflicts.";
   let constructor = "mlir::nvgpu::createOptimizeSharedMemoryPass()";
   let dependentDialects = [
index 4f25ff6..0e80fe3 100644 (file)
 
 namespace mlir {
 
-/// Creates a pass that bufferizes the SCF dialect.
-std::unique_ptr<Pass> createSCFBufferizePass();
-
-/// Creates a pass that specializes for loop for unrolling and
-/// vectorization.
-std::unique_ptr<Pass> createForLoopSpecializationPass();
-
-/// Creates a pass that peels for loops at their upper bounds for
-/// better vectorization.
-std::unique_ptr<Pass> createForLoopPeelingPass();
-
-/// Creates a pass that canonicalizes affine.min and affine.max operations
-/// inside of scf.for loops with known lower and upper bounds.
-std::unique_ptr<Pass> createSCFForLoopCanonicalizationPass();
-
-/// Creates a pass that transforms a single ParallelLoop over N induction
-/// variables into another ParallelLoop over less than N induction variables.
-std::unique_ptr<Pass> createParallelLoopCollapsingPass();
-
-/// Creates a loop fusion pass which fuses parallel loops.
-std::unique_ptr<Pass> createParallelLoopFusionPass();
-
-/// Creates a pass that specializes parallel loop for unrolling and
-/// vectorization.
-std::unique_ptr<Pass> createParallelLoopSpecializationPass();
-
-/// Creates a pass which tiles innermost parallel loops.
-/// If noMinMaxBounds, the upper bound of the inner loop will
-/// be a same value among different outter loop iterations, and
-/// an additional inbound check will be emitted inside the internal
-/// loops.
-std::unique_ptr<Pass>
-createParallelLoopTilingPass(llvm::ArrayRef<int64_t> tileSize = {},
-                             bool noMinMaxBounds = false);
-
-/// Creates a pass which folds arith ops on induction variable into
-/// loop range.
-std::unique_ptr<Pass> createForLoopRangeFoldingPass();
-
-// Creates a pass which lowers for loops into while loops.
-std::unique_ptr<Pass> createForToWhileLoopPass();
+#define GEN_PASS_DECL_SCFBUFFERIZEPASS
+#define GEN_PASS_DECL_SCFFORLOOPCANONICALIZATIONPASS
+#define GEN_PASS_DECL_SCFFORLOOPPEELINGPASS
+#define GEN_PASS_DECL_SCFFORLOOPSPECIALIZATIONPASS
+#define GEN_PASS_DECL_SCFPARALLELLOOPFUSIONPASS
+#define GEN_PASS_DECL_SCFPARALLELLOOPCOLLAPSINGPASS
+#define GEN_PASS_DECL_SCFPARALLELLOOPSPECIALIZATIONPASS
+#define GEN_PASS_DECL_SCFPARALLELLOOPTILINGPASS
+#define GEN_PASS_DECL_SCFFORLOOPRANGEFOLDINGPASS
+#define GEN_PASS_DECL_SCFFORTOWHILELOOPPASS
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
 
 //===----------------------------------------------------------------------===//
 // Registration
index 9abffe5..44b3433 100644 (file)
 
 include "mlir/Pass/PassBase.td"
 
-def SCFBufferize : Pass<"scf-bufferize"> {
+def SCFBufferizePass : Pass<"scf-bufferize"> {
   let summary = "Bufferize the scf dialect.";
-  let constructor = "mlir::createSCFBufferizePass()";
   let dependentDialects = ["bufferization::BufferizationDialect",
                            "memref::MemRefDialect"];
 }
 
 // Note: Making these canonicalization patterns would require a dependency
 // of the SCF dialect on the Affine/Tensor/MemRef dialects or vice versa.
-def SCFForLoopCanonicalization
+def SCFForLoopCanonicalizationPass
     : Pass<"scf-for-loop-canonicalization"> {
   let summary = "Canonicalize operations within scf.for loop bodies";
-  let constructor = "mlir::createSCFForLoopCanonicalizationPass()";
+  let description = [{
+      Canonicalize `affine.min` and `affine.max` operations inside of `scf.for`
+      loops with known lower and upper bounds.
+  }];
   let dependentDialects = ["AffineDialect", "tensor::TensorDialect",
                            "memref::MemRefDialect"];
 }
 
-def SCFForLoopPeeling : Pass<"scf-for-loop-peeling"> {
+def SCFForLoopPeelingPass : Pass<"scf-for-loop-peeling"> {
   let summary = "Peel `for` loops at their upper bounds.";
-  let constructor = "mlir::createForLoopPeelingPass()";
+  let description = [{
+     Peel for loops at their upper bounds for better vectorization.
+  }];
   let options = [
     Option<"skipPartial", "skip-partial", "bool",
            /*default=*/"true",
@@ -40,19 +44,20 @@ def SCFForLoopPeeling : Pass<"scf-for-loop-peeling"> {
   let dependentDialects = ["AffineDialect"];
 }
 
-def SCFForLoopSpecialization : Pass<"scf-for-loop-specialization"> {
+def SCFForLoopSpecializationPass : Pass<"scf-for-loop-specialization"> {
   let summary = "Specialize `for` loops for vectorization";
-  let constructor = "mlir::createForLoopSpecializationPass()";
 }
 
-def SCFParallelLoopFusion : Pass<"scf-parallel-loop-fusion"> {
+def SCFParallelLoopFusionPass : Pass<"scf-parallel-loop-fusion"> {
   let summary = "Fuse adjacent parallel loops";
-  let constructor = "mlir::createParallelLoopFusionPass()";
 }
 
-def SCFParallelLoopCollapsing : Pass<"scf-parallel-loop-collapsing"> {
+def SCFParallelLoopCollapsingPass : Pass<"scf-parallel-loop-collapsing"> {
   let summary = "Collapse parallel loops to use less induction variables";
-  let constructor = "mlir::createParallelLoopCollapsingPass()";
+  let description = [{
+      Transforms a single `ParallelLoop` over N induction variables into
+      another `ParallelLoop` over less than N induction variables.
+  }];
   let options = [
     ListOption<"clCollapsedIndices0", "collapsed-indices-0", "unsigned",
                "Which loop indices to combine 0th loop index">,
@@ -63,15 +68,22 @@ def SCFParallelLoopCollapsing : Pass<"scf-parallel-loop-collapsing"> {
   ];
 }
 
-def SCFParallelLoopSpecialization
+def SCFParallelLoopSpecializationPass
     : Pass<"scf-parallel-loop-specialization"> {
   let summary = "Specialize parallel loops for vectorization";
-  let constructor = "mlir::createParallelLoopSpecializationPass()";
+  let description = [{
+     Specialize parallel loop for unrolling and vectorization.
+  }];
 }
 
-def SCFParallelLoopTiling : Pass<"scf-parallel-loop-tiling"> {
+def SCFParallelLoopTilingPass : Pass<"scf-parallel-loop-tiling"> {
   let summary = "Tile parallel loops";
-  let constructor = "mlir::createParallelLoopTilingPass()";
+  let description = [{
+      Tile innermost parallel loops.
+      If `noMinMaxBounds`, the upper bound of the inner loop will be a same
+      value among different outter loop iterations, and an additional inbound
+      check will be emitted inside the internal loops.
+  }];
   let options = [
     ListOption<"tileSizes", "parallel-loop-tile-sizes", "int64_t",
                "Factors to tile parallel loops by">,
@@ -83,14 +95,15 @@ def SCFParallelLoopTiling : Pass<"scf-parallel-loop-tiling"> {
   let dependentDialects = ["AffineDialect"];
 }
 
-def SCFForLoopRangeFolding : Pass<"scf-for-loop-range-folding"> {
+def SCFForLoopRangeFoldingPass : Pass<"scf-for-loop-range-folding"> {
   let summary = "Fold add/mul ops into loop range";
-  let constructor = "mlir::createForLoopRangeFoldingPass()";
+  let description = [{
+      Fold arith ops on induction variable into loop range.
+  }];
 }
 
-def SCFForToWhileLoop : Pass<"scf-for-to-while"> {
+def SCFForToWhileLoopPass : Pass<"scf-for-to-while"> {
   let summary = "Convert SCF for loops to SCF while loops";
-  let constructor = "mlir::createForToWhileLoopPass()";
   let description = [{
     This pass transforms SCF.ForOp operations to SCF.WhileOp. The For loop
     condition is placed in the 'before' region of the while operation, and the
index 523be40..a0f9281 100644 (file)
@@ -27,6 +27,14 @@ class ModuleOp;
 // Passes
 //===----------------------------------------------------------------------===//
 
+#define GEN_PASS_DECL_SPIRVDECORATECOMPOSITETYPELAYOUTPASS
+#define GEN_PASS_DECL_SPIRVCANONICALIZEGLPASS
+#define GEN_PASS_DECL_SPIRVLOWERABIATTRIBUTESPASS
+#define GEN_PASS_DECL_SPIRVREWRITEINSERTSPASS
+#define GEN_PASS_DECL_SPIRVUNIFYALIASEDRESOURCEPASS
+#define GEN_PASS_DECL_SPIRVUPDATEVCEPASS
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
+
 /// Creates a pass to run canoncalization patterns that involve GL ops.
 /// These patterns cannot be run in default canonicalization because GL ops
 /// aren't always available. So they should be involed specifically when needed.
index d527185..ed6d8d2 100644 (file)
 
 include "mlir/Pass/PassBase.td"
 
-def SPIRVCompositeTypeLayout
-    : Pass<"decorate-spirv-composite-type-layout", "ModuleOp"> {
+def SPIRVDecorateCompositeTypeLayoutPass
+    : Pass<"decorate-spirv-composite-type-layout", "mlir::ModuleOp"> {
   let summary = "Decorate SPIR-V composite type with layout info";
   let constructor = "mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass()";
 }
 
-def SPIRVCanonicalizeGL : Pass<"spirv-canonicalize-gl", ""> {
+def SPIRVCanonicalizeGLPass : Pass<"spirv-canonicalize-gl", ""> {
   let summary = "Run canonicalization involving GLSL ops";
   let constructor = "mlir::spirv::createCanonicalizeGLPass()";
 }
 
-def SPIRVLowerABIAttributes : Pass<"spirv-lower-abi-attrs", "spirv::ModuleOp"> {
+def SPIRVLowerABIAttributesPass : Pass<"spirv-lower-abi-attrs", "spirv::ModuleOp"> {
   let summary = "Decorate SPIR-V composite type with layout info";
   let constructor = "mlir::spirv::createLowerABIAttributesPass()";
 }
@@ -40,7 +40,7 @@ def SPIRVUnifyAliasedResourcePass
   let constructor = "mlir::spirv::createUnifyAliasedResourcePass()";
 }
 
-def SPIRVUpdateVCE : Pass<"spirv-update-vce", "spirv::ModuleOp"> {
+def SPIRVUpdateVCEPass : Pass<"spirv-update-vce", "spirv::ModuleOp"> {
   let summary = "Deduce and attach minimal (version, capabilities, extensions) "
                 "requirements to spv.module ops";
   let constructor = "mlir::spirv::createUpdateVersionCapabilityExtensionPass()";
index a489ba3..06665e5 100644 (file)
@@ -25,6 +25,12 @@ class FuncOp;
 } // namespace mlir
 
 namespace mlir {
+
+#define GEN_PASS_DECL_SHAPETOSHAPELOWERINGPASS
+#define GEN_PASS_DECL_REMOVESHAPECONSTRAINTSPASS
+#define GEN_PASS_DECL_SHAPEBUFFERIZEPASS
+#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
+
 /// Creates an instance of the ShapeToShapeLowering pass that legalizes Shape
 /// dialect to be convertible to Arithmetic. For example, `shape.num_elements`
 /// get transformed to `shape.reduce`, which can be lowered to SCF and
index 47d16ce..a0c470a 100644 (file)
 
 include "mlir/Pass/PassBase.td"
 
-def RemoveShapeConstraints : Pass<"remove-shape-constraints", "func::FuncOp"> {
+def RemoveShapeConstraintsPass : Pass<"remove-shape-constraints", "func::FuncOp"> {
   let summary = "Replace all cstr_ ops with a true witness";
   let constructor = "mlir::createRemoveShapeConstraintsPass()";
 }
 
-def ShapeToShapeLowering : Pass<"shape-to-shape-lowering", "func::FuncOp"> {
+def ShapeToShapeLoweringPass : Pass<"shape-to-shape-lowering", "func::FuncOp"> {
   let summary = "Legalize Shape dialect to be convertible to Arithmetic";
   let constructor = "mlir::createShapeToShapeLowering()";
 }
 
 // TODO: Generalize this to allow any type conversions desired.
-def ShapeBufferize : Pass<"shape-bufferize", "func::FuncOp"> {
+def ShapeBufferizePass : Pass<"shape-bufferize", "func::FuncOp"> {
   let summary = "Bufferize the shape dialect.";
   let constructor = "mlir::createShapeBufferizePass()";
   let dependentDialects = ["bufferization::BufferizationDialect",
index 2d4bdb3..cba4b2e 100644 (file)
@@ -26,6 +26,11 @@ namespace bufferization {
 struct OneShotBufferizationOptions;
 } // namespace bufferization
 
+#define GEN_PASS_DECL_SPARSIFICATIONPASS
+#define GEN_PASS_DECL_SPARSETENSORCONVERSIONPASS
+#define GEN_PASS_DECL_SPARSETENSORCODEGENPASS
+#include "mlir/Dialect/SparseTensor/Transforms/Passes.h.inc"
+
 //===----------------------------------------------------------------------===//
 // The Sparsification pass.
 //===----------------------------------------------------------------------===//
index 4ca224b..b599ecd 100644 (file)
@@ -11,7 +11,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def Sparsification : Pass<"sparsification", "ModuleOp"> {
+def SparsificationPass : Pass<"sparsification", "ModuleOp"> {
   let summary = "Automatically generate sparse tensor code from sparse tensor types";
   let description = [{
     A pass that implements the core functionality of a **sparse compiler**.
@@ -76,7 +76,7 @@ def Sparsification : Pass<"sparsification", "ModuleOp"> {
   ];
 }
 
-def SparseTensorConversion : Pass<"sparse-tensor-conversion", "ModuleOp"> {
+def SparseTensorConversionPass : Pass<"sparse-tensor-conversion", "ModuleOp"> {
   let summary = "Convert sparse tensors and primitives to library calls";
   let description = [{
     A pass that converts sparse tensor primitives into calls into a runtime
@@ -122,7 +122,7 @@ def SparseTensorConversion : Pass<"sparse-tensor-conversion", "ModuleOp"> {
   ];
 }
 
-def SparseTensorCodegen : Pass<"sparse-tensor-codegen", "ModuleOp"> {
+def SparseTensorCodegenPass : Pass<"sparse-tensor-codegen", "ModuleOp"> {
   let summary = "Convert sparse tensors and primitives to actual code";
   let description = [{
     A pass that converts sparse tensor types and primitives to actual
index a346577..c0854f9 100644 (file)
 #include "mlir/Pass/Pass.h"
 
 namespace mlir {
-/// Creates an instance of `tensor` dialect bufferization pass.
-std::unique_ptr<Pass> createTensorBufferizePass();
+namespace tensor {
+
+#define GEN_PASS_DECL_TENSORBUFFERIZEPASS
+#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
 
 //===----------------------------------------------------------------------===//
 // Registration
 //===----------------------------------------------------------------------===//
 
-namespace tensor {
 /// Generate the code for registering passes.
 #define GEN_PASS_REGISTRATION
 #include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
index 2bf774d..3e7ccfb 100644 (file)
@@ -11,9 +11,8 @@
 
 include "mlir/Pass/PassBase.td"
 
-def TensorBufferize : Pass<"tensor-bufferize", "func::FuncOp"> {
+def TensorBufferizePass : Pass<"tensor-bufferize", "func::FuncOp"> {
   let summary = "Bufferize the `tensor` dialect";
-  let constructor = "mlir::createTensorBufferizePass()";
 }
 
 #endif // MLIR_DIALECT_TENSOR_TRANSFORMS_PASSES
diff --git a/mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h b/mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 218aa12..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-//===- PassDetail.h - TOSA Pass class details -------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
-#define MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Dialect/Tensor/IR/Tensor.h"
-#include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
index 9ffccfc..26a2df4 100644 (file)
 namespace mlir {
 namespace tosa {
 
+#define GEN_PASS_DECL_TOSALAYERWISECONSTANTFOLDPASS
+#define GEN_PASS_DECL_TOSAINFERSHAPESPASS
+#define GEN_PASS_DECL_TOSAMAKEBROADCASTABLEPASS
+#define GEN_PASS_DECL_TOSAOPTIONALDECOMPOSITIONSPASS
+#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
+
 // Expose Rewrite Functions that decompose TOSA Ops into further TOSA Ops.
 // The rewrites can be selectively added to a conversion pass.
 void populateTosaDecomposeConv2D(MLIRContext *ctx, RewritePatternSet &patterns);
@@ -29,12 +35,6 @@ void populateTosaDecomposeDepthwise(MLIRContext *ctx,
 void populateTosaFoldConstantTransposePatterns(MLIRContext *ctx,
                                                RewritePatternSet &patterns);
 
-std::unique_ptr<Pass> createTosaLayerwiseConstantFoldPass();
-std::unique_ptr<Pass> createTosaInferShapesPass();
-std::unique_ptr<Pass> createTosaMakeBroadcastablePass();
-std::unique_ptr<Pass> createTosaTestQuantUtilAPIPass();
-std::unique_ptr<Pass> createTosaOptionalDecompositions();
-
 #define GEN_PASS_REGISTRATION
 #include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
 
index 46bd7a4..45d96ad 100644 (file)
@@ -20,18 +20,14 @@ def TosaLayerwiseConstantFoldPass : Pass<"tosa-layerwise-constant-fold", "func::
   let description = [{
     Pass that enables folding of full-layer operations on constant tensors.
   }];
-
-  let constructor = "createTosaLayerwiseConstantFoldPass()";
 }
 
-def TosaInferShapes : Pass<"tosa-infer-shapes", "func::FuncOp"> {
+def TosaInferShapesPass : Pass<"tosa-infer-shapes", "func::FuncOp"> {
   let summary = "Propagate shapes across TOSA operations";
   let description = [{
     Pass that uses operand types and propagates shapes to TOSA operations.
     This includes legalizing rankless and dynamic shapes towards static.
   }];
-
-  let constructor = "createTosaInferShapesPass()";
   let dependentDialects = [
     "func::FuncDialect",
     "tensor::TensorDialect",
@@ -39,7 +35,7 @@ def TosaInferShapes : Pass<"tosa-infer-shapes", "func::FuncOp"> {
   ];
 }
 
-def TosaMakeBroadcastable : Pass<"tosa-make-broadcastable", "func::FuncOp"> {
+def TosaMakeBroadcastablePass : Pass<"tosa-make-broadcastable", "func::FuncOp"> {
   let summary = "TOSA rank Reshape to enable Broadcasting";
   let description = [{
     Pass that enables broadcast by making all input arrays have the same
@@ -48,19 +44,15 @@ def TosaMakeBroadcastable : Pass<"tosa-make-broadcastable", "func::FuncOp"> {
     approach similar to step 1 of Numpy 4-step broadcasting:
     https://numpy.org/doc/stable/reference/ufuncs.html#broadcasting
   }];
-
-  let constructor = "createTosaMakeBroadcastablePass()";
 }
 
-def TosaOptionalDecompositions
+def TosaOptionalDecompositionsPass
   : Pass<"tosa-optional-decompositions", "func::FuncOp"> {
   let summary = "Applies Tosa operations optional decompositions";
   let description = [{
     Pass to apply the Tosa operations decompositions 
     exposed as populate functions in include/mlir/Dialect/Tosa/Transforms/Passes.h
   }];
-
-  let constructor = "tosa::createTosaOptionalDecompositions()";
 }
 
 #endif // MLIR_DIALECT_TOSA_TRANSFORMS_PASSES
index a567db6..be5cbd5 100644 (file)
@@ -16,7 +16,8 @@ namespace mlir {
 class Pass;
 
 namespace transform {
-std::unique_ptr<Pass> createCheckUsesPass();
+#define GEN_PASS_DECL_CHECKUSESPASS
+#include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
 
 #define GEN_PASS_REGISTRATION
 #include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
index 1d7d865..4fdd2e3 100644 (file)
@@ -11,7 +11,7 @@
 
 include "mlir/Pass/PassBase.td"
 
-def CheckUses : Pass<"transform-dialect-check-uses"> {
+def CheckUsesPass : Pass<"transform-dialect-check-uses"> {
   let summary = "warn about potential use-after-free in the transform dialect";
   let description = [{
     This pass analyzes operations from the transform dialect and its extensions
@@ -30,7 +30,6 @@ def CheckUses : Pass<"transform-dialect-check-uses"> {
     prior to this pass provided that transform ops implement the relevant
     control flow interfaces.
   }];
-  let constructor = "::mlir::transform::createCheckUsesPass()";
 }
 
 #endif // MLIR_DIALECT_TRANSFORM_TRANSFORMS_PASSES
index 7734fe9..1d36132 100644 (file)
@@ -13,8 +13,8 @@
 
 namespace mlir {
 namespace vector {
-/// Creates an instance of the `vector` dialect bufferization pass.
-std::unique_ptr<Pass> createVectorBufferizePass();
+#define GEN_PASS_DECL_VECTORBUFFERIZEPASS
+#include "mlir/Dialect/Vector/Transforms/Passes.h.inc"
 
 //===----------------------------------------------------------------------===//
 // Registration
index a1971a7..c785093 100644 (file)
@@ -11,9 +11,8 @@
 
 include "mlir/Pass/PassBase.td"
 
-def VectorBufferize : Pass<"vector-bufferize", "func::FuncOp"> {
+def VectorBufferizePass : Pass<"vector-bufferize", "func::FuncOp"> {
   let summary = "Bufferize Vector dialect ops";
-  let constructor = "mlir::vector::createVectorBufferizePass()";
 }
 
 #endif // MLIR_DIALECT_VECTOR_TRANSFORMS_PASSES
diff --git a/mlir/include/mlir/Reducer/PassDetail.h b/mlir/include/mlir/Reducer/PassDetail.h
deleted file mode 100644 (file)
index 327d9b5..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-//===- PassDetail.h - Reducer Pass class details ----------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MLIR_REDUCER_PASSDETAIL_H
-#define MLIR_REDUCER_PASSDETAIL_H
-
-#include "mlir/IR/BuiltinOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-#define GEN_PASS_CLASSES
-#include "mlir/Reducer/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // MLIR_REDUCER_PASSDETAIL_H
index c0d46bf..a6d37f1 100644 (file)
 
 namespace mlir {
 
+#define GEN_PASS_DECL_REDUCTIONTREEPASS
+#define GEN_PASS_DECL_OPTREDUCTIONPASS
+#include "mlir/Reducer/Passes.h.inc"
+
 std::unique_ptr<Pass> createReductionTreePass();
 
 std::unique_ptr<Pass> createOptReductionPass();
index cf89176..26a56e7 100644 (file)
@@ -24,7 +24,7 @@ def CommonReductionPassOptions {
   ];
 }
 
-def ReductionTree : Pass<"reduction-tree"> {
+def ReductionTreePass : Pass<"reduction-tree"> {
   let summary = "Reduce the input with reduction-tree algorithm";
 
   let constructor = "mlir::createReductionTreePass()";
@@ -36,7 +36,7 @@ def ReductionTree : Pass<"reduction-tree"> {
   ] # CommonReductionPassOptions.options;
 }
 
-def OptReduction : Pass<"opt-reduction-pass", "ModuleOp"> {
+def OptReductionPass : Pass<"opt-reduction-pass", "ModuleOp"> {
   let summary = "A wrapper pass that reduces the file with optimization passes";
 
   let constructor = "mlir::createOptReductionPass()";
index 1da1145..7f30e57 100644 (file)
@@ -26,6 +26,9 @@ class Operation;
 class OpPrintingFlags;
 class Pass;
 
+#define GEN_PASS_DECL_LOCATIONSNAPSHOTPASS
+#include "mlir/Transforms/Passes.h.inc"
+
 /// This function generates new locations from the given IR by snapshotting the
 /// IR to the given stream, and using the printed locations within that stream.
 /// The generated locations replace the current operation locations.
index 16862ae..7463e62 100644 (file)
@@ -28,6 +28,19 @@ class GreedyRewriteConfig;
 // Passes
 //===----------------------------------------------------------------------===//
 
+#define GEN_PASS_DECL_CANONICALIZERPASS
+#define GEN_PASS_DECL_CONTROLFLOWSINKPASS
+#define GEN_PASS_DECL_CSEPASS
+#define GEN_PASS_DECL_LOOPINVARIANTCODEMOTIONPASS
+#define GEN_PASS_DECL_STRIPDEBUGINFOPASS
+#define GEN_PASS_DECL_PRINTOPSTATSPASS
+#define GEN_PASS_DECL_INLINERPASS
+#define GEN_PASS_DECL_SCCPPASS
+#define GEN_PASS_DECL_SYMBOLDCEPASS
+#define GEN_PASS_DECL_SYMBOLPRIVATIZEPASS
+#define GEN_PASS_DECL_TOPOLOGICALSORTPASS
+#include "mlir/Transforms/Passes.h.inc"
+
 /// Creates an instance of the Canonicalizer pass, configured with default
 /// settings (which can be overridden by pass options on the command line).
 std::unique_ptr<Pass> createCanonicalizerPass();
@@ -45,19 +58,6 @@ createCanonicalizerPass(const GreedyRewriteConfig &config,
                         ArrayRef<std::string> disabledPatterns = llvm::None,
                         ArrayRef<std::string> enabledPatterns = llvm::None);
 
-/// Creates a pass to perform control-flow sinking.
-std::unique_ptr<Pass> createControlFlowSinkPass();
-
-/// Creates a pass to perform common sub expression elimination.
-std::unique_ptr<Pass> createCSEPass();
-
-/// Creates a loop invariant code motion pass that hoists loop invariant
-/// instructions out of the loop.
-std::unique_ptr<Pass> createLoopInvariantCodeMotionPass();
-
-/// Creates a pass to strip debug information from a function.
-std::unique_ptr<Pass> createStripDebugInfoPass();
-
 /// Creates a pass which prints the list of ops and the number of occurrences in
 /// the module.
 std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os = llvm::errs());
@@ -83,24 +83,11 @@ std::unique_ptr<Pass>
 createInlinerPass(llvm::StringMap<OpPassManager> opPipelines,
                   std::function<void(OpPassManager &)> defaultPipelineBuilder);
 
-/// Creates a pass which performs sparse conditional constant propagation over
-/// nested operations.
-std::unique_ptr<Pass> createSCCPPass();
-
-/// Creates a pass which delete symbol operations that are unreachable. This
-/// pass may *only* be scheduled on an operation that defines a SymbolTable.
-std::unique_ptr<Pass> createSymbolDCEPass();
-
 /// Creates a pass which marks top-level symbol operations as `private` unless
 /// listed in `excludeSymbols`.
 std::unique_ptr<Pass>
 createSymbolPrivatizePass(ArrayRef<std::string> excludeSymbols = {});
 
-/// Creates a pass that recursively sorts nested regions without SSA dominance
-/// topologically such that, as much as possible, users of values appear after
-/// their producers.
-std::unique_ptr<Pass> createTopologicalSortPass();
-
 //===----------------------------------------------------------------------===//
 // Registration
 //===----------------------------------------------------------------------===//
index 8b8e6a1..d13c462 100644 (file)
@@ -16,7 +16,7 @@
 include "mlir/Pass/PassBase.td"
 include "mlir/Rewrite/PassUtil.td"
 
-def Canonicalizer : Pass<"canonicalize"> {
+def CanonicalizerPass : Pass<"canonicalize"> {
   let summary = "Canonicalize operations";
   let description = [{
     This pass performs various types of canonicalizations over a set of
@@ -37,7 +37,7 @@ def Canonicalizer : Pass<"canonicalize"> {
   ] # RewritePassUtils.options;
 }
 
-def ControlFlowSink : Pass<"control-flow-sink"> {
+def ControlFlowSinkPass : Pass<"control-flow-sink"> {
   let summary = "Sink operations into conditional blocks";
   let description = [{
     This pass implements control-flow sink on operations that implement
@@ -55,13 +55,12 @@ def ControlFlowSink : Pass<"control-flow-sink"> {
     blocks: ops in unreachable blocks may prevent other operations from being
     sunk as they may contain uses of their results
   }];
-  let constructor = "::mlir::createControlFlowSinkPass()";
   let statistics = [
     Statistic<"numSunk", "num-sunk", "Number of operations sunk">,
   ];
 }
 
-def CSE : Pass<"cse"> {
+def CSEPass : Pass<"cse"> {
   let summary = "Eliminate common sub-expressions";
   let description = [{
     This pass implements a generalized algorithm for common sub-expression
@@ -70,14 +69,13 @@ def CSE : Pass<"cse"> {
     operations. See [Common subexpression elimination](https://en.wikipedia.org/wiki/Common_subexpression_elimination)
     for more general details on this optimization.
   }];
-  let constructor = "mlir::createCSEPass()";
   let statistics = [
     Statistic<"numCSE", "num-cse'd", "Number of operations CSE'd">,
     Statistic<"numDCE", "num-dce'd", "Number of operations DCE'd">
   ];
 }
 
-def Inliner : Pass<"inline"> {
+def InlinerPass : Pass<"inline"> {
   let summary = "Inline function calls";
   let constructor = "mlir::createInlinerPass()";
   let options = [
@@ -92,7 +90,7 @@ def Inliner : Pass<"inline"> {
   ];
 }
 
-def LocationSnapshot : Pass<"snapshot-op-locations"> {
+def LocationSnapshotPass : Pass<"snapshot-op-locations"> {
   let summary = "Generate new locations from the current IR";
   let description = [{
     This pass allows for generating new locations from the IR during any stage
@@ -137,12 +135,11 @@ def LocationSnapshot : Pass<"snapshot-op-locations"> {
   ];
 }
 
-def LoopInvariantCodeMotion : Pass<"loop-invariant-code-motion"> {
+def LoopInvariantCodeMotionPass : Pass<"loop-invariant-code-motion"> {
   let summary = "Hoist loop invariant instructions outside of the loop";
-  let constructor = "mlir::createLoopInvariantCodeMotionPass()";
 }
 
-def PrintOpStats : Pass<"print-op-stats"> {
+def PrintOpStatsPass : Pass<"print-op-stats"> {
   let summary = "Print statistics of operations";
   let constructor = "mlir::createPrintOpStatsPass()";
   let options = [
@@ -151,7 +148,7 @@ def PrintOpStats : Pass<"print-op-stats"> {
   ];
 }
 
-def SCCP : Pass<"sccp"> {
+def SCCPPass : Pass<"sccp"> {
   let summary = "Sparse Conditional Constant Propagation";
   let description = [{
     This pass implements a general algorithm for sparse conditional constant
@@ -162,19 +159,17 @@ def SCCP : Pass<"sccp"> {
     This implementation is based on the algorithm described by Wegman and Zadeck
     in [“Constant Propagation with Conditional Branches”](https://dl.acm.org/doi/10.1145/103135.103136) (1991).
   }];
-  let constructor = "mlir::createSCCPPass()";
 }
 
-def StripDebugInfo : Pass<"strip-debuginfo"> {
+def StripDebugInfoPass : Pass<"strip-debuginfo"> {
   let summary = "Strip debug info from all operations";
   let description = [{
     This pass strips the IR of any location information, by replacing all
     operation locations with [`unknown`](Diagnostics.md#unknown-location).
   }];
-  let constructor = "mlir::createStripDebugInfoPass()";
 }
 
-def SymbolDCE : Pass<"symbol-dce"> {
+def SymbolDCEPass : Pass<"symbol-dce"> {
   let summary = "Eliminate dead symbols";
   let description = [{
     This pass deletes all symbols that are found to be unreachable. This is done
@@ -214,14 +209,13 @@ def SymbolDCE : Pass<"symbol-dce"> {
     See [Symbols and SymbolTables](SymbolsAndSymbolTables.md) for more
     information on `Symbols`.
   }];
-  let constructor = "mlir::createSymbolDCEPass()";
 
   let statistics = [
     Statistic<"numDCE", "num-dce'd", "Number of symbols DCE'd">,
   ];
 }
 
-def SymbolPrivatize : Pass<"symbol-privatize"> {
+def SymbolPrivatizePass : Pass<"symbol-privatize"> {
   let summary = "Mark symbols private";
   let description = [{
     This pass marks all top-level symbols of the operation run as `private`
@@ -234,7 +228,7 @@ def SymbolPrivatize : Pass<"symbol-privatize"> {
   let constructor = "mlir::createSymbolPrivatizePass()";
 }
 
-def ViewOpGraph : Pass<"view-op-graph"> {
+def ViewOpGraphPass : Pass<"view-op-graph"> {
   let summary = "Print Graphviz visualization of an operation";
   let description = [{
     This pass prints a Graphviz graph of a module.
@@ -261,10 +255,10 @@ def ViewOpGraph : Pass<"view-op-graph"> {
     Option<"printResultTypes", "print-result-types", "bool",
             /*default=*/"true", "Print result types of operations">
   ];
-  let constructor = "mlir::createPrintOpGraphPass()";
+  let constructor = "mlir::createViewOpGraphPass()";
 }
 
-def TopologicalSort : Pass<"topological-sort"> {
+def TopologicalSortPass : Pass<"topological-sort"> {
   let summary = "Sort regions without SSA dominance in topological order";
   let description = [{
     Recursively sorts all nested regions without SSA dominance in topological
@@ -277,8 +271,6 @@ def TopologicalSort : Pass<"topological-sort"> {
     is not changed. Operations that form a cycle are moved to the end of the
     regions in a stable order.
   }];
-
-  let constructor = "mlir::createTopologicalSortPass()";
 }
 
 #endif // MLIR_TRANSFORMS_PASSES
index ab52ec7..f8abc14 100644 (file)
 namespace mlir {
 class Pass;
 
+#define GEN_PASS_DECL_VIEWOPGRAPHPASS
+#include "mlir/Transforms/Passes.h.inc"
+
 /// Creates a pass to print op graphs.
-std::unique_ptr<Pass> createPrintOpGraphPass(raw_ostream &os = llvm::errs());
+std::unique_ptr<Pass> createViewOpGraphPass(raw_ostream &os = llvm::errs());
 
 } // namespace mlir
 
index 0e2894a..e292bf3 100644 (file)
@@ -7,11 +7,17 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Dialect/AMDGPU/AMDGPUDialect.h"
 #include "mlir/Dialect/LLVMIR/ROCDLDialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTAMDGPUTOROCDLPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 using namespace mlir::amdgpu;
@@ -269,8 +275,8 @@ struct LDSBarrierOpLowering : public ConvertOpToLLVMPattern<LDSBarrierOp> {
 };
 
 struct ConvertAMDGPUToROCDLPass
-    : public ConvertAMDGPUToROCDLBase<ConvertAMDGPUToROCDLPass> {
-  ConvertAMDGPUToROCDLPass() = default;
+    : public impl::ConvertAMDGPUToROCDLPassBase<ConvertAMDGPUToROCDLPass> {
+  using ConvertAMDGPUToROCDLPassBase::ConvertAMDGPUToROCDLPassBase;
 
   void runOnOperation() override {
     MLIRContext *ctx = &getContext();
@@ -303,7 +309,3 @@ void mlir::populateAMDGPUToROCDLConversionPatterns(LLVMTypeConverter &converter,
       RawBufferOpLowering<RawBufferAtomicFaddOp, ROCDL::RawBufferAtomicFAddOp>>(
       converter, chipset);
 }
-
-std::unique_ptr<Pass> mlir::createConvertAMDGPUToROCDLPass() {
-  return std::make_unique<ConvertAMDGPUToROCDLPass>();
-}
index 2c9a1ea..67835c0 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
 
-#include "../PassDetail.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/Utils.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/BlockAndValueMapping.h"
 #include "mlir/IR/IntegerSet.h"
 #include "mlir/IR/MLIRContext.h"
-#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "mlir/Transforms/Passes.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTAFFINETOSTANDARDPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::vector;
 
@@ -544,7 +547,11 @@ void mlir::populateAffineToVectorConversionPatterns(
 }
 
 namespace {
-class LowerAffinePass : public ConvertAffineToStandardBase<LowerAffinePass> {
+class ConvertAffineToStandardPass
+    : public impl::ConvertAffineToStandardPassBase<
+          ConvertAffineToStandardPass> {
+  using ConvertAffineToStandardPassBase::ConvertAffineToStandardPassBase;
+
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
     populateAffineToStdConversionPatterns(patterns);
@@ -558,9 +565,3 @@ class LowerAffinePass : public ConvertAffineToStandardBase<LowerAffinePass> {
   }
 };
 } // namespace
-
-/// Lowers If and For operations within a function into their lower level CFG
-/// equivalent blocks.
-std::unique_ptr<Pass> mlir::createLowerAffinePass() {
-  return std::make_unique<LowerAffinePass>();
-}
index df6df15..e579f27 100644 (file)
@@ -7,12 +7,18 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/VectorPattern.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/IR/TypeUtilities.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTARITHMETICTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -315,8 +321,9 @@ CmpFOpLowering::matchAndRewrite(arith::CmpFOp op, OpAdaptor adaptor,
 
 namespace {
 struct ConvertArithmeticToLLVMPass
-    : public ConvertArithmeticToLLVMBase<ConvertArithmeticToLLVMPass> {
-  ConvertArithmeticToLLVMPass() = default;
+    : public impl::ConvertArithmeticToLLVMPassBase<
+          ConvertArithmeticToLLVMPass> {
+  using ConvertArithmeticToLLVMPassBase::ConvertArithmeticToLLVMPassBase;
 
   void runOnOperation() override {
     LLVMConversionTarget target(getContext());
@@ -389,7 +396,3 @@ void mlir::arith::populateArithmeticToLLVMConversionPatterns(
   >(converter);
   // clang-format on
 }
-
-std::unique_ptr<Pass> mlir::arith::createConvertArithmeticToLLVMPass() {
-  return std::make_unique<ConvertArithmeticToLLVMPass>();
-}
index 6ca37c6..8e54e0d 100644 (file)
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h"
-#include "../PassDetail.h"
+
 #include "../SPIRVCommon/Pattern.h"
 #include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTARITHMETICTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "arith-to-spirv-pattern"
 
 using namespace mlir;
@@ -855,8 +860,8 @@ AddICarryOpPattern::matchAndRewrite(arith::AddUICarryOp op, OpAdaptor adaptor,
                                     ConversionPatternRewriter &rewriter) const {
   Type dstElemTy = adaptor.getLhs().getType();
   Location loc = op->getLoc();
-  Value result = rewriter.create<spirv::IAddCarryOp>(
-      loc, adaptor.getLhs(), adaptor.getRhs());
+  Value result = rewriter.create<spirv::IAddCarryOp>(loc, adaptor.getLhs(),
+                                                     adaptor.getRhs());
 
   Value sumResult = rewriter.create<spirv::CompositeExtractOp>(
       loc, result, llvm::makeArrayRef(0));
@@ -948,7 +953,10 @@ void mlir::arith::populateArithmeticToSPIRVPatterns(
 
 namespace {
 struct ConvertArithmeticToSPIRVPass
-    : public ConvertArithmeticToSPIRVBase<ConvertArithmeticToSPIRVPass> {
+    : public impl::ConvertArithmeticToSPIRVPassBase<
+          ConvertArithmeticToSPIRVPass> {
+  using ConvertArithmeticToSPIRVPassBase::ConvertArithmeticToSPIRVPassBase;
+
   void runOnOperation() override {
     Operation *op = getOperation();
     auto targetAttr = spirv::lookupTargetEnvOrDefault(op);
@@ -978,7 +986,6 @@ struct ConvertArithmeticToSPIRVPass
 };
 } // namespace
 
-std::unique_ptr<OperationPass<>>
-mlir::arith::createConvertArithmeticToSPIRVPass() {
+std::unique_ptr<OperationPass<>> mlir::createConvertArithmeticToSPIRVPass() {
   return std::make_unique<ConvertArithmeticToSPIRVPass>();
 }
index a2f5641..a963e71 100644 (file)
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h"
-#include "../PassDetail.h"
+
 #include "mlir/Dialect/ArmNeon/ArmNeonDialect.h"
 #include "mlir/Dialect/Vector/IR/VectorOps.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Pass/PassRegistry.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTARMNEON2DTOINTRPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::arm_neon;
 
@@ -46,8 +51,10 @@ public:
   }
 };
 
-class ConvertArmNeon2dToIntr
-    : public ConvertArmNeon2dToIntrBase<ConvertArmNeon2dToIntr> {
+class ConvertArmNeon2dToIntrPass
+    : public impl::ConvertArmNeon2dToIntrPassBase<ConvertArmNeon2dToIntrPass> {
+  using ConvertArmNeon2dToIntrPassBase::ConvertArmNeon2dToIntrPassBase;
+
   void runOnOperation() override {
     auto *context = &getContext();
 
@@ -65,7 +72,3 @@ class ConvertArmNeon2dToIntr
 void mlir::populateConvertArmNeon2dToIntrPatterns(RewritePatternSet &patterns) {
   patterns.add<Sdot2dLoweringPattern>(patterns.getContext());
 }
-
-std::unique_ptr<Pass> mlir::createConvertArmNeon2dToIntrPass() {
-  return std::make_unique<ConvertArmNeon2dToIntr>();
-}
index 26154e4..7ed8348 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h"
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/TypeConverter.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTASYNCTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "convert-async-to-llvm"
 
 using namespace mlir;
@@ -986,7 +990,9 @@ public:
 
 namespace {
 struct ConvertAsyncToLLVMPass
-    : public ConvertAsyncToLLVMBase<ConvertAsyncToLLVMPass> {
+    : public impl::ConvertAsyncToLLVMPassBase<ConvertAsyncToLLVMPass> {
+  using ConvertAsyncToLLVMPassBase::ConvertAsyncToLLVMPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
@@ -1117,10 +1123,6 @@ public:
 };
 } // namespace
 
-std::unique_ptr<OperationPass<ModuleOp>> mlir::createConvertAsyncToLLVMPass() {
-  return std::make_unique<ConvertAsyncToLLVMPass>();
-}
-
 void mlir::populateAsyncStructuralTypeConversionsAndLegality(
     TypeConverter &typeConverter, RewritePatternSet &patterns,
     ConversionTarget &target) {
@@ -1136,3 +1138,7 @@ void mlir::populateAsyncStructuralTypeConversionsAndLegality(
   target.addDynamicallyLegalOp<AwaitOp, ExecuteOp, async::YieldOp>(
       [&](Operation *op) { return typeConverter.isLegal(op); });
 }
+
+std::unique_ptr<OperationPass<ModuleOp>> mlir::createConvertAsyncToLLVMPass() {
+  return std::make_unique<ConvertAsyncToLLVMPass>();
+}
index d98bb2a..d1a575c 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h"
-#include "../PassDetail.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/BuiltinTypes.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Support/LogicalResult.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTBUFFERIZATIONTOMEMREFPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -81,9 +87,11 @@ void mlir::populateBufferizationToMemRefConversionPatterns(
 }
 
 namespace {
-struct BufferizationToMemRefPass
-    : public ConvertBufferizationToMemRefBase<BufferizationToMemRefPass> {
-  BufferizationToMemRefPass() = default;
+struct ConvertBufferizationToMemRefPass
+    : public impl::ConvertBufferizationToMemRefPassBase<
+          ConvertBufferizationToMemRefPass> {
+  using ConvertBufferizationToMemRefPassBase::
+      ConvertBufferizationToMemRefPassBase;
 
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
@@ -100,7 +108,3 @@ struct BufferizationToMemRefPass
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::createBufferizationToMemRefPass() {
-  return std::make_unique<BufferizationToMemRefPass>();
-}
index 820086e..8b5861d 100644 (file)
@@ -8,12 +8,17 @@
 
 #include "mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h"
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Complex/IR/Complex.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTCOMPLEXTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 using namespace mlir::LLVM;
@@ -318,7 +323,9 @@ void mlir::populateComplexToLLVMConversionPatterns(
 
 namespace {
 struct ConvertComplexToLLVMPass
-    : public ConvertComplexToLLVMBase<ConvertComplexToLLVMPass> {
+    : public impl::ConvertComplexToLLVMPassBase<ConvertComplexToLLVMPass> {
+  using ConvertComplexToLLVMPassBase::ConvertComplexToLLVMPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
@@ -335,7 +342,3 @@ void ConvertComplexToLLVMPass::runOnOperation() {
           applyPartialConversion(getOperation(), target, std::move(patterns))))
     signalPassFailure();
 }
-
-std::unique_ptr<Pass> mlir::createConvertComplexToLLVMPass() {
-  return std::make_unique<ConvertComplexToLLVMPass>();
-}
index 558b1cc..e8da779 100644 (file)
@@ -8,10 +8,15 @@
 
 #include "mlir/Conversion/ComplexToLibm/ComplexToLibm.h"
 
-#include "../PassDetail.h"
 #include "mlir/Dialect/Complex/IR/Complex.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/PatternMatch.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTCOMPLEXTOLIBMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -117,7 +122,9 @@ void mlir::populateComplexToLibmConversionPatterns(RewritePatternSet &patterns,
 
 namespace {
 struct ConvertComplexToLibmPass
-    : public ConvertComplexToLibmBase<ConvertComplexToLibmPass> {
+    : public impl::ConvertComplexToLibmPassBase<ConvertComplexToLibmPass> {
+  using ConvertComplexToLibmPassBase::ConvertComplexToLibmPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index 064b0db..b7b833b 100644 (file)
@@ -8,16 +8,20 @@
 
 #include "mlir/Conversion/ComplexToStandard/ComplexToStandard.h"
 
-#include <memory>
-#include <type_traits>
-
-#include "../PassDetail.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Complex/IR/Complex.h"
 #include "mlir/Dialect/Math/IR/Math.h"
 #include "mlir/IR/ImplicitLocOpBuilder.h"
 #include "mlir/IR/PatternMatch.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
+#include <memory>
+#include <type_traits>
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTCOMPLEXTOSTANDARDPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -1081,7 +1085,10 @@ void mlir::populateComplexToStandardConversionPatterns(
 
 namespace {
 struct ConvertComplexToStandardPass
-    : public ConvertComplexToStandardBase<ConvertComplexToStandardPass> {
+    : public impl::ConvertComplexToStandardPassBase<
+          ConvertComplexToStandardPass> {
+  using ConvertComplexToStandardPassBase::ConvertComplexToStandardPassBase;
+
   void runOnOperation() override;
 };
 
@@ -1098,7 +1105,3 @@ void ConvertComplexToStandardPass::runOnOperation() {
     signalPassFailure();
 }
 } // namespace
-
-std::unique_ptr<Pass> mlir::createConvertComplexToStandardPass() {
-  return std::make_unique<ConvertComplexToStandardPass>();
-}
index 8901270..b5e435b 100644 (file)
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Conversion/LLVMCommon/VectorPattern.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/IR/BuiltinOps.h"
 #include "mlir/IR/PatternMatch.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "llvm/ADT/StringRef.h"
 #include <functional>
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTCONTROLFLOWTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 #define PASS_NAME "convert-cf-to-llvm"
@@ -195,9 +201,10 @@ void mlir::cf::populateControlFlowToLLVMConversionPatterns(
 
 namespace {
 /// A pass converting MLIR operations into the LLVM IR dialect.
-struct ConvertControlFlowToLLVM
-    : public ConvertControlFlowToLLVMBase<ConvertControlFlowToLLVM> {
-  ConvertControlFlowToLLVM() = default;
+struct ConvertControlFlowToLLVMPass
+    : public impl::ConvertControlFlowToLLVMPassBase<
+          ConvertControlFlowToLLVMPass> {
+  using ConvertControlFlowToLLVMPassBase::ConvertControlFlowToLLVMPassBase;
 
   /// Run the dialect converter on the module.
   void runOnOperation() override {
@@ -217,7 +224,3 @@ struct ConvertControlFlowToLLVM
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::cf::createConvertControlFlowToLLVMPass() {
-  return std::make_unique<ConvertControlFlowToLLVM>();
-}
index 6cd237e..5eb51d5 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTCONTROLFLOWTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 /// A pass converting MLIR ControlFlow operations into the SPIR-V dialect.
 class ConvertControlFlowToSPIRVPass
-    : public ConvertControlFlowToSPIRVBase<ConvertControlFlowToSPIRVPass> {
+    : public impl::ConvertControlFlowToSPIRVPassBase<
+          ConvertControlFlowToSPIRVPass> {
+  using ConvertControlFlowToSPIRVPassBase::ConvertControlFlowToSPIRVPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index 4b80bcb..08979cc 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
+#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h"
+
 #include "mlir/Analysis/DataLayoutAnalysis.h"
 #include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
 #include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
 #include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
-#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h"
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Conversion/LLVMCommon/VectorPattern.h"
 #include <algorithm>
 #include <functional>
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTFUNCTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 #define PASS_NAME "convert-func-to-llvm"
@@ -699,7 +704,7 @@ void mlir::populateFuncToLLVMConversionPatterns(LLVMTypeConverter &converter,
 namespace {
 /// A pass converting Func operations into the LLVM IR dialect.
 struct ConvertFuncToLLVMPass
-    : public ConvertFuncToLLVMBase<ConvertFuncToLLVMPass> {
+    : public impl::ConvertFuncToLLVMPassBase<ConvertFuncToLLVMPass> {
   ConvertFuncToLLVMPass() = default;
   ConvertFuncToLLVMPass(bool useBarePtrCallConv, unsigned indexBitwidth,
                         bool useAlignedAlloc,
index d2416fe..131623f 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTFUNCTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 /// A pass converting MLIR Func operations into the SPIR-V dialect.
 class ConvertFuncToSPIRVPass
-    : public ConvertFuncToSPIRVBase<ConvertFuncToSPIRVPass> {
+    : public impl::ConvertFuncToSPIRVPassBase<ConvertFuncToSPIRVPass> {
+  using ConvertFuncToSPIRVPassBase::ConvertFuncToSPIRVPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index e4448ff..8757726 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "mlir/Conversion/GPUCommon/GPUCommonPass.h"
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
 #include "mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h"
 #include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FormatVariadic.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTGPUTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 static constexpr const char *kGpuBinaryStorageSuffix = "_gpubin_cst";
 
 namespace {
 
-class GpuToLLVMConversionPass
-    : public GpuToLLVMConversionPassBase<GpuToLLVMConversionPass> {
+class ConvertGpuToLLVMPass
+    : public impl::ConvertGpuToLLVMPassBase<ConvertGpuToLLVMPass> {
 public:
-  GpuToLLVMConversionPass() = default;
+  ConvertGpuToLLVMPass() = default;
 
-  GpuToLLVMConversionPass(bool kernelBarePtrCallConv)
-      : GpuToLLVMConversionPass() {
+  ConvertGpuToLLVMPass(bool kernelBarePtrCallConv) : ConvertGpuToLLVMPass() {
     if (this->kernelBarePtrCallConv.getNumOccurrences() == 0)
       this->kernelBarePtrCallConv = kernelBarePtrCallConv;
   }
 
-  GpuToLLVMConversionPass(const GpuToLLVMConversionPass &other)
-      : GpuToLLVMConversionPassBase(other) {}
+  ConvertGpuToLLVMPass(const ConvertGpuToLLVMPass &other)
+      : ConvertGpuToLLVMPassBase(other) {}
 
   // Run the dialect converter on the module.
   void runOnOperation() override;
@@ -377,7 +380,7 @@ public:
 };
 } // namespace
 
-void GpuToLLVMConversionPass::runOnOperation() {
+void ConvertGpuToLLVMPass::runOnOperation() {
   LLVMTypeConverter converter(&getContext());
   RewritePatternSet patterns(&getContext());
   LLVMConversionTarget target(getContext());
@@ -896,11 +899,6 @@ LogicalResult ConvertSetDefaultDeviceOpToGpuRuntimeCallPattern::matchAndRewrite(
   return success();
 }
 
-std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
-mlir::createGpuToLLVMConversionPass(bool kernelBarePtrCallConv) {
-  return std::make_unique<GpuToLLVMConversionPass>(kernelBarePtrCallConv);
-}
-
 void mlir::populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter,
                                                RewritePatternSet &patterns,
                                                StringRef gpuBinaryAnnotation,
@@ -922,3 +920,8 @@ void mlir::populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter,
       converter, gpuBinaryAnnotation, kernelBarePtrCallConv);
   patterns.add<EraseGpuModuleOpPattern>(&converter.getContext());
 }
+
+std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
+mlir::createConvertGpuToLLVMPass(bool kernelBarePtrCallConv) {
+  return std::make_unique<ConvertGpuToLLVMPass>(kernelBarePtrCallConv);
+}
index 2e89a3a..07af892 100644 (file)
 #include "../GPUCommon/GPUOpsLowering.h"
 #include "../GPUCommon/IndexIntrinsicsOpLowering.h"
 #include "../GPUCommon/OpToFuncCallLowering.h"
-#include "../PassDetail.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTGPUTONVVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -151,10 +155,10 @@ struct GPULaneIdOpToNVVM : ConvertOpToLLVMPattern<gpu::LaneIdOp> {
 ///
 /// This pass only handles device code and is not meant to be run on GPU host
 /// code.
-struct LowerGpuOpsToNVVMOpsPass
-    : public ConvertGpuOpsToNVVMOpsBase<LowerGpuOpsToNVVMOpsPass> {
-  LowerGpuOpsToNVVMOpsPass() = default;
-  LowerGpuOpsToNVVMOpsPass(unsigned indexBitwidth) {
+struct ConvertGpuToNVVMPass
+    : public impl::ConvertGpuToNVVMPassBase<ConvertGpuToNVVMPass> {
+  ConvertGpuToNVVMPass() = default;
+  ConvertGpuToNVVMPass(unsigned indexBitwidth) {
     this->indexBitwidth = indexBitwidth;
   }
 
@@ -289,6 +293,6 @@ void mlir::populateGpuToNVVMConversionPatterns(LLVMTypeConverter &converter,
 }
 
 std::unique_ptr<OperationPass<gpu::GPUModuleOp>>
-mlir::createLowerGpuOpsToNVVMOpsPass(unsigned indexBitwidth) {
-  return std::make_unique<LowerGpuOpsToNVVMOpsPass>(indexBitwidth);
+mlir::createConvertGpuToNVVMPass(unsigned indexBitwidth) {
+  return std::make_unique<ConvertGpuToNVVMPass>(indexBitwidth);
 }
index 2c7f700..3e6b844 100644 (file)
 #include "../GPUCommon/GPUOpsLowering.h"
 #include "../GPUCommon/IndexIntrinsicsOpLowering.h"
 #include "../GPUCommon/OpToFuncCallLowering.h"
-#include "../PassDetail.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTGPUTOROCDLPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -61,12 +65,11 @@ namespace {
 //
 // This pass only handles device code and is not meant to be run on GPU host
 // code.
-struct LowerGpuOpsToROCDLOpsPass
-    : public ConvertGpuOpsToROCDLOpsBase<LowerGpuOpsToROCDLOpsPass> {
-  LowerGpuOpsToROCDLOpsPass() = default;
-  LowerGpuOpsToROCDLOpsPass(const std::string &chipset, unsigned indexBitwidth,
-                            bool useBarePtrCallConv,
-                            gpu::amd::Runtime runtime) {
+struct ConvertGpuToROCDLPass
+    : public impl::ConvertGpuToROCDLPassBase<ConvertGpuToROCDLPass> {
+  ConvertGpuToROCDLPass() = default;
+  ConvertGpuToROCDLPass(const std::string &chipset, unsigned indexBitwidth,
+                        bool useBarePtrCallConv, gpu::amd::Runtime runtime) {
     if (this->chipset.getNumOccurrences() == 0)
       this->chipset = chipset;
     if (this->indexBitwidth.getNumOccurrences() == 0)
@@ -220,10 +223,10 @@ void mlir::populateGpuToROCDLConversionPatterns(
 }
 
 std::unique_ptr<OperationPass<gpu::GPUModuleOp>>
-mlir::createLowerGpuOpsToROCDLOpsPass(const std::string &chipset,
-                                      unsigned indexBitwidth,
-                                      bool useBarePtrCallConv,
-                                      gpu::amd::Runtime runtime) {
-  return std::make_unique<LowerGpuOpsToROCDLOpsPass>(
-      chipset, indexBitwidth, useBarePtrCallConv, runtime);
+mlir::createConvertGpuToROCDLPass(const std::string &chipset,
+                                  unsigned indexBitwidth,
+                                  bool useBarePtrCallConv,
+                                  gpu::amd::Runtime runtime) {
+  return std::make_unique<ConvertGpuToROCDLPass>(chipset, indexBitwidth,
+                                                 useBarePtrCallConv, runtime);
 }
index 480c903..f5fa81c 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h"
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h"
 #include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
 #include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTGPUTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -35,9 +39,10 @@ namespace {
 /// replace it).
 ///
 /// 2) Lower the body of the spirv::ModuleOp.
-class GPUToSPIRVPass : public ConvertGPUToSPIRVBase<GPUToSPIRVPass> {
+class ConvertGPUToSPIRVPass
+    : public impl::ConvertGPUToSPIRVPassBase<ConvertGPUToSPIRVPass> {
 public:
-  explicit GPUToSPIRVPass(bool mapMemorySpace)
+  explicit ConvertGPUToSPIRVPass(bool mapMemorySpace)
       : mapMemorySpace(mapMemorySpace) {}
   void runOnOperation() override;
 
@@ -46,7 +51,7 @@ private:
 };
 } // namespace
 
-void GPUToSPIRVPass::runOnOperation() {
+void ConvertGPUToSPIRVPass::runOnOperation() {
   MLIRContext *context = &getContext();
   ModuleOp module = getOperation();
 
@@ -94,5 +99,5 @@ void GPUToSPIRVPass::runOnOperation() {
 
 std::unique_ptr<OperationPass<ModuleOp>>
 mlir::createConvertGPUToSPIRVPass(bool mapMemorySpace) {
-  return std::make_unique<GPUToSPIRVPass>(mapMemorySpace);
+  return std::make_unique<ConvertGPUToSPIRVPass>(mapMemorySpace);
 }
index 361dae6..64f6106 100644 (file)
@@ -13,8 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
+
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/BuiltinOps.h"
 #include "mlir/IR/BuiltinTypes.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Target/SPIRV/Serialization.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNCPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 static constexpr const char *kSPIRVBlobAttrName = "spirv_blob";
@@ -37,10 +43,13 @@ namespace {
 /// SPIR-V binary shader from `spirv::ModuleOp` using `spirv::serialize`
 /// function and attaching binary data and entry point name as an attributes to
 /// created vulkan launch call op.
-class ConvertGpuLaunchFuncToVulkanLaunchFunc
-    : public ConvertGpuLaunchFuncToVulkanLaunchFuncBase<
-          ConvertGpuLaunchFuncToVulkanLaunchFunc> {
+class ConvertGpuLaunchFuncToVulkanLaunchFuncPass
+    : public impl::ConvertGpuLaunchFuncToVulkanLaunchFuncPassBase<
+          ConvertGpuLaunchFuncToVulkanLaunchFuncPass> {
 public:
+  using ConvertGpuLaunchFuncToVulkanLaunchFuncPassBase::
+      ConvertGpuLaunchFuncToVulkanLaunchFuncPassBase;
+
   void runOnOperation() override;
 
 private:
@@ -76,7 +85,7 @@ private:
 
 } // namespace
 
-void ConvertGpuLaunchFuncToVulkanLaunchFunc::runOnOperation() {
+void ConvertGpuLaunchFuncToVulkanLaunchFuncPass::runOnOperation() {
   bool done = false;
   getOperation().walk([this, &done](gpu::LaunchFuncOp op) {
     if (done) {
@@ -97,7 +106,8 @@ void ConvertGpuLaunchFuncToVulkanLaunchFunc::runOnOperation() {
     spirvModule.erase();
 }
 
-LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFunc::declareVulkanLaunchFunc(
+LogicalResult
+ConvertGpuLaunchFuncToVulkanLaunchFuncPass::declareVulkanLaunchFunc(
     Location loc, gpu::LaunchFuncOp launchOp) {
   auto builder = OpBuilder::atBlockEnd(getOperation().getBody());
 
@@ -128,7 +138,7 @@ LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFunc::declareVulkanLaunchFunc(
   return success();
 }
 
-LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFunc::createBinaryShader(
+LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFuncPass::createBinaryShader(
     ModuleOp module, std::vector<char> &binaryShader) {
   bool done = false;
   SmallVector<uint32_t, 0> binary;
@@ -146,7 +156,7 @@ LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFunc::createBinaryShader(
   return success();
 }
 
-void ConvertGpuLaunchFuncToVulkanLaunchFunc::convertGpuLaunchFunc(
+void ConvertGpuLaunchFuncToVulkanLaunchFuncPass::convertGpuLaunchFunc(
     gpu::LaunchFuncOp launchOp) {
   ModuleOp module = getOperation();
   OpBuilder builder(launchOp);
@@ -188,5 +198,5 @@ void ConvertGpuLaunchFuncToVulkanLaunchFunc::convertGpuLaunchFunc(
 
 std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
 mlir::createConvertGpuLaunchFuncToVulkanLaunchFuncPass() {
-  return std::make_unique<ConvertGpuLaunchFuncToVulkanLaunchFunc>();
+  return std::make_unique<ConvertGpuLaunchFuncToVulkanLaunchFuncPass>();
 }
index 3242add..043612a 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
+
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/IR/Attributes.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/BuiltinOps.h"
-
+#include "mlir/Pass/Pass.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/FormatVariadic.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 static constexpr const char *kCInterfaceVulkanLaunch =
@@ -53,7 +58,7 @@ namespace {
 /// * deinitVulkan         -- deinitializes vulkan runtime
 ///
 class VulkanLaunchFuncToVulkanCallsPass
-    : public ConvertVulkanLaunchFuncToVulkanCallsBase<
+    : public impl::ConvertVulkanLaunchFuncToVulkanCallsPassBase<
           VulkanLaunchFuncToVulkanCallsPass> {
 private:
   void initializeCachedTypes() {
@@ -149,6 +154,9 @@ private:
   }
 
 public:
+  using ConvertVulkanLaunchFuncToVulkanCallsPassBase::
+      ConvertVulkanLaunchFuncToVulkanCallsPassBase;
+
   void runOnOperation() override;
 
 private:
index 04512f0..26066ac 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h"
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/ErrorHandling.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTLINALGTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::LLVM;
 using namespace mlir::linalg;
@@ -74,7 +78,9 @@ void mlir::populateLinalgToLLVMConversionPatterns(LLVMTypeConverter &converter,
 
 namespace {
 struct ConvertLinalgToLLVMPass
-    : public ConvertLinalgToLLVMBase<ConvertLinalgToLLVMPass> {
+    : public impl::ConvertLinalgToLLVMPassBase<ConvertLinalgToLLVMPass> {
+  using ConvertLinalgToLLVMPassBase::ConvertLinalgToLLVMPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index 1238cfe..0e37717 100644 (file)
@@ -7,22 +7,31 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTLINALGTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
 namespace {
 /// A pass converting MLIR Linalg ops into SPIR-V ops.
-class LinalgToSPIRVPass : public ConvertLinalgToSPIRVBase<LinalgToSPIRVPass> {
+class ConvertLinalgToSPIRVPass
+    : public impl::ConvertLinalgToSPIRVPassBase<ConvertLinalgToSPIRVPass> {
+  using ConvertLinalgToSPIRVPassBase::ConvertLinalgToSPIRVPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
 
-void LinalgToSPIRVPass::runOnOperation() {
+void ConvertLinalgToSPIRVPass::runOnOperation() {
   MLIRContext *context = &getContext();
   ModuleOp module = getOperation();
 
@@ -46,6 +55,7 @@ void LinalgToSPIRVPass::runOnOperation() {
     return signalPassFailure();
 }
 
-std::unique_ptr<OperationPass<ModuleOp>> mlir::createLinalgToSPIRVPass() {
-  return std::make_unique<LinalgToSPIRVPass>();
+std::unique_ptr<OperationPass<ModuleOp>>
+mlir::createConvertLinalgToSPIRVPass() {
+  return std::make_unique<ConvertLinalgToSPIRVPass>();
 }
index 2779d24..313f86e 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "mlir/Conversion/LinalgToStandard/LinalgToStandard.h"
 
-#include "../PassDetail.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTLINALGTOSTANDARDPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 using namespace mlir::linalg;
@@ -121,7 +126,10 @@ void mlir::linalg::populateLinalgToStandardConversionPatterns(
 
 namespace {
 struct ConvertLinalgToStandardPass
-    : public ConvertLinalgToStandardBase<ConvertLinalgToStandardPass> {
+    : public impl::ConvertLinalgToStandardPassBase<
+          ConvertLinalgToStandardPass> {
+  using ConvertLinalgToStandardPassBase::ConvertLinalgToStandardPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index 25ee8ce..be0048b 100644 (file)
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/MathToFuncs/MathToFuncs.h"
-#include "../PassDetail.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Vector/Utils/VectorUtils.h"
 #include "mlir/IR/ImplicitLocOpBuilder.h"
 #include "mlir/IR/TypeUtilities.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTMATHTOFUNCSPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -318,8 +324,8 @@ IPowIOpLowering::matchAndRewrite(math::IPowIOp op,
 
 namespace {
 struct ConvertMathToFuncsPass
-    : public ConvertMathToFuncsBase<ConvertMathToFuncsPass> {
-  ConvertMathToFuncsPass() = default;
+    : public impl::ConvertMathToFuncsPassBase<ConvertMathToFuncsPass> {
+  using ConvertMathToFuncsPassBase::ConvertMathToFuncsPassBase;
 
   void runOnOperation() override;
 
@@ -377,7 +383,3 @@ void ConvertMathToFuncsPass::runOnOperation() {
   if (failed(applyPartialConversion(module, target, std::move(patterns))))
     signalPassFailure();
 }
-
-std::unique_ptr<Pass> mlir::createConvertMathToFuncsPass() {
-  return std::make_unique<ConvertMathToFuncsPass>();
-}
index 8161cc5..f53d436 100644 (file)
@@ -7,13 +7,19 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Conversion/LLVMCommon/VectorPattern.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/Math/IR/Math.h"
 #include "mlir/IR/TypeUtilities.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTMATHTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -250,8 +256,8 @@ struct RsqrtOpLowering : public ConvertOpToLLVMPattern<math::RsqrtOp> {
 };
 
 struct ConvertMathToLLVMPass
-    : public ConvertMathToLLVMBase<ConvertMathToLLVMPass> {
-  ConvertMathToLLVMPass() = default;
+    : public impl::ConvertMathToLLVMPassBase<ConvertMathToLLVMPass> {
+  using ConvertMathToLLVMPassBase::ConvertMathToLLVMPassBase;
 
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
@@ -295,7 +301,3 @@ void mlir::populateMathToLLVMConversionPatterns(LLVMTypeConverter &converter,
   >(converter);
   // clang-format on
 }
-
-std::unique_ptr<Pass> mlir::createConvertMathToLLVMPass() {
-  return std::make_unique<ConvertMathToLLVMPass>();
-}
index 6dcf453..553b88d 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "mlir/Conversion/MathToLibm/MathToLibm.h"
 
-#include "../PassDetail.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/Vector/Utils/VectorUtils.h"
 #include "mlir/IR/BuiltinDialect.h"
 #include "mlir/IR/PatternMatch.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTMATHTOLIBMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -193,7 +198,9 @@ void mlir::populateMathToLibmConversionPatterns(
 
 namespace {
 struct ConvertMathToLibmPass
-    : public ConvertMathToLibmBase<ConvertMathToLibmPass> {
+    : public impl::ConvertMathToLibmPassBase<ConvertMathToLibmPass> {
+  using ConvertMathToLibmPassBase::ConvertMathToLibmPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index 6ef71d9..d86abda 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/MathToSPIRV/MathToSPIRV.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTMATHTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
 namespace {
 /// A pass converting MLIR Math operations into the SPIR-V dialect.
 class ConvertMathToSPIRVPass
-    : public ConvertMathToSPIRVBase<ConvertMathToSPIRVPass> {
+    : public impl::ConvertMathToSPIRVPassBase<ConvertMathToSPIRVPass> {
+  using ConvertMathToSPIRVPassBase::ConvertMathToSPIRVPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index 8b3348f..bacea71 100644 (file)
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
-#include "../PassDetail.h"
+
 #include "mlir/Analysis/DataLayoutAnalysis.h"
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/AffineMap.h"
 #include "mlir/IR/BlockAndValueMapping.h"
+#include "mlir/Pass/Pass.h"
 #include "llvm/ADT/SmallBitVector.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTMEMREFTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -2042,8 +2048,9 @@ void mlir::populateMemRefToLLVMConversionPatterns(LLVMTypeConverter &converter,
 }
 
 namespace {
-struct MemRefToLLVMPass : public ConvertMemRefToLLVMBase<MemRefToLLVMPass> {
-  MemRefToLLVMPass() = default;
+struct ConvertMemRefToLLVMPass
+    : public impl::ConvertMemRefToLLVMPassBase<ConvertMemRefToLLVMPass> {
+  using ConvertMemRefToLLVMPassBase::ConvertMemRefToLLVMPassBase;
 
   void runOnOperation() override {
     Operation *op = getOperation();
@@ -2070,7 +2077,3 @@ struct MemRefToLLVMPass : public ConvertMemRefToLLVMBase<MemRefToLLVMPass> {
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::createMemRefToLLVMPass() {
-  return std::make_unique<MemRefToLLVMPass>();
-}
index e63f059..b55e69f 100644 (file)
@@ -11,9 +11,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
-#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
 #include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h"
+
+#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_MAPMEMREFSTORAGECLASSPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "mlir-map-memref-storage-class"
 
 using namespace mlir;
@@ -284,7 +289,7 @@ void spirv::populateMemorySpaceToStorageClassPatterns(
 
 namespace {
 class MapMemRefStorageClassPass final
-    : public MapMemRefStorageClassBase<MapMemRefStorageClassPass> {
+    : public impl::MapMemRefStorageClassPassBase<MapMemRefStorageClassPass> {
 public:
   explicit MapMemRefStorageClassPass() {
     memorySpaceMap = spirv::mapMemorySpaceToVulkanStorageClass;
index 44fc17b..a97f4c3 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTMEMREFTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 /// A pass converting MLIR MemRef operations into the SPIR-V dialect.
 class ConvertMemRefToSPIRVPass
-    : public ConvertMemRefToSPIRVBase<ConvertMemRefToSPIRVPass> {
+    : public impl::ConvertMemRefToSPIRVPassBase<ConvertMemRefToSPIRVPass> {
+  using ConvertMemRefToSPIRVPassBase::ConvertMemRefToSPIRVPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index ff515bc..955a7dc 100644 (file)
@@ -7,12 +7,18 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/LLVMIR/NVVMDialect.h"
 #include "mlir/Dialect/NVGPU/IR/NVGPUDialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTNVGPUTONVVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -327,8 +333,8 @@ struct MmaSyncOptoNVVM : public ConvertOpToLLVMPattern<nvgpu::MmaSyncOp> {
 };
 
 struct ConvertNVGPUToNVVMPass
-    : public ConvertNVGPUToNVVMBase<ConvertNVGPUToNVVMPass> {
-  ConvertNVGPUToNVVMPass() = default;
+    : public impl::ConvertNVGPUToNVVMPassBase<ConvertNVGPUToNVVMPass> {
+  using ConvertNVGPUToNVVMPassBase::ConvertNVGPUToNVVMPassBase;
 
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
@@ -438,7 +444,3 @@ void mlir::populateNVGPUToNVVMConversionPatterns(LLVMTypeConverter &converter,
                NVGPUAsyncCreateGroupLowering, NVGPUAsyncWaitLowering>(
       converter);
 }
-
-std::unique_ptr<Pass> mlir::createConvertNVGPUToNVVMPass() {
-  return std::make_unique<ConvertNVGPUToNVVMPass>();
-}
index 43a49a5..eab0abc 100644 (file)
@@ -6,12 +6,18 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
-#include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h"
+
+#include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/OpenACC/OpenACC.h"
 #include "mlir/IR/Builders.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTOPENACCTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -148,7 +154,9 @@ void mlir::populateOpenACCToLLVMConversionPatterns(
 
 namespace {
 struct ConvertOpenACCToLLVMPass
-    : public ConvertOpenACCToLLVMBase<ConvertOpenACCToLLVMPass> {
+    : public impl::ConvertOpenACCToLLVMPassBase<ConvertOpenACCToLLVMPass> {
+  using ConvertOpenACCToLLVMPassBase::ConvertOpenACCToLLVMPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index ddc4517..34a4fdf 100644 (file)
@@ -6,13 +6,19 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/OpenACC/OpenACC.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTOPENACCTOSCFPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 //===----------------------------------------------------------------------===//
@@ -56,7 +62,9 @@ void mlir::populateOpenACCToSCFConversionPatterns(RewritePatternSet &patterns) {
 
 namespace {
 struct ConvertOpenACCToSCFPass
-    : public ConvertOpenACCToSCFBase<ConvertOpenACCToSCFPass> {
+    : public impl::ConvertOpenACCToSCFPassBase<ConvertOpenACCToSCFPass> {
+  using ConvertOpenACCToSCFPassBase::ConvertOpenACCToSCFPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index 4552465..5ae5093 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h"
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
 #include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
 #include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
 #include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/OpenMP/OpenMPDialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTOPENMPTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -132,7 +137,9 @@ void mlir::populateOpenMPToLLVMConversionPatterns(LLVMTypeConverter &converter,
 
 namespace {
 struct ConvertOpenMPToLLVMPass
-    : public ConvertOpenMPToLLVMBase<ConvertOpenMPToLLVMPass> {
+    : public impl::ConvertOpenMPToLLVMPassBase<ConvertOpenMPToLLVMPass> {
+  using ConvertOpenMPToLLVMPassBase::ConvertOpenMPToLLVMPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index c24620a..bdff775 100644 (file)
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h"
-#include "../PassDetail.h"
+
 #include "PredicateTree.h"
 #include "mlir/Dialect/PDL/IR/PDL.h"
 #include "mlir/Dialect/PDL/IR/PDLTypes.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTPDLTOPDLINTERPPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::pdl_to_pdl_interp;
 
@@ -908,15 +913,17 @@ void PatternLowering::generateOperationResultTypeRewriter(
 //===----------------------------------------------------------------------===//
 
 namespace {
-struct PDLToPDLInterpPass
-    : public ConvertPDLToPDLInterpBase<PDLToPDLInterpPass> {
+struct ConvertPDLToPDLInterpPass
+    : public impl::ConvertPDLToPDLInterpPassBase<ConvertPDLToPDLInterpPass> {
+  using ConvertPDLToPDLInterpPassBase::ConvertPDLToPDLInterpPassBase;
+
   void runOnOperation() final;
 };
 } // namespace
 
 /// Convert the given module containing PDL pattern operations into a PDL
 /// Interpreter operations.
-void PDLToPDLInterpPass::runOnOperation() {
+void ConvertPDLToPDLInterpPass::runOnOperation() {
   ModuleOp module = getOperation();
 
   // Create the main matcher function This function contains all of the match
@@ -944,5 +951,5 @@ void PDLToPDLInterpPass::runOnOperation() {
 }
 
 std::unique_ptr<OperationPass<ModuleOp>> mlir::createPDLToPDLInterpPass() {
-  return std::make_unique<PDLToPDLInterpPass>();
+  return std::make_unique<ConvertPDLToPDLInterpPass>();
 }
diff --git a/mlir/lib/Conversion/PassDetail.h b/mlir/lib/Conversion/PassDetail.h
deleted file mode 100644 (file)
index 530e156..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-//===- PassDetail.h - Conversion Pass class details -------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef CONVERSION_PASSDETAIL_H_
-#define CONVERSION_PASSDETAIL_H_
-
-#include "mlir/Pass/Pass.h"
-
-#include "mlir/Conversion/GPUToROCDL/Runtimes.h"
-#include "mlir/IR/BuiltinOps.h"
-#include "mlir/IR/FunctionInterfaces.h"
-
-namespace mlir {
-class AffineDialect;
-
-// Forward declaration from Dialect.h
-template <typename ConcreteDialect>
-void registerDialect(DialectRegistry &registry);
-
-namespace acc {
-class OpenACCDialect;
-} // namespace acc
-
-namespace arith {
-class ArithmeticDialect;
-} // namespace arith
-
-namespace cf {
-class ControlFlowDialect;
-} // namespace cf
-
-namespace complex {
-class ComplexDialect;
-} // namespace complex
-
-namespace gpu {
-class GPUDialect;
-class GPUModuleOp;
-} // namespace gpu
-
-namespace func {
-class FuncDialect;
-} // namespace func
-
-namespace linalg {
-class LinalgDialect;
-} // namespace linalg
-
-namespace LLVM {
-class LLVMDialect;
-} // namespace LLVM
-
-namespace nvgpu {
-class NVGPUDialect;
-}
-
-namespace NVVM {
-class NVVMDialect;
-} // namespace NVVM
-
-namespace math {
-class MathDialect;
-} // namespace math
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-namespace omp {
-class OpenMPDialect;
-} // namespace omp
-
-namespace pdl_interp {
-class PDLInterpDialect;
-} // namespace pdl_interp
-
-namespace ROCDL {
-class ROCDLDialect;
-} // namespace ROCDL
-
-namespace scf {
-class SCFDialect;
-} // namespace scf
-
-namespace spirv {
-class SPIRVDialect;
-} // namespace spirv
-
-namespace tensor {
-class TensorDialect;
-} // namespace tensor
-
-namespace tosa {
-class TosaDialect;
-} // namespace tosa
-
-namespace vector {
-class VectorDialect;
-} // namespace vector
-
-namespace arm_neon {
-class ArmNeonDialect;
-} // namespace arm_neon
-
-#define GEN_PASS_CLASSES
-#include "mlir/Conversion/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // CONVERSION_PASSDETAIL_H_
index 773e9b2..cc468ce 100644 (file)
@@ -7,12 +7,17 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h"
-#include "../PassDetail.h"
+
 #include "mlir/IR/BuiltinOps.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_RECONCILEUNREALIZEDCASTSPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -102,9 +107,10 @@ struct UnrealizedConversionCastPassthrough
 };
 
 /// Pass to simplify and eliminate unrealized conversion casts.
-struct ReconcileUnrealizedCasts
-    : public ReconcileUnrealizedCastsBase<ReconcileUnrealizedCasts> {
-  ReconcileUnrealizedCasts() = default;
+struct ReconcileUnrealizedCastsPass
+    : public impl::ReconcileUnrealizedCastsPassBase<
+          ReconcileUnrealizedCastsPass> {
+  using ReconcileUnrealizedCastsPassBase::ReconcileUnrealizedCastsPassBase;
 
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
@@ -123,7 +129,3 @@ void mlir::populateReconcileUnrealizedCastsPatterns(
     RewritePatternSet &patterns) {
   patterns.add<UnrealizedConversionCastPassthrough>(patterns.getContext());
 }
-
-std::unique_ptr<Pass> mlir::createReconcileUnrealizedCastsPass() {
-  return std::make_unique<ReconcileUnrealizedCasts>();
-}
index 8bdf683..13035ec 100644 (file)
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
-#include "../PassDetail.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "mlir/Transforms/Passes.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTSCFTOCONTROLFLOWPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::scf;
 
 namespace {
 
-struct SCFToControlFlowPass
-    : public SCFToControlFlowBase<SCFToControlFlowPass> {
+struct ConvertSCFToControlFlowPass
+    : public impl::ConvertSCFToControlFlowPassBase<
+          ConvertSCFToControlFlowPass> {
+  using ConvertSCFToControlFlowPassBase::ConvertSCFToControlFlowPassBase;
+
   void runOnOperation() override;
 };
 
@@ -617,7 +625,7 @@ void mlir::populateSCFToControlFlowConversionPatterns(
   patterns.add<DoWhileLowering>(patterns.getContext(), /*benefit=*/2);
 }
 
-void SCFToControlFlowPass::runOnOperation() {
+void ConvertSCFToControlFlowPass::runOnOperation() {
   RewritePatternSet patterns(&getContext());
   populateSCFToControlFlowConversionPatterns(patterns);
 
@@ -630,7 +638,3 @@ void SCFToControlFlowPass::runOnOperation() {
           applyPartialConversion(getOperation(), target, std::move(patterns))))
     signalPassFailure();
 }
-
-std::unique_ptr<Pass> mlir::createConvertSCFToCFPass() {
-  return std::make_unique<SCFToControlFlowPass>();
-}
index 42260b5..350b775 100644 (file)
@@ -7,18 +7,24 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/SCFToGPU/SCFToGPUPass.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/SCFToGPU/SCFToGPU.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Complex/IR/Complex.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
-
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/CommandLine.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTAFFINEFORTOGPUPASS
+#define GEN_PASS_DEF_CONVERTPARALLELLOOPTOGPUPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::scf;
 
@@ -26,7 +32,8 @@ namespace {
 // A pass that traverses top-level loops in the function and converts them to
 // GPU launch operations.  Nested launches are not allowed, so this does not
 // walk the function recursively to avoid considering nested loops.
-struct ForLoopMapper : public ConvertAffineForToGPUBase<ForLoopMapper> {
+struct ForLoopMapper
+    : public impl::ConvertAffineForToGPUPassBase<ForLoopMapper> {
   ForLoopMapper() = default;
   ForLoopMapper(unsigned numBlockDims, unsigned numThreadDims) {
     this->numBlockDims = numBlockDims;
@@ -46,7 +53,9 @@ struct ForLoopMapper : public ConvertAffineForToGPUBase<ForLoopMapper> {
 };
 
 struct ParallelLoopToGpuPass
-    : public ConvertParallelLoopToGpuBase<ParallelLoopToGpuPass> {
+    : public impl::ConvertParallelLoopToGpuPassBase<ParallelLoopToGpuPass> {
+  using ConvertParallelLoopToGpuPassBase::ConvertParallelLoopToGpuPassBase;
+
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
     populateParallelLoopToGPUPatterns(patterns);
@@ -70,7 +79,3 @@ std::unique_ptr<InterfacePass<FunctionOpInterface>>
 mlir::createAffineForToGPUPass() {
   return std::make_unique<ForLoopMapper>();
 }
-
-std::unique_ptr<Pass> mlir::createParallelLoopToGpuPass() {
-  return std::make_unique<ParallelLoopToGpuPass>();
-}
index e963f02..593149a 100644 (file)
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h"
-#include "../PassDetail.h"
+
 #include "mlir/Analysis/SliceAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/IR/ImplicitLocOpBuilder.h"
 #include "mlir/IR/SymbolTable.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTSCFTOOPENMPPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 /// Matches a block containing a "simple" reduction. The expected shape of the
@@ -443,7 +449,10 @@ static LogicalResult applyPatterns(ModuleOp module) {
 }
 
 /// A pass converting SCF operations to OpenMP operations.
-struct SCFToOpenMPPass : public ConvertSCFToOpenMPBase<SCFToOpenMPPass> {
+struct ConvertSCFToOpenMPPass
+    : public impl::ConvertSCFToOpenMPPassBase<ConvertSCFToOpenMPPass> {
+  using ConvertSCFToOpenMPPassBase::ConvertSCFToOpenMPPassBase;
+
   /// Pass entry point.
   void runOnOperation() override {
     if (failed(applyPatterns(getOperation())))
@@ -454,5 +463,5 @@ struct SCFToOpenMPPass : public ConvertSCFToOpenMPBase<SCFToOpenMPPass> {
 } // namespace
 
 std::unique_ptr<OperationPass<ModuleOp>> mlir::createConvertSCFToOpenMPPass() {
-  return std::make_unique<SCFToOpenMPPass>();
+  return std::make_unique<ConvertSCFToOpenMPPass>();
 }
index 1b22fad..c907cad 100644 (file)
@@ -12,7 +12,6 @@
 
 #include "mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h"
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h"
 #include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
 #include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTSCFTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
-struct SCFToSPIRVPass : public SCFToSPIRVBase<SCFToSPIRVPass> {
+struct ConvertSCFToSPIRVPass
+    : public impl::ConvertSCFToSPIRVPassBase<ConvertSCFToSPIRVPass> {
+  using ConvertSCFToSPIRVPassBase::ConvertSCFToSPIRVPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
 
-void SCFToSPIRVPass::runOnOperation() {
+void ConvertSCFToSPIRVPass::runOnOperation() {
   MLIRContext *context = &getContext();
   Operation *op = getOperation();
 
@@ -54,5 +61,5 @@ void SCFToSPIRVPass::runOnOperation() {
 }
 
 std::unique_ptr<OperationPass<>> mlir::createConvertSCFToSPIRVPass() {
-  return std::make_unique<SCFToSPIRVPass>();
+  return std::make_unique<ConvertSCFToSPIRVPass>();
 }
index f383f9a..74e38cf 100644 (file)
@@ -11,7 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
+#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
+
 #include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
 #include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
 #include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
 #include "mlir/Conversion/LLVMCommon/TypeConverter.h"
 #include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
 #include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h"
-#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
 #include "mlir/IR/BuiltinOps.h"
 #include "mlir/IR/SymbolTable.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
-
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/FormatVariadic.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LOWERHOSTCODETOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 static constexpr const char kSPIRVModule[] = "__spv__";
@@ -270,9 +275,11 @@ class GPULaunchLowering : public ConvertOpToLLVMPattern<gpu::LaunchFuncOp> {
   }
 };
 
-class LowerHostCodeToLLVM
-    : public LowerHostCodeToLLVMBase<LowerHostCodeToLLVM> {
+class LowerHostCodeToLLVMPass
+    : public impl::LowerHostCodeToLLVMPassBase<LowerHostCodeToLLVMPass> {
 public:
+  using LowerHostCodeToLLVMPassBase::LowerHostCodeToLLVMPassBase;
+
   void runOnOperation() override {
     ModuleOp module = getOperation();
 
@@ -317,5 +324,5 @@ public:
 
 std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
 mlir::createLowerHostCodeToLLVMPass() {
-  return std::make_unique<LowerHostCodeToLLVM>();
+  return std::make_unique<LowerHostCodeToLLVMPass>();
 }
index 4c0f558..d2067cd 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/LLVMCommon/TypeConverter.h"
 #include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTSPIRVTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
 namespace {
 /// A pass converting MLIR SPIR-V operations into LLVM dialect.
 class ConvertSPIRVToLLVMPass
-    : public ConvertSPIRVToLLVMBase<ConvertSPIRVToLLVMPass> {
+    : public impl::ConvertSPIRVToLLVMPassBase<ConvertSPIRVToLLVMPass> {
+  using ConvertSPIRVToLLVMPassBase::ConvertSPIRVToLLVMPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index b342276..f92bf89 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "mlir/Conversion/ShapeToStandard/ShapeToStandard.h"
 
-#include "../PassDetail.h"
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/Shape/IR/Shape.h"
 #include "mlir/Pass/PassRegistry.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTSHAPECONSTRAINTSPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
+
 namespace {
 #include "ShapeToStandard.cpp.inc"
 } // namespace
@@ -48,8 +53,11 @@ namespace {
 // eager (side-effecting) error handling code. After eager error handling code
 // is emitted, witnesses are satisfied, so they are replace with
 // `shape.const_witness true`.
-class ConvertShapeConstraints
-    : public ConvertShapeConstraintsBase<ConvertShapeConstraints> {
+class ConvertShapeConstraintsPass
+    : public impl::ConvertShapeConstraintsPassBase<
+          ConvertShapeConstraintsPass> {
+  using ConvertShapeConstraintsPassBase::ConvertShapeConstraintsPassBase;
+
   void runOnOperation() override {
     auto *func = getOperation();
     auto *context = &getContext();
@@ -62,7 +70,3 @@ class ConvertShapeConstraints
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::createConvertShapeConstraintsPass() {
-  return std::make_unique<ConvertShapeConstraints>();
-}
index 3a3a336..4fdaee6 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "mlir/Conversion/ShapeToStandard/ShapeToStandard.h"
 
-#include "../PassDetail.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/IR/BlockAndValueMapping.h"
 #include "mlir/IR/ImplicitLocOpBuilder.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "llvm/ADT/STLExtras.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTSHAPETOSTANDARDPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::shape;
 using namespace mlir::scf;
@@ -680,7 +685,8 @@ namespace {
 namespace {
 /// Conversion pass.
 class ConvertShapeToStandardPass
-    : public ConvertShapeToStandardBase<ConvertShapeToStandardPass> {
+    : public impl::ConvertShapeToStandardPassBase<ConvertShapeToStandardPass> {
+  using ConvertShapeToStandardPassBase::ConvertShapeToStandardPassBase;
 
   void runOnOperation() override;
 };
index 8be029e..281ace9 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/TensorToLinalg/TensorToLinalg.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTTENSORTOLINALGPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 /// A pass converting MLIR Tensor operations into the Linalg dialect.
 class ConvertTensorToLinalgPass
-    : public ConvertTensorToLinalgBase<ConvertTensorToLinalgPass> {
+    : public impl::ConvertTensorToLinalgPassBase<ConvertTensorToLinalgPass> {
+  using ConvertTensorToLinalgPassBase::ConvertTensorToLinalgPassBase;
+
   void runOnOperation() override {
     auto &context = getContext();
     ConversionTarget target(context);
index 3a8ccc8..6b4ef16 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h"
-#include "../PassDetail.h"
+
 #include "mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h"
 #include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
 #include "mlir/Conversion/TensorToSPIRV/TensorToSPIRV.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTTENSORTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 /// A pass converting MLIR Tensor operations into the SPIR-V dialect.
 class ConvertTensorToSPIRVPass
-    : public ConvertTensorToSPIRVBase<ConvertTensorToSPIRVPass> {
+    : public impl::ConvertTensorToSPIRVPassBase<ConvertTensorToSPIRVPass> {
+  using ConvertTensorToSPIRVPassBase::ConvertTensorToSPIRVPassBase;
+
   void runOnOperation() override {
     MLIRContext *context = &getContext();
     Operation *op = getOperation();
index a4e4de6..8aa2735 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/TosaToArith/TosaToArith.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
 #include "mlir/Dialect/Tosa/Transforms/Passes.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Pass/PassManager.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTTOSATOARITHPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace tosa;
 
 namespace {
-struct TosaToArith : public TosaToArithBase<TosaToArith> {
+struct ConvertTosaToArithPass
+    : public impl::ConvertTosaToArithPassBase<ConvertTosaToArithPass> {
 public:
+  using ConvertTosaToArithPassBase::ConvertTosaToArithPassBase;
+
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
     ConversionTarget target(getContext());
@@ -47,7 +54,3 @@ public:
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::tosa::createTosaToArith() {
-  return std::make_unique<TosaToArith>();
-}
index 0743f57..38c07f8 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
 #include "mlir/Dialect/Math/IR/Math.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
 #include "mlir/Dialect/Tosa/Transforms/Passes.h"
 #include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTTOSATOLINALGNAMEDPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
-struct TosaToLinalgNamed : public TosaToLinalgNamedBase<TosaToLinalgNamed> {
+struct ConvertTosaToLinalgNamedPass
+    : public impl::ConvertTosaToLinalgNamedPassBase<
+          ConvertTosaToLinalgNamedPass> {
 public:
+  using ConvertTosaToLinalgNamedPassBase::ConvertTosaToLinalgNamedPassBase;
+
   void getDependentDialects(DialectRegistry &registry) const override {
     registry
         .insert<arith::ArithmeticDialect, linalg::LinalgDialect,
@@ -60,7 +69,3 @@ public:
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::tosa::createTosaToLinalgNamed() {
-  return std::make_unique<TosaToLinalgNamed>();
-}
index f8f4a8f..16de755 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
 #include "mlir/Dialect/Math/IR/Math.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
 #include "mlir/Dialect/Tosa/Transforms/Passes.h"
 #include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "mlir/Transforms/Passes.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTTOSATOLINALGPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
-struct TosaToLinalg : public TosaToLinalgBase<TosaToLinalg> {
+struct ConvertTosaToLinalgPass
+    : public impl::ConvertTosaToLinalgPassBase<ConvertTosaToLinalgPass> {
 public:
+  using ConvertTosaToLinalgPassBase::ConvertTosaToLinalgPassBase;
+
   void getDependentDialects(DialectRegistry &registry) const override {
     registry
         .insert<arith::ArithmeticDialect, linalg::LinalgDialect,
@@ -62,22 +70,19 @@ public:
 };
 } // namespace
 
-std::unique_ptr<Pass> mlir::tosa::createTosaToLinalg() {
-  return std::make_unique<TosaToLinalg>();
-}
-
 void mlir::tosa::addTosaToLinalgPasses(OpPassManager &pm,
                                        bool disableTosaDecompositions) {
   // Optional decompositions are designed to benefit linalg.
   if (!disableTosaDecompositions)
-    pm.addNestedPass<func::FuncOp>(tosa::createTosaOptionalDecompositions());
+    pm.addNestedPass<func::FuncOp>(
+        tosa::createTosaOptionalDecompositionsPass());
   pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
 
   pm.addNestedPass<func::FuncOp>(tosa::createTosaMakeBroadcastablePass());
-  pm.addNestedPass<func::FuncOp>(tosa::createTosaToLinalgNamed());
+  pm.addNestedPass<func::FuncOp>(createConvertTosaToLinalgNamedPass());
   pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
   // TODO: Remove pass that operates on const tensor and enable optionality
   pm.addNestedPass<func::FuncOp>(tosa::createTosaLayerwiseConstantFoldPass());
   pm.addNestedPass<func::FuncOp>(tosa::createTosaMakeBroadcastablePass());
-  pm.addNestedPass<func::FuncOp>(tosa::createTosaToLinalg());
+  pm.addNestedPass<func::FuncOp>(createConvertTosaToLinalgPass());
 }
index c86216a..00de6f0 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/TosaToSCF/TosaToSCF.h"
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
 #include "mlir/Dialect/Tosa/Transforms/Passes.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Pass/PassManager.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTTOSATOSCFPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace tosa;
 
 namespace {
-struct TosaToSCF : public TosaToSCFBase<TosaToSCF> {
+struct TosaToSCF : public impl::ConvertTosaToSCFPassBase<TosaToSCF> {
 public:
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
@@ -43,10 +48,6 @@ public:
 };
 } // namespace
 
-std::unique_ptr<Pass> mlir::tosa::createTosaToSCF() {
-  return std::make_unique<TosaToSCF>();
-}
-
 void mlir::tosa::addTosaToSCFPasses(OpPassManager &pm) {
-  pm.addNestedPass<func::FuncOp>(createTosaToSCF());
+  pm.addNestedPass<func::FuncOp>(createConvertTosaToSCFPass());
 }
index 08d5c7d..6b90323 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/TosaToTensor/TosaToTensor.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
 #include "mlir/Dialect/Tosa/Transforms/Passes.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Pass/PassManager.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTTOSATOTENSORPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace tosa;
 
 namespace {
-struct TosaToTensor : public TosaToTensorBase<TosaToTensor> {
+struct ConvertTosaToTensorPass
+    : public impl::ConvertTosaToTensorPassBase<ConvertTosaToTensorPass> {
 public:
+  using ConvertTosaToTensorPassBase::ConvertTosaToTensorPassBase;
+
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
     ConversionTarget target(getContext());
@@ -43,7 +50,3 @@ public:
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::tosa::createTosaToTensor() {
-  return std::make_unique<TosaToTensor>();
-}
index 2675882..c07bd4b 100644 (file)
@@ -15,7 +15,6 @@
 #include "NvGpuSupport.h"
 #include "mlir/Conversion/VectorToGPU/VectorToGPU.h"
 
-#include "../PassDetail.h"
 #include "mlir/Analysis/SliceAnalysis.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Transforms/Passes.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTVECTORTOGPUPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 /// For a vector TransferOpType `xferOp`, an empty `indices` vector, and an
@@ -882,7 +886,7 @@ LogicalResult mlir::convertVectorToNVVMCompatibleMMASync(Operation *rootOp) {
 namespace {
 
 struct ConvertVectorToGPUPass
-    : public ConvertVectorToGPUBase<ConvertVectorToGPUPass> {
+    : public impl::ConvertVectorToGPUPassBase<ConvertVectorToGPUPass> {
 
   explicit ConvertVectorToGPUPass(bool useNvGpu_) {
     useNvGpu.setValue(useNvGpu_);
index 3493e2c..cc5937c 100644 (file)
@@ -8,8 +8,6 @@
 
 #include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
 
-#include "../PassDetail.h"
-
 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/TypeConverter.h"
 #include "mlir/Dialect/AMX/AMXDialect.h"
 #include "mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h"
 #include "mlir/Dialect/X86Vector/Transforms.h"
 #include "mlir/Dialect/X86Vector/X86VectorDialect.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTVECTORTOLLVMPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::vector;
 
 namespace {
-struct LowerVectorToLLVMPass
-    : public ConvertVectorToLLVMBase<LowerVectorToLLVMPass> {
-  LowerVectorToLLVMPass(const LowerVectorToLLVMOptions &options) {
+struct ConvertVectorToLLVMPass
+    : public impl::ConvertVectorToLLVMPassBase<ConvertVectorToLLVMPass> {
+  ConvertVectorToLLVMPass(const LowerVectorToLLVMOptions &options) {
     this->reassociateFPReductions = options.reassociateFPReductions;
     this->force32BitVectorIndices = options.force32BitVectorIndices;
     this->armNeon = options.armNeon;
@@ -58,7 +62,7 @@ struct LowerVectorToLLVMPass
 };
 } // namespace
 
-void LowerVectorToLLVMPass::runOnOperation() {
+void ConvertVectorToLLVMPass::runOnOperation() {
   // Perform progressive lowering of operations on slices and
   // all contraction operations. Also applies folding and DCE.
   {
@@ -115,5 +119,5 @@ void LowerVectorToLLVMPass::runOnOperation() {
 
 std::unique_ptr<OperationPass<ModuleOp>>
 mlir::createConvertVectorToLLVMPass(const LowerVectorToLLVMOptions &options) {
-  return std::make_unique<LowerVectorToLLVMPass>(options);
+  return std::make_unique<ConvertVectorToLLVMPass>(options);
 }
index 6bcceb6..e50dd26 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "mlir/Conversion/VectorToSCF/VectorToSCF.h"
 
-#include "../PassDetail.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "mlir/Transforms/Passes.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTVECTORTOSCFPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using vector::TransferReadOp;
 using vector::TransferWriteOp;
@@ -1281,7 +1285,7 @@ void mlir::populateVectorToSCFConversionPatterns(
 namespace {
 
 struct ConvertVectorToSCFPass
-    : public ConvertVectorToSCFBase<ConvertVectorToSCFPass> {
+    : public impl::ConvertVectorToSCFPassBase<ConvertVectorToSCFPass> {
   ConvertVectorToSCFPass() = default;
   ConvertVectorToSCFPass(const VectorTransferToSCFOptions &options) {
     this->fullUnroll = options.unroll;
index 04bc41e..483619b 100644 (file)
@@ -12,7 +12,6 @@
 
 #include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h"
 
-#include "../PassDetail.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
index d3585ca..830b79b 100644 (file)
 
 #include "mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h"
 
-#include "../PassDetail.h"
 #include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTVECTORTOSPIRVPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 struct ConvertVectorToSPIRVPass
-    : public ConvertVectorToSPIRVBase<ConvertVectorToSPIRVPass> {
+    : public impl::ConvertVectorToSPIRVPassBase<ConvertVectorToSPIRVPass> {
+  using ConvertVectorToSPIRVPassBase::ConvertVectorToSPIRVPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
index 303498b..b0e2584 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Dialect/Affine/Analysis/Utils.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
-#include "mlir/Dialect/Affine/Passes.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/Support/Debug.h"
 #include <algorithm>
 
+namespace mlir {
+#define GEN_PASS_DEF_AFFINEDATACOPYGENERATIONPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "affine-data-copy-generate"
 
 using namespace mlir;
@@ -49,14 +55,15 @@ namespace {
 /// provided.
 // TODO: We currently can't generate copies correctly when stores
 // are strided. Check for strided stores.
-struct AffineDataCopyGeneration
-    : public AffineDataCopyGenerationBase<AffineDataCopyGeneration> {
-  AffineDataCopyGeneration() = default;
-  explicit AffineDataCopyGeneration(unsigned slowMemorySpace,
-                                    unsigned fastMemorySpace,
-                                    unsigned tagMemorySpace,
-                                    int minDmaTransferSize,
-                                    uint64_t fastMemCapacityBytes) {
+struct AffineDataCopyGenerationPass
+    : public impl::AffineDataCopyGenerationPassBase<
+          AffineDataCopyGenerationPass> {
+  AffineDataCopyGenerationPass() = default;
+  explicit AffineDataCopyGenerationPass(unsigned slowMemorySpace,
+                                        unsigned fastMemorySpace,
+                                        unsigned tagMemorySpace,
+                                        int minDmaTransferSize,
+                                        uint64_t fastMemCapacityBytes) {
     this->slowMemorySpace = slowMemorySpace;
     this->fastMemorySpace = fastMemorySpace;
     this->tagMemorySpace = tagMemorySpace;
@@ -83,21 +90,21 @@ mlir::createAffineDataCopyGenerationPass(unsigned slowMemorySpace,
                                          unsigned tagMemorySpace,
                                          int minDmaTransferSize,
                                          uint64_t fastMemCapacityBytes) {
-  return std::make_unique<AffineDataCopyGeneration>(
+  return std::make_unique<AffineDataCopyGenerationPass>(
       slowMemorySpace, fastMemorySpace, tagMemorySpace, minDmaTransferSize,
       fastMemCapacityBytes);
 }
 std::unique_ptr<OperationPass<func::FuncOp>>
 mlir::createAffineDataCopyGenerationPass() {
-  return std::make_unique<AffineDataCopyGeneration>();
+  return std::make_unique<AffineDataCopyGenerationPass>();
 }
 
 /// Generate copies for this block. The block is partitioned into separate
 /// ranges: each range is either a sequence of one or more operations starting
 /// and ending with an affine load or store op, or just an affine.forop (which
 /// could have other affine for op's nested within).
-void AffineDataCopyGeneration::runOnBlock(Block *block,
-                                          DenseSet<Operation *> &copyNests) {
+void AffineDataCopyGenerationPass::runOnBlock(
+    Block *block, DenseSet<Operation *> &copyNests) {
   if (block->empty())
     return;
 
@@ -198,7 +205,7 @@ void AffineDataCopyGeneration::runOnBlock(Block *block,
   }
 }
 
-void AffineDataCopyGeneration::runOnOperation() {
+void AffineDataCopyGenerationPass::runOnOperation() {
   func::FuncOp f = getOperation();
   OpBuilder topBuilder(f.getBody());
   zeroIndex = topBuilder.create<arith::ConstantIndexOp>(f.getLoc(), 0);
index c162aa2..c48abc4 100644 (file)
 // fundamental operations.
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/Passes.h"
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/Utils.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_AFFINEEXPANDINDEXOPSPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -38,7 +42,7 @@ struct LowerDelinearizeIndexOps
 };
 
 class ExpandAffineIndexOpsPass
-    : public AffineExpandIndexOpsBase<ExpandAffineIndexOpsPass> {
+    : public impl::AffineExpandIndexOpsPassBase<ExpandAffineIndexOpsPass> {
 public:
   ExpandAffineIndexOpsPass() = default;
 
index 280e928..0d67f35 100644 (file)
@@ -10,7 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Analysis/SliceAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
@@ -18,9 +19,9 @@
 #include "mlir/Dialect/Affine/Analysis/Utils.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
-#include "mlir/Dialect/Affine/Passes.h"
 #include "mlir/Dialect/Affine/Utils.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/AffineExpr.h"
 #include "mlir/IR/AffineMap.h"
 #include "mlir/IR/Builders.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_AFFINELOOPINVARIANTCODEMOTIONPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "licm"
 
 using namespace mlir;
@@ -44,7 +50,8 @@ namespace {
 /// TODO: This code should be removed once the new LICM pass can handle its
 ///       uses.
 struct LoopInvariantCodeMotion
-    : public AffineLoopInvariantCodeMotionBase<LoopInvariantCodeMotion> {
+    : public impl::AffineLoopInvariantCodeMotionPassBase<
+          LoopInvariantCodeMotion> {
   void runOnOperation() override;
   void runOnAffineForOp(AffineForOp forOp);
 };
index 28b6b99..e664dd7 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/Passes.h"
+
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_AFFINELOOPNORMALIZEPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
@@ -23,7 +29,7 @@ namespace {
 /// As currently implemented, this pass cannot fail, but it might skip over ops
 /// that are already in a normalized form.
 struct AffineLoopNormalizePass
-    : public AffineLoopNormalizeBase<AffineLoopNormalizePass> {
+    : public impl::AffineLoopNormalizePassBase<AffineLoopNormalizePass> {
 
   void runOnOperation() override {
     getOperation().walk([](Operation *op) {
index dbd5541..9955f4c 100644 (file)
@@ -11,7 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
 #include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/IR/AffineValueMap.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
-#include "mlir/Dialect/Affine/Passes.h"
 #include "mlir/Dialect/Affine/Passes.h.inc"
 #include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "llvm/Support/Debug.h"
 #include <deque>
 
+namespace mlir {
+#define GEN_PASS_DEF_AFFINEPARALLELIZEPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "affine-parallel"
 
 using namespace mlir;
 
 namespace {
 /// Convert all parallel affine.for op into 1-D affine.parallel op.
-struct AffineParallelize : public AffineParallelizeBase<AffineParallelize> {
+struct AffineParallelize
+    : public impl::AffineParallelizePassBase<AffineParallelize> {
   void runOnOperation() override;
 };
 
index efc1676..965c650 100644 (file)
 
 #include "mlir/Dialect/Affine/Passes.h"
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/Dominance.h"
 #include "mlir/Support/LogicalResult.h"
 #include <algorithm>
 
+namespace mlir {
+#define GEN_PASS_DEF_AFFINESCALARREPLACEMENTPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "affine-scalrep"
 
 using namespace mlir;
 
 namespace {
 struct AffineScalarReplacement
-    : public AffineScalarReplacementBase<AffineScalarReplacement> {
+    : public impl::AffineScalarReplacementPassBase<AffineScalarReplacement> {
   void runOnOperation() override;
 };
 
index 765bc05..4ae38c2 100644 (file)
@@ -6,23 +6,31 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/SCF/Utils/Utils.h"
 #include "mlir/Transforms/Passes.h"
 #include "mlir/Transforms/RegionUtils.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LOOPCOALESCINGPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 #define PASS_NAME "loop-coalescing"
 #define DEBUG_TYPE PASS_NAME
 
 using namespace mlir;
 
 namespace {
-struct LoopCoalescingPass : public LoopCoalescingBase<LoopCoalescingPass> {
+struct LoopCoalescingPass
+    : public impl::LoopCoalescingPassBase<LoopCoalescingPass> {
 
   /// Walk either an scf.for or an affine.for to find a band to coalesce.
   template <typename LoopOpTy>
index 81b4e4d..b0fbdb3 100644 (file)
@@ -10,7 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
 #include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
@@ -19,6 +20,7 @@
 #include "mlir/Dialect/Affine/LoopFusionUtils.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
 #include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/AffineExpr.h"
 #include "mlir/IR/AffineMap.h"
 #include "llvm/Support/raw_ostream.h"
 #include <iomanip>
 #include <sstream>
+
+namespace mlir {
+#define GEN_PASS_DEF_AFFINELOOPFUSIONPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "affine-loop-fusion"
 
 using namespace mlir;
@@ -47,7 +55,7 @@ namespace {
 // TODO: Extend this pass to check for fusion preventing dependences,
 // and add support for more general loop fusion algorithms.
 
-struct LoopFusion : public AffineLoopFusionBase<LoopFusion> {
+struct LoopFusion : public impl::AffineLoopFusionPassBase<LoopFusion> {
   LoopFusion() = default;
   LoopFusion(unsigned fastMemorySpace, uint64_t localBufSizeThresholdBytes,
              bool maximalFusion, enum FusionMode affineFusionMode) {
index 3cdae8a..632ab64 100644 (file)
@@ -10,7 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
 #include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/IR/AffineValueMap.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
-#include "mlir/Dialect/Affine/Passes.h"
 #include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/BlockAndValueMapping.h"
 #include "mlir/IR/Builders.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-using namespace mlir;
+
+namespace mlir {
+#define GEN_PASS_DEF_AFFINELOOPTILINGPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
 
 #define DEBUG_TYPE "affine-loop-tile"
 
+using namespace mlir;
+
 namespace {
 
 /// A pass to perform loop tiling on all suitable loop nests of a Function.
-struct LoopTiling : public AffineLoopTilingBase<LoopTiling> {
+struct LoopTiling : public impl::AffineLoopTilingPassBase<LoopTiling> {
   LoopTiling() = default;
   explicit LoopTiling(uint64_t cacheSizeBytes, bool avoidMaxMinBounds = true)
       : avoidMaxMinBounds(avoidMaxMinBounds) {
index 8f7cae5..cd5e53c 100644 (file)
@@ -9,11 +9,13 @@
 // This file implements loop unrolling.
 //
 //===----------------------------------------------------------------------===//
-#include "PassDetail.h"
+
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
-#include "mlir/Dialect/Affine/Passes.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/AffineExpr.h"
 #include "mlir/IR/AffineMap.h"
 #include "mlir/IR/Builders.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 
-using namespace mlir;
+namespace mlir {
+#define GEN_PASS_DEF_AFFINELOOPUNROLLPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
 
 #define DEBUG_TYPE "affine-loop-unroll"
 
+using namespace mlir;
+
 namespace {
 
 // TODO: this is really a test pass and should be moved out of dialect
@@ -34,7 +41,7 @@ namespace {
 /// full unroll threshold was specified, in which case, fully unrolls all loops
 /// with trip count less than the specified threshold. The latter is for testing
 /// purposes, especially for testing outer loop unrolling.
-struct LoopUnroll : public AffineLoopUnrollBase<LoopUnroll> {
+struct LoopUnroll : public impl::AffineLoopUnrollPassBase<LoopUnroll> {
   // Callback to obtain unroll factors; if this has a callable target, takes
   // precedence over command-line argument or passed argument.
   const std::function<unsigned(AffineForOp)> getUnrollFactor;
index 42f6487..85b24cc 100644 (file)
 // op's, bodies of those loops will not be jammed.
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
-#include "mlir/Dialect/Affine/Passes.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/AffineExpr.h"
 #include "mlir/IR/AffineMap.h"
 #include "mlir/IR/BlockAndValueMapping.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/CommandLine.h"
 
-using namespace mlir;
+namespace mlir {
+#define GEN_PASS_DEF_AFFINELOOPUNROLLANDJAMPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
 
 #define DEBUG_TYPE "affine-loop-unroll-jam"
 
+using namespace mlir;
+
 namespace {
 /// Loop unroll jam pass. Currently, this just unroll jams the first
 /// outer loop in a Function.
-struct LoopUnrollAndJam : public AffineLoopUnrollAndJamBase<LoopUnrollAndJam> {
+struct LoopUnrollAndJam
+    : public impl::AffineLoopUnrollAndJamPassBase<LoopUnrollAndJam> {
   explicit LoopUnrollAndJam(Optional<unsigned> unrollJamFactor = None) {
     if (unrollJamFactor)
       this->unrollJamFactor = *unrollJamFactor;
diff --git a/mlir/lib/Dialect/Affine/Transforms/PassDetail.h b/mlir/lib/Dialect/Affine/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 37dccb1..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-//===- PassDetail.h - Affine Pass class details -----------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_AFFINE_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_AFFINE_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Dialect/Affine/Passes.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-// Forward declaration from Dialect.h
-template <typename ConcreteDialect>
-void registerDialect(DialectRegistry &registry);
-
-namespace arith {
-class ArithmeticDialect;
-} // namespace arith
-
-namespace linalg {
-class LinalgDialect;
-} // namespace linalg
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-namespace vector {
-class VectorDialect;
-} // namespace vector
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Affine/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_AFFINE_TRANSFORMS_PASSDETAIL_H_
index ec30c29..93e497d 100644 (file)
@@ -10,7 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/Utils.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
 #include "mlir/Dialect/Affine/Utils.h"
 #include "mlir/Dialect/Arithmetic/Utils/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/Transforms/Passes.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_AFFINEPIPELINEDATATRANSFERPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "affine-pipeline-data-transfer"
 
 using namespace mlir;
 
 namespace {
 struct PipelineDataTransfer
-    : public AffinePipelineDataTransferBase<PipelineDataTransfer> {
+    : public impl::AffinePipelineDataTransferPassBase<PipelineDataTransfer> {
   void runOnOperation() override;
   void runOnAffineForOp(AffineForOp forOp);
 
index cd05d66..c60e7b2 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Dialect/Affine/Analysis/Utils.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/Affine/Passes.h"
 #include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/IntegerSet.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SIMPLIFYAFFINESTRUCTURESPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "simplify-affine-structure"
 
 using namespace mlir;
@@ -29,7 +35,7 @@ namespace {
 /// all memrefs with non-trivial layout maps are converted to ones with trivial
 /// identity layout ones.
 struct SimplifyAffineStructures
-    : public SimplifyAffineStructuresBase<SimplifyAffineStructures> {
+    : public impl::SimplifyAffineStructuresPassBase<SimplifyAffineStructures> {
   void runOnOperation() override;
 
   /// Utility to simplify an affine attribute and update its entry in the parent
index 749ac8d..6b592f0 100644 (file)
@@ -11,7 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Affine/Passes.h"
+
 #include "mlir/Analysis/SliceAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
 #include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/Utils.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Vector/IR/VectorOps.h"
 #include "mlir/Dialect/Vector/Utils/VectorUtils.h"
 #include "mlir/IR/BlockAndValueMapping.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Support/LLVM.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_AFFINEVECTORIZEPASS
+#include "mlir/Dialect/Affine/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace vector;
 
@@ -607,7 +615,7 @@ namespace {
 
 /// Base state for the vectorize pass.
 /// Command line arguments are preempted by non-empty pass arguments.
-struct Vectorize : public AffineVectorizeBase<Vectorize> {
+struct Vectorize : public impl::AffineVectorizePassBase<Vectorize> {
   Vectorize() = default;
   Vectorize(ArrayRef<int64_t> virtualVectorSize);
   void runOnOperation() override;
index 60c644e..f90496f 100644 (file)
@@ -6,23 +6,29 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
 
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Arithmetic/Transforms/BufferizableOpInterfaceImpl.h"
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 
+namespace mlir {
+namespace arith {
+#define GEN_PASS_DEF_ARITHMETICBUFFERIZEPASS
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
+} // namespace arith
+} // namespace mlir
+
 using namespace mlir;
 using namespace bufferization;
 
 namespace {
 /// Pass to bufferize Arithmetic ops.
 struct ArithmeticBufferizePass
-    : public ArithmeticBufferizeBase<ArithmeticBufferizePass> {
+    : public arith::impl::ArithmeticBufferizePassBase<ArithmeticBufferizePass> {
   ArithmeticBufferizePass(uint64_t alignment = 0, bool constantOpOnly = false)
       : constantOpOnly(constantOpOnly) {
     this->alignment = alignment;
index afe7aab..30cfa61 100644 (file)
@@ -6,12 +6,19 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
-#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
+
+#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/IR/TypeUtilities.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+namespace arith {
+#define GEN_PASS_DEF_ARITHMETICEXPANDOPSPASS
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
+} // namespace arith
+} // namespace mlir
+
 using namespace mlir;
 
 /// Create an integer or index constant.
@@ -189,7 +196,7 @@ public:
 };
 
 struct ArithmeticExpandOpsPass
-    : public ArithmeticExpandOpsBase<ArithmeticExpandOpsPass> {
+    : public arith::impl::ArithmeticExpandOpsPassBase<ArithmeticExpandOpsPass> {
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
     ConversionTarget target(getContext());
diff --git a/mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h b/mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 5877ccc..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-//===- PassDetail.h - Arithmetic Pass details -------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_ARITHMETIC_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_ARITHMETIC_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/IR/BuiltinOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-namespace bufferization {
-class BufferizationDialect;
-} // namespace bufferization
-
-namespace func {
-class FuncDialect;
-} // namespace func
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_ARITHMETIC_TRANSFORMS_PASSDETAIL_H_
index 82e4428..801abe6 100644 (file)
@@ -8,13 +8,20 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
+
 #include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
 #include "mlir/Analysis/DataFlow/IntegerRangeAnalysis.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+namespace arith {
+#define GEN_PASS_DEF_ARITHMETICUNSIGNEDWHENEQUIVALENTPASS
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
+} // namespace arith
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::arith;
 using namespace mlir::dataflow;
@@ -102,7 +109,7 @@ struct ConvertCmpIToUnsigned : OpConversionPattern<CmpIOp> {
 };
 
 struct ArithmeticUnsignedWhenEquivalentPass
-    : public ArithmeticUnsignedWhenEquivalentBase<
+    : public arith::impl::ArithmeticUnsignedWhenEquivalentPassBase<
           ArithmeticUnsignedWhenEquivalentPass> {
   /// Implementation structure: first find all equivalent ops and collect them,
   /// then perform all the rewrites in a second pass over the target op. This
index c50baf7..1fbc89a 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include <utility>
+#include "mlir/Dialect/Async/Passes.h"
 
 #include "PassDetail.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Async/IR/Async.h"
-#include "mlir/Dialect/Async/Passes.h"
 #include "mlir/Dialect/Async/Transforms.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Support/LLVM.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "mlir/Transforms/RegionUtils.h"
+#include <utility>
+
+namespace mlir {
+#define GEN_PASS_DEF_ASYNCPARALLELFORPASS
+#include "mlir/Dialect/Async/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 using namespace mlir::async;
@@ -94,7 +99,7 @@ namespace {
 //   }
 //
 struct AsyncParallelForPass
-    : public AsyncParallelForBase<AsyncParallelForPass> {
+    : public impl::AsyncParallelForPassBase<AsyncParallelForPass> {
   AsyncParallelForPass() = default;
 
   AsyncParallelForPass(bool asyncDispatch, int32_t numWorkerThreads,
index 959d633..0174b79 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Async/Passes.h"
+
 #include "mlir/Analysis/Liveness.h"
 #include "mlir/Dialect/Async/IR/Async.h"
-#include "mlir/Dialect/Async/Passes.h"
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/ImplicitLocOpBuilder.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "llvm/ADT/SmallSet.h"
 
-using namespace mlir;
-using namespace mlir::async;
+namespace mlir {
+#define GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGPASS
+#define GEN_PASS_DEF_ASYNCRUNTIMEPOLICYBASEDREFCOUNTINGPASS
+#include "mlir/Dialect/Async/Passes.h.inc"
+} // namespace mlir
 
 #define DEBUG_TYPE "async-runtime-ref-counting"
 
+using namespace mlir;
+using namespace mlir::async;
+
 //===----------------------------------------------------------------------===//
 // Utility functions shared by reference counting passes.
 //===----------------------------------------------------------------------===//
@@ -103,7 +109,8 @@ static LogicalResult walkReferenceCountedValues(
 namespace {
 
 class AsyncRuntimeRefCountingPass
-    : public AsyncRuntimeRefCountingBase<AsyncRuntimeRefCountingPass> {
+    : public impl::AsyncRuntimeRefCountingPassBase<
+          AsyncRuntimeRefCountingPass> {
 public:
   AsyncRuntimeRefCountingPass() = default;
   void runOnOperation() override;
@@ -462,7 +469,7 @@ void AsyncRuntimeRefCountingPass::runOnOperation() {
 namespace {
 
 class AsyncRuntimePolicyBasedRefCountingPass
-    : public AsyncRuntimePolicyBasedRefCountingBase<
+    : public impl::AsyncRuntimePolicyBasedRefCountingPassBase<
           AsyncRuntimePolicyBasedRefCountingPass> {
 public:
   AsyncRuntimePolicyBasedRefCountingPass() { initializeDefaultPolicy(); }
index 14fe91a..ee7bd2f 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
-#include "mlir/Dialect/Async/IR/Async.h"
 #include "mlir/Dialect/Async/Passes.h"
+
+#include "mlir/Dialect/Async/IR/Async.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/Support/Debug.h"
 
-using namespace mlir;
-using namespace mlir::async;
+namespace mlir {
+#define GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGOPTPASS
+#include "mlir/Dialect/Async/Passes.h.inc"
+} // namespace mlir
 
 #define DEBUG_TYPE "async-ref-counting"
 
+using namespace mlir;
+using namespace mlir::async;
+
 namespace {
 
 class AsyncRuntimeRefCountingOptPass
-    : public AsyncRuntimeRefCountingOptBase<AsyncRuntimeRefCountingOptPass> {
+    : public impl::AsyncRuntimeRefCountingOptPassBase<
+          AsyncRuntimeRefCountingOptPass> {
 public:
   AsyncRuntimeRefCountingOptPass() = default;
   void runOnOperation() override;
index efdae66..85da871 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
+#include "mlir/Dialect/Async/Passes.h"
+
 #include "PassDetail.h"
 #include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Async/IR/Async.h"
-#include "mlir/Dialect/Async/Passes.h"
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_ASYNCTOASYNCRUNTIMEPASS
+#include "mlir/Dialect/Async/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::async;
 
@@ -37,7 +43,7 @@ static constexpr const char kAsyncFnPrefix[] = "async_execute_fn";
 namespace {
 
 class AsyncToAsyncRuntimePass
-    : public AsyncToAsyncRuntimeBase<AsyncToAsyncRuntimePass> {
+    : public impl::AsyncToAsyncRuntimePassBase<AsyncToAsyncRuntimePass> {
 public:
   AsyncToAsyncRuntimePass() = default;
   void runOnOperation() override;
index d2d7114..40e3c58 100644 (file)
@@ -27,9 +27,6 @@ namespace scf {
 class SCFDialect;
 } // namespace scf
 
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Async/Passes.h.inc"
-
 // -------------------------------------------------------------------------- //
 // Utility functions shared by Async Transformations.
 // -------------------------------------------------------------------------- //
index ff308e6..71cabc1 100644 (file)
@@ -6,17 +6,23 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
 
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/Bufferization/Transforms/AllocTensorElimination.h"
 #include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/IR/Dominance.h"
 #include "mlir/Pass/Pass.h"
 
+namespace mlir {
+namespace bufferization {
+#define GEN_PASS_DEF_ALLOCTENSORELIMINATIONPASS
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+} // namespace bufferization
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::bufferization;
 
@@ -234,7 +240,8 @@ mlir::bufferization::insertSliceAnchoredAllocTensorEliminationStep(
 
 namespace {
 struct AllocTensorElimination
-    : public AllocTensorEliminationBase<AllocTensorElimination> {
+    : public bufferization::impl::AllocTensorEliminationPassBase<
+          AllocTensorElimination> {
   AllocTensorElimination() = default;
 
   void runOnOperation() override;
index 2f7ede7..88a2919 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
 
 #include "mlir/Dialect/Bufferization/IR/AllocationOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/Bufferization/Transforms/BufferUtils.h"
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "llvm/ADT/SetOperations.h"
 
+namespace mlir {
+namespace bufferization {
+#define GEN_PASS_DEF_BUFFERDEALLOCATIONPASS
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+} // namespace bufferization
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::bufferization;
 
@@ -633,7 +640,8 @@ struct DefaultAllocationInterface
 /// The actual buffer deallocation pass that inserts and moves dealloc nodes
 /// into the right positions. Furthermore, it inserts additional clones if
 /// necessary. It uses the algorithm described at the top of the file.
-struct BufferDeallocationPass : BufferDeallocationBase<BufferDeallocationPass> {
+struct BufferDeallocationPass
+    : bufferization::impl::BufferDeallocationPassBase<BufferDeallocationPass> {
   void getDependentDialects(DialectRegistry &registry) const override {
     registry.insert<bufferization::BufferizationDialect>();
     registry.insert<memref::MemRefDialect>();
index e79e282..46ab822 100644 (file)
 // allocations and copies during buffer deallocation. The third pass tries to
 // convert heap-based allocations to stack-based allocations, if possible.
 
-#include "PassDetail.h"
-#include "mlir/Dialect/Bufferization/Transforms/BufferUtils.h"
 #include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+
+#include "mlir/Dialect/Bufferization/Transforms/BufferUtils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/Operation.h"
 #include "mlir/Interfaces/LoopLikeInterface.h"
 #include "mlir/Pass/Pass.h"
 
+namespace mlir {
+namespace bufferization {
+#define GEN_PASS_DEF_BUFFERHOISTINGPASS
+#define GEN_PASS_DEF_BUFFERLOOPHOISTINGPASS
+#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACKPASS
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+} // namespace bufferization
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::bufferization;
 
@@ -361,7 +371,8 @@ public:
 
 /// The buffer hoisting pass that hoists allocation nodes into dominating
 /// blocks.
-struct BufferHoistingPass : BufferHoistingBase<BufferHoistingPass> {
+struct BufferHoistingPass
+    : bufferization::impl::BufferHoistingPassBase<BufferHoistingPass> {
 
   void runOnOperation() override {
     // Hoist all allocations into dominator blocks.
@@ -372,7 +383,8 @@ struct BufferHoistingPass : BufferHoistingBase<BufferHoistingPass> {
 };
 
 /// The buffer loop hoisting pass that hoists allocation nodes out of loops.
-struct BufferLoopHoistingPass : BufferLoopHoistingBase<BufferLoopHoistingPass> {
+struct BufferLoopHoistingPass
+    : bufferization::impl::BufferLoopHoistingPassBase<BufferLoopHoistingPass> {
 
   void runOnOperation() override {
     // Hoist all allocations out of loops.
@@ -385,7 +397,8 @@ struct BufferLoopHoistingPass : BufferLoopHoistingBase<BufferLoopHoistingPass> {
 /// The promote buffer to stack pass that tries to convert alloc nodes into
 /// alloca nodes.
 class PromoteBuffersToStackPass
-    : public PromoteBuffersToStackBase<PromoteBuffersToStackPass> {
+    : public bufferization::impl::PromoteBuffersToStackPassBase<
+          PromoteBuffersToStackPass> {
 public:
   PromoteBuffersToStackPass(unsigned maxAllocSizeInBytes,
                             unsigned maxRankOfAllocatedMemRef) {
index d00da76..7d5e882 100644 (file)
@@ -6,13 +6,20 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/Operation.h"
 #include "mlir/Pass/Pass.h"
 
+namespace mlir {
+namespace bufferization {
+#define GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMSPASS
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+} // namespace bufferization
+} // namespace mlir
+
 using namespace mlir;
 
 /// Return `true` if the given MemRef type has a fully dynamic layout.
@@ -179,7 +186,8 @@ mlir::bufferization::promoteBufferResultsToOutParams(ModuleOp module) {
 
 namespace {
 struct BufferResultsToOutParamsPass
-    : BufferResultsToOutParamsBase<BufferResultsToOutParamsPass> {
+    : bufferization::impl::BufferResultsToOutParamsPassBase<
+          BufferResultsToOutParamsPass> {
   void runOnOperation() override {
     if (failed(bufferization::promoteBufferResultsToOutParams(getOperation())))
       return signalPassFailure();
index a233367..9d19786 100644 (file)
@@ -6,14 +6,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
 
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
 #include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
 #include "mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h"
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
 #include "mlir/Dialect/Bufferization/Transforms/TensorCopyInsertion.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "mlir/Transforms/Passes.h"
 
+namespace mlir {
+namespace bufferization {
+#define GEN_PASS_DEF_FINALIZINGBUFFERIZEPASS
+#define GEN_PASS_DEF_BUFFERIZATIONBUFFERIZEPASS
+#define GEN_PASS_DEF_ONESHOTBUFFERIZEPASS
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+} // namespace bufferization
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::bufferization;
 
@@ -122,9 +130,9 @@ void mlir::bufferization::populateEliminateBufferizeMaterializationsPatterns(
 
 namespace {
 struct FinalizingBufferizePass
-    : public FinalizingBufferizeBase<FinalizingBufferizePass> {
-  using FinalizingBufferizeBase<
-      FinalizingBufferizePass>::FinalizingBufferizeBase;
+    : public bufferization::impl::FinalizingBufferizePassBase<
+          FinalizingBufferizePass> {
+  using FinalizingBufferizePassBase::FinalizingBufferizePassBase;
 
   void runOnOperation() override {
     auto func = getOperation();
@@ -164,7 +172,8 @@ parseLayoutMapOption(const std::string &s) {
 }
 
 struct OneShotBufferizePass
-    : public OneShotBufferizeBase<OneShotBufferizePass> {
+    : public bufferization::impl::OneShotBufferizePassBase<
+          OneShotBufferizePass> {
   OneShotBufferizePass() {}
 
   explicit OneShotBufferizePass(const OneShotBufferizationOptions &options)
@@ -255,7 +264,8 @@ private:
 
 namespace {
 struct BufferizationBufferizePass
-    : public BufferizationBufferizeBase<BufferizationBufferizePass> {
+    : public bufferization::impl::BufferizationBufferizePassBase<
+          BufferizationBufferizePass> {
   void runOnOperation() override {
     BufferizationOptions options = getPartialBufferizationOptions();
     options.opFilter.allowDialect<BufferizationDialect>();
index fdbc9a0..ef06d1d 100644 (file)
 // function argument, it is also considered equivalent. A cast is inserted at
 // the call site in that case.
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/Operation.h"
 #include "mlir/Pass/Pass.h"
 
+namespace mlir {
+namespace bufferization {
+#define GEN_PASS_DEF_DROPEQUIVALENTBUFFERRESULTSPASS
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+} // namespace bufferization
+} // namespace mlir
+
 using namespace mlir;
 
 /// Return the unique ReturnOp that terminates `funcOp`.
@@ -137,7 +144,8 @@ mlir::bufferization::dropEquivalentBufferResults(ModuleOp module) {
 
 namespace {
 struct DropEquivalentBufferResultsPass
-    : DropEquivalentBufferResultsBase<DropEquivalentBufferResultsPass> {
+    : bufferization::impl::DropEquivalentBufferResultsPassBase<
+          DropEquivalentBufferResultsPass> {
   void runOnOperation() override {
     if (failed(bufferization::dropEquivalentBufferResults(getOperation())))
       return signalPassFailure();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h b/mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h
deleted file mode 100644 (file)
index c63e85c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-//===- PassDetail.h - Bufferization Pass details ----------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_BUFFERIZATION_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_BUFFERIZATION_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/IR/BuiltinOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-namespace bufferization {
-class BufferizationDialect;
-} // namespace bufferization
-
-namespace func {
-class FuncDialect;
-} // namespace func
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_BUFFERIZATION_TRANSFORMS_PASSDETAIL_H_
index 8e5aa1c..7bdace3 100644 (file)
@@ -6,16 +6,22 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/Bufferization/Transforms/TensorCopyInsertion.h"
-
-#include "PassDetail.h"
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
 
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
 #include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
 #include "mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h"
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+#include "mlir/Dialect/Bufferization/Transforms/TensorCopyInsertion.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+
+namespace mlir {
+namespace bufferization {
+#define GEN_PASS_DEF_TENSORCOPYINSERTIONPASS
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+} // namespace bufferization
+} // namespace mlir
 
 using namespace mlir;
 using namespace mlir::bufferization;
@@ -159,7 +165,8 @@ mlir::bufferization::insertTensorCopies(Operation *op,
 
 namespace {
 struct TensorCopyInsertionPass
-    : TensorCopyInsertionBase<TensorCopyInsertionPass> {
+    : bufferization::impl::TensorCopyInsertionPassBase<
+          TensorCopyInsertionPass> {
   TensorCopyInsertionPass() : options(llvm::None) {}
   TensorCopyInsertionPass(const OneShotBufferizationOptions &options)
       : options(options) {}
index 327f2df..e925779 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Func/Transforms/Passes.h"
+
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Func/Transforms/FuncConversions.h"
-#include "mlir/Dialect/Func/Transforms/Passes.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_FUNCBUFFERIZEPASS
+#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::func;
 
 namespace {
-struct FuncBufferizePass : public FuncBufferizeBase<FuncBufferizePass> {
-  using FuncBufferizeBase<FuncBufferizePass>::FuncBufferizeBase;
+struct FuncBufferizePass
+    : public impl::FuncBufferizePassBase<FuncBufferizePass> {
+  using FuncBufferizePassBase::FuncBufferizePassBase;
+
   void runOnOperation() override {
     auto module = getOperation();
     auto *context = &getContext();
diff --git a/mlir/lib/Dialect/Func/Transforms/PassDetail.h b/mlir/lib/Dialect/Func/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 4b8a2cd..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-//===- PassDetail.h - Func Pass class details -------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_FUNC_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_FUNC_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/IR/BuiltinOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-class AtomicRMWOp;
-
-namespace bufferization {
-class BufferizationDialect;
-} // namespace bufferization
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_FUNC_TRANSFORMS_PASSDETAIL_H_
index 59758b8..92d186b 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/GPU/Transforms/Passes.h"
+
 #include "mlir/Dialect/Async/IR/Async.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
-#include "mlir/Dialect/GPU/Transforms/Passes.h"
 #include "mlir/Dialect/GPU/Transforms/Utils.h"
 #include "mlir/IR/BlockAndValueMapping.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/Transforms/RegionUtils.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_GPUASYNCREGIONPASS
+#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
+
 namespace {
-class GpuAsyncRegionPass : public GpuAsyncRegionPassBase<GpuAsyncRegionPass> {
+class GpuAsyncRegionPass
+    : public impl::GpuAsyncRegionPassBase<GpuAsyncRegionPass> {
   struct ThreadTokenCallback;
   struct DeferWaitCallback;
   struct SingleTokenUseCallback;
index df81284..f4c3966 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/GPU/Transforms/Passes.h"
+
 #include "mlir/AsmParser/AsmParser.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
 #include "mlir/Dialect/DLTI/DLTI.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
-#include "mlir/Dialect/GPU/Transforms/Passes.h"
 #include "mlir/Dialect/GPU/Transforms/Utils.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/BlockAndValueMapping.h"
 #include "mlir/Support/LLVM.h"
 #include "mlir/Transforms/RegionUtils.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_GPULAUNCHSINKINDEXCOMPUTATIONSPASS
+#define GEN_PASS_DEF_GPUKERNELOUTLININGPASS
+#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 template <typename OpTy>
@@ -239,7 +245,7 @@ namespace {
 /// Pass that moves ops which are likely an index computation into gpu.launch
 /// body.
 class GpuLaunchSinkIndexComputationsPass
-    : public GpuLaunchSinkIndexComputationsBase<
+    : public impl::GpuLaunchSinkIndexComputationsPassBase<
           GpuLaunchSinkIndexComputationsPass> {
 public:
   void runOnOperation() override {
@@ -266,7 +272,7 @@ public:
 /// a separate pass. The external functions can then be annotated with the
 /// symbol of the cubin accessor function.
 class GpuKernelOutliningPass
-    : public GpuKernelOutliningBase<GpuKernelOutliningPass> {
+    : public impl::GpuKernelOutliningPassBase<GpuKernelOutliningPass> {
 public:
   GpuKernelOutliningPass(StringRef dlStr) {
     if (!dlStr.empty() && !dataLayoutStr.hasValue())
@@ -274,7 +280,8 @@ public:
   }
 
   GpuKernelOutliningPass(const GpuKernelOutliningPass &other)
-      : GpuKernelOutliningBase(other), dataLayoutSpec(other.dataLayoutSpec) {
+      : GpuKernelOutliningPassBase(other),
+        dataLayoutSpec(other.dataLayoutSpec) {
     dataLayoutStr = other.dataLayoutStr.getValue();
   }
 
index 84f2a90..72e0ebc 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h"
+#include "mlir/Dialect/GPU/Transforms/Passes.h"
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
-#include "mlir/Dialect/GPU/Transforms/Passes.h"
+#include "mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/IR/AffineMap.h"
 
 namespace mlir {
+#define GEN_PASS_DEF_GPUMAPPARALLELLOOPSPASS
+#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
+} // namespace mlir
+
+namespace mlir {
 
 using scf::ParallelOp;
 
@@ -129,7 +134,7 @@ static void mapParallelOp(ParallelOp parallelOp,
 
 namespace {
 struct GpuMapParallelLoopsPass
-    : public GpuMapParallelLoopsPassBase<GpuMapParallelLoopsPass> {
+    : public impl::GpuMapParallelLoopsPassBase<GpuMapParallelLoopsPass> {
   void runOnOperation() override {
     for (Region &region : getOperation()->getRegions()) {
       region.walk([](ParallelOp parallelOp) { mapParallelOp(parallelOp); });
diff --git a/mlir/lib/Dialect/GPU/Transforms/PassDetail.h b/mlir/lib/Dialect/GPU/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 2f5c7dc..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-//===- PassDetail.h - GPU Pass class details --------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_GPU_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_GPU_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Dialect/Async/IR/Async.h"
-#include "mlir/Dialect/DLTI/DLTI.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Dialect/GPU/IR/GPUDialect.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_GPU_TRANSFORMS_PASSDETAIL_H_
index 08fd412..9fc80c5 100644 (file)
@@ -7,11 +7,19 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h"
-#include "PassDetail.h"
+
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/IR/Block.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/BuiltinOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+namespace LLVM {
+#define GEN_PASS_DEF_LLVMLEGALIZEFOREXPORTPASS
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+} // namespace LLVM
+} // namespace mlir
 
 using namespace mlir;
 
@@ -67,8 +75,11 @@ void mlir::LLVM::ensureDistinctSuccessors(Operation *op) {
 }
 
 namespace {
-struct LegalizeForExportPass
-    : public LLVMLegalizeForExportBase<LegalizeForExportPass> {
+struct LLVMLegalizeForExportPass
+    : public LLVM::impl::LLVMLegalizeForExportPassBase<
+          LLVMLegalizeForExportPass> {
+  using LLVMLegalizeForExportPassBase::LLVMLegalizeForExportPassBase;
+
   void runOnOperation() override {
     LLVM::ensureDistinctSuccessors(getOperation());
   }
@@ -76,5 +87,5 @@ struct LegalizeForExportPass
 } // namespace
 
 std::unique_ptr<Pass> LLVM::createLegalizeForExportPass() {
-  return std::make_unique<LegalizeForExportPass>();
+  return std::make_unique<LLVMLegalizeForExportPass>();
 }
index d269aa8..5bf0d7d 100644 (file)
@@ -7,12 +7,20 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h"
-#include "PassDetail.h"
+
 #include "mlir/Dialect/LLVMIR/NVVMDialect.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/PatternMatch.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+namespace NVVM {
+#define GEN_PASS_DEF_NVVMOPTIMIZEFORTARGETPASS
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+} // namespace NVVM
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -31,8 +39,11 @@ private:
                                 PatternRewriter &rewriter) const override;
 };
 
-struct NVVMOptimizeForTarget
-    : public NVVMOptimizeForTargetBase<NVVMOptimizeForTarget> {
+struct NVVMOptimizeForTargetPass
+    : public NVVM::impl::NVVMOptimizeForTargetPassBase<
+          NVVMOptimizeForTargetPass> {
+  using NVVMOptimizeForTargetPassBase::NVVMOptimizeForTargetPassBase;
+
   void runOnOperation() override;
 
   void getDependentDialects(DialectRegistry &registry) const override {
@@ -84,7 +95,7 @@ LogicalResult ExpandDivF16::matchAndRewrite(LLVM::FDivOp op,
   return success();
 }
 
-void NVVMOptimizeForTarget::runOnOperation() {
+void NVVMOptimizeForTargetPass::runOnOperation() {
   MLIRContext *ctx = getOperation()->getContext();
   RewritePatternSet patterns(ctx);
   patterns.add<ExpandDivF16>(ctx);
@@ -93,5 +104,5 @@ void NVVMOptimizeForTarget::runOnOperation() {
 }
 
 std::unique_ptr<Pass> NVVM::createOptimizeForTargetPass() {
-  return std::make_unique<NVVMOptimizeForTarget>();
+  return std::make_unique<NVVMOptimizeForTargetPass>();
 }
diff --git a/mlir/lib/Dialect/LLVMIR/Transforms/PassDetail.h b/mlir/lib/Dialect/LLVMIR/Transforms/PassDetail.h
deleted file mode 100644 (file)
index deb54ba..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-//===- PassDetail.h - LLVM Pass class details -------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_LLVMIR_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_LLVMIR_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-namespace func {
-class FuncOp;
-} // namespace func
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_LLVMIR_TRANSFORMS_PASSDETAIL_H_
index d32f510..17f9536 100644 (file)
@@ -7,16 +7,25 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h"
-#include "PassDetail.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+namespace LLVM {
+#define GEN_PASS_DEF_LLVMREQUESTCWRAPPERSPASS
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+} // namespace LLVM
+} // namespace mlir
 
 using namespace mlir;
 
 namespace {
-class RequestCWrappersPass
-    : public LLVMRequestCWrappersBase<RequestCWrappersPass> {
-public:
+struct LLVMRequestCWrappersPass
+    : public LLVM::impl::LLVMRequestCWrappersPassBase<
+          LLVMRequestCWrappersPass> {
+  using LLVMRequestCWrappersPassBase::LLVMRequestCWrappersPassBase;
+
   void runOnOperation() override {
     getOperation()->setAttr(LLVM::LLVMDialect::getEmitCWrapperAttrName(),
                             UnitAttr::get(&getContext()));
@@ -25,5 +34,5 @@ public:
 } // namespace
 
 std::unique_ptr<Pass> mlir::LLVM::createRequestCWrappersPass() {
-  return std::make_unique<RequestCWrappersPass>();
+  return std::make_unique<LLVMRequestCWrappersPass>();
 }
index 78dd1ea..c14f910 100644 (file)
@@ -12,7 +12,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/Utils/Utils.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
index 63433ef..fd3a424 100644 (file)
@@ -6,12 +6,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Linalg/Passes.h"
 
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/IR/Operation.h"
 #include "mlir/Pass/Pass.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LINALGBUFFERIZEPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace bufferization;
 
 namespace {
 /// Converts Linalg operations that work on tensor-type operands or results to
 /// work on buffers.
-struct LinalgBufferizePass : public LinalgBufferizeBase<LinalgBufferizePass> {
+struct LinalgBufferizePass
+    : public impl::LinalgBufferizePassBase<LinalgBufferizePass> {
   void runOnOperation() override {
     BufferizationOptions options = getPartialBufferizationOptions();
     options.opFilter.allowDialect<linalg::LinalgDialect>();
index b98b486..72515fd 100644 (file)
@@ -6,11 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Linalg/Passes.h"
+
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Func/Transforms/FuncConversions.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/IR/OpDefinition.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include <memory>
 #include <utility>
 
+namespace mlir {
+#define GEN_PASS_DEF_LINALGDETENSORIZEPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::linalg;
 
@@ -158,7 +164,8 @@ public:
 };
 
 /// @see LinalgDetensorize in Linalg/Passes.td for more details.
-struct LinalgDetensorize : public LinalgDetensorizeBase<LinalgDetensorize> {
+struct LinalgDetensorize
+    : public impl::LinalgDetensorizePassBase<LinalgDetensorize> {
   LinalgDetensorize() = default;
 
   class CostModel {
index df3b8e6..0ecc07d 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Linalg/Passes.h"
+
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/Dialect/Linalg/Utils/Utils.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMSPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "linalg-drop-unit-dims"
 
 using namespace mlir;
@@ -542,7 +548,8 @@ void mlir::linalg::populateFoldUnitExtentDimsPatterns(
 namespace {
 /// Pass that removes unit-extent dims within generic ops.
 struct LinalgFoldUnitExtentDimsPass
-    : public LinalgFoldUnitExtentDimsBase<LinalgFoldUnitExtentDimsPass> {
+    : public impl::LinalgFoldUnitExtentDimsPassBase<
+          LinalgFoldUnitExtentDimsPass> {
   void runOnOperation() override {
     Operation *op = getOperation();
     MLIRContext *context = op->getContext();
index 2644e50..c8701fc 100644 (file)
@@ -9,12 +9,11 @@
 // This file implements the linalg dialect Fusion on tensors operations pass.
 //
 //===----------------------------------------------------------------------===//
-#include <utility>
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Linalg/Passes.h"
+
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/Dialect/Linalg/Utils/Utils.h"
 #include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Support/LLVM.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
+#include <utility>
+
+namespace mlir {
+#define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMSPASS
+#define GEN_PASS_DEF_LINALGELEMENTWISEOPFUSIONPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 using namespace mlir::linalg;
@@ -1753,7 +1759,8 @@ namespace {
 // favor of test passes that check the functionality of each of the patterns
 // added here individually.
 struct LinalgElementwiseOpFusionPass
-    : public LinalgElementwiseOpFusionBase<LinalgElementwiseOpFusionPass> {
+    : public impl::LinalgElementwiseOpFusionPassBase<
+          LinalgElementwiseOpFusionPass> {
   void runOnOperation() override {
     Operation *op = getOperation();
     MLIRContext *context = op->getContext();
index 9b5dad0..2494198 100644 (file)
@@ -8,13 +8,17 @@
 
 #include "mlir/Dialect/Linalg/Passes.h"
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Arithmetic/Utils/Utils.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/Dialect/Linalg/Utils/Utils.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTELEMENTWISETOLINALGPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 static bool isElementwiseMappableOpOnRankedTensors(Operation *op) {
@@ -121,7 +125,8 @@ void mlir::linalg::populateElementwiseToLinalgConversionPatterns(
 
 namespace {
 class ConvertElementwiseToLinalgPass
-    : public ConvertElementwiseToLinalgBase<ConvertElementwiseToLinalgPass> {
+    : public impl::ConvertElementwiseToLinalgPassBase<
+          ConvertElementwiseToLinalgPass> {
 
   void runOnOperation() final {
     auto *func = getOperation();
index 9d38dd6..ebef656 100644 (file)
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h"
index 24caab3..ff28663 100644 (file)
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "mlir/Analysis/SliceAnalysis.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
index 9c5b3fa..4512ab5 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
-#include "mlir/Dialect/Linalg/IR/Linalg.h"
 #include "mlir/Dialect/Linalg/Passes.h"
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Linalg/IR/Linalg.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/IR/AffineMap.h"
 #include "mlir/IR/Attributes.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LINALGGENERALIZATIONPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "linalg-generalization"
 
 using namespace mlir;
@@ -67,7 +73,7 @@ FailureOr<GenericOp> mlir::linalg::generalizeNamedOp(RewriterBase &rewriter,
 namespace {
 
 struct LinalgGeneralizationPass
-    : public LinalgGeneralizationBase<LinalgGeneralizationPass> {
+    : public impl::LinalgGeneralizationPassBase<LinalgGeneralizationPass> {
   void runOnOperation() override;
 };
 
index 978220e..a34005c 100644 (file)
@@ -6,13 +6,17 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Linalg/Passes.h"
 
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
-#include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LINALGINITTENSORTOALLOCTENSORPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::bufferization;
 using namespace mlir::linalg;
@@ -30,7 +34,8 @@ struct InitTensorLoweringPattern : public OpRewritePattern<InitTensorOp> {
 };
 
 struct LinalgInitTensorToAllocTensor
-    : public LinalgInitTensorToAllocTensorBase<LinalgInitTensorToAllocTensor> {
+    : public impl::LinalgInitTensorToAllocTensorPassBase<
+          LinalgInitTensorToAllocTensor> {
   LinalgInitTensorToAllocTensor() = default;
 
   void runOnOperation() override;
index b2ad1b2..5280e96 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Linalg/Passes.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/IR/AffineExpr.h"
 #include "mlir/IR/AffineMap.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LINALGINLINESCALAROPERANDSPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::linalg;
 
@@ -96,7 +102,8 @@ void mlir::linalg::populateInlineConstantOperandsPatterns(
 namespace {
 /// Pass that removes unit-extent dims within generic ops.
 struct LinalgInlineScalarOperandsPass
-    : public LinalgInlineScalarOperandsBase<LinalgInlineScalarOperandsPass> {
+    : public impl::LinalgInlineScalarOperandsPassBase<
+          LinalgInlineScalarOperandsPass> {
   void runOnOperation() override {
     func::FuncOp funcOp = getOperation();
     MLIRContext *context = funcOp.getContext();
index b8a8bbd..6966c94 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include <utility>
+#include "mlir/Dialect/Linalg/Passes.h"
 
-#include "PassDetail.h"
 #include "mlir/Analysis/SliceAnalysis.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/LoopUtils.h"
 #include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Dialect/Linalg/Transforms/Hoisting.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/Dialect/Linalg/Utils/Utils.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "mlir/Transforms/LoopInvariantCodeMotionUtils.h"
 #include "mlir/Transforms/Passes.h"
+#include <utility>
+
+namespace mlir {
+#define GEN_PASS_DEF_LINALGSTRATEGYTILEANDFUSEPASS
+#define GEN_PASS_DEF_LINALGSTRATEGYTILEPASS
+#define GEN_PASS_DEF_LINALGSTRATEGYPADPASS
+#define GEN_PASS_DEF_LINALGSTRATEGYDECOMPOSEPASS
+#define GEN_PASS_DEF_LINALGSTRATEGYPEELPASS
+#define GEN_PASS_DEF_LINALGSTRATEGYVECTORIZEPASS
+#define GEN_PASS_DEF_LINALGSTRATEGYENABLEPASS
+#define GEN_PASS_DEF_LINALGSTRATEGYLOWERVECTORSPASS
+#define GEN_PASS_DEF_LINALGSTRATEGYREMOVEMARKERSPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 using namespace mlir::vector;
@@ -42,7 +55,8 @@ namespace {
 
 /// Configurable pass to apply pattern-based tiling and fusion.
 struct LinalgStrategyTileAndFusePass
-    : public LinalgStrategyTileAndFusePassBase<LinalgStrategyTileAndFusePass> {
+    : public impl::LinalgStrategyTileAndFusePassBase<
+          LinalgStrategyTileAndFusePass> {
 
   LinalgStrategyTileAndFusePass() = default;
 
@@ -79,7 +93,7 @@ struct LinalgStrategyTileAndFusePass
 
 /// Configurable pass to apply pattern-based linalg tiling.
 struct LinalgStrategyTilePass
-    : public LinalgStrategyTilePassBase<LinalgStrategyTilePass> {
+    : public impl::LinalgStrategyTilePassBase<LinalgStrategyTilePass> {
 
   LinalgStrategyTilePass() = default;
 
@@ -112,7 +126,7 @@ struct LinalgStrategyTilePass
 
 /// Configurable pass to apply hoisting and padding.
 struct LinalgStrategyPadPass
-    : public LinalgStrategyPadPassBase<LinalgStrategyPadPass> {
+    : public impl::LinalgStrategyPadPassBase<LinalgStrategyPadPass> {
 
   LinalgStrategyPadPass() = default;
 
@@ -142,11 +156,11 @@ struct LinalgStrategyPadPass
   LinalgTransformationFilter filter;
 };
 
-
 /// Configurable pass to apply lowering of coarser-grained named linalg ops into
 /// finer-grained named versions.
 struct LinalgStrategyDecomposePass
-    : public LinalgStrategyDecomposePassBase<LinalgStrategyDecomposePass> {
+    : public impl::LinalgStrategyDecomposePassBase<
+          LinalgStrategyDecomposePass> {
 
   LinalgStrategyDecomposePass() = default;
 
@@ -169,7 +183,7 @@ struct LinalgStrategyDecomposePass
 
 /// Configurable pass to apply pattern-based linalg peeling.
 struct LinalgStrategyPeelPass
-    : public LinalgStrategyPeelPassBase<LinalgStrategyPeelPass> {
+    : public impl::LinalgStrategyPeelPassBase<LinalgStrategyPeelPass> {
 
   LinalgStrategyPeelPass() = default;
 
@@ -203,7 +217,8 @@ struct LinalgStrategyPeelPass
 
 /// Configurable pass to apply pattern-based linalg vectorization.
 struct LinalgStrategyVectorizePass
-    : public LinalgStrategyVectorizePassBase<LinalgStrategyVectorizePass> {
+    : public impl::LinalgStrategyVectorizePassBase<
+          LinalgStrategyVectorizePass> {
 
   LinalgStrategyVectorizePass() = default;
 
@@ -259,7 +274,7 @@ struct LinalgStrategyVectorizePass
 /// Configurable pass to enable the application of other pattern-based linalg
 /// passes.
 struct LinalgStrategyEnablePass
-    : public LinalgStrategyEnablePassBase<LinalgStrategyEnablePass> {
+    : public impl::LinalgStrategyEnablePassBase<LinalgStrategyEnablePass> {
 
   LinalgStrategyEnablePass(LinalgEnablingOptions opt,
                            LinalgTransformationFilter filt)
@@ -309,7 +324,7 @@ struct LinalgStrategyEnablePass
 
 /// Configurable pass to lower vector operations.
 struct LinalgStrategyLowerVectorsPass
-    : public LinalgStrategyLowerVectorsPassBase<
+    : public impl::LinalgStrategyLowerVectorsPassBase<
           LinalgStrategyLowerVectorsPass> {
 
   LinalgStrategyLowerVectorsPass(LinalgVectorLoweringOptions opt,
@@ -374,7 +389,7 @@ struct LinalgStrategyLowerVectorsPass
 
 /// Configurable pass to lower vector operations.
 struct LinalgStrategyRemoveMarkersPass
-    : public LinalgStrategyRemoveMarkersPassBase<
+    : public impl::LinalgStrategyRemoveMarkersPassBase<
           LinalgStrategyRemoveMarkersPass> {
 
   void runOnOperation() override {
index 3656bc2..941e5f0 100644 (file)
@@ -6,11 +6,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Linalg/Passes.h"
+
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Arithmetic/Utils/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/Dialect/Linalg/Utils/Utils.h"
 #include "mlir/Dialect/SCF/Transforms/Transforms.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LINALGLOWERTOAFFINELOOPSPASS
+#define GEN_PASS_DEF_LINALGLOWERTOLOOPSPASS
+#define GEN_PASS_DEF_LINALGLOWERTOPARALLELLOOPSPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::linalg;
 
@@ -311,7 +320,7 @@ static void lowerLinalgToLoopsImpl(func::FuncOp funcOp) {
 }
 
 struct LowerToAffineLoops
-    : public LinalgLowerToAffineLoopsBase<LowerToAffineLoops> {
+    : public impl::LinalgLowerToAffineLoopsPassBase<LowerToAffineLoops> {
   void getDependentDialects(DialectRegistry &registry) const override {
     registry.insert<memref::MemRefDialect>();
   }
@@ -320,7 +329,7 @@ struct LowerToAffineLoops
   }
 };
 
-struct LowerToLoops : public LinalgLowerToLoopsBase<LowerToLoops> {
+struct LowerToLoops : public impl::LinalgLowerToLoopsPassBase<LowerToLoops> {
   void getDependentDialects(DialectRegistry &registry) const override {
     registry.insert<memref::MemRefDialect, scf::SCFDialect>();
   }
@@ -330,7 +339,7 @@ struct LowerToLoops : public LinalgLowerToLoopsBase<LowerToLoops> {
 };
 
 struct LowerToParallelLoops
-    : public LinalgLowerToParallelLoopsBase<LowerToParallelLoops> {
+    : public impl::LinalgLowerToParallelLoopsPassBase<LowerToParallelLoops> {
   void runOnOperation() override {
     lowerLinalgToLoopsImpl<scf::ParallelOp>(getOperation());
   }
index 1d987ee..83148b3 100644 (file)
 // canonicalizations of named ops.
 //
 //===----------------------------------------------------------------------===//
-#include "PassDetail.h"
-#include "mlir/Dialect/Linalg/IR/Linalg.h"
+
 #include "mlir/Dialect/Linalg/Passes.h"
+
+#include "mlir/Dialect/Linalg/IR/Linalg.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-
 #include "llvm/ADT/SmallVector.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LINALGNAMEDOPCONVERSIONPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::linalg;
 
@@ -135,7 +140,8 @@ struct SimplifyDepthwiseConvQOp
 };
 
 struct LinalgNamedOpConversionPass
-    : public LinalgNamedOpConversionBase<LinalgNamedOpConversionPass> {
+    : public impl::LinalgNamedOpConversionPassBase<
+          LinalgNamedOpConversionPass> {
   LinalgNamedOpConversionPass() = default;
   LinalgNamedOpConversionPass(const LinalgNamedOpConversionPass &) = default;
 
diff --git a/mlir/lib/Dialect/Linalg/Transforms/PassDetail.h b/mlir/lib/Dialect/Linalg/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 63f9475..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-//===- PassDetail.h - Linalg Pass class details -----------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_LINALG_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_LINALG_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/IR/BuiltinOps.h"
-#include "mlir/IR/Dialect.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-namespace arith {
-class ArithmeticDialect;
-} // namespace arith
-
-namespace bufferization {
-class BufferizationDialect;
-} // namespace bufferization
-
-namespace linalg {
-class LinalgDialect;
-} // namespace linalg
-
-namespace scf {
-class SCFDialect;
-} // namespace scf
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-namespace tensor {
-class TensorDialect;
-} // namespace tensor
-
-namespace vector {
-class VectorDialect;
-} // namespace vector
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_LINALG_TRANSFORMS_PASSDETAIL_H_
index 4c5fbf9..79ef14e 100644 (file)
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Complex/IR/Complex.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
index 55ce5ea..175dbad 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include <utility>
+#include "mlir/Dialect/Linalg/Passes.h"
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/Utils/Utils.h"
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Linalg/Passes.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
 #include "mlir/Dialect/Linalg/Utils/Utils.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/AffineMap.h"
 #include "mlir/Transforms/FoldUtils.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-
 #include "llvm/Support/CommandLine.h"
+#include <utility>
+
+namespace mlir {
+#define GEN_PASS_DEF_LINALGTILINGPASS
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+} // namespace mlir
+
+#define DEBUG_TYPE "linalg-tiling"
 
 using namespace mlir;
 using namespace mlir::linalg;
 using namespace mlir::scf;
 
-#define DEBUG_TYPE "linalg-tiling"
-
 static bool isZero(OpFoldResult v) {
   if (!v)
     return false;
@@ -744,7 +748,7 @@ static void applyExtractSliceOfPadTensorSwapPattern(func::FuncOp funcOp) {
 }
 
 namespace {
-struct LinalgTilingPass : public LinalgTilingBase<LinalgTilingPass> {
+struct LinalgTilingPass : public impl::LinalgTilingPassBase<LinalgTilingPass> {
   LinalgTilingPass() = default;
   LinalgTilingPass(ArrayRef<int64_t> tileSizes, LinalgTilingLoopType loopType) {
     this->tileSizes = tileSizes;
index c4011c5..73eb6fa 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/MemRef/Transforms/Passes.h"
 
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/MemRef/Transforms/Passes.h"
 #include "mlir/IR/TypeUtilities.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+namespace memref {
+#define GEN_PASS_DEF_EXPANDOPSPASS
+#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
+} // namespace memref
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -119,7 +125,7 @@ public:
   }
 };
 
-struct ExpandOpsPass : public ExpandOpsBase<ExpandOpsPass> {
+struct ExpandOpsPass : public memref::impl::ExpandOpsPassBase<ExpandOpsPass> {
   void runOnOperation() override {
     MLIRContext &ctx = getContext();
 
index 3ce18ec..e91c33e 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/MemRef/Transforms/Passes.h"
+
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/MemRef/Transforms/Passes.h"
 #include "mlir/Dialect/Utils/IndexingUtils.h"
 #include "mlir/Dialect/Vector/IR/VectorOps.h"
 #include "mlir/IR/BuiltinTypes.h"
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace mlir {
+namespace memref {
+#define GEN_PASS_DEF_FOLDMEMREFALIASOPSPASS
+#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
+} // namespace memref
+} // namespace mlir
+
 using namespace mlir;
 
 //===----------------------------------------------------------------------===//
@@ -540,11 +547,8 @@ void memref::populateFoldMemRefAliasOpPatterns(RewritePatternSet &patterns) {
 
 namespace {
 
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
-
 struct FoldMemRefAliasOpsPass final
-    : public FoldMemRefAliasOpsBase<FoldMemRefAliasOpsPass> {
+    : public memref::impl::FoldMemRefAliasOpsPassBase<FoldMemRefAliasOpsPass> {
   void runOnOperation() override;
 };
 
index 345c71d..a3c2a9d 100644 (file)
@@ -11,7 +11,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/Utils.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+namespace memref {
+#define GEN_PASS_DEF_NORMALIZEMEMREFSPASS
+#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
+} // namespace memref
+} // namespace mlir
+
 #define DEBUG_TYPE "normalize-memrefs"
 
 using namespace mlir;
@@ -32,7 +38,8 @@ namespace {
 /// such functions as normalizable. Also, if a normalizable function is known
 /// to call a non-normalizable function, we treat that function as
 /// non-normalizable as well. We assume external functions to be normalizable.
-struct NormalizeMemRefs : public NormalizeMemRefsBase<NormalizeMemRefs> {
+struct NormalizeMemRefs
+    : public memref::impl::NormalizeMemRefsPassBase<NormalizeMemRefs> {
   void runOnOperation() override;
   void normalizeFuncOpMemRefs(func::FuncOp funcOp, ModuleOp moduleOp);
   bool areMemRefsNormalizable(func::FuncOp funcOp);
diff --git a/mlir/lib/Dialect/MemRef/Transforms/PassDetail.h b/mlir/lib/Dialect/MemRef/Transforms/PassDetail.h
deleted file mode 100644 (file)
index ba7a875..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-//===- PassDetail.h - MemRef Pass class details -----------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_MEMREF_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_MEMREF_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/IR/BuiltinOps.h"
-#include "mlir/IR/DialectRegistry.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-class AffineDialect;
-
-// Forward declaration from Dialect.h
-template <typename ConcreteDialect>
-void registerDialect(DialectRegistry &registry);
-
-namespace arith {
-class ArithmeticDialect;
-} // namespace arith
-
-namespace func {
-class FuncDialect;
-} // namespace func
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-namespace tensor {
-class TensorDialect;
-} // namespace tensor
-
-namespace vector {
-class VectorDialect;
-} // namespace vector
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_MEMREF_TRANSFORMS_PASSDETAIL_H_
index d90ec22..bf23658 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/MemRef/Transforms/Passes.h"
+
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/MemRef/Transforms/Passes.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Interfaces/InferTypeOpInterface.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+namespace memref {
+#define GEN_PASS_DEF_RESOLVERANKEDSHAPETYPERESULTDIMSPASS
+#define GEN_PASS_DEF_RESOLVESHAPEDTYPERESULTDIMSPASS
+#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
+} // namespace memref
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -108,13 +116,14 @@ struct DimOfReifyRankedShapedTypeOpInterface : public OpRewritePattern<OpTy> {
 
 namespace {
 struct ResolveRankedShapeTypeResultDimsPass final
-    : public ResolveRankedShapeTypeResultDimsBase<
+    : public memref::impl::ResolveRankedShapeTypeResultDimsPassBase<
           ResolveRankedShapeTypeResultDimsPass> {
   void runOnOperation() override;
 };
 
 struct ResolveShapedTypeResultDimsPass final
-    : public ResolveShapedTypeResultDimsBase<ResolveShapedTypeResultDimsPass> {
+    : public memref::impl::ResolveShapedTypeResultDimsPassBase<
+          ResolveShapedTypeResultDimsPass> {
   void runOnOperation() override;
 };
 
index d24001c..4d38319 100644 (file)
@@ -11,7 +11,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
index da8292b..419617d 100644 (file)
@@ -9,12 +9,13 @@
 // This file implements transforms to optimize accesses to shared memory.
 //
 //===----------------------------------------------------------------------===//
-#include "PassDetail.h"
+
+#include "mlir/Dialect/NVGPU/Passes.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/NVGPU/IR/NVGPUDialect.h"
-#include "mlir/Dialect/NVGPU/Passes.h"
 #include "mlir/Dialect/NVGPU/Transforms/Transforms.h"
 #include "mlir/Dialect/Vector/IR/VectorOps.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/MathExtras.h"
 
+namespace mlir {
+namespace nvgpu {
+#define GEN_PASS_DEF_OPTIMIZESHAREDMEMORYPASS
+#include "mlir/Dialect/NVGPU/Passes.h.inc"
+} // namespace nvgpu
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::nvgpu;
 
@@ -242,9 +250,10 @@ mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(Operation *parentOp,
 
 namespace {
 class OptimizeSharedMemoryPass
-    : public OptimizeSharedMemoryBase<OptimizeSharedMemoryPass> {
+    : public nvgpu::impl::OptimizeSharedMemoryPassBase<
+          OptimizeSharedMemoryPass> {
 public:
-  OptimizeSharedMemoryPass() = default;
+  using OptimizeSharedMemoryPassBase::OptimizeSharedMemoryPassBase;
 
   void runOnOperation() override {
     Operation *op = getOperation();
diff --git a/mlir/lib/Dialect/NVGPU/Transforms/PassDetail.h b/mlir/lib/Dialect/NVGPU/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 884a103..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-//===- PassDetail.h - NVGPU Pass class details -----------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#ifndef DIALECT_NVGPU_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_NVGPU_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/IR/BuiltinOps.h"
-#include "mlir/IR/Dialect.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-namespace arith {
-class ArithmeticDialect;
-} // namespace arith
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-namespace vector {
-class VectorDialect;
-} // namespace vector
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/NVGPU/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_NVGPU_TRANSFORMS_PASSDETAIL_H_
index 961e11a..f81e8f9 100644 (file)
@@ -6,20 +6,27 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
-#include "PassDetail.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
+
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
 #include "mlir/Dialect/SCF/Transforms/Transforms.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SCFBUFFERIZEPASS
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::scf;
 
 namespace {
-struct SCFBufferizePass : public SCFBufferizeBase<SCFBufferizePass> {
+struct SCFBufferizePass : public impl::SCFBufferizePassBase<SCFBufferizePass> {
+  using SCFBufferizePassBase::SCFBufferizePassBase;
+
   void runOnOperation() override {
     auto func = getOperation();
     auto *context = &getContext();
@@ -36,7 +43,3 @@ struct SCFBufferizePass : public SCFBufferizeBase<SCFBufferizePass> {
   };
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::createSCFBufferizePass() {
-  return std::make_unique<SCFBufferizePass>();
-}
index 14eb075..49eca81 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
 #include "mlir/Dialect/SCF/Transforms/Transforms.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SCFFORTOWHILELOOPPASS
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace llvm;
 using namespace mlir;
 using scf::ForOp;
@@ -98,7 +103,10 @@ struct ForLoopLoweringPattern : public OpRewritePattern<ForOp> {
   }
 };
 
-struct ForToWhileLoop : public SCFForToWhileLoopBase<ForToWhileLoop> {
+struct SCFForToWhileLoopPass
+    : public impl::SCFForToWhileLoopPassBase<SCFForToWhileLoopPass> {
+  using SCFForToWhileLoopPassBase::SCFForToWhileLoopPassBase;
+
   void runOnOperation() override {
     auto *parentOp = getOperation();
     MLIRContext *ctx = parentOp->getContext();
@@ -108,7 +116,3 @@ struct ForToWhileLoop : public SCFForToWhileLoopBase<ForToWhileLoop> {
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::createForToWhileLoopPass() {
-  return std::make_unique<ForToWhileLoop>();
-}
index 0797dc2..7324be3 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
+
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
 #include "mlir/Dialect/SCF/Transforms/Transforms.h"
 #include "mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "llvm/ADT/TypeSwitch.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SCFFORLOOPCANONICALIZATIONPASS
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::scf;
 
@@ -192,8 +197,11 @@ struct AffineOpSCFCanonicalizationPattern : public OpRewritePattern<OpTy> {
   }
 };
 
-struct SCFForLoopCanonicalization
-    : public SCFForLoopCanonicalizationBase<SCFForLoopCanonicalization> {
+struct SCFForLoopCanonicalizationPass
+    : public impl::SCFForLoopCanonicalizationPassBase<
+          SCFForLoopCanonicalizationPass> {
+  using SCFForLoopCanonicalizationPassBase::SCFForLoopCanonicalizationPassBase;
+
   void runOnOperation() override {
     auto *parentOp = getOperation();
     MLIRContext *ctx = parentOp->getContext();
@@ -215,7 +223,3 @@ void mlir::scf::populateSCFForLoopCanonicalizationPatterns(
            DimOfLoopResultFolder<tensor::DimOp>,
            DimOfLoopResultFolder<memref::DimOp>>(ctx);
 }
-
-std::unique_ptr<Pass> mlir::createSCFForLoopCanonicalizationPass() {
-  return std::make_unique<SCFForLoopCanonicalization>();
-}
index c1d04af..7a162dc 100644 (file)
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/SCF/Transforms/Patterns.h"
@@ -19,6 +18,7 @@
 #include "mlir/IR/BlockAndValueMapping.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Support/MathExtras.h"
+#include "llvm/ADT/MapVector.h"
 
 using namespace mlir;
 using namespace mlir::scf;
index c5aabe9..7c3b03d 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
 #include "mlir/Dialect/SCF/Transforms/Transforms.h"
 #include "mlir/Dialect/SCF/Utils/Utils.h"
 #include "mlir/IR/BlockAndValueMapping.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SCFFORLOOPRANGEFOLDINGPASS
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::scf;
 
 namespace {
-struct ForLoopRangeFolding
-    : public SCFForLoopRangeFoldingBase<ForLoopRangeFolding> {
+struct SCFForLoopRangeFoldingPass
+    : public impl::SCFForLoopRangeFoldingPassBase<SCFForLoopRangeFoldingPass> {
+  using SCFForLoopRangeFoldingPassBase::SCFForLoopRangeFoldingPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
 
-void ForLoopRangeFolding::runOnOperation() {
+void SCFForLoopRangeFoldingPass::runOnOperation() {
   getOperation()->walk([&](ForOp op) {
     Value indVar = op.getInductionVar();
 
@@ -80,7 +87,3 @@ void ForLoopRangeFolding::runOnOperation() {
     }
   });
 }
-
-std::unique_ptr<Pass> mlir::createForLoopRangeFoldingPass() {
-  return std::make_unique<ForLoopRangeFolding>();
-}
index 3778bb9..97d222c 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
+
 #include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
 #include "mlir/Dialect/SCF/Transforms/Transforms.h"
 #include "mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h"
 #include "mlir/Dialect/Utils/StaticValueUtils.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "llvm/ADT/DenseMap.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SCFFORLOOPPEELINGPASS
+#define GEN_PASS_DEF_SCFFORLOOPSPECIALIZATIONPASS
+#define GEN_PASS_DEF_SCFPARALLELLOOPSPECIALIZATIONPASS
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using scf::ForOp;
 using scf::ParallelOp;
@@ -234,22 +241,32 @@ struct ForLoopPeelingPattern : public OpRewritePattern<ForOp> {
 } // namespace
 
 namespace {
-struct ParallelLoopSpecialization
-    : public SCFParallelLoopSpecializationBase<ParallelLoopSpecialization> {
+struct SCFParallelLoopSpecializationPass
+    : public impl::SCFParallelLoopSpecializationPassBase<
+          SCFParallelLoopSpecializationPass> {
+  using SCFParallelLoopSpecializationPassBase::
+      SCFParallelLoopSpecializationPassBase;
+
   void runOnOperation() override {
     getOperation()->walk(
         [](ParallelOp op) { specializeParallelLoopForUnrolling(op); });
   }
 };
 
-struct ForLoopSpecialization
-    : public SCFForLoopSpecializationBase<ForLoopSpecialization> {
+struct SCFForLoopSpecializationPass
+    : public impl::SCFForLoopSpecializationPassBase<
+          SCFForLoopSpecializationPass> {
+  using SCFForLoopSpecializationPassBase::SCFForLoopSpecializationPassBase;
+
   void runOnOperation() override {
     getOperation()->walk([](ForOp op) { specializeForLoopForUnrolling(op); });
   }
 };
 
-struct ForLoopPeeling : public SCFForLoopPeelingBase<ForLoopPeeling> {
+struct SCFForLoopPeelingPass
+    : public impl::SCFForLoopPeelingPassBase<SCFForLoopPeelingPass> {
+  using SCFForLoopPeelingPassBase::SCFForLoopPeelingPassBase;
+
   void runOnOperation() override {
     auto *parentOp = getOperation();
     MLIRContext *ctx = parentOp->getContext();
@@ -265,15 +282,3 @@ struct ForLoopPeeling : public SCFForLoopPeelingBase<ForLoopPeeling> {
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::createParallelLoopSpecializationPass() {
-  return std::make_unique<ParallelLoopSpecialization>();
-}
-
-std::unique_ptr<Pass> mlir::createForLoopSpecializationPass() {
-  return std::make_unique<ForLoopSpecialization>();
-}
-
-std::unique_ptr<Pass> mlir::createForLoopPeelingPass() {
-  return std::make_unique<ForLoopPeeling>();
-}
index 3403cd5..9804b1e 100644 (file)
@@ -6,21 +6,29 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
-#include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/SCF/Transforms/Passes.h"
+
+#include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/SCF/Utils/Utils.h"
 #include "mlir/Transforms/RegionUtils.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SCFPARALLELLOOPCOLLAPSINGPASS
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "parallel-loop-collapsing"
 
 using namespace mlir;
 
 namespace {
-struct ParallelLoopCollapsing
-    : public SCFParallelLoopCollapsingBase<ParallelLoopCollapsing> {
+struct SCFParallelLoopCollapsingPass
+    : public impl::SCFParallelLoopCollapsingPassBase<
+          SCFParallelLoopCollapsingPass> {
+  using SCFParallelLoopCollapsingPassBase::SCFParallelLoopCollapsingPassBase;
+
   void runOnOperation() override {
     Operation *module = getOperation();
 
@@ -39,7 +47,3 @@ struct ParallelLoopCollapsing
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::createParallelLoopCollapsingPass() {
-  return std::make_unique<ParallelLoopCollapsing>();
-}
index cab8b76..035dc81 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
+
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
 #include "mlir/Dialect/SCF/Transforms/Transforms.h"
 #include "mlir/IR/BlockAndValueMapping.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/OpDefinition.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SCFPARALLELLOOPFUSIONPASS
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::scf;
 
@@ -161,8 +166,10 @@ void mlir::scf::naivelyFuseParallelOps(Region &region) {
 }
 
 namespace {
-struct ParallelLoopFusion
-    : public SCFParallelLoopFusionBase<ParallelLoopFusion> {
+struct SCFParallelLoopFusionPass
+    : public impl::SCFParallelLoopFusionPassBase<SCFParallelLoopFusionPass> {
+  using SCFParallelLoopFusionPassBase::SCFParallelLoopFusionPassBase;
+
   void runOnOperation() override {
     getOperation()->walk([&](Operation *child) {
       for (Region &region : child->getRegions())
@@ -171,7 +178,3 @@ struct ParallelLoopFusion
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::createParallelLoopFusionPass() {
-  return std::make_unique<ParallelLoopFusion>();
-}
index 9424305..e30e6fc 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
+
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
 #include "mlir/Dialect/SCF/Transforms/Transforms.h"
 #include "mlir/Dialect/SCF/Utils/Utils.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SCFPARALLELLOOPTILINGPASS
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::scf;
 
@@ -180,14 +185,9 @@ mlir::scf::tileParallelLoop(ParallelOp op, ArrayRef<int64_t> tileSizes,
 }
 
 namespace {
-struct ParallelLoopTiling
-    : public SCFParallelLoopTilingBase<ParallelLoopTiling> {
-  ParallelLoopTiling() = default;
-  explicit ParallelLoopTiling(ArrayRef<int64_t> tileSizes,
-                              bool noMinMaxBounds = false) {
-    this->tileSizes = tileSizes;
-    this->noMinMaxBounds = noMinMaxBounds;
-  }
+struct SCFParallelLoopTilingPass
+    : public impl::SCFParallelLoopTilingPassBase<SCFParallelLoopTilingPass> {
+  using SCFParallelLoopTilingPassBase::SCFParallelLoopTilingPassBase;
 
   void runOnOperation() override {
     auto *parentOp = getOperation();
@@ -201,9 +201,3 @@ struct ParallelLoopTiling
   }
 };
 } // namespace
-
-std::unique_ptr<Pass>
-mlir::createParallelLoopTilingPass(ArrayRef<int64_t> tileSizes,
-                                   bool noMinMaxBounds) {
-  return std::make_unique<ParallelLoopTiling>(tileSizes, noMinMaxBounds);
-}
diff --git a/mlir/lib/Dialect/SCF/Transforms/PassDetail.h b/mlir/lib/Dialect/SCF/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 98109f7..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//===- PassDetail.h - Loop Pass class details -------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_SCF_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_SCF_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-// Forward declaration from Dialect.h
-template <typename ConcreteDialect>
-void registerDialect(DialectRegistry &registry);
-
-class AffineDialect;
-
-namespace arith {
-class ArithmeticDialect;
-} // namespace arith
-
-namespace bufferization {
-class BufferizationDialect;
-} // namespace bufferization
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-namespace tensor {
-class TensorDialect;
-} // namespace tensor
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_SCF_TRANSFORMS_PASSDETAIL_H_
index e7408d9..fb15fcb 100644 (file)
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/SCF/Transforms/Passes.h"
 #include "mlir/Dialect/SCF/Transforms/Transforms.h"
index 7277e84..57e393a 100644 (file)
@@ -6,19 +6,28 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
+
 #include "mlir/Dialect/SPIRV/IR/SPIRVGLCanonicalization.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+namespace spirv {
+#define GEN_PASS_DEF_SPIRVCANONICALIZEGLPASS
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
+} // namespace spirv
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
-class CanonicalizeGLPass final
-    : public SPIRVCanonicalizeGLBase<CanonicalizeGLPass> {
+class SPIRVCanonicalizeGLPass final
+    : public spirv::impl::SPIRVCanonicalizeGLPassBase<SPIRVCanonicalizeGLPass> {
 public:
+  using SPIRVCanonicalizeGLPassBase::SPIRVCanonicalizeGLPassBase;
+
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
     spirv::populateSPIRVGLCanonicalizationPatterns(patterns);
@@ -30,5 +39,5 @@ public:
 } // namespace
 
 std::unique_ptr<OperationPass<>> spirv::createCanonicalizeGLPass() {
-  return std::make_unique<CanonicalizeGLPass>();
+  return std::make_unique<SPIRVCanonicalizeGLPass>();
 }
index dd958e5..863361f 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
+
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
 #include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
 #include "mlir/Transforms/DialectConversion.h"
 
 using namespace mlir;
 
+namespace mlir {
+namespace spirv {
+#define GEN_PASS_DEF_SPIRVDECORATECOMPOSITETYPELAYOUTPASS
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
+} // namespace spirv
+} // namespace mlir
+
 namespace {
 class SPIRVGlobalVariableOpLayoutInfoDecoration
     : public OpRewritePattern<spirv::GlobalVariableOp> {
@@ -98,14 +105,17 @@ static void populateSPIRVLayoutInfoPatterns(RewritePatternSet &patterns) {
 }
 
 namespace {
-class DecorateSPIRVCompositeTypeLayoutPass
-    : public SPIRVCompositeTypeLayoutBase<
-          DecorateSPIRVCompositeTypeLayoutPass> {
+class SPIRVDecorateCompositeTypeLayoutPass
+    : public spirv::impl::SPIRVDecorateCompositeTypeLayoutPassBase<
+          SPIRVDecorateCompositeTypeLayoutPass> {
+  using SPIRVDecorateCompositeTypeLayoutPassBase::
+      SPIRVDecorateCompositeTypeLayoutPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
 
-void DecorateSPIRVCompositeTypeLayoutPass::runOnOperation() {
+void SPIRVDecorateCompositeTypeLayoutPass::runOnOperation() {
   auto module = getOperation();
   RewritePatternSet patterns(module.getContext());
   populateSPIRVLayoutInfoPatterns(patterns);
@@ -141,5 +151,5 @@ void DecorateSPIRVCompositeTypeLayoutPass::runOnOperation() {
 
 std::unique_ptr<OperationPass<ModuleOp>>
 mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass() {
-  return std::make_unique<DecorateSPIRVCompositeTypeLayoutPass>();
+  return std::make_unique<SPIRVDecorateCompositeTypeLayoutPass>();
 }
index 263f00e..ec9ae0b 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
+
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
 #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
 #include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "llvm/ADT/SetVector.h"
 
+namespace mlir {
+namespace spirv {
+#define GEN_PASS_DEF_SPIRVLOWERABIATTRIBUTESPASS
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
+} // namespace spirv
+} // namespace mlir
+
 using namespace mlir;
 
 /// Creates a global variable for an argument based on the ABI info.
@@ -164,8 +171,11 @@ public:
 };
 
 /// Pass to implement the ABI information specified as attributes.
-class LowerABIAttributesPass final
-    : public SPIRVLowerABIAttributesBase<LowerABIAttributesPass> {
+class SPIRVLowerABIAttributesPass final
+    : public spirv::impl::SPIRVLowerABIAttributesPassBase<
+          SPIRVLowerABIAttributesPass> {
+  using SPIRVLowerABIAttributesPassBase::SPIRVLowerABIAttributesPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
@@ -233,7 +243,7 @@ LogicalResult ProcessInterfaceVarABI::matchAndRewrite(
   return success();
 }
 
-void LowerABIAttributesPass::runOnOperation() {
+void SPIRVLowerABIAttributesPass::runOnOperation() {
   // Uses the signature conversion methodology of the dialect conversion
   // framework to implement the conversion.
   spirv::ModuleOp module = getOperation();
@@ -291,5 +301,5 @@ void LowerABIAttributesPass::runOnOperation() {
 
 std::unique_ptr<OperationPass<spirv::ModuleOp>>
 mlir::spirv::createLowerABIAttributesPass() {
-  return std::make_unique<LowerABIAttributesPass>();
+  return std::make_unique<SPIRVLowerABIAttributesPass>();
 }
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/PassDetail.h b/mlir/lib/Dialect/SPIRV/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 15f5c54..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-//===- PassDetail.h - SPIRV Pass class details ------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_SPIRV_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_SPIRV_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/IR/BuiltinOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-namespace spirv {
-class ModuleOp;
-} // namespace spirv
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_SPIRV_TRANSFORMS_PASSDETAIL_H_
index c381ee5..2d6ba8b 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
-#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
 #include "mlir/Dialect/SPIRV/Transforms/Passes.h"
+
+#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/BuiltinOps.h"
 
+namespace mlir {
+namespace spirv {
+#define GEN_PASS_DEF_SPIRVREWRITEINSERTSPASS
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
+} // namespace spirv
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 
 /// Replaces sequential chains of `spirv::CompositeInsertOp` operation into
 /// `spirv::CompositeConstructOp` operation if possible.
-class RewriteInsertsPass
-    : public SPIRVRewriteInsertsPassBase<RewriteInsertsPass> {
+class SPIRVRewriteInsertsPass
+    : public spirv::impl::SPIRVRewriteInsertsPassBase<SPIRVRewriteInsertsPass> {
 public:
+  using SPIRVRewriteInsertsPassBase::SPIRVRewriteInsertsPassBase;
+
   void runOnOperation() override;
 
 private:
@@ -40,7 +49,7 @@ private:
 
 } // namespace
 
-void RewriteInsertsPass::runOnOperation() {
+void SPIRVRewriteInsertsPass::runOnOperation() {
   SmallVector<SmallVector<spirv::CompositeInsertOp, 4>, 4> workList;
   getOperation().walk([this, &workList](spirv::CompositeInsertOp op) {
     SmallVector<spirv::CompositeInsertOp, 4> insertions;
@@ -74,7 +83,7 @@ void RewriteInsertsPass::runOnOperation() {
   }
 }
 
-LogicalResult RewriteInsertsPass::collectInsertionChain(
+LogicalResult SPIRVRewriteInsertsPass::collectInsertionChain(
     spirv::CompositeInsertOp op,
     SmallVectorImpl<spirv::CompositeInsertOp> &insertions) {
   auto indicesArrayAttr = op.indices().cast<ArrayAttr>();
@@ -111,5 +120,5 @@ LogicalResult RewriteInsertsPass::collectInsertionChain(
 
 std::unique_ptr<mlir::OperationPass<spirv::ModuleOp>>
 mlir::spirv::createRewriteInsertsPass() {
-  return std::make_unique<RewriteInsertsPass>();
+  return std::make_unique<SPIRVRewriteInsertsPass>();
 }
index 8299fd0..194258d 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
+
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/BuiltinAttributes.h"
 #include "mlir/IR/BuiltinTypes.h"
 #include <algorithm>
 #include <iterator>
 
+namespace mlir {
+namespace spirv {
+#define GEN_PASS_DEF_SPIRVUNIFYALIASEDRESOURCEPASS
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
+} // namespace spirv
+} // namespace mlir
+
 #define DEBUG_TYPE "spirv-unify-aliased-resource"
 
 using namespace mlir;
@@ -520,14 +527,17 @@ struct ConvertStore : public ConvertAliasResource<spirv::StoreOp> {
 //===----------------------------------------------------------------------===//
 
 namespace {
-class UnifyAliasedResourcePass final
-    : public SPIRVUnifyAliasedResourcePassBase<UnifyAliasedResourcePass> {
+class SPIRVUnifyAliasedResourcePass final
+    : public spirv::impl::SPIRVUnifyAliasedResourcePassBase<
+          SPIRVUnifyAliasedResourcePass> {
 public:
+  using SPIRVUnifyAliasedResourcePassBase::SPIRVUnifyAliasedResourcePassBase;
+
   void runOnOperation() override;
 };
 } // namespace
 
-void UnifyAliasedResourcePass::runOnOperation() {
+void SPIRVUnifyAliasedResourcePass::runOnOperation() {
   spirv::ModuleOp moduleOp = getOperation();
   MLIRContext *context = &getContext();
 
@@ -562,5 +572,5 @@ void UnifyAliasedResourcePass::runOnOperation() {
 
 std::unique_ptr<mlir::OperationPass<spirv::ModuleOp>>
 spirv::createUnifyAliasedResourcePass() {
-  return std::make_unique<UnifyAliasedResourcePass>();
+  return std::make_unique<SPIRVUnifyAliasedResourcePass>();
 }
index 3232c98..3bab93e 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
+
 #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
 #include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
 #include "mlir/Dialect/SPIRV/IR/TargetAndABI.h"
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/Visitors.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringExtras.h"
 
+namespace mlir {
+namespace spirv {
+#define GEN_PASS_DEF_SPIRVUPDATEVCEPASS
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
+} // namespace spirv
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 /// Pass to deduce minimal version/extension/capability requirements for a
 /// spirv::ModuleOp.
-class UpdateVCEPass final : public SPIRVUpdateVCEBase<UpdateVCEPass> {
+class SPIRVUpdateVCEPass final
+    : public spirv::impl::SPIRVUpdateVCEPassBase<SPIRVUpdateVCEPass> {
+  using SPIRVUpdateVCEPassBase::SPIRVUpdateVCEPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
@@ -89,7 +99,7 @@ static LogicalResult checkAndUpdateCapabilityRequirements(
   return success();
 }
 
-void UpdateVCEPass::runOnOperation() {
+void SPIRVUpdateVCEPass::runOnOperation() {
   spirv::ModuleOp module = getOperation();
 
   spirv::TargetEnvAttr targetAttr = spirv::lookupTargetEnv(module);
@@ -179,5 +189,5 @@ void UpdateVCEPass::runOnOperation() {
 
 std::unique_ptr<OperationPass<spirv::ModuleOp>>
 mlir::spirv::createUpdateVersionCapabilityExtensionPass() {
-  return std::make_unique<UpdateVCEPass>();
+  return std::make_unique<SPIRVUpdateVCEPass>();
 }
index 3735528..11ea8d2 100644 (file)
@@ -6,21 +6,28 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
-#include "PassDetail.h"
+#include "mlir/Dialect/Shape/Transforms/Passes.h"
+
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/Shape/IR/Shape.h"
 #include "mlir/Dialect/Shape/Transforms/BufferizableOpInterfaceImpl.h"
-#include "mlir/Dialect/Shape/Transforms/Passes.h"
 #include "mlir/Pass/Pass.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SHAPEBUFFERIZEPASS
+#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace bufferization;
 
 namespace {
-struct ShapeBufferizePass : public ShapeBufferizeBase<ShapeBufferizePass> {
+struct ShapeBufferizePass
+    : public impl::ShapeBufferizePassBase<ShapeBufferizePass> {
   void runOnOperation() override {
     BufferizationOptions options = getPartialBufferizationOptions();
     options.opFilter.allowDialect<shape::ShapeDialect>();
diff --git a/mlir/lib/Dialect/Shape/Transforms/PassDetail.h b/mlir/lib/Dialect/Shape/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 2856871..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-//===- PassDetail.h - Shape Pass class details ------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_SHAPE_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_SHAPE_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-namespace bufferization {
-class BufferizationDialect;
-} // namespace bufferization
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_SHAPE_TRANSFORMS_PASSDETAIL_H_
index 9375be9..042543d 100644 (file)
@@ -6,12 +6,18 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
-#include "mlir/Dialect/Shape/IR/Shape.h"
 #include "mlir/Dialect/Shape/Transforms/Passes.h"
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Shape/IR/Shape.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_REMOVESHAPECONSTRAINTSPASS
+#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -40,8 +46,9 @@ public:
 };
 
 /// Removal pass.
-class RemoveShapeConstraintsPass
-    : public RemoveShapeConstraintsBase<RemoveShapeConstraintsPass> {
+struct RemoveShapeConstraintsPass
+    : public impl::RemoveShapeConstraintsPassBase<RemoveShapeConstraintsPass> {
+  using RemoveShapeConstraintsPassBase::RemoveShapeConstraintsPassBase;
 
   void runOnOperation() override {
     MLIRContext &ctx = getContext();
index 4179e60..ca3f7c5 100644 (file)
@@ -6,15 +6,21 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Dialect/Shape/Transforms/Passes.h"
+
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Shape/IR/Shape.h"
-#include "mlir/Dialect/Shape/Transforms/Passes.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SHAPETOSHAPELOWERINGPASS
+#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::shape;
 
@@ -52,13 +58,15 @@ NumElementsOpConverter::matchAndRewrite(NumElementsOp op,
 }
 
 namespace {
-struct ShapeToShapeLowering
-    : public ShapeToShapeLoweringBase<ShapeToShapeLowering> {
+struct ShapeToShapeLoweringPass
+    : public impl::ShapeToShapeLoweringPassBase<ShapeToShapeLoweringPass> {
+  using ShapeToShapeLoweringPassBase::ShapeToShapeLoweringPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
 
-void ShapeToShapeLowering::runOnOperation() {
+void ShapeToShapeLoweringPass::runOnOperation() {
   MLIRContext &ctx = getContext();
 
   RewritePatternSet patterns(&ctx);
@@ -77,5 +85,5 @@ void mlir::populateShapeRewritePatterns(RewritePatternSet &patterns) {
 }
 
 std::unique_ptr<Pass> mlir::createShapeToShapeLowering() {
-  return std::make_unique<ShapeToShapeLowering>();
+  return std::make_unique<ShapeToShapeLoweringPass>();
 }
index f9abd72..3362c7b 100644 (file)
@@ -68,10 +68,10 @@ void mlir::sparse_tensor::buildSparseCompiler(
   // it to this pipeline.
   pm.addNestedPass<func::FuncOp>(createConvertLinalgToLoopsPass());
   pm.addNestedPass<func::FuncOp>(createConvertVectorToSCFPass());
-  pm.addNestedPass<func::FuncOp>(createConvertSCFToCFPass());
-  pm.addPass(createLowerAffinePass());
+  pm.addNestedPass<func::FuncOp>(createConvertSCFToControlFlowPass());
+  pm.addPass(createConvertAffineToStandardPass());
   pm.addPass(createConvertVectorToLLVMPass(options.lowerVectorToLLVMOptions()));
-  pm.addPass(createMemRefToLLVMPass());
+  pm.addPass(createConvertMemRefToLLVMPass());
   pm.addNestedPass<func::FuncOp>(createConvertComplexToStandardPass());
   pm.addNestedPass<mlir::func::FuncOp>(
       mlir::arith::createArithmeticExpandOpsPass());
index 643cff9..6df5462 100644 (file)
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_SPARSIFICATIONPASS
+#define GEN_PASS_DEF_SPARSETENSORCONVERSIONPASS
+#define GEN_PASS_DEF_SPARSETENSORCODEGENPASS
+#include "mlir/Dialect/SparseTensor/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::sparse_tensor;
 
 namespace {
 
 //===----------------------------------------------------------------------===//
-// Passes declaration.
-//===----------------------------------------------------------------------===//
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/SparseTensor/Transforms/Passes.h.inc"
-
-//===----------------------------------------------------------------------===//
 // Passes implementation.
 //===----------------------------------------------------------------------===//
 
-struct SparsificationPass : public SparsificationBase<SparsificationPass> {
+struct SparsificationPass
+    : public mlir::impl::SparsificationPassBase<SparsificationPass> {
 
   SparsificationPass() = default;
   SparsificationPass(const SparsificationPass &pass) = default;
@@ -68,7 +69,8 @@ struct SparsificationPass : public SparsificationBase<SparsificationPass> {
 };
 
 struct SparseTensorConversionPass
-    : public SparseTensorConversionBase<SparseTensorConversionPass> {
+    : public mlir::impl::SparseTensorConversionPassBase<
+          SparseTensorConversionPass> {
 
   SparseTensorConversionPass() = default;
   SparseTensorConversionPass(const SparseTensorConversionPass &pass) = default;
@@ -145,7 +147,7 @@ struct SparseTensorConversionPass
 };
 
 struct SparseTensorCodegenPass
-    : public SparseTensorCodegenBase<SparseTensorCodegenPass> {
+    : public mlir::impl::SparseTensorCodegenPassBase<SparseTensorCodegenPass> {
 
   SparseTensorCodegenPass() = default;
   SparseTensorCodegenPass(const SparseTensorCodegenPass &pass) = default;
index caf3f0f..bab753f 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
-#include "PassDetail.h"
 #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/IR/ImplicitLocOpBuilder.h"
 #include "mlir/Transforms/DialectConversion.h"
 
+namespace mlir {
+namespace tensor {
+#define GEN_PASS_DEF_TENSORBUFFERIZEPASS
+#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
+} // namespace tensor
+} // namespace mlir
+
 using namespace mlir;
 using namespace bufferization;
 
 namespace {
-struct TensorBufferizePass : public TensorBufferizeBase<TensorBufferizePass> {
+struct TensorBufferizePass
+    : public tensor::impl::TensorBufferizePassBase<TensorBufferizePass> {
+  using TensorBufferizePassBase::TensorBufferizePassBase;
+
   void runOnOperation() override {
     BufferizationOptions options = getPartialBufferizationOptions();
     options.opFilter.allowDialect<tensor::TensorDialect>();
@@ -44,7 +54,3 @@ struct TensorBufferizePass : public TensorBufferizeBase<TensorBufferizePass> {
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::createTensorBufferizePass() {
-  return std::make_unique<TensorBufferizePass>();
-}
diff --git a/mlir/lib/Dialect/Tensor/Transforms/PassDetail.h b/mlir/lib/Dialect/Tensor/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 033372b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-//===- PassDetail.h - GPU Pass class details --------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_TENSOR_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_TENSOR_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-namespace bufferization {
-class BufferizationDialect;
-} // namespace bufferization
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-namespace scf {
-class SCFDialect;
-} // namespace scf
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_TENSOR_TRANSFORMS_PASSDETAIL_H_
index b323890..4b975a2 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
+#include "mlir/Dialect/Tosa/Transforms/Passes.h"
+
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
-#include "mlir/Dialect/Tosa/Transforms/Passes.h"
 #include "mlir/Dialect/Tosa/Utils/ShapeUtils.h"
 #include "mlir/IR/BlockAndValueMapping.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "llvm/Support/FormatVariadic.h"
 
+namespace mlir {
+namespace tosa {
+#define GEN_PASS_DEF_TOSAINFERSHAPESPASS
+#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
+} // namespace tosa
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::tosa;
 
@@ -275,8 +282,11 @@ void propagateShapesInRegion(Region &region) {
 
 /// Pass that performs shape propagation across TOSA operations. This includes
 /// migrating to within the regions of if/while operations.
-struct TosaInferShapes : public TosaInferShapesBase<TosaInferShapes> {
+struct TosaInferShapesPass
+    : public tosa::impl::TosaInferShapesPassBase<TosaInferShapesPass> {
 public:
+  using TosaInferShapesPassBase::TosaInferShapesPassBase;
+
   void runOnOperation() override {
     func::FuncOp func = getOperation();
 
@@ -320,7 +330,3 @@ public:
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::tosa::createTosaInferShapesPass() {
-  return std::make_unique<TosaInferShapes>();
-}
index aed8ff5..593c21b 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
 #include "mlir/Dialect/Tosa/Transforms/Passes.h"
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Tosa/IR/TosaOps.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+namespace tosa {
+#define GEN_PASS_DEF_TOSALAYERWISECONSTANTFOLDPASS
+#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
+} // namespace tosa
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::tosa;
 
@@ -35,7 +43,10 @@ void populateTosaOpsCanonicalizationPatterns(MLIRContext *ctx,
 }
 
 struct TosaLayerwiseConstantFoldPass
-    : public TosaLayerwiseConstantFoldPassBase<TosaLayerwiseConstantFoldPass> {
+    : public tosa::impl::TosaLayerwiseConstantFoldPassBase<
+          TosaLayerwiseConstantFoldPass> {
+  using TosaLayerwiseConstantFoldPassBase::TosaLayerwiseConstantFoldPassBase;
+
   void runOnOperation() override {
     auto *ctx = &getContext();
     RewritePatternSet patterns(ctx);
@@ -50,7 +61,3 @@ struct TosaLayerwiseConstantFoldPass
 };
 
 } // namespace
-
-std::unique_ptr<Pass> mlir::tosa::createTosaLayerwiseConstantFoldPass() {
-  return std::make_unique<TosaLayerwiseConstantFoldPass>();
-}
index 61f6014..54e587b 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
-#include "mlir/Dialect/Tosa/IR//TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
+#include "mlir/Dialect/Tosa/IR/TosaOps.h"
 #include "mlir/Dialect/Tosa/Transforms/Passes.h"
 #include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+namespace tosa {
+#define GEN_PASS_DEF_TOSAMAKEBROADCASTABLEPASS
+#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
+} // namespace tosa
+} // namespace mlir
+
 using namespace mlir;
 using namespace mlir::tosa;
 
@@ -231,9 +238,12 @@ struct ConvertTosaOp<tosa::ArithmeticRightShiftOp>
 namespace {
 /// Pass that enables broadcast by making all input arrays have the same
 /// number of dimensions. Insert RESHAPE operations to lower rank operand
-struct TosaMakeBroadcastable
-    : public TosaMakeBroadcastableBase<TosaMakeBroadcastable> {
+struct TosaMakeBroadcastablePass
+    : public tosa::impl::TosaMakeBroadcastablePassBase<
+          TosaMakeBroadcastablePass> {
 public:
+  using TosaMakeBroadcastablePassBase::TosaMakeBroadcastablePassBase;
+
   void runOnOperation() override {
     auto func = getOperation();
     RewritePatternSet patterns(func.getContext());
@@ -262,7 +272,3 @@ public:
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::tosa::createTosaMakeBroadcastablePass() {
-  return std::make_unique<TosaMakeBroadcastable>();
-}
index 78b8cb3..b6c5b4f 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
 #include "mlir/Dialect/Tosa/Transforms/Passes.h"
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Tosa/IR/TosaOps.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
+namespace mlir {
+namespace tosa {
+#define GEN_PASS_DEF_TOSAOPTIONALDECOMPOSITIONSPASS
+#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
+} // namespace tosa
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 
-struct TosaOptionalDecompositions
-    : public TosaOptionalDecompositionsBase<TosaOptionalDecompositions> {
+struct TosaOptionalDecompositionsPass
+    : public tosa::impl::TosaOptionalDecompositionsPassBase<
+          TosaOptionalDecompositionsPass> {
+  using TosaOptionalDecompositionsPassBase::TosaOptionalDecompositionsPassBase;
+
   void runOnOperation() override {
     auto *ctx = &getContext();
     RewritePatternSet patterns(ctx);
@@ -39,7 +50,3 @@ struct TosaOptionalDecompositions
 };
 
 } // namespace
-
-std::unique_ptr<Pass> mlir::tosa::createTosaOptionalDecompositions() {
-  return std::make_unique<TosaOptionalDecompositions>();
-}
index f70e2b6..b49b963 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/Transform/IR/TransformInterfaces.h"
 #include "mlir/Dialect/Transform/Transforms/Passes.h"
+
+#include "mlir/Dialect/Transform/IR/TransformInterfaces.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 #include "mlir/Pass/Pass.h"
 #include "llvm/ADT/SetOperations.h"
 
+namespace mlir {
+namespace transform {
+#define GEN_PASS_DEF_CHECKUSESPASS
+#include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
+} // namespace transform
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -361,13 +369,12 @@ private:
   DenseMap<Block *, llvm::SmallPtrSet<Block *, 4>> reachableFromCache;
 };
 
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
-
 //// A simple pass that warns about any use of a value by a transform operation
 // that may be using the value after it has been freed.
-class CheckUsesPass : public CheckUsesBase<CheckUsesPass> {
+class CheckUsesPass : public transform::impl::CheckUsesPassBase<CheckUsesPass> {
 public:
+  using CheckUsesPassBase::CheckUsesPassBase;
+
   void runOnOperation() override {
     auto &analysis = getAnalysis<TransformOpMemFreeAnalysis>();
 
@@ -391,11 +398,3 @@ public:
 };
 
 } // namespace
-
-namespace mlir {
-namespace transform {
-std::unique_ptr<Pass> createCheckUsesPass() {
-  return std::make_unique<CheckUsesPass>();
-}
-} // namespace transform
-} // namespace mlir
index f98eeda..3de6e75 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
-#include "PassDetail.h"
+
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Vector/IR/VectorOps.h"
 #include "mlir/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.h"
 #include "mlir/Dialect/Vector/Transforms/Passes.h"
 
+namespace mlir {
+namespace vector {
+#define GEN_PASS_DEF_VECTORBUFFERIZEPASS
+#include "mlir/Dialect/Vector/Transforms/Passes.h.inc"
+} // namespace vector
+} // namespace mlir
+
 using namespace mlir;
 using namespace bufferization;
 
 namespace {
-struct VectorBufferizePass : public VectorBufferizeBase<VectorBufferizePass> {
+struct VectorBufferizePass
+    : public vector::impl::VectorBufferizePassBase<VectorBufferizePass> {
+  using VectorBufferizePassBase::VectorBufferizePassBase;
+
   void runOnOperation() override {
     BufferizationOptions options = getPartialBufferizationOptions();
     options.opFilter.allowDialect<vector::VectorDialect>();
@@ -40,7 +51,3 @@ struct VectorBufferizePass : public VectorBufferizeBase<VectorBufferizePass> {
   }
 };
 } // namespace
-
-std::unique_ptr<Pass> mlir::vector::createVectorBufferizePass() {
-  return std::make_unique<VectorBufferizePass>();
-}
diff --git a/mlir/lib/Dialect/Vector/Transforms/PassDetail.h b/mlir/lib/Dialect/Vector/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 305aae4..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-//===- PassDetail.h - Vector Pass class details -----------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DIALECT_VECTOR_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_VECTOR_TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-
-namespace bufferization {
-class BufferizationDialect;
-} // namespace bufferization
-
-namespace memref {
-class MemRefDialect;
-} // namespace memref
-
-#define GEN_PASS_CLASSES
-#include "mlir/Dialect/Vector/Transforms/Passes.h.inc"
-
-} // namespace mlir
-
-#endif // DIALECT_VECTOR_TRANSFORMS_PASSDETAIL_H_
index a7f09b4..21fb19d 100644 (file)
 
 #include "mlir/Pass/PassManager.h"
 #include "mlir/Pass/PassRegistry.h"
-#include "mlir/Reducer/PassDetail.h"
 #include "mlir/Reducer/Passes.h"
 #include "mlir/Reducer/Tester.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_OPTREDUCTIONPASS
+#include "mlir/Reducer/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "mlir-reduce"
 
 using namespace mlir;
 
 namespace {
 
-class OptReductionPass : public OptReductionBase<OptReductionPass> {
+class OptReductionPass
+    : public mlir::impl::OptReductionPassBase<OptReductionPass> {
 public:
   /// Runs the pass instance in the pass pipeline.
   void runOnOperation() override;
index 05f0f74..f542317 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "mlir/IR/DialectInterface.h"
 #include "mlir/IR/OpDefinition.h"
-#include "mlir/Reducer/PassDetail.h"
 #include "mlir/Reducer/Passes.h"
 #include "mlir/Reducer/ReductionNode.h"
 #include "mlir/Reducer/ReductionPatternInterface.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/ManagedStatic.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_REDUCTIONTREEPASS
+#include "mlir/Reducer/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 /// We implicitly number each operation in the region and if an operation's
@@ -183,7 +187,8 @@ public:
 /// This class defines the Reduction Tree Pass. It provides a framework to
 /// to implement a reduction pass using a tree structure to keep track of the
 /// generated reduced variants.
-class ReductionTreePass : public ReductionTreeBase<ReductionTreePass> {
+class ReductionTreePass
+    : public mlir::impl::ReductionTreePassBase<ReductionTreePass> {
 public:
   ReductionTreePass() = default;
   ReductionTreePass(const ReductionTreePass &pass) = default;
index 783a226..6f6c308 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Transforms/Passes.h"
+
 #include "mlir/IR/Dominance.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 #include "mlir/Pass/Pass.h"
-#include "mlir/Transforms/Passes.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/ScopedHashTable.h"
 #include "llvm/Support/RecyclingAllocator.h"
 #include <deque>
 
+namespace mlir {
+#define GEN_PASS_DEF_CSEPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
@@ -53,7 +58,9 @@ struct SimpleOperationInfo : public llvm::DenseMapInfo<Operation *> {
 
 namespace {
 /// Simple common sub-expression elimination.
-struct CSE : public CSEBase<CSE> {
+struct CSEPass : public impl::CSEPassBase<CSEPass> {
+  using CSEPassBase::CSEPassBase;
+
   /// Shared implementation of operation elimination and scoped map definitions.
   using AllocatorTy = llvm::RecyclingAllocator<
       llvm::BumpPtrAllocator,
@@ -108,8 +115,8 @@ private:
 };
 } // namespace
 
-void CSE::replaceUsesAndDelete(ScopedMapTy &knownValues, Operation *op,
-                               Operation *existing, bool hasSSADominance) {
+void CSEPass::replaceUsesAndDelete(ScopedMapTy &knownValues, Operation *op,
+                                   Operation *existing, bool hasSSADominance) {
   // If we find one then replace all uses of the current operation with the
   // existing one and mark it for deletion. We can only replace an operand in
   // an operation if it has not been visited yet.
@@ -142,7 +149,8 @@ void CSE::replaceUsesAndDelete(ScopedMapTy &knownValues, Operation *op,
   ++numCSE;
 }
 
-bool CSE::hasOtherSideEffectingOpInBetween(Operation *fromOp, Operation *toOp) {
+bool CSEPass::hasOtherSideEffectingOpInBetween(Operation *fromOp,
+                                               Operation *toOp) {
   assert(fromOp->getBlock() == toOp->getBlock());
   assert(
       isa<MemoryEffectOpInterface>(fromOp) &&
@@ -183,8 +191,8 @@ bool CSE::hasOtherSideEffectingOpInBetween(Operation *fromOp, Operation *toOp) {
 }
 
 /// Attempt to eliminate a redundant operation.
-LogicalResult CSE::simplifyOperation(ScopedMapTy &knownValues, Operation *op,
-                                     bool hasSSADominance) {
+LogicalResult CSEPass::simplifyOperation(ScopedMapTy &knownValues,
+                                         Operation *op, bool hasSSADominance) {
   // Don't simplify terminator operations.
   if (op->hasTrait<OpTrait::IsTerminator>())
     return failure();
@@ -239,8 +247,8 @@ LogicalResult CSE::simplifyOperation(ScopedMapTy &knownValues, Operation *op,
   return failure();
 }
 
-void CSE::simplifyBlock(ScopedMapTy &knownValues, Block *bb,
-                        bool hasSSADominance) {
+void CSEPass::simplifyBlock(ScopedMapTy &knownValues, Block *bb,
+                            bool hasSSADominance) {
   for (auto &op : *bb) {
     // If the operation is simplified, we don't process any held regions.
     if (succeeded(simplifyOperation(knownValues, &op, hasSSADominance)))
@@ -268,7 +276,7 @@ void CSE::simplifyBlock(ScopedMapTy &knownValues, Block *bb,
   memEffectsCache.clear();
 }
 
-void CSE::simplifyRegion(ScopedMapTy &knownValues, Region &region) {
+void CSEPass::simplifyRegion(ScopedMapTy &knownValues, Region &region) {
   // If the region is empty there is nothing to do.
   if (region.empty())
     return;
@@ -323,7 +331,7 @@ void CSE::simplifyRegion(ScopedMapTy &knownValues, Region &region) {
   }
 }
 
-void CSE::runOnOperation() {
+void CSEPass::runOnOperation() {
   /// A scoped hash table of defining operations within a region.
   ScopedMapTy knownValues;
 
@@ -347,5 +355,3 @@ void CSE::runOnOperation() {
   markAnalysesPreserved<DominanceInfo, PostDominanceInfo>();
   domInfo = nullptr;
 }
-
-std::unique_ptr<Pass> mlir::createCSEPass() { return std::make_unique<CSE>(); }
index 3f6dbe9..40000a2 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Transforms/Passes.h"
+
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-#include "mlir/Transforms/Passes.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CANONICALIZERPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
 namespace {
 /// Canonicalize operations in nested regions.
-struct Canonicalizer : public CanonicalizerBase<Canonicalizer> {
-  Canonicalizer() = default;
-  Canonicalizer(const GreedyRewriteConfig &config,
-                ArrayRef<std::string> disabledPatterns,
-                ArrayRef<std::string> enabledPatterns) {
+struct CanonicalizerPass
+    : public impl::CanonicalizerPassBase<CanonicalizerPass> {
+  CanonicalizerPass() = default;
+  CanonicalizerPass(const GreedyRewriteConfig &config,
+                    ArrayRef<std::string> disabledPatterns,
+                    ArrayRef<std::string> enabledPatterns) {
     this->topDownProcessingEnabled = config.useTopDownTraversal;
     this->enableRegionSimplification = config.enableRegionSimplification;
     this->maxIterations = config.maxIterations;
@@ -59,7 +65,7 @@ struct Canonicalizer : public CanonicalizerBase<Canonicalizer> {
 
 /// Create a Canonicalizer pass.
 std::unique_ptr<Pass> mlir::createCanonicalizerPass() {
-  return std::make_unique<Canonicalizer>();
+  return std::make_unique<CanonicalizerPass>();
 }
 
 /// Creates an instance of the Canonicalizer pass with the specified config.
@@ -67,6 +73,6 @@ std::unique_ptr<Pass>
 mlir::createCanonicalizerPass(const GreedyRewriteConfig &config,
                               ArrayRef<std::string> disabledPatterns,
                               ArrayRef<std::string> enabledPatterns) {
-  return std::make_unique<Canonicalizer>(config, disabledPatterns,
-                                         enabledPatterns);
+  return std::make_unique<CanonicalizerPass>(config, disabledPatterns,
+                                             enabledPatterns);
 }
index 5b0cfc2..960a035 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Transforms/Passes.h"
+
 #include "mlir/IR/Dominance.h"
 #include "mlir/Interfaces/ControlFlowInterfaces.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 #include "mlir/Transforms/ControlFlowSinkUtils.h"
-#include "mlir/Transforms/Passes.h"
 #include "mlir/Transforms/SideEffectUtils.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_CONTROLFLOWSINKPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 /// A control-flow sink pass.
-struct ControlFlowSink : public ControlFlowSinkBase<ControlFlowSink> {
+struct ControlFlowSinkPass
+    : public impl::ControlFlowSinkPassBase<ControlFlowSinkPass> {
+  using ControlFlowSinkPassBase::ControlFlowSinkPassBase;
+
   void runOnOperation() override;
 };
 } // end anonymous namespace
 
-void ControlFlowSink::runOnOperation() {
+void ControlFlowSinkPass::runOnOperation() {
   auto &domInfo = getAnalysis<DominanceInfo>();
   getOperation()->walk([&](RegionBranchOpInterface branch) {
     SmallVector<Region *> regionsToSink;
@@ -48,7 +56,3 @@ void ControlFlowSink::runOnOperation() {
         });
   });
 }
-
-std::unique_ptr<Pass> mlir::createControlFlowSinkPass() {
-  return std::make_unique<ControlFlowSink>();
-}
index 5ce32b1..c4633c0 100644 (file)
@@ -13,7 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Transforms/Passes.h"
+
 #include "mlir/Analysis/CallGraph.h"
 #include "mlir/IR/Threading.h"
 #include "mlir/Interfaces/CallInterfaces.h"
 #include "mlir/Pass/PassManager.h"
 #include "mlir/Support/DebugStringHelper.h"
 #include "mlir/Transforms/InliningUtils.h"
-#include "mlir/Transforms/Passes.h"
 #include "llvm/ADT/SCCIterator.h"
 #include "llvm/Support/Debug.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_INLINERPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 #define DEBUG_TYPE "inlining"
 
 using namespace mlir;
@@ -582,7 +587,7 @@ static LogicalResult inlineCallsInSCC(Inliner &inliner, CGUseList &useList,
 //===----------------------------------------------------------------------===//
 
 namespace {
-class InlinerPass : public InlinerBase<InlinerPass> {
+class InlinerPass : public impl::InlinerPassBase<InlinerPass> {
 public:
   InlinerPass();
   InlinerPass(const InlinerPass &) = default;
index a042d07..c0d23cc 100644 (file)
@@ -7,13 +7,19 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Transforms/LocationSnapshot.h"
-#include "PassDetail.h"
+
 #include "mlir/IR/AsmState.h"
 #include "mlir/IR/Builders.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Support/FileUtilities.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/ToolOutputFile.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LOCATIONSNAPSHOTPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 /// This function generates new locations from the given IR by snapshotting the
@@ -123,7 +129,7 @@ LogicalResult mlir::generateLocationsFromIR(StringRef fileName, StringRef tag,
 
 namespace {
 struct LocationSnapshotPass
-    : public LocationSnapshotBase<LocationSnapshotPass> {
+    : public impl::LocationSnapshotPassBase<LocationSnapshotPass> {
   LocationSnapshotPass() = default;
   LocationSnapshotPass(OpPrintingFlags flags, StringRef fileName, StringRef tag)
       : flags(flags) {
index 35e0f48..a0f738b 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Transforms/Passes.h"
+
 #include "mlir/Interfaces/LoopLikeInterface.h"
 #include "mlir/Transforms/LoopInvariantCodeMotionUtils.h"
-#include "mlir/Transforms/Passes.h"
 #include "mlir/Transforms/SideEffectUtils.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_LOOPINVARIANTCODEMOTIONPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
 /// Loop invariant code motion (LICM) pass.
-struct LoopInvariantCodeMotion
-    : public LoopInvariantCodeMotionBase<LoopInvariantCodeMotion> {
+struct LoopInvariantCodeMotionPass
+    : public impl::LoopInvariantCodeMotionPassBase<
+          LoopInvariantCodeMotionPass> {
+  using LoopInvariantCodeMotionPassBase::LoopInvariantCodeMotionPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
 
-void LoopInvariantCodeMotion::runOnOperation() {
+void LoopInvariantCodeMotionPass::runOnOperation() {
   // Walk through all loops in a function in innermost-loop-first order. This
   // way, we first LICM from the inner loop, and place the ops in
   // the outer loop, which in turn can be further LICM'ed.
   getOperation()->walk(
       [&](LoopLikeOpInterface loopLike) { moveLoopInvariantCode(loopLike); });
 }
-
-std::unique_ptr<Pass> mlir::createLoopInvariantCodeMotionPass() {
-  return std::make_unique<LoopInvariantCodeMotion>();
-}
index d02cb8a..ac5fec1 100644 (file)
@@ -6,19 +6,24 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Transforms/Passes.h"
+
 #include "mlir/IR/BuiltinOps.h"
 #include "mlir/IR/Operation.h"
 #include "mlir/IR/OperationSupport.h"
-#include "mlir/Transforms/Passes.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_PRINTOPSTATSPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
-struct PrintOpStatsPass : public PrintOpStatsBase<PrintOpStatsPass> {
+struct PrintOpStatsPass : public impl::PrintOpStatsPassBase<PrintOpStatsPass> {
   explicit PrintOpStatsPass(raw_ostream &os) : os(os) {}
 
   explicit PrintOpStatsPass(raw_ostream &os, bool printAsJSON) : os(os) {
diff --git a/mlir/lib/Transforms/PassDetail.h b/mlir/lib/Transforms/PassDetail.h
deleted file mode 100644 (file)
index 7c1f539..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-//===- PassDetail.h - Transforms Pass class details -------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef TRANSFORMS_PASSDETAIL_H_
-#define TRANSFORMS_PASSDETAIL_H_
-
-#include "mlir/Pass/Pass.h"
-#include "mlir/Pass/PassManager.h"
-#include "mlir/Transforms/Passes.h"
-
-namespace mlir {
-#define GEN_PASS_CLASSES
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
-#endif // TRANSFORMS_PASSDETAIL_H_
index a0a0635..37de046 100644 (file)
@@ -14,7 +14,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Transforms/Passes.h"
+
 #include "mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h"
 #include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 #include "mlir/Pass/Pass.h"
 #include "mlir/Transforms/FoldUtils.h"
-#include "mlir/Transforms/Passes.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_SCCPPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 using namespace mlir::dataflow;
@@ -109,12 +114,14 @@ static void rewrite(DataFlowSolver &solver, MLIRContext *context,
 //===----------------------------------------------------------------------===//
 
 namespace {
-struct SCCP : public SCCPBase<SCCP> {
+struct SCCPPass : public impl::SCCPPassBase<SCCPPass> {
+  using SCCPPassBase::SCCPPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
 
-void SCCP::runOnOperation() {
+void SCCPPass::runOnOperation() {
   Operation *op = getOperation();
 
   DataFlowSolver solver;
@@ -124,7 +131,3 @@ void SCCP::runOnOperation() {
     return signalPassFailure();
   rewrite(solver, op->getContext(), op->getRegions());
 }
-
-std::unique_ptr<Pass> mlir::createSCCPPass() {
-  return std::make_unique<SCCP>();
-}
index 99e1151..63cfaf9 100644 (file)
@@ -6,21 +6,29 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Transforms/Passes.h"
+
 #include "mlir/IR/BuiltinOps.h"
 #include "mlir/IR/Operation.h"
 #include "mlir/Pass/Pass.h"
-#include "mlir/Transforms/Passes.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_STRIPDEBUGINFOPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
 
 using namespace mlir;
 
 namespace {
-struct StripDebugInfo : public StripDebugInfoBase<StripDebugInfo> {
+struct StripDebugInfoPass
+    : public impl::StripDebugInfoPassBase<StripDebugInfoPass> {
+  using StripDebugInfoPassBase::StripDebugInfoPassBase;
+
   void runOnOperation() override;
 };
 } // namespace
 
-void StripDebugInfo::runOnOperation() {
+void StripDebugInfoPass::runOnOperation() {
   auto unknownLoc = UnknownLoc::get(&getContext());
 
   // Strip the debug info from all operations.
@@ -36,8 +44,3 @@ void StripDebugInfo::runOnOperation() {
     }
   });
 }
-
-/// Creates a pass to strip debug information from a function.
-std::unique_ptr<Pass> mlir::createStripDebugInfoPass() {
-  return std::make_unique<StripDebugInfo>();
-}
index c197f50..a96aa12 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
-#include "mlir/IR/SymbolTable.h"
 #include "mlir/Transforms/Passes.h"
 
+#include "mlir/IR/SymbolTable.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_SYMBOLDCEPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
-struct SymbolDCE : public SymbolDCEBase<SymbolDCE> {
+struct SymbolDCEPass : public impl::SymbolDCEPassBase<SymbolDCEPass> {
+  using SymbolDCEPassBase::SymbolDCEPassBase;
+
   void runOnOperation() override;
 
   /// Compute the liveness of the symbols within the given symbol table.
@@ -31,7 +38,7 @@ struct SymbolDCE : public SymbolDCEBase<SymbolDCE> {
 };
 } // namespace
 
-void SymbolDCE::runOnOperation() {
+void SymbolDCEPass::runOnOperation() {
   Operation *symbolTableOp = getOperation();
 
   // SymbolDCE should only be run on operations that define a symbol table.
@@ -75,10 +82,9 @@ void SymbolDCE::runOnOperation() {
 /// Compute the liveness of the symbols within the given symbol table.
 /// `symbolTableIsHidden` is true if this symbol table is known to be
 /// unaccessible from operations in its parent regions.
-LogicalResult SymbolDCE::computeLiveness(Operation *symbolTableOp,
-                                         SymbolTableCollection &symbolTable,
-                                         bool symbolTableIsHidden,
-                                         DenseSet<Operation *> &liveSymbols) {
+LogicalResult SymbolDCEPass::computeLiveness(
+    Operation *symbolTableOp, SymbolTableCollection &symbolTable,
+    bool symbolTableIsHidden, DenseSet<Operation *> &liveSymbols) {
   // A worklist of live operations to propagate uses from.
   SmallVector<Operation *, 16> worklist;
 
@@ -140,7 +146,3 @@ LogicalResult SymbolDCE::computeLiveness(Operation *symbolTableOp,
 
   return success();
 }
-
-std::unique_ptr<Pass> mlir::createSymbolDCEPass() {
-  return std::make_unique<SymbolDCE>();
-}
index 4aa7897..28342a3 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
-#include "mlir/IR/SymbolTable.h"
 #include "mlir/Transforms/Passes.h"
 
+#include "mlir/IR/SymbolTable.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_SYMBOLPRIVATIZEPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
-struct SymbolPrivatize : public SymbolPrivatizeBase<SymbolPrivatize> {
-  explicit SymbolPrivatize(ArrayRef<std::string> excludeSymbols);
+struct SymbolPrivatizePass
+    : public impl::SymbolPrivatizePassBase<SymbolPrivatizePass> {
+  explicit SymbolPrivatizePass(ArrayRef<std::string> excludeSymbols);
   LogicalResult initialize(MLIRContext *context) override;
   void runOnOperation() override;
 
@@ -28,17 +34,18 @@ struct SymbolPrivatize : public SymbolPrivatizeBase<SymbolPrivatize> {
 };
 } // namespace
 
-SymbolPrivatize::SymbolPrivatize(llvm::ArrayRef<std::string> excludeSymbols) {
+SymbolPrivatizePass::SymbolPrivatizePass(
+    llvm::ArrayRef<std::string> excludeSymbols) {
   exclude = excludeSymbols;
 }
 
-LogicalResult SymbolPrivatize::initialize(MLIRContext *context) {
+LogicalResult SymbolPrivatizePass::initialize(MLIRContext *context) {
   for (const std::string &symbol : exclude)
     excludedSymbols.insert(StringAttr::get(context, symbol));
   return success();
 }
 
-void SymbolPrivatize::runOnOperation() {
+void SymbolPrivatizePass::runOnOperation() {
   for (Region &region : getOperation()->getRegions()) {
     for (Block &block : region) {
       for (Operation &op : block) {
@@ -54,5 +61,5 @@ void SymbolPrivatize::runOnOperation() {
 
 std::unique_ptr<Pass>
 mlir::createSymbolPrivatizePass(ArrayRef<std::string> exclude) {
-  return std::make_unique<SymbolPrivatize>(exclude);
+  return std::make_unique<SymbolPrivatizePass>(exclude);
 }
index afa0b78..69e81b8 100644 (file)
@@ -6,14 +6,23 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PassDetail.h"
+#include "mlir/Transforms/Passes.h"
+
 #include "mlir/IR/RegionKindInterface.h"
 #include "mlir/Transforms/TopologicalSortUtils.h"
 
+namespace mlir {
+#define GEN_PASS_DEF_TOPOLOGICALSORTPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 namespace {
-struct TopologicalSortPass : public TopologicalSortBase<TopologicalSortPass> {
+struct TopologicalSortPass
+    : public impl::TopologicalSortPassBase<TopologicalSortPass> {
+  using TopologicalSortPassBase::TopologicalSortPassBase;
+
   void runOnOperation() override {
     // Topologically sort the regions of the operation without SSA dominance.
     getOperation()->walk([](RegionKindInterface op) {
@@ -27,7 +36,3 @@ struct TopologicalSortPass : public TopologicalSortBase<TopologicalSortPass> {
   }
 };
 } // end anonymous namespace
-
-std::unique_ptr<Pass> mlir::createTopologicalSortPass() {
-  return std::make_unique<TopologicalSortPass>();
-}
index 1cd0164..7a0ed4b 100644 (file)
@@ -7,15 +7,22 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Transforms/ViewOpGraph.h"
-#include "PassDetail.h"
+
 #include "mlir/IR/Block.h"
 #include "mlir/IR/BuiltinTypes.h"
 #include "mlir/IR/Operation.h"
+#include "mlir/Pass/Pass.h"
 #include "mlir/Support/IndentedOstream.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/GraphWriter.h"
 #include <utility>
 
+namespace mlir {
+#define GEN_PASS_DEF_VIEWOPGRAPHPASS
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
 using namespace mlir;
 
 static const StringRef kLineStyleControlFlow = "dashed";
@@ -72,10 +79,11 @@ public:
 /// This pass generates a Graphviz dataflow visualization of an MLIR operation.
 /// Note: See https://www.graphviz.org/doc/info/lang.html for more information
 /// about the Graphviz DOT language.
-class PrintOpPass : public ViewOpGraphBase<PrintOpPass> {
+class ViewOpGraphPass : public impl::ViewOpGraphPassBase<ViewOpGraphPass> {
 public:
-  PrintOpPass(raw_ostream &os) : os(os) {}
-  PrintOpPass(const PrintOpPass &o) : PrintOpPass(o.os.getOStream()) {}
+  ViewOpGraphPass(raw_ostream &os) : os(os) {}
+  ViewOpGraphPass(const ViewOpGraphPass &o)
+      : ViewOpGraphPass(o.os.getOStream()) {}
 
   void runOnOperation() override {
     emitGraph([&]() {
@@ -314,8 +322,8 @@ private:
 
 } // namespace
 
-std::unique_ptr<Pass> mlir::createPrintOpGraphPass(raw_ostream &os) {
-  return std::make_unique<PrintOpPass>(os);
+std::unique_ptr<Pass> mlir::createViewOpGraphPass(raw_ostream &os) {
+  return std::make_unique<ViewOpGraphPass>(os);
 }
 
 /// Generate a CFG for a region and show it in a window.
@@ -328,7 +336,7 @@ static void llvmViewGraph(Region &region, const Twine &name) {
       llvm::errs() << "error opening file '" << filename << "' for writing\n";
       return;
     }
-    PrintOpPass pass(os);
+    ViewOpGraphPass pass(os);
     pass.emitRegionCFG(region);
   }
   llvm::DisplayGraph(filename, /*wait=*/false, llvm::GraphProgram::DOT);
index 60171db..a9eb97c 100644 (file)
@@ -34,9 +34,9 @@ void lowerModuleToLLVM(MlirContext ctx, MlirModule module) {
   MlirPassManager pm = mlirPassManagerCreate(ctx);
   MlirOpPassManager opm = mlirPassManagerGetNestedUnder(
       pm, mlirStringRefCreateFromCString("func.func"));
-  mlirPassManagerAddOwnedPass(pm, mlirCreateConversionConvertFuncToLLVM());
-  mlirOpPassManagerAddOwnedPass(opm,
-                                mlirCreateConversionConvertArithmeticToLLVM());
+  mlirPassManagerAddOwnedPass(pm, mlirCreateConversionConvertFuncToLLVMPass());
+  mlirOpPassManagerAddOwnedPass(
+      opm, mlirCreateConversionConvertArithmeticToLLVMPass());
   MlirLogicalResult status = mlirPassManagerRun(pm, module);
   if (mlirLogicalResultIsFailure(status)) {
     fprintf(stderr, "Unexpected failure running pass pipeline\n");
index e48045a..cdbf982 100644 (file)
@@ -54,7 +54,7 @@ void testRunPassOnModule() {
   // CHECK: func.return        , 1
   {
     MlirPassManager pm = mlirPassManagerCreate(ctx);
-    MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats();
+    MlirPass printOpStatPass = mlirCreateTransformsPrintOpStatsPass();
     mlirPassManagerAddOwnedPass(pm, printOpStatPass);
     MlirLogicalResult success = mlirPassManagerRun(pm, module);
     if (mlirLogicalResultIsFailure(success)) {
@@ -98,7 +98,7 @@ void testRunPassOnNestedModule() {
     MlirPassManager pm = mlirPassManagerCreate(ctx);
     MlirOpPassManager nestedFuncPm = mlirPassManagerGetNestedUnder(
         pm, mlirStringRefCreateFromCString("func.func"));
-    MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats();
+    MlirPass printOpStatPass = mlirCreateTransformsPrintOpStatsPass();
     mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass);
     MlirLogicalResult success = mlirPassManagerRun(pm, module);
     if (mlirLogicalResultIsFailure(success))
@@ -116,7 +116,7 @@ void testRunPassOnNestedModule() {
         pm, mlirStringRefCreateFromCString("builtin.module"));
     MlirOpPassManager nestedFuncPm = mlirOpPassManagerGetNestedUnder(
         nestedModulePm, mlirStringRefCreateFromCString("func.func"));
-    MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats();
+    MlirPass printOpStatPass = mlirCreateTransformsPrintOpStatsPass();
     mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass);
     MlirLogicalResult success = mlirPassManagerRun(pm, module);
     if (mlirLogicalResultIsFailure(success))
@@ -141,7 +141,7 @@ void testPrintPassPipeline() {
       pm, mlirStringRefCreateFromCString("builtin.module"));
   MlirOpPassManager nestedFuncPm = mlirOpPassManagerGetNestedUnder(
       nestedModulePm, mlirStringRefCreateFromCString("func.func"));
-  MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats();
+  MlirPass printOpStatPass = mlirCreateTransformsPrintOpStatsPass();
   mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass);
 
   // Print the top level pass manager
@@ -184,7 +184,7 @@ void testParsePassPipeline() {
     exit(EXIT_FAILURE);
   }
   // Try again after registrating the pass.
-  mlirRegisterTransformsPrintOpStats();
+  mlirRegisterTransformsPrintOpStatsPass();
   status = mlirParsePassPipeline(
       mlirPassManagerGetAsOpPassManager(pm),
       mlirStringRefCreateFromCString(
index bd506c2..874fe56 100644 (file)
@@ -15,53 +15,53 @@ func.func @bar() {
   return
 }
 
-// BEFORE: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
+// BEFORE: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
 // BEFORE-NEXT: func @foo()
-// BEFORE: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
+// BEFORE: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
 // BEFORE-NEXT: func @bar()
-// BEFORE-NOT: // -----// IR Dump Before{{.*}}Canonicalizer (canonicalize) //----- //
+// BEFORE-NOT: // -----// IR Dump Before{{.*}}CanonicalizerPass (canonicalize) //----- //
 // BEFORE-NOT: // -----// IR Dump After
 
-// BEFORE_ALL: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
+// BEFORE_ALL: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
 // BEFORE_ALL-NEXT: func @foo()
-// BEFORE_ALL: // -----// IR Dump Before{{.*}}Canonicalizer (canonicalize) //----- //
+// BEFORE_ALL: // -----// IR Dump Before{{.*}}CanonicalizerPass (canonicalize) //----- //
 // BEFORE_ALL-NEXT: func @foo()
-// BEFORE_ALL: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
+// BEFORE_ALL: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
 // BEFORE_ALL-NEXT: func @bar()
-// BEFORE_ALL: // -----// IR Dump Before{{.*}}Canonicalizer (canonicalize) //----- //
+// BEFORE_ALL: // -----// IR Dump Before{{.*}}CanonicalizerPass (canonicalize) //----- //
 // BEFORE_ALL-NEXT: func @bar()
 // BEFORE_ALL-NOT: // -----// IR Dump After
 
 // AFTER-NOT: // -----// IR Dump Before
-// AFTER: // -----// IR Dump After{{.*}}CSE (cse) //----- //
+// AFTER: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
 // AFTER-NEXT: func @foo()
-// AFTER: // -----// IR Dump After{{.*}}CSE (cse) //----- //
+// AFTER: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
 // AFTER-NEXT: func @bar()
-// AFTER-NOT: // -----// IR Dump After{{.*}}Canonicalizer (canonicalize) //----- //
+// AFTER-NOT: // -----// IR Dump After{{.*}}CanonicalizerPass (canonicalize) //----- //
 
 // AFTER_ALL-NOT: // -----// IR Dump Before
-// AFTER_ALL: // -----// IR Dump After{{.*}}CSE (cse) //----- //
+// AFTER_ALL: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
 // AFTER_ALL-NEXT: func @foo()
-// AFTER_ALL: // -----// IR Dump After{{.*}}Canonicalizer (canonicalize) //----- //
+// AFTER_ALL: // -----// IR Dump After{{.*}}CanonicalizerPass (canonicalize) //----- //
 // AFTER_ALL-NEXT: func @foo()
-// AFTER_ALL: // -----// IR Dump After{{.*}}CSE (cse) //----- //
+// AFTER_ALL: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
 // AFTER_ALL-NEXT: func @bar()
-// AFTER_ALL: // -----// IR Dump After{{.*}}Canonicalizer (canonicalize) //----- //
+// AFTER_ALL: // -----// IR Dump After{{.*}}CanonicalizerPass (canonicalize) //----- //
 // AFTER_ALL-NEXT: func @bar()
 
-// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSE (cse) ('func.func' operation: @foo) //----- //
+// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSEPass (cse) ('func.func' operation: @foo) //----- //
 // BEFORE_MODULE: func @foo()
 // BEFORE_MODULE: func @bar()
-// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSE (cse) ('func.func' operation: @bar) //----- //
+// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSEPass (cse) ('func.func' operation: @bar) //----- //
 // BEFORE_MODULE: func @foo()
 // BEFORE_MODULE: func @bar()
 
-// AFTER_ALL_CHANGE: // -----// IR Dump After{{.*}}CSE (cse) //----- //
+// AFTER_ALL_CHANGE: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
 // AFTER_ALL_CHANGE-NEXT: func @foo()
-// AFTER_ALL_CHANGE-NOT: // -----// IR Dump After{{.*}}CSE (cse) //----- //
+// AFTER_ALL_CHANGE-NOT: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
 // We expect that only 'foo' changed during CSE, and the second run of CSE did
 // nothing.
 
-// AFTER_FAILURE-NOT: // -----// IR Dump After{{.*}}CSE
+// AFTER_FAILURE-NOT: // -----// IR Dump After{{.*}}CSEPass
 // AFTER_FAILURE: // -----// IR Dump After{{.*}}TestFailurePass Failed (test-pass-failure) //----- //
 // AFTER_FAILURE: func @foo()
index 6627033..31eb043 100644 (file)
@@ -18,9 +18,9 @@ func.func @bar() {
   }
 #-}
 
-// BEFORE: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
+// BEFORE: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
 // BEFORE-NEXT: func @foo()
-// BEFORE: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
+// BEFORE: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
 // BEFORE-NEXT: func @bar()
-// BEFORE-NOT: // -----// IR Dump Before{{.*}}Canonicalizer (canonicalize) //----- //
+// BEFORE-NOT: // -----// IR Dump Before{{.*}}CanonicalizerPass (canonicalize) //----- //
 // BEFORE-NOT: // -----// IR Dump After
index ec103b7..beab4b1 100644 (file)
@@ -10,9 +10,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
-#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
 #include "mlir/Dialect/Tosa/Transforms/Passes.h"
 #include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
 #include "mlir/IR/BuiltinTypes.h"
index 3436863..72275e7 100644 (file)
@@ -74,7 +74,7 @@ MlirPass mlirCreate{0}{1}() {
   return wrap({2}.release());
 }
 void mlirRegister{0}{1}() {
-  register{1}Pass();
+  register{1}();
 }
 
 )";
@@ -103,7 +103,7 @@ static bool emitCAPIImpl(const llvm::RecordKeeper &records, raw_ostream &os) {
       constructorCall = constructor.str();
     else
       constructorCall =
-          llvm::formatv("create{0}Pass()", pass.getDef()->getName()).str();
+          llvm::formatv("create{0}()", pass.getDef()->getName()).str();
 
     os << llvm::formatv(passCreateDef, groupName, defName, constructorCall);
   }
index 801db20..aaecaf0 100644 (file)
@@ -27,8 +27,6 @@ static llvm::cl::opt<std::string>
     groupName("name", llvm::cl::desc("The name of this group of passes"),
               llvm::cl::cat(passGenCat));
 
-static void emitOldPassDecl(const Pass &pass, raw_ostream &os);
-
 /// Extract the list of passes from the TableGen records.
 static std::vector<Pass> getPasses(const llvm::RecordKeeper &recordKeeper) {
   std::vector<Pass> passes;
@@ -356,73 +354,6 @@ static void emitPassDefs(const Pass &pass, raw_ostream &os) {
   os << "#endif // " << enableVarName << "\n";
 }
 
-// TODO drop old pass declarations
-// The old pass base class is being kept until all the passes have switched to
-// the new decls/defs design.
-const char *const oldPassDeclBegin = R"(
-template <typename DerivedT>
-class {0}Base : public {1} {
-public:
-  using Base = {0}Base;
-
-  {0}Base() : {1}(::mlir::TypeID::get<DerivedT>()) {{}
-  {0}Base(const {0}Base &other) : {1}(other) {{}
-
-  /// Returns the command-line argument attached to this pass.
-  static constexpr ::llvm::StringLiteral getArgumentName() {
-    return ::llvm::StringLiteral("{2}");
-  }
-  ::llvm::StringRef getArgument() const override { return "{2}"; }
-
-  ::llvm::StringRef getDescription() const override { return "{3}"; }
-
-  /// Returns the derived pass name.
-  static constexpr ::llvm::StringLiteral getPassName() {
-    return ::llvm::StringLiteral("{0}");
-  }
-  ::llvm::StringRef getName() const override { return "{0}"; }
-
-  /// Support isa/dyn_cast functionality for the derived pass class.
-  static bool classof(const ::mlir::Pass *pass) {{
-    return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
-  }
-
-  /// A clone method to create a copy of this pass.
-  std::unique_ptr<::mlir::Pass> clonePass() const override {{
-    return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
-  }
-
-  /// Return the dialect that must be loaded in the context before this pass.
-  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
-    {4}
-  }
-
-  /// Explicitly declare the TypeID for this class. We declare an explicit private
-  /// instantiation because Pass classes should only be visible by the current
-  /// library.
-  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID({0}Base<DerivedT>)
-
-protected:
-)";
-
-/// Emit a backward-compatible declaration of the pass base class.
-static void emitOldPassDecl(const Pass &pass, raw_ostream &os) {
-  StringRef defName = pass.getDef()->getName();
-  std::string dependentDialectRegistrations;
-  {
-    llvm::raw_string_ostream dialectsOs(dependentDialectRegistrations);
-    for (StringRef dependentDialect : pass.getDependentDialects())
-      dialectsOs << llvm::formatv(dialectRegistrationTemplate,
-                                  dependentDialect);
-  }
-  os << llvm::formatv(oldPassDeclBegin, defName, pass.getBaseClass(),
-                      pass.getArgument(), pass.getSummary(),
-                      dependentDialectRegistrations);
-  emitPassOptionDecls(pass, os);
-  emitPassStatisticDecls(pass, os);
-  os << "};\n";
-}
-
 static void emitPass(const Pass &pass, raw_ostream &os) {
   StringRef passName = pass.getDef()->getName();
   os << llvm::formatv(passHeader, passName);
@@ -440,14 +371,6 @@ static void emitPasses(const llvm::RecordKeeper &recordKeeper,
     emitPass(pass, os);
 
   emitRegistrations(passes, os);
-
-  // TODO: Drop old pass declarations.
-  // Emit the old code until all the passes have switched to the new design.
-  os << "#ifdef GEN_PASS_CLASSES\n";
-  for (const Pass &pass : passes)
-    emitOldPassDecl(pass, os);
-  os << "#undef GEN_PASS_CLASSES\n";
-  os << "#endif // GEN_PASS_CLASSES\n";
 }
 
 static mlir::GenRegistration
index 60b5be6..ff41a8b 100644 (file)
@@ -53,9 +53,8 @@ static struct LLVMInitializer {
 /// dialects lowering to LLVM Dialect.
 static LogicalResult lowerToLLVMDialect(ModuleOp module) {
   PassManager pm(module.getContext());
-  pm.addPass(mlir::createMemRefToLLVMPass());
-  pm.addNestedPass<func::FuncOp>(
-      mlir::arith::createConvertArithmeticToLLVMPass());
+  pm.addPass(mlir::createConvertMemRefToLLVMPass());
+  pm.addNestedPass<func::FuncOp>(mlir::createConvertArithmeticToLLVMPass());
   pm.addPass(mlir::createConvertFuncToLLVMPass());
   pm.addPass(mlir::createReconcileUnrealizedCastsPass());
   return pm.run(module);