[mips] Add support for command-line options -mno-check-zero-division and
authorAkira Hatanaka <ahatanaka@mips.com>
Fri, 19 Jul 2013 18:58:48 +0000 (18:58 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Fri, 19 Jul 2013 18:58:48 +0000 (18:58 +0000)
-mcheck-zero-division.

llvm-svn: 186710

clang/include/clang/Driver/Options.td
clang/lib/Driver/Tools.cpp
clang/test/Driver/mips-features.c

index fb37228..2035bf8 100644 (file)
@@ -1009,6 +1009,9 @@ def mxgot : Flag<["-"], "mxgot">, Group<m_Group>;
 def mno_xgot : Flag<["-"], "mno-xgot">, Group<m_Group>;
 def mldc1_sdc1 : Flag<["-"], "mldc1-sdc1">, Group<m_Group>;
 def mno_ldc1_sdc1 : Flag<["-"], "mno-ldc1-sdc1">, Group<m_Group>;
+def mcheck_zero_division : Flag<["-"], "mcheck-zero-division">, Group<m_Group>;
+def mno_check_zero_division : Flag<["-"], "mno-check-zero-division">,
+                              Group<m_Group>;
 def mdsp : Flag<["-"], "mdsp">, Group<m_Group>;
 def mno_dsp : Flag<["-"], "mno-dsp">, Group<m_Group>;
 def mdspr2 : Flag<["-"], "mdspr2">, Group<m_Group>;
index c2a0205..83aab8d 100644 (file)
@@ -1039,6 +1039,14 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args,
     }
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_mcheck_zero_division,
+                               options::OPT_mno_check_zero_division)) {
+    if (A->getOption().matches(options::OPT_mno_check_zero_division)) {
+      CmdArgs.push_back("-mllvm");
+      CmdArgs.push_back("-mno-check-zero-division");
+    }
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_G)) {
     StringRef v = A->getValue();
     CmdArgs.push_back("-mllvm");
index 3c1cea5..ffa4dcd 100644 (file)
 // RUN:   | FileCheck --check-prefix=CHECK-NOLDC1SDC1 %s
 // CHECK-NOLDC1SDC1: "-mllvm" "-mno-ldc1-sdc1"
 //
+// -mcheck-zero-division
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN:     -mno-check-zero-division -mcheck-zero-division 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ZERODIV %s
+// CHECK-ZERODIV-NOT: "-mllvm" "-mno-check-zero-division"
+//
+// -mno-check-zero-division
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN:     -mcheck-zero-division -mno-check-zero-division 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NOZERODIV %s
+// CHECK-NOZERODIV: "-mllvm" "-mno-check-zero-division"
+//
 // -G
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:     -G 16 2>&1 \