[PATCH] Emit ABI_PCS_R9_use build attribute.

Saleem Abdulrasool compnerd at compnerd.org
Thu Jul 24 09:15:16 PDT 2014


On Thu, Jul 24, 2014 at 7:17 AM, Benjamin Foster <benjamin.foster at arm.com>
wrote:

> Emit the build attribute describing how the r9 register is to be treated,
> (i.e. as V6 or not at all).
>
> http://reviews.llvm.org/D4657
>
> Files:
>   include/llvm/Support/ARMBuildAttributes.h
>   lib/Target/ARM/ARMAsmPrinter.cpp
>   test/CodeGen/ARM/build-attributes.ll
>
> Index: include/llvm/Support/ARMBuildAttributes.h
> ===================================================================
> --- include/llvm/Support/ARMBuildAttributes.h
> +++ include/llvm/Support/ARMBuildAttributes.h
> @@ -146,6 +146,10 @@
>    AllowNeon2 = 2,     // SIMDv2 was permitted (Half-precision FP, MAC
> operations)
>    AllowNeonARMv8 = 3, // ARM v8-A SIMD was permitted
>
> +  // Tag_ABI_PCS_R9_use, (=14), uleb128
> +  R9UsedAsV6 = 0, // R9 used as v6 (just another callee-saved register)
> +  R9Reserved = 3, // R9 not used at all by code associated with
> attributed entity
>

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?


> +
>    // Tag_ABI_PCS_RW_data, (=15), uleb128
>    AddressRWPCRel = 1, // Address RW static data PC-relative
>    AddressRWSBRel = 2, // Address RW static data SB-relative
> Index: lib/Target/ARM/ARMAsmPrinter.cpp
> ===================================================================
> --- lib/Target/ARM/ARMAsmPrinter.cpp
> +++ lib/Target/ARM/ARMAsmPrinter.cpp
> @@ -757,6 +757,15 @@
>      }
>    }
>
> +  // ABI_PCS_R9_use, we only support either reserving the register, or
> treating
> +  // it as another callee-saved register, but not as SB or a TLS pointer.
>

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.


> +  if (Subtarget->isR9Reserved())
> +      ATS.emitAttribute(ARMBuildAttrs::ABI_PCS_R9_use,
> +                        ARMBuildAttrs::R9Reserved);
> +  else
> +      ATS.emitAttribute(ARMBuildAttrs::ABI_PCS_R9_use,
> +                        ARMBuildAttrs::R9UsedAsV6);
> +
>    if (Subtarget->hasTrustZone() && Subtarget->hasVirtualization())
>        ATS.emitAttribute(ARMBuildAttrs::Virtualization_use,
>                          ARMBuildAttrs::AllowTZVirtualization);
> Index: test/CodeGen/ARM/build-attributes.ll
> ===================================================================
> --- test/CodeGen/ARM/build-attributes.ll
> +++ test/CodeGen/ARM/build-attributes.ll
> @@ -38,6 +38,8 @@
>  ; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -relocation-model=default
> | FileCheck %s --check-prefix=RELOC-OTHER
>  ; RUN: llc < %s -mtriple=arm-none-linux-gnueabi
> -relocation-model=dynamic-no-pic | FileCheck %s --check-prefix=RELOC-OTHER
>  ; RUN: llc < %s -mtriple=arm-none-linux-gnueabi | FileCheck %s
> --check-prefix=RELOC-OTHER
> +; RUN: llc < %s -mtriple=arm-none-linux-gnueabi | FileCheck %s
> --check-prefix=PCS-R9-USE
> +; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -arm-reserve-r9 |
> FileCheck %s --check-prefix=PCS-R9-RESERVE
>
>  ; XSCALE:      .eabi_attribute 6, 5
>  ; XSCALE:      .eabi_attribute 8, 1
> @@ -463,6 +465,9 @@
>  ; RELOC-PIC:  .eabi_attribute 17, 2
>  ; RELOC-OTHER:  .eabi_attribute 17, 1
>
> +; PCS-R9-USE:  .eabi_attribute 14, 0
> +; PCS-R9-RESERVE:  .eabi_attribute 14, 3
> +
>  define i32 @f(i64 %z) {
>         ret i32 0
>  }
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>


-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140724/0d7b32ba/attachment.html>


More information about the llvm-commits mailing list