OSDN Git Service

Fix an unwinding bug for functions with dynamic stack frames.
[pf3gnuchains/gcc-fork.git] / gcc / config / tilepro / tilepro.c
index 71b5807..011ac08 100644 (file)
@@ -3556,9 +3556,8 @@ tilepro_expand_prologue (void)
     {
       /* Copy the old stack pointer aside so we can save it later.  */
       sp_copy_regno = next_scratch_regno--;
-      insn = FRP (emit_move_insn (gen_rtx_REG (Pmode, sp_copy_regno),
-                                 stack_pointer_rtx));
-      add_reg_note (insn, REG_CFA_REGISTER, NULL_RTX);
+      emit_move_insn (gen_rtx_REG (Pmode, sp_copy_regno),
+                     stack_pointer_rtx);
     }
 
   if (tilepro_current_function_is_leaf ())
@@ -3600,8 +3599,8 @@ tilepro_expand_prologue (void)
        }
 
       /* Save our frame pointer for backtrace chaining.  */
-      FRP (frame_emit_store (sp_copy_regno, STACK_POINTER_REGNUM,
-                            chain_addr, cfa, cfa_offset));
+      emit_insn (gen_movsi (gen_frame_mem (SImode, chain_addr),
+                           gen_rtx_REG (SImode, sp_copy_regno)));
     }
 
   /* Compute where to start storing registers we need to save.  */
@@ -3742,16 +3741,7 @@ tilepro_expand_epilogue (bool sibcall_p)
 
   emit_insn (gen_blockage ());
 
-  if (crtl->calls_eh_return)
-    {
-      rtx r = compute_frame_addr (-total_size + UNITS_PER_WORD,
-                                 &next_scratch_regno);
-      insn = emit_move_insn (gen_rtx_REG (Pmode, STACK_POINTER_REGNUM),
-                            gen_frame_mem (Pmode, r));
-      RTX_FRAME_RELATED_P (insn) = 1;
-      REG_NOTES (insn) = cfa_restores;
-    }
-  else if (frame_pointer_needed)
+  if (frame_pointer_needed)
     {
       /* Restore the old stack pointer by copying from the frame
          pointer.  */
@@ -3767,6 +3757,10 @@ tilepro_expand_epilogue (bool sibcall_p)
                             cfa_restores);
     }
 
+  if (crtl->calls_eh_return)
+    emit_insn (gen_sp_adjust (stack_pointer_rtx, stack_pointer_rtx,
+                             EH_RETURN_STACKADJ_RTX));
+
   /* Restore the old frame pointer.  */
   if (frame_pointer_needed)
     {