diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -1503,19 +1503,19 @@ //===--------------------------------------------------------------------===// void genFIR(const Fortran::parser::EventPostStmt &stmt) { - TODO(toLocation(), "EventPostStmt lowering"); + genEventPostStatement(*this, stmt); } void genFIR(const Fortran::parser::EventWaitStmt &stmt) { - TODO(toLocation(), "EventWaitStmt lowering"); + genEventWaitStatement(*this, stmt); } void genFIR(const Fortran::parser::FormTeamStmt &stmt) { - TODO(toLocation(), "FormTeamStmt lowering"); + genFormTeamStatement(*this, getEval(), stmt); } void genFIR(const Fortran::parser::LockStmt &stmt) { - TODO(toLocation(), "LockStmt lowering"); + genLockStatement(*this, stmt); } fir::ExtendedValue @@ -1883,23 +1883,23 @@ } void genFIR(const Fortran::parser::SyncAllStmt &stmt) { - TODO(toLocation(), "SyncAllStmt lowering"); + genSyncAllStatement(*this, stmt); } void genFIR(const Fortran::parser::SyncImagesStmt &stmt) { - TODO(toLocation(), "SyncImagesStmt lowering"); + genSyncImagesStatement(*this, stmt); } void genFIR(const Fortran::parser::SyncMemoryStmt &stmt) { - TODO(toLocation(), "SyncMemoryStmt lowering"); + genSyncMemoryStatement(*this, stmt); } void genFIR(const Fortran::parser::SyncTeamStmt &stmt) { - TODO(toLocation(), "SyncTeamStmt lowering"); + genSyncTeamStatement(*this, stmt); } void genFIR(const Fortran::parser::UnlockStmt &stmt) { - TODO(toLocation(), "UnlockStmt lowering"); + genUnlockStatement(*this, stmt); } void genFIR(const Fortran::parser::AssignStmt &stmt) { diff --git a/flang/lib/Lower/Runtime.cpp b/flang/lib/Lower/Runtime.cpp --- a/flang/lib/Lower/Runtime.cpp +++ b/flang/lib/Lower/Runtime.cpp @@ -25,6 +25,14 @@ using namespace Fortran::runtime; +// TODO: We don't have runtime library support for various features. When they +// are encountered, we emit an error message and exit immediately. +static void noRuntimeSupport(mlir::Location loc, llvm::StringRef stmt) { + mlir::emitError(loc, "There is no runtime support for ") + << stmt << " statement.\n"; + std::exit(1); +} + /// Runtime calls that do not return to the caller indicate this condition by /// terminating the current basic block with an unreachable op. static void genUnreachable(fir::FirOpBuilder &builder, mlir::Location loc) { @@ -107,6 +115,72 @@ genUnreachable(builder, loc); } +void Fortran::lower::genFailImageStatement( + Fortran::lower::AbstractConverter &converter) { + fir::FirOpBuilder &builder = converter.getFirOpBuilder(); + mlir::Location loc = converter.getCurrentLocation(); + mlir::FuncOp callee = + fir::runtime::getRuntimeFunc(loc, builder); + builder.create(loc, callee, llvm::None); + genUnreachable(builder, loc); +} + +void Fortran::lower::genEventPostStatement( + Fortran::lower::AbstractConverter &converter, + const Fortran::parser::EventPostStmt &) { + // FIXME: There is no runtime call to make for this yet. + noRuntimeSupport(converter.getCurrentLocation(), "EVENT POST"); +} + +void Fortran::lower::genEventWaitStatement( + Fortran::lower::AbstractConverter &converter, + const Fortran::parser::EventWaitStmt &) { + // FIXME: There is no runtime call to make for this yet. + noRuntimeSupport(converter.getCurrentLocation(), "EVENT WAIT"); +} + +void Fortran::lower::genLockStatement( + Fortran::lower::AbstractConverter &converter, + const Fortran::parser::LockStmt &) { + // FIXME: There is no runtime call to make for this yet. + noRuntimeSupport(converter.getCurrentLocation(), "LOCK"); +} + +void Fortran::lower::genUnlockStatement( + Fortran::lower::AbstractConverter &converter, + const Fortran::parser::UnlockStmt &) { + // FIXME: There is no runtime call to make for this yet. + noRuntimeSupport(converter.getCurrentLocation(), "UNLOCK"); +} + +void Fortran::lower::genSyncAllStatement( + Fortran::lower::AbstractConverter &converter, + const Fortran::parser::SyncAllStmt &) { + // FIXME: There is no runtime call to make for this yet. + noRuntimeSupport(converter.getCurrentLocation(), "SYNC ALL"); +} + +void Fortran::lower::genSyncImagesStatement( + Fortran::lower::AbstractConverter &converter, + const Fortran::parser::SyncImagesStmt &) { + // FIXME: There is no runtime call to make for this yet. + noRuntimeSupport(converter.getCurrentLocation(), "SYNC IMAGES"); +} + +void Fortran::lower::genSyncMemoryStatement( + Fortran::lower::AbstractConverter &converter, + const Fortran::parser::SyncMemoryStmt &) { + // FIXME: There is no runtime call to make for this yet. + noRuntimeSupport(converter.getCurrentLocation(), "SYNC MEMORY"); +} + +void Fortran::lower::genSyncTeamStatement( + Fortran::lower::AbstractConverter &converter, + const Fortran::parser::SyncTeamStmt &) { + // FIXME: There is no runtime call to make for this yet. + noRuntimeSupport(converter.getCurrentLocation(), "SYNC TEAM"); +} + void Fortran::lower::genPauseStatement( Fortran::lower::AbstractConverter &converter, const Fortran::parser::PauseStmt &) {