aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/SystemZ.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/SystemZ.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/SystemZ.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/SystemZ.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/SystemZ.cpp
index 2b77d59fdc66..f81bf68172de 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/SystemZ.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/SystemZ.cpp
@@ -7,6 +7,8 @@
//===----------------------------------------------------------------------===//
#include "SystemZ.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/Host.h"
@@ -16,24 +18,40 @@ using namespace clang::driver::tools;
using namespace clang;
using namespace llvm::opt;
+systemz::FloatABI systemz::getSystemZFloatABI(const Driver &D,
+ const ArgList &Args) {
+ // Hard float is the default.
+ systemz::FloatABI ABI = systemz::FloatABI::Hard;
+ if (Args.hasArg(options::OPT_mfloat_abi_EQ))
+ D.Diag(diag::err_drv_unsupported_opt)
+ << Args.getLastArg(options::OPT_mfloat_abi_EQ)->getAsString(Args);
+
+ if (Arg *A = Args.getLastArg(clang::driver::options::OPT_msoft_float,
+ options::OPT_mhard_float))
+ if (A->getOption().matches(clang::driver::options::OPT_msoft_float))
+ ABI = systemz::FloatABI::Soft;
+
+ return ABI;
+}
+
std::string systemz::getSystemZTargetCPU(const ArgList &Args) {
if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) {
llvm::StringRef CPUName = A->getValue();
if (CPUName == "native") {
- std::string CPU = llvm::sys::getHostCPUName();
+ std::string CPU = std::string(llvm::sys::getHostCPUName());
if (!CPU.empty() && CPU != "generic")
return CPU;
else
return "";
}
- return CPUName;
+ return std::string(CPUName);
}
- return "z10";
+ return CLANG_SYSTEMZ_DEFAULT_ARCH;
}
-void systemz::getSystemZTargetFeatures(const ArgList &Args,
+void systemz::getSystemZTargetFeatures(const Driver &D, const ArgList &Args,
std::vector<llvm::StringRef> &Features) {
// -m(no-)htm overrides use of the transactional-execution facility.
if (Arg *A = Args.getLastArg(options::OPT_mhtm, options::OPT_mno_htm)) {
@@ -49,4 +67,8 @@ void systemz::getSystemZTargetFeatures(const ArgList &Args,
else
Features.push_back("-vector");
}
+
+ systemz::FloatABI FloatABI = systemz::getSystemZFloatABI(D, Args);
+ if (FloatABI == systemz::FloatABI::Soft)
+ Features.push_back("+soft-float");
}