r195124 - [Mips] Do not adjust float-abi flags in case of MIPS16 mode. This code

Simon Atanasyan simon at atanasyan.com
Tue Nov 19 04:22:39 PST 2013


Author: atanasyan
Date: Tue Nov 19 06:22:38 2013
New Revision: 195124

URL: http://llvm.org/viewvc/llvm-project?rev=195124&view=rev
Log:
[Mips] Do not adjust float-abi flags in case of MIPS16 mode. This code
should be isolated in the backend (r195123). From the frontend point
of view in case of "-mhard-float -mips16" combination of flags the float
ABI mode should remain unchanged.

The patch reviewed by Reed Kotler.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/mips-float.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=195124&r1=195123&r2=195124&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Nov 19 06:22:38 2013
@@ -1015,8 +1015,7 @@ static void AddTargetFeature(const ArgLi
 static void getMIPSTargetFeatures(const Driver &D, const ArgList &Args,
                                   std::vector<const char *> &Features) {
   StringRef FloatABI = getMipsFloatABI(D, Args);
-  bool IsMips16 = Args.getLastArg(options::OPT_mips16) != NULL;
-  if (FloatABI == "soft" || (FloatABI == "hard" && IsMips16)) {
+  if (FloatABI == "soft") {
     // FIXME: Note, this is a hack. We need to pass the selected float
     // mode to the MipsTargetInfoBase to define appropriate macros there.
     // Now it is the only method.
@@ -1057,18 +1056,11 @@ void Clang::AddMIPSTargetArgs(const ArgL
 
   StringRef FloatABI = getMipsFloatABI(D, Args);
 
-  bool IsMips16 = Args.getLastArg(options::OPT_mips16) != NULL;
-
-  if (FloatABI == "soft" || (FloatABI == "hard" && IsMips16)) {
+  if (FloatABI == "soft") {
     // Floating point operations and argument passing are soft.
     CmdArgs.push_back("-msoft-float");
     CmdArgs.push_back("-mfloat-abi");
     CmdArgs.push_back("soft");
-
-    if (FloatABI == "hard" && IsMips16) {
-      CmdArgs.push_back("-mllvm");
-      CmdArgs.push_back("-mips16-hard-float");
-    }
   }
   else {
     // Floating point operations and argument passing are hard.

Modified: cfe/trunk/test/Driver/mips-float.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-float.c?rev=195124&r1=195123&r2=195124&view=diff
==============================================================================
--- cfe/trunk/test/Driver/mips-float.c (original)
+++ cfe/trunk/test/Driver/mips-float.c Tue Nov 19 06:22:38 2013
@@ -60,23 +60,22 @@
 // RUN: %clang -c %s -### -o %t.o 2>&1 \
 // RUN:     -target mips-linux-gnu -mips16 \
 // RUN:   | FileCheck --check-prefix=CHECK-DEF-MIPS16 %s
-// CHECK-DEF-MIPS16: "-mfloat-abi" "soft"
-// CHECK-DEF-MIPS16: "-mllvm" "-mips16-hard-float"
+// CHECK-DEF-MIPS16: "-target-feature" "+mips16"
+// CHECK-DEF-MIPS16: "-mfloat-abi" "hard"
 //
 // -mhard-float -mips16
 // RUN: %clang -c %s -### -o %t.o 2>&1 \
 // RUN:     -target mips-linux-gnu -mhard-float -mips16 \
 // RUN:   | FileCheck --check-prefix=CHECK-HARD-MIPS16 %s
-// CHECK-HARD-MIPS16: "-target-feature" "+soft-float"
-// CHECK-HARD-MIPS16: "-msoft-float"
-// CHECK-HARD-MIPS16: "-mfloat-abi" "soft"
-// CHECK-HARD-MIPS16: "-mllvm" "-mips16-hard-float"
+// CHECK-HARD-MIPS16: "-target-feature" "+mips16"
+// CHECK-HARD-MIPS16: "-mfloat-abi" "hard"
 //
 // -msoft-float -mips16
 // RUN: %clang -c %s -### -o %t.o 2>&1 \
 // RUN:     -target mips-linux-gnu -msoft-float -mips16 \
 // RUN:   | FileCheck --check-prefix=CHECK-SOFT-MIPS16 %s
 // CHECK-SOFT-MIPS16: "-target-feature" "+soft-float"
+// CHECK-SOFT-MIPS16: "-target-feature" "+mips16"
 // CHECK-SOFT-MIPS16: "-msoft-float"
 // CHECK-SOFT-MIPS16: "-mfloat-abi" "soft"
 //
@@ -84,15 +83,14 @@
 // RUN: %clang -c %s -### -o %t.o 2>&1 \
 // RUN:     -target mips-linux-gnu -mfloat-abi=hard -mips16 \
 // RUN:   | FileCheck --check-prefix=CHECK-ABI-HARD-MIPS16 %s
-// CHECK-ABI-HARD-MIPS16: "-target-feature" "+soft-float"
-// CHECK-ABI-HARD-MIPS16: "-msoft-float"
-// CHECK-ABI-HARD-MIPS16: "-mfloat-abi" "soft"
-// CHECK-ABI-HARD-MIPS16: "-mllvm" "-mips16-hard-float"
+// CHECK-ABI-HARD-MIPS16: "-target-feature" "+mips16"
+// CHECK-ABI-HARD-MIPS16: "-mfloat-abi" "hard"
 //
 // -mfloat-abi=soft -mips16
 // RUN: %clang -c %s -### -o %t.o 2>&1 \
 // RUN:     -target mips-linux-gnu -mfloat-abi=soft -mips16 \
 // RUN:   | FileCheck --check-prefix=CHECK-ABI-SOFT-MIPS16 %s
 // CHECK-ABI-SOFT-MIPS16: "-target-feature" "+soft-float"
+// CHECK-ABI-SOFT-MIPS16: "-target-feature" "+mips16"
 // CHECK-ABI-SOFT-MIPS16: "-msoft-float"
 // CHECK-ABI-SOFT-MIPS16: "-mfloat-abi" "soft"





More information about the cfe-commits mailing list