Hi Jeff

Thanks for the review!

> Note this is more general than just FP related addresses.  The variable
> name in that routine isn't great in that regard as it would seem to
> imply this code is only used on frame pointer based addresses.

The address being legitimized is a virtual-stack-vars based address rather 
than a frame-pointer one, so the "fp" name is misleading. I've renamed it 
to "stack_base" in v1. 

> Note that riscv_add_offset handles SMALL_OPERAND just fine.  So it seems
> like we could call it unconditionally [...]
> reg1 = force_reg (Pmode, riscv_add_offset (NULL, fp, offset));
> Can you try that?

Done.  Dropping the SMALL_OPERAND conditional and calling
riscv_add_offset unconditionally produces identical code for the small
offset case and keeps the large offset case in a single pseudo, so v1
now just does:

  reg1 = force_reg (Pmode, riscv_add_offset (NULL, stack_base, offset));

This makes the patch considerably simpler.

> Finally, how was this tested?

Tested on riscv64-unknown-linux-gnu:

  - Full GCC regression run with no new failures; the new
    frame-indexed-basec tests pass.  

  - SPEC CPU 2017: on 505.mcf_r the change gives the expected ~3%
    reduction in dynamic instruction count. 

I'll send v1 shortly.

Best regards,
Wang Jue

Reply via email to