On 08/26/2014 05:58 AM, Jiong Wang wrote:
> On 22/08/14 23:05, Richard Henderson wrote:
>> Don't continually re-read data from cfun->machine.
>>
>>     * config/aarch64/aarch64.c (aarch64_expand_prologue): Load
>>     cfun->machine->frame.hard_fp_offset into a local variable.
>> ---
>>   gcc/config/aarch64/aarch64.c | 14 +++++++-------
>>   1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
>> index dcca446..c890773 100644
>> --- a/gcc/config/aarch64/aarch64.c
>> +++ b/gcc/config/aarch64/aarch64.c
>> @@ -2194,18 +2194,18 @@ aarch64_expand_prologue (void)
>>     */
>>     HOST_WIDE_INT frame_size, offset;
>>     HOST_WIDE_INT fp_offset;        /* Offset from hard FP to SP.  */
>> +  HOST_WIDE_INT hard_fp_offset;
>>     rtx insn;
>>       aarch64_layout_frame ();
>>   -  if (flag_stack_usage_info)
>> -    current_function_static_stack_size = cfun->machine->frame.frame_size;
>> -
>>     frame_size = cfun->machine->frame.frame_size;
>> -  offset = cfun->machine->frame.frame_size;
>> +  hard_fp_offset = cfun->machine->frame.hard_fp_offset;
>> +  offset = frame_size;
>> +  fp_offset = frame_size - hard_fp_offset;
> 
> there is a field "hardfp_offset" in aarch64_frame, and I think that field is
> not used and not initialized correctly.
> 
> how about hoisting the calculation to aarch64_layout_frame to avoid duplicated
> calcuation here and there,  something like:
> 
>  cfun->machine->frame.hardfp_offset = (cfun->machine->frame.frame_size-
>                                        cfun->machine->frame.hard_fp_offset);
> 
> then use it directly in expand_epilogue:
> 
> fp_offset = cfun->machine->frame.hardfp_offset;

I'd go the other way, and simply delete hardfp_offset as unused.  We need the
other two inputs to the subtraction for other reasons, so we don't save
anything by pre-computing the subtract.


r~

Reply via email to