r242368 - [ARM] Pass subtarget feature "+no-movt" instead of passing backend option

Akira Hatanaka ahatanaka at apple.com
Wed Jul 15 17:43:00 PDT 2015


Author: ahatanak
Date: Wed Jul 15 19:43:00 2015
New Revision: 242368

URL: http://llvm.org/viewvc/llvm-project?rev=242368&view=rev
Log:
[ARM] Pass subtarget feature "+no-movt" instead of passing backend option
"-arm-use-movt=0".
        
This change is needed since backend options do not make it to the backend
when doing LTO and are not capable of changing the behavior of code-gen
passes on a per-function basis.

rdar://problem/21529937

Differential Revision: http://reviews.llvm.org/D11025

Added:
    cfe/trunk/test/CodeGen/arm-no-movt.c
    cfe/trunk/test/Driver/arm-no-movt.c
Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=242368&r1=242367&r2=242368&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jul 15 19:43:00 2015
@@ -718,6 +718,10 @@ static void getARMTargetFeatures(const D
   } else if (KernelOrKext && (!Triple.isiOS() || Triple.isOSVersionLT(6))) {
       Features.push_back("+long-calls");
   }
+
+  // The kext linker doesn't know how to deal with movw/movt.
+  if (KernelOrKext)
+    Features.push_back("+no-movt");
 }
 
 void Clang::AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs,
@@ -793,10 +797,6 @@ void Clang::AddARMTargetArgs(const ArgLi
   if (KernelOrKext) {
     CmdArgs.push_back("-backend-option");
     CmdArgs.push_back("-arm-strict-align");
-
-    // The kext linker doesn't know how to deal with movw/movt.
-    CmdArgs.push_back("-backend-option");
-    CmdArgs.push_back("-arm-use-movt=0");
   }
 
   // -mkernel implies -mstrict-align; don't add the redundant option.

Added: cfe/trunk/test/CodeGen/arm-no-movt.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-no-movt.c?rev=242368&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/arm-no-movt.c (added)
+++ cfe/trunk/test/CodeGen/arm-no-movt.c Wed Jul 15 19:43:00 2015
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple thumbv7-apple-ios5  -target-feature +no-movt -emit-llvm -o - %s | FileCheck -check-prefix=NO-MOVT %s
+// RUN: %clang_cc1 -triple thumbv7-apple-ios5 -emit-llvm -o - %s | FileCheck -check-prefix=MOVT %s
+
+// NO-MOVT: attributes #0 = { {{.*}} "target-features"="+no-movt"
+// MOVT-NOT: attributes #0 = { {{.*}} "target-features"="+no-movt"
+
+int foo1(int a) { return a; }

Added: cfe/trunk/test/Driver/arm-no-movt.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-no-movt.c?rev=242368&view=auto
==============================================================================
--- cfe/trunk/test/Driver/arm-no-movt.c (added)
+++ cfe/trunk/test/Driver/arm-no-movt.c Wed Jul 15 19:43:00 2015
@@ -0,0 +1,9 @@
+// RUN: %clang -target armv7-apple-darwin -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-DEFAULT
+
+// RUN: %clang -target armv7-apple-darwin -mkernel -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-KERNEL
+
+// CHECK-DEFAULT-NOT: "-target-feature" "+no-movt"
+
+// CHECK-KERNEL: "-target-feature" "+no-movt"





More information about the cfe-commits mailing list