r215211 - [mips] Invert the abicalls feature bit to be noabicalls so that it's possible for -mno-abicalls to take effect.

Daniel Sanders daniel.sanders at imgtec.com
Fri Aug 8 08:47:17 PDT 2014


Author: dsanders
Date: Fri Aug  8 10:47:17 2014
New Revision: 215211

URL: http://llvm.org/viewvc/llvm-project?rev=215211&view=rev
Log:
[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).


Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/mips-features.c
    cfe/trunk/test/Driver/mips-integrated-as.s

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=215211&r1=215210&r2=215211&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Aug  8 10:47:17 2014
@@ -1040,12 +1040,8 @@ static void getMIPSTargetFeatures(const
   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(Co
     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);
 

Modified: cfe/trunk/test/Driver/mips-features.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-features.c?rev=215211&r1=215210&r2=215211&view=diff
==============================================================================
--- cfe/trunk/test/Driver/mips-features.c (original)
+++ cfe/trunk/test/Driver/mips-features.c Fri Aug  8 10:47:17 2014
@@ -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 \

Modified: cfe/trunk/test/Driver/mips-integrated-as.s
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-integrated-as.s?rev=215211&r1=215210&r2=215211&view=diff
==============================================================================
--- cfe/trunk/test/Driver/mips-integrated-as.s (original)
+++ cfe/trunk/test/Driver/mips-integrated-as.s Fri Aug  8 10:47:17 2014
@@ -206,14 +206,12 @@
 // 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"





More information about the cfe-commits mailing list