================ @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Implementation of external dialect interfaces for CIR. +// +//===----------------------------------------------------------------------===// + +#include "clang/CIR/Dialect/OpenACC/CIROpenACCTypeInterfaces.h" + +namespace cir::acc { + +template <> +mlir::acc::VariableTypeCategory +OpenACCPointerLikeModel<cir::PointerType>::getPointeeTypeCategory( + mlir::Type pointer, mlir::TypedValue<mlir::acc::PointerLikeType> varPtr, + mlir::Type varType) const { + mlir::Type eleTy = mlir::cast<cir::PointerType>(pointer).getPointee(); + + if (auto mappableTy = mlir::dyn_cast<mlir::acc::MappableType>(eleTy)) + return mappableTy.getTypeCategory(varPtr); + + if (isAnyIntegerOrFloatingPointType(eleTy) || + mlir::isa<cir::BoolType>(eleTy) || mlir::isa<cir::PointerType>(eleTy)) + return mlir::acc::VariableTypeCategory::scalar; ---------------- razvanlupusoru wrote:
Seems the CIR type system allows computation of interior pointers: https://godbolt.org/z/aPn1j5a69 Which means that scalar categorization might capture things which it shouldn't. More specifically, "a member of a composite variable" is not considered a "scalar" in OpenACC terminology - and the CIR type system by itself does not provide the appropriate features to distinguish this. Here is how we dealt with this case in FIR which allows the same: https://github.com/llvm/llvm-project/blob/main/flang/lib/Optimizer/OpenACC/FIROpenACCTypeInterfaces.cpp#L386 https://github.com/llvm/llvm-project/pull/139768 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits