On 12/1/22 03:03, Fei Gao wrote:
frame->total_size to remaining_size conversion is done as an independent patch 
without
functionality change as per review comment.

gcc/ChangeLog:

         * config/riscv/riscv.cc (riscv_first_stack_step): add a new function 
parameter remaining_size.
         (riscv_compute_frame_info): adapt new riscv_first_stack_step interface.
         (riscv_expand_prologue): likewise.
         (riscv_expand_epilogue): likewise.
---
  gcc/config/riscv/riscv.cc | 48 +++++++++++++++++++--------------------
  1 file changed, 24 insertions(+), 24 deletions(-)





@@ -5037,7 +5037,7 @@ riscv_expand_prologue (void)
    /* Save the registers.  */
    if ((frame->mask | frame->fmask) != 0)
      {
-      HOST_WIDE_INT step1 = riscv_first_stack_step (frame);
+      HOST_WIDE_INT step1 = riscv_first_stack_step (frame, frame->total_size);
        if (size.is_constant ())
        step1 = MIN (size.to_constant(), step1);
Hmm. I generally agree that this patch has no functional changes in behavior. But I wonder if there's a latent bug in the prologue code.

It seems to me that if we are optimizing for size and need to save both GPRs and FPRs that we don't want to be using frame->total_size as the libcall path to save the GPRs will have done a partial allocation, thus reducing the amount of stack still to allocate. Or am I missing something here?



Jeff

Reply via email to