1 //===- LinkAllPassesAndDialects.h - MLIR Registration -----------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file defines a helper to trigger the registration of all dialects and 10 // passes to the system. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef MLIR_INITALLPASSES_H_ 15 #define MLIR_INITALLPASSES_H_ 16 17 #include "mlir/Conversion/Passes.h" 18 #include "mlir/Dialect/Affine/Passes.h" 19 #include "mlir/Dialect/Async/Passes.h" 20 #include "mlir/Dialect/GPU/Passes.h" 21 #include "mlir/Dialect/LLVMIR/Transforms/Passes.h" 22 #include "mlir/Dialect/Linalg/Passes.h" 23 #include "mlir/Dialect/Quant/Passes.h" 24 #include "mlir/Dialect/SCF/Passes.h" 25 #include "mlir/Dialect/SPIRV/Passes.h" 26 #include "mlir/Dialect/Shape/Transforms/Passes.h" 27 #include "mlir/Dialect/StandardOps/Transforms/Passes.h" 28 #include "mlir/Dialect/Tosa/Transforms/Passes.h" 29 #include "mlir/Transforms/Passes.h" 30 31 #include <cstdlib> 32 33 namespace mlir { 34 35 // This function may be called to register the MLIR passes with the 36 // global registry. 37 // If you're building a compiler, you likely don't need this: you would build a 38 // pipeline programmatically without the need to register with the global 39 // registry, since it would already be calling the creation routine of the 40 // individual passes. 41 // The global registry is interesting to interact with the command-line tools. registerAllPasses()42inline void registerAllPasses() { 43 // General passes 44 registerTransformsPasses(); 45 46 // Conversion passes 47 registerConversionPasses(); 48 49 // Dialect passes 50 registerAffinePasses(); 51 registerAsyncPasses(); 52 registerGPUPasses(); 53 registerLinalgPasses(); 54 LLVM::registerLLVMPasses(); 55 quant::registerQuantPasses(); 56 registerSCFPasses(); 57 registerShapePasses(); 58 spirv::registerSPIRVPasses(); 59 registerStandardPasses(); 60 tosa::registerTosaOptPasses(); 61 } 62 63 } // namespace mlir 64 65 #endif // MLIR_INITALLPASSES_H_ 66