]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Darwin, PPC : Fix R13 for PPC64.
authorIain Sandoe <iain@sandoe.co.uk>
Fri, 11 Dec 2020 00:29:42 +0000 (00:29 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Thu, 14 Apr 2022 05:25:12 +0000 (06:25 +0100)
We have a somewhat unusual situation in that for PPC64, R13 is
both reserved and callee-saved (it is used internally by the
pthreads implementation to contain pthread_self).

So add R13 to the fixed regs, but also keep it in the callee-
saved set.

gcc/ChangeLog:

* config/rs6000/darwin.h (FIXED_R13): Add for PPC64.
(FIRST_SAVED_GP_REGNO): Save from R13 even when it is one
of the fixed regs.

(cherry picked from commit b12d6e79899fd27833c53ffc3c973538244f62e1)

gcc/config/rs6000/darwin.h

index 42f39e60305713ddaf97d52cb8fdb66524546cd3..566794af70694d1d0a56e8b8592f82891b394305 100644 (file)
 
 /* Make both r2 and r13 available for allocation.  */
 #define FIXED_R2 0
-#define FIXED_R13 0
+#define FIXED_R13 TARGET_64BIT
 
 /* Base register for access to local variables of the function.  */
 
 #undef  RS6000_PIC_OFFSET_TABLE_REGNUM
 #define RS6000_PIC_OFFSET_TABLE_REGNUM 31
 
+#undef FIRST_SAVED_GP_REGNO
+#define FIRST_SAVED_GP_REGNO 13
+
 /* Darwin's stack must remain 16-byte aligned for both 32 and 64 bit
    ABIs.  */