Skip to content

Commit

Permalink
Merge pull request #33 from flang-compiler/sjs_60
Browse files Browse the repository at this point in the history
Set flang default to use barriers for atomics.
  • Loading branch information
sscalpone authored Aug 17, 2018
2 parents b12b396 + 6d36b3d commit 79937ec
Showing 1 changed file with 47 additions and 40 deletions.
87 changes: 47 additions & 40 deletions lib/Driver/ToolChains/Flang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ void FlangFrontend::ConstructJob(Compilation &C, const JobAction &JA,
CommonCmdArgs.push_back("-x");
CommonCmdArgs.push_back("69");
CommonCmdArgs.push_back("0x400");

// Disable use of native atomic instructions
// for OpenMP atomics pending either a named
// option or a libatomic bundled with flang.
UpperCmdArgs.push_back("-x");
UpperCmdArgs.push_back("69");
UpperCmdArgs.push_back("0x1000");
}
}

Expand Down Expand Up @@ -333,46 +340,6 @@ void FlangFrontend::ConstructJob(Compilation &C, const JobAction &JA,
UpperCmdArgs.push_back("0x10");
}

// Set a -x flag for first part of Fortran frontend
for (Arg *A : Args.filtered(options::OPT_Hx_EQ)) {
A->claim();
StringRef Value = A->getValue();
auto XFlag = Value.split(",");
UpperCmdArgs.push_back("-x");
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.first));
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.second));
}

// Set a -y flag for first part of Fortran frontend
for (Arg *A : Args.filtered(options::OPT_Hy_EQ)) {
A->claim();
StringRef Value = A->getValue();
auto XFlag = Value.split(",");
UpperCmdArgs.push_back("-y");
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.first));
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.second));
}

// Set a -q (debug) flag for first part of Fortran frontend
for (Arg *A : Args.filtered(options::OPT_Hq_EQ)) {
A->claim();
StringRef Value = A->getValue();
auto XFlag = Value.split(",");
UpperCmdArgs.push_back("-q");
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.first));
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.second));
}

// Set a -qq (debug) flag for first part of Fortran frontend
for (Arg *A : Args.filtered(options::OPT_Hqq_EQ)) {
A->claim();
StringRef Value = A->getValue();
auto XFlag = Value.split(",");
UpperCmdArgs.push_back("-qq");
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.first));
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.second));
}

// Pass an arbitrary flag for first part of Fortran frontend
for (Arg *A : Args.filtered(options::OPT_Wh_EQ)) {
A->claim();
Expand Down Expand Up @@ -767,6 +734,46 @@ void FlangFrontend::ConstructJob(Compilation &C, const JobAction &JA,
}
}

// Set a -x flag for first part of Fortran frontend
for (Arg *A : Args.filtered(options::OPT_Hx_EQ)) {
A->claim();
StringRef Value = A->getValue();
auto XFlag = Value.split(",");
UpperCmdArgs.push_back("-x");
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.first));
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.second));
}

// Set a -y flag for first part of Fortran frontend
for (Arg *A : Args.filtered(options::OPT_Hy_EQ)) {
A->claim();
StringRef Value = A->getValue();
auto XFlag = Value.split(",");
UpperCmdArgs.push_back("-y");
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.first));
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.second));
}

// Set a -q (debug) flag for first part of Fortran frontend
for (Arg *A : Args.filtered(options::OPT_Hq_EQ)) {
A->claim();
StringRef Value = A->getValue();
auto XFlag = Value.split(",");
UpperCmdArgs.push_back("-q");
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.first));
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.second));
}

// Set a -qq (debug) flag for first part of Fortran frontend
for (Arg *A : Args.filtered(options::OPT_Hqq_EQ)) {
A->claim();
StringRef Value = A->getValue();
auto XFlag = Value.split(",");
UpperCmdArgs.push_back("-qq");
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.first));
UpperCmdArgs.push_back(Args.MakeArgString(XFlag.second));
}

const char * STBFile = Args.MakeArgString(Stem + ".stb");
C.addTempFile(STBFile);
UpperCmdArgs.push_back("-stbfile");
Expand Down

0 comments on commit 79937ec

Please sign in to comment.