This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Frame pointer and regalloc/reload
- From: Ian Lance Taylor <iant at google dot com>
- To: Hendrik Greving <hendrik dot greving dot intel at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Wed, 13 Nov 2013 17:52:51 -0800
- Subject: Re: Frame pointer and regalloc/reload
- Authentication-results: sourceware.org; auth=none
- References: <CANc4vhpgHu_fdYZdneMvSHaMHpeKM_Y9Xp6a8cJdwh3Oz63rZw at mail dot gmail dot com>
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