This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[m68k patch] Fix regression in prologue and epilogue generation


Hello!

This patch fixes a regression as discussed in http://gcc.gnu.org/ml/gcc/2003-10/msg00664.html
(The patch was also sent as http://gcc.gnu.org/ml/gcc/2003-10/msg00940.html
to gcc@ by mistake)

Gunther

--cut--
2003-10-21  Gunther Nikl  <gni@gecko.de>

	* config/m68k/m68k.c (m68k_compute_frame_layout): swap reg_mask and
	reg_rev_mask computation
	* config/m68k/m68k.c (m68k_output_function_prologue): Fix usage of
	current_frame (one typo and one missing); use reg_rev_mask not
	reg_mask
	* config/m68k/m68k.c (m68k_output_function_epilogue): Fix usage of
	current_frame; use fpu_rev_mask not fpu_mask

--- m68k.c.orig	Tue Oct 21 13:31:13 2003
+++ m68k.c	Tue Oct 21 13:32:35 2003
@@ -358,8 +358,8 @@ m68k_compute_frame_layout (void)
       for (regno = 16; regno < 24; regno++)
 	if (m68k_save_reg (regno, interrupt_handler))
 	  {
-	    mask |= 1 << (23 - regno);
-	    rmask |= 1 << (regno - 16);
+	    mask |= 1 << (regno - 16);
+	    rmask |= 1 << (23 - regno);
 	    saved++;
 	  }
       current_frame.foffset = saved * 12 /* (TARGET_CFV4E ? 8 : 12) */;
@@ -616,7 +616,7 @@ m68k_output_function_prologue (FILE *str
 #ifdef MOTOROLA
 	  asm_fprintf (stream, "\tfmovm %I0x%x,-(%Rsp)\n", current_frame.fpu_mask);
 #else
-	  asm_fprintf (stream, "\tfmovem %I0x%x,%Rsp@-\n", current_frmae.fpu_mask);
+	  asm_fprintf (stream, "\tfmovem %I0x%x,%Rsp@-\n", current_frame.fpu_mask);
 #endif
 	  if (dwarf2out_do_frame ())
 	    {
@@ -651,8 +651,8 @@ m68k_output_function_prologue (FILE *str
       else if (GET_CODE (stack_limit_rtx) != SYMBOL_REF)
 	warning ("stack limit expression is not supported");
     }
-  
-  if (num_saved_regs <= 2)
+
+  if (current_frame.reg_no <= 2)
     {
       /* Store each separately in the same order moveml uses.
          Using two movel instructions instead of a single moveml
@@ -701,9 +701,9 @@ m68k_output_function_prologue (FILE *str
       else
 	{
 #ifdef MOTOROLA
-	  asm_fprintf (stream, "\tmovm.l %I0x%x,-(%Rsp)\n", current_frame.reg_mask);
+	  asm_fprintf (stream, "\tmovm.l %I0x%x,-(%Rsp)\n", current_frame.reg_rev_mask);
 #else
-	  asm_fprintf (stream, "\tmoveml %I0x%x,%Rsp@-\n", current_frame.reg_mask);
+	  asm_fprintf (stream, "\tmoveml %I0x%x,%Rsp@-\n", current_frame.reg_rev_mask);
 #endif
 	}
       if (dwarf2out_do_frame ())
@@ -928,7 +928,7 @@ m68k_output_function_epilogue (FILE *str
 #else
               asm_fprintf (stream, "\tmoveml %s@(-%wd),%I0x%x\n",
                            reg_names[FRAME_POINTER_REGNUM],
-                           offset + fsize,
+                           current_frame.offset + fsize,
 			   current_frame.reg_mask);
 #endif
 	    }
@@ -1007,7 +1007,7 @@ m68k_output_function_epilogue (FILE *str
 	  asm_fprintf (stream, "\tfmovm -%wd(%s),%I0x%x\n",
 		       current_frame.foffset + fsize,
 		       reg_names[FRAME_POINTER_REGNUM],
-		       current_frame.fpu_mask);
+		       current_frame.fpu_rev_mask);
 #else
 	  asm_fprintf (stream, "\tfmovem %s@(-%wd),%I0x%x\n",
 		       reg_names[FRAME_POINTER_REGNUM],
--cut--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]