r242755 - [ARM] Pass subtarget feature "+reserve-r9" instead of passing backend

Akira Hatanaka ahatanaka at apple.com
Mon Jul 20 18:41:08 PDT 2015


Author: ahatanak
Date: Mon Jul 20 20:41:08 2015
New Revision: 242755

URL: http://llvm.org/viewvc/llvm-project?rev=242755&view=rev
Log:
[ARM] Pass subtarget feature "+reserve-r9" instead of passing backend
option "-arm-reserve-r9".

This recommits r242736, which had to be reverted because the llvm-side
change that was committed in r242737 caused the number of subtarget
features to go over the limit of 64.

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/D11319

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/arm-fixed-r9.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=242755&r1=242754&r2=242755&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Jul 20 20:41:08 2015
@@ -719,6 +719,12 @@ static void getARMTargetFeatures(const D
       Features.push_back("+long-calls");
   }
 
+  // llvm does not support reserving registers in general. There is support
+  // for reserving r9 on ARM though (defined as a platform-specific register
+  // in ARM EABI).
+  if (Args.hasArg(options::OPT_ffixed_r9))
+    Features.push_back("+reserve-r9");
+
   // The kext linker doesn't know how to deal with movw/movt.
   if (KernelOrKext)
     Features.push_back("+no-movt");
@@ -828,13 +834,6 @@ void Clang::AddARMTargetArgs(const ArgLi
                     options::OPT_mno_implicit_float, true))
     CmdArgs.push_back("-no-implicit-float");
 
-  // llvm does not support reserving registers in general. There is support
-  // for reserving r9 on ARM though (defined as a platform-specific register
-  // in ARM EABI).
-  if (Args.hasArg(options::OPT_ffixed_r9)) {
-    CmdArgs.push_back("-backend-option");
-    CmdArgs.push_back("-arm-reserve-r9");
-  }
 }
 
 /// getAArch64TargetCPU - Get the (LLVM) name of the AArch64 cpu we are

Modified: cfe/trunk/test/Driver/arm-fixed-r9.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-fixed-r9.c?rev=242755&r1=242754&r2=242755&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arm-fixed-r9.c (original)
+++ cfe/trunk/test/Driver/arm-fixed-r9.c Mon Jul 20 20:41:08 2015
@@ -1,4 +1,4 @@
 // RUN: %clang -target arm-none-gnueabi -ffixed-r9 -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-FIXED-R9 < %t %s
 
-// CHECK-FIXED-R9: "-backend-option" "-arm-reserve-r9"
+// CHECK-FIXED-R9: "-target-feature" "+reserve-r9"





More information about the cfe-commits mailing list