]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
emit-rtl: Change return type of predicate functions from int to bool
authorUros Bizjak <ubizjak@gmail.com>
Wed, 31 May 2023 08:49:03 +0000 (10:49 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Wed, 31 May 2023 14:14:22 +0000 (16:14 +0200)
Also fix some stalled comments.

gcc/ChangeLog:

* rtl.h (subreg_lowpart_p): Change return type from int to bool.
(active_insn_p): Ditto.
(in_sequence_p): Ditto.
(unshare_all_rtl): Change return type from int to void.
* emit-rtl.h (mem_expr_equal_p): Change return type from int to bool.
* emit-rtl.cc (subreg_lowpart_p): Change return type from int to bool
and adjust function body accordingly.
(mem_expr_equal_p): Ditto.
(unshare_all_rtl): Change return type from int to void
and adjust function body accordingly.
(verify_rtx_sharing): Remove unneeded return.
(active_insn_p): Change return type from int to bool
and adjust function body accordingly.
(in_sequence_p): Ditto.

gcc/emit-rtl.cc
gcc/emit-rtl.h
gcc/rtl.h

index 51db055d214dc8bae510475edf78054901e7b15d..f6276a2d0b627fd5b2a742795a55423f449e9d93 100644 (file)
@@ -215,7 +215,7 @@ const_int_hasher::hash (rtx x)
   return (hashval_t) INTVAL (x);
 }
 
-/* Returns nonzero if the value represented by X (which is really a
+/* Returns true if the value represented by X (which is really a
    CONST_INT) is the same as that given by Y (which is really a
    HOST_WIDE_INT *).  */
 
@@ -241,7 +241,7 @@ const_wide_int_hasher::hash (rtx x)
   return (hashval_t) hash;
 }
 
-/* Returns nonzero if the value represented by X (which is really a
+/* Returns true if the value represented by X (which is really a
    CONST_WIDE_INT) is the same as that given by Y (which is really a
    CONST_WIDE_INT).  */
 
@@ -274,7 +274,7 @@ const_poly_int_hasher::hash (rtx x)
   return h.end ();
 }
 
-/* Returns nonzero if CONST_POLY_INT X is an rtx representation of Y.  */
+/* Returns true if CONST_POLY_INT X is an rtx representation of Y.  */
 
 bool
 const_poly_int_hasher::equal (rtx x, const compare_type &y)
@@ -305,7 +305,7 @@ const_double_hasher::hash (rtx x)
   return h;
 }
 
-/* Returns nonzero if the value represented by X (really a ...)
+/* Returns true if the value represented by X (really a ...)
    is the same as that represented by Y (really a ...) */
 bool
 const_double_hasher::equal (rtx x, rtx y)
@@ -313,7 +313,7 @@ const_double_hasher::equal (rtx x, rtx y)
   const_rtx const a = x, b = y;
 
   if (GET_MODE (a) != GET_MODE (b))
-    return 0;
+    return false;
   if (TARGET_SUPPORTS_WIDE_INT == 0 && GET_MODE (a) == VOIDmode)
     return (CONST_DOUBLE_LOW (a) == CONST_DOUBLE_LOW (b)
            && CONST_DOUBLE_HIGH (a) == CONST_DOUBLE_HIGH (b));
@@ -336,7 +336,7 @@ const_fixed_hasher::hash (rtx x)
   return h;
 }
 
-/* Returns nonzero if the value represented by X is the same as that
+/* Returns true if the value represented by X is the same as that
    represented by Y.  */
 
 bool
@@ -345,7 +345,7 @@ const_fixed_hasher::equal (rtx x, rtx y)
   const_rtx const a = x, b = y;
 
   if (GET_MODE (a) != GET_MODE (b))
-    return 0;
+    return false;
   return fixed_identical (CONST_FIXED_VALUE (a), CONST_FIXED_VALUE (b));
 }
 
@@ -403,7 +403,7 @@ reg_attr_hasher::hash (reg_attrs *x)
   return h.end ();
 }
 
-/* Returns nonzero if the value represented by X  is the same as that given by
+/* Returns true if the value represented by X  is the same as that given by
    Y.  */
 
 bool
@@ -1710,17 +1710,17 @@ subreg_size_highpart_offset (poly_uint64 outer_bytes, poly_uint64 inner_bytes)
                                        * BITS_PER_UNIT);
 }
 
-/* Return 1 iff X, assumed to be a SUBREG,
+/* Return true iff X, assumed to be a SUBREG,
    refers to the least significant part of its containing reg.
-   If X is not a SUBREG, always return 1 (it is its own low part!).  */
+   If X is not a SUBREG, always return true (it is its own low part!).  */
 
-int
+bool
 subreg_lowpart_p (const_rtx x)
 {
   if (GET_CODE (x) != SUBREG)
-    return 1;
+    return true;
   else if (GET_MODE (SUBREG_REG (x)) == VOIDmode)
-    return 0;
+    return false;
 
   return known_eq (subreg_lowpart_offset (GET_MODE (x),
                                          GET_MODE (SUBREG_REG (x))),
@@ -1836,20 +1836,20 @@ mem_attrs::mem_attrs ()
     size_known_p (false)
 {}
 
-/* Returns 1 if both MEM_EXPR can be considered equal
-   and 0 otherwise.  */
+/* Returns true if both MEM_EXPR can be considered equal
+   and false otherwise.  */
 
-int
+bool
 mem_expr_equal_p (const_tree expr1, const_tree expr2)
 {
   if (expr1 == expr2)
-    return 1;
+    return true;
 
   if (! expr1 || ! expr2)
-    return 0;
+    return false;
 
   if (TREE_CODE (expr1) != TREE_CODE (expr2))
-    return 0;
+    return false;
 
   return operand_equal_p (expr1, expr2, 0);
 }
@@ -2820,7 +2820,7 @@ unshare_all_rtl_again (rtx_insn *insn)
   unshare_all_rtl_1 (insn);
 }
 
-unsigned int
+void
 unshare_all_rtl (void)
 {
   unshare_all_rtl_1 (get_insns ());
@@ -2831,8 +2831,6 @@ unshare_all_rtl (void)
        SET_DECL_RTL (decl, copy_rtx_if_shared (DECL_RTL (decl)));
       DECL_INCOMING_RTL (decl) = copy_rtx_if_shared (DECL_INCOMING_RTL (decl));
     }
-
-  return 0;
 }
 
 
@@ -2943,7 +2941,6 @@ verify_rtx_sharing (rtx orig, rtx insn)
          break;
        }
     }
-  return;
 }
 
 /* Reset used-flags for INSN.  */
@@ -3206,7 +3203,6 @@ repeat:
       orig1 = last_ptr;
       goto repeat;
     }
-  return;
 }
 
 /* Set the USED bit in X and its non-shareable subparts to FLAG.  */
@@ -3686,11 +3682,7 @@ last_call_insn (void)
   return safe_as_a <rtx_call_insn *> (insn);
 }
 
-/* Find the next insn after INSN that really does something.  This routine
-   does not look inside SEQUENCEs.  After reload this also skips over
-   standalone USE and CLOBBER insn.  */
-
-int
+bool
 active_insn_p (const rtx_insn *insn)
 {
   return (CALL_P (insn) || JUMP_P (insn)
@@ -3701,6 +3693,10 @@ active_insn_p (const rtx_insn *insn)
                      && GET_CODE (PATTERN (insn)) != CLOBBER))));
 }
 
+/* Find the next insn after INSN that really does something.  This routine
+   does not look inside SEQUENCEs.  After reload this also skips over
+   standalone USE and CLOBBER insn.  */
+
 rtx_insn *
 next_active_insn (rtx_insn *insn)
 {
@@ -5586,9 +5582,9 @@ end_sequence (void)
   free_sequence_stack = tem;
 }
 
-/* Return 1 if currently emitting into a sequence.  */
+/* Return true if currently emitting into a sequence.  */
 
-int
+bool
 in_sequence_p (void)
 {
   return get_current_sequence ()->next != 0;
index c472c736cb66acf821d54ab899ed6e425faa0658..af62f21f1d503994ef4fbf5883e2fe978f43f7f0 100644 (file)
@@ -393,7 +393,7 @@ extern void set_reg_attrs_from_value (rtx, rtx);
 extern void set_reg_attrs_for_parm (rtx, rtx);
 extern void set_reg_attrs_for_decl_rtl (tree t, rtx x);
 extern void adjust_reg_mode (rtx, machine_mode);
-extern int mem_expr_equal_p (const_tree, const_tree);
+extern bool mem_expr_equal_p (const_tree, const_tree);
 extern rtx gen_int_shift_amount (machine_mode, poly_int64);
 
 extern bool need_atomic_barrier_p (enum memmodel, bool);
index cabe0e9e9c6f6b67b4349fb685a2a89ab67a59e5..6eaa52d531b4915f585d43f5c3e3607f698d778a 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3162,7 +3162,7 @@ extern rtx operand_subword (rtx, poly_uint64, int, machine_mode);
 
 /* In emit-rtl.cc */
 extern rtx operand_subword_force (rtx, poly_uint64, machine_mode);
-extern int subreg_lowpart_p (const_rtx);
+extern bool subreg_lowpart_p (const_rtx);
 extern poly_uint64 subreg_size_lowpart_offset (poly_uint64, poly_uint64);
 
 /* Return true if a subreg of mode OUTERMODE would only access part of
@@ -3371,7 +3371,7 @@ extern rtx_insn *prev_real_nondebug_insn (rtx_insn *);
 extern rtx_insn *next_real_nondebug_insn (rtx);
 extern rtx_insn *prev_active_insn (rtx_insn *);
 extern rtx_insn *next_active_insn (rtx_insn *);
-extern int active_insn_p (const rtx_insn *);
+extern bool active_insn_p (const rtx_insn *);
 
 /* In emit-rtl.cc  */
 extern int insn_line (const rtx_insn *);
@@ -4189,7 +4189,7 @@ extern void set_used_flags (rtx);
 extern void reorder_insns (rtx_insn *, rtx_insn *, rtx_insn *);
 extern void reorder_insns_nobb (rtx_insn *, rtx_insn *, rtx_insn *);
 extern int get_max_insn_count (void);
-extern int in_sequence_p (void);
+extern bool in_sequence_p (void);
 extern void init_emit (void);
 extern void init_emit_regs (void);
 extern void init_derived_machine_modes (void);
@@ -4197,7 +4197,7 @@ extern void init_emit_once (void);
 extern void push_topmost_sequence (void);
 extern void pop_topmost_sequence (void);
 extern void set_new_first_and_last_insn (rtx_insn *, rtx_insn *);
-extern unsigned int unshare_all_rtl (void);
+extern void unshare_all_rtl (void);
 extern void unshare_all_rtl_again (rtx_insn *);
 extern void unshare_all_rtl_in_chain (rtx_insn *);
 extern void verify_rtl_sharing (void);