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

Dhananjay R. Deshpande dhananjayd@kpit.com
Fri Mar 28 07:31:00 GMT 2003


Hi,

>Synopsis: Incorrect code generated for H8300 "normal" mode

>State-Changed-From-To: open->analyzed
>State-Changed-By: kazu
>State-Changed-When: Thu Mar 27 19:59:48 2003
>State-Changed-Why:
>    Still present in mainline.  Here is a smaller testcase.
 
The patch below fixes this. If it is OK, it should be applied to both mainline 
and 3.3 branch.

- Dhannajay

Changelog

2003-03-28  Dhananjay Deshpande  <dhananjayd@kpit.com>

	  PR target/10205
        * config/h8300/h8300.c (h8300_initial_elimination_offset): Remove hack in 
	  adjustment of offset for normal mode.

===================================================================================
--- h8300.c.orig	Fri Mar 28 12:07:21 2003
+++ h8300.c	Fri Mar 28 12:04:57 2003
@@ -1717,7 +1717,8 @@ h8300_initial_elimination_offset (from, 
   int offset = 0;
 
   if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
-    offset = UNITS_PER_WORD + frame_pointer_needed * UNITS_PER_WORD;
+    offset = (POINTER_SIZE / BITS_PER_UNIT) + 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 +1735,8 @@ h8300_initial_elimination_offset (from, 
       offset += round_frame_size (get_frame_size ());
 
       if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
-	offset += UNITS_PER_WORD;	/* Skip saved PC */
+        offset += (POINTER_SIZE / BITS_PER_UNIT);       /* Skip saved PC */
     }
-
-  if ((TARGET_H8300H || TARGET_H8300S) && TARGET_NORMAL_MODE)
-    offset -= 2;
 
   return offset;
 }

===================================================================================



More information about the Gcc-patches mailing list