1 //===-- Optimizer/Transforms/Utils.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_OPTIMIZER_TRANSFORMS_UTILS_H 14 #define FORTRAN_OPTIMIZER_TRANSFORMS_UTILS_H 15 16 namespace fir { 17 18 using MinlocBodyOpGeneratorTy = llvm::function_ref<mlir::Value( 19 fir::FirOpBuilder &, mlir::Location, const mlir::Type &, mlir::Value, 20 mlir::Value, mlir::Value, const llvm::SmallVectorImpl<mlir::Value> &)>; 21 using InitValGeneratorTy = llvm::function_ref<mlir::Value( 22 fir::FirOpBuilder &, mlir::Location, const mlir::Type &)>; 23 using AddrGeneratorTy = llvm::function_ref<mlir::Value( 24 fir::FirOpBuilder &, mlir::Location, const mlir::Type &, mlir::Value, 25 mlir::Value)>; 26 27 // Produces a loop nest for a Minloc intrinsic. 28 void genMinMaxlocReductionLoop(fir::FirOpBuilder &builder, mlir::Value array, 29 fir::InitValGeneratorTy initVal, 30 fir::MinlocBodyOpGeneratorTy genBody, 31 fir::AddrGeneratorTy getAddrFn, unsigned rank, 32 mlir::Type elementType, mlir::Location loc, 33 mlir::Type maskElemType, mlir::Value resultArr, 34 bool maskMayBeLogicalScalar); 35 36 } // namespace fir 37 38 #endif // FORTRAN_OPTIMIZER_TRANSFORMS_UTILS_H 39