[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 llvm-svn: 239755
This commit is contained in:
parent
91244924cb
commit
b240652746
|
@ -1334,47 +1334,26 @@ static std::string getR600TargetGPU(const ArgList &Args) {
|
|||
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 Driver &D, const llvm::Triple &Triple,
|
|||
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;
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue