Skip to content

Commit

Permalink
[flang] Change the default F18_FC to gfortran
Browse files Browse the repository at this point in the history
Summary: Changed default F18_FC from pgf90 to gfortran. Removed unnecessary references to pgf90 in favor of more generic naming.

Reviewers: sscalpone, richard.barton.arm, DavidTruby, jdoerfert, clementval

Reviewed By: sscalpone, richard.barton.arm, clementval

Subscribers: sstefan1, tskeith, klausler, clementval, flang-commits, llvm-commits

Tags: #llvm, #flang

Differential Revision: https://reviews.llvm.org/D83488
  • Loading branch information
AlexisPerry committed Jul 14, 2020
1 parent 2b3c505 commit 02c3f70
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions flang/tools/f18/f18.cpp
Expand Up @@ -101,8 +101,8 @@ struct DriverOptions {
bool debugNoSemantics{false};
bool debugModuleWriter{false};
bool measureTree{false};
bool unparseTypedExprsToPGF90{false};
std::vector<std::string> pgf90Args;
bool unparseTypedExprsToF18_FC{false};
std::vector<std::string> F18_FCArgs;
const char *prefix{nullptr};
bool getDefinition{false};
GetDefinitionArgs getDefinitionArgs{0, 0, 0};
Expand Down Expand Up @@ -137,8 +137,8 @@ void Exec(std::vector<char *> &argv, bool verbose = false) {

void RunOtherCompiler(DriverOptions &driver, char *source, char *relo) {
std::vector<char *> argv;
for (size_t j{0}; j < driver.pgf90Args.size(); ++j) {
argv.push_back(driver.pgf90Args[j].data());
for (size_t j{0}; j < driver.F18_FCArgs.size(); ++j) {
argv.push_back(driver.F18_FCArgs[j].data());
}
char dashC[3] = "-c", dashO[3] = "-o";
argv.push_back(dashC);
Expand Down Expand Up @@ -342,7 +342,7 @@ std::string CompileFortran(std::string path, Fortran::parser::Options options,
options.features.IsEnabled(
Fortran::common::LanguageFeature::BackslashEscapes),
nullptr /* action before each statement */,
driver.unparseTypedExprsToPGF90 ? &asFortran : nullptr);
driver.unparseTypedExprsToF18_FC ? &asFortran : nullptr);
}

if (ParentProcess()) {
Expand Down Expand Up @@ -371,8 +371,8 @@ std::string CompileOtherLanguage(std::string path, DriverOptions &driver) {
void Link(std::vector<std::string> &relocatables, DriverOptions &driver) {
if (!ParentProcess()) {
std::vector<char *> argv;
for (size_t j{0}; j < driver.pgf90Args.size(); ++j) {
argv.push_back(driver.pgf90Args[j].data());
for (size_t j{0}; j < driver.F18_FCArgs.size(); ++j) {
argv.push_back(driver.F18_FCArgs[j].data());
}
for (auto &relo : relocatables) {
argv.push_back(relo.data());
Expand All @@ -391,9 +391,9 @@ int main(int argc, char *const argv[]) {
atexit(CleanUpAtExit);

DriverOptions driver;
const char *pgf90{getenv("F18_FC")};
driver.pgf90Args.push_back(pgf90 ? pgf90 : "pgf90");
bool isPGF90{driver.pgf90Args.back().rfind("pgf90") != std::string::npos};
const char *F18_FC{getenv("F18_FC")};
driver.F18_FCArgs.push_back(F18_FC ? F18_FC : "gfortran");
bool isPGF90{driver.F18_FCArgs.back().rfind("pgf90") != std::string::npos};

std::list<std::string> args{argList(argc, argv)};
std::string prefix{args.front()};
Expand Down Expand Up @@ -423,7 +423,7 @@ int main(int argc, char *const argv[]) {
anyFiles = true;
auto dot{arg.rfind(".")};
if (dot == std::string::npos) {
driver.pgf90Args.push_back(arg);
driver.F18_FCArgs.push_back(arg);
} else {
std::string suffix{arg.substr(dot + 1)};
if (suffix == "f" || suffix == "F" || suffix == "ff" ||
Expand Down Expand Up @@ -516,8 +516,8 @@ int main(int argc, char *const argv[]) {
driver.dumpUnparse = true;
} else if (arg == "-funparse-with-symbols") {
driver.dumpUnparseWithSymbols = true;
} else if (arg == "-funparse-typed-exprs-to-pgf90") {
driver.unparseTypedExprsToPGF90 = true;
} else if (arg == "-funparse-typed-exprs-to-f18-fc") {
driver.unparseTypedExprsToF18_FC = true;
} else if (arg == "-fparse-only") {
driver.parseOnly = true;
} else if (arg == "-c") {
Expand Down Expand Up @@ -626,11 +626,11 @@ int main(int argc, char *const argv[]) {
llvm::errs() << "\nf18 compiler (under development)\n";
return exitStatus;
} else {
driver.pgf90Args.push_back(arg);
driver.F18_FCArgs.push_back(arg);
if (arg == "-v") {
driver.verbose = true;
} else if (arg == "-I") {
driver.pgf90Args.push_back(args.front());
driver.F18_FCArgs.push_back(args.front());
driver.searchDirectories.push_back(args.front());
args.pop_front();
} else if (arg.substr(0, 2) == "-I") {
Expand All @@ -645,21 +645,21 @@ int main(int argc, char *const argv[]) {
if (isPGF90) {
if (!options.features.IsEnabled(
Fortran::common::LanguageFeature::BackslashEscapes)) {
driver.pgf90Args.push_back(
driver.F18_FCArgs.push_back(
"-Mbackslash"); // yes, this *disables* them in pgf90
}
if (options.features.IsEnabled(Fortran::common::LanguageFeature::OpenMP)) {
driver.pgf90Args.push_back("-mp");
driver.F18_FCArgs.push_back("-mp");
}

Fortran::parser::useHexadecimalEscapeSequences = false;
} else {
if (options.features.IsEnabled(
Fortran::common::LanguageFeature::BackslashEscapes)) {
driver.pgf90Args.push_back("-fbackslash");
driver.F18_FCArgs.push_back("-fbackslash");
}
if (options.features.IsEnabled(Fortran::common::LanguageFeature::OpenMP)) {
driver.pgf90Args.push_back("-fopenmp");
driver.F18_FCArgs.push_back("-fopenmp");
}

Fortran::parser::useHexadecimalEscapeSequences = true;
Expand Down

0 comments on commit 02c3f70

Please sign in to comment.