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


On Fri, Aug 31, 2018 at 3:33 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 30, 2018 at 10:21 AM, Jason Merrill <jason@redhat.com> 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
>>> SUPPORTS_STACK_ALIGNMENT is true.
>>
>> 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
> - UNITS_PER_WORD.
>
> 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?

Jason


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