public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [patch] allow target config to state r18 is fixed on aarch64
@ 2018-10-18 17:35 Wilco Dijkstra
  2018-10-23 19:41 ` Olivier Hainque
  0 siblings, 1 reply; 15+ messages in thread
From: Wilco Dijkstra @ 2018-10-18 17:35 UTC (permalink / raw)
  To: GCC Patches, hainque
  Cc: nd, Kyrylo Tkachov, Richard Earnshaw, James Greenhalgh

Hi Olivier,

> STATIC_CHAIN_REGNUM still needs to be adjusted directly I think.
>
> I wondered if we could set it to R11 unconditionally and picked
> the way ensuring no change for !vxworks ports, especially since I
> don't have means to test more than what I described above.

Yes it should always be the same register, there is no gain in switching
it dynamically. I'd suggest to use X9 since X8 is the last register used for
arguments (STATIC_CHAIN_REGNUM is passed when calling a nested
function) and some of the higher registers may be used as temporaries in
prolog/epilog.

Wilco

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [patch] allow target config to state r18 is fixed on aarch64
@ 2018-10-10 22:44 Olivier Hainque
  2018-10-12  9:54 ` Kyrill Tkachov
  0 siblings, 1 reply; 15+ messages in thread
From: Olivier Hainque @ 2018-10-10 22:44 UTC (permalink / raw)
  To: GCC Patches; +Cc: Olivier Hainque

[-- Attachment #1: Type: text/plain, Size: 827 bytes --]

Hello,

The aarch64 "platform register" r18 is currently
unconditionally used as a scratch register by gcc.

Working on a VxWorks port for this arch (that we
plan to contribute soon), we discovered that VxWorks
has an internal use of this register so it needs
to be considered "fixed" for this port.

Hence the attached patch proposal, which we have been
using successfully for a while now. It just introduces
a FIXED_R18 config macro, defaulted to 0, which an OS
specific config file may redefine.

Is this ok to commit ?

Thanks in advance,

With Kind Regards,

Olivier


2018-03-18  Olivier Hainque  <hainque@adacore.com>

	* config/aarch64/aarch64.h (FIXED_R18): New
	internal configuration macro, defaulted to 0.
	(FIXED_REGISTERS): Use it.
	(STATIC_CHAIN_REGNUM): Fallback to r11 instead
	of r18 if the latter is fixed.


[-- Attachment #2: fixed-r18.txt --]
[-- Type: text/plain, Size: 1547 bytes --]

diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index fa9af26..2e69a4d 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -284,11 +284,13 @@ extern unsigned aarch64_architecture_version;
 
 /* Standard register usage.  */
 
+#define FIXED_R18 0
+
 /* 31 64-bit general purpose registers R0-R30:
    R30		LR (link register)
    R29		FP (frame pointer)
    R19-R28	Callee-saved registers
-   R18		The platform register; use as temporary register.
+   R18		The platform register; use as temporary register if !FIXED_R18.
    R17		IP1 The second intra-procedure-call temporary register
 		(can be used by call veneers and PLT code); otherwise use
 		as a temporary register
@@ -324,7 +326,7 @@ extern unsigned aarch64_architecture_version;
   {							\
     0, 0, 0, 0,   0, 0, 0, 0,	/* R0 - R7 */		\
     0, 0, 0, 0,   0, 0, 0, 0,	/* R8 - R15 */		\
-    0, 0, 0, 0,   0, 0, 0, 0,	/* R16 - R23 */		\
+    0, 0, FIXED_R18, 0, 0, 0, 0, 0,	/* R16 - R23 */		\
     0, 0, 0, 0,   0, 1, 0, 1,	/* R24 - R30, SP */	\
     0, 0, 0, 0,   0, 0, 0, 0,   /* V0 - V7 */           \
     0, 0, 0, 0,   0, 0, 0, 0,   /* V8 - V15 */		\
@@ -419,7 +421,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		(!(FIXED_R18) ? R18_REGNUM : R11_REGNUM)
 #define HARD_FRAME_POINTER_REGNUM	R29_REGNUM
 #define FRAME_POINTER_REGNUM		SFP_REGNUM
 #define STACK_POINTER_REGNUM		SP_REGNUM

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-12-12 16:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 17:35 [patch] allow target config to state r18 is fixed on aarch64 Wilco Dijkstra
2018-10-23 19:41 ` Olivier Hainque
2018-11-09 18:09   ` Olivier Hainque
2018-11-10  0:11     ` Andrew Pinski
2018-12-12 15:36     ` [ping] use REGNUM macros instead of hardcoded values in aarch64 PROBE_STACK reg definitions Olivier Hainque
2018-12-12 15:43       ` Kyrill Tkachov
2018-12-12 16:03         ` Olivier Hainque
  -- strict thread matches above, loose matches on Subject: below --
2018-10-10 22:44 [patch] allow target config to state r18 is fixed on aarch64 Olivier Hainque
2018-10-12  9:54 ` Kyrill Tkachov
2018-10-12 20:35   ` Olivier Hainque
2018-10-16 17:33     ` Kyrill Tkachov
2018-10-18 15:43       ` Olivier Hainque
2018-10-18 13:23     ` Sam Tebbs
2018-10-18 14:25       ` Olivier Hainque
2018-10-18 15:38         ` Olivier Hainque

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).