[flang-commits] [flang] [flang][Lower] Add lowering to SYNC ALL, SYNC MEMORY and SYNC IMAGES to PRIF (PR #154166)
Jean-Didier PAILLEUX via flang-commits
flang-commits at lists.llvm.org
Wed Aug 20 06:09:24 PDT 2025
================
@@ -48,6 +49,51 @@ static void genUnreachable(fir::FirOpBuilder &builder, mlir::Location loc) {
builder.setInsertionPointToStart(newBlock);
}
+// Check support of Multi-image features if -fcoarray is provided
+void checkCoarrayEnabled(Fortran::lower::AbstractConverter &converter,
+ mlir::Location loc) {
+ if (!converter.getFoldingContext().languageFeatures().IsEnabled(
+ Fortran::common::LanguageFeature::Coarray))
+ fir::emitFatalError(loc, "Coarrays disabled, use '-fcoarray' to enable.",
+ false);
+}
+
+/// Initializes values for STAT and ERRMSG
+static std::pair<mlir::Value, mlir::Value> getStatAndErrmsg(
+ Fortran::lower::AbstractConverter &converter, mlir::Location loc,
+ const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList) {
+ fir::FirOpBuilder &builder = converter.getFirOpBuilder();
+ Fortran::lower::StatementContext stmtCtx;
+ fir::ExtendedValue errMsgExpr, statExpr;
+
+ mlir::Value statAddr, errMsgAddr;
+ for (const Fortran::parser::StatOrErrmsg &statOrErr : statOrErrList) {
+ std::visit(Fortran::common::visitors{
+ [&](const Fortran::parser::StatVariable &statVar) {
+ statExpr = converter.genExprAddr(
+ loc, Fortran::semantics::GetExpr(statVar), stmtCtx);
+ statAddr = fir::getBase(statExpr);
+ },
+ [&](const Fortran::parser::MsgVariable &errMsgVar) {
+ fir::ExtendedValue errMsgExpr = converter.genExprAddr(
+ loc, Fortran::semantics::GetExpr(errMsgVar), stmtCtx);
+ errMsgAddr = builder.createBox(loc, errMsgExpr);
----------------
JDPailleux wrote:
I see what you mean. I've updated the code in line with what was suggested.
https://github.com/llvm/llvm-project/pull/154166
More information about the flang-commits
mailing list