Re: regarding df_regs_ever_live_p

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 9, 2019 at 10:58 AM Jeff Law <law@xxxxxxxxxx> wrote:
>
> On 4/7/19 10:44 AM, William Tambe wrote:
> > When STATIC_CHAIN_REGNUM is defined and the static chain register is
> > not a fixed register, I am assuming that the prologue need to save it
> > and that df_regs_ever_live_p must be checked to determine whether to
> > save it.
> Again, it depends on the ABI and what it says about the register.  Most
> (if not all) the ABIs I've worked with through the years use a static
> chain that is call clobbered and thus you don't have to do anything special.
>
>
> >
> > The uncertainty arise when one cannot tell which GCC internal variable
> > must be checked beside df_regs_ever_live_p ; ie:
> > https://github.com/gcc-mirror/gcc/blob/gcc-8_3_0-release/gcc/config/fr30/fr30.c#L145
> I'm not familiar with the fr30.  But AFAICT its static chain (%r12) is
> clobbered.
>
> In general it's better to include the actual code you're referencing.  I
> don't have gcc-8.3.0 handy and the line number references are going to
> be "off".
>
> I'm guessing you're referring to this:
>
> > /* Tell prologue and epilogue if register REGNO should be saved / restored.
> >    The return address and frame pointer are treated separately.
> >    Don't consider them here.  */
> > #define MUST_SAVE_REGISTER(regno)      \
> >   (   (regno) != RETURN_POINTER_REGNUM \
> >    && (regno) != FRAME_POINTER_REGNUM  \
> >    && df_regs_ever_live_p (regno)      \
> >    && ! call_used_regs [regno]         )
> >
> > #define MUST_SAVE_FRAME_POINTER  (df_regs_ever_live_p (FRAME_POINTER_REGNUM)  || frame_pointer_needed)
> > #define MUST_SAVE_RETURN_POINTER (df_regs_ever_live_p (RETURN_POINTER_REGNUM) || crtl->profile)
>
> Which looks pretty normal.  For a typical register you just need to know
> if it's call saved (! call_used_regs) and if it's ever used
> (df_regs_ever_live).
>
> Frame pointers are sometimes handled specially (and the frame pointer is
> different than the static chain).  Frame pointers are often eliminated
> and references turned into a stack pointer address.  That in turn allows
> the frame pointer to be used by the register allocator.
>
> On the fr30 the return address appears to be handled specially as well.
>  Not really sure why -- perhaps the call to mcount isn't fully exposed
> or something similar.  It's not terribly uncommon to handle a few things
> specially when profiling.
>
>
> >
> > Hence the reason for asking for examples showing how to properly have
> > the DF entry block define registers so that it is enough to check only
> > df_regs_ever_live_p in the prologue on whether to save them.
> >
> > Are they currently such examples ?
> So the first question I would ask is whether or not your static chain is
> a call clobbered register is not.  If not, why -- most ports have a call
> clobbered static chain.

My static chain register is not marked in CALL_USED_REGISTERS , which
I assume mean, it is not call clobbered.
My preference would be to have it call clobbered so I wouldn't need to
do anything special.

>
> Jeff



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux