1 //===-- Lower/Coarray.h -- image related lowering ---------------*- 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 #ifndef FORTRAN_LOWER_COARRAY_H 10 #define FORTRAN_LOWER_COARRAY_H 11 12 #include "flang/Lower/AbstractConverter.h" 13 #include "flang/Optimizer/Builder/BoxValue.h" 14 15 namespace Fortran { 16 17 namespace parser { 18 struct ChangeTeamConstruct; 19 struct ChangeTeamStmt; 20 struct EndChangeTeamStmt; 21 struct FormTeamStmt; 22 } // namespace parser 23 24 namespace evaluate { 25 class CoarrayRef; 26 } // namespace evaluate 27 28 namespace lower { 29 30 class SymMap; 31 32 namespace pft { 33 struct Evaluation; 34 } // namespace pft 35 36 //===----------------------------------------------------------------------===// 37 // TEAM constructs 38 //===----------------------------------------------------------------------===// 39 40 void genChangeTeamConstruct(AbstractConverter &, pft::Evaluation &eval, 41 const parser::ChangeTeamConstruct &); 42 void genChangeTeamStmt(AbstractConverter &, pft::Evaluation &eval, 43 const parser::ChangeTeamStmt &); 44 void genEndChangeTeamStmt(AbstractConverter &, pft::Evaluation &eval, 45 const parser::EndChangeTeamStmt &); 46 void genFormTeamStatement(AbstractConverter &, pft::Evaluation &eval, 47 const parser::FormTeamStmt &); 48 49 //===----------------------------------------------------------------------===// 50 // COARRAY expressions 51 //===----------------------------------------------------------------------===// 52 53 /// Coarray expression lowering helper. A coarray expression is expected to be 54 /// lowered into runtime support calls. For example, expressions may use a 55 /// message-passing runtime to access another image's data. 56 class CoarrayExprHelper { 57 public: CoarrayExprHelper(AbstractConverter & converter,mlir::Location loc,SymMap & syms)58 explicit CoarrayExprHelper(AbstractConverter &converter, mlir::Location loc, 59 SymMap &syms) 60 : converter{converter}, symMap{syms}, loc{loc} {} 61 CoarrayExprHelper(const CoarrayExprHelper &) = delete; 62 63 /// Generate the address of a co-array expression. 64 fir::ExtendedValue genAddr(const evaluate::CoarrayRef &expr); 65 66 /// Generate the value of a co-array expression. 67 fir::ExtendedValue genValue(const evaluate::CoarrayRef &expr); 68 69 private: 70 AbstractConverter &converter; 71 SymMap &symMap; 72 mlir::Location loc; 73 }; 74 75 } // namespace lower 76 } // namespace Fortran 77 78 #endif // FORTRAN_LOWER_COARRAY_H 79