[mips] Invert the abicalls feature bit to be noabicalls so that it's possible for -mno-abicalls to take effect.
Also added the testcase that should have been in r215194.
This behaviour has surprised me a few times now. The problem is that the
generated MipsSubtarget::ParseSubtargetFeatures() contains code like this:
if ((Bits & Mips::FeatureABICalls) != 0) IsABICalls = true;
so '-abicalls' means 'leave it at the default' and '+abicalls' means 'set it to
true'. In this case, (and the similar -modd-spreg case) I'd like the code to be
IsABICalls = (Bits & Mips::FeatureABICalls) != 0;
or possibly:
if ((Bits & Mips::FeatureABICalls) != 0)
IsABICalls = true;
else
IsABICalls = false;
and preferably arrange for 'Bits & Mips::FeatureABICalls' to be true by default
(on some triples).
llvm-svn: 215211
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 303d115..0e51c3c 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1040,12 +1040,8 @@
Features.push_back("-n64");
Features.push_back(Args.MakeArgString(ABIFeature));
- // Preserve the current default.
- // FIXME: This ought to depend on Triple.getOS()
- Features.push_back(Args.MakeArgString("+abicalls"));
-
- AddTargetFeature(Args, Features, options::OPT_mabicalls,
- options::OPT_mno_abicalls, "abicalls");
+ AddTargetFeature(Args, Features, options::OPT_mno_abicalls,
+ options::OPT_mabicalls, "noabicalls");
StringRef FloatABI = getMipsFloatABI(D, Args);
if (FloatABI == "soft") {
@@ -7105,8 +7101,6 @@
CmdArgs.push_back("-mabi");
CmdArgs.push_back(ABIName.data());
- // Preserve the current default
- // FIXME: This ought to depend on Triple.getOS().
CmdArgs.push_back("-mabicalls");
Args.AddLastArg(CmdArgs, options::OPT_mabicalls, options::OPT_mno_abicalls);