1 //===-- Lower/OpenMP/PrivateReductionUtils.h --------------------*- 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 // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/ 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef FORTRAN_LOWER_OPENMP_PRIVATEREDUCTIONUTILS_H 14 #define FORTRAN_LOWER_OPENMP_PRIVATEREDUCTIONUTILS_H 15 16 #include "mlir/IR/Location.h" 17 #include "mlir/IR/Value.h" 18 19 namespace mlir { 20 class Region; 21 } // namespace mlir 22 23 namespace fir { 24 class FirOpBuilder; 25 class ShapeShiftOp; 26 } // namespace fir 27 28 namespace Fortran { 29 namespace lower { 30 namespace omp { 31 32 /// Generate init and cleanup regions suitable for reduction or privatizer 33 /// declarations. `scalarInitValue` may be nullptr if there is no default 34 /// initialization (for privatization). 35 void populateByRefInitAndCleanupRegions(fir::FirOpBuilder &builder, 36 mlir::Location loc, mlir::Type argType, 37 mlir::Value scalarInitValue, 38 mlir::Block *initBlock, 39 mlir::Value allocatedPrivVarArg, 40 mlir::Value moldArg, 41 mlir::Region &cleanupRegion); 42 43 /// Generate a fir::ShapeShift op describing the provided boxed array. 44 fir::ShapeShiftOp getShapeShift(fir::FirOpBuilder &builder, mlir::Location loc, 45 mlir::Value box); 46 47 } // namespace omp 48 } // namespace lower 49 } // namespace Fortran 50 51 #endif // FORTRAN_LOWER_OPENMP_PRIVATEREDUCTIONUTILS_H 52