r256920 - Add -fno-movt frontend option, to disable movt/movw on ARM

Dimitry Andric via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 5 23:42:18 PST 2016


Author: dim
Date: Wed Jan  6 01:42:18 2016
New Revision: 256920

URL: http://llvm.org/viewvc/llvm-project?rev=256920&view=rev
Log:
Add -fno-movt frontend option, to disable movt/movw on ARM

Summary:
In rL256641, @davide turned off movt generation by default for FreeBSD.
This was because our ld is very old, and did not support the relocations
for it.  However, Ian Lepore added the support very recently, so we
would like to revert rL256641, and replace it with a new `-fno-movt`
frontend option.  This way, it can be turned off when needed.

Reviewers: dexonsmith, echristo, emaste, davide

Subscribers: andrew, aemerson, rengolin, davide, cfe-commits, ahatanak, emaste

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

Modified:
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/arm-no-movt.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=256920&r1=256919&r2=256920&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Jan  6 01:42:18 2016
@@ -1385,6 +1385,8 @@ def mno_restrict_it: Flag<["-"], "mno-re
 def marm : Flag<["-"], "marm">, Alias<mno_thumb>;
 def ffixed_r9 : Flag<["-"], "ffixed-r9">, Group<m_arm_Features_Group>,
   HelpText<"Reserve the r9 register (ARM only)">;
+def mno_movt : Flag<["-"], "mno-movt">, Group<m_arm_Features_Group>,
+  HelpText<"Disallow use of movt/movw pairs (ARM only)">;
 def mcrc : Flag<["-"], "mcrc">, Group<m_arm_Features_Group>,
   HelpText<"Allow use of CRC instructions (ARM only)">;
 def mnocrc : Flag<["-"], "mnocrc">, Group<m_arm_Features_Group>,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=256920&r1=256919&r2=256920&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jan  6 01:42:18 2016
@@ -938,8 +938,8 @@ static void getARMTargetFeatures(const T
   if (Args.hasArg(options::OPT_ffixed_r9))
     Features.push_back("+reserve-r9");
 
-  // The kext and FreeBSD linkers don't know how to deal with movw/movt.
-  if (KernelOrKext || Triple.isOSFreeBSD())
+  // The kext linker doesn't know how to deal with movw/movt.
+  if (KernelOrKext || Args.hasArg(options::OPT_mno_movt))
     Features.push_back("+no-movt");
 }
 

Modified: cfe/trunk/test/Driver/arm-no-movt.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-no-movt.c?rev=256920&r1=256919&r2=256920&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arm-no-movt.c (original)
+++ cfe/trunk/test/Driver/arm-no-movt.c Wed Jan  6 01:42:18 2016
@@ -4,11 +4,11 @@
 // RUN: %clang -target armv7-apple-darwin -mkernel -### %s 2>&1 \
 // RUN:    | FileCheck %s -check-prefix CHECK-KERNEL
 
-// RUN: %clang -target armv7-gnueabi-freebsd11 -### %s 2>&1 \
-// RUN:    | FileCheck %s -check-prefix CHECK-FREEBSD
+// RUN: %clang -target armv7-none-gnueabi -mno-movt -### %s 2>&1 \
+// RUN:    | FileCheck %s -check-prefix CHECK-NO-MOVT
 
 // CHECK-DEFAULT-NOT: "-target-feature" "+no-movt"
 
 // CHECK-KERNEL: "-target-feature" "+no-movt"
 
-// CHECK-FREEBSD: "-target-feature" "+no-movt"
+// CHECK-NO-MOVT: "-target-feature" "+no-movt"




More information about the cfe-commits mailing list