Remove COMPL_HARD_REG_SET
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 9 Sep 2019 17:59:10 +0000 (17:59 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 9 Sep 2019 17:59:10 +0000 (17:59 +0000)
"COMPL_HARD_REG_SET (x, y)" becomes "x = ~y".

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

gcc/
* hard-reg-set.h (HARD_REG_SET::operator~): New function.
(COMPL_HARD_REG_SET): Delete.
* config/c6x/c6x.c (c6x_call_saved_register_used): Use ~ instead
of COMPL_HARD_REG_SET.
(try_rename_operands): Likewise.
* config/sh/sh.c (push_regs): Likewise.
* lra-assigns.c (find_hard_regno_for_1): Likewise.
* lra-constraints.c (contains_reg_p): Likewise.
* reload1.c (finish_spills, choose_reload_regs_init): Likewise.

From-SVN: r275529

gcc/ChangeLog
gcc/config/c6x/c6x.c
gcc/config/sh/sh.c
gcc/hard-reg-set.h
gcc/lra-assigns.c
gcc/lra-constraints.c
gcc/reload1.c

index a323888..69b742a 100644 (file)
@@ -1,5 +1,17 @@
 2019-09-09  Richard Sandiford  <richard.sandiford@arm.com>
 
+       * hard-reg-set.h (HARD_REG_SET::operator~): New function.
+       (COMPL_HARD_REG_SET): Delete.
+       * config/c6x/c6x.c (c6x_call_saved_register_used): Use ~ instead
+       of COMPL_HARD_REG_SET.
+       (try_rename_operands): Likewise.
+       * config/sh/sh.c (push_regs): Likewise.
+       * lra-assigns.c (find_hard_regno_for_1): Likewise.
+       * lra-constraints.c (contains_reg_p): Likewise.
+       * reload1.c (finish_spills, choose_reload_regs_init): Likewise.
+
+2019-09-09  Richard Sandiford  <richard.sandiford@arm.com>
+
        * hard-reg-set.h (COPY_HARD_REG_SET): Delete.
        * caller-save.c (save_call_clobbered_regs): Use assignment instead
        of COPY_HARD_REG_SET.
index 05b111e..f6a4518 100644 (file)
@@ -1094,7 +1094,7 @@ c6x_call_saved_register_used (tree call_expr)
   INIT_CUMULATIVE_ARGS (cum_v, NULL, NULL, 0, 0);
   cum = pack_cumulative_args (&cum_v);
 
-  COMPL_HARD_REG_SET (call_saved_regset, call_used_reg_set);
+  call_saved_regset = ~call_used_reg_set;
   for (i = 0; i < call_expr_nargs (call_expr); i++)
     {
       parameter = CALL_EXPR_ARG (call_expr, i);
@@ -3472,7 +3472,7 @@ try_rename_operands (rtx_insn *head, rtx_insn *tail, unit_req_table reqs,
     }
 
   /* If we get here, we can do the renaming.  */
-  COMPL_HARD_REG_SET (unavailable, reg_class_contents[(int) super_class]);
+  unavailable = ~reg_class_contents[super_class];
 
   old_reg = this_head->regno;
   best_reg =
index d1af580..4b70ac9 100644 (file)
@@ -6908,11 +6908,8 @@ push_regs (HARD_REG_SET *mask, bool interrupt_handler)
       if (i == FIRST_FP_REG && interrupt_handler && TARGET_FMOVD
          && hard_reg_set_intersect_p (*mask, reg_class_contents[DF_REGS]))
        {
-         HARD_REG_SET unsaved;
-
          push (FPSCR_REG);
-         COMPL_HARD_REG_SET (unsaved, *mask);
-         fpscr_set_from_mem (NORMAL_MODE (FP_MODE), unsaved);
+         fpscr_set_from_mem (NORMAL_MODE (FP_MODE), ~*mask);
          skip_fpscr = true;
        }
       if (i != PR_REG
index 3d6eef2..ca663e8 100644 (file)
@@ -53,6 +53,15 @@ typedef const HARD_REG_SET const_hard_reg_set;
 
 struct HARD_REG_SET
 {
+  HARD_REG_SET
+  operator~ () const
+  {
+    HARD_REG_SET res;
+    for (unsigned int i = 0; i < ARRAY_SIZE (elts); ++i)
+      res.elts[i] = ~elts[i];
+    return res;
+  }
+
   HARD_REG_ELT_TYPE elts[HARD_REG_SET_LONGS];
 };
 typedef const HARD_REG_SET &const_hard_reg_set;
@@ -83,11 +92,6 @@ struct hard_reg_set_container
    CLEAR_HARD_REG_SET and SET_HARD_REG_SET.
    These take just one argument.
 
-   Also define macros for copying the complement of a hard reg set:
-   COMPL_HARD_REG_SET.
-   This takes two arguments TO and FROM; it reads from FROM
-   and stores into TO.
-
    Also define macros for combining hard reg sets:
    IOR_HARD_REG_SET and AND_HARD_REG_SET.
    These take two arguments TO and FROM; they read from FROM
@@ -116,8 +120,6 @@ struct hard_reg_set_container
 #define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0))
 #define SET_HARD_REG_SET(TO) ((TO) = ~ HARD_CONST (0))
 
-#define COMPL_HARD_REG_SET(TO, FROM) ((TO) = ~(FROM))
-
 #define IOR_HARD_REG_SET(TO, FROM) ((TO) |= (FROM))
 #define IOR_COMPL_HARD_REG_SET(TO, FROM) ((TO) |= ~ (FROM))
 #define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM))
@@ -185,13 +187,6 @@ SET_HARD_REG_SET (HARD_REG_SET &set)
 }
 
 inline void
-COMPL_HARD_REG_SET (HARD_REG_SET &to, const_hard_reg_set from)
-{
-  for (unsigned int i = 0; i < ARRAY_SIZE (to.elts); ++i)
-    to.elts[i] = ~from.elts[i];
-}
-
-inline void
 AND_HARD_REG_SET (HARD_REG_SET &to, const_hard_reg_set from)
 {
   for (unsigned int i = 0; i < ARRAY_SIZE (to.elts); ++i)
index d5268c3..8c07e90 100644 (file)
@@ -496,7 +496,7 @@ find_hard_regno_for_1 (int regno, int *cost, int try_only_hard_regno,
     conflict_set = lra_no_alloc_regs;
   else
     {
-      COMPL_HARD_REG_SET (conflict_set, regno_set);
+      conflict_set = ~regno_set;
       IOR_HARD_REG_SET (conflict_set, lra_no_alloc_regs);
     }
   rclass = regno_allocno_class_array[regno];
index 9354612..c3f0c6e 100644 (file)
@@ -4559,7 +4559,7 @@ contains_reg_p (rtx x, bool hard_reg_p, bool spilled_p)
            regno = lra_get_regno_hard_regno (regno);
          if (regno < 0)
            return false;
-         COMPL_HARD_REG_SET (alloc_regs, lra_no_alloc_regs);
+         alloc_regs = ~lra_no_alloc_regs;
          return overlaps_hard_reg_set_p (alloc_regs, GET_MODE (x), regno);
        }
       else
index cadad5e..b2c8304 100644 (file)
@@ -4310,7 +4310,7 @@ finish_spills (int global)
             may be not included in the value calculated here because
             of possible removing caller-saves insns (see function
             delete_caller_save_insns.  */
-         COMPL_HARD_REG_SET (chain->used_spill_regs, used_by_pseudos);
+         chain->used_spill_regs = ~used_by_pseudos;
          AND_HARD_REG_SET (chain->used_spill_regs, used_spill_regs);
        }
     }
@@ -6257,7 +6257,7 @@ choose_reload_regs_init (class insn_chain *chain, rtx *save_reload_reg_rtx)
       CLEAR_HARD_REG_SET (reload_reg_used_in_outaddr_addr[i]);
     }
 
-  COMPL_HARD_REG_SET (reload_reg_unavailable, chain->used_spill_regs);
+  reload_reg_unavailable = ~chain->used_spill_regs;
 
   CLEAR_HARD_REG_SET (reload_reg_used_for_inherit);