how to configure GCC to have caller save registers instead of callee prologue

William Tambe tambewilliam@gmail.com
Wed Aug 7 15:49:00 GMT 2019


To expand on my previous reply, I would like to configure GCC so that
a callee does not need to save and restore registers that it is using
other than the frame-pointer and return-pointer registers.
The callee would not need to save and restore registers that it is
using because it would be assumed that the caller has saved all
registers that it is using.

On Mon, Aug 5, 2019 at 6:19 PM William Tambe <tambewilliam@gmail.com> wrote:
>
> On Mon, Aug 5, 2019 at 4:53 PM Florian Weimer <fw@deneb.enyo.de> wrote:
> >
> > * William Tambe:
> >
> > > Is there a way to configure GCC so that before a function call, the
> > > caller save any registers that it is using, instead of the callee
> > > prologue saving registers that it is using ?
> >
> > How is that different from an ordinary volatile/caller-saved register?
> > Do you need a way to change an existing target ABI in this way?  In
> > general, I think this will require patching of target code, and there
> > will be some loss of functionality.
>
> I am working on porting GCC to a new target, and it is the behavior
> that I have in mind for its ABI.
>
> I am not sure how different it is from an ordinary
> volatile/caller-saved register, however I would like to configure GCC
> so that the prologue never need to use code similar to the following
> as the caller would have saved all registers that it is using:
> #define MUST_SAVE_REGISTER(R)            \
>   !fixed_regs[R] &&                      \
>   df_regs_ever_live_p (R) &&             \
>   !call_used_regs[R])
>
> Pointers on how to implement such a behavior would be much appreciated.



More information about the Gcc-help mailing list