This is the mail archive of the gcc-bugs@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]

Re: target/10205: Incorrect code generated for H8300 "normal" mode


Hi,

Here is the final patch I committed to 3.3 branch and mainline.

Kazu Hirata

2003-03-28  Kazu Hirata  <kazu at cs dot umass dot edu>,
	    Dhananjay Deshpande  <dhananjayd at kpit dot com>

	PR target/10205
	* config/h8300/h8300.c (h8300_initial_elimination_offset):
	Correct the offset computation when TARGET_NORMAL.

Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.221
diff -u -r1.221 h8300.c
--- h8300.c	22 Mar 2003 15:22:37 -0000	1.221
+++ h8300.c	28 Mar 2003 14:50:38 -0000
@@ -1715,9 +1715,11 @@
      int from, to;
 {
   int offset = 0;
+  /* The number of bytes that the return address takes on the stack.  */
+  int pc_size = POINTER_SIZE / BITS_PER_UNIT;
 
   if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
-    offset = UNITS_PER_WORD + frame_pointer_needed * UNITS_PER_WORD;
+    offset = pc_size + frame_pointer_needed * UNITS_PER_WORD;
   else if (from == RETURN_ADDRESS_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
     offset = frame_pointer_needed * UNITS_PER_WORD;
   else
@@ -1734,11 +1736,9 @@
       offset += round_frame_size (get_frame_size ());
 
       if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
-	offset += UNITS_PER_WORD;	/* Skip saved PC */
+	/* Skip saved PC.  */
+	offset += pc_size;
     }
-
-  if ((TARGET_H8300H || TARGET_H8300S) && TARGET_NORMAL_MODE)
-    offset -= 2;
 
   return offset;
 }


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