This is the mail archive of the 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: DWARF: Represent hard frame pointer as stack pointer + offset

On Fri, Aug 31, 2018 at 1:32 PM, Jason Merrill <> wrote:
> On Fri, Aug 31, 2018 at 3:33 PM, H.J. Lu <> wrote:
>> On Thu, Aug 30, 2018 at 10:21 AM, Jason Merrill <> wrote:
>>>> r138335 allowed arg_pointer_rtx to be eliminated by either FP or SP,
>>>> but only when dynamic stack alignment is supported.  In this case,
>>>> arg_pointer_rtx is eliminated by FP even when frame_pointer_needed
>>>> is false and there is no dynamic stack alignment at all.
>>>>> gcc_assert (elim == stack_pointer_rtx || (frame_pointer_needed && elim
>>>>> == hard_frame_pointer_rtx));
>>>>> so as not to allow eliminating to an uninitialized FP.
>>>> FP isn't uninitialized.  It is initialized the same way as in the case of
>>> How is that?  Why would it be initialized when frame_pointer_needed is
>>> false?  What does it mean for frame_pointer_needed to be false, if
>>> not, as in the documentation of -fomit-frame-pointer,
>>> "This avoids the instructions to save, set up and restore the frame
>>> pointer; on many targets it also makes an extra register available."
>>> ?
>> A backend may not set up frame pointer even with -fno-omit-frame-pointer.
>> In the case of x86,  hard frame pointer can be represented by stack pointer
>> This patch adds hard_frame_pointer_from_stack_pointer_plus_offset and
>> hard_frame_pointer_offset to rtl_data to allow a backend to represent
>> hard frame pointer as stack pointer + offset.
> Shouldn't this be fixed in eliminate_regs rather than dwarf2out?

With -fno-omit-frame-pointer, arg pointer is eliminated with hard frame
pointer.  But

commit cd557ff63f388ad27c376d0a225e74d3594a6f9d
Author: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Aug 10 15:29:05 2017 +0000

    i386: Don't use frame pointer without stack access

    When there is no stack access, there is no need to use frame pointer
    even if -fno-omit-frame-pointer is used and caller's frame pointer is

changed it in the last minute.  It is too late to go back.  When it is done,
hard frame pointer must be replaced by stack pointer - UNITS_PER_WORD
if it is ever used.


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