re PR target/46434 (crx-elf --enable-werror-always build fails)
authorRichard Henderson <rth@redhat.com>
Mon, 22 Nov 2010 21:20:52 +0000 (13:20 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 22 Nov 2010 21:20:52 +0000 (13:20 -0800)
PR target/46434
        * config/crx/crx.c (crx_addr_reg): Rename from crx_addr_reg_p;
        return the address register extracted.
        (crx_decompose_address): Update the extracted address register.

From-SVN: r167053

gcc/ChangeLog
gcc/config/crx/crx.c

index 43f469670ee62b831a003ca9e6c404eb1d2e3028..753b9702ba034de81ae767b04500be70b9121d24 100644 (file)
@@ -1,3 +1,10 @@
+2010-11-22  Richard Henderson  <rth@redhat.com>
+
+       PR target/46434
+       * config/crx/crx.c (crx_addr_reg): Rename from crx_addr_reg_p;
+       return the address register extracted.
+       (crx_decompose_address): Update the extracted address register.
+
 2010-11-22  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
 
        PR driver/43335
index 0691de69b2fea279a56670e611b61f1b1eb64c0c..d6b9022b239e1ddeb784739f2f49c0ccb792140c 100644 (file)
@@ -590,30 +590,21 @@ crx_function_arg_regno_p (int n)
  * Scaled index                --> reg + reg | 22-bit disp. + reg + reg |
  *                         22-disp. + reg + reg + (2 | 4 | 8) */
 
-static int crx_addr_reg_p (rtx addr_reg)
+static rtx
+crx_addr_reg (rtx addr_reg)
 {
-  rtx reg;
+  if (GET_MODE (addr_reg) != Pmode)
+    return NULL_RTX;
 
   if (REG_P (addr_reg))
-    {
-      reg = addr_reg;
-    }
-  else if ((GET_CODE (addr_reg) == SUBREG
+    return addr_reg;
+  else if (GET_CODE (addr_reg) == SUBREG
           && REG_P (SUBREG_REG (addr_reg))
-          && GET_MODE_SIZE (GET_MODE (SUBREG_REG (addr_reg)))
-          <= UNITS_PER_WORD))
-    {
-      reg = SUBREG_REG (addr_reg);
-    }
+          && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (addr_reg)))
+              <= UNITS_PER_WORD))
+    return SUBREG_REG (addr_reg);
   else
-    return FALSE;
-
-  if (GET_MODE (addr_reg) != Pmode)
-    {
-      return FALSE;
-    }
-
-  return TRUE;
+    return NULL_RTX;
 }
 
 enum crx_addrtype
@@ -752,8 +743,18 @@ crx_decompose_address (rtx addr, struct crx_address *out)
       return CRX_INVALID;
     }
 
-  if (base && !crx_addr_reg_p (base)) return CRX_INVALID;
-  if (index && !crx_addr_reg_p (index)) return CRX_INVALID;
+  if (base)
+    {
+      base = crx_addr_reg (base);
+      if (!base)
+       return CRX_INVALID;
+    }
+  if (index)
+    {
+      index = crx_addr_reg (index);
+      if (!index)
+       return CRX_INVALID;
+    }
   
   out->base = base;
   out->index = index;