[i386] Change ix86_decompose_address return type to bool.

Message ID CAFULd4azPy1F6RCukJ=e0jb+DiKfVZVZjDLP1fAEtjUGwuGHiQ@mail.gmail.com
State Committed
Commit d7071e4982231741409a9653c53d58bd8c7fe1e5
Headers
Series [i386] Change ix86_decompose_address return type to bool. |

Commit Message

Uros Bizjak Sept. 16, 2021, 5:08 p.m. UTC
  After a recent change only a boolean value is returned.

2021-09-16  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
    * config/i386/i386-protos.h (ix86_decompose_address):
    Change return type to bool.
    * config/i386/i386.c (ix86_decompose_address): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Pushed to master.

Uros.
  

Patch

diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index dcae34b915e..708834ae832 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -320,7 +320,7 @@  struct ix86_address
   addr_space_t seg;
 };
 
-extern int ix86_decompose_address (rtx, struct ix86_address *);
+extern bool ix86_decompose_address (rtx, struct ix86_address *);
 extern int memory_address_length (rtx, bool);
 extern void x86_output_aligned_bss (FILE *, tree, const char *,
 				    unsigned HOST_WIDE_INT, unsigned);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index d7abff0f396..337ea291780 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -10101,10 +10101,10 @@  ix86_live_on_entry (bitmap regs)
 }
 
 /* Extract the parts of an RTL expression that is a valid memory address
-   for an instruction.  Return 0 if the structure of the address is
+   for an instruction.  Return false if the structure of the address is
    grossly off.  */
 
-int
+bool
 ix86_decompose_address (rtx addr, struct ix86_address *out)
 {
   rtx base = NULL_RTX, index = NULL_RTX, disp = NULL_RTX;
@@ -10123,17 +10123,17 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
 	{
 	  addr = XEXP (addr, 0);
 	  if (CONST_INT_P (addr))
-	    return 0;
+	    return false;
 	}	      
       else if (GET_CODE (addr) == AND
 	       && const_32bit_mask (XEXP (addr, 1), DImode))
 	{
 	  addr = lowpart_subreg (SImode, XEXP (addr, 0), DImode);
 	  if (addr == NULL_RTX)
-	    return 0;
+	    return false;
 
 	  if (CONST_INT_P (addr))
-	    return 0;
+	    return false;
 	}
       else if (GET_CODE (addr) == AND)
 	{
@@ -10167,7 +10167,7 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
 	{
 	  addr = SUBREG_REG (addr);
 	  if (CONST_INT_P (addr))
-	    return 0;
+	    return false;
 	}
     }
 
@@ -10178,7 +10178,7 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
       if (REG_P (SUBREG_REG (addr)))
 	base = addr;
       else
-	return 0;
+	return false;
     }
   else if (GET_CODE (addr) == PLUS)
     {
@@ -10189,13 +10189,13 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
       do
 	{
 	  if (n >= 4)
-	    return 0;
+	    return false;
 	  addends[n++] = XEXP (op, 1);
 	  op = XEXP (op, 0);
 	}
       while (GET_CODE (op) == PLUS);
       if (n >= 4)
-	return 0;
+	return false;
       addends[n] = op;
 
       for (i = n; i >= 0; --i)
@@ -10205,28 +10205,28 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
 	    {
 	    case MULT:
 	      if (index)
-		return 0;
+		return false;
 	      index = XEXP (op, 0);
 	      scale_rtx = XEXP (op, 1);
 	      break;
 
 	    case ASHIFT:
 	      if (index)
-		return 0;
+		return false;
 	      index = XEXP (op, 0);
 	      tmp = XEXP (op, 1);
 	      if (!CONST_INT_P (tmp))
-		return 0;
+		return false;
 	      scale = INTVAL (tmp);
 	      if ((unsigned HOST_WIDE_INT) scale > 3)
-		return 0;
+		return false;
 	      scale = 1 << scale;
 	      break;
 
 	    case ZERO_EXTEND:
 	      op = XEXP (op, 0);
 	      if (GET_CODE (op) != UNSPEC)
-		return 0;
+		return false;
 	      /* FALLTHRU */
 
 	    case UNSPEC:
@@ -10235,12 +10235,12 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
 	          && seg == ADDR_SPACE_GENERIC)
 		seg = DEFAULT_TLS_SEG_REG;
 	      else
-		return 0;
+		return false;
 	      break;
 
 	    case SUBREG:
 	      if (!REG_P (SUBREG_REG (op)))
-		return 0;
+		return false;
 	      /* FALLTHRU */
 
 	    case REG:
@@ -10249,7 +10249,7 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
 	      else if (!index)
 		index = op;
 	      else
-		return 0;
+		return false;
 	      break;
 
 	    case CONST:
@@ -10257,12 +10257,12 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
 	    case SYMBOL_REF:
 	    case LABEL_REF:
 	      if (disp)
-		return 0;
+		return false;
 	      disp = op;
 	      break;
 
 	    default:
-	      return 0;
+	      return false;
 	    }
 	}
     }
@@ -10277,10 +10277,10 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
       index = XEXP (addr, 0);
       tmp = XEXP (addr, 1);
       if (!CONST_INT_P (tmp))
-	return 0;
+	return false;
       scale = INTVAL (tmp);
       if ((unsigned HOST_WIDE_INT) scale > 3)
-	return 0;
+	return false;
       scale = 1 << scale;
     }
   else
@@ -10294,14 +10294,14 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
 	       && REG_P (SUBREG_REG (index)))
 	;
       else
-	return 0;
+	return false;
     }
 
   /* Extract the integral value of scale.  */
   if (scale_rtx)
     {
       if (!CONST_INT_P (scale_rtx))
-	return 0;
+	return false;
       scale = INTVAL (scale_rtx);
     }
 
@@ -10354,7 +10354,7 @@  ix86_decompose_address (rtx addr, struct ix86_address *out)
   out->scale = scale;
   out->seg = seg;
 
-  return 1;
+  return true;
 }
 
 /* Return cost of the memory address x.