]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: explow.c (convert_memory_address): Define even when POINTERS_EXTEND_UNSIGNE...
authorRoger Sayle <sayle@gcc.gnu.org>
Wed, 24 Dec 2003 16:04:46 +0000 (16:04 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Wed, 24 Dec 2003 16:04:46 +0000 (16:04 +0000)
Backport from mainline:

2003-09-18  Mark Mitchell  <mark@codesourcery.com>
* explow.c (convert_memory_address): Define even when
POINTERS_EXTEND_UNSIGNED is not defined.  Do nothing if the address
        is already in the right mode.

From-SVN: r75008

gcc/ChangeLog
gcc/explow.c

index 3f5b6f2181a4e7f135f6917b7ca51759f028d790..ab878d6550554bf0eca7a4a82b55f74d04562271 100644 (file)
@@ -1,11 +1,20 @@
+2003-12-24  Roger Sayle  <roger@eyesopen.com>
+
+       Backport from mainline:
+
+       2003-09-18  Mark Mitchell  <mark@codesourcery.com>
+       * explow.c (convert_memory_address): Define even when
+       POINTERS_EXTEND_UNSIGNED is not defined.  Do nothing if the address
+        is already in the right mode.
+
 2003-12-23  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR middle-end/13475
        Backport from mainline:
                2003-06-19  Aldy Hernandez  <aldyh@redhat.com>
 
-               * expr.c (const_vector_from_tree): Initialize remaining elements
-               to 0.
+               * expr.c (const_vector_from_tree): Initialize remaining
+               elements to 0.
 
 2003-12-23  Kazu Hirata  <kazu@cs.umass.edu>
 
index 0d9139a466b2a9a4bb5a00be3573ff7b5573bf4d..63bbbb080eb17a1d8cb64a0fce4a01df3815e210 100644 (file)
@@ -356,8 +356,6 @@ break_out_memory_refs (x)
   return x;
 }
 
-#ifdef POINTERS_EXTEND_UNSIGNED
-
 /* Given X, a memory address in ptr_mode, convert it to an address
    in Pmode, or vice versa (TO_MODE says which way).  We take advantage of
    the fact that pointers are not allowed to overflow by commuting arithmetic
@@ -366,13 +364,22 @@ break_out_memory_refs (x)
 
 rtx
 convert_memory_address (to_mode, x)
-     enum machine_mode to_mode;
+     enum machine_mode to_mode ATTRIBUTE_UNUSED;
      rtx x;
 {
-  enum machine_mode from_mode = to_mode == ptr_mode ? Pmode : ptr_mode;
+#ifndef POINTERS_EXTEND_UNSIGNED
+  return x;
+#else /* defined(POINTERS_EXTEND_UNSIGNED) */
+  enum machine_mode from_mode;
   rtx temp;
   enum rtx_code code;
 
+  /* If X already has the right mode, just return it.  */
+  if (GET_MODE (x) == to_mode)
+    return x;
+
+  from_mode = to_mode == ptr_mode ? Pmode : ptr_mode;
+
   /* Here we handle some special cases.  If none of them apply, fall through
      to the default case.  */
   switch (GET_CODE (x))
@@ -436,8 +443,8 @@ convert_memory_address (to_mode, x)
 
   return convert_modes (to_mode, from_mode,
                        x, POINTERS_EXTEND_UNSIGNED);
+#endif /* defined(POINTERS_EXTEND_UNSIGNED) */
 }
-#endif
 
 /* Given a memory address or facsimile X, construct a new address,
    currently equivalent, that is stable: future stores won't change it.