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]

[PATCH] MEM tracking info related IA-64 bootstrap failure


On Tue, Nov 13, 2001 at 08:33:08AM -0500, Richard Kenner wrote:
>     (insn 46 135 47 (set (mem/s:DI (post_inc:DI (reg/f:DI 354)) [3 d+0 S8 A128])
>     (insn 51 50 52 (set (mem/s:DI (post_inc:DI (reg/f:DI 354)) [3 d+0 S8 A128])
> 
> This looks wrong.  This has both at offset 0, but clearly the second is at
> offset 8.  Can you see where these MEMs are made?

Here is a patch which fixes this. IMHO it is desirable to keep MEM_OFFSETs
for the loads/stores in builtin memset/memcpy, so I haven't used change_address
which would kill that information.
Ok to commit?

2001-11-13  Jakub Jelinek  <jakub@redhat.com>

	* emit-rtl.c (adjust_address_1): Add ADJUST argument.
	* expr.h (adjust_address, adjust_address_nv): Adjust.
	(adjust_automodify_address, adjust_automodify_address_nv): Define.
	(adjust_address_1): Update prototype.
	(move_by_pieces_1): Use adjust_automodify_address.
	(store_by_pieces_2): Likewise.

--- gcc/expr.c.jj	Mon Nov 12 10:33:43 2001
+++ gcc/expr.c	Tue Nov 13 15:50:13 2001
@@ -1578,7 +1578,7 @@ move_by_pieces_1 (genfun, mode, data)
 	  if (data->autinc_to)
 	    {
 	      to1 = replace_equiv_address (data->to, data->to_addr);
-	      to1 = adjust_address (to1, mode, 0);
+	      to1 = adjust_automodify_address (to1, mode, data->offset);
 	    }
 	  else
 	    to1 = adjust_address (data->to, mode, data->offset);
@@ -1587,7 +1587,7 @@ move_by_pieces_1 (genfun, mode, data)
       if (data->autinc_from)
 	{
 	  from1 = replace_equiv_address (data->from, data->from_addr);
-	  from1 = adjust_address (from1, mode, 0);
+	  from1 = adjust_automodify_address (from1, mode, data->offset);
 	}
       else
 	from1 = adjust_address (data->from, mode, data->offset);
@@ -2526,7 +2526,7 @@ store_by_pieces_2 (genfun, mode, data)
       if (data->autinc_to)
 	{
 	  to1 = replace_equiv_address (data->to, data->to_addr);
-	  to1 = adjust_address (to1, mode, 0);
+	  to1 = adjust_automodify_address (to1, mode, data->offset);
 	}
       else
 	to1 = adjust_address (data->to, mode, data->offset);
--- gcc/expr.h.jj	Mon Nov 12 10:34:00 2001
+++ gcc/expr.h	Mon Nov 12 10:34:00 2001
@@ -627,14 +627,23 @@ extern rtx change_address PARAMS ((rtx, 
 /* Return a memory reference like MEMREF, but with its mode changed
    to MODE and its address offset by OFFSET bytes.  */
 #define adjust_address(MEMREF, MODE, OFFSET) \
-  adjust_address_1 (MEMREF, MODE, OFFSET, 1)
+  adjust_address_1 (MEMREF, MODE, OFFSET, 1, 1)
 
 /* Likewise, but the reference is not required to be valid.  */
 #define adjust_address_nv(MEMREF, MODE, OFFSET) \
-  adjust_address_1 (MEMREF, MODE, OFFSET, 0)
+  adjust_address_1 (MEMREF, MODE, OFFSET, 0, 1)
+
+/* Return a memory reference like MEMREF, but with its mode changed
+   to MODE and its base assumed to be increased by OFFSET bytes.  */
+#define adjust_automodify_address(MEMREF, MODE, OFFSET) \
+  adjust_address_1 (MEMREF, MODE, OFFSET, 1, 0)
+
+/* Likewise, but the reference is not required to be valid.  */
+#define adjust_automodify_address_nv(MEMREF, MODE, OFFSET) \
+  adjust_address_1 (MEMREF, MODE, OFFSET, 0, 0)
 
 extern rtx adjust_address_1 PARAMS ((rtx, enum machine_mode, HOST_WIDE_INT,
-				     int));
+				     int, int));
 
 /* Return a memory reference like MEMREF, but whose address is changed by
    adding OFFSET, an RTX, to it.  POW2 is the highest power of two factor
--- gcc/emit-rtl.c.jj	Mon Nov 12 10:33:43 2001
+++ gcc/emit-rtl.c	Tue Nov 13 15:55:02 2001
@@ -1870,14 +1870,16 @@ change_address (memref, mode, addr)
 
 /* Return a memory reference like MEMREF, but with its mode changed
    to MODE and its address offset by OFFSET bytes.  If VALIDATE is
-   nonzero, the memory address is forced to be valid.  */
+   nonzero, the memory address is forced to be valid.
+   If ADJUST is zero, OFFSET is only used to update MEM_ATTRS
+   and caller is responsible for adjusting MEMREF base register.  */
 
 rtx
-adjust_address_1 (memref, mode, offset, validate)
+adjust_address_1 (memref, mode, offset, validate, adjust)
      rtx memref;
      enum machine_mode mode;
      HOST_WIDE_INT offset;
-     int validate;
+     int validate, adjust;
 {
   rtx addr = XEXP (memref, 0);
   rtx new;
@@ -1885,17 +1887,17 @@ adjust_address_1 (memref, mode, offset, 
   rtx size = 0;
   unsigned int memalign = MEM_ALIGN (memref);
 
+  if (adjust == 0 || offset == 0)
+    /* ??? Prefer to create garbage instead of creating shared rtl.  */
+    addr = copy_rtx (addr);
   /* If MEMREF is a LO_SUM and the offset is within the alignment of the
      object, we can merge it into the LO_SUM.  */
-  if (GET_MODE (memref) != BLKmode && GET_CODE (addr) == LO_SUM
-      && offset >= 0
-      && (unsigned HOST_WIDE_INT) offset
-         < GET_MODE_ALIGNMENT (GET_MODE (memref)) / BITS_PER_UNIT)
+  else if (GET_MODE (memref) != BLKmode && GET_CODE (addr) == LO_SUM
+	   && offset >= 0
+	   && (unsigned HOST_WIDE_INT) offset
+	      < GET_MODE_ALIGNMENT (GET_MODE (memref)) / BITS_PER_UNIT)
     addr = gen_rtx_LO_SUM (Pmode, XEXP (addr, 0),
 			   plus_constant (XEXP (addr, 1), offset));
-  else if (offset == 0)
-    /* ??? Prefer to create garbage instead of creating shared rtl.  */
-    addr = copy_rtx (addr);
   else
     addr = plus_constant (addr, offset);
 


	Jakub


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