On 3/15/23 01:51, Yoshinori Sato wrote:
What about this?
It no longer occurs for me.

gcc/config/rx/
        * rx.cc (add_pop_cfi_notes): Release the frame pointer if it is used.
        (rx_expand_prologue): Redesigned stack pointer and frame pointer update 
process.
So I think the ChangeLog entry needs a bit of work. I don't see how the ChangeLog entry for add_pop_cfi_notes relates to the changes at all.

This might be better:

        * config/rx/rx.cc (add_pop_cfi_notes): Attach CFA_RESTORE notes
        first, then the CFA_ADJUST_CFA note.  If restoring the frame
        pointer, use (fp + offset) for the CFA_ADJUST_CFA note.



@@ -1815,37 +1819,17 @@ rx_expand_prologue (void)
        }
      }
- /* If needed, set up the frame pointer. */
-  if (frame_pointer_needed)
-    gen_safe_add (frame_pointer_rtx, stack_pointer_rtx,
-                 GEN_INT (- (HOST_WIDE_INT) frame_size), true);
-
-  /* Allocate space for the outgoing args.
-     If the stack frame has not already been set up then handle this as well.  
*/
-  if (stack_size)
+  if (stack_size || frame_size)
      {
-      if (frame_size)
-       {
-         if (frame_pointer_needed)
-           gen_safe_add (stack_pointer_rtx, frame_pointer_rtx,
-                         GEN_INT (- (HOST_WIDE_INT) stack_size), true);
-         else
-           gen_safe_add (stack_pointer_rtx, stack_pointer_rtx,
-                         GEN_INT (- (HOST_WIDE_INT) (frame_size + stack_size)),
-                         true);
-       }
-      else
-       gen_safe_add (stack_pointer_rtx, stack_pointer_rtx,
-                     GEN_INT (- (HOST_WIDE_INT) stack_size), true);
+      gen_safe_add (stack_pointer_rtx, stack_pointer_rtx,
+                   GEN_INT (- (HOST_WIDE_INT) (stack_size + frame_size)),
+                   true);
      }
-  else if (frame_size)
+  if (frame_pointer_needed)
      {
-      if (! frame_pointer_needed)
-       gen_safe_add (stack_pointer_rtx, stack_pointer_rtx,
-                     GEN_INT (- (HOST_WIDE_INT) frame_size), true);
-      else
-       gen_safe_add (stack_pointer_rtx, frame_pointer_rtx, NULL_RTX,
-                     false /* False because the epilogue will use the FP not 
the SP.  */);
+      gen_safe_add (frame_pointer_rtx, stack_pointer_rtx,
+                   GEN_INT ((HOST_WIDE_INT) stack_size),
+                   true);
It looks like we're emitting;

(set (sp) (plus (sp) (stack_size + frame_size)

Then  we emit

(set (fp) (plus (sp) (stack_size))

Unless I missing something important, that seems wrong and results in stack_size being added to FP twice.


jeff

Reply via email to