This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch to omit the frame pointer from leaf functions (version 2)
- To: law at cygnus dot com
- Subject: Re: patch to omit the frame pointer from leaf functions (version 2)
- From: John Wehle <john at feith dot com>
- Date: Sat, 17 Oct 1998 16:09:25 -0400 (EDT)
- cc: egcs-patches at cygnus dot com
> Check out FRAME_POINTER_REQUIRED for the x86 though. I'd bet it claims that
> a frame pointer is needed for non-leaf functions.
>
> I don't know about the m88k.
You are right. In both cases FRAME_POINTER_REQUIRED checks leaf_function_p.
>> What targets (other the i386) are unabled to debug code
>> which has been optimized by this patch?
> h8, m68k, and probably just about every port that does not define
> ACCUMULATE_OUTGOING_ARGS.
Maybe the thing to do is to fix gdb so it handles frameless leaf functions
for the i386, make the optimization dependent on CAN_DEBUG_LEAF_WITHOUT_FP,
and have i386.h define this new macro.
>> *** gcc/config/pa/pa.c.ORIGINAL Sun Oct 11 13:57:29 1998
>> --- gcc/config/pa/pa.c Sat Oct 17 01:05:22 1998
>> *************** basereg_operand (op, mode)
>> *** 5710,5716 ****
>> /* While it's always safe to index off the frame pointer, it's not
>> always profitable, particularly when the frame pointer is being
>> eliminated. */
>> ! if (! flag_omit_frame_pointer && op == frame_pointer_rtx)
>> return 1;
>>
>> /* The only other valid OPs are pseudo registers with
>> --- 5710,5717 ----
>> /* While it's always safe to index off the frame pointer, it's not
>> always profitable, particularly when the frame pointer is being
>> eliminated. */
>> ! if (! (flag_omit_frame_pointer || current_function_sp_is_unchanging)
>> ! && op == frame_pointer_rtx)
>> return 1;
>
> This is undesirable. The reason we don't allow frame pointers as a base reg
> is because we get worse code when the frame pointer is eliminated to the
> stack pointer.
My change to reload1.c causes the frame pointer to be eliminated whenever
current_function_sp_is_unchanging is set. The comment says that using
the frame pointer as a base reg in this situation is undesirable. My
change to pa.c was to realize that the frame pointer is eliminated if
either flag_omit_frame_pointer or current_function_sp_is_unchanging is
set so using the frame pointer as a base register should only be done if
! (flag_omit_frame_pointer || current_function_sp_is_unchanging).
Did I miss understand something?
Note that the issue is probably moot since:
1) pa defines CAN_DEBUG_WITHOUT_FP which means that
flag_omit_frame_pointer is set anytime that optimization
is being used and current_function_sp_is_unchanging
is only set when life_analysis_1 runs which means
that optimization is being used.
2) The optimization will probably end up being conditional
on CAN_DEBUG_LEAF_WITHOUT_FP which means that it will
not initially affect any port besides the i386.
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------