<div dir="ltr">On Thu, Jul 24, 2014 at 7:17 AM, Benjamin Foster <span dir="ltr"><<a href="mailto:benjamin.foster@arm.com" target="_blank">benjamin.foster@arm.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Emit the build attribute describing how the r9 register is to be treated, (i.e. as V6 or not at all).<br>
<br>
<a href="http://reviews.llvm.org/D4657" target="_blank">http://reviews.llvm.org/D4657</a><br>
<br>
Files:<br>
  include/llvm/Support/ARMBuildAttributes.h<br>
  lib/Target/ARM/ARMAsmPrinter.cpp<br>
  test/CodeGen/ARM/build-attributes.ll<br>
<br>
Index: include/llvm/Support/ARMBuildAttributes.h<br>
===================================================================<br>
--- include/llvm/Support/ARMBuildAttributes.h<br>
+++ include/llvm/Support/ARMBuildAttributes.h<br>
@@ -146,6 +146,10 @@<br>
   AllowNeon2 = 2,     // SIMDv2 was permitted (Half-precision FP, MAC operations)<br>
   AllowNeonARMv8 = 3, // ARM v8-A SIMD was permitted<br>
<br>
+  // Tag_ABI_PCS_R9_use, (=14), uleb128<br>
+  R9UsedAsV6 = 0, // R9 used as v6 (just another callee-saved register)<br>
+  R9Reserved = 3, // R9 not used at all by code associated with attributed entity<br></blockquote><div><br></div><div>I think that R9IsGPR is a better name.  Can you also add R9IsSB (1) and R9IsTLSPointer (2) as well to the enumeration if you are adding this?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
   // Tag_ABI_PCS_RW_data, (=15), uleb128<br>
   AddressRWPCRel = 1, // Address RW static data PC-relative<br>
   AddressRWSBRel = 2, // Address RW static data SB-relative<br>
Index: lib/Target/ARM/ARMAsmPrinter.cpp<br>
===================================================================<br>
--- lib/Target/ARM/ARMAsmPrinter.cpp<br>
+++ lib/Target/ARM/ARMAsmPrinter.cpp<br>
@@ -757,6 +757,15 @@<br>
     }<br>
   }<br>
<br>
+  // ABI_PCS_R9_use, we only support either reserving the register, or treating<br>
+  // it as another callee-saved register, but not as SB or a TLS pointer.<br></blockquote><div><br></div><div>I think that this should be a TODO item here.  It would be nicer to push this down from the fronted as metadata similar to the wchar size tag.</div>
<div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+  if (Subtarget->isR9Reserved())<br>
+      ATS.emitAttribute(ARMBuildAttrs::ABI_PCS_R9_use,<br>
+                        ARMBuildAttrs::R9Reserved);<br>
+  else<br>
+      ATS.emitAttribute(ARMBuildAttrs::ABI_PCS_R9_use,<br>
+                        ARMBuildAttrs::R9UsedAsV6);<br>
+<br>
   if (Subtarget->hasTrustZone() && Subtarget->hasVirtualization())<br>
       ATS.emitAttribute(ARMBuildAttrs::Virtualization_use,<br>
                         ARMBuildAttrs::AllowTZVirtualization);<br>
Index: test/CodeGen/ARM/build-attributes.ll<br>
===================================================================<br>
--- test/CodeGen/ARM/build-attributes.ll<br>
+++ test/CodeGen/ARM/build-attributes.ll<br>
@@ -38,6 +38,8 @@<br>
 ; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -relocation-model=default | FileCheck %s --check-prefix=RELOC-OTHER<br>
 ; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -relocation-model=dynamic-no-pic | FileCheck %s --check-prefix=RELOC-OTHER<br>
 ; RUN: llc < %s -mtriple=arm-none-linux-gnueabi | FileCheck %s --check-prefix=RELOC-OTHER<br>
+; RUN: llc < %s -mtriple=arm-none-linux-gnueabi | FileCheck %s --check-prefix=PCS-R9-USE<br>
+; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -arm-reserve-r9 | FileCheck %s --check-prefix=PCS-R9-RESERVE<br>
<br>
 ; XSCALE:      .eabi_attribute 6, 5<br>
 ; XSCALE:      .eabi_attribute 8, 1<br>
@@ -463,6 +465,9 @@<br>
 ; RELOC-PIC:  .eabi_attribute 17, 2<br>
 ; RELOC-OTHER:  .eabi_attribute 17, 1<br>
<br>
+; PCS-R9-USE:  .eabi_attribute 14, 0<br>
+; PCS-R9-RESERVE:  .eabi_attribute 14, 3<br>
+<br>
 define i32 @f(i64 %z) {<br>
        ret i32 0<br>
 }<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org
</div></div>