| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 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 | #include "clang/CIR/InitAllDialects.h" |
| 10 | |
| 11 | #include "mlir/Dialect/Arith/IR/Arith.h" |
| 12 | #include "mlir/Dialect/DLTI/DLTI.h" |
| 13 | #include "mlir/Dialect/LLVMIR/LLVMDialectDecl.h" |
| 14 | #include "mlir/Dialect/OpenACC/OpenACC.h" |
| 15 | #include "mlir/Dialect/OpenMP/OpenMPDialect.h" |
| 16 | #include "mlir/IR/BuiltinDialect.h" |
| 17 | #include "mlir/IR/MLIRContext.h" |
| 18 | |
| 19 | #include "clang/CIR/Dialect/IR/CIRDialect.h" |
| 20 | #include "clang/CIR/Dialect/OpenACC/RegisterOpenACCExtensions.h" |
| 21 | #include "clang/CIR/Dialect/OpenMP/RegisterOpenMPExtensions.h" |
| 22 | |
| 23 | namespace cir { |
| 24 | |
| 25 | void registerAllDialects(mlir::DialectRegistry ®istry) { |
| 26 | // The LLVM dialect is needed to parse CIR: data layout specs use LLVM |
| 27 | // pointer types as keys. |
| 28 | registry |
| 29 | .insert<mlir::BuiltinDialect, cir::CIRDialect, mlir::arith::ArithDialect, |
| 30 | mlir::DLTIDialect, mlir::LLVM::LLVMDialect, |
| 31 | mlir::omp::OpenMPDialect, mlir::acc::OpenACCDialect>(); |
| 32 | // Register extensions to integrate CIR types with OpenACC and OpenMP. |
| 33 | cir::omp::registerOpenMPExtensions(registry); |
| 34 | cir::acc::registerOpenACCExtensions(registry); |
| 35 | } |
| 36 | |
| 37 | void registerAllDialects(mlir::MLIRContext &context) { |
| 38 | mlir::DialectRegistry registry; |
| 39 | registerAllDialects(registry); |
| 40 | context.appendDialectRegistry(registry); |
| 41 | } |
| 42 | |
| 43 | } // namespace cir |
| 44 |