[flang-commits] [clang] [flang] [flang]Add support for -moutline-atomics and -mno-outline-atomics (PR #78755)
via flang-commits
flang-commits at lists.llvm.org
Wed Jan 31 07:12:03 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 0217d2e089afba8ca33330713787521ba52a1056 26e268baa357c5a10ee2fc54d79f959f1e453e71 -- clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp clang/lib/Driver/ToolChains/CommonArgs.h clang/lib/Driver/ToolChains/Flang.cpp flang/lib/Frontend/CompilerInvocation.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 07e44c1878..8e0350ea87 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7651,7 +7651,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
addMachineOutlinerArgs(D, Args, CmdArgs, Triple, /*IsLTO=*/false);
addOutlineAtomicsArgs(D, getToolChain(), Args, CmdArgs, Triple);
-
+
if (Triple.isAArch64() &&
(Args.hasArg(options::OPT_mno_fmv) ||
(Triple.isAndroid() && Triple.isAndroidVersionLT(23)) ||
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index ad03bdc766..a860c81454 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2791,9 +2791,11 @@ void tools::addHIPRuntimeLibArgs(const ToolChain &TC, Compilation &C,
}
}
-void tools::addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList & CmdArgs, const llvm::Triple &Triple)
-{
- if (Arg *A = Args.getLastArg(options::OPT_moutline_atomics,
+void tools::addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC,
+ const llvm::opt::ArgList &Args,
+ llvm::opt::ArgStringList &CmdArgs,
+ const llvm::Triple &Triple) {
+ if (Arg *A = Args.getLastArg(options::OPT_moutline_atomics,
options::OPT_mno_outline_atomics)) {
// Option -moutline-atomics supported for AArch64 target only.
if (!Triple.isAArch64()) {
@@ -2808,8 +2810,7 @@ void tools::addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC, const ll
CmdArgs.push_back("-outline-atomics");
}
}
- } else if (Triple.isAArch64() &&
- TC.IsAArch64OutlineAtomicsDefault(Args)) {
+ } else if (Triple.isAArch64() && TC.IsAArch64OutlineAtomicsDefault(Args)) {
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("+outline-atomics");
}
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.h b/clang/lib/Driver/ToolChains/CommonArgs.h
index e90c3965bc..2db0f889ca 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.h
+++ b/clang/lib/Driver/ToolChains/CommonArgs.h
@@ -216,7 +216,10 @@ void addOpenMPDeviceRTL(const Driver &D, const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
StringRef BitcodeSuffix, const llvm::Triple &Triple);
-void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple);
+void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC,
+ const llvm::opt::ArgList &Args,
+ llvm::opt::ArgStringList &CmdArgs,
+ const llvm::Triple &Triple);
} // end namespace tools
} // end namespace driver
@@ -225,5 +228,4 @@ void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC, const llvm::opt
clang::CodeGenOptions::FramePointerKind
getFramePointerKind(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
-
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 7a6515d368..43789e6046 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -353,7 +353,7 @@ void Flang::addTargetOptions(const ArgList &Args,
}
addOutlineAtomicsArgs(D, getToolChain(), Args, CmdArgs, Triple);
-
+
// Add the target features.
switch (TC.getArch()) {
default:
``````````
</details>
https://github.com/llvm/llvm-project/pull/78755
More information about the flang-commits
mailing list