1 //===-- Lower/Runtime.h -- Fortran runtime codegen interface ----*- 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 // Builder routines for constructing the FIR dialect of MLIR. As FIR is a 10 // dialect of MLIR, it makes extensive use of MLIR interfaces and MLIR's coding 11 // style (https://mlir.llvm.org/getting_started/DeveloperGuide/) is used in this 12 // module. 13 // 14 //===----------------------------------------------------------------------===// 15 16 #ifndef FORTRAN_LOWER_RUNTIME_H 17 #define FORTRAN_LOWER_RUNTIME_H 18 19 #include <optional> 20 21 namespace mlir { 22 class Location; 23 class Value; 24 } // namespace mlir 25 26 namespace fir { 27 class CharBoxValue; 28 class FirOpBuilder; 29 } // namespace fir 30 31 namespace Fortran { 32 33 namespace parser { 34 struct EventPostStmt; 35 struct EventWaitStmt; 36 struct LockStmt; 37 struct NotifyWaitStmt; 38 struct PauseStmt; 39 struct StopStmt; 40 struct SyncAllStmt; 41 struct SyncImagesStmt; 42 struct SyncMemoryStmt; 43 struct SyncTeamStmt; 44 struct UnlockStmt; 45 } // namespace parser 46 47 namespace lower { 48 49 class AbstractConverter; 50 51 // Lowering of Fortran statement related runtime (other than IO and maths) 52 53 void genNotifyWaitStatement(AbstractConverter &, 54 const parser::NotifyWaitStmt &); 55 void genEventPostStatement(AbstractConverter &, const parser::EventPostStmt &); 56 void genEventWaitStatement(AbstractConverter &, const parser::EventWaitStmt &); 57 void genLockStatement(AbstractConverter &, const parser::LockStmt &); 58 void genFailImageStatement(AbstractConverter &); 59 void genStopStatement(AbstractConverter &, const parser::StopStmt &); 60 void genSyncAllStatement(AbstractConverter &, const parser::SyncAllStmt &); 61 void genSyncImagesStatement(AbstractConverter &, 62 const parser::SyncImagesStmt &); 63 void genSyncMemoryStatement(AbstractConverter &, 64 const parser::SyncMemoryStmt &); 65 void genSyncTeamStatement(AbstractConverter &, const parser::SyncTeamStmt &); 66 void genUnlockStatement(AbstractConverter &, const parser::UnlockStmt &); 67 void genPauseStatement(AbstractConverter &, const parser::PauseStmt &); 68 69 void genPointerAssociate(fir::FirOpBuilder &, mlir::Location, 70 mlir::Value pointer, mlir::Value target); 71 void genPointerAssociateRemapping(fir::FirOpBuilder &, mlir::Location, 72 mlir::Value pointer, mlir::Value target, 73 mlir::Value bounds); 74 void genPointerAssociateLowerBounds(fir::FirOpBuilder &, mlir::Location, 75 mlir::Value pointer, mlir::Value target, 76 mlir::Value lbounds); 77 } // namespace lower 78 } // namespace Fortran 79 80 #endif // FORTRAN_LOWER_RUNTIME_H 81