Hi!

On Tue, Jul 08, 2025 at 08:51:30AM +0000, Cui, Lili wrote:
> > rs6000 does not *have* a hard frame pointer!
> 
> Oh, I see.  The handling of HARD_FRAME_POINTER_REGNUM seems redundant for 
> rs6000.

The Power Architecture, Power ISA, nor any of our ABIs has a frame
pointer.  GCC generic code requires one to exist though (for no reason
at all), so when given -fno-omit-framepointer we dedicate GPR for it (we
use 31, I had to look it up to confirm it even, we never actually want
to use it!)

> Yes, -fomit-frame-pointer does help performance.  Here is a simple small case 
> https://godbolt.org/z/5Tc3jM7qc . Do you mean to optimize the %rbp here?

You tell GCC you want a frame pointer.  It follows your instructions.
There is a function call, so the frame pointer is saved before it; the
compiler does not realise it does not actually use the frame pointer
ever, it could optimise this whole stuff out (that's what in rs6000 the
frame_pointer_needed_indeed thing is for:
  frame_pointer_needed_indeed
    = frame_pointer_needed
      && df_regs_ever_live_p (HARD_FRAME_POINTER_REGNUM);
)


Segher

Reply via email to