FLANG
FIROpenACCUtils.h
1//===- FIROpenACCUtils.h - FIR OpenACC Utilities ----------------*- 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// This file declares utility functions for FIR OpenACC support.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef FORTRAN_OPTIMIZER_OPENACC_SUPPORT_FIROPENACCUTILS_H
14#define FORTRAN_OPTIMIZER_OPENACC_SUPPORT_FIROPENACCUTILS_H
15
16#include "mlir/Dialect/OpenACC/OpenACC.h"
17#include "mlir/IR/Builders.h"
18#include "mlir/IR/Value.h"
19#include <string>
20
21namespace fir {
22namespace acc {
23
30std::string getVariableName(mlir::Value v, bool preferDemangledName = true);
31
44std::string getRecipeName(mlir::acc::RecipeKind kind, mlir::Type type,
45 mlir::Value var = nullptr,
46 llvm::ArrayRef<mlir::Value> bounds = {},
47 mlir::acc::ReductionOperator reductionOp =
48 mlir::acc::ReductionOperator::AccNone);
49
53bool areAllBoundsConstant(llvm::ArrayRef<mlir::Value> bounds);
54
61mlir::SymbolRefAttr
62createOrGetPrivateRecipe(mlir::OpBuilder &builder, mlir::Location loc,
63 mlir::Type ty,
64 llvm::SmallVector<mlir::Value> &dataBoundOps);
65
72mlir::SymbolRefAttr
73createOrGetFirstprivateRecipe(mlir::OpBuilder &builder, mlir::Location loc,
74 mlir::Type ty,
75 llvm::SmallVector<mlir::Value> &dataBoundOps);
76
85mlir::SymbolRefAttr
86createOrGetReductionRecipe(mlir::OpBuilder &builder, mlir::Location loc,
87 mlir::Type ty, mlir::acc::ReductionOperator op,
88 llvm::SmallVector<mlir::Value> &dataBoundOps,
89 mlir::Attribute fastMathAttr = {});
90
97mlir::Value getOriginalDef(mlir::Value value, bool stripDeclare = true);
98
99} // namespace acc
100} // namespace fir
101
102#endif // FORTRAN_OPTIMIZER_OPENACC_SUPPORT_FIROPENACCUTILS_H
Definition AbstractConverter.h:37