r239755 - [Sparc] Make soft-float emit an error.
James Y Knight
jyknight at google.com
Mon Jun 15 13:51:25 PDT 2015
Author: jyknight
Date: Mon Jun 15 15:51:24 2015
New Revision: 239755
URL: http://llvm.org/viewvc/llvm-project?rev=239755&view=rev
Log:
[Sparc] Make soft-float emit an error.
LLVM does not and has not ever supported a soft-float ABI mode on
Sparc, so don't pretend that it does.
Also switch the default from "soft-float" -- which was actually
hard-float because soft-float is unimplemented -- to hard-float.
Differential Revision: http://reviews.llvm.org/D10457
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/sparc-float.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=239755&r1=239754&r2=239755&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Jun 15 15:51:24 2015
@@ -1334,47 +1334,26 @@ static std::string getR600TargetGPU(cons
return "";
}
-static void getSparcTargetFeatures(const ArgList &Args,
- std::vector<const char *> &Features) {
- bool SoftFloatABI = true;
- if (Arg *A =
- Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float)) {
- if (A->getOption().matches(options::OPT_mhard_float))
- SoftFloatABI = false;
- }
- if (SoftFloatABI)
- Features.push_back("+soft-float");
-}
-
void Clang::AddSparcTargetArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
const Driver &D = getToolChain().getDriver();
+ std::string Triple = getToolChain().ComputeEffectiveClangTriple(Args);
- // Select the float ABI as determined by -msoft-float and -mhard-float.
- StringRef FloatABI;
- if (Arg *A = Args.getLastArg(options::OPT_msoft_float,
- options::OPT_mhard_float)) {
+ bool SoftFloatABI = false;
+ if (Arg *A =
+ Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float)) {
if (A->getOption().matches(options::OPT_msoft_float))
- FloatABI = "soft";
- else if (A->getOption().matches(options::OPT_mhard_float))
- FloatABI = "hard";
+ SoftFloatABI = true;
}
- // If unspecified, choose the default based on the platform.
- if (FloatABI.empty()) {
- // Assume "soft", but warn the user we are guessing.
- FloatABI = "soft";
- D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft";
- }
-
- if (FloatABI == "soft") {
- // Floating point operations and argument passing are soft.
- //
- // FIXME: This changes CPP defines, we need -target-soft-float.
- CmdArgs.push_back("-msoft-float");
- } else {
- assert(FloatABI == "hard" && "Invalid float abi!");
- CmdArgs.push_back("-mhard-float");
+ // Only the hard-float ABI on Sparc is standardized, and it is the
+ // default. GCC also supports a nonstandard soft-float ABI mode, and
+ // perhaps LLVM should implement that, too. However, since llvm
+ // currently does not support Sparc soft-float, at all, display an
+ // error if it's requested.
+ if (SoftFloatABI) {
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << "-msoft-float" << Triple;
}
}
@@ -1996,11 +1975,6 @@ static void getTargetFeatures(const Driv
case llvm::Triple::ppc64le:
getPPCTargetFeatures(Args, Features);
break;
- case llvm::Triple::sparc:
- case llvm::Triple::sparcel:
- case llvm::Triple::sparcv9:
- getSparcTargetFeatures(Args, Features);
- break;
case llvm::Triple::systemz:
getSystemZTargetFeatures(Args, Features);
break;
Modified: cfe/trunk/test/Driver/sparc-float.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sparc-float.c?rev=239755&r1=239754&r2=239755&view=diff
==============================================================================
--- cfe/trunk/test/Driver/sparc-float.c (original)
+++ cfe/trunk/test/Driver/sparc-float.c Mon Jun 15 15:51:24 2015
@@ -5,38 +5,36 @@
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-DEF %s
-// CHECK-DEF: "-target-feature" "+soft-float"
-// CHECK-DEF: "-msoft-float"
+// CHECK-DEF-NOT: "-target-feature" "+soft-float"
+// CHECK-DEF-NOT: "-msoft-float"
//
// -mhard-float
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc-linux-gnu -mhard-float \
// RUN: | FileCheck --check-prefix=CHECK-HARD %s
-// CHECK-HARD: "-mhard-float"
+// CHECK-HARD-NOT: "-msoft-float"
//
// -msoft-float
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc-linux-gnu -msoft-float \
// RUN: | FileCheck --check-prefix=CHECK-SOFT %s
-// CHECK-SOFT: "-target-feature" "+soft-float"
-// CHECK-SOFT: "-msoft-float"
+// CHECK-SOFT: error: unsupported option '-msoft-float'
//
// Default sparc64
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc64-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-DEF-SPARC64 %s
-// CHECK-DEF-SPARC64: "-target-feature" "+soft-float"
-// CHECK-DEF-SPARC64: "-msoft-float"
+// CHECK-DEF-SPARC64-NOT: "-target-feature" "+soft-float"
+// CHECK-DEF-SPARC64-NOT: "-msoft-float"
//
// -mhard-float
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc64-linux-gnu -mhard-float \
// RUN: | FileCheck --check-prefix=CHECK-HARD-SPARC64 %s
-// CHECK-HARD-SPARC64: "-mhard-float"
+// CHECK-HARD-SPARC64-NOT: "-msoft-float"
//
// -msoft-float
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc64-linux-gnu -msoft-float \
// RUN: | FileCheck --check-prefix=CHECK-SOFT-SPARC64 %s
-// CHECK-SOFT-SPARC64: "-target-feature" "+soft-float"
-// CHECK-SOFT-SPARC64: "-msoft-float"
+// CHECK-SOFT-SPARC64: error: unsupported option '-msoft-float'
More information about the cfe-commits
mailing list