Re: Frame pointer not getting eliminated

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

 



On Thu, Mar 28, 2019 at 09:24:18PM -0500, William Tambe wrote:
> On Thu, Mar 28, 2019 at 3:07 PM Segher Boessenkool
> <segher@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Thu, Mar 28, 2019 at 12:26:13PM -0500, William Tambe wrote:
> > > I am doing porting work and writing a backend using GCC 8.2.0.
> > >
> > > Despite the following #defines, the frame pointer is not getting
> > > eliminated; any idea why GCC would still generate a frame pointer ?
> >
> > Do you use -fomit-frame-pointer (perhaps indirectly from -O, or from a
> > default)?
> 
> -O2 is being used; I can't tell whether -fomit-frame-pointer is being used.

One easy way is to compile with -S -fverbose-asm and look at the generated
.s file.  Another is to run something like
$ gcc -Q --help=optimize -O2 | grep omit

> > > #define ELIMINABLE_REGS  \
> > >           {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
> > >            {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
> > >            {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
> >
> > Maybe you need to define HARD_FRAME_POINTER as well?  Or is FRAME_POINTER
> > a hardware register for you?
> 
> I am passing function call arguments through the stack; I assumed that
> HARD_FRAME_POINTER_REGNO would not need to be defined.
> 
> The FRAME_POINTER is not a hardware register; I wished to eliminate it
> into the STACK_POINTER hardware register.

There are situations where GCC *needs* a frame pointer.  Like -O0 (or just
-fno-omit-frame-pointer), obviously; but there are more.


Segher



[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