]> granicus.if.org Git - clang/commitdiff
[mips] Invert the abicalls feature bit to be noabicalls so that it's possible for...
authorDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 8 Aug 2014 15:47:17 +0000 (15:47 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 8 Aug 2014 15:47:17 +0000 (15:47 +0000)
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215211 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/mips-features.c
test/Driver/mips-integrated-as.s

index 303d11509d14a7a428ad1cc394cd994ad1fd069c..0e51c3c82c020866ed94639ffd82ecd295c3526a 100644 (file)
@@ -1040,12 +1040,8 @@ static void getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple,
   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 @@ void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
     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);
 
index 964e88bfb8bc91b419d504cd632b4019d38926e2..f7022306fc118cac035e78318692e6c9a321755b 100644 (file)
@@ -1,16 +1,14 @@
 // Check handling MIPS specific features options.
 //
 // -mabicalls
-// RUN: %clang -target mips-linux-gnu -### -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-MABICALLS %s
 // RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mabicalls 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MABICALLS %s
-// CHECK-MABICALLS: "-target-feature" "+abicalls"
+// CHECK-MABICALLS: "-target-feature" "-noabicalls"
 //
 // -mno-abicalls
 // RUN: %clang -target mips-linux-gnu -### -c %s -mabicalls -mno-abicalls 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MNOABICALLS %s
-// CHECK-MNOABICALLS: "-target-feature" "-abicalls"
+// CHECK-MNOABICALLS: "-target-feature" "+noabicalls"
 //
 // -mips16
 // RUN: %clang -target mips-linux-gnu -### -c %s \
index 398ea458dcbca90a56b3b39a87216aa6b89818ba..b648650e4be92cae018067ee5c0341f2e80f3b4d 100644 (file)
 // FPXX-ODDSPREG: "-target-feature" "+fpxx"
 // FPXX-ODDSPREG: "-target-feature" "-nooddspreg"
 
-// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \
-// RUN:   FileCheck -check-prefix=ABICALLS-ON %s
 // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabicalls 2>&1 | \
 // RUN:   FileCheck -check-prefix=ABICALLS-ON %s
 // ABICALLS-ON: -cc1as
-// ABICALLS-ON: "-target-feature" "+abicalls"
+// ABICALLS-ON: "-target-feature" "-noabicalls"
 
 // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mno-abicalls 2>&1 | \
 // RUN:   FileCheck -check-prefix=ABICALLS-OFF %s
 // ABICALLS-OFF: -cc1as
-// ABICALLS-OFF: "-target-feature" "-abicalls"
+// ABICALLS-OFF: "-target-feature" "+noabicalls"