@@ -23,17 +23,12 @@ static llvm::cl::opt<bool> clDisableStructuredFir(
23
23
" no-structured-fir" , llvm::cl::desc(" disable generation of structured FIR" ),
24
24
llvm::cl::init(false ), llvm::cl::Hidden);
25
25
26
- // FIXME: should be set with switch such as `--std=2018`.
27
26
static llvm::cl::opt<bool > nonRecursiveProcedures (
28
27
" non-recursive-procedures" ,
29
28
llvm::cl::desc (" Make procedures non-recursive by default. This was the "
30
29
" default for all Fortran standards prior to 2018." ),
31
30
llvm::cl::init(/* 2018 standard=*/ false ));
32
31
33
- static bool defaultRecursiveFunctionSetting () {
34
- return !nonRecursiveProcedures;
35
- }
36
-
37
32
using namespace Fortran ;
38
33
39
34
namespace {
@@ -1286,17 +1281,6 @@ Fortran::lower::pft::FunctionLikeUnit::FunctionLikeUnit(
1286
1281
}
1287
1282
}
1288
1283
1289
- template <typename A>
1290
- static bool procedureIsRecursive (const A &stmt) {
1291
- for (const auto &p : std::get<std::list<parser::PrefixSpec>>(stmt.t )) {
1292
- if (std::holds_alternative<parser::PrefixSpec::Recursive>(p.u ))
1293
- return true ;
1294
- if (std::holds_alternative<parser::PrefixSpec::Non_Recursive>(p.u ))
1295
- return false ;
1296
- }
1297
- return defaultRecursiveFunctionSetting ();
1298
- }
1299
-
1300
1284
Fortran::lower::pft::FunctionLikeUnit::FunctionLikeUnit (
1301
1285
const parser::FunctionSubprogram &func,
1302
1286
const lower::pft::ParentVariant &parent,
@@ -1305,8 +1289,6 @@ Fortran::lower::pft::FunctionLikeUnit::FunctionLikeUnit(
1305
1289
beginStmt{getFunctionStmt<parser::FunctionStmt>(func)},
1306
1290
endStmt{getFunctionStmt<parser::EndFunctionStmt>(func)} {
1307
1291
auto symbol = getSymbol (*beginStmt);
1308
- recursiveFunction =
1309
- procedureIsRecursive (beginStmt->getStatement <parser::FunctionStmt>());
1310
1292
entryPointList[0 ].first = symbol;
1311
1293
processSymbolTable (*symbol->scope (), varList);
1312
1294
}
@@ -1319,8 +1301,6 @@ Fortran::lower::pft::FunctionLikeUnit::FunctionLikeUnit(
1319
1301
beginStmt{getFunctionStmt<parser::SubroutineStmt>(func)},
1320
1302
endStmt{getFunctionStmt<parser::EndSubroutineStmt>(func)} {
1321
1303
auto symbol = getSymbol (*beginStmt);
1322
- recursiveFunction =
1323
- procedureIsRecursive (beginStmt->getStatement <parser::SubroutineStmt>());
1324
1304
entryPointList[0 ].first = symbol;
1325
1305
processSymbolTable (*symbol->scope (), varList);
1326
1306
}
@@ -1331,8 +1311,7 @@ Fortran::lower::pft::FunctionLikeUnit::FunctionLikeUnit(
1331
1311
const semantics::SemanticsContext &)
1332
1312
: ProgramUnit{func, parent},
1333
1313
beginStmt{getFunctionStmt<parser::MpSubprogramStmt>(func)},
1334
- endStmt{getFunctionStmt<parser::EndMpSubprogramStmt>(func)},
1335
- recursiveFunction{defaultRecursiveFunctionSetting ()} {
1314
+ endStmt{getFunctionStmt<parser::EndMpSubprogramStmt>(func)} {
1336
1315
auto symbol = getSymbol (*beginStmt);
1337
1316
entryPointList[0 ].first = symbol;
1338
1317
processSymbolTable (*symbol->scope (), varList);
@@ -1371,6 +1350,14 @@ Fortran::lower::createPFT(const parser::Program &root,
1371
1350
return walker.result ();
1372
1351
}
1373
1352
1353
+ // FIXME: FlangDriver
1354
+ // This option should be integrated with the real driver as the default of
1355
+ // RECURSIVE vs. NON_RECURSIVE may be changed by other command line options,
1356
+ // etc., etc.
1357
+ bool Fortran::lower::defaultRecursiveFunctionSetting () {
1358
+ return !nonRecursiveProcedures;
1359
+ }
1360
+
1374
1361
void Fortran::lower::dumpPFT (llvm::raw_ostream &outputStream,
1375
1362
const lower::pft::Program &pft) {
1376
1363
PFTDumper{}.dumpPFT (outputStream, pft);
0 commit comments