[PATCH] D22761: [ARM] Pass -mimplcit-it= to integrated assembler

Oliver Stannard via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 09:24:45 PDT 2016


olista01 created this revision.
olista01 added a reviewer: rengolin.
olista01 added a subscriber: llvm-commits.
olista01 set the repository for this revision to rL LLVM.
Herald added subscribers: samparker, rengolin, aemerson.

Pass the new -mimplcit-it= option though to the ARM integrated assembler.

Repository:
  rL LLVM

https://reviews.llvm.org/D22761

Files:
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  test/Driver/arm-implicit-it.s

Index: test/Driver/arm-implicit-it.s
===================================================================
--- /dev/null
+++ test/Driver/arm-implicit-it.s
@@ -0,0 +1,24 @@
+// RUN: %clang -target armv7--none-eabi -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-DEFAULT
+
+// RUN: %clang -target armv7--none-eabi -mimplicit-it=arm -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-ARM
+
+// RUN: %clang -target armv7--none-eabi -mimplicit-it=thumb -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-THUMB
+
+// RUN: %clang -target armv7--none-eabi -mimplicit-it=never -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-NEVER
+
+// RUN: %clang -target armv7--none-eabi -mimplicit-it=always -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-ALWAYS
+
+// RUN: %clang -target armv7--none-eabi -mimplicit-it=thisisnotavalidoption -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-INVALID
+
+// CHECK-DEFAULT-NOT: "-mimplicit-it
+// CHECK-ARM: "-mimplicit-it=arm"
+// CHECK-THUMB: "-mimplicit-it=thumb"
+// CHECK-NEVER: "-mimplicit-it=never"
+// CHECK-ALWAYS: "-mimplicit-it=always"
+// CHECK-INVALID: error: unsupported argument 'thisisnotavalidoption' to option 'mimplicit-it='
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2882,6 +2882,27 @@
                    DefaultIncrementalLinkerCompatible))
     CmdArgs.push_back("-mincremental-linker-compatible");
 
+  switch (C.getDefaultToolChain().getArch()) {
+  case llvm::Triple::arm:
+  case llvm::Triple::armeb:
+  case llvm::Triple::thumb:
+  case llvm::Triple::thumbeb:
+    if (Arg *A = Args.getLastArg(options::OPT_mimplicit_it_EQ)) {
+      StringRef Value = A->getValue();
+      if (Value == "always" || Value == "never" || Value == "arm" ||
+          Value == "thumb") {
+        CmdArgs.push_back("-mllvm");
+        CmdArgs.push_back(Args.MakeArgString("-implicit-it=" + Value));
+      } else {
+        D.Diag(diag::err_drv_unsupported_option_argument)
+            << A->getOption().getName() << Value;
+      }
+    }
+    break;
+  default:
+    break;
+  }
+
   // When passing -I arguments to the assembler we sometimes need to
   // unconditionally take the next argument.  For example, when parsing
   // '-Wa,-I -Wa,foo' we need to accept the -Wa,foo arg after seeing the
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1374,6 +1374,7 @@
 def march_EQ : Joined<["-"], "march=">, Group<m_Group>;
 def masm_EQ : Joined<["-"], "masm=">, Group<m_Group>, Flags<[DriverOption]>;
 def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>;
+def mimplicit_it_EQ : Joined<["-"], "mimplicit-it=">, Group<m_Group>;
 def mconstant_cfstrings : Flag<["-"], "mconstant-cfstrings">, Group<clang_ignored_m_Group>;
 def mconsole : Joined<["-"], "mconsole">, Group<m_Group>, Flags<[DriverOption]>;
 def mwindows : Joined<["-"], "mwindows">, Group<m_Group>, Flags<[DriverOption]>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22761.65357.patch
Type: text/x-patch
Size: 3140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160725/efc1c1cc/attachment.bin>


More information about the llvm-commits mailing list