Lines Matching refs:Fortran

69   explicit IncrementLoopInfo(Fortran::semantics::Symbol &sym, const T &lower,  in IncrementLoopInfo()
72 : loopVariableSym{sym}, lowerExpr{Fortran::semantics::GetExpr(lower)}, in IncrementLoopInfo()
73 upperExpr{Fortran::semantics::GetExpr(upper)},
74 stepExpr{Fortran::semantics::GetExpr(step)}, isUnordered{isUnordered} {}
87 const Fortran::semantics::Symbol &loopVariableSym;
88 const Fortran::lower::SomeExpr *lowerExpr;
89 const Fortran::lower::SomeExpr *upperExpr;
90 const Fortran::lower::SomeExpr *stepExpr;
91 const Fortran::lower::SomeExpr *maskExpr = nullptr;
93 llvm::SmallVector<const Fortran::semantics::Symbol *> localInitSymList;
94 llvm::SmallVector<const Fortran::semantics::Symbol *> sharedSymList;
125 Fortran::semantics::SymbolRef symbol;
130 void registerTypeInfoSymbol(Fortran::lower::AbstractConverter &converter, in registerTypeInfoSymbol()
132 Fortran::semantics::SymbolRef typeInfoSym) { in registerTypeInfoSymbol()
145 Fortran::lower::createRuntimeTypeInfoGlobal(converter, loc, in registerTypeInfoSymbol()
149 void createTypeInfoGlobals(Fortran::lower::AbstractConverter &converter) { in createTypeInfoGlobals()
152 Fortran::lower::createRuntimeTypeInfoGlobal(converter, info.loc, in createTypeInfoGlobals()
167 llvm::SmallSetVector<Fortran::semantics::SymbolRef, 64> seen;
180 class FirConverter : public Fortran::lower::AbstractConverter {
182 explicit FirConverter(Fortran::lower::LoweringBridge &bridge) in FirConverter()
187 void run(Fortran::lower::pft::Program &pft) { in run()
203 for (Fortran::lower::pft::Program::Units &u : pft.getUnits()) { in run()
204 std::visit(Fortran::common::visitors{ in run()
205 [&](Fortran::lower::pft::FunctionLikeUnit &f) { in run()
208 [&](Fortran::lower::pft::ModuleLikeUnit &m) { in run()
210 for (Fortran::lower::pft::FunctionLikeUnit &f : in run()
214 [&](Fortran::lower::pft::BlockDataUnit &b) {}, in run()
215 [&](Fortran::lower::pft::CompilerDirectiveUnit &d) {}, in run()
221 for (Fortran::lower::pft::Program::Units &u : pft.getUnits()) { in run()
223 Fortran::common::visitors{ in run()
224 [&](Fortran::lower::pft::FunctionLikeUnit &f) { lowerFunc(f); }, in run()
225 [&](Fortran::lower::pft::ModuleLikeUnit &m) { lowerMod(m); }, in run()
226 [&](Fortran::lower::pft::BlockDataUnit &b) {}, in run()
227 [&](Fortran::lower::pft::CompilerDirectiveUnit &d) { in run()
229 d.get<Fortran::parser::CompilerDirective>().source); in run()
245 void declareFunction(Fortran::lower::pft::FunctionLikeUnit &funit) { in declareFunction()
258 Fortran::lower::CalleeInterface{funit, *this}; in declareFunction()
263 llvm::SetVector<const Fortran::semantics::Symbol *> escapeHost; in declareFunction()
264 for (Fortran::lower::pft::FunctionLikeUnit &f : funit.nestedFunctions) in declareFunction()
269 for (Fortran::lower::pft::FunctionLikeUnit &f : funit.nestedFunctions) in declareFunction()
277 Fortran::lower::pft::FunctionLikeUnit &funit, in collectHostAssociatedVariables()
278 llvm::SetVector<const Fortran::semantics::Symbol *> &escapees) { in collectHostAssociatedVariables()
279 const Fortran::semantics::Scope *internalScope = in collectHostAssociatedVariables()
282 auto addToListIfEscapee = [&](const Fortran::semantics::Symbol &sym) { in collectHostAssociatedVariables()
283 const Fortran::semantics::Symbol &ultimate = sym.GetUltimate(); in collectHostAssociatedVariables()
285 ultimate.detailsIf<Fortran::semantics::NamelistDetails>(); in collectHostAssociatedVariables()
286 if (ultimate.has<Fortran::semantics::ObjectEntityDetails>() || in collectHostAssociatedVariables()
287 Fortran::semantics::IsProcedurePointer(ultimate) || in collectHostAssociatedVariables()
288 Fortran::semantics::IsDummy(sym) || namelistDetails) { in collectHostAssociatedVariables()
289 const Fortran::semantics::Scope &ultimateScope = ultimate.owner(); in collectHostAssociatedVariables()
291 Fortran::semantics::Scope::Kind::MainProgram || in collectHostAssociatedVariables()
292 ultimateScope.kind() == Fortran::semantics::Scope::Kind::Subprogram) in collectHostAssociatedVariables()
310 Fortran::lower::pft::visitAllSymbols(funit, addToListIfEscapee); in collectHostAssociatedVariables()
317 mlir::Value getSymbolAddress(Fortran::lower::SymbolRef sym) override final { in getSymbolAddress()
322 getSymbolExtendedValue(const Fortran::semantics::Symbol &sym) override final { in getSymbolExtendedValue()
323 Fortran::lower::SymbolBox sb = localSymbols.lookupSymbol(sym); in getSymbolExtendedValue()
335 void copySymbolBinding(Fortran::lower::SymbolRef src, in copySymbolBinding()
336 Fortran::lower::SymbolRef target) override final { in copySymbolBinding()
342 bool bindIfNewSymbol(Fortran::lower::SymbolRef sym, in bindIfNewSymbol()
350 void bindSymbol(Fortran::lower::SymbolRef sym, in bindSymbol()
355 bool lookupLabelSet(Fortran::lower::SymbolRef sym, in lookupLabelSet()
356 Fortran::lower::pft::LabelSet &labelSet) override final { in lookupLabelSet()
357 Fortran::lower::pft::FunctionLikeUnit &owningProc = in lookupLabelSet()
366 Fortran::lower::pft::Evaluation *
367 lookupLabel(Fortran::lower::pft::Label label) override final { in lookupLabel()
368 Fortran::lower::pft::FunctionLikeUnit &owningProc = in lookupLabel()
376 fir::ExtendedValue genExprAddr(const Fortran::lower::SomeExpr &expr, in genExprAddr()
377 Fortran::lower::StatementContext &context, in genExprAddr()
379 return Fortran::lower::createSomeExtendedAddress( in genExprAddr()
383 genExprValue(const Fortran::lower::SomeExpr &expr, in genExprValue()
384 Fortran::lower::StatementContext &context, in genExprValue()
386 return Fortran::lower::createSomeExtendedExpression( in genExprValue()
391 genExprBox(mlir::Location loc, const Fortran::lower::SomeExpr &expr, in genExprBox()
392 Fortran::lower::StatementContext &stmtCtx) override final { in genExprBox()
393 return Fortran::lower::createBoxValue(loc, *this, expr, localSymbols, in genExprBox()
397 Fortran::evaluate::FoldingContext &getFoldingContext() override final { in getFoldingContext()
401 mlir::Type genType(const Fortran::lower::SomeExpr &expr) override final { in genType()
402 return Fortran::lower::translateSomeExprToFIRType(*this, expr); in genType()
404 mlir::Type genType(const Fortran::lower::pft::Variable &var) override final { in genType()
405 return Fortran::lower::translateVariableToFIRType(*this, var); in genType()
407 mlir::Type genType(Fortran::lower::SymbolRef sym) override final { in genType()
408 return Fortran::lower::translateSymbolToFIRType(*this, sym); in genType()
411 genType(Fortran::common::TypeCategory tc, int kind, in genType()
413 return Fortran::lower::getFIRType(&getMLIRContext(), tc, kind, in genType()
417 genType(const Fortran::semantics::DerivedTypeSpec &tySpec) override final { in genType()
418 return Fortran::lower::translateDerivedTypeToFIRType(*this, tySpec); in genType()
420 mlir::Type genType(Fortran::common::TypeCategory tc) override final { in genType()
421 return Fortran::lower::getFIRType( in genType()
427 const Fortran::semantics::Symbol &sym) override final { in createHostAssociateVarClone()
430 const auto *details = sym.detailsIf<Fortran::semantics::HostAssocDetails>(); in createHostAssociateVarClone()
432 const Fortran::semantics::Symbol &hsym = details->symbol(); in createHostAssociateVarClone()
433 Fortran::lower::SymbolBox hsb = lookupSymbol(hsym); in createHostAssociateVarClone()
440 sym.GetUltimate().attrs().test(Fortran::semantics::Attr::TARGET)); in createHostAssociateVarClone()
447 const Fortran::semantics::DeclTypeSpec *type = sym.GetType(); in createHostAssociateVarClone()
497 copyHostAssociateVar(const Fortran::semantics::Symbol &sym, in copyHostAssociateVar()
500 assert(sym.has<Fortran::semantics::HostAssocDetails>() && in copyHostAssociateVar()
502 const Fortran::semantics::Symbol &hsym = sym.GetUltimate(); in copyHostAssociateVar()
503 Fortran::lower::SymbolBox hsb = lookupOneLevelUpSymbol(hsym); in copyHostAssociateVar()
508 Fortran::lower::SymbolBox sb = shallowLookupSymbol(sym); in copyHostAssociateVar()
534 Fortran::lower::StatementContext stmtCtx; in copyHostAssociateVar()
535 Fortran::lower::createSomeArrayAssignment(*this, lhs, rhs, localSymbols, in copyHostAssociateVar()
556 Fortran::lower::pft::Evaluation &eval, in collectSymbolSet()
557 llvm::SetVector<const Fortran::semantics::Symbol *> &symbolSet, in collectSymbolSet()
558 Fortran::semantics::Symbol::Flag flag, in collectSymbolSet()
560 auto addToList = [&](const Fortran::semantics::Symbol &sym) { in collectSymbolSet()
561 const Fortran::semantics::Symbol &symbol = in collectSymbolSet()
566 Fortran::lower::pft::visitAllSymbols(eval, addToList); in collectSymbolSet()
579 genLocation(const Fortran::parser::CharBlock &block) override final { in genLocation()
580 if (const Fortran::parser::AllCookedSources *cooked = in genLocation()
582 if (std::optional<std::pair<Fortran::parser::SourcePosition, in genLocation()
583 Fortran::parser::SourcePosition>> in genLocation()
586 Fortran::parser::SourcePosition &filePos = loc->first; in genLocation()
602 mangleName(const Fortran::semantics::Symbol &symbol) override final { in mangleName()
603 return Fortran::lower::mangle::mangleName(symbol); in mangleName()
620 Fortran::lower::SymbolRef typeInfoSym) override final { in registerRuntimeTypeInfo()
634 const Fortran::lower::SomeExpr *expr, in createFIRExpr()
635 Fortran::lower::StatementContext &stmtCtx) { in createFIRExpr()
640 Fortran::lower::SymbolBox
641 lookupSymbol(const Fortran::semantics::Symbol &sym) { in lookupSymbol()
642 if (Fortran::lower::SymbolBox v = localSymbols.lookupSymbol(sym)) in lookupSymbol()
648 Fortran::lower::SymbolBox
649 shallowLookupSymbol(const Fortran::semantics::Symbol &sym) { in shallowLookupSymbol()
650 if (Fortran::lower::SymbolBox v = localSymbols.shallowLookupSymbol(sym)) in shallowLookupSymbol()
657 Fortran::lower::SymbolBox
658 lookupOneLevelUpSymbol(const Fortran::semantics::Symbol &sym) { in lookupOneLevelUpSymbol()
659 if (Fortran::lower::SymbolBox v = localSymbols.lookupOneLevelUpSymbol(sym)) in lookupOneLevelUpSymbol()
667 bool addSymbol(const Fortran::semantics::SymbolRef sym, mlir::Value val, in addSymbol()
675 bool addCharSymbol(const Fortran::semantics::SymbolRef sym, mlir::Value val, in addCharSymbol()
685 fir::ExtendedValue getExtendedValue(Fortran::lower::SymbolBox sb) { in getExtendedValue()
687 [&](const Fortran::lower::SymbolBox::PointerOrAllocatable &box) { in getExtendedValue()
697 const Fortran::semantics::Symbol &sym, in genLoopVariableAddress()
699 if (isUnordered || sym.has<Fortran::semantics::HostAssocDetails>() || in genLoopVariableAddress()
700 sym.has<Fortran::semantics::UseDetails>()) { in genLoopVariableAddress()
713 Fortran::lower::StatementContext stmtCtx; in genLoopVariableAddress()
715 genExprAddr(Fortran::evaluate::AsGenericExpr(sym).value(), stmtCtx)); in genLoopVariableAddress()
718 static bool isNumericScalarCategory(Fortran::common::TypeCategory cat) { in isNumericScalarCategory()
719 return cat == Fortran::common::TypeCategory::Integer || in isNumericScalarCategory()
720 cat == Fortran::common::TypeCategory::Real || in isNumericScalarCategory()
721 cat == Fortran::common::TypeCategory::Complex || in isNumericScalarCategory()
722 cat == Fortran::common::TypeCategory::Logical; in isNumericScalarCategory()
724 static bool isLogicalCategory(Fortran::common::TypeCategory cat) { in isLogicalCategory()
725 return cat == Fortran::common::TypeCategory::Logical; in isLogicalCategory()
727 static bool isCharacterCategory(Fortran::common::TypeCategory cat) { in isCharacterCategory()
728 return cat == Fortran::common::TypeCategory::Character; in isCharacterCategory()
730 static bool isDerivedCategory(Fortran::common::TypeCategory cat) { in isDerivedCategory()
731 return cat == Fortran::common::TypeCategory::Derived; in isDerivedCategory()
742 mlir::Block *blockOfLabel(Fortran::lower::pft::Evaluation &eval, in blockOfLabel()
743 Fortran::parser::Label label) { in blockOfLabel()
744 const Fortran::lower::pft::LabelEvalMap &labelEvaluationMap = in blockOfLabel()
768 Fortran::lower::pft::Evaluation *trueTarget, in genFIRConditionalBranch()
769 Fortran::lower::pft::Evaluation *falseTarget) { in genFIRConditionalBranch()
772 void genFIRConditionalBranch(const Fortran::parser::ScalarLogicalExpr &expr, in genFIRConditionalBranch()
775 Fortran::lower::StatementContext stmtCtx; in genFIRConditionalBranch()
777 createFIRExpr(toLocation(), Fortran::semantics::GetExpr(expr), stmtCtx); in genFIRConditionalBranch()
781 void genFIRConditionalBranch(const Fortran::parser::ScalarLogicalExpr &expr, in genFIRConditionalBranch()
782 Fortran::lower::pft::Evaluation *trueTarget, in genFIRConditionalBranch()
783 Fortran::lower::pft::Evaluation *falseTarget) { in genFIRConditionalBranch()
784 Fortran::lower::StatementContext stmtCtx; in genFIRConditionalBranch()
786 createFIRExpr(toLocation(), Fortran::semantics::GetExpr(expr), stmtCtx); in genFIRConditionalBranch()
802 void genFIR(const Fortran::parser::EndProgramStmt &) { genExitRoutine(); } in genFIR()
807 void genReturnSymbol(const Fortran::semantics::Symbol &functionSymbol) { in genReturnSymbol()
808 const Fortran::semantics::Symbol &resultSym = in genReturnSymbol()
809 functionSymbol.get<Fortran::semantics::SubprogramDetails>().result(); in genReturnSymbol()
810 Fortran::lower::SymbolBox resultSymBox = lookupSymbol(resultSym); in genReturnSymbol()
838 getAltReturnResult(const Fortran::semantics::Symbol &symbol) { in getAltReturnResult()
839 assert(Fortran::semantics::HasAlternateReturns(symbol) && in getAltReturnResult()
844 void genFIRProcedureExit(Fortran::lower::pft::FunctionLikeUnit &funit, in genFIRProcedureExit()
845 const Fortran::semantics::Symbol &symbol) { in genFIRProcedureExit()
853 if (Fortran::semantics::IsFunction(symbol)) { in genFIRProcedureExit()
855 } else if (Fortran::semantics::HasAlternateReturns(symbol)) { in genFIRProcedureExit()
872 Fortran::lower::StatementContext stmtCtx; in genIfCondition()
875 Fortran::semantics::GetExpr( in genIfCondition()
876 std::get<Fortran::parser::ScalarLogicalExpr>(stmt->t)), in genIfCondition()
896 void genFIR(const Fortran::parser::CallStmt &stmt) { in genFIR()
897 Fortran::lower::StatementContext stmtCtx; in genFIR()
898 Fortran::lower::pft::Evaluation &eval = getEval(); in genFIR()
902 mlir::Value res = Fortran::lower::createSubroutineCall( in genFIR()
912 for (const Fortran::parser::ActualArgSpec &arg : in genFIR()
913 std::get<std::list<Fortran::parser::ActualArgSpec>>(stmt.v.t)) { in genFIR()
914 const auto &actual = std::get<Fortran::parser::ActualArg>(arg.t); in genFIR()
916 std::get_if<Fortran::parser::AltReturnSpec>(&actual.u)) { in genFIR()
926 void genFIR(const Fortran::parser::ComputedGotoStmt &stmt) { in genFIR()
927 Fortran::lower::StatementContext stmtCtx; in genFIR()
928 Fortran::lower::pft::Evaluation &eval = getEval(); in genFIR()
931 Fortran::semantics::GetExpr( in genFIR()
932 std::get<Fortran::parser::ScalarIntExpr>(stmt.t)), in genFIR()
938 for (Fortran::parser::Label label : in genFIR()
939 std::get<std::list<Fortran::parser::Label>>(stmt.t)) { in genFIR()
948 void genFIR(const Fortran::parser::ArithmeticIfStmt &stmt) { in genFIR()
949 Fortran::lower::StatementContext stmtCtx; in genFIR()
950 Fortran::lower::pft::Evaluation &eval = getEval(); in genFIR()
953 Fortran::semantics::GetExpr(std::get<Fortran::parser::Expr>(stmt.t)), in genFIR()
996 void genFIR(const Fortran::parser::AssignedGotoStmt &stmt) { in genFIR()
1007 Fortran::lower::pft::Evaluation &eval = getEval(); in genFIR()
1008 const Fortran::lower::pft::SymbolLabelMap &symbolLabelMap = in genFIR()
1010 const Fortran::semantics::Symbol &symbol = in genFIR()
1011 *std::get<Fortran::parser::Name>(stmt.t).symbol; in genFIR()
1024 auto addLabel = [&](Fortran::parser::Label label) { in genFIR()
1029 for (Fortran::parser::Label label : in genFIR()
1030 std::get<std::list<Fortran::parser::Label>>(stmt.t)) { in genFIR()
1049 const Fortran::parser::ConcurrentHeader &header, in getConcurrentControl()
1050 const std::list<Fortran::parser::LocalitySpec> &localityList = {}) { in getConcurrentControl()
1052 for (const Fortran::parser::ConcurrentControl &control :
1053 std::get<std::list<Fortran::parser::ConcurrentControl>>(header.t))
1058 info.maskExpr = Fortran::semantics::GetExpr(
1059 std::get<std::optional<Fortran::parser::ScalarLogicalExpr>>(header.t));
1060 for (const Fortran::parser::LocalitySpec &x : localityList) {
1062 std::get_if<Fortran::parser::LocalitySpec::LocalInit>(&x.u))
1063 for (const Fortran::parser::Name &x : localInitList->v)
1066 std::get_if<Fortran::parser::LocalitySpec::Shared>(&x.u))
1067 for (const Fortran::parser::Name &x : sharedList->v)
1069 if (std::get_if<Fortran::parser::LocalitySpec::Local>(&x.u))
1079 void genFIR(const Fortran::parser::DoConstruct &doConstruct) { in genFIR()
1083 Fortran::lower::pft::Evaluation &eval = getEval(); in genFIR()
1085 Fortran::lower::pft::Evaluation &doStmtEval = in genFIR()
1087 auto *doStmt = doStmtEval.getIf<Fortran::parser::NonLabelDoStmt>(); in genFIR()
1089 std::get<std::optional<Fortran::parser::LoopControl>>(doStmt->t); in genFIR()
1103 const Fortran::parser::ScalarLogicalExpr *whileCondition = nullptr; in genFIR()
1109 std::get_if<Fortran::parser::ScalarLogicalExpr>( in genFIR()
1116 std::get_if<Fortran::parser::LoopControl::Bounds>( in genFIR()
1125 Fortran::common::TypeCategory::Real); in genFIR()
1132 std::get_if<Fortran::parser::LoopControl::Concurrent>( in genFIR()
1136 std::get<Fortran::parser::ConcurrentHeader>(concurrent->t), in genFIR()
1137 std::get<std::list<Fortran::parser::LocalitySpec>>(concurrent->t)); in genFIR()
1167 for (Fortran::lower::pft::Evaluation &e : eval.getNestedEvaluations()) in genFIR()
1181 auto genControlValue = [&](const Fortran::lower::SomeExpr *expr, in genFIRIncrementLoopBegin()
1185 Fortran::lower::StatementContext stmtCtx; in genFIRIncrementLoopBegin()
1196 for (const Fortran::semantics::Symbol *sym : info.localInitSymList) { in genFIRIncrementLoopBegin()
1198 sym->detailsIf<Fortran::semantics::HostAssocDetails>(); in genFIRIncrementLoopBegin()
1200 const Fortran::semantics::Symbol &hostSym = hostDetails->symbol(); in genFIRIncrementLoopBegin()
1205 for (const Fortran::semantics::Symbol *sym : info.sharedSymList) { in genFIRIncrementLoopBegin()
1207 sym->detailsIf<Fortran::semantics::HostAssocDetails>(); in genFIRIncrementLoopBegin()
1209 const Fortran::semantics::Symbol &hostSym = hostDetails->symbol(); in genFIRIncrementLoopBegin()
1231 Fortran::lower::StatementContext stmtCtx; in genFIRIncrementLoopBegin()
1289 Fortran::lower::StatementContext stmtCtx; in genFIRIncrementLoopBegin()
1357 void genFIR(const Fortran::parser::IfConstruct &) { in genFIR()
1359 Fortran::lower::pft::Evaluation &eval = getEval(); in genFIR()
1363 for (Fortran::lower::pft::Evaluation &e : eval.getNestedEvaluations()) { in genFIR()
1369 if (auto *s = e.getIf<Fortran::parser::IfThenStmt>()) { in genFIR()
1371 } else if (auto *s = e.getIf<Fortran::parser::IfStmt>()) { in genFIR()
1373 } else if (auto *s = e.getIf<Fortran::parser::ElseIfStmt>()) { in genFIR()
1377 } else if (e.isA<Fortran::parser::ElseStmt>()) { in genFIR()
1380 } else if (e.isA<Fortran::parser::EndIfStmt>()) { in genFIR()
1390 for (Fortran::lower::pft::Evaluation &e : eval.getNestedEvaluations()) { in genFIR()
1398 if (auto *s = e.getIf<Fortran::parser::IfThenStmt>()) { in genFIR()
1401 } else if (auto *s = e.getIf<Fortran::parser::IfStmt>()) { in genFIR()
1404 } else if (auto *s = e.getIf<Fortran::parser::ElseIfStmt>()) { in genFIR()
1413 void genFIR(const Fortran::parser::CaseConstruct &) { in genFIR()
1414 for (Fortran::lower::pft::Evaluation &e : getEval().getNestedEvaluations()) in genFIR()
1419 void genNestedStatement(const Fortran::parser::Statement<A> &stmt) { in genNestedStatement()
1426 void forceControlVariableBinding(const Fortran::semantics::Symbol *sym, in forceControlVariableBinding()
1435 Fortran::lower::getAdaptToByRefAttr(*builder)}); in forceControlVariableBinding()
1443 void genFIR(const Fortran::parser::ConcurrentHeader &header) { in genFIR()
1455 Fortran::lower::StatementContext &stmtCtx = in genFIR()
1460 for (const Fortran::parser::ConcurrentControl &ctrl : in genFIR()
1461 std::get<std::list<Fortran::parser::ConcurrentControl>>(header.t)) { in genFIR()
1462 const Fortran::lower::SomeExpr *lo = in genFIR()
1463 Fortran::semantics::GetExpr(std::get<1>(ctrl.t)); in genFIR()
1464 const Fortran::lower::SomeExpr *hi = in genFIR()
1465 Fortran::semantics::GetExpr(std::get<2>(ctrl.t)); in genFIR()
1467 std::get<std::optional<Fortran::parser::ScalarIntExpr>>(ctrl.t); in genFIR()
1474 lowerExpr(*Fortran::semantics::GetExpr(*optStep))) in genFIR()
1483 Fortran::lower::StatementContext &stmtCtx = in genFIR()
1490 for (const Fortran::parser::ConcurrentControl &ctrl : in genFIR()
1491 std::get<std::list<Fortran::parser::ConcurrentControl>>(header.t)) { in genFIR()
1492 const Fortran::semantics::Symbol *ctrlVar = in genFIR()
1493 std::get<Fortran::parser::Name>(ctrl.t).symbol; in genFIR()
1505 const Fortran::lower::SomeExpr *lo = in genFIR()
1506 Fortran::semantics::GetExpr(std::get<1>(ctrl.t)); in genFIR()
1507 const Fortran::lower::SomeExpr *hi = in genFIR()
1508 Fortran::semantics::GetExpr(std::get<2>(ctrl.t)); in genFIR()
1510 std::get<std::optional<Fortran::parser::ScalarIntExpr>>(ctrl.t); in genFIR()
1516 lowerExpr(*Fortran::semantics::GetExpr(*optStep))) in genFIR()
1533 std::get<std::optional<Fortran::parser::ScalarLogicalExpr>>( in genFIR()
1538 genExprValue(*Fortran::semantics::GetExpr(mask.value()), stmtCtx); in genFIR()
1554 void genFIR(const Fortran::parser::ForallAssignmentStmt &stmt) { in genFIR()
1558 void genFIR(const Fortran::parser::EndForallStmt &) { in genFIR()
1577 void genFIR(const Fortran::parser::ForallStmt &stmt) { in genFIR()
1580 Fortran::common::Indirection<Fortran::parser::ConcurrentHeader>>( in genFIR()
1583 genFIR(std::get<Fortran::parser::UnlabeledStatement< in genFIR()
1584 Fortran::parser::ForallAssignmentStmt>>(stmt.t) in genFIR()
1590 void genFIR(const Fortran::parser::ForallConstruct &forall) { in genFIR()
1594 Fortran::parser::Statement<Fortran::parser::ForallConstructStmt>>( in genFIR()
1596 for (const Fortran::parser::ForallBodyConstruct &s : in genFIR()
1597 std::get<std::list<Fortran::parser::ForallBodyConstruct>>(forall.t)) { in genFIR()
1599 Fortran::common::visitors{ in genFIR()
1600 [&](const Fortran::parser::WhereConstruct &b) { genFIR(b); }, in genFIR()
1601 [&](const Fortran::common::Indirection< in genFIR()
1602 Fortran::parser::ForallConstruct> &b) { genFIR(b.value()); }, in genFIR()
1607 std::get<Fortran::parser::Statement<Fortran::parser::EndForallStmt>>( in genFIR()
1612 void genFIR(const Fortran::parser::ForallConstructStmt &stmt) { in genFIR()
1614 Fortran::common::Indirection<Fortran::parser::ConcurrentHeader>>( in genFIR()
1619 void genFIR(const Fortran::parser::CompilerDirective &) { in genFIR()
1623 void genFIR(const Fortran::parser::OpenACCConstruct &acc) { in genFIR()
1626 for (Fortran::lower::pft::Evaluation &e : getEval().getNestedEvaluations()) in genFIR()
1631 void genFIR(const Fortran::parser::OpenACCDeclarativeConstruct &accDecl) { in genFIR()
1634 for (Fortran::lower::pft::Evaluation &e : getEval().getNestedEvaluations()) in genFIR()
1639 void genFIR(const Fortran::parser::OpenMPConstruct &omp) { in genFIR()
1644 const Fortran::parser::OpenMPLoopConstruct *ompLoop = in genFIR()
1645 std::get_if<Fortran::parser::OpenMPLoopConstruct>(&omp.u); in genFIR()
1653 Fortran::lower::pft::Evaluation *curEval = &getEval(); in genFIR()
1654 const Fortran::parser::OmpClauseList *loopOpClauseList = nullptr; in genFIR()
1656 loopOpClauseList = &std::get<Fortran::parser::OmpClauseList>( in genFIR()
1657 std::get<Fortran::parser::OmpBeginLoopDirective>(ompLoop->t).t); in genFIR()
1659 Fortran::lower::getCollapseValue(*loopOpClauseList); in genFIR()
1667 for (Fortran::lower::pft::Evaluation &e : curEval->getNestedEvaluations()) in genFIR()
1677 void genFIR(const Fortran::parser::OpenMPDeclarativeConstruct &ompDecl) { in genFIR()
1680 for (Fortran::lower::pft::Evaluation &e : getEval().getNestedEvaluations()) in genFIR()
1687 void genFIR(const Fortran::parser::SelectCaseStmt &stmt) { in genFIR()
1688 Fortran::lower::pft::Evaluation &eval = getEval(); in genFIR()
1691 Fortran::lower::StatementContext stmtCtx; in genFIR()
1692 const Fortran::lower::SomeExpr *expr = Fortran::semantics::GetExpr( in genFIR()
1693 std::get<Fortran::parser::Scalar<Fortran::parser::Expr>>(stmt.t)); in genFIR()
1696 auto charValue = [&](const Fortran::lower::SomeExpr *expr) { in genFIR()
1721 using CaseValue = Fortran::parser::Scalar<Fortran::parser::ConstantExpr>; in genFIR()
1723 const Fortran::lower::SomeExpr *expr = in genFIR()
1724 Fortran::semantics::GetExpr(caseValue.thing); in genFIR()
1732 loc, selectType, *Fortran::evaluate::ToInt64(*expr))); in genFIR()
1734 for (Fortran::lower::pft::Evaluation *e = eval.controlSuccessor; e; in genFIR()
1736 const auto &caseStmt = e->getIf<Fortran::parser::CaseStmt>(); in genFIR()
1739 std::get<Fortran::parser::CaseSelector>(caseStmt->t); in genFIR()
1741 std::get_if<std::list<Fortran::parser::CaseValueRange>>( in genFIR()
1747 for (const Fortran::parser::CaseValueRange &caseValueRange : in genFIR()
1756 std::get<Fortran::parser::CaseValueRange::Range>(caseValueRange.u); in genFIR()
1865 genAssociateSelector(const Fortran::lower::SomeExpr &selector, in genAssociateSelector()
1866 Fortran::lower::StatementContext &stmtCtx) { in genAssociateSelector()
1867 return Fortran::lower::isArraySectionWithoutVectorSubscript(selector) in genAssociateSelector()
1868 ? Fortran::lower::createSomeArrayBox(*this, selector, in genAssociateSelector()
1873 void genFIR(const Fortran::parser::AssociateConstruct &) { in genFIR()
1874 Fortran::lower::StatementContext stmtCtx; in genFIR()
1875 Fortran::lower::pft::Evaluation &eval = getEval(); in genFIR()
1876 for (Fortran::lower::pft::Evaluation &e : eval.getNestedEvaluations()) { in genFIR()
1877 if (auto *stmt = e.getIf<Fortran::parser::AssociateStmt>()) { in genFIR()
1881 for (const Fortran::parser::Association &assoc : in genFIR()
1882 std::get<std::list<Fortran::parser::Association>>(stmt->t)) { in genFIR()
1883 Fortran::semantics::Symbol &sym = in genFIR()
1884 *std::get<Fortran::parser::Name>(assoc.t).symbol; in genFIR()
1885 const Fortran::lower::SomeExpr &selector = in genFIR()
1886 *sym.get<Fortran::semantics::AssocEntityDetails>().expr(); in genFIR()
1889 } else if (e.getIf<Fortran::parser::EndAssociateStmt>()) { in genFIR()
1900 void genFIR(const Fortran::parser::BlockConstruct &blockConstruct) { in genFIR()
1904 void genFIR(const Fortran::parser::BlockStmt &) { in genFIR()
1907 void genFIR(const Fortran::parser::EndBlockStmt &) { in genFIR()
1911 void genFIR(const Fortran::parser::ChangeTeamConstruct &construct) { in genFIR()
1914 void genFIR(const Fortran::parser::ChangeTeamStmt &stmt) { in genFIR()
1917 void genFIR(const Fortran::parser::EndChangeTeamStmt &stmt) { in genFIR()
1921 void genFIR(const Fortran::parser::CriticalConstruct &criticalConstruct) { in genFIR()
1925 void genFIR(const Fortran::parser::CriticalStmt &) { in genFIR()
1928 void genFIR(const Fortran::parser::EndCriticalStmt &) { in genFIR()
1932 void genFIR(const Fortran::parser::SelectRankConstruct &selectRankConstruct) { in genFIR()
1936 void genFIR(const Fortran::parser::SelectRankStmt &) { in genFIR()
1939 void genFIR(const Fortran::parser::SelectRankCaseStmt &) { in genFIR()
1943 void genFIR(const Fortran::parser::SelectTypeConstruct &selectTypeConstruct) { in genFIR()
1947 void genFIR(const Fortran::parser::SelectTypeStmt &) { in genFIR()
1950 void genFIR(const Fortran::parser::TypeGuardStmt &) { in genFIR()
1958 void genFIR(const Fortran::parser::BackspaceStmt &stmt) { in genFIR()
1962 void genFIR(const Fortran::parser::CloseStmt &stmt) { in genFIR()
1966 void genFIR(const Fortran::parser::EndfileStmt &stmt) { in genFIR()
1970 void genFIR(const Fortran::parser::FlushStmt &stmt) { in genFIR()
1974 void genFIR(const Fortran::parser::InquireStmt &stmt) { in genFIR()
1977 std::get_if<std::list<Fortran::parser::InquireSpec>>(&stmt.u)) in genFIR()
1980 void genFIR(const Fortran::parser::OpenStmt &stmt) { in genFIR()
1984 void genFIR(const Fortran::parser::PrintStmt &stmt) { in genFIR()
1987 void genFIR(const Fortran::parser::ReadStmt &stmt) { in genFIR()
1991 void genFIR(const Fortran::parser::RewindStmt &stmt) { in genFIR()
1995 void genFIR(const Fortran::parser::WaitStmt &stmt) { in genFIR()
1999 void genFIR(const Fortran::parser::WriteStmt &stmt) { in genFIR()
2005 void genIoConditionBranches(Fortran::lower::pft::Evaluation &eval, in genIoConditionBranches()
2014 std::visit(Fortran::common::visitors{ in genIoConditionBranches()
2015 [&](const Fortran::parser::EndLabel &label) { in genIoConditionBranches()
2018 [&](const Fortran::parser::EorLabel &label) { in genIoConditionBranches()
2021 [&](const Fortran::parser::ErrLabel &label) { in genIoConditionBranches()
2036 indexList.push_back(Fortran::runtime::io::IostatEor); in genIoConditionBranches()
2040 indexList.push_back(Fortran::runtime::io::IostatEnd); in genIoConditionBranches()
2059 void genFIR(const Fortran::parser::AllocateStmt &stmt) { in genFIR()
2060 Fortran::lower::genAllocateStmt(*this, stmt, toLocation()); in genFIR()
2063 void genFIR(const Fortran::parser::DeallocateStmt &stmt) { in genFIR()
2064 Fortran::lower::genDeallocateStmt(*this, stmt, toLocation()); in genFIR()
2071 void genFIR(const Fortran::parser::NullifyStmt &stmt) { in genFIR()
2074 const Fortran::lower::SomeExpr *expr = in genFIR()
2075 Fortran::semantics::GetExpr(pointerObject); in genFIR()
2084 void genFIR(const Fortran::parser::EventPostStmt &stmt) { in genFIR()
2088 void genFIR(const Fortran::parser::EventWaitStmt &stmt) { in genFIR()
2092 void genFIR(const Fortran::parser::FormTeamStmt &stmt) { in genFIR()
2096 void genFIR(const Fortran::parser::LockStmt &stmt) { in genFIR()
2101 genInitializerExprValue(const Fortran::lower::SomeExpr &expr, in genInitializerExprValue()
2102 Fortran::lower::StatementContext &stmtCtx) { in genInitializerExprValue()
2103 return Fortran::lower::createSomeInitializerExpression( in genInitializerExprValue()
2124 const Fortran::evaluate::Assignment &assign, in genArrayAssignment()
2125 Fortran::lower::StatementContext &stmtCtx, in genArrayAssignment()
2128 if (Fortran::lower::isWholeAllocatable(assign.lhs)) { in genArrayAssignment()
2131 Fortran::lower::createAllocatableArrayAssignment( in genArrayAssignment()
2139 if (!Fortran::lower::isWholePointer(assign.lhs)) in genArrayAssignment()
2142 Fortran::lower::createArrayOfPointerAssignment( in genArrayAssignment()
2151 Fortran::lower::createSomeArrayAssignment(*this, assign.lhs, assign.rhs, in genArrayAssignment()
2165 Fortran::lower::createAnyMaskedArrayAssignment( in genArrayAssignment()
2173 static bool isFuncResultDesignator(const Fortran::lower::SomeExpr &expr) { in isFuncResultDesignator()
2174 const Fortran::semantics::Symbol *sym = in isFuncResultDesignator()
2175 Fortran::evaluate::GetFirstSymbol(expr); in isFuncResultDesignator()
2182 const Fortran::lower::SomeExpr &expr) override final { in genExprMutableBox()
2183 return Fortran::lower::createMutableBox(loc, *this, expr, localSymbols); in genExprMutableBox()
2187 void genAssignment(const Fortran::evaluate::Assignment &assign) { in genAssignment()
2188 Fortran::lower::StatementContext stmtCtx; in genAssignment()
2191 Fortran::lower::createArrayLoads(*this, explicitIterSpace, localSymbols); in genAssignment()
2195 Fortran::common::visitors{ in genAssignment()
2197 [&](const Fortran::evaluate::Assignment::Intrinsic &) { in genAssignment()
2198 const Fortran::semantics::Symbol *sym = in genAssignment()
2199 Fortran::evaluate::GetLastSymbol(assign.lhs); in genAssignment()
2204 std::optional<Fortran::evaluate::DynamicType> lhsType = in genAssignment()
2210 Fortran::lower::isWholeAllocatable(assign.lhs)) in genAssignment()
2232 Fortran::lower::isWholeAllocatable(assign.lhs); in genAssignment()
2293 [&](const Fortran::evaluate::ProcedureRef &procRef) { in genAssignment()
2294 Fortran::lower::StatementContext &ctx = in genAssignment()
2297 Fortran::lower::createSubroutineCall( in genAssignment()
2304 [&](const Fortran::evaluate::Assignment::BoundsSpec &lbExprs) { in genAssignment()
2305 if (Fortran::evaluate::IsProcedure(assign.rhs)) in genAssignment()
2307 std::optional<Fortran::evaluate::DynamicType> lhsType = in genAssignment()
2309 std::optional<Fortran::evaluate::DynamicType> rhsType = in genAssignment()
2317 for (const Fortran::evaluate::ExtentExpr &lbExpr : lbExprs) in genAssignment()
2327 Fortran::lower::associateMutableBox(*this, loc, lhs, assign.rhs, in genAssignment()
2333 [&](const Fortran::evaluate::Assignment::BoundsRemapping in genAssignment()
2335 std::optional<Fortran::evaluate::DynamicType> lhsType = in genAssignment()
2337 std::optional<Fortran::evaluate::DynamicType> rhsType = in genAssignment()
2346 for (const std::pair<Fortran::evaluate::ExtentExpr, in genAssignment()
2347 Fortran::evaluate::ExtentExpr> &pair : in genAssignment()
2349 const Fortran::evaluate::ExtentExpr &lbExpr = pair.first; in genAssignment()
2350 const Fortran::evaluate::ExtentExpr &ubExpr = pair.second; in genAssignment()
2363 if (Fortran::evaluate::UnwrapExpr<Fortran::evaluate::NullPointer>( in genAssignment()
2370 Fortran::lower::isArraySectionWithoutVectorSubscript( in genAssignment()
2372 ? Fortran::lower::createSomeArrayBox( in genAssignment()
2386 Fortran::lower::createArrayMergeStores(*this, explicitIterSpace); in genAssignment()
2389 void genFIR(const Fortran::parser::WhereConstruct &c) { in genFIR()
2393 Fortran::parser::Statement<Fortran::parser::WhereConstructStmt>>( in genFIR()
2396 std::get<std::list<Fortran::parser::WhereBodyConstruct>>(c.t)) in genFIR()
2399 std::get<std::list<Fortran::parser::WhereConstruct::MaskedElsewhere>>( in genFIR()
2403 std::get<std::optional<Fortran::parser::WhereConstruct::Elsewhere>>( in genFIR()
2408 std::get<Fortran::parser::Statement<Fortran::parser::EndWhereStmt>>( in genFIR()
2411 void genFIR(const Fortran::parser::WhereBodyConstruct &body) { in genFIR()
2413 Fortran::common::visitors{ in genFIR()
2414 [&](const Fortran::parser::Statement< in genFIR()
2415 Fortran::parser::AssignmentStmt> &stmt) { in genFIR()
2418 [&](const Fortran::parser::Statement<Fortran::parser::WhereStmt> in genFIR()
2420 [&](const Fortran::common::Indirection< in genFIR()
2421 Fortran::parser::WhereConstruct> &c) { genFIR(c.value()); }, in genFIR()
2425 void genFIR(const Fortran::parser::WhereConstructStmt &stmt) { in genFIR()
2426 implicitIterSpace.append(Fortran::semantics::GetExpr( in genFIR()
2427 std::get<Fortran::parser::LogicalExpr>(stmt.t))); in genFIR()
2429 void genFIR(const Fortran::parser::WhereConstruct::MaskedElsewhere &ew) { in genFIR()
2432 Fortran::parser::Statement<Fortran::parser::MaskedElsewhereStmt>>( in genFIR()
2435 std::get<std::list<Fortran::parser::WhereBodyConstruct>>(ew.t)) in genFIR()
2438 void genFIR(const Fortran::parser::MaskedElsewhereStmt &stmt) { in genFIR()
2439 implicitIterSpace.append(Fortran::semantics::GetExpr( in genFIR()
2440 std::get<Fortran::parser::LogicalExpr>(stmt.t))); in genFIR()
2442 void genFIR(const Fortran::parser::WhereConstruct::Elsewhere &ew) { in genFIR()
2444 std::get<Fortran::parser::Statement<Fortran::parser::ElsewhereStmt>>( in genFIR()
2447 std::get<std::list<Fortran::parser::WhereBodyConstruct>>(ew.t)) in genFIR()
2450 void genFIR(const Fortran::parser::ElsewhereStmt &stmt) { in genFIR()
2453 void genFIR(const Fortran::parser::EndWhereStmt &) { in genFIR()
2457 void genFIR(const Fortran::parser::WhereStmt &stmt) { in genFIR()
2458 Fortran::lower::StatementContext stmtCtx; in genFIR()
2459 const auto &assign = std::get<Fortran::parser::AssignmentStmt>(stmt.t); in genFIR()
2461 implicitIterSpace.append(Fortran::semantics::GetExpr( in genFIR()
2462 std::get<Fortran::parser::LogicalExpr>(stmt.t))); in genFIR()
2467 void genFIR(const Fortran::parser::PointerAssignmentStmt &stmt) { in genFIR()
2471 void genFIR(const Fortran::parser::AssignmentStmt &stmt) { in genFIR()
2475 void genFIR(const Fortran::parser::SyncAllStmt &stmt) { in genFIR()
2479 void genFIR(const Fortran::parser::SyncImagesStmt &stmt) { in genFIR()
2483 void genFIR(const Fortran::parser::SyncMemoryStmt &stmt) { in genFIR()
2487 void genFIR(const Fortran::parser::SyncTeamStmt &stmt) { in genFIR()
2491 void genFIR(const Fortran::parser::UnlockStmt &stmt) { in genFIR()
2495 void genFIR(const Fortran::parser::AssignStmt &stmt) { in genFIR()
2496 const Fortran::semantics::Symbol &symbol = in genFIR()
2497 *std::get<Fortran::parser::Name>(stmt.t).symbol; in genFIR()
2500 loc, genType(symbol), std::get<Fortran::parser::Label>(stmt.t)); in genFIR()
2504 void genFIR(const Fortran::parser::FormatStmt &) { in genFIR()
2511 void genFIR(const Fortran::parser::PauseStmt &stmt) { in genFIR()
2516 void genFIR(const Fortran::parser::FailImageStmt &stmt) { in genFIR()
2521 void genFIR(const Fortran::parser::StopStmt &stmt) { in genFIR()
2525 void genFIR(const Fortran::parser::ReturnStmt &stmt) { in genFIR()
2526 Fortran::lower::pft::FunctionLikeUnit *funit = in genFIR()
2539 const Fortran::semantics::Symbol &symbol = funit->getSubprogramSymbol(); in genFIR()
2540 if (Fortran::semantics::HasAlternateReturns(symbol)) { in genFIR()
2541 Fortran::lower::StatementContext stmtCtx; in genFIR()
2542 const Fortran::lower::SomeExpr *expr = in genFIR()
2543 Fortran::semantics::GetExpr(*stmt.v); in genFIR()
2560 void genFIR(const Fortran::parser::CycleStmt &) { in genFIR()
2563 void genFIR(const Fortran::parser::ExitStmt &) { in genFIR()
2566 void genFIR(const Fortran::parser::GotoStmt &) { in genFIR()
2571 void genFIR(const Fortran::parser::AssociateStmt &) {} // nop in genFIR()
2572 void genFIR(const Fortran::parser::CaseStmt &) {} // nop in genFIR()
2573 void genFIR(const Fortran::parser::ContinueStmt &) {} // nop in genFIR()
2574 void genFIR(const Fortran::parser::ElseIfStmt &) {} // nop in genFIR()
2575 void genFIR(const Fortran::parser::ElseStmt &) {} // nop in genFIR()
2576 void genFIR(const Fortran::parser::EndAssociateStmt &) {} // nop in genFIR()
2577 void genFIR(const Fortran::parser::EndDoStmt &) {} // nop in genFIR()
2578 void genFIR(const Fortran::parser::EndFunctionStmt &) {} // nop in genFIR()
2579 void genFIR(const Fortran::parser::EndIfStmt &) {} // nop in genFIR()
2580 void genFIR(const Fortran::parser::EndMpSubprogramStmt &) {} // nop in genFIR()
2581 void genFIR(const Fortran::parser::EndSelectStmt &) {} // nop in genFIR()
2582 void genFIR(const Fortran::parser::EndSubroutineStmt &) {} // nop in genFIR()
2583 void genFIR(const Fortran::parser::EntryStmt &) {} // nop in genFIR()
2584 void genFIR(const Fortran::parser::IfStmt &) {} // nop in genFIR()
2585 void genFIR(const Fortran::parser::IfThenStmt &) {} // nop in genFIR()
2586 void genFIR(const Fortran::parser::NonLabelDoStmt &) {} // nop in genFIR()
2587 void genFIR(const Fortran::parser::OmpEndLoopDirective &) {} // nop in genFIR()
2589 void genFIR(const Fortran::parser::NamelistStmt &) { in genFIR()
2594 void genFIR(Fortran::lower::pft::Evaluation &eval, in genFIR()
2610 Fortran::lower::pft::Evaluation *successor{}; in genFIR()
2625 void mapDummiesAndResults(Fortran::lower::pft::FunctionLikeUnit &funit, in mapDummiesAndResults()
2626 const Fortran::lower::CalleeInterface &callee) { in mapDummiesAndResults()
2628 using PassBy = Fortran::lower::CalleeInterface::PassEntityBy; in mapDummiesAndResults()
2648 for (const Fortran::lower::CalleeInterface::PassedEntity &arg : in mapDummiesAndResults()
2651 if (std::optional<Fortran::lower::CalleeInterface::PassedEntity> in mapDummiesAndResults()
2664 void instantiateVar(const Fortran::lower::pft::Variable &var, in instantiateVar()
2665 Fortran::lower::AggregateStoreMap &storeMap) { in instantiateVar()
2666 Fortran::lower::instantiateVariable(*this, var, localSymbols, storeMap); in instantiateVar()
2669 Fortran::semantics::Symbol::Flag::OmpThreadprivate)) in instantiateVar()
2670 Fortran::lower::genThreadprivateOp(*this, var); in instantiateVar()
2674 void startNewFunction(Fortran::lower::pft::FunctionLikeUnit &funit) { in startNewFunction()
2676 Fortran::lower::CalleeInterface callee(funit, *this); in startNewFunction()
2687 llvm::SmallVector<Fortran::lower::pft::Variable> deferredFuncResultList; in startNewFunction()
2692 Fortran::lower::SymbolBox resultArg; in startNewFunction()
2693 if (std::optional<Fortran::lower::CalleeInterface::PassedEntity> in startNewFunction()
2697 Fortran::lower::AggregateStoreMap storeMap; in startNewFunction()
2703 if (auto *module = Fortran::lower::pft::getAncestor< in startNewFunction()
2704 Fortran::lower::pft::ModuleLikeUnit>(funit)) in startNewFunction()
2705 for (const Fortran::lower::pft::Variable &var : in startNewFunction()
2710 for (const Fortran::lower::pft::Variable &var : in startNewFunction()
2717 const Fortran::semantics::Symbol &sym = var.getSymbol(); in startNewFunction()
2722 const Fortran::semantics::Symbol &ultimate = sym.GetUltimate(); in startNewFunction()
2724 Fortran::lower::SymbolBox hostBox = in startNewFunction()
2745 for (const Fortran::lower::pft::Variable &altResult : in startNewFunction()
2747 if (std::optional<Fortran::lower::CalleeInterface::PassedEntity> in startNewFunction()
2750 Fortran::lower::StatementContext stmtCtx; in startNewFunction()
2751 Fortran::lower::mapSymbolAttributes(*this, altResult, localSymbols, in startNewFunction()
2771 const Fortran::semantics::Symbol &symbol = funit.getSubprogramSymbol(); in startNewFunction()
2781 if (Fortran::lower::pft::Evaluation *alternateEntryEval = in startNewFunction()
2797 std::list<Fortran::lower::pft::Evaluation> &evaluationList) { in createEmptyBlocks()
2799 for (Fortran::lower::pft::Evaluation &eval : evaluationList) { in createEmptyBlocks()
2807 Fortran::lower::pft::Evaluation &constructStmt = in createEmptyBlocks()
2845 void endNewFunction(Fortran::lower::pft::FunctionLikeUnit &funit) { in endNewFunction()
2846 setCurrentPosition(Fortran::lower::pft::stmtSourceLoc(funit.endStmt)); in endNewFunction()
2888 void lowerBlockData(Fortran::lower::pft::BlockDataUnit &bdunit) { in lowerBlockData()
2890 Fortran::lower::AggregateStoreMap fakeMap; in lowerBlockData()
2892 if (sym->has<Fortran::semantics::ObjectEntityDetails>()) { in lowerBlockData()
2893 Fortran::lower::pft::Variable var(*sym, true); in lowerBlockData()
2902 lowerCommonBlocks(const Fortran::semantics::CommonBlockList &commonBlocks) { in lowerCommonBlocks()
2904 [&]() { Fortran::lower::defineCommonBlocks(*this, commonBlocks); }); in lowerCommonBlocks()
2908 void lowerFunc(Fortran::lower::pft::FunctionLikeUnit &funit) { in lowerFunc()
2910 const Fortran::semantics::Symbol &procSymbol = in lowerFunc()
2914 if (Fortran::semantics::IsSeparateModuleProcedureInterface(&procSymbol)) in lowerFunc()
2922 for (Fortran::lower::pft::Evaluation &eval : funit.evaluationList) in lowerFunc()
2927 for (Fortran::lower::pft::FunctionLikeUnit &f : funit.nestedFunctions) in lowerFunc()
2933 void lowerModuleDeclScope(Fortran::lower::pft::ModuleLikeUnit &mod) { in lowerModuleDeclScope()
2936 for (const Fortran::lower::pft::Variable &var : in lowerModuleDeclScope()
2939 const Fortran::semantics::Scope *owningScope = var.getOwningScope(); in lowerModuleDeclScope()
2941 Fortran::lower::defineModuleVariable(*this, var); in lowerModuleDeclScope()
2949 void lowerMod(Fortran::lower::pft::ModuleLikeUnit &mod) { in lowerMod()
2950 for (Fortran::lower::pft::FunctionLikeUnit &f : mod.nestedFunctions) in lowerMod()
2954 void setCurrentPosition(const Fortran::parser::CharBlock &position) { in setCurrentPosition()
2955 if (position != Fortran::parser::CharBlock{}) in setCurrentPosition()
2965 setCurrentPosition(Fortran::parser::FindSourceLocation(parseTreeNode)); in setCurrentPositionAt()
2973 mlir::Location toLocation(const Fortran::parser::CharBlock &cb) { in toLocation()
2978 void setCurrentEval(Fortran::lower::pft::Evaluation &eval) { in setCurrentEval()
2981 Fortran::lower::pft::Evaluation &getEval() { in getEval()
2986 std::optional<Fortran::evaluate::Shape>
2987 getShape(const Fortran::lower::SomeExpr &expr) { in getShape()
2988 return Fortran::evaluate::GetShape(foldingContext, expr); in getShape()
2995 void analyzeExplicitSpace(const Fortran::parser::ConcurrentHeader &header) { in analyzeExplicitSpace()
2997 for (const Fortran::parser::ConcurrentControl &ctrl : in analyzeExplicitSpace()
2998 std::get<std::list<Fortran::parser::ConcurrentControl>>(header.t)) { in analyzeExplicitSpace()
2999 const Fortran::semantics::Symbol *ctrlVar = in analyzeExplicitSpace()
3000 std::get<Fortran::parser::Name>(ctrl.t).symbol; in analyzeExplicitSpace()
3004 std::get<std::optional<Fortran::parser::ScalarLogicalExpr>>( in analyzeExplicitSpace()
3007 analyzeExplicitSpace(*Fortran::semantics::GetExpr(*mask)); in analyzeExplicitSpace()
3010 void analyzeExplicitSpace(const Fortran::evaluate::Expr<A> &e) { in analyzeExplicitSpace()
3013 void analyzeExplicitSpace(const Fortran::evaluate::Assignment *assign) { in analyzeExplicitSpace()
3014 auto analyzeAssign = [&](const Fortran::lower::SomeExpr &lhs, in analyzeExplicitSpace()
3015 const Fortran::lower::SomeExpr &rhs) { in analyzeExplicitSpace()
3020 Fortran::common::visitors{ in analyzeExplicitSpace()
3021 [&](const Fortran::evaluate::ProcedureRef &procRef) { in analyzeExplicitSpace()
3024 const Fortran::lower::SomeExpr *lhs = in analyzeExplicitSpace()
3026 const Fortran::lower::SomeExpr *rhs = in analyzeExplicitSpace()
3036 void analyzeExplicitSpace(const Fortran::parser::ForallAssignmentStmt &stmt) { in analyzeExplicitSpace()
3039 void analyzeExplicitSpace(const Fortran::parser::AssignmentStmt &s) { in analyzeExplicitSpace()
3042 void analyzeExplicitSpace(const Fortran::parser::PointerAssignmentStmt &s) { in analyzeExplicitSpace()
3045 void analyzeExplicitSpace(const Fortran::parser::WhereConstruct &c) { in analyzeExplicitSpace()
3048 Fortran::parser::Statement<Fortran::parser::WhereConstructStmt>>( in analyzeExplicitSpace()
3051 for (const Fortran::parser::WhereBodyConstruct &body : in analyzeExplicitSpace()
3052 std::get<std::list<Fortran::parser::WhereBodyConstruct>>(c.t)) in analyzeExplicitSpace()
3054 for (const Fortran::parser::WhereConstruct::MaskedElsewhere &e : in analyzeExplicitSpace()
3055 std::get<std::list<Fortran::parser::WhereConstruct::MaskedElsewhere>>( in analyzeExplicitSpace()
3059 std::get<std::optional<Fortran::parser::WhereConstruct::Elsewhere>>( in analyzeExplicitSpace()
3064 void analyzeExplicitSpace(const Fortran::parser::WhereConstructStmt &ws) { in analyzeExplicitSpace()
3065 const Fortran::lower::SomeExpr *exp = Fortran::semantics::GetExpr( in analyzeExplicitSpace()
3066 std::get<Fortran::parser::LogicalExpr>(ws.t)); in analyzeExplicitSpace()
3071 const Fortran::parser::WhereConstruct::MaskedElsewhere &ew) { in analyzeExplicitSpace()
3074 Fortran::parser::Statement<Fortran::parser::MaskedElsewhereStmt>>( in analyzeExplicitSpace()
3077 for (const Fortran::parser::WhereBodyConstruct &e : in analyzeExplicitSpace()
3078 std::get<std::list<Fortran::parser::WhereBodyConstruct>>(ew.t)) in analyzeExplicitSpace()
3081 void analyzeExplicitSpace(const Fortran::parser::WhereBodyConstruct &body) { in analyzeExplicitSpace()
3082 std::visit(Fortran::common::visitors{ in analyzeExplicitSpace()
3083 [&](const Fortran::common::Indirection< in analyzeExplicitSpace()
3084 Fortran::parser::WhereConstruct> &wc) { in analyzeExplicitSpace()
3090 void analyzeExplicitSpace(const Fortran::parser::MaskedElsewhereStmt &stmt) { in analyzeExplicitSpace()
3091 const Fortran::lower::SomeExpr *exp = Fortran::semantics::GetExpr( in analyzeExplicitSpace()
3092 std::get<Fortran::parser::LogicalExpr>(stmt.t)); in analyzeExplicitSpace()
3097 analyzeExplicitSpace(const Fortran::parser::WhereConstruct::Elsewhere *ew) { in analyzeExplicitSpace()
3098 for (const Fortran::parser::WhereBodyConstruct &e : in analyzeExplicitSpace()
3099 std::get<std::list<Fortran::parser::WhereBodyConstruct>>(ew->t)) in analyzeExplicitSpace()
3102 void analyzeExplicitSpace(const Fortran::parser::WhereStmt &stmt) { in analyzeExplicitSpace()
3103 const Fortran::lower::SomeExpr *exp = Fortran::semantics::GetExpr( in analyzeExplicitSpace()
3104 std::get<Fortran::parser::LogicalExpr>(stmt.t)); in analyzeExplicitSpace()
3107 const std::optional<Fortran::evaluate::Assignment> &assign = in analyzeExplicitSpace()
3108 std::get<Fortran::parser::AssignmentStmt>(stmt.t).typedAssignment->v; in analyzeExplicitSpace()
3112 void analyzeExplicitSpace(const Fortran::parser::ForallStmt &forall) { in analyzeExplicitSpace()
3115 Fortran::common::Indirection<Fortran::parser::ConcurrentHeader>>( in analyzeExplicitSpace()
3118 analyzeExplicitSpace(std::get<Fortran::parser::UnlabeledStatement< in analyzeExplicitSpace()
3119 Fortran::parser::ForallAssignmentStmt>>(forall.t) in analyzeExplicitSpace()
3124 analyzeExplicitSpace(const Fortran::parser::ForallConstructStmt &forall) { in analyzeExplicitSpace()
3127 Fortran::common::Indirection<Fortran::parser::ConcurrentHeader>>( in analyzeExplicitSpace()
3131 void analyzeExplicitSpace(const Fortran::parser::ForallConstruct &forall) { in analyzeExplicitSpace()
3134 Fortran::parser::Statement<Fortran::parser::ForallConstructStmt>>( in analyzeExplicitSpace()
3137 for (const Fortran::parser::ForallBodyConstruct &s : in analyzeExplicitSpace()
3138 std::get<std::list<Fortran::parser::ForallBodyConstruct>>(forall.t)) { in analyzeExplicitSpace()
3139 std::visit(Fortran::common::visitors{ in analyzeExplicitSpace()
3140 [&](const Fortran::common::Indirection< in analyzeExplicitSpace()
3141 Fortran::parser::ForallConstruct> &b) { in analyzeExplicitSpace()
3144 [&](const Fortran::parser::WhereConstruct &w) { in analyzeExplicitSpace()
3155 void addMaskVariable(Fortran::lower::FrontEndExpr exp) { in addMaskVariable()
3197 Fortran::lower::LoweringBridge &bridge;
3198 Fortran::evaluate::FoldingContext foldingContext;
3200 Fortran::lower::pft::Evaluation *evalPtr = nullptr;
3201 Fortran::lower::SymMap localSymbols;
3202 Fortran::parser::CharBlock currentPosition;
3206 Fortran::lower::ImplicitIterSpace implicitIterSpace;
3209 Fortran::lower::ExplicitIterSpace explicitIterSpace;
3217 Fortran::evaluate::FoldingContext
3218 Fortran::lower::LoweringBridge::createFoldingContext() const { in createFoldingContext()
3222 void Fortran::lower::LoweringBridge::lower( in lower()
3223 const Fortran::parser::Program &prg, in lower()
3224 const Fortran::semantics::SemanticsContext &semanticsContext) { in lower()
3225 std::unique_ptr<Fortran::lower::pft::Program> pft = in lower()
3226 Fortran::lower::createPFT(prg, semanticsContext); in lower()
3228 Fortran::lower::dumpPFT(llvm::errs(), *pft); in lower()
3233 void Fortran::lower::LoweringBridge::parseSourceFile(llvm::SourceMgr &srcMgr) { in parseSourceFile()
3240 Fortran::lower::LoweringBridge::LoweringBridge( in LoweringBridge()
3242 const Fortran::common::IntrinsicTypeDefaultKinds &defaultKinds, in LoweringBridge()
3243 const Fortran::evaluate::IntrinsicProcTable &intrinsics, in LoweringBridge()
3244 const Fortran::evaluate::TargetCharacteristics &targetCharacteristics, in LoweringBridge()
3245 const Fortran::parser::AllCookedSources &cooked, llvm::StringRef triple, in LoweringBridge()