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/Operation.h"
19#include "mlir/IR/Value.h"
20#include <string>
21
22namespace fir {
23namespace acc {
24
31std::string getVariableName(mlir::Value v, bool preferDemangledName = true);
32
45std::string getRecipeName(mlir::acc::RecipeKind kind, mlir::Type type,
46 mlir::Value var = nullptr,
47 llvm::ArrayRef<mlir::Value> bounds = {},
48 mlir::acc::ReductionOperator reductionOp =
49 mlir::acc::ReductionOperator::AccNone);
50
54bool areAllBoundsConstant(llvm::ArrayRef<mlir::Value> bounds);
55
62mlir::SymbolRefAttr
63createOrGetPrivateRecipe(mlir::OpBuilder &builder, mlir::Location loc,
64 mlir::Value var,
65 llvm::SmallVector<mlir::Value> &dataBoundOps);
66
73mlir::SymbolRefAttr
74createOrGetFirstprivateRecipe(mlir::OpBuilder &builder, mlir::Location loc,
75 mlir::Value var,
76 llvm::SmallVector<mlir::Value> &dataBoundOps);
77
86mlir::SymbolRefAttr
87createOrGetReductionRecipe(mlir::OpBuilder &builder, mlir::Location loc,
88 mlir::Value var, mlir::acc::ReductionOperator op,
89 llvm::SmallVector<mlir::Value> &dataBoundOps,
90 mlir::Attribute fastMathAttr = {});
91
98mlir::Value getOriginalDef(mlir::Value value, bool stripDeclare = true);
99
100} // namespace acc
101} // namespace fir
102
103#endif // FORTRAN_OPTIMIZER_OPENACC_SUPPORT_FIROPENACCUTILS_H
Definition AbstractConverter.h:37