]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RTL: Change return type of predicate and callback functions from int to bool
authorUros Bizjak <ubizjak@gmail.com>
Sun, 18 Jun 2023 20:09:38 +0000 (22:09 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Sun, 18 Jun 2023 20:10:19 +0000 (22:10 +0200)
gcc/ChangeLog:

* rtl.h (*rtx_equal_p_callback_function):
Change return type from int to bool.
(rtx_equal_p): Ditto.
(*hash_rtx_callback_function): Ditto.
* rtl.cc (rtx_equal_p): Change return type from int to bool
and adjust function body accordingly.
* early-remat.cc (scratch_equal): Ditto.
* sel-sched-ir.cc (skip_unspecs_callback): Ditto.
(hash_with_unspec_callback): Ditto.

gcc/early-remat.cc
gcc/rtl.cc
gcc/rtl.h
gcc/sel-sched-ir.cc

index 93cef60c790c0cb8b743f5e6bb53daeb568bca92..700cb65d1e91f77e638f605629198160daee8cc5 100644 (file)
@@ -508,16 +508,16 @@ early_remat *early_remat::er;
    This allows us to compare two copies of a pattern, even though their
    SCRATCHes are always distinct.  */
 
-static int
+static bool
 scratch_equal (const_rtx *x, const_rtx *y, rtx *nx, rtx *ny)
 {
   if (GET_CODE (*x) == SCRATCH && GET_CODE (*y) == SCRATCH)
     {
       *nx = const0_rtx;
       *ny = const0_rtx;
-      return 1;
+      return true;
     }
-  return 0;
+  return false;
 }
 
 /* Hash callback functions for remat_candidate.  */
index 0c0049477517578c89a1734c19af4e79edca518d..635410242fa4500558f9961d5a8f904929879b73 100644 (file)
@@ -412,13 +412,13 @@ int currently_expanding_to_rtl;
 
 \f
 
-/* Return 1 if X and Y are identical-looking rtx's.
+/* Return true if X and Y are identical-looking rtx's.
    This is the Lisp function EQUAL for rtx arguments.
 
    Call CB on each pair of rtx if CB is not NULL.
    When the callback returns true, we continue with the new pair.  */
 
-int
+bool
 rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
 {
   int i;
@@ -428,9 +428,9 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
   rtx nx, ny;
 
   if (x == y)
-    return 1;
+    return true;
   if (x == 0 || y == 0)
-    return 0;
+    return false;
 
   /* Invoke the callback first.  */
   if (cb != NULL
@@ -440,17 +440,17 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
   code = GET_CODE (x);
   /* Rtx's of different codes cannot be equal.  */
   if (code != GET_CODE (y))
-    return 0;
+    return false;
 
   /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
      (REG:SI x) and (REG:HI x) are NOT equivalent.  */
 
   if (GET_MODE (x) != GET_MODE (y))
-    return 0;
+    return false;
 
   /* MEMs referring to different address space are not equivalent.  */
   if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
-    return 0;
+    return false;
 
   /* Some RTL can be compared nonrecursively.  */
   switch (code)
@@ -468,7 +468,7 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
     case VALUE:
     case SCRATCH:
     CASE_CONST_UNIQUE:
-      return 0;
+      return false;
 
     case CONST_VECTOR:
       if (!same_vector_encodings_p (x, y))
@@ -500,7 +500,7 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
        {
        case 'w':
          if (XWINT (x, i) != XWINT (y, i))
-           return 0;
+           return false;
          break;
 
        case 'n':
@@ -513,30 +513,30 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
                  && XINT (x, i) == XINT (y, i))
                break;
 #endif
-             return 0;
+             return false;
            }
          break;
 
        case 'p':
          if (maybe_ne (SUBREG_BYTE (x), SUBREG_BYTE (y)))
-           return 0;
+           return false;
          break;
 
        case 'V':
        case 'E':
          /* Two vectors must have the same length.  */
          if (XVECLEN (x, i) != XVECLEN (y, i))
-           return 0;
+           return false;
 
          /* And the corresponding elements must match.  */
          for (j = 0; j < XVECLEN (x, i); j++)
-           if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j), cb) == 0)
-             return 0;
+           if (!rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j), cb))
+             return false;
          break;
 
        case 'e':
-         if (rtx_equal_p (XEXP (x, i), XEXP (y, i), cb) == 0)
-           return 0;
+         if (!rtx_equal_p (XEXP (x, i), XEXP (y, i), cb))
+           return false;
          break;
 
        case 'S':
@@ -544,7 +544,7 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
          if ((XSTR (x, i) || XSTR (y, i))
              && (! XSTR (x, i) || ! XSTR (y, i)
                  || strcmp (XSTR (x, i), XSTR (y, i))))
-           return 0;
+           return false;
          break;
 
        case 'u':
@@ -562,7 +562,7 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
          gcc_unreachable ();
        }
     }
-  return 1;
+  return true;
 }
 
 /* Return true if all elements of VEC are equal.  */
index 3995216b58ba5152a67c14e6bc65aca127b819aa..f66744b18e3b03c4a751fd718c2e6840006f50a1 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3009,10 +3009,10 @@ extern rtx copy_rtx_if_shared (rtx);
 extern unsigned int rtx_size (const_rtx);
 extern rtx shallow_copy_rtx (const_rtx CXX_MEM_STAT_INFO);
 
-typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
-                                             rtx *, rtx *);
-extern int rtx_equal_p (const_rtx, const_rtx,
-                       rtx_equal_p_callback_function = NULL);
+typedef bool (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
+                                              rtx *, rtx *);
+extern bool rtx_equal_p (const_rtx, const_rtx,
+                        rtx_equal_p_callback_function = NULL);
 
 extern bool rtvec_all_equal_p (const_rtvec);
 extern bool rtvec_series_p (rtvec, int);
@@ -4138,8 +4138,8 @@ extern int rtx_to_tree_code (enum rtx_code);
 extern int delete_trivially_dead_insns (rtx_insn *, int);
 extern bool exp_equiv_p (const_rtx, const_rtx, int, bool);
 
-typedef int (*hash_rtx_callback_function) (const_rtx, machine_mode, rtx *,
-                                          machine_mode *);
+typedef bool (*hash_rtx_callback_function) (const_rtx, machine_mode, rtx *,
+                                           machine_mode *);
 extern unsigned hash_rtx (const_rtx, machine_mode, int *, int *,
                          bool, hash_rtx_callback_function = NULL);
 
index 2c82e854b26ea4368d83707dcd93fc25e8a60d4d..a829ba66331eaa9197d9c87302ad4179e8e04570 100644 (file)
@@ -1079,7 +1079,7 @@ free_nop_pool (void)
 /* Skip unspec to support ia64 speculation. Called from rtx_equal_p.
    The callback is given two rtxes XX and YY and writes the new rtxes
    to NX and NY in case some needs to be skipped.  */
-static int
+static bool
 skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
 {
   const_rtx x = *xx;
@@ -1091,7 +1091,7 @@ skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
     {
       *nx = XVECEXP (x, 0, 0);
       *ny = CONST_CAST_RTX (y);
-      return 1;
+      return true;
     }
 
   if (GET_CODE (y) == UNSPEC
@@ -1100,16 +1100,16 @@ skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
     {
       *nx = CONST_CAST_RTX (x);
       *ny = XVECEXP (y, 0, 0);
-      return 1;
+      return true;
     }
 
-  return 0;
+  return false;
 }
 
 /* Callback, called from hash_rtx.  Helps to hash UNSPEC rtx X in a correct way
    to support ia64 speculation.  When changes are needed, new rtx X and new mode
    NMODE are written, and the callback returns true.  */
-static int
+static bool
 hash_with_unspec_callback (const_rtx x, machine_mode mode ATTRIBUTE_UNUSED,
                            rtx *nx, machine_mode* nmode)
 {
@@ -1119,10 +1119,10 @@ hash_with_unspec_callback (const_rtx x, machine_mode mode ATTRIBUTE_UNUSED,
     {
       *nx = XVECEXP (x, 0 ,0);
       *nmode = VOIDmode;
-      return 1;
+      return true;
     }
 
-  return 0;
+  return false;
 }
 
 /* Returns LHS and RHS are ok to be scheduled separately.  */