diff mbox

[AVR] : Fix thinko in LEGITIMIZE_RELOAD_ADDRESS

Message ID 4EA19189.6020402@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay Oct. 21, 2011, 3:36 p.m. UTC
This fixes avr_legitimize_reload_address:

Since breaking out the code from LEGITIMIZE_RELOAD_ADDRESS, protiype of above is
   avr_legitimize_reload_address (rtx x, ...
but must be
   avr_legitimize_reload_address (rtx *px, ...
because at one place &x is used as input to push_reload which is now px.

Ok to install?

Johann

	* config/avr/avr.h (LEGITIMIZE_RELOAD_ADDRESS): Pass address of X
	instead of X to avr_legitimize_reload_address.
	* config/avr/avr-protos.h (avr_legitimize_reload_address): Change
	first arrument from rtx to rtx*.
	* config/avr/avr.c (avr_legitimize_reload_address): Ditto.
	Pass PX to push_reload instead of &X.  Change log messages for
	better distinction.

Comments

Denis Chertykov Oct. 21, 2011, 3:39 p.m. UTC | #1
2011/10/21 Georg-Johann Lay <avr@gjlay.de>:
> This fixes avr_legitimize_reload_address:
>
> Since breaking out the code from LEGITIMIZE_RELOAD_ADDRESS, protiype of above is
>   avr_legitimize_reload_address (rtx x, ...
> but must be
>   avr_legitimize_reload_address (rtx *px, ...
> because at one place &x is used as input to push_reload which is now px.
>
> Ok to install?
>
> Johann
>
>        * config/avr/avr.h (LEGITIMIZE_RELOAD_ADDRESS): Pass address of X
>        instead of X to avr_legitimize_reload_address.
>        * config/avr/avr-protos.h (avr_legitimize_reload_address): Change
>        first arrument from rtx to rtx*.
>        * config/avr/avr.c (avr_legitimize_reload_address): Ditto.
>        Pass PX to push_reload instead of &X.  Change log messages for
>        better distinction.
>

Approved.

Denis.
diff mbox

Patch

Index: config/avr/avr-protos.h
===================================================================
--- config/avr/avr-protos.h	(revision 180298)
+++ config/avr/avr-protos.h	(working copy)
@@ -110,7 +110,7 @@  extern void out_shift_with_cnt (const ch
 extern reg_class_t avr_mode_code_base_reg_class (enum machine_mode, RTX_CODE, RTX_CODE);
 extern bool avr_regno_mode_code_ok_for_base_p (int, enum machine_mode, RTX_CODE, RTX_CODE);
 extern rtx avr_incoming_return_addr_rtx (void);
-extern rtx avr_legitimize_reload_address (rtx, enum machine_mode, int, int, int, int, rtx (*)(rtx,int));
+extern rtx avr_legitimize_reload_address (rtx*, enum machine_mode, int, int, int, int, rtx (*)(rtx,int));
 #endif /* RTX_CODE */
 
 #ifdef REAL_VALUE_TYPE
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 180298)
+++ config/avr/avr.c	(working copy)
@@ -1356,11 +1356,13 @@  avr_legitimize_address (rtx x, rtx oldx,
    than 63 bytes or for R++ or --R addressing.  */
 
 rtx
-avr_legitimize_reload_address (rtx x, enum machine_mode mode,
+avr_legitimize_reload_address (rtx *px, enum machine_mode mode,
                                int opnum, int type, int addr_type,
                                int ind_levels ATTRIBUTE_UNUSED,
                                rtx (*mk_memloc)(rtx,int))
 {
+  rtx x = *px;
+  
   if (avr_log.legitimize_reload_address)
     avr_edump ("\n%?:%m %r\n", mode, x);
   
@@ -1372,7 +1374,7 @@  avr_legitimize_reload_address (rtx x, en
                    opnum, RELOAD_OTHER);
       
       if (avr_log.legitimize_reload_address)
-        avr_edump (" RCLASS = %R\n IN = %r\n OUT = %r\n",
+        avr_edump (" RCLASS.1 = %R\n IN = %r\n OUT = %r\n",
                    POINTER_REGS, XEXP (x, 0), XEXP (x, 0));
       
       return x;
@@ -1398,7 +1400,7 @@  avr_legitimize_reload_address (rtx x, en
                            1, addr_type);
               
               if (avr_log.legitimize_reload_address)
-                avr_edump (" RCLASS = %R\n IN = %r\n OUT = %r\n",
+                avr_edump (" RCLASS.2 = %R\n IN = %r\n OUT = %r\n",
                            POINTER_REGS, XEXP (mem, 0), NULL_RTX);
               
               push_reload (mem, NULL_RTX, &XEXP (x, 0), NULL,
@@ -1406,7 +1408,7 @@  avr_legitimize_reload_address (rtx x, en
                            opnum, type);
               
               if (avr_log.legitimize_reload_address)
-                avr_edump (" RCLASS = %R\n IN = %r\n OUT = %r\n",
+                avr_edump (" RCLASS.2 = %R\n IN = %r\n OUT = %r\n",
                            BASE_POINTER_REGS, mem, NULL_RTX);
               
               return x;
@@ -1415,12 +1417,12 @@  avr_legitimize_reload_address (rtx x, en
       else if (! (frame_pointer_needed
                   && XEXP (x, 0) == frame_pointer_rtx))
         {
-          push_reload (x, NULL_RTX, &x, NULL,
+          push_reload (x, NULL_RTX, px, NULL,
                        POINTER_REGS, GET_MODE (x), VOIDmode, 0, 0,
                        opnum, type);
           
           if (avr_log.legitimize_reload_address)
-            avr_edump (" RCLASS = %R\n IN = %r\n OUT = %r\n",
+            avr_edump (" RCLASS.3 = %R\n IN = %r\n OUT = %r\n",
                        POINTER_REGS, x, NULL_RTX);
           
           return x;
Index: config/avr/avr.h
===================================================================
--- config/avr/avr.h	(revision 180298)
+++ config/avr/avr.h	(working copy)
@@ -375,7 +375,7 @@  typedef struct avr_args {
 
 #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_L,WIN)          \
   do {                                                                  \
-    rtx new_x = avr_legitimize_reload_address (X, MODE, OPNUM, TYPE,    \
+    rtx new_x = avr_legitimize_reload_address (&(X), MODE, OPNUM, TYPE, \
                                                ADDR_TYPE (TYPE),        \
                                                IND_L, make_memloc);     \
     if (new_x)                                                          \