diff --git a/mlir/include/mlir/Dialect/OpenMP/CMakeLists.txt b/mlir/include/mlir/Dialect/OpenMP/CMakeLists.txt --- a/mlir/include/mlir/Dialect/OpenMP/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/OpenMP/CMakeLists.txt @@ -21,3 +21,10 @@ mlir_tablegen(OpenMPTypeInterfaces.cpp.inc -gen-type-interface-defs) add_public_tablegen_target(MLIROpenMPTypeInterfacesIncGen) add_dependencies(mlir-generic-headers MLIROpenMPTypeInterfacesIncGen) + +set(LLVM_TARGET_DEFINITIONS OpenMPPasses.td) +mlir_tablegen(OpenMPPasses.h.inc -gen-pass-decls -name OpenMP) +mlir_tablegen(OpenMPPasses.capi.h.inc -gen-pass-capi-header --prefix OpenMP) +mlir_tablegen(OpenMPPasses.capi.cpp.inc -gen-pass-capi-impl --prefix OpenMP) +add_public_tablegen_target(MLIROpenMPPassIncGen) +add_mlir_doc(Passes OpenMPPasses ./ -gen-pass-doc) diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPPasses.h b/mlir/include/mlir/Dialect/OpenMP/OpenMPPasses.h new file mode 100644 --- /dev/null +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPPasses.h @@ -0,0 +1,37 @@ +//===- OpenMPPasses.h - OpenMP pass entry points ----------------*- 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 +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes that expose pass constructors. +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_DIALECT_OPENMP_OPENMPPASSES_H_ +#define MLIR_DIALECT_OPENMP_OPENMPPASSES_H_ + +#include "mlir/Pass/Pass.h" + +namespace mlir { +namespace omp { + +#define GEN_PASS_DECL +#include "mlir/Dialect/OpenMP/OpenMPPasses.h.inc" + +// TODO Add "std::unique_ptr createPass();" declarations + +} // namespace omp + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/OpenMP/OpenMPPasses.h.inc" + +} // namespace mlir + +#endif // MLIR_DIALECT_OPENMP_OPENMPPASSES_H_ diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPPasses.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPPasses.td new file mode 100644 --- /dev/null +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPPasses.td @@ -0,0 +1,16 @@ +//===-- OpenMPPasses.td - OpenMp pass definition file ------*- tablegen -*-===// +// +// 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_OPENMP_OPENMPPASSES_TD_ +#define MLIR_DIALECT_OPENMP_OPENMPPASSES_TD_ + +include "mlir/Pass/PassBase.td" + +// TODO Add transform pass definitions + +#endif // MLIR_DIALECT_OPENMP_OPENMPPASSES_TD_ diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h --- a/mlir/include/mlir/InitAllPasses.h +++ b/mlir/include/mlir/InitAllPasses.h @@ -28,6 +28,7 @@ #include "mlir/Dialect/Math/Transforms/Passes.h" #include "mlir/Dialect/MemRef/Transforms/Passes.h" #include "mlir/Dialect/NVGPU/Passes.h" +#include "mlir/Dialect/OpenMP/OpenMPPasses.h" #include "mlir/Dialect/SCF/Transforms/Passes.h" #include "mlir/Dialect/SPIRV/Transforms/Passes.h" #include "mlir/Dialect/Shape/Transforms/Passes.h" @@ -73,6 +74,7 @@ LLVM::registerLLVMPasses(); math::registerMathPasses(); memref::registerMemRefPasses(); + registerOpenMPPasses(); registerSCFPasses(); registerShapePasses(); spirv::registerSPIRVPasses(); diff --git a/mlir/lib/Dialect/OpenMP/CMakeLists.txt b/mlir/lib/Dialect/OpenMP/CMakeLists.txt --- a/mlir/lib/Dialect/OpenMP/CMakeLists.txt +++ b/mlir/lib/Dialect/OpenMP/CMakeLists.txt @@ -14,3 +14,5 @@ MLIRLLVMDialect MLIRFuncDialect ) + +add_subdirectory(Transforms) diff --git a/mlir/lib/Dialect/OpenMP/Transforms/CMakeLists.txt b/mlir/lib/Dialect/OpenMP/Transforms/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/mlir/lib/Dialect/OpenMP/Transforms/CMakeLists.txt @@ -0,0 +1,15 @@ +add_mlir_dialect_library(MLIROpenMPTransforms + # TODO Add a source file for each pass + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenMP + + DEPENDS + MLIROpenMPPassIncGen + + LINK_LIBS PUBLIC + MLIRIR + MLIROpenMPDialect + MLIRPass + MLIRTransforms +)