[AArch64] Update comments on the usage of X30 in FIXED_REGISTERS and CALL_USED_REGISTERS

Richard Earnshaw Richard.Earnshaw@foss.arm.com
Mon Nov 2 12:02:00 GMT 2015


On 16/10/15 15:36, Jiong Wang wrote:
> The patch https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02654.html
> from last year changed the definition of LR in CALL_USED_REGISTERS,
> but didn't update the comment above the #define to reflect the new usage.
> 
> This patch bring the comment inline with the implementation.
> 
> OK for trunk?
> 
> Thanks.
> 
> 2015-10-16  Jiong. Wang  <jiong.wang@arm.com>
> 
> gcc/
>   * config/aarch64/aarch64.h: Update the comments on usage of X30.
> 
> 
> fix-comment.patch
> 
> 
> diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
> index 5a8db76..1eaaca0 100644
> --- a/gcc/config/aarch64/aarch64.h
> +++ b/gcc/config/aarch64/aarch64.h
> @@ -210,14 +210,17 @@ extern unsigned aarch64_architecture_version;
>     significant bits.  Unlike AArch32 S1 is not packed into D0,
>     etc.  */
>  
> -/* Note that we don't mark X30 as a call-clobbered register.  The idea is
> -   that it's really the call instructions themselves which clobber X30.
> -   We don't care what the called function does with it afterwards.
> -
> -   This approach makes it easier to implement sibcalls.  Unlike normal
> -   calls, sibcalls don't clobber X30, so the register reaches the
> -   called function intact.  EPILOGUE_USES says that X30 is useful
> -   to the called function.  */
> +/* We don't mark X30 as a fixed register while we mark it as a caller-saved
> +   register.  The idea is we want X30 to be allocable as a caller-saved
> +   register when possible.
> +
> +   NOTE: although X30 is marked as caller-saved, it's callee-saved at the same
> +   time.  The caller-saved attribute makes sure if X30 is allocated as free
> +   register to hold any temporary value then the value is saved properly across
> +   function call.  While on AArch64, the call instruction writes the return
> +   address to LR.  If the called function is a non-leaf function, it is the
> +   responsibility of the callee to save and restore LR appropriately in it's
> +   prologue / epilogue.  */
>  

Sorry, but I find that just confusing.

Wouldn't it be easier just to say:

 X30 is clobbered by call instructions, so must be treated as a
 caller-saved register.

I don't think there's anything more to add after that.

R.

>  #define FIXED_REGISTERS					\
>    {							\
> 



More information about the Gcc-patches mailing list