"COMPL_HARD_REG_SET (x, y)" becomes "x = ~y".
2019-09-09 Richard Sandiford <richard.sandif...@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. Index: gcc/hard-reg-set.h =================================================================== --- gcc/hard-reg-set.h 2019-09-09 16:06:17.649228402 +0100 +++ gcc/hard-reg-set.h 2019-09-09 16:06:54.720965449 +0100 @@ -53,6 +53,15 @@ #define HARD_REG_SET_LONGS \ 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 @@ #define HARD_CONST(X) ((HARD_REG_ELT_TYP 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 @@ #define TEST_HARD_REG_BIT(SET, BIT) \ #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: gcc/config/c6x/c6x.c =================================================================== --- gcc/config/c6x/c6x.c 2019-09-09 12:27:14.242372402 +0100 +++ gcc/config/c6x/c6x.c 2019-09-09 16:06:54.720965449 +0100 @@ -1094,7 +1094,7 @@ c6x_call_saved_register_used (tree call_ 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 } /* 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: gcc/config/sh/sh.c =================================================================== --- gcc/config/sh/sh.c 2019-09-09 16:06:17.649228402 +0100 +++ gcc/config/sh/sh.c 2019-09-09 16:06:54.720965449 +0100 @@ -6908,11 +6908,8 @@ push_regs (HARD_REG_SET *mask, bool inte 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: gcc/lra-assigns.c =================================================================== --- gcc/lra-assigns.c 2019-09-09 16:06:17.649228402 +0100 +++ gcc/lra-assigns.c 2019-09-09 16:06:54.724965420 +0100 @@ -496,7 +496,7 @@ find_hard_regno_for_1 (int regno, int *c 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: gcc/lra-constraints.c =================================================================== --- gcc/lra-constraints.c 2019-09-09 16:06:17.653228374 +0100 +++ gcc/lra-constraints.c 2019-09-09 16:06:54.724965420 +0100 @@ -4559,7 +4559,7 @@ contains_reg_p (rtx x, bool hard_reg_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: gcc/reload1.c =================================================================== --- gcc/reload1.c 2019-09-09 16:06:17.653228374 +0100 +++ gcc/reload1.c 2019-09-09 16:06:54.724965420 +0100 @@ -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_chai 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);