Remove hard_reg_set_equal_p
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 9 Sep 2019 17:59:41 +0000 (17:59 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 9 Sep 2019 17:59:41 +0000 (17:59 +0000)
Use "x == y" instead of "hard_reg_set_equal_p (x, y)".

2019-09-09  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* hard-reg-set.h (HARD_REG_SET::operator==): New function.
(HARD_REG_SET::operator!=): Likewise.
(hard_reg_set_equal_p): Delete.
* cfgcleanup.c (old_insns_match_p): Use == instead of
hard_reg_set_equal_p and != instead of !hard_reg_set_equal_p.
* ira-color.c (allocno_hard_regs_hasher::equal): Likewise.
(add_allocno_hard_regs_to_forest): Likewise.
(setup_allocno_available_regs_num): Likewise.
* ira.c (setup_pressure_classes): Likewise.
(setup_allocno_and_important_classes): Likewise.
(setup_reg_class_relations): Likewise.
* lra-lives.c (process_bb_lives): Likewise.
* reg-stack.c (change_stack, convert_regs_1): Likewise.

From-SVN: r275534

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/hard-reg-set.h
gcc/ira-color.c
gcc/ira.c
gcc/lra-lives.c
gcc/reg-stack.c

index 5a97cb9e61af341969946dd069bd76337d8ef99b..8c791dd71318ae2715ad01164d46b8fbb6187f42 100644 (file)
@@ -1,3 +1,19 @@
+2019-09-09  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * hard-reg-set.h (HARD_REG_SET::operator==): New function.
+       (HARD_REG_SET::operator!=): Likewise.
+       (hard_reg_set_equal_p): Delete.
+       * cfgcleanup.c (old_insns_match_p): Use == instead of
+       hard_reg_set_equal_p and != instead of !hard_reg_set_equal_p.
+       * ira-color.c (allocno_hard_regs_hasher::equal): Likewise.
+       (add_allocno_hard_regs_to_forest): Likewise.
+       (setup_allocno_available_regs_num): Likewise.
+       * ira.c (setup_pressure_classes): Likewise.
+       (setup_allocno_and_important_classes): Likewise.
+       (setup_reg_class_relations): Likewise.
+       * lra-lives.c (process_bb_lives): Likewise.
+       * reg-stack.c (change_stack, convert_regs_1): Likewise.
+
 2019-09-09  Richard Sandiford  <richard.sandiford@arm.com>
 
        * hard-reg-set.h (IOR_COMPL_HARD_REG_SET): Delete.
index b9307631e1cdd2ef88b3c24dfb57295fd540887c..baa380959642eae8805d9c73e4cdb4d7de81d76f 100644 (file)
@@ -1231,7 +1231,7 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx_insn *i1, rtx_insn *i2)
       get_call_reg_set_usage (i1, &i1_used, call_used_reg_set);
       get_call_reg_set_usage (i2, &i2_used, call_used_reg_set);
 
-      if (!hard_reg_set_equal_p (i1_used, i2_used))
+      if (i1_used != i2_used)
         return dir_none;
     }
 
@@ -1265,7 +1265,7 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx_insn *i1, rtx_insn *i2)
        if (REG_NOTE_KIND (note) == REG_DEAD && STACK_REG_P (XEXP (note, 0)))
          SET_HARD_REG_BIT (i2_regset, REGNO (XEXP (note, 0)));
 
-      if (!hard_reg_set_equal_p (i1_regset, i2_regset))
+      if (i1_regset != i2_regset)
        return dir_none;
     }
 #endif
index 793b8699c36b227e66e72e6b57ad3a29587f66fa..e59779dddd288b62acb7a52be8707c343a2be3dd 100644 (file)
@@ -96,6 +96,21 @@ struct HARD_REG_SET
     return *this;
   }
 
+  bool
+  operator== (const HARD_REG_SET &other) const
+  {
+    HARD_REG_ELT_TYPE bad = 0;
+    for (unsigned int i = 0; i < ARRAY_SIZE (elts); ++i)
+      bad |= (elts[i] ^ other.elts[i]);
+    return bad == 0;
+  }
+
+  bool
+  operator!= (const HARD_REG_SET &other) const
+  {
+    return !operator== (other);
+  }
+
   HARD_REG_ELT_TYPE elts[HARD_REG_SET_LONGS];
 };
 typedef const HARD_REG_SET &const_hard_reg_set;
@@ -129,7 +144,6 @@ struct hard_reg_set_container
    Also define:
 
    hard_reg_set_subset_p (X, Y), which returns true if X is a subset of Y.
-   hard_reg_set_equal_p (X, Y), which returns true if X and Y are equal.
    hard_reg_set_intersect_p (X, Y), which returns true if X and Y intersect.
    hard_reg_set_empty_p (X), which returns true if X is empty.  */
 
@@ -153,12 +167,6 @@ hard_reg_set_subset_p (const_hard_reg_set x, const_hard_reg_set y)
   return (x & ~y) == HARD_CONST (0);
 }
 
-static inline bool
-hard_reg_set_equal_p (const_hard_reg_set x, const_hard_reg_set y)
-{
-  return x == y;
-}
-
 static inline bool
 hard_reg_set_intersect_p (const_hard_reg_set x, const_hard_reg_set y)
 {
@@ -217,15 +225,6 @@ hard_reg_set_subset_p (const_hard_reg_set x, const_hard_reg_set y)
   return bad == 0;
 }
 
-static inline bool
-hard_reg_set_equal_p (const_hard_reg_set x, const_hard_reg_set y)
-{
-  HARD_REG_ELT_TYPE bad = 0;
-  for (unsigned int i = 0; i < ARRAY_SIZE (x.elts); ++i)
-    bad |= (x.elts[i] ^ y.elts[i]);
-  return bad == 0;
-}
-
 static inline bool
 hard_reg_set_intersect_p (const_hard_reg_set x, const_hard_reg_set y)
 {
index 8d68c87c2693af2db17dffa22273ce5d15bc95f0..eee9e0b7b4881fc3190e9ae54b5df94d3941db66 100644 (file)
@@ -218,7 +218,7 @@ inline bool
 allocno_hard_regs_hasher::equal (const allocno_hard_regs *hv1,
                                 const allocno_hard_regs *hv2)
 {
-  return hard_reg_set_equal_p (hv1->set, hv2->set);
+  return hv1->set == hv2->set;
 }
 
 /* Hash table of unique allocno hard registers.  */
@@ -371,7 +371,7 @@ add_allocno_hard_regs_to_forest (allocno_hard_regs_node_t *roots,
   start = hard_regs_node_vec.length ();
   for (node = *roots; node != NULL; node = node->next)
     {
-      if (hard_reg_set_equal_p (hv->set, node->hard_regs->set))
+      if (hv->set == node->hard_regs->set)
        return;
       if (hard_reg_set_subset_p (hv->set, node->hard_regs->set))
        {
@@ -2688,8 +2688,7 @@ setup_allocno_available_regs_num (ira_allocno_t a)
      reg_class_names[aclass], ira_class_hard_regs_num[aclass], n);
   print_hard_reg_set (ira_dump_file, data->profitable_hard_regs, false);
   fprintf (ira_dump_file, ", %snode: ",
-          hard_reg_set_equal_p (data->profitable_hard_regs,
-                                data->hard_regs_node->hard_regs->set)
+          data->profitable_hard_regs == data->hard_regs_node->hard_regs->set
           ? "" : "^");
   print_hard_reg_set (ira_dump_file,
                      data->hard_regs_node->hard_regs->set, false);
index 344275a24a852461c4596643bb916ea2938a098e..029d690cb4c9e83394723b4f5079eb3e4ce29c2f 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -841,8 +841,7 @@ setup_pressure_classes (void)
              temp_hard_regset2 = (reg_class_contents[cl2]
                                   & ~no_unit_alloc_regs);
              if (hard_reg_set_subset_p (temp_hard_regset, temp_hard_regset2)
-                 && (! hard_reg_set_equal_p (temp_hard_regset,
-                                             temp_hard_regset2)
+                 && (temp_hard_regset != temp_hard_regset2
                      || cl2 == (int) GENERAL_REGS))
                {
                  pressure_classes[curr++] = (enum reg_class) cl2;
@@ -850,11 +849,10 @@ setup_pressure_classes (void)
                  continue;
                }
              if (hard_reg_set_subset_p (temp_hard_regset2, temp_hard_regset)
-                 && (! hard_reg_set_equal_p (temp_hard_regset2,
-                                             temp_hard_regset)
+                 && (temp_hard_regset2 != temp_hard_regset
                      || cl == (int) GENERAL_REGS))
                continue;
-             if (hard_reg_set_equal_p (temp_hard_regset2, temp_hard_regset))
+             if (temp_hard_regset2 == temp_hard_regset)
                insert_p = false;
              pressure_classes[curr++] = (enum reg_class) cl2;
            }
@@ -999,8 +997,7 @@ setup_allocno_and_important_classes (void)
        {
          cl = classes[j];
          temp_hard_regset2 = reg_class_contents[cl] & ~no_unit_alloc_regs;
-         if (hard_reg_set_equal_p (temp_hard_regset,
-                                   temp_hard_regset2))
+         if (temp_hard_regset == temp_hard_regset2)
            break;
        }
       if (j >= n || targetm.additional_allocno_class_p (i))
@@ -1273,7 +1270,7 @@ setup_reg_class_relations (void)
                             the same, prefer GENERAL_REGS or the
                             smallest class for debugging
                             purposes.  */
-                         || (hard_reg_set_equal_p (temp_hard_regset, temp_set2)
+                         || (temp_hard_regset == temp_set2
                              && (cl3 == GENERAL_REGS
                                  || ((ira_reg_class_intersect[cl1][cl2]
                                       != GENERAL_REGS)
@@ -1290,7 +1287,7 @@ setup_reg_class_relations (void)
                  if (! hard_reg_set_subset_p (temp_hard_regset, temp_set2)
                      /* Ignore unavailable hard registers and prefer
                         smallest class for debugging purposes.  */
-                     || (hard_reg_set_equal_p (temp_hard_regset, temp_set2)
+                     || (temp_hard_regset == temp_set2
                          && hard_reg_set_subset_p
                             (reg_class_contents[cl3],
                              reg_class_contents
@@ -1309,8 +1306,7 @@ setup_reg_class_relations (void)
                  if (ira_reg_class_subunion[cl1][cl2] == NO_REGS
                      || (hard_reg_set_subset_p (temp_set2, temp_hard_regset)
                          
-                         && (! hard_reg_set_equal_p (temp_set2,
-                                                     temp_hard_regset)
+                         && (temp_set2 != temp_hard_regset
                              || cl3 == GENERAL_REGS
                              /* If the allocatable hard register sets are the
                                 same, prefer GENERAL_REGS or the smallest
@@ -1333,8 +1329,7 @@ setup_reg_class_relations (void)
                  if (ira_reg_class_superunion[cl1][cl2] == NO_REGS
                      || (hard_reg_set_subset_p (temp_hard_regset, temp_set2)
 
-                         && (! hard_reg_set_equal_p (temp_set2,
-                                                     temp_hard_regset)
+                         && (temp_set2 != temp_hard_regset
                              || cl3 == GENERAL_REGS
                              /* If the allocatable hard register sets are the
                                 same, prefer GENERAL_REGS or the smallest
index e1674b570ac32a56f900263c4a441ce710f9acb7..0bdba3910ab87f3db1bac4b1d906365a3c7b9711 100644 (file)
@@ -936,8 +936,8 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p)
                                      call_used_reg_set);
 
              bool flush = (! hard_reg_set_empty_p (last_call_used_reg_set)
-                           && ( ! hard_reg_set_equal_p (last_call_used_reg_set,
-                                                      this_call_used_reg_set)))
+                           && (last_call_used_reg_set
+                               != this_call_used_reg_set))
                           || (last_call_insn && ! calls_have_same_clobbers_p
                                                     (call_insn,
                                                      last_call_insn));
index 19f020acd7e910ff40597befdafbc9304c4d208e..6edcc6f6101c145e8dfb78c7066735d51e80d511 100644 (file)
@@ -2643,7 +2643,7 @@ change_stack (rtx_insn *insn, stack_ptr old, stack_ptr new_stack,
       /* By now, the only difference should be the order of the stack,
         not their depth or liveliness.  */
 
-      gcc_assert (hard_reg_set_equal_p (old->reg_set, new_stack->reg_set));
+      gcc_assert (old->reg_set == new_stack->reg_set);
       gcc_assert (old->top == new_stack->top);
 
       /* If the stack is not empty (new_stack->top != -1), loop here emitting
@@ -3158,8 +3158,7 @@ convert_regs_1 (basic_block block)
      asms, we zapped the instruction itself, but that didn't produce the
      same pattern of register kills as before.  */
 
-  gcc_assert (hard_reg_set_equal_p (regstack.reg_set, bi->out_reg_set)
-             || any_malformed_asm);
+  gcc_assert (regstack.reg_set == bi->out_reg_set || any_malformed_asm);
   bi->stack_out = regstack;
   bi->done = true;