On Fri, Nov 9, 2018 at 10:09 AM Olivier Hainque <hain...@adacore.com> wrote:
>
> Hello Wilco,
>
> Would you have further thoughts on the patches proposed in
>
>  https://gcc.gnu.org/ml/gcc-patches/2018-10/msg01453.html
>
> ?
>
> There was:
>
> 1)  * config/aarch64/aarch64.c (PROBE_STACK_FIRST_REG) : Redefine as
>     R9_REGNUM instead of 9.
>     (PROBE_STACK_SECOND_REG): Redefine as R10_REGNUM instead of 10.
>
>
> 2)  * config/aarch64/aarch64.h (FIXED_R18): New internal
>     configuration macro, defaulted to 0.
>     (FIXED_REGISTERS): Use it.
>     (STATIC_CHAIN_REGNUM): Use r11 instead of r18.
>
> and
>
> 3)  * config/aarch64/aarch64.c (aarch64_override_options): Once
>     arch, cpu and tune were validated, insert SUBTARGET_OVERRIDE_OPTIONS
>    if defined.

I remember hearing from some folks, they would like this (the ability
to mark r18 as being fixed) to be a target option so they could
support wine on AARCH64 too; I hear clang has this option already too.
https://bugs.winehq.org/show_bug.cgi?id=38780 for the wine issue.

Thanks,
Andrew

>
>
>
> Thanks a lot in advance!
>
> With Kind Regards,
>
> Olivier
>
>
> > On 23 Oct 2018, at 19:13, Olivier Hainque <hain...@adacore.com> wrote:
> >
> > Hi Wilco,
> >
> >> On 18 Oct 2018, at 19:08, Wilco Dijkstra <wilco.dijks...@arm.com> wrote:
> >
> >>> 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.
> >
> > Thanks for your feedback!  I ported the patches
> > to gcc-8 and was able to get a functional toolchain
> > for aarch64-wrs-vxworks7 and aarch64-elf, passing
> > full Acats for a couple of runtime variants on VxWorks
> > (compiled for RTP or kernel mode) as well as a small
> > internal testsuite we have, dedicated to cross configurations.
> >
> > All the patches apply directly on mainline.
> >
> > As for the original patch, I also sanity checked that
> > "make all-gcc" passes (self tests included) there for
> > --target=aarch64-elf --enable-languages=c
> >
> >
> > There are three changes to the common aarch64 port files.
> >
> > It turns out that X9 doesn't work for STATIC_CHECK_REGNUM
> > because this conflicts with the registers used for -fstack-check:
> >
> >  /* The pair of scratch registers used for stack probing.  */
> >  #define PROBE_STACK_FIRST_REG  9
> >  #define PROBE_STACK_SECOND_REG 10
> >
> > I didn't find that immediately (read, I first experienced a few
> > badly crashing test runs) because I searched for R9_REGNUM to check
> > for other uses, so the first patchlet attached simply adjusts
> > the two #defines above to use R9/R10_REGNUM.
> >
> >
> > 2018-10-23  Olivier Hainque  <hain...@adacore.com>
> >
> >        * config/aarch64/aarch64.c (PROBE_STACK_FIRST_REG) : Redefine as
> >        R9_REGNUM instead of 9.
> >        (PROBE_STACK_SECOND_REG): Redefine as R10_REGNUM instead of 10.
> >
> >
> > The second patch is the one which I proposed a few days ago
> > to allow a subtarget (in my case, the VxWorks port) to state that
> > R18 is to be considered fixed. Two changes compared to the original
> > patch: a comment attached to the default definition of FIXED_R18,
> > and the unconditional use of R11_REGNUM as an alternate STATIC_CHAIN_REGNUM.
> >
> > I suppose the latter could require extra testing than what I was
> > able to put in (since this is also changing for !vxworks configurations),
> > which Sam very kindly did on the first instance.
> >
> > I didn't touch CALL_SAVED_REGISTERS since this is 1 for r18 already.
> > I also didn't see a strong reason to move to a more dynamic scheme,
> > through conditional_register_usage.
> >
> > 2018-03-18  Olivier Hainque  <hain...@adacore.com>
> >
> >       * config/aarch64/aarch64.h (FIXED_R18): New internal
> >       configuration macro, defaulted to 0.
> >       (FIXED_REGISTERS): Use it.
> >       (STATIC_CHAIN_REGNUM): Use r11 instead of r18.
> >
> >
> > The third patch proposes the introduction of support for a
> > conditional SUBTARGET_OVERRIDE_OPTIONS macro, as many other
> > architectures have, and which is needed by all VxWorks ports.
> >
> > In the current state, this one could possibly impact only
> > VxWorks, as no other config file would define the macro.
> >
> > I'm not 100% clear on the possible existence of rules regarding
> > the placement of this within the override_options functions. We used
> > something similar to what other ports do, and it worked just fine
> > for VxWorks.
> >
> > 2018-10-23  Olivier Hainque  <hain...@adacore.com>
> >
> >        * config/aarch64/aarch64.c (aarch64_override_options): Once
> >        arch, cpu and tune were validated, insert SUBTARGET_OVERRIDE_OPTIONS
> >        if defined.
> >
> > I'm happy to adjust any of all this if needed of course.
> >
> > Thanks in advance for your feedback!
> >
> > With Kind Regards,
> >
> > Olivier
> >
> >
> > <0001-Use-R9-R10_REGNUM-to-designate-stack-checking-regist.patch.txt><0002-Introduce-FIXED_R18-in-aarch64.h.patch.txt><0003-Support-for-SUBTARGET_OVERRIDE_OPTIONS-in-aarch64.c.patch.txt>
>

Reply via email to