This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Frame pointer and regalloc/reload


On Wed, Nov 13, 2013 at 4:29 PM, Hendrik Greving
<hendrik.greving.intel@gmail.com> wrote:
> In case it is determined that a frame pointer is needed (in reload?),
> who is supposed to make sure that the register that will hold the
> frame pointer is not allocated for general use? We have a customized
> register allocation mechanism, but I am trying to figure out /
> understand the regular/general case first. For instance I am not sure
> if I understand the usage of the fixed_regs table w.r.t. to the frame
> pointer. Could anybody shed some light on this by any chance?

On some platforms the frame pointer is in fixed_regs.  Those platforms
are easy.

On most platforms the frame pointer is not in fixed_regs.  Those
platforms will still define FRAME_POINTER_REGNUM or
HARD_FRAME_POINTER_REGNUM.

The register allocator will set the function-specific variable
frame_pointer_needed to indicate whether the function requires a frame
pointer.  This test includes a call to the target hook
frame_pointer_required.  If frame_pointer_needed is true, then
FRAME_POINTER_REGNUM or HARD_FRAME_POINTER_REGNUM, as appropriate,
will be added to the list of registers that should not be allocated.

If you have a custom register allocator, you need to do the same.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]