[PATCH] D13100: [mips] Separated mips specific -Wa options, so that they are not checked on other platforms.

Scott Egerton via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 08:47:13 PDT 2015


s.egerton updated this revision to Diff 36252.
s.egerton added a comment.

Responded to comments made on the mailing list.


http://reviews.llvm.org/D13100

Files:
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2351,10 +2351,35 @@
         continue;
       }
 
-      bool IsMips = C.getDefaultToolChain().getArch() == llvm::Triple::mips ||
-                    C.getDefaultToolChain().getArch() == llvm::Triple::mipsel ||
-                    C.getDefaultToolChain().getArch() == llvm::Triple::mips64 ||
-                    C.getDefaultToolChain().getArch() == llvm::Triple::mips64el;
+      switch (C.getDefaultToolChain().getArch()) {
+      default:
+        break;
+      case llvm::Triple::mips:
+      case llvm::Triple::mipsel:
+      case llvm::Triple::mips64:
+      case llvm::Triple::mips64el:
+        if (Value == "--trap") {
+          CmdArgs.push_back("-target-feature");
+          CmdArgs.push_back("+use-tcc-in-div");
+          continue;
+        }
+        if (Value == "--break") {
+          CmdArgs.push_back("-target-feature");
+          CmdArgs.push_back("-use-tcc-in-div");
+          continue;
+        }
+        if (Value.startswith("-msoft-float")) {
+          CmdArgs.push_back("-target-feature");
+          CmdArgs.push_back("+soft-float");
+          continue;
+        }
+        if (Value.startswith("-mhard-float")) {
+          CmdArgs.push_back("-target-feature");
+          CmdArgs.push_back("-soft-float");
+          continue;
+        }
+        break;
+      }
 
       if (Value == "-force_cpusubtype_ALL") {
         // Do nothing, this is the default and we don't support anything else.
@@ -2381,18 +2406,6 @@
       } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") ||
                  Value.startswith("-mhwdiv") || Value.startswith("-march")) {
         // Do nothing, we'll validate it later.
-      } else if (IsMips && Value == "--trap") {
-        CmdArgs.push_back("-target-feature");
-        CmdArgs.push_back("+use-tcc-in-div");
-      } else if (IsMips && Value == "--break") {
-        CmdArgs.push_back("-target-feature");
-        CmdArgs.push_back("-use-tcc-in-div");
-      } else if (IsMips && Value.startswith("-msoft-float")) {
-        CmdArgs.push_back("-target-feature");
-        CmdArgs.push_back("+soft-float");
-      } else if (IsMips && Value.startswith("-mhard-float")) {
-        CmdArgs.push_back("-target-feature");
-        CmdArgs.push_back("-soft-float");
       } else {
         D.Diag(diag::err_drv_unsupported_option_argument)
             << A->getOption().getName() << Value;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13100.36252.patch
Type: text/x-patch
Size: 2527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151001/413fc992/attachment-0001.bin>


More information about the cfe-commits mailing list