[flang-commits] [flang] [flang] Adding lowering of TEAMs features to PRIF in MIF Dialect (PR #165573)
Jean-Didier PAILLEUX via flang-commits
flang-commits at lists.llvm.org
Tue Nov 4 06:09:45 PST 2025
================
@@ -33,21 +34,144 @@ void Fortran::lower::genChangeTeamConstruct(
void Fortran::lower::genChangeTeamStmt(
Fortran::lower::AbstractConverter &converter,
Fortran::lower::pft::Evaluation &,
- const Fortran::parser::ChangeTeamStmt &) {
- TODO(converter.getCurrentLocation(), "coarray: CHANGE TEAM statement");
+ const Fortran::parser::ChangeTeamStmt &stmt) {
+ mlir::Location loc = converter.getCurrentLocation();
+ converter.checkCoarrayEnabled();
+ fir::FirOpBuilder &builder = converter.getFirOpBuilder();
+
+ mlir::Value errMsgAddr, statAddr, team;
+ // Handle STAT and ERRMSG values
+ Fortran::lower::StatementContext stmtCtx;
+ const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList =
+ std::get<std::list<Fortran::parser::StatOrErrmsg>>(stmt.t);
+ for (const Fortran::parser::StatOrErrmsg &statOrErr : statOrErrList) {
+ std::visit(Fortran::common::visitors{
+ [&](const Fortran::parser::StatVariable &statVar) {
+ const auto *expr = Fortran::semantics::GetExpr(statVar);
+ statAddr = fir::getBase(
+ converter.genExprAddr(loc, *expr, stmtCtx));
+ },
+ [&](const Fortran::parser::MsgVariable &errMsgVar) {
+ const auto *expr = Fortran::semantics::GetExpr(errMsgVar);
+ errMsgAddr = fir::getBase(
+ converter.genExprBox(loc, *expr, stmtCtx));
+ },
+ },
+ statOrErr.u);
+ }
+
+ // TODO: Manage the list of coarrays associated in
+ // `std::list<CoarrayAssociation>`. According to the PRIF specification, it is
+ // necessary to call `prif_alias_{create|destroy}` for each coarray defined in
+ // this list. Support will be added once lowering to this procedure is
+ // possible.
+ const std::list<Fortran::parser::CoarrayAssociation> &coarrayAssocList =
+ std::get<std::list<Fortran::parser::CoarrayAssociation>>(stmt.t);
+ if (coarrayAssocList.size())
+ mlir::emitWarning(loc,
----------------
JDPailleux wrote:
Um, yes, you're right
https://github.com/llvm/llvm-project/pull/165573
More information about the flang-commits
mailing list