Replace call_used_reg_set with call_used_or_fixed_regs
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 10 Sep 2019 18:56:37 +0000 (18:56 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 10 Sep 2019 18:56:37 +0000 (18:56 +0000)
commita5647ae846f6765f12a359acba6a71fc12254fa8
tree3ca1e4fc718b6a7523af1797005c2a814c34f8d5
parent026116ce2a4dedad81518b0ca89dd8243b545778
Replace call_used_reg_set with call_used_or_fixed_regs

CALL_USED_REGISTERS and call_used_regs infamously contain all fixed
registers (hence the need for CALL_REALLY_USED_REGISTERS etc.).
We try to recover from this to some extent with:

  /* Contains 1 for registers that are set or clobbered by calls.  */
  /* ??? Ideally, this would be just call_used_regs plus global_regs, but
     for someone's bright idea to have call_used_regs strictly include
     fixed_regs.  Which leaves us guessing as to the set of fixed_regs
     that are actually preserved.  We know for sure that those associated
     with the local stack frame are safe, but scant others.  */
  HARD_REG_SET x_regs_invalidated_by_call;

Since global registers are added to fixed_reg_set and call_used_reg_set
too, it's always the case that:

  call_used_reg_set == regs_invalidated_by_call | fixed_reg_set

This patch replaces all uses of call_used_reg_set with a new macro
call_used_or_fixed_regs to make this clearer.

This is part of a series that allows call_used_regs to be what is
now call_really_used_regs.  It's a purely mechanical replacement;
later patches clean up obvious oddities like
"call_used_or_fixed_regs & ~fixed_regs".

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

gcc/
* hard-reg-set.h (target_hard_regs::x_call_used_reg_set): Delete.
(call_used_reg_set): Delete.
(call_used_or_fixed_regs): New macro.
* reginfo.c (init_reg_sets_1, globalize_reg): Remove initialization
of call_used_reg_set.
* caller-save.c (setup_save_areas): Use call_used_or_fixed_regs
instead of call_used_regs.
(save_call_clobbered_regs): Likewise.
* cfgcleanup.c (old_insns_match_p): Likewise.
* config/c6x/c6x.c (c6x_call_saved_register_used): Likewise.
* config/epiphany/epiphany.c (epiphany_conditional_register_usage):
Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests): Likewise.
* config/sh/sh.c (output_stack_adjust): Likewise.
* final.c (collect_fn_hard_reg_usage): Likewise.
* ira-build.c (ira_build): Likewise.
* ira-color.c (calculate_saved_nregs): Likewise.
(allocno_reload_assign, calculate_spill_cost): Likewise.
* ira-conflicts.c (ira_build_conflicts): Likewise.
* ira-costs.c (ira_tune_allocno_costs): Likewise.
* ira-lives.c (process_bb_node_lives): Likewise.
* ira.c (setup_reg_renumber): Likewise.
* lra-assigns.c (find_hard_regno_for_1, lra_assign): Likewise.
* lra-constraints.c (need_for_call_save_p): Likewise.
(need_for_split_p, inherit_in_ebb): Likewise.
* lra-lives.c (process_bb_lives): Likewise.
* lra-remat.c (call_used_input_regno_present_p): Likewise.
* postreload.c (reload_combine): Likewise.
* regrename.c (find_rename_reg): Likewise.
* reload1.c (reload_as_needed): Likewise.
* rtlanal.c (find_all_hard_reg_sets): Likewise.
* sel-sched.c (mark_unavailable_hard_regs): Likewise.
* shrink-wrap.c (requires_stack_frame_p): Likewise.

From-SVN: r275600
26 files changed:
gcc/ChangeLog
gcc/caller-save.c
gcc/cfgcleanup.c
gcc/config/c6x/c6x.c
gcc/config/epiphany/epiphany.c
gcc/config/frv/frv.c
gcc/config/sh/sh.c
gcc/final.c
gcc/hard-reg-set.h
gcc/ira-build.c
gcc/ira-color.c
gcc/ira-conflicts.c
gcc/ira-costs.c
gcc/ira-lives.c
gcc/ira.c
gcc/lra-assigns.c
gcc/lra-constraints.c
gcc/lra-lives.c
gcc/lra-remat.c
gcc/postreload.c
gcc/reginfo.c
gcc/regrename.c
gcc/reload1.c
gcc/rtlanal.c
gcc/sel-sched.c
gcc/shrink-wrap.c