| 1 | //===-- RegisterOpenACCExtensions.cpp -------------------------------------===// |
| 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 | // Registration for OpenACC extensions as applied to FIR dialect. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "flang/Optimizer/OpenACC/RegisterOpenACCExtensions.h" |
| 14 | #include "flang/Optimizer/Dialect/FIRDialect.h" |
| 15 | #include "flang/Optimizer/Dialect/FIRType.h" |
| 16 | #include "flang/Optimizer/OpenACC/FIROpenACCTypeInterfaces.h" |
| 17 | |
| 18 | namespace fir::acc { |
| 19 | void registerOpenACCExtensions(mlir::DialectRegistry ®istry) { |
| 20 | registry.addExtension(+[](mlir::MLIRContext *ctx, |
| 21 | fir::FIROpsDialect *dialect) { |
| 22 | fir::SequenceType::attachInterface<OpenACCMappableModel<fir::SequenceType>>( |
| 23 | *ctx); |
| 24 | fir::BoxType::attachInterface<OpenACCMappableModel<fir::BaseBoxType>>(*ctx); |
| 25 | fir::ClassType::attachInterface<OpenACCMappableModel<fir::BaseBoxType>>( |
| 26 | *ctx); |
| 27 | |
| 28 | fir::ReferenceType::attachInterface< |
| 29 | OpenACCPointerLikeModel<fir::ReferenceType>>(*ctx); |
| 30 | fir::PointerType::attachInterface< |
| 31 | OpenACCPointerLikeModel<fir::PointerType>>(*ctx); |
| 32 | fir::HeapType::attachInterface<OpenACCPointerLikeModel<fir::HeapType>>( |
| 33 | *ctx); |
| 34 | fir::LLVMPointerType::attachInterface< |
| 35 | OpenACCPointerLikeModel<fir::LLVMPointerType>>(*ctx); |
| 36 | }); |
| 37 | registerAttrsExtensions(registry); |
| 38 | } |
| 39 | |
| 40 | } // namespace fir::acc |
| 41 | |