From 50b3f54d551787e0a066451ef60ef3b055a893e6 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 9 Sep 2019 17:59:10 +0000 Subject: [PATCH] Remove COMPL_HARD_REG_SET "COMPL_HARD_REG_SET (x, y)" becomes "x = ~y". 2019-09-09 Richard Sandiford 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 | 12 ++++++++++++ gcc/config/c6x/c6x.c | 4 ++-- gcc/config/sh/sh.c | 5 +---- gcc/hard-reg-set.h | 23 +++++++++-------------- gcc/lra-assigns.c | 2 +- gcc/lra-constraints.c | 2 +- gcc/reload1.c | 4 ++-- 7 files changed, 28 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a3238884c46..69b742a0c4d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-09-09 Richard Sandiford + + * 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 * hard-reg-set.h (COPY_HARD_REG_SET): Delete. diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index 05b111e3fd8..f6a45184bb5 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -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 = diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index d1af5802840..4b70ac95075 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -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 diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h index 3d6eef22037..ca663e82ae9 100644 --- a/gcc/hard-reg-set.h +++ b/gcc/hard-reg-set.h @@ -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)) @@ -184,13 +186,6 @@ SET_HARD_REG_SET (HARD_REG_SET &set) set.elts[i] = -1; } -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) { diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c index d5268c36ee6..8c07e90e164 100644 --- a/gcc/lra-assigns.c +++ b/gcc/lra-assigns.c @@ -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]; diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 93546129066..c3f0c6ec681 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -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 diff --git a/gcc/reload1.c b/gcc/reload1.c index cadad5e1ddc..b2c83045eed 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -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);