This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ping] Change static chain to r11 on aarch64


On 12/12/2018 15:47, Olivier Hainque wrote:
> Hello,
> 
> Ping for part of the changes last proposed here:
> 
>  https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00761.html
> 
> Submitted separately as an attempt to facilitate the review
> process.
> 
> This piece is the change of static chain from r18 to r11.
> 
> Regression testing with languages=all on an aarch64-linux box
> uncovered (various go related test failures) that libffi needs
> a synchronized adjustment.
> 
> This is the updated version of the patch, so bootstrapped and
> regression tested clean on aarch64-linux.
> 
> OK to commit ?
> 
> Thanks in advance!
> 
> With Kind Regards,
> 
> Olivier
> 
> 2018-12-12  Olivier Hainque  <hainque@adacore.com>
> 
> 	gcc/
> 	* config/aarch64/aarch64.h (STATIC_CHAIN_REGNUM): Use R11 instead
> 	of R18.
> 
> 	gcc/testsuite/
> 	* gcc.dg/cwsc1.c: Expect r11 as the static chain on aarch64.
> 
> 	libffi/
> 	* src/aarch64/sysv.S (ffi_call_SYSV): Expect r11 as the static chain.
> 	(ffi_go_closure_SYSV): Likewise.
> 	* testsuite/libffi.go/static-chain.h: Likewise.
> 

libffi is a separate project; so a patch for that needs to be sent to
the libffi maintainers.  However, that introduces an issue that that
code is potentially used across multiple versions of gcc, with
potentially different choices of the static chain register.  Hmm, this
might need some more careful thought....

I'm also not keen on the fact that we are now seriously eating into the
space of call clobbered registers; what's the argument behind your
selection of r11 as opposed to any other register?  On Arm we manage
with IP; is there some reason why we can't do something similar on AArch64?

R.

> 
> 
> 0003-Change-static-chain-from-r18-to-r11-on-aarch64.patch
> 
> From 2fe2661e581e8e3989e62b81db6ca37d2392f83d Mon Sep 17 00:00:00 2001
> From: Olivier Hainque <hainque@adacore.com>
> Date: Wed, 12 Dec 2018 07:05:23 -0800
> Subject: [PATCH 3/4] Change static chain from r18 to r11 on aarch64
> 
> 	gcc/
> 	* config/aarch64/aarch64.h (STATIC_CHAIN_REGNUM): Use R11 instead
> 	of R18.
> 
> 	gcc/testsuite/
> 	* gcc.dg/cwsc1.c: Expect r11 as the static chain on aarch64.
> 
> 	libffi/
> 	* src/aarch64/sysv.S (ffi_call_SYSV): Expect r11 as the static chain.
> 	(ffi_go_closure_SYSV): Likewise.
> 	* testsuite/libffi.go/static-chain.h: Likewise.
> ---
>  gcc/config/aarch64/aarch64.h              | 2 +-
>  gcc/testsuite/gcc.dg/cwsc1.c              | 2 +-
>  libffi/src/aarch64/sysv.S                 | 6 +++---
>  libffi/testsuite/libffi.go/static-chain.h | 2 +-
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
> index 0c833a8..a8063c2 100644
> --- a/gcc/config/aarch64/aarch64.h
> +++ b/gcc/config/aarch64/aarch64.h
> @@ -422,7 +422,7 @@ extern unsigned aarch64_architecture_version;
>     uses alloca.  */
>  #define EXIT_IGNORE_STACK	(cfun->calls_alloca)
>  
> -#define STATIC_CHAIN_REGNUM		R18_REGNUM
> +#define STATIC_CHAIN_REGNUM		R11_REGNUM
>  #define HARD_FRAME_POINTER_REGNUM	R29_REGNUM
>  #define FRAME_POINTER_REGNUM		SFP_REGNUM
>  #define STACK_POINTER_REGNUM		SP_REGNUM
> diff --git a/gcc/testsuite/gcc.dg/cwsc1.c b/gcc/testsuite/gcc.dg/cwsc1.c
> index e793e26..be22317 100644
> --- a/gcc/testsuite/gcc.dg/cwsc1.c
> +++ b/gcc/testsuite/gcc.dg/cwsc1.c
> @@ -6,7 +6,7 @@
>  #elif defined(__i386__)
>  # define CHAIN  "%ecx"
>  #elif defined(__aarch64__)
> -# define CHAIN  "x18"
> +# define CHAIN  "x11"
>  #elif defined(__alpha__)
>  # define CHAIN  "$1"
>  #elif defined(__arm__)
> diff --git a/libffi/src/aarch64/sysv.S b/libffi/src/aarch64/sysv.S
> index c1bf9b9..12e7ec3 100644
> --- a/libffi/src/aarch64/sysv.S
> +++ b/libffi/src/aarch64/sysv.S
> @@ -89,7 +89,7 @@ CNAME(ffi_call_SYSV):
>  	mov	x9, x2			/* save fn */
>  	mov	x8, x3			/* install structure return */
>  #ifdef FFI_GO_CLOSURES
> -	mov	x18, x5			/* install static chain */
> +	mov	x11, x5			/* install static chain */
>  #endif
>  	stp	x3, x4, [x29, #16]	/* save rvalue and flags */
>  
> @@ -415,8 +415,8 @@ CNAME(ffi_go_closure_SYSV):
>  	stp     x6, x7, [sp, #16 + 16*N_V_ARG_REG + 48]
>  
>  	/* Load ffi_closure_inner arguments.  */
> -	ldp	PTR_REG(0), PTR_REG(1), [x18, #PTR_SIZE]/* load cif, fn */
> -	mov	x2, x18					/* load user_data */
> +	ldp	PTR_REG(0), PTR_REG(1), [x11, #PTR_SIZE]/* load cif, fn */
> +	mov	x2, x11					/* load user_data */
>  	b	.Ldo_closure
>  	cfi_endproc
>  
> diff --git a/libffi/testsuite/libffi.go/static-chain.h b/libffi/testsuite/libffi.go/static-chain.h
> index e120eea..d22b037 100644
> --- a/libffi/testsuite/libffi.go/static-chain.h
> +++ b/libffi/testsuite/libffi.go/static-chain.h
> @@ -1,5 +1,5 @@
>  #ifdef __aarch64__
> -# define STATIC_CHAIN_REG  "x18"
> +# define STATIC_CHAIN_REG  "x11"
>  #elif defined(__alpha__)
>  # define STATIC_CHAIN_REG  "$1"
>  #elif defined(__arm__)
> 
> 
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]