@@ -48,31 +48,6 @@ static void genUnreachable(fir::FirOpBuilder &builder, mlir::Location loc) {
4848 builder.setInsertionPointToStart (newBlock);
4949}
5050
51- // / Initializes values for STAT and ERRMSG
52- static std::pair<mlir::Value, mlir::Value> getStatAndErrmsg (
53- Fortran::lower::AbstractConverter &converter, mlir::Location loc,
54- const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList) {
55- Fortran::lower::StatementContext stmtCtx;
56-
57- mlir::Value errMsgExpr, statExpr;
58- for (const Fortran::parser::StatOrErrmsg &statOrErr : statOrErrList) {
59- std::visit (Fortran::common::visitors{
60- [&](const Fortran::parser::StatVariable &statVar) {
61- statExpr = fir::getBase (converter.genExprAddr (
62- loc, Fortran::semantics::GetExpr (statVar), stmtCtx));
63- },
64- [&](const Fortran::parser::MsgVariable &errMsgVar) {
65- const Fortran::semantics::SomeExpr *expr =
66- Fortran::semantics::GetExpr (errMsgVar);
67- errMsgExpr = fir::getBase (
68- converter.genExprBox (loc, *expr, stmtCtx));
69- }},
70- statOrErr.u );
71- }
72-
73- return {statExpr, errMsgExpr};
74- }
75-
7651// ===----------------------------------------------------------------------===//
7752// Misc. Fortran statements that lower to runtime calls
7853// ===----------------------------------------------------------------------===//
@@ -193,91 +168,6 @@ void Fortran::lower::genUnlockStatement(
193168 TODO (converter.getCurrentLocation (), " coarray: UNLOCK runtime" );
194169}
195170
196- void Fortran::lower::genSyncAllStatement (
197- Fortran::lower::AbstractConverter &converter,
198- const Fortran::parser::SyncAllStmt &stmt) {
199- mlir::Location loc = converter.getCurrentLocation ();
200- converter.checkCoarrayEnabled ();
201-
202- // Handle STAT and ERRMSG values
203- const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList = stmt.v ;
204- auto [statAddr, errMsgAddr] = getStatAndErrmsg (converter, loc, statOrErrList);
205-
206- fir::FirOpBuilder &builder = converter.getFirOpBuilder ();
207- mif::SyncAllOp::create (builder, loc, statAddr, errMsgAddr);
208- }
209-
210- void Fortran::lower::genSyncImagesStatement (
211- Fortran::lower::AbstractConverter &converter,
212- const Fortran::parser::SyncImagesStmt &stmt) {
213- mlir::Location loc = converter.getCurrentLocation ();
214- converter.checkCoarrayEnabled ();
215- fir::FirOpBuilder &builder = converter.getFirOpBuilder ();
216-
217- // Handle STAT and ERRMSG values
218- const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList =
219- std::get<std::list<Fortran::parser::StatOrErrmsg>>(stmt.t );
220- auto [statAddr, errMsgAddr] = getStatAndErrmsg (converter, loc, statOrErrList);
221-
222- // SYNC_IMAGES(*) is passed as count == -1 while SYNC IMAGES([]) has count
223- // == 0. Note further that SYNC IMAGES(*) is not semantically equivalent to
224- // SYNC ALL.
225- Fortran::lower::StatementContext stmtCtx;
226- mlir::Value imageSet;
227- const Fortran::parser::SyncImagesStmt::ImageSet &imgSet =
228- std::get<Fortran::parser::SyncImagesStmt::ImageSet>(stmt.t );
229- std::visit (Fortran::common::visitors{
230- [&](const Fortran::parser::IntExpr &intExpr) {
231- const SomeExpr *expr = Fortran::semantics::GetExpr (intExpr);
232- imageSet =
233- fir::getBase (converter.genExprBox (loc, *expr, stmtCtx));
234- },
235- [&](const Fortran::parser::Star &) {
236- // Image set is not set.
237- imageSet = mlir::Value{};
238- }},
239- imgSet.u );
240-
241- mif::SyncImagesOp::create (builder, loc, imageSet, statAddr, errMsgAddr);
242- }
243-
244- void Fortran::lower::genSyncMemoryStatement (
245- Fortran::lower::AbstractConverter &converter,
246- const Fortran::parser::SyncMemoryStmt &stmt) {
247- mlir::Location loc = converter.getCurrentLocation ();
248- converter.checkCoarrayEnabled ();
249-
250- // Handle STAT and ERRMSG values
251- const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList = stmt.v ;
252- auto [statAddr, errMsgAddr] = getStatAndErrmsg (converter, loc, statOrErrList);
253-
254- fir::FirOpBuilder &builder = converter.getFirOpBuilder ();
255- mif::SyncMemoryOp::create (builder, loc, statAddr, errMsgAddr);
256- }
257-
258- void Fortran::lower::genSyncTeamStatement (
259- Fortran::lower::AbstractConverter &converter,
260- const Fortran::parser::SyncTeamStmt &stmt) {
261- mlir::Location loc = converter.getCurrentLocation ();
262- converter.checkCoarrayEnabled ();
263-
264- // Handle TEAM
265- Fortran::lower::StatementContext stmtCtx;
266- const Fortran::parser::TeamValue &teamValue =
267- std::get<Fortran::parser::TeamValue>(stmt.t );
268- const SomeExpr *teamExpr = Fortran::semantics::GetExpr (teamValue);
269- mlir::Value team =
270- fir::getBase (converter.genExprBox (loc, *teamExpr, stmtCtx));
271-
272- // Handle STAT and ERRMSG values
273- const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList =
274- std::get<std::list<Fortran::parser::StatOrErrmsg>>(stmt.t );
275- auto [statAddr, errMsgAddr] = getStatAndErrmsg (converter, loc, statOrErrList);
276-
277- fir::FirOpBuilder &builder = converter.getFirOpBuilder ();
278- mif::SyncTeamOp::create (builder, loc, team, statAddr, errMsgAddr);
279- }
280-
281171void Fortran::lower::genPauseStatement (
282172 Fortran::lower::AbstractConverter &converter,
283173 const Fortran::parser::PauseStmt &) {
0 commit comments