// AffineToStandard
//===----------------------------------------------------------------------===//
-def ConvertAffineToStandard : Pass<"lower-affine"> {
+def ConvertAffineToStandard : FunctionPass<"lower-affine"> {
let summary = "Lower Affine operations to a combination of Standard and Loop "
"operations";
let description = [{
// AVX512ToLLVM
//===----------------------------------------------------------------------===//
-def ConvertAVX512ToLLVM : Pass<"convert-avx512-to-llvm"> {
+def ConvertAVX512ToLLVM : Pass<"convert-avx512-to-llvm", "ModuleOp"> {
let summary = "Convert the operations from the avx512 dialect into the LLVM "
"dialect";
let constructor = "mlir::createConvertAVX512ToLLVMPass()";
// GPUToCUDA
//===----------------------------------------------------------------------===//
-def ConvertGpuLaunchFuncToCudaCalls : Pass<"launch-func-to-cuda"> {
+def ConvertGpuLaunchFuncToCudaCalls : Pass<"launch-func-to-cuda", "ModuleOp"> {
let summary = "Convert all launch_func ops to CUDA runtime calls";
let constructor = "mlir::createConvertGpuLaunchFuncToCudaCallsPass()";
}
// GPUToNVVM
//===----------------------------------------------------------------------===//
-def ConvertGpuOpsToNVVMOps : Pass<"convert-gpu-to-nvvm"> {
+def ConvertGpuOpsToNVVMOps : Pass<"convert-gpu-to-nvvm", "gpu::GPUModuleOp"> {
let summary = "Generate NVVM operations for gpu operations";
let constructor = "mlir::createLowerGpuOpsToNVVMOpsPass()";
}
// GPUToROCDL
//===----------------------------------------------------------------------===//
-def ConvertGpuOpsToROCDLOps : Pass<"convert-gpu-to-rocdl"> {
+def ConvertGpuOpsToROCDLOps : Pass<"convert-gpu-to-rocdl", "gpu::GPUModuleOp"> {
let summary = "Generate ROCDL operations for gpu operations";
let constructor = "mlir::createLowerGpuOpsToROCDLOpsPass()";
}
// GPUToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertGPUToSPIRV : Pass<"convert-gpu-to-spirv"> {
+def ConvertGPUToSPIRV : Pass<"convert-gpu-to-spirv", "ModuleOp"> {
let summary = "Convert GPU dialect to SPIR-V dialect";
let constructor = "mlir::createConvertGPUToSPIRVPass()";
}
//===----------------------------------------------------------------------===//
def ConvertGpuLaunchFuncToVulkanLaunchFunc
- : Pass<"convert-gpu-launch-to-vulkan-launch"> {
+ : Pass<"convert-gpu-launch-to-vulkan-launch", "ModuleOp"> {
let summary = "Convert gpu.launch_func to vulkanLaunch external call";
let constructor = "mlir::createConvertGpuLaunchFuncToVulkanLaunchFuncPass()";
}
-def ConvertVulkanLaunchFuncToVulkanCalls : Pass<"launch-func-to-vulkan"> {
+def ConvertVulkanLaunchFuncToVulkanCalls
+ : Pass<"launch-func-to-vulkan", "ModuleOp"> {
let summary = "Convert vulkanLaunch external call to Vulkan runtime external "
"calls";
let constructor = "mlir::createConvertVulkanLaunchFuncToVulkanCallsPass()";
// LinalgToLLVM
//===----------------------------------------------------------------------===//
-def ConvertLinalgToLLVM : Pass<"convert-linalg-to-llvm"> {
+def ConvertLinalgToLLVM : Pass<"convert-linalg-to-llvm", "ModuleOp"> {
let summary = "Convert the operations from the linalg dialect into the LLVM "
"dialect";
let constructor = "mlir::createConvertLinalgToLLVMPass()";
// LinalgToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertLinalgToSPIRV : Pass<"convert-linalg-to-spirv"> {
+def ConvertLinalgToSPIRV : Pass<"convert-linalg-to-spirv", "ModuleOp"> {
let summary = "Convert Linalg ops to SPIR-V ops";
let constructor = "mlir::createLinalgToSPIRVPass()";
}
// LoopsToGPU
//===----------------------------------------------------------------------===//
-def ConvertSimpleLoopsToGPU : Pass<"convert-loops-to-gpu"> {
+def ConvertSimpleLoopsToGPU : FunctionPass<"convert-loops-to-gpu"> {
let summary = "Convert top-level loops to GPU kernels";
let constructor = "mlir::createSimpleLoopsToGPUPass()";
let options = [
];
}
-def ConvertLoopsToGPU : Pass<"convert-loop-op-to-gpu"> {
+def ConvertLoopsToGPU : FunctionPass<"convert-loop-op-to-gpu"> {
let summary = "Convert top-level loop::ForOp to GPU kernels";
let constructor = "mlir::createLoopToGPUPass()";
let options = [
// StandardToLLVM
//===----------------------------------------------------------------------===//
-def ConvertStandardToLLVM : Pass<"convert-std-to-llvm"> {
+def ConvertStandardToLLVM : Pass<"convert-std-to-llvm", "ModuleOp"> {
let summary = "Convert scalar and vector operations from the Standard to the "
"LLVM dialect";
let description = [{
"Emit wrappers for C-compatible pointer-to-struct memref "
"descriptors">,
Option<"indexBitwidth", "index-bitwidth", "unsigned",
- /*default=*/"kDeriveIndexBitwidthFromDataLayout",
+ /*default=kDeriveIndexBitwidthFromDataLayout*/"0",
"Bitwidth of the index type, 0 to use size of machine word">,
];
}
let constructor = "mlir::createLegalizeStdOpsForSPIRVLoweringPass()";
}
-def ConvertStandardToSPIRV : Pass<"convert-std-to-spirv"> {
+def ConvertStandardToSPIRV : Pass<"convert-std-to-spirv", "ModuleOp"> {
let summary = "Convert Standard Ops to SPIR-V dialect";
let constructor = "mlir::createConvertStandardToSPIRVPass()";
}
// VectorToLLVM
//===----------------------------------------------------------------------===//
-def ConvertVectorToLLVM : Pass<"convert-vector-to-llvm"> {
+def ConvertVectorToLLVM : Pass<"convert-vector-to-llvm", "ModuleOp"> {
let summary = "Lower the operations from the vector dialect into the LLVM "
"dialect";
let constructor = "mlir::createConvertVectorToLLVMPass()";
include "mlir/Pass/PassBase.td"
-def AffineDataCopyGeneration : Pass<"affine-data-copy-generate"> {
+def AffineDataCopyGeneration : FunctionPass<"affine-data-copy-generate"> {
let summary = "Generate explicit copying for affine memory operations";
let constructor = "mlir::createAffineDataCopyGenerationPass()";
}
-def AffineLoopInvariantCodeMotion : Pass<"affine-loop-invariant-code-motion"> {
+def AffineLoopInvariantCodeMotion
+ : FunctionPass<"affine-loop-invariant-code-motion"> {
let summary = "Hoist loop invariant instructions outside of affine loops";
let constructor = "mlir::createAffineLoopInvariantCodeMotionPass()";
}
-def AffineLoopTiling : Pass<"affine-loop-tile"> {
+def AffineLoopTiling : FunctionPass<"affine-loop-tile"> {
let summary = "Tile affine loop nests";
let constructor = "mlir::createLoopTilingPass()";
}
-def AffineLoopUnroll : Pass<"affine-loop-unroll"> {
+def AffineLoopUnroll : FunctionPass<"affine-loop-unroll"> {
let summary = "Unroll affine loops";
let constructor = "mlir::createLoopUnrollPass()";
}
-def AffineLoopUnrollAndJam : Pass<"affine-loop-unroll-jam"> {
+def AffineLoopUnrollAndJam : FunctionPass<"affine-loop-unroll-jam"> {
let summary = "Unroll and jam affine loops";
let constructor = "mlir::createLoopUnrollAndJamPass()";
}
-def AffineVectorize : Pass<"affine-super-vectorize"> {
+def AffineVectorize : FunctionPass<"affine-super-vectorize"> {
let summary = "Vectorize to a target independent n-D vector abstraction";
let constructor = "mlir::createSuperVectorizePass()";
let options = [
];
}
-def SimplifyAffineStructures : Pass<"simplify-affine-structures"> {
+def SimplifyAffineStructures : FunctionPass<"simplify-affine-structures"> {
let summary = "Simplify affine expressions in maps/sets and normalize "
"memrefs";
let constructor = "mlir::createSimplifyAffineStructuresPass()";
include "mlir/Pass/PassBase.td"
-def GpuKernelOutlining : Pass<"gpu-kernel-outlining"> {
+def GpuKernelOutlining : Pass<"gpu-kernel-outlining", "ModuleOp"> {
let summary = "Outline gpu.launch bodies to kernel functions";
let constructor = "mlir::createGpuKernelOutliningPass()";
}
include "mlir/Pass/PassBase.td"
-def LinalgFusion : Pass<"linalg-fusion"> {
+def LinalgFusion : FunctionPass<"linalg-fusion"> {
let summary = "Fuse operations in the linalg dialect";
let constructor = "mlir::createLinalgFusionPass()";
}
let constructor = "mlir::createLinalgFusionOfTensorOpsPass()";
}
-def LinalgLowerToAffineLoops : Pass<"convert-linalg-to-affine-loops"> {
+def LinalgLowerToAffineLoops : FunctionPass<"convert-linalg-to-affine-loops"> {
let summary = "Lower the operations from the linalg dialect into affine "
"loops";
let constructor = "mlir::createConvertLinalgToAffineLoopsPass()";
}
-def LinalgLowerToLoops : Pass<"convert-linalg-to-loops"> {
+def LinalgLowerToLoops : FunctionPass<"convert-linalg-to-loops"> {
let summary = "Lower the operations from the linalg dialect into loops";
let constructor = "mlir::createConvertLinalgToLoopsPass()";
}
-def LinalgLowerToParallelLoops : Pass<"convert-linalg-to-parallel-loops"> {
+def LinalgLowerToParallelLoops
+ : FunctionPass<"convert-linalg-to-parallel-loops"> {
let summary = "Lower the operations from the linalg dialect into parallel "
"loops";
let constructor = "mlir::createConvertLinalgToParallelLoopsPass()";
}
-def LinalgPromotion : Pass<"linalg-promote-subviews"> {
+def LinalgPromotion : FunctionPass<"linalg-promote-subviews"> {
let summary = "Promote subview ops to local buffers";
let constructor = "mlir::createLinalgPromotionPass()";
let options = [
];
}
-def LinalgTiling : Pass<"linalg-tile"> {
+def LinalgTiling : FunctionPass<"linalg-tile"> {
let summary = "Tile operations in the linalg dialect";
let constructor = "mlir::createLinalgTilingPass()";
let options = [
];
}
-def LinalgTilingToParallelLoops : Pass<"linalg-tile-to-parallel-loops"> {
+def LinalgTilingToParallelLoops
+ : FunctionPass<"linalg-tile-to-parallel-loops"> {
let summary = "Tile operations in the linalg dialect to parallel loops";
let constructor = "mlir::createLinalgTilingToParallelLoopsPass()";
let options = [
let constructor = "mlir::createParallelLoopFusionPass()";
}
-def LoopParallelLoopSpecialization : Pass<"parallel-loop-specialization"> {
+def LoopParallelLoopSpecialization
+ : FunctionPass<"parallel-loop-specialization"> {
let summary = "Specialize parallel loops for vectorization";
let constructor = "mlir::createParallelLoopSpecializationPass()";
}
-def LoopParallelLoopTiling : Pass<"parallel-loop-tiling"> {
+def LoopParallelLoopTiling : FunctionPass<"parallel-loop-tiling"> {
let summary = "Tile parallel loops";
let constructor = "mlir::createParallelLoopTilingPass()";
let options = [
include "mlir/Pass/PassBase.td"
-def QuantConvertConst : Pass<"quant-convert-const"> {
+def QuantConvertConst : FunctionPass<"quant-convert-const"> {
let summary = "Converts constants followed by qbarrier to actual quantized "
"values";
let constructor = "mlir::quant::createConvertConstPass()";
}
-def QuantConvertSimulatedQuant : Pass<"quant-convert-simulated-quantization"> {
+def QuantConvertSimulatedQuant
+ : FunctionPass<"quant-convert-simulated-quantization"> {
let summary = "Converts training-time simulated quantization ops to "
"corresponding quantize/dequantize casts";
let constructor = "mlir::quant::createConvertSimulatedQuantPass()";
include "mlir/Pass/PassBase.td"
-def SPIRVCompositeTypeLayout : Pass<"decorate-spirv-composite-type-layout"> {
+def SPIRVCompositeTypeLayout
+ : Pass<"decorate-spirv-composite-type-layout", "ModuleOp"> {
let summary = "Decorate SPIR-V composite type with layout info";
let constructor = "mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass()";
}
-def SPIRVLowerABIAttributes : Pass<"spirv-lower-abi-attrs"> {
+def SPIRVLowerABIAttributes : Pass<"spirv-lower-abi-attrs", "spirv::ModuleOp"> {
let summary = "Decorate SPIR-V composite type with layout info";
let constructor = "mlir::spirv::createLowerABIAttributesPass()";
}
-def SPIRVUpdateVCE : Pass<"spirv-update-vce"> {
+def SPIRVUpdateVCE : 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()";
// Pass
//===----------------------------------------------------------------------===//
-class Pass<string passArg> {
+class PassBase<string passArg, string base> {
// The command line argument of the pass.
string argument = passArg;
+ // The C++ base class for the pass.
+ string baseClass = base;
+
// A short 1-line summary of the pass.
string summary = "";
list<Statistic> statistics = [];
}
+// This class represents an mlir::OperationPass.
+class Pass<string passArg, string operation = "">
+ : PassBase<passArg, "::mlir::OperationPass<" # operation # ">">;
+
+// This class represents an mlir::FunctionPass.
+class FunctionPass<string passArg> : PassBase<passArg, "::mlir::FunctionPass">;
+
#endif // MLIR_PASS_PASSBASE
/// Return the command line argument of the pass.
StringRef getArgument() const;
+ /// Return the name for the C++ base class.
+ StringRef getBaseClass() const;
+
/// Return the short 1-line summary of the pass.
StringRef getSummary() const;
include "mlir/Pass/PassBase.td"
-def AffinePipelineDataTransfer : Pass<
- "affine-pipeline-data-transfer"> {
+def AffinePipelineDataTransfer
+ : FunctionPass<"affine-pipeline-data-transfer"> {
let summary = "Pipeline non-blocking data transfers between explicitly "
"managed levels of the memory hierarchy";
let description = [{
let constructor = "mlir::createPipelineDataTransferPass()";
}
-def AffineLoopFusion : Pass<"affine-loop-fusion"> {
+def AffineLoopFusion : FunctionPass<"affine-loop-fusion"> {
let summary = "Fuse affine loop nests";
let constructor = "mlir::createLoopFusionPass()";
}
];
}
-def LoopCoalescing : Pass<"loop-coalescing"> {
+def LoopCoalescing : FunctionPass<"loop-coalescing"> {
let summary = "Coalesce nested loops with independent bounds into a single "
"loop";
let constructor = "mlir::createLoopCoalescingPass()";
let constructor = "mlir::createLoopInvariantCodeMotionPass()";
}
-def MemRefDataFlowOpt : Pass<"memref-dataflow-opt"> {
+def MemRefDataFlowOpt : FunctionPass<"memref-dataflow-opt"> {
let summary = "Perform store/load forwarding for memrefs";
let description = [{
This pass performs store to load forwarding for memref's to eliminate memory
];
}
-def PrintCFG : Pass<"print-cfg-graph"> {
+def PrintCFG : FunctionPass<"print-cfg-graph"> {
let summary = "Print CFG graph per-Region";
let constructor = "mlir::createPrintCFGGraphPass()";
}
-def PrintOpStats : Pass<"print-op-stats"> {
+def PrintOpStats : Pass<"print-op-stats", "ModuleOp"> {
let summary = "Print statistics of operations";
let constructor = "mlir::createPrintOpStatsPass()";
}
-def PrintOp : Pass<"print-op-graph"> {
+def PrintOp : Pass<"print-op-graph", "ModuleOp"> {
let summary = "Print op graph per-Region";
let constructor = "mlir::createPrintOpGraphPass()";
}
#include "mlir/Conversion/AVX512ToLLVM/ConvertAVX512ToLLVM.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
namespace {
struct ConvertAVX512ToLLVMPass
- : public PassWrapper<ConvertAVX512ToLLVMPass, OperationPass<ModuleOp>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertAVX512ToLLVM
-#include "mlir/Conversion/Passes.h.inc"
-
+ : public ConvertAVX512ToLLVMBase<ConvertAVX512ToLLVMPass> {
void runOnOperation() override;
};
} // namespace
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/LoopOps/LoopOps.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
}
namespace {
-class LowerAffinePass : public PassWrapper<LowerAffinePass, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertAffineToStandard
-#include "mlir/Conversion/Passes.h.inc"
-
+class LowerAffinePass : public ConvertAffineToStandardBase<LowerAffinePass> {
void runOnFunction() override {
OwningRewritePatternList patterns;
populateAffineToStdConversionPatterns(patterns, &getContext());
#include "mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Function.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/StandardTypes.h"
-#include "mlir/Pass/Pass.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/DataLayout.h"
///
/// Intermediate data structures are allocated on the stack.
class GpuLaunchFuncToCudaCallsPass
- : public PassWrapper<GpuLaunchFuncToCudaCallsPass,
- OperationPass<ModuleOp>> {
+ : public ConvertGpuLaunchFuncToCudaCallsBase<GpuLaunchFuncToCudaCallsPass> {
private:
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertGpuLaunchFuncToCudaCalls
-#include "mlir/Conversion/Passes.h.inc"
-
LLVM::LLVMDialect *getLLVMDialect() { return llvmDialect; }
llvm::LLVMContext &getLLVMContext() {
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
#include "mlir/IR/BlockAndValueMapping.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/FormatVariadic.h"
#include "../GPUCommon/IndexIntrinsicsOpLowering.h"
#include "../GPUCommon/OpToFuncCallLowering.h"
+#include "../PassDetail.h"
using namespace mlir;
/// This pass only handles device code and is not meant to be run on GPU host
/// code.
class LowerGpuOpsToNVVMOpsPass
- : public PassWrapper<LowerGpuOpsToNVVMOpsPass,
- OperationPass<gpu::GPUModuleOp>> {
+ : public ConvertGpuOpsToNVVMOpsBase<LowerGpuOpsToNVVMOpsPass> {
public:
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertGpuOpsToNVVMOps
-#include "mlir/Conversion/Passes.h.inc"
-
void runOnOperation() override {
gpu::GPUModuleOp m = getOperation();
#include "../GPUCommon/IndexIntrinsicsOpLowering.h"
#include "../GPUCommon/OpToFuncCallLowering.h"
+#include "../PassDetail.h"
using namespace mlir;
// This pass only handles device code and is not meant to be run on GPU host
// code.
class LowerGpuOpsToROCDLOpsPass
- : public PassWrapper<LowerGpuOpsToROCDLOpsPass,
- OperationPass<gpu::GPUModuleOp>> {
+ : public ConvertGpuOpsToROCDLOpsBase<LowerGpuOpsToROCDLOpsPass> {
public:
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertGpuOpsToROCDLOps
-#include "mlir/Conversion/Passes.h.inc"
-
void runOnOperation() override {
gpu::GPUModuleOp m = getOperation();
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h"
#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/SPIRV/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/SPIRVLowering.h"
#include "mlir/Dialect/SPIRV/SPIRVOps.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
/// replace it).
///
/// 2) Lower the body of the spirv::ModuleOp.
-struct GPUToSPIRVPass
- : public PassWrapper<GPUToSPIRVPass, OperationPass<ModuleOp>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertGpuToSPIRV
-#include "mlir/Conversion/Passes.h.inc"
-
+struct GPUToSPIRVPass : public ConvertGPUToSPIRVBase<GPUToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/SPIRV/SPIRVOps.h"
#include "mlir/IR/Function.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/StandardTypes.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
/// function and attaching binary data and entry point name as an attributes to
/// created vulkan launch call op.
class ConvertGpuLaunchFuncToVulkanLaunchFunc
- : public PassWrapper<ConvertGpuLaunchFuncToVulkanLaunchFunc,
- OperationPass<ModuleOp>> {
+ : public ConvertGpuLaunchFuncToVulkanLaunchFuncBase<
+ ConvertGpuLaunchFuncToVulkanLaunchFunc> {
public:
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertGpuLaunchFuncToVulkanLaunchFunc
-#include "mlir/Conversion/Passes.h.inc"
-
void runOnOperation() override;
private:
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/Function.h"
#include "mlir/IR/Module.h"
-#include "mlir/Pass/Pass.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/FormatVariadic.h"
/// * deinitVulkan -- deinitializes vulkan runtime
///
class VulkanLaunchFuncToVulkanCallsPass
- : public PassWrapper<VulkanLaunchFuncToVulkanCallsPass,
- OperationPass<ModuleOp>> {
+ : public ConvertVulkanLaunchFuncToVulkanCallsBase<
+ VulkanLaunchFuncToVulkanCallsPass> {
private:
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertVulkanLaunchFuncToVulkanCalls
-#include "mlir/Conversion/Passes.h.inc"
-
LLVM::LLVMDialect *getLLVMDialect() { return llvmDialect; }
llvm::LLVMContext &getLLVMContext() {
#include "mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
#include "mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/StandardTypes.h"
#include "mlir/IR/Types.h"
-#include "mlir/Pass/Pass.h"
-#include "mlir/Pass/PassManager.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
namespace {
struct ConvertLinalgToLLVMPass
- : public PassWrapper<ConvertLinalgToLLVMPass, OperationPass<ModuleOp>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertLinalgToLLVM
-#include "mlir/Conversion/Passes.h.inc"
-
+ : public ConvertLinalgToLLVMBase<ConvertLinalgToLLVMPass> {
void runOnOperation() override;
};
} // namespace
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h"
#include "mlir/Dialect/SPIRV/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/SPIRVLowering.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
namespace {
/// A pass converting MLIR Linalg ops into SPIR-V ops.
-class LinalgToSPIRVPass
- : public PassWrapper<LinalgToSPIRVPass, OperationPass<ModuleOp>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertLinalgToSPIRV
-#include "mlir/Conversion/Passes.h.inc"
-
+class LinalgToSPIRVPass : public ConvertLinalgToSPIRVBase<LinalgToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h"
#include "mlir/Dialect/LoopOps/LoopOps.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/Functional.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
namespace {
struct LoopToStandardPass
- : public PassWrapper<LoopToStandardPass, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertLoopToStandard
-#include "mlir/Conversion/Passes.h.inc"
-
+ : public ConvertLoopToStandardBase<LoopToStandardPass> {
void runOnOperation() override;
};
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/LoopsToGPU/LoopsToGPU.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/LoopOps/LoopOps.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/ArrayRef.h"
// 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 PassWrapper<ForLoopMapper, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertSimpleLoopsToGPU
-#include "mlir/Conversion/Passes.h.inc"
-
+struct ForLoopMapper : public ConvertSimpleLoopsToGPUBase<ForLoopMapper> {
ForLoopMapper() = default;
- ForLoopMapper(const ForLoopMapper &) {}
ForLoopMapper(unsigned numBlockDims, unsigned numThreadDims) {
this->numBlockDims = numBlockDims;
this->numThreadDims = numThreadDims;
// nested loops as the size of `numWorkGroups`. Within these any loop nest has
// to be perfectly nested upto depth equal to size of `workGroupSize`.
struct ImperfectlyNestedForLoopMapper
- : public PassWrapper<ImperfectlyNestedForLoopMapper, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertLoopsToGPU
-#include "mlir/Conversion/Passes.h.inc"
-
+ : public ConvertLoopsToGPUBase<ImperfectlyNestedForLoopMapper> {
ImperfectlyNestedForLoopMapper() = default;
- ImperfectlyNestedForLoopMapper(const ImperfectlyNestedForLoopMapper &) {}
ImperfectlyNestedForLoopMapper(ArrayRef<int64_t> numWorkGroups,
ArrayRef<int64_t> workGroupSize) {
this->numWorkGroups->assign(numWorkGroups.begin(), numWorkGroups.end());
};
struct ParallelLoopToGpuPass
- : public PassWrapper<ParallelLoopToGpuPass, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertParallelLoopToGpu
-#include "mlir/Conversion/Passes.h.inc"
-
+ : public ConvertParallelLoopToGpuBase<ParallelLoopToGpuPass> {
void runOnOperation() override {
OwningRewritePatternList patterns;
populateParallelLoopToGPUPatterns(patterns, &getContext());
--- /dev/null
+//===- 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"
+
+namespace mlir {
+
+namespace gpu {
+class GPUModuleOp;
+} // end namespace gpu
+
+#define GEN_PASS_CLASSES
+#include "mlir/Conversion/Passes.h.inc"
+
+} // end namespace mlir
+
+#endif // CONVERSION_PASSDETAIL_H_
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/ADT/TypeSwitch.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
namespace {
/// A pass converting MLIR operations into the LLVM IR dialect.
-struct LLVMLoweringPass
- : public PassWrapper<LLVMLoweringPass, OperationPass<ModuleOp>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertStandardToLLVM
-#include "mlir/Conversion/Passes.h.inc"
-
- /// Creates an LLVM lowering pass.
+struct LLVMLoweringPass : public ConvertStandardToLLVMBase<LLVMLoweringPass> {
+ LLVMLoweringPass() = default;
LLVMLoweringPass(bool useBarePtrCallConv, bool emitCWrappers,
unsigned indexBitwidth) {
this->useBarePtrCallConv = useBarePtrCallConv;
this->emitCWrappers = emitCWrappers;
this->indexBitwidth = indexBitwidth;
}
- explicit LLVMLoweringPass() {}
- LLVMLoweringPass(const LLVMLoweringPass &pass) {}
/// Run the dialect converter on the module.
void runOnOperation() override {
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h"
#include "mlir/Dialect/SPIRV/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/SPIRVLowering.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
namespace {
/// A pass converting MLIR Standard operations into the SPIR-V dialect.
class ConvertStandardToSPIRVPass
- : public PassWrapper<ConvertStandardToSPIRVPass, OperationPass<ModuleOp>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertStandardToSPIRV
-#include "mlir/Conversion/Passes.h.inc"
-
+ : public ConvertStandardToSPIRVBase<ConvertStandardToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h"
#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/StandardTypes.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
namespace {
struct SPIRVLegalization final
- : public PassWrapper<SPIRVLegalization, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LegalizeStandardForSPIRV
-#include "mlir/Conversion/Passes.h.inc"
-
+ : public LegalizeStandardForSPIRVBase<SPIRVLegalization> {
void runOnOperation() override;
};
} // namespace
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/StandardTypes.h"
#include "mlir/IR/Types.h"
-#include "mlir/Pass/Pass.h"
-#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/IR/DerivedTypes.h"
namespace {
struct LowerVectorToLLVMPass
- : public PassWrapper<LowerVectorToLLVMPass, OperationPass<ModuleOp>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ConvertVectorToLLVM
-#include "mlir/Conversion/Passes.h.inc"
-
+ : public ConvertVectorToLLVMBase<LowerVectorToLLVMPass> {
void runOnOperation() override;
};
} // namespace
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopUtils.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/Support/CommandLine.h"
// TODO(bondhugula): We currently can't generate copies correctly when stores
// are strided. Check for strided stores.
struct AffineDataCopyGeneration
- : public PassWrapper<AffineDataCopyGeneration, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_AffineDataCopyGeneration
-#include "mlir/Dialect/Affine/Passes.h.inc"
-
+ : public AffineDataCopyGenerationBase<AffineDataCopyGeneration> {
explicit AffineDataCopyGeneration(
unsigned slowMemorySpace = 0,
unsigned fastMemorySpace = clFastMemorySpace, unsigned tagMemorySpace = 0,
skipNonUnitStrideLoops(skipNonUnitStrideLoops) {}
explicit AffineDataCopyGeneration(const AffineDataCopyGeneration &other)
- : slowMemorySpace(other.slowMemorySpace),
+ : AffineDataCopyGenerationBase<AffineDataCopyGeneration>(other),
+ slowMemorySpace(other.slowMemorySpace),
fastMemorySpace(other.fastMemorySpace),
tagMemorySpace(other.tagMemorySpace),
minDmaTransferSize(other.minDmaTransferSize),
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/AffineStructures.h"
#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopUtils.h"
#include "mlir/Transforms/Utils.h"
#include "llvm/ADT/DenseMap.h"
/// TODO: This code should be removed once the new LICM pass can handle its
/// uses.
struct LoopInvariantCodeMotion
- : public PassWrapper<LoopInvariantCodeMotion, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_AffineLoopInvariantCodeMotion
-#include "mlir/Dialect/Affine/Passes.h.inc"
-
+ : public AffineLoopInvariantCodeMotionBase<LoopInvariantCodeMotion> {
void runOnFunction() override;
void runOnAffineForOp(AffineForOp forOp);
};
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/AffineStructures.h"
#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopUtils.h"
#include "mlir/Transforms/Utils.h"
#include "llvm/Support/CommandLine.h"
namespace {
/// A pass to perform loop tiling on all suitable loop nests of a Function.
-struct LoopTiling : public PassWrapper<LoopTiling, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_AffineLoopTiling
-#include "mlir/Dialect/Affine/Passes.h.inc"
-
+struct LoopTiling : public AffineLoopTilingBase<LoopTiling> {
explicit LoopTiling(uint64_t cacheSizeBytes = kDefaultCacheMemCapacity,
bool avoidMaxMinBounds = true)
: cacheSizeBytes(cacheSizeBytes), avoidMaxMinBounds(avoidMaxMinBounds) {}
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopUtils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/CommandLine.h"
/// 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 PassWrapper<LoopUnroll, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_AffineUnroll
-#include "mlir/Dialect/Affine/Passes.h.inc"
-
+struct LoopUnroll : public AffineLoopUnrollBase<LoopUnroll> {
const Optional<unsigned> unrollFactor;
const Optional<bool> unrollFull;
// Callback to obtain unroll factors; if this has a callable target, takes
// Note: 'if/else' blocks are not jammed. So, if there are loops inside if
// op's, bodies of those loops will not be jammed.
//===----------------------------------------------------------------------===//
+
+#include "PassDetail.h"
#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopUtils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/CommandLine.h"
namespace {
/// Loop unroll jam pass. Currently, this just unroll jams the first
/// outer loop in a Function.
-struct LoopUnrollAndJam : public PassWrapper<LoopUnrollAndJam, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_AffineLoopUnrollAndJam
-#include "mlir/Dialect/Affine/Passes.h.inc"
-
+struct LoopUnrollAndJam : public AffineLoopUnrollAndJamBase<LoopUnrollAndJam> {
Optional<unsigned> unrollJamFactor;
static const unsigned kDefaultUnrollJamFactor = 4;
--- /dev/null
+//===- 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/Pass/Pass.h"
+
+namespace mlir {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Affine/Passes.h.inc"
+
+} // end namespace mlir
+
+#endif // DIALECT_AFFINE_TRANSFORMS_PASSDETAIL_H_
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/Utils.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/IR/IntegerSet.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/Utils.h"
#define DEBUG_TYPE "simplify-affine-structure"
/// all memrefs with non-trivial layout maps are converted to ones with trivial
/// identity layout ones.
struct SimplifyAffineStructures
- : public PassWrapper<SimplifyAffineStructures, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_SimplifyAffineStructures
-#include "mlir/Dialect/Affine/Passes.h.inc"
-
+ : public SimplifyAffineStructuresBase<SimplifyAffineStructures> {
void runOnFunction() override;
/// Utility to simplify an affine attribute and update its entry in the parent
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Analysis/NestedMatcher.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/Types.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Transforms/FoldUtils.h"
/// Base state for the vectorize pass.
/// Command line arguments are preempted by non-empty pass arguments.
-struct Vectorize : public PassWrapper<Vectorize, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_AffineVectorize
-#include "mlir/Dialect/Affine/Passes.h.inc"
-
+struct Vectorize : public AffineVectorizeBase<Vectorize> {
Vectorize() = default;
- Vectorize(const Vectorize &) {}
Vectorize(ArrayRef<int64_t> virtualVectorSize);
void runOnFunction() override;
};
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/GPU/Utils.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/SymbolTable.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/RegionUtils.h"
using namespace mlir;
/// a separate pass. The external functions can then be annotated with the
/// symbol of the cubin accessor function.
class GpuKernelOutliningPass
- : public PassWrapper<GpuKernelOutliningPass, OperationPass<ModuleOp>> {
+ : public GpuKernelOutliningBase<GpuKernelOutliningPass> {
public:
-/// Include the generated pass utilities.
-#define GEN_PASS_GpuKernelOutlining
-#include "mlir/Dialect/GPU/Passes.h.inc"
-
void runOnOperation() override {
SymbolTable symbolTable(getOperation());
bool modified = false;
--- /dev/null
+//===- 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/Pass/Pass.h"
+
+namespace mlir {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/GPU/Passes.h.inc"
+
+} // end namespace mlir
+
+#endif // DIALECT_GPU_TRANSFORMS_PASSDETAIL_H_
//===----------------------------------------------------------------------===//
#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/Module.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
namespace {
struct LegalizeForExportPass
- : public PassWrapper<LegalizeForExportPass, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LLVMLegalizeForExport
-#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
-
+ : public LLVMLegalizeForExportBase<LegalizeForExportPass> {
void runOnOperation() override {
LLVM::ensureDistinctSuccessors(getOperation());
}
--- /dev/null
+//===- 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 {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+
+} // end namespace mlir
+
+#endif // DIALECT_LLVMIR_TRANSFORMS_PASSDETAIL_H_
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/Dominance.h"
#include "mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h"
#include "mlir/Dialect/Linalg/EDSC/Intrinsics.h"
#include "mlir/Dialect/StandardOps/EDSC/Intrinsics.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
-#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/STLExtras.h"
#include "mlir/Transforms/FoldUtils.h"
/// Pass that fuses generic ops on tensors. Used only for testing.
struct FusionOfTensorOpsPass
- : public PassWrapper<FusionOfTensorOpsPass, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LinalgFusionOfTensorOps
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
+ : public LinalgFusionOfTensorOpsBase<FusionOfTensorOpsPass> {
void runOnOperation() override {
OwningRewritePatternList patterns;
Operation *op = getOperation();
};
};
-struct LinalgFusionPass : public PassWrapper<LinalgFusionPass, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LinalgFusion
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
+struct LinalgFusionPass : public LinalgFusionBase<LinalgFusionPass> {
void runOnFunction() override { fuseLinalgOpsGreedily(getFunction()); }
};
} // namespace
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/EDSC/Intrinsics.h"
#include "mlir/Dialect/Linalg/EDSC/Intrinsics.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BlockAndValueMapping.h"
-#include "mlir/IR/OpImplementation.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/STLExtras.h"
namespace {
struct LowerToAffineLoops
- : public PassWrapper<LowerToAffineLoops, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LinalgLowerToAffineLoops
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
+ : public LinalgLowerToAffineLoopsBase<LowerToAffineLoops> {
void runOnFunction() override {
lowerLinalgToLoopsImpl<AffineForOp, AffineIndexedValue>(getFunction(),
&getContext());
}
};
-struct LowerToLoops : public PassWrapper<LowerToLoops, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LinalgLowerToLoops
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
+struct LowerToLoops : public LinalgLowerToLoopsBase<LowerToLoops> {
void runOnFunction() override {
lowerLinalgToLoopsImpl<loop::ForOp, StdIndexedValue>(getFunction(),
&getContext());
}
};
struct LowerToParallelLoops
- : public PassWrapper<LowerToParallelLoops, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LinalgLowerToParallelLoops
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
+ : public LinalgLowerToParallelLoopsBase<LowerToParallelLoops> {
void runOnFunction() override {
lowerLinalgToLoopsImpl<loop::ParallelOp, StdIndexedValue>(getFunction(),
&getContext());
--- /dev/null
+//===- 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/Pass/Pass.h"
+
+namespace mlir {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+
+} // end namespace mlir
+
+#endif // DIALECT_LINALG_TRANSFORMS_PASSDETAIL_H_
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/EDSC/Intrinsics.h"
#include "mlir/Dialect/Linalg/EDSC/Intrinsics.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/AffineMap.h"
-#include "mlir/IR/OpImplementation.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/STLExtras.h"
#include "mlir/Transforms/FoldUtils.h"
}
namespace {
-struct LinalgPromotionPass
- : public PassWrapper<LinalgPromotionPass, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LinalgPromotion
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
+struct LinalgPromotionPass : public LinalgPromotionBase<LinalgPromotionPass> {
LinalgPromotionPass() = default;
- LinalgPromotionPass(const LinalgPromotionPass &) {}
LinalgPromotionPass(bool dynamicBuffers) {
this->dynamicBuffers = dynamicBuffers;
}
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/EDSC/Intrinsics.h"
#include "mlir/Dialect/Linalg/EDSC/Intrinsics.h"
#include "mlir/Dialect/Linalg/IR/LinalgTypes.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/AffineMap.h"
-#include "mlir/IR/OpImplementation.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/Functional.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/STLExtras.h"
}
namespace {
-struct LinalgTilingPass : public PassWrapper<LinalgTilingPass, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LinalgTiling
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
+struct LinalgTilingPass : public LinalgTilingBase<LinalgTilingPass> {
LinalgTilingPass() = default;
- LinalgTilingPass(const LinalgTilingPass &) {}
LinalgTilingPass(ArrayRef<int64_t> sizes) {
tileSizes->assign(sizes.begin(), sizes.end());
}
};
struct LinalgTilingToParallelLoopsPass
- : public PassWrapper<LinalgTilingToParallelLoopsPass, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LinalgTilingToParallelLoops
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
+ : public LinalgTilingToParallelLoopsBase<LinalgTilingToParallelLoopsPass> {
LinalgTilingToParallelLoopsPass() = default;
- LinalgTilingToParallelLoopsPass(const LinalgTilingToParallelLoopsPass &) {}
LinalgTilingToParallelLoopsPass(ArrayRef<int64_t> sizes) {
tileSizes->assign(sizes.begin(), sizes.end());
}
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/LoopOps/LoopOps.h"
#include "mlir/Dialect/LoopOps/Passes.h"
#include "mlir/Dialect/LoopOps/Transforms.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/OpDefinition.h"
-#include "mlir/Pass/Pass.h"
-#include "mlir/Transforms/Passes.h"
using namespace mlir;
using namespace mlir::loop;
namespace {
struct ParallelLoopFusion
- : public PassWrapper<ParallelLoopFusion, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LoopParallelLoopFusion
-#include "mlir/Dialect/LoopOps/Passes.h.inc"
-
+ : public LoopParallelLoopFusionBase<ParallelLoopFusion> {
void runOnOperation() override {
for (Region ®ion : getOperation()->getRegions())
naivelyFuseParallelOps(region);
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/LoopOps/LoopOps.h"
#include "mlir/Dialect/LoopOps/Passes.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/BlockAndValueMapping.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
using loop::ParallelOp;
namespace {
struct ParallelLoopSpecialization
- : public PassWrapper<ParallelLoopSpecialization, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LoopParallelLoopSpecialization
-#include "mlir/Dialect/LoopOps/Passes.h.inc"
-
+ : public LoopParallelLoopSpecializationBase<ParallelLoopSpecialization> {
void runOnFunction() override {
getFunction().walk([](ParallelOp op) { specializeLoopForUnrolling(op); });
}
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/LoopOps/LoopOps.h"
#include "mlir/Dialect/LoopOps/Passes.h"
#include "mlir/Dialect/LoopOps/Transforms.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/RegionUtils.h"
#include "llvm/Support/CommandLine.h"
namespace {
struct ParallelLoopTiling
- : public PassWrapper<ParallelLoopTiling, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LoopParallelLoopTiling
-#include "mlir/Dialect/LoopOps/Passes.h.inc"
-
+ : public LoopParallelLoopTilingBase<ParallelLoopTiling> {
ParallelLoopTiling() = default;
- ParallelLoopTiling(const ParallelLoopTiling &) {}
explicit ParallelLoopTiling(ArrayRef<int64_t> tileSizes) {
this->tileSizes = tileSizes;
}
--- /dev/null
+//===- 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_LOOPOPS_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_LOOPOPS_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/LoopOps/Passes.h.inc"
+
+} // end namespace mlir
+
+#endif // DIALECT_LOOPOPS_TRANSFORMS_PASSDETAIL_H_
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Quant/Passes.h"
#include "mlir/Dialect/Quant/QuantOps.h"
#include "mlir/Dialect/Quant/QuantizeUtils.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/StandardTypes.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
using namespace mlir::quant;
namespace {
-struct ConvertConstPass : public PassWrapper<ConvertConstPass, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_QuantConvertConst
-#include "mlir/Dialect/Quant/Passes.h.inc"
-
+struct ConvertConstPass : public QuantConvertConstBase<ConvertConstPass> {
void runOnFunction() override;
};
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Quant/FakeQuantSupport.h"
#include "mlir/Dialect/Quant/Passes.h"
#include "mlir/Dialect/Quant/QuantOps.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/StandardTypes.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
using namespace mlir::quant;
namespace {
struct ConvertSimulatedQuantPass
- : public PassWrapper<ConvertSimulatedQuantPass, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_QuantConvertSimulatedQuant
-#include "mlir/Dialect/Quant/Passes.h.inc"
-
+ : public QuantConvertSimulatedQuantBase<ConvertSimulatedQuantPass> {
void runOnFunction() override;
};
--- /dev/null
+//===- PassDetail.h - Quant 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_QUANT_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_QUANT_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Quant/Passes.h.inc"
+
+} // end namespace mlir
+
+#endif // DIALECT_QUANT_TRANSFORMS_PASSDETAIL_H_
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/SPIRV/LayoutUtils.h"
#include "mlir/Dialect/SPIRV/Passes.h"
#include "mlir/Dialect/SPIRV/SPIRVDialect.h"
namespace {
class DecorateSPIRVCompositeTypeLayoutPass
- : public PassWrapper<DecorateSPIRVCompositeTypeLayoutPass,
- OperationPass<ModuleOp>> {
-private:
+ : public SPIRVCompositeTypeLayoutBase<
+ DecorateSPIRVCompositeTypeLayoutPass> {
void runOnOperation() override;
};
} // namespace
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/SPIRV/LayoutUtils.h"
#include "mlir/Dialect/SPIRV/Passes.h"
#include "mlir/Dialect/SPIRV/SPIRVDialect.h"
/// Pass to implement the ABI information specified as attributes.
class LowerABIAttributesPass final
- : public PassWrapper<LowerABIAttributesPass,
- OperationPass<spirv::ModuleOp>> {
-private:
+ : public SPIRVLowerABIAttributesBase<LowerABIAttributesPass> {
void runOnOperation() override;
};
} // namespace
--- /dev/null
+//===- 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/Pass/Pass.h"
+
+namespace mlir {
+
+namespace spirv {
+class ModuleOp;
+} // end namespace spirv
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/SPIRV/Passes.h.inc"
+
+} // end namespace mlir
+
+#endif // DIALECT_SPIRV_TRANSFORMS_PASSDETAIL_H_
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/SPIRV/Passes.h"
#include "mlir/Dialect/SPIRV/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/SPIRVOps.h"
namespace {
/// Pass to deduce minimal version/extension/capability requirements for a
/// spirv::ModuleOp.
-class UpdateVCEPass final
- : public PassWrapper<UpdateVCEPass, OperationPass<spirv::ModuleOp>> {
-private:
+class UpdateVCEPass final : public SPIRVUpdateVCEBase<UpdateVCEPass> {
void runOnOperation() override;
};
} // namespace
return def->getValueAsString("argument");
}
+StringRef Pass::getBaseClass() const {
+ return def->getValueAsString("baseClass");
+}
+
StringRef Pass::getSummary() const { return def->getValueAsString("summary"); }
StringRef Pass::getDescription() const {
//===----------------------------------------------------------------------===//
//
// This transformation pass performs a simple common sub-expression elimination
-// algorithm on operations within a function.
+// algorithm on operations within a region.
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/Dominance.h"
-#include "mlir/IR/Attributes.h"
-#include "mlir/IR/Builders.h"
-#include "mlir/IR/Function.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/Functional.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/Utils.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/RecyclingAllocator.h"
#include <deque>
+
using namespace mlir;
namespace {
namespace {
/// Simple common sub-expression elimination.
-struct CSE : public PassWrapper<CSE, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_CSE
-#include "mlir/Transforms/Passes.h.inc"
-
- CSE() = default;
- CSE(const CSE &) {}
-
+struct CSE : public CSEBase<CSE> {
/// Shared implementation of operation elimination and scoped map definitions.
using AllocatorTy = llvm::RecyclingAllocator<
llvm::BumpPtrAllocator,
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/Passes.h"
namespace {
/// Canonicalize operations in nested regions.
-struct Canonicalizer : public PassWrapper<Canonicalizer, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_Canonicalizer
-#include "mlir/Transforms/Passes.h.inc"
-
+struct Canonicalizer : public CanonicalizerBase<Canonicalizer> {
void runOnOperation() override {
OwningRewritePatternList patterns;
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/CallGraph.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/SideEffects.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/InliningUtils.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/SCCIterator.h"
//===----------------------------------------------------------------------===//
namespace {
-struct InlinerPass : public PassWrapper<InlinerPass, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_Inliner
-#include "mlir/Transforms/Passes.h.inc"
-
+struct InlinerPass : public InlinerBase<InlinerPass> {
void runOnOperation() override {
CallGraph &cg = getAnalysis<CallGraph>();
auto *context = &getContext();
//===----------------------------------------------------------------------===//
#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 {
struct LocationSnapshotPass
- : public PassWrapper<LocationSnapshotPass, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LocationSnapshot
-#include "mlir/Transforms/Passes.h.inc"
-
+ : public LocationSnapshotBase<LocationSnapshotPass> {
LocationSnapshotPass() = default;
- LocationSnapshotPass(const LocationSnapshotPass &) {}
LocationSnapshotPass(OpPrintingFlags flags, StringRef fileName, StringRef tag)
: flags(flags) {
this->fileName = fileName.str();
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/LoopOps/LoopOps.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopUtils.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/RegionUtils.h"
using namespace mlir;
namespace {
-struct LoopCoalescingPass
- : public PassWrapper<LoopCoalescingPass, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LoopCoalescing
-#include "mlir/Transforms/Passes.h.inc"
-
+struct LoopCoalescingPass : public LoopCoalescingBase<LoopCoalescingPass> {
void runOnFunction() override {
FuncOp func = getFunction();
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/AffineStructures.h"
#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopFusionUtils.h"
#include "mlir/Transforms/LoopUtils.h"
#include "mlir/Transforms/Passes.h"
// TODO(andydavis) Extend this pass to check for fusion preventing dependences,
// and add support for more general loop fusion algorithms.
-struct LoopFusion : public PassWrapper<LoopFusion, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_AffineLoopFusion
-#include "mlir/Transforms/Passes.h.inc"
-
+struct LoopFusion : public AffineLoopFusionBase<LoopFusion> {
LoopFusion(unsigned fastMemorySpace = 0, uint64_t localBufSizeThreshold = 0,
bool maximalFusion = false)
: localBufSizeThreshold(localBufSizeThreshold),
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/Function.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Interfaces/SideEffects.h"
-#include "mlir/Pass/Pass.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
namespace {
/// Loop invariant code motion (LICM) pass.
struct LoopInvariantCodeMotion
- : public PassWrapper<LoopInvariantCodeMotion, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_LoopInvariantCodeMotion
-#include "mlir/Transforms/Passes.h.inc"
-
+ : public LoopInvariantCodeMotionBase<LoopInvariantCodeMotion> {
void runOnOperation() override;
};
} // end anonymous namespace
// SSA scalars live out of 'affine.for'/'affine.if' statements is available.
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/Dominance.h"
#include "mlir/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/SmallPtrSet.h"
#include <algorithm>
// currently only eliminates the stores only if no other loads/uses (other
// than dealloc) remain.
//
-struct MemRefDataFlowOpt : public PassWrapper<MemRefDataFlowOpt, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_MemRefDataFlowOpt
-#include "mlir/Transforms/Passes.h.inc"
-
+struct MemRefDataFlowOpt : public MemRefDataFlowOptBase<MemRefDataFlowOpt> {
void runOnFunction() override;
void forwardStoreToLoad(AffineLoadOp loadOp);
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/OperationSupport.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/Format.h"
using namespace mlir;
namespace {
-struct PrintOpStatsPass
- : public PassWrapper<PrintOpStatsPass, OperationPass<ModuleOp>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_PrintOpStats
-#include "mlir/Transforms/Passes.h.inc"
-
+struct PrintOpStatsPass : public PrintOpStatsBase<PrintOpStatsPass> {
explicit PrintOpStatsPass(raw_ostream &os = llvm::errs()) : os(os) {}
// Prints the resultant operation statistics post iterating over the module.
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/LoopOps/LoopOps.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopUtils.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/RegionUtils.h"
namespace {
struct ParallelLoopCollapsing
- : public PassWrapper<ParallelLoopCollapsing, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_ParallelLoopCollapsing
-#include "mlir/Transforms/Passes.h.inc"
-
- ParallelLoopCollapsing() = default;
- ParallelLoopCollapsing(const ParallelLoopCollapsing &) {}
+ : public ParallelLoopCollapsingBase<ParallelLoopCollapsing> {
void runOnOperation() override {
Operation *module = getOperation();
});
}
};
-
} // namespace
std::unique_ptr<Pass> mlir::createParallelLoopCollapsingPass() {
--- /dev/null
+//===- 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"
+
+namespace mlir {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Transforms/Passes.h.inc"
+
+} // end namespace mlir
+
+#endif // TRANSFORMS_PASSDETAIL_H_
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/IR/Builders.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopUtils.h"
#include "mlir/Transforms/Utils.h"
#include "llvm/ADT/DenseMap.h"
namespace {
struct PipelineDataTransfer
- : public PassWrapper<PipelineDataTransfer, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_AffinePipelineDataTransfer
-#include "mlir/Transforms/Passes.h.inc"
-
+ : public AffinePipelineDataTransferBase<PipelineDataTransfer> {
void runOnFunction() override;
void runOnAffineForOp(AffineForOp forOp);
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/IR/Function.h"
#include "mlir/IR/Operation.h"
#include "mlir/Pass/Pass.h"
using namespace mlir;
namespace {
-struct StripDebugInfo : public PassWrapper<StripDebugInfo, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_StripDebugInfo
-#include "mlir/Transforms/Passes.h.inc"
-
+struct StripDebugInfo : public StripDebugInfoBase<StripDebugInfo> {
void runOnOperation() override;
};
} // end anonymous namespace
//
//===----------------------------------------------------------------------===//
-#include "mlir/Pass/Pass.h"
+#include "PassDetail.h"
#include "mlir/Transforms/Passes.h"
using namespace mlir;
namespace {
-struct SymbolDCE : public PassWrapper<SymbolDCE, OperationPass<>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_SymbolDCE
-#include "mlir/Transforms/Passes.h.inc"
-
+struct SymbolDCE : public SymbolDCEBase<SymbolDCE> {
void runOnOperation() override;
/// Compute the liveness of the symbols within the given symbol table.
//===----------------------------------------------------------------------===//
#include "mlir/Transforms/ViewOpGraph.h"
+#include "PassDetail.h"
#include "mlir/IR/Block.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/StandardTypes.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/STLExtras.h"
#include "llvm/Support/CommandLine.h"
// PrintOpPass is simple pass to write graph per function.
// Note: this is a module pass only to avoid interleaving on the same ostream
// due to multi-threading over functions.
-struct PrintOpPass : public PassWrapper<PrintOpPass, OperationPass<ModuleOp>> {
-/// Include the generated pass utilities.
-#define GEN_PASS_PrintOpGraph
-#include "mlir/Transforms/Passes.h.inc"
-
+struct PrintOpPass : public PrintOpBase<PrintOpPass> {
explicit PrintOpPass(raw_ostream &os = llvm::errs(), bool short_names = false,
const Twine &title = "")
: os(os), title(title.str()), short_names(short_names) {}
//===----------------------------------------------------------------------===//
#include "mlir/Transforms/ViewRegionGraph.h"
+#include "PassDetail.h"
#include "mlir/IR/RegionGraphTraits.h"
-#include "mlir/Pass/Pass.h"
using namespace mlir;
void mlir::Region::viewGraph() { viewGraph("region"); }
namespace {
-struct PrintCFGPass : public PassWrapper<PrintCFGPass, FunctionPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_PrintCFG
-#include "mlir/Transforms/Passes.h.inc"
-
+struct PrintCFGPass : public PrintCFGBase<PrintCFGPass> {
PrintCFGPass(raw_ostream &os = llvm::errs(), bool shortNames = false,
const Twine &title = "")
: os(os), shortNames(shortNames), title(title.str()) {}
static void emitDocs(const llvm::RecordKeeper &recordKeeper, raw_ostream &os) {
os << "<!-- Autogenerated by mlir-tblgen; don't manually edit -->\n";
- auto passDefs = recordKeeper.getAllDerivedDefinitions("Pass");
+ auto passDefs = recordKeeper.getAllDerivedDefinitions("PassBase");
// Collect the registered passes, sorted by argument name.
SmallVector<Pass, 16> passes(passDefs.begin(), passDefs.end());
/// The code snippet used to generate the start of a pass base class.
///
/// {0}: The def name of the pass record.
-/// {1}: The command line argument for the pass.
+/// {1}: The base class for the pass.
+/// {2): The command line argument for the pass.
const char *const passDeclBegin = R"(
//===----------------------------------------------------------------------===//
// {0}
//===----------------------------------------------------------------------===//
-#ifdef GEN_PASS_{0}
+
+template <typename DerivedT>
+class {0}Base : public {1} {
+public:
+ {0}Base() : {1}(PassID::getID<DerivedT>()) {{}
+ {0}Base(const {0}Base &) : {1}(PassID::getID<DerivedT>()) {{}
+
/// Returns the command-line argument attached to this pass.
- static StringRef getPassArgument() { return "{1}"; }
-)";
+ static llvm::StringRef getPassArgument() { return "{2}"; }
-/// The code snippet used to generate the end of a pass base class.
-///
-/// {0}: The def name of the pass record.
-const char *const passDeclEnd = R"(
-#undef GEN_PASS_{0}
-#endif // GEN_PASS_{0}
+ /// Returns the derived pass name.
+ llvm::StringRef getName() override { return "{0}"; }
+
+ /// Support isa/dyn_cast functionality for the derived pass class.
+ static bool classof(const ::mlir::Pass *pass) {{
+ return pass->getPassID() == ::mlir::PassID::getID<DerivedT>();
+ }
+
+ /// A clone method to create a copy of this pass.
+ std::unique_ptr<Pass> clonePass() const override {{
+ return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
+ }
+
+protected:
)";
/// Emit the declarations for each of the pass options.
static void emitPassDecl(const Pass &pass, raw_ostream &os) {
StringRef defName = pass.getDef()->getName();
- os << llvm::formatv(passDeclBegin, defName, pass.getArgument());
+ os << llvm::formatv(passDeclBegin, defName, pass.getBaseClass(),
+ pass.getArgument());
emitPassOptionDecls(pass, os);
emitPassStatisticDecls(pass, os);
- os << llvm::formatv(passDeclEnd, defName);
+ os << "};\n";
+}
+
+/// Emit the code for registering each of the given passes with the global
+/// PassRegistry.
+static void emitPassDecls(ArrayRef<Pass> passes, raw_ostream &os) {
+ os << "#ifdef GEN_PASS_CLASSES\n";
+ for (const Pass &pass : passes)
+ emitPassDecl(pass, os);
+ os << "#undef GEN_PASS_CLASSES\n";
+ os << "#endif // GEN_PASS_CLASSES\n";
}
//===----------------------------------------------------------------------===//
static void emitDecls(const llvm::RecordKeeper &recordKeeper, raw_ostream &os) {
os << "/* Autogenerated by mlir-tblgen; don't manually edit */\n";
-
std::vector<Pass> passes;
- for (const auto *def : recordKeeper.getAllDerivedDefinitions("Pass")) {
- Pass pass(def);
- passes.push_back(pass);
- emitPassDecl(pass, os);
- }
+ for (const auto *def : recordKeeper.getAllDerivedDefinitions("PassBase"))
+ passes.push_back(Pass(def));
+
+ emitPassDecls(passes, os);
emitRegistration(passes, os);
}