diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-09-10 18:56:51 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-09-10 18:56:51 +0000 |
commit | a365fa0636886aeda83e57b84d837cfba13597fe (patch) | |
tree | 4462b290455f16484b4486384ad142798dfc3d3b | |
parent | ff18ad15259c8978f85344934b146ff7b9ee07e1 (diff) | |
download | gcc-a365fa0636886aeda83e57b84d837cfba13597fe.zip gcc-a365fa0636886aeda83e57b84d837cfba13597fe.tar.gz gcc-a365fa0636886aeda83e57b84d837cfba13597fe.tar.bz2 |
Add call_used_or_fixed_reg_p
Similarly to the call_used_or_fixed_regs patch, this one replaces
tests of call_used_regs[i] with call_used_or_fixed_reg_p (i).
The only remaining direct uses of call_used_regs are in reginfo.c
and in the conditional register usage hooks.
Again, this is purely mechanical. A later patch will clear up the
oddities in config/ code.
2019-09-10 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* hard-reg-set.h (call_used_or_fixed_reg_p): New macro.
* cfgloopanal.c (init_set_costs): Use call_used_or_fixed_reg_p
instead of testing call_used_regs directly.
* config/aarch64/aarch64.c (aarch64_layout_frame): Likewise.
(aarch64_components_for_bb): Likewise.
* config/alpha/alpha.c (alpha_compute_frame_layout): Likewise.
* config/arc/arc.c (arc_must_save_register): Likewise.
(arc_epilogue_uses): Likewise.
* config/arm/arm.c (arm_option_override, use_return_insn): Likewise.
(legitimize_pic_address, callee_saved_reg_p): Likewise.
(arm_compute_save_reg0_reg12_mask): Likewise.
(arm_compute_save_core_reg_mask): Likewise.
(arm_get_vfp_saved_size, arm_compute_frame_layout): Likewise.
(arm_save_coproc_regs, thumb1_extra_regs_pushed): Likewise.
(cmse_nonsecure_entry_clear_before_return): Likewise.
(thumb1_expand_epilogue, arm_expand_epilogue_apcs_frame): Likewise.
(arm_expand_epilogue): Likewise.
* config/avr/avr.c (avr_regs_to_save, sequent_regs_live): Likewise.
(avr_function_arg_advance, avr_find_unused_d_reg): Likewise.
(_reg_unused_after): Likewise.
* config/bfin/bfin.c (must_save_p, expand_prologue_reg_save): Likewise.
(expand_epilogue_reg_restore, n_regs_saved_by_prologue): Likewise.
(add_to_reg, hwloop_optimize): Likewise.
* config/bpf/bpf.c (bpf_compute_frame_layout, bpf_expand_prologue)
(bpf_expand_epilogue): Likewise.
* config/c6x/c6x.c (c6x_save_reg, c6x_regno_reg_class): Likewise.
* config/cr16/cr16.c (cr16_compute_save_regs): Likewise.
* config/cris/cris.c (cris_reg_saved_in_regsave_area): Likewise.
* config/epiphany/epiphany.c (epiphany_init_reg_tables): Likewise.
(epiphany_compute_function_type, MUST_SAVE_REGISTER): Likewise.
(epiphany_output_mi_thunk, epiphany_start_function): Likewise.
* config/fr30/fr30.c (fr30_num_arg_regs): Likewise.
* config/frv/frv.c (frv_stack_info): Likewise.
* config/ft32/ft32.c (ft32_compute_frame): Likewise.
(ft32_expand_prologue, ft32_expand_epilogue): Likewise.
* config/gcn/gcn.c (gcn_compute_frame_offsets): Likewise.
(move_callee_saved_registers): Likewise.
* config/h8300/h8300.c (byte_reg): Likewise.
* config/i386/i386-options.c (ix86_set_current_function): Likewise.
* config/i386/i386.c (ix86_save_reg, ix86_expand_prologue): Likewise.
(ix86_expand_epilogue, x86_order_regs_for_local_alloc): Likewise.
* config/i386/predicates.md (sibcall_memory_operand): Likewise.
* config/ia64/ia64.c (emit_safe_across_calls, find_gr_spill): Likewise.
(next_scratch_gr_reg, ia64_compute_frame_size): Likewise.
* config/iq2000/iq2000.h (MUST_SAVE_REGISTER): Likewise.
* config/lm32/lm32.c (lm32_compute_frame_size): Likewise.
* config/m32c/m32c.c (need_to_save): Likewise.
* config/m68k/m68k.c (m68k_save_reg): Likewise.
* config/mcore/mcore.c (calc_live_regs): Likewise.
* config/microblaze/microblaze.c (microblaze_must_save_register):
Likewise.
* config/mmix/mmix.c (mmix_local_regno): Likewise.
(mmix_initial_elimination_offset, mmix_reorg): Likewise.
(mmix_use_simple_return, mmix_expand_prologue): Likewise.
(mmix_expand_epilogue): Likewise.
* config/moxie/moxie.c (moxie_compute_frame): Likewise.
(moxie_expand_prologue, moxie_expand_epilogue): Likewise.
* config/msp430/msp430.c (msp430_preserve_reg_p): Likewise.
* config/nds32/nds32.h (nds32_16bit_address_type): Likewise.
(NDS32_REQUIRED_CALLEE_SAVED_P): Likewise.
* config/nios2/nios2.c (prologue_saved_reg_p): Likewise.
* config/or1k/or1k.c (callee_saved_regno_p): Likewise.
* config/pa/pa.c (pa_expand_prologue, pa_expand_epilogue): Likewise.
* config/pdp11/pdp11.c (pdp11_saved_regno): Likewise.
* config/pru/pru.c (prologue_saved_reg_p): Likewise.
* config/riscv/riscv.c (riscv_save_reg_p): Likewise.
(riscv_epilogue_uses, riscv_hard_regno_mode_ok): Likewise.
* config/rl78/rl78.c (need_to_save): Likewise.
* config/rs6000/rs6000-logue.c (save_reg_p): Likewise.
(rs6000_stack_info, generate_set_vrsave): Likewise.
(rs6000_emit_prologue, rs6000_emit_epilogue): Likewise.
* config/rs6000/rs6000.c (rs6000_debug_reg_print): Likewise.
* config/rx/rx.c (rx_get_stack_layout): Likewise.
* config/s390/s390.c (s390_call_saved_register_used): Likewise.
* config/sh/sh.c (calc_live_regs, sh_output_mi_thunk): Likewise.
* config/sparc/sparc.c (save_global_or_fp_reg_p): Likewise.
(save_local_or_in_reg_p): Likewise.
* config/stormy16/stormy16.c (REG_NEEDS_SAVE): Likewise.
(xstormy16_epilogue_uses): Likewise.
* config/tilegx/tilegx.c (need_to_save_reg): Likewise.
* config/tilepro/tilepro.c (need_to_save_reg): Likewise.
* config/v850/v850.c (compute_register_save_size): Likewise.
* config/vax/vax.c (vax_expand_prologue): Likewise.
* config/visium/visium.c (visium_save_reg_p): Likewise.
* config/xtensa/xtensa.c (xtensa_call_save_reg): Likewise.
* cselib.c (cselib_process_insn): Likewise.
* df-scan.c (df_get_entry_block_def_set): Likewise.
* function.c (aggregate_value_p): Likewise.
* haifa-sched.c (alloc_global_sched_pressure_data): Likewise.
* ira-lives.c (process_bb_node_lives): Likewise.
* ira.c (do_reload): Likewise.
* lra-lives.c (process_bb_lives): Likewise.
* lra-remat.c (lra_remat): Likewise.
* lra.c (lra): Likewise.
* postreload.c (reload_combine_recognize_pattern): Likewise.
(reload_cse_move2add): Likewise.
* recog.c (peep2_find_free_register): Likewise.
* regrename.c (check_new_reg_p): Likewise.
* reload.c (find_equiv_reg): Likewise.
* reload1.c (reload, find_reg): Likewise.
* sel-sched.c (init_hard_regs_data): Likewise.
From-SVN: r275602
68 files changed, 306 insertions, 173 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 33f34c3..099652b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,109 @@ 2019-09-10 Richard Sandiford <richard.sandiford@arm.com> + * hard-reg-set.h (call_used_or_fixed_reg_p): New macro. + * cfgloopanal.c (init_set_costs): Use call_used_or_fixed_reg_p + instead of testing call_used_regs directly. + * config/aarch64/aarch64.c (aarch64_layout_frame): Likewise. + (aarch64_components_for_bb): Likewise. + * config/alpha/alpha.c (alpha_compute_frame_layout): Likewise. + * config/arc/arc.c (arc_must_save_register): Likewise. + (arc_epilogue_uses): Likewise. + * config/arm/arm.c (arm_option_override, use_return_insn): Likewise. + (legitimize_pic_address, callee_saved_reg_p): Likewise. + (arm_compute_save_reg0_reg12_mask): Likewise. + (arm_compute_save_core_reg_mask): Likewise. + (arm_get_vfp_saved_size, arm_compute_frame_layout): Likewise. + (arm_save_coproc_regs, thumb1_extra_regs_pushed): Likewise. + (cmse_nonsecure_entry_clear_before_return): Likewise. + (thumb1_expand_epilogue, arm_expand_epilogue_apcs_frame): Likewise. + (arm_expand_epilogue): Likewise. + * config/avr/avr.c (avr_regs_to_save, sequent_regs_live): Likewise. + (avr_function_arg_advance, avr_find_unused_d_reg): Likewise. + (_reg_unused_after): Likewise. + * config/bfin/bfin.c (must_save_p, expand_prologue_reg_save): Likewise. + (expand_epilogue_reg_restore, n_regs_saved_by_prologue): Likewise. + (add_to_reg, hwloop_optimize): Likewise. + * config/bpf/bpf.c (bpf_compute_frame_layout, bpf_expand_prologue) + (bpf_expand_epilogue): Likewise. + * config/c6x/c6x.c (c6x_save_reg, c6x_regno_reg_class): Likewise. + * config/cr16/cr16.c (cr16_compute_save_regs): Likewise. + * config/cris/cris.c (cris_reg_saved_in_regsave_area): Likewise. + * config/epiphany/epiphany.c (epiphany_init_reg_tables): Likewise. + (epiphany_compute_function_type, MUST_SAVE_REGISTER): Likewise. + (epiphany_output_mi_thunk, epiphany_start_function): Likewise. + * config/fr30/fr30.c (fr30_num_arg_regs): Likewise. + * config/frv/frv.c (frv_stack_info): Likewise. + * config/ft32/ft32.c (ft32_compute_frame): Likewise. + (ft32_expand_prologue, ft32_expand_epilogue): Likewise. + * config/gcn/gcn.c (gcn_compute_frame_offsets): Likewise. + (move_callee_saved_registers): Likewise. + * config/h8300/h8300.c (byte_reg): Likewise. + * config/i386/i386-options.c (ix86_set_current_function): Likewise. + * config/i386/i386.c (ix86_save_reg, ix86_expand_prologue): Likewise. + (ix86_expand_epilogue, x86_order_regs_for_local_alloc): Likewise. + * config/i386/predicates.md (sibcall_memory_operand): Likewise. + * config/ia64/ia64.c (emit_safe_across_calls, find_gr_spill): Likewise. + (next_scratch_gr_reg, ia64_compute_frame_size): Likewise. + * config/iq2000/iq2000.h (MUST_SAVE_REGISTER): Likewise. + * config/lm32/lm32.c (lm32_compute_frame_size): Likewise. + * config/m32c/m32c.c (need_to_save): Likewise. + * config/m68k/m68k.c (m68k_save_reg): Likewise. + * config/mcore/mcore.c (calc_live_regs): Likewise. + * config/microblaze/microblaze.c (microblaze_must_save_register): + Likewise. + * config/mmix/mmix.c (mmix_local_regno): Likewise. + (mmix_initial_elimination_offset, mmix_reorg): Likewise. + (mmix_use_simple_return, mmix_expand_prologue): Likewise. + (mmix_expand_epilogue): Likewise. + * config/moxie/moxie.c (moxie_compute_frame): Likewise. + (moxie_expand_prologue, moxie_expand_epilogue): Likewise. + * config/msp430/msp430.c (msp430_preserve_reg_p): Likewise. + * config/nds32/nds32.h (nds32_16bit_address_type): Likewise. + (NDS32_REQUIRED_CALLEE_SAVED_P): Likewise. + * config/nios2/nios2.c (prologue_saved_reg_p): Likewise. + * config/or1k/or1k.c (callee_saved_regno_p): Likewise. + * config/pa/pa.c (pa_expand_prologue, pa_expand_epilogue): Likewise. + * config/pdp11/pdp11.c (pdp11_saved_regno): Likewise. + * config/pru/pru.c (prologue_saved_reg_p): Likewise. + * config/riscv/riscv.c (riscv_save_reg_p): Likewise. + (riscv_epilogue_uses, riscv_hard_regno_mode_ok): Likewise. + * config/rl78/rl78.c (need_to_save): Likewise. + * config/rs6000/rs6000-logue.c (save_reg_p): Likewise. + (rs6000_stack_info, generate_set_vrsave): Likewise. + (rs6000_emit_prologue, rs6000_emit_epilogue): Likewise. + * config/rs6000/rs6000.c (rs6000_debug_reg_print): Likewise. + * config/rx/rx.c (rx_get_stack_layout): Likewise. + * config/s390/s390.c (s390_call_saved_register_used): Likewise. + * config/sh/sh.c (calc_live_regs, sh_output_mi_thunk): Likewise. + * config/sparc/sparc.c (save_global_or_fp_reg_p): Likewise. + (save_local_or_in_reg_p): Likewise. + * config/stormy16/stormy16.c (REG_NEEDS_SAVE): Likewise. + (xstormy16_epilogue_uses): Likewise. + * config/tilegx/tilegx.c (need_to_save_reg): Likewise. + * config/tilepro/tilepro.c (need_to_save_reg): Likewise. + * config/v850/v850.c (compute_register_save_size): Likewise. + * config/vax/vax.c (vax_expand_prologue): Likewise. + * config/visium/visium.c (visium_save_reg_p): Likewise. + * config/xtensa/xtensa.c (xtensa_call_save_reg): Likewise. + * cselib.c (cselib_process_insn): Likewise. + * df-scan.c (df_get_entry_block_def_set): Likewise. + * function.c (aggregate_value_p): Likewise. + * haifa-sched.c (alloc_global_sched_pressure_data): Likewise. + * ira-lives.c (process_bb_node_lives): Likewise. + * ira.c (do_reload): Likewise. + * lra-lives.c (process_bb_lives): Likewise. + * lra-remat.c (lra_remat): Likewise. + * lra.c (lra): Likewise. + * postreload.c (reload_combine_recognize_pattern): Likewise. + (reload_cse_move2add): Likewise. + * recog.c (peep2_find_free_register): Likewise. + * regrename.c (check_new_reg_p): Likewise. + * reload.c (find_equiv_reg): Likewise. + * reload1.c (reload, find_reg): Likewise. + * sel-sched.c (init_hard_regs_data): Likewise. + +2019-09-10 Richard Sandiford <richard.sandiford@arm.com> + * config/frv/frv.c (frv_ifcvt_modify_tests): Use regs_invalidated_by_call & ~fixed_reg_set instead of call_used_or_fixed_regs & ~fixed_reg_set. diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c index 10037f0..0ebecc3 100644 --- a/gcc/cfgloopanal.c +++ b/gcc/cfgloopanal.c @@ -353,7 +353,7 @@ init_set_costs (void) && !fixed_regs[i]) { target_avail_regs++; - if (call_used_regs[i]) + if (call_used_or_fixed_reg_p (i)) target_clobbered_regs++; } diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 01b138d..ed04060 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5336,12 +5336,12 @@ aarch64_layout_frame (void) for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++) if (df_regs_ever_live_p (regno) && (regno == R30_REGNUM - || !call_used_regs[regno])) + || !call_used_or_fixed_reg_p (regno))) cfun->machine->frame.reg_offset[regno] = SLOT_REQUIRED; for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) if (df_regs_ever_live_p (regno) - && (!call_used_regs[regno] + && (!call_used_or_fixed_reg_p (regno) || (simd_function && FP_SIMD_SAVED_REGNUM_P (regno)))) { cfun->machine->frame.reg_offset[regno] = SLOT_REQUIRED; @@ -5938,7 +5938,7 @@ aarch64_components_for_bb (basic_block bb) /* GPRs are used in a bb if they are in the IN, GEN, or KILL sets. */ for (unsigned regno = 0; regno <= LAST_SAVED_REGNUM; regno++) - if ((!call_used_regs[regno] + if ((!call_used_or_fixed_reg_p (regno) || (simd_function && FP_SIMD_SAVED_REGNUM_P (regno))) && (bitmap_bit_p (in, regno) || bitmap_bit_p (gen, regno) diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index fd6b5a8..5c07b95 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -7225,7 +7225,7 @@ alpha_compute_frame_layout (void) /* One for every register we have to save. */ for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (! fixed_regs[i] && ! call_used_regs[i] + if (! fixed_regs[i] && ! call_used_or_fixed_reg_p (i) && df_regs_ever_live_p (i) && i != REG_RA) sa_mask |= HOST_WIDE_INT_1U << i; @@ -7285,7 +7285,7 @@ alpha_compute_frame_layout (void) vms_save_fp_regno = -1; if (vms_base_regno == HARD_FRAME_POINTER_REGNUM) for (unsigned i = 0; i < 32; i++) - if (! fixed_regs[i] && call_used_regs[i] + if (! fixed_regs[i] && call_used_or_fixed_reg_p (i) && ! df_regs_ever_live_p (i)) { vms_save_fp_regno = i; diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index d603406..0b5d3fd 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -2735,7 +2735,7 @@ arc_must_save_register (int regno, struct function *func, bool special_p) break; } - if (((df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if (((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) /* In an interrupt save everything. */ || (ARC_INTERRUPT_P (fn_type) && (df_regs_ever_live_p (RETURN_ADDR_REGNUM) @@ -10331,7 +10331,7 @@ arc_epilogue_uses (int regno) if (epilogue_completed && ARC_INTERRUPT_P (fn_type)) { /* An interrupt function restores more registers. */ - if (df_regs_ever_live_p (regno) || call_used_regs[regno]) + if (df_regs_ever_live_p (regno) || call_used_or_fixed_reg_p (regno)) return true; } diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index c452771..db7de5e 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -3475,7 +3475,7 @@ arm_option_override (void) warning (0, "%<-mpic-register=%> is useless without %<-fpic%>"); /* Prevent the user from choosing an obviously stupid PIC register. */ - else if (pic_register < 0 || call_used_regs[pic_register] + else if (pic_register < 0 || call_used_or_fixed_reg_p (pic_register) || pic_register == HARD_FRAME_POINTER_REGNUM || pic_register == STACK_POINTER_REGNUM || pic_register >= PC_REGNUM @@ -4155,7 +4155,7 @@ use_return_insn (int iscond, rtx sibling) { /* Validate that r3 is a call-clobbered register (always true in the default abi) ... */ - if (!call_used_regs[3]) + if (!call_used_or_fixed_reg_p (3)) return 0; /* ... that it isn't being used for a return value ... */ @@ -4211,12 +4211,12 @@ use_return_insn (int iscond, rtx sibling) since this also requires an insn. */ if (TARGET_HARD_FLOAT) for (regno = FIRST_VFP_REGNUM; regno <= LAST_VFP_REGNUM; regno++) - if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) return 0; if (TARGET_REALLY_IWMMXT) for (regno = FIRST_IWMMXT_REGNUM; regno <= LAST_IWMMXT_REGNUM; regno++) - if (df_regs_ever_live_p (regno) && ! call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && ! call_used_or_fixed_reg_p (regno)) return 0; return 1; @@ -7735,7 +7735,7 @@ legitimize_pic_address (rtx orig, machine_mode mode, rtx reg, rtx pic_reg, registers are marked as caller saved when optimizing for size on Thumb-1 targets despite being callee saved in order to avoid using them. */ #define callee_saved_reg_p(reg) \ - (!call_used_regs[reg] \ + (!call_used_or_fixed_reg_p (reg) \ || (TARGET_THUMB1 && optimize_size \ && reg >= FIRST_HI_REGNUM && reg <= LAST_HI_REGNUM)) @@ -19721,7 +19721,7 @@ arm_compute_save_reg0_reg12_mask (void) for (reg = 0; reg <= max_reg; reg++) if (df_regs_ever_live_p (reg) - || (! crtl->is_leaf && call_used_regs[reg])) + || (! crtl->is_leaf && call_used_or_fixed_reg_p (reg))) save_reg_mask |= (1 << reg); /* Also save the pic base register if necessary. */ @@ -19900,7 +19900,7 @@ arm_compute_save_core_reg_mask (void) && (save_reg_mask & THUMB2_WORK_REGS) == 0) { reg = thumb_find_work_register (1 << 4); - if (!call_used_regs[reg]) + if (!call_used_or_fixed_reg_p (reg)) save_reg_mask |= (1 << reg); } @@ -20008,8 +20008,10 @@ arm_get_vfp_saved_size (void) regno < LAST_VFP_REGNUM; regno += 2) { - if ((!df_regs_ever_live_p (regno) || call_used_regs[regno]) - && (!df_regs_ever_live_p (regno + 1) || call_used_regs[regno + 1])) + if ((!df_regs_ever_live_p (regno) + || call_used_or_fixed_reg_p (regno)) + && (!df_regs_ever_live_p (regno + 1) + || call_used_or_fixed_reg_p (regno + 1))) { if (count > 0) { @@ -21530,7 +21532,8 @@ arm_compute_frame_layout (void) for (regno = FIRST_IWMMXT_REGNUM; regno <= LAST_IWMMXT_REGNUM; regno++) - if (df_regs_ever_live_p (regno) && ! call_used_regs[regno]) + if (df_regs_ever_live_p (regno) + && !call_used_or_fixed_reg_p (regno)) saved += 8; } @@ -21747,7 +21750,7 @@ arm_save_coproc_regs(void) rtx insn; for (reg = LAST_IWMMXT_REGNUM; reg >= FIRST_IWMMXT_REGNUM; reg--) - if (df_regs_ever_live_p (reg) && ! call_used_regs[reg]) + if (df_regs_ever_live_p (reg) && !call_used_or_fixed_reg_p (reg)) { insn = gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx); insn = gen_rtx_MEM (V2SImode, insn); @@ -21762,8 +21765,9 @@ arm_save_coproc_regs(void) for (reg = FIRST_VFP_REGNUM; reg < LAST_VFP_REGNUM; reg += 2) { - if ((!df_regs_ever_live_p (reg) || call_used_regs[reg]) - && (!df_regs_ever_live_p (reg + 1) || call_used_regs[reg + 1])) + if ((!df_regs_ever_live_p (reg) || call_used_or_fixed_reg_p (reg)) + && (!df_regs_ever_live_p (reg + 1) + || call_used_or_fixed_reg_p (reg + 1))) { if (start_reg != reg) saved_size += vfp_emit_fstmd (start_reg, @@ -25137,7 +25141,7 @@ thumb1_extra_regs_pushed (arm_stack_offsets *offsets, bool for_prologue) } while (reg_base + n_free < 8 && !(live_regs_mask & 1) - && (for_prologue || call_used_regs[reg_base + n_free])) + && (for_prologue || call_used_or_fixed_reg_p (reg_base + n_free))) { live_regs_mask >>= 1; n_free++; @@ -25821,7 +25825,7 @@ cmse_nonsecure_entry_clear_before_return (void) continue; if (IN_RANGE (regno, IP_REGNUM, PC_REGNUM)) continue; - if (call_used_regs[regno]) + if (call_used_or_fixed_reg_p (regno)) bitmap_set_bit (to_clear_bitmap, regno); } @@ -25973,7 +25977,7 @@ thumb1_expand_epilogue (void) /* Emit a clobber for each insn that will be restored in the epilogue, so that flow2 will get register lifetimes correct. */ for (regno = 0; regno < 13; regno++) - if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) emit_clobber (gen_rtx_REG (SImode, regno)); if (! df_regs_ever_live_p (LR_REGNUM)) @@ -26039,9 +26043,9 @@ arm_expand_epilogue_apcs_frame (bool really_return) for (i = FIRST_VFP_REGNUM; i < LAST_VFP_REGNUM; i += 2) /* Look for a case where a reg does not need restoring. */ - if ((!df_regs_ever_live_p (i) || call_used_regs[i]) + if ((!df_regs_ever_live_p (i) || call_used_or_fixed_reg_p (i)) && (!df_regs_ever_live_p (i + 1) - || call_used_regs[i + 1])) + || call_used_or_fixed_reg_p (i + 1))) { if (start_reg != i) arm_emit_vfp_multi_reg_pop (start_reg, @@ -26068,7 +26072,7 @@ arm_expand_epilogue_apcs_frame (bool really_return) int lrm_count = (num_regs % 2) ? (num_regs + 2) : (num_regs + 1); for (i = LAST_IWMMXT_REGNUM; i >= FIRST_IWMMXT_REGNUM; i--) - if (df_regs_ever_live_p (i) && !call_used_regs[i]) + if (df_regs_ever_live_p (i) && !call_used_or_fixed_reg_p (i)) { rtx addr = gen_frame_mem (V2SImode, plus_constant (Pmode, hard_frame_pointer_rtx, @@ -26273,9 +26277,9 @@ arm_expand_epilogue (bool really_return) unlike pop, vldm can only do consecutive regs. */ for (i = LAST_VFP_REGNUM - 1; i >= FIRST_VFP_REGNUM; i -= 2) /* Look for a case where a reg does not need restoring. */ - if ((!df_regs_ever_live_p (i) || call_used_regs[i]) + if ((!df_regs_ever_live_p (i) || call_used_or_fixed_reg_p (i)) && (!df_regs_ever_live_p (i + 1) - || call_used_regs[i + 1])) + || call_used_or_fixed_reg_p (i + 1))) { /* Restore the regs discovered so far (from reg+2 to end_reg). */ @@ -26297,7 +26301,7 @@ arm_expand_epilogue (bool really_return) if (TARGET_IWMMXT) for (i = FIRST_IWMMXT_REGNUM; i <= LAST_IWMMXT_REGNUM; i++) - if (df_regs_ever_live_p (i) && !call_used_regs[i]) + if (df_regs_ever_live_p (i) && !call_used_or_fixed_reg_p (i)) { rtx_insn *insn; rtx addr = gen_rtx_MEM (V2SImode, diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 6a5271d..04fc00f 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -1183,9 +1183,9 @@ avr_regs_to_save (HARD_REG_SET *set) if (fixed_regs[reg]) continue; - if ((int_or_sig_p && !crtl->is_leaf && call_used_regs[reg]) + if ((int_or_sig_p && !crtl->is_leaf && call_used_or_fixed_reg_p (reg)) || (df_regs_ever_live_p (reg) - && (int_or_sig_p || !call_used_regs[reg]) + && (int_or_sig_p || !call_used_or_fixed_reg_p (reg)) /* Don't record frame pointer registers here. They are treated indivitually in prologue. */ && !(frame_pointer_needed @@ -1367,7 +1367,7 @@ sequent_regs_live (void) continue; } - if (!call_used_regs[reg]) + if (!call_used_or_fixed_reg_p (reg)) { if (df_regs_ever_live_p (reg)) { @@ -3421,7 +3421,7 @@ avr_function_arg_advance (cumulative_args_t cum_v, if (cum->regno >= 8 && cum->nregs >= 0 - && !call_used_regs[cum->regno]) + && !call_used_or_fixed_reg_p (cum->regno)) { /* FIXME: We ship info on failing tail-call in struct machine_function. This uses internals of calls.c:expand_call() and the way args_so_far @@ -3568,7 +3568,7 @@ avr_find_unused_d_reg (rtx_insn *insn, rtx exclude) && (TREE_THIS_VOLATILE (current_function_decl) || cfun->machine->is_OS_task || cfun->machine->is_OS_main - || (!isr_p && call_used_regs[regno]))) + || (!isr_p && call_used_or_fixed_reg_p (regno)))) { return reg; } @@ -9552,7 +9552,7 @@ _reg_unused_after (rtx_insn *insn, rtx reg) && REG_P (XEXP (XEXP (tem, 0), 0)) && reg_overlap_mentioned_p (reg, XEXP (XEXP (tem, 0), 0))) return 0; - if (call_used_regs[REGNO (reg)]) + if (call_used_or_fixed_reg_p (REGNO (reg))) return 1; } diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 49f18b6..fbe4c10 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -235,13 +235,13 @@ must_save_p (bool is_inthandler, unsigned regno) return (is_eh_return_reg || (df_regs_ever_live_p (regno) && !fixed_regs[regno] - && (is_inthandler || !call_used_regs[regno]))); + && (is_inthandler || !call_used_or_fixed_reg_p (regno)))); } else if (P_REGNO_P (regno)) { return ((df_regs_ever_live_p (regno) && !fixed_regs[regno] - && (is_inthandler || !call_used_regs[regno])) + && (is_inthandler || !call_used_or_fixed_reg_p (regno))) || (is_inthandler && (ENABLE_WA_05000283 || ENABLE_WA_05000315) && regno == REG_P5) @@ -251,9 +251,9 @@ must_save_p (bool is_inthandler, unsigned regno) || (TARGET_ID_SHARED_LIBRARY && !crtl->is_leaf)))); } else - return ((is_inthandler || !call_used_regs[regno]) + return ((is_inthandler || !call_used_or_fixed_reg_p (regno)) && (df_regs_ever_live_p (regno) - || (!leaf_function_p () && call_used_regs[regno]))); + || (!leaf_function_p () && call_used_or_fixed_reg_p (regno)))); } @@ -419,7 +419,7 @@ expand_prologue_reg_save (rtx spreg, int saveall, bool is_inthandler) if (saveall || (is_inthandler && (df_regs_ever_live_p (i) - || (!leaf_function_p () && call_used_regs[i])))) + || (!leaf_function_p () && call_used_or_fixed_reg_p (i))))) { rtx_insn *insn; if (i == REG_A0 || i == REG_A1) @@ -458,7 +458,7 @@ expand_epilogue_reg_restore (rtx spreg, bool saveall, bool is_inthandler) if (saveall || (is_inthandler && (df_regs_ever_live_p (i) - || (!leaf_function_p () && call_used_regs[i])))) + || (!leaf_function_p () && call_used_or_fixed_reg_p (i))))) { if (i == REG_A0 || i == REG_A1) { @@ -652,7 +652,7 @@ n_regs_saved_by_prologue (void) if (all || (fkind != SUBROUTINE && (df_regs_ever_live_p (i) - || (!leaf_function_p () && call_used_regs[i])))) + || (!leaf_function_p () && call_used_or_fixed_reg_p (i))))) n += i == REG_A0 || i == REG_A1 ? 2 : 1; return n; @@ -753,7 +753,7 @@ add_to_reg (rtx reg, HOST_WIDE_INT value, int frame, int epilogue_p) { int i; for (i = REG_P0; i <= REG_P5; i++) - if ((df_regs_ever_live_p (i) && ! call_used_regs[i]) + if ((df_regs_ever_live_p (i) && ! call_used_or_fixed_reg_p (i)) || (!TARGET_FDPIC && i == PIC_OFFSET_TABLE_REGNUM && (crtl->uses_pic_offset_table @@ -3482,7 +3482,7 @@ hwloop_optimize (hwloop_info loop) for (i = REG_P0; i <= REG_P5; i++) if ((df_regs_ever_live_p (i) || (funkind (TREE_TYPE (current_function_decl)) == SUBROUTINE - && call_used_regs[i])) + && call_used_or_fixed_reg_p (i))) && !REGNO_REG_SET_P (df_get_live_out (bb_in), i)) { scratchreg = gen_rtx_REG (SImode, i); diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c index 8b2a592..6e57b00 100644 --- a/gcc/config/bpf/bpf.c +++ b/gcc/config/bpf/bpf.c @@ -273,7 +273,7 @@ bpf_compute_frame_layout (void) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if ((!fixed_regs[regno] && df_regs_ever_live_p (regno) - && !call_used_regs[regno]) + && !call_used_or_fixed_reg_p (regno)) || (cfun->calls_alloca && regno == STACK_POINTER_REGNUM)) cfun->machine->callee_saved_reg_size += 8; @@ -314,7 +314,7 @@ bpf_expand_prologue (void) { if ((!fixed_regs[regno] && df_regs_ever_live_p (regno) - && !call_used_regs[regno]) + && !call_used_or_fixed_reg_p (regno)) || (cfun->calls_alloca && regno == STACK_POINTER_REGNUM)) { @@ -374,7 +374,7 @@ bpf_expand_epilogue (void) { if ((!fixed_regs[regno] && df_regs_ever_live_p (regno) - && !call_used_regs[regno]) + && !call_used_or_fixed_reg_p (regno)) || (cfun->calls_alloca && regno == STACK_POINTER_REGNUM)) { diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index f7f0dbc..7d1c2f7 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -2532,7 +2532,7 @@ static int c6x_save_reg (unsigned int regno) { return ((df_regs_ever_live_p (regno) - && !call_used_regs[regno] + && !call_used_or_fixed_reg_p (regno) && !fixed_regs[regno]) || (regno == RETURN_ADDR_REGNO && (df_regs_ever_live_p (regno) @@ -6694,7 +6694,7 @@ c6x_regno_reg_class (int reg) if (A_REGNO_P (reg)) return NONPREDICATE_A_REGS; - if (call_used_regs[reg]) + if (call_used_or_fixed_reg_p (reg)) return CALL_USED_B_REGS; return B_REGS; diff --git a/gcc/config/cr16/cr16.c b/gcc/config/cr16/cr16.c index c95d5d1..aaac797 100644 --- a/gcc/config/cr16/cr16.c +++ b/gcc/config/cr16/cr16.c @@ -367,7 +367,7 @@ cr16_compute_save_regs (void) /* If this reg is used and not call-used (except RA), save it. */ if (cr16_interrupt_function_p ()) { - if (!crtl->is_leaf && call_used_regs[regno]) + if (!crtl->is_leaf && call_used_or_fixed_reg_p (regno)) /* This is a volatile reg in a non-leaf interrupt routine - save it for the sake of its sons. */ current_frame_info.save_regs[regno] = 1; @@ -382,7 +382,8 @@ cr16_compute_save_regs (void) { /* If this reg is used and not call-used (except RA), save it. */ if (df_regs_ever_live_p (regno) - && (!call_used_regs[regno] || regno == RETURN_ADDRESS_REGNUM)) + && (!call_used_or_fixed_reg_p (regno) + || regno == RETURN_ADDRESS_REGNUM)) current_frame_info.save_regs[regno] = 1; else current_frame_info.save_regs[regno] = 0; diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index fff641e9..9f9bc51 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -716,13 +716,13 @@ cris_reg_saved_in_regsave_area (unsigned int regno, bool got_really_used) { return (((df_regs_ever_live_p (regno) - && !call_used_regs[regno]) + && !call_used_or_fixed_reg_p (regno)) || (regno == PIC_OFFSET_TABLE_REGNUM && (got_really_used /* It is saved anyway, if there would be a gap. */ || (flag_pic && df_regs_ever_live_p (regno + 1) - && !call_used_regs[regno + 1])))) + && !call_used_or_fixed_reg_p (regno + 1))))) && (regno != FRAME_POINTER_REGNUM || !frame_pointer_needed) && regno != CRIS_SRP_REGNUM) || (crtl->calls_eh_return diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c index d8b1cee..12cb4b4 100644 --- a/gcc/config/epiphany/epiphany.c +++ b/gcc/config/epiphany/epiphany.c @@ -434,7 +434,7 @@ epiphany_init_reg_tables (void) epiphany_regno_reg_class[i] = LR_REGS; else if (i <= 7 && TARGET_PREFER_SHORT_INSN_REGS) epiphany_regno_reg_class[i] = SHORT_INSN_REGS; - else if (call_used_regs[i] + else if (call_used_or_fixed_reg_p (i) && TEST_HARD_REG_BIT (reg_class_contents[GENERAL_REGS], i)) epiphany_regno_reg_class[i] = SIBCALL_REGS; else if (i >= CORE_CONTROL_FIRST && i <= CORE_CONTROL_LAST) @@ -1066,8 +1066,8 @@ epiphany_compute_function_type (tree decl) #define MUST_SAVE_REGISTER(regno, interrupt_p) \ ((df_regs_ever_live_p (regno) \ || (interrupt_p && !crtl->is_leaf \ - && call_used_regs[regno] && !fixed_regs[regno])) \ - && (!call_used_regs[regno] || regno == GPR_LR \ + && call_used_or_fixed_reg_p (regno) && !fixed_regs[regno])) \ + && (!call_used_or_fixed_reg_p (regno) || regno == GPR_LR \ || (interrupt_p && regno != GPR_SP))) #define MUST_SAVE_RETURN_ADDR 0 @@ -2892,8 +2892,8 @@ epiphany_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, assemble_start_function (thunk, fnname); /* We use IP and R16 as a scratch registers. */ - gcc_assert (call_used_regs [GPR_IP]); - gcc_assert (call_used_regs [GPR_16]); + gcc_assert (call_used_or_fixed_reg_p (GPR_IP)); + gcc_assert (call_used_or_fixed_reg_p (GPR_16)); /* Add DELTA. When possible use a plain add, otherwise load it into a register first. */ @@ -2999,7 +2999,7 @@ epiphany_start_function (FILE *file, const char *name, tree decl) fputs ("\tstrd r0,[sp,-1]\n", file); else tmp = GPR_16; - gcc_assert (call_used_regs[tmp]); + gcc_assert (call_used_or_fixed_reg_p (tmp)); fprintf (file, "\tmov r%d,%%low(", tmp); assemble_name (file, dst_name); fprintf (file, ")\n" diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index 675198f..d765c4b 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -141,7 +141,7 @@ static int fr30_num_arg_regs (const function_arg_info &); ( (regno) != RETURN_POINTER_REGNUM \ && (regno) != FRAME_POINTER_REGNUM \ && df_regs_ever_live_p (regno) \ - && ! call_used_regs [regno] ) + && ! call_used_or_fixed_reg_p (regno)) #define MUST_SAVE_FRAME_POINTER (df_regs_ever_live_p (FRAME_POINTER_REGNUM) || frame_pointer_needed) #define MUST_SAVE_RETURN_POINTER (df_regs_ever_live_p (RETURN_POINTER_REGNUM) || crtl->profile) diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 936c532..223415e 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -1101,7 +1101,8 @@ frv_stack_info (void) default: for (regno = first; regno <= last; regno++) { - if ((df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if ((df_regs_ever_live_p (regno) + && !call_used_or_fixed_reg_p (regno)) || (crtl->calls_eh_return && (regno >= FIRST_EH_REGNUM && regno <= LAST_EH_REGNUM)) || (!TARGET_FDPIC && flag_pic diff --git a/gcc/config/ft32/ft32.c b/gcc/config/ft32/ft32.c index e9eb4d4..3361df1 100644 --- a/gcc/config/ft32/ft32.c +++ b/gcc/config/ft32/ft32.c @@ -411,7 +411,7 @@ ft32_compute_frame (void) /* Save callee-saved registers. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if (df_regs_ever_live_p (regno) && (!call_used_regs[regno])) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) cfun->machine->callee_saved_reg_size += 4; cfun->machine->size_for_adjusting_sp = @@ -475,7 +475,7 @@ ft32_expand_prologue (void) { for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0;) { - if (!fixed_regs[regno] && !call_used_regs[regno] + if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) { rtx preg = gen_rtx_REG (Pmode, regno); @@ -489,7 +489,7 @@ ft32_expand_prologue (void) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) { if (!fixed_regs[regno] && df_regs_ever_live_p (regno) - && !call_used_regs[regno]) + && !call_used_or_fixed_reg_p (regno)) { insn = emit_insn (gen_movsi_push (gen_rtx_REG (Pmode, regno))); RTX_FRAME_RELATED_P (insn) = 1; @@ -554,7 +554,7 @@ ft32_expand_epilogue (void) { for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0;) { - if (!fixed_regs[regno] && !call_used_regs[regno] + if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) { rtx preg = gen_rtx_REG (Pmode, regno); diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 473f6ed..50ae8e1 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -2540,7 +2540,7 @@ gcn_compute_frame_offsets (void) offsets->callee_saves = offsets->lr_needs_saving ? 8 : 0; for (int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if ((df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if ((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || ((regno & ~1) == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed)) offsets->callee_saves += (VGPR_REGNO_P (regno) ? 256 : 4); @@ -2572,7 +2572,7 @@ move_callee_saved_registers (rtx sp, machine_function *offsets, /* Move scalars into two vector registers. */ for (regno = 0, saved_scalars = 0; regno < FIRST_VGPR_REG; regno++) - if ((df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if ((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || ((regno & ~1) == LINK_REGNUM && offsets->lr_needs_saving) || ((regno & ~1) == HARD_FRAME_POINTER_REGNUM && offsets->need_frame_pointer)) @@ -2618,7 +2618,7 @@ move_callee_saved_registers (rtx sp, machine_function *offsets, /* Move vectors. */ for (regno = FIRST_VGPR_REG, offset = offsets->pretend_size; regno < FIRST_PSEUDO_REGISTER; regno++) - if ((df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if ((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || (regno == VGPR_REGNO (6) && saved_scalars > 0) || (regno == VGPR_REGNO (7) && saved_scalars > 63)) { diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index c51b32d..87529c3 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -485,7 +485,8 @@ byte_reg (rtx x, int b) && ! TREE_THIS_VOLATILE (current_function_decl) \ && (h8300_saveall_function_p (current_function_decl) \ /* Save any call saved register that was used. */ \ - || (df_regs_ever_live_p (regno) && !call_used_regs[regno]) \ + || (df_regs_ever_live_p (regno) \ + && !call_used_or_fixed_reg_p (regno)) \ /* Save the frame pointer if it was used. */ \ || (regno == HARD_FRAME_POINTER_REGNUM && df_regs_ever_live_p (regno)) \ /* Save any register used in an interrupt handler. */ \ @@ -494,7 +495,7 @@ byte_reg (rtx x, int b) /* Save call clobbered registers in non-leaf interrupt \ handlers. */ \ || (h8300_current_function_interrupt_function_p () \ - && call_used_regs[regno] \ + && call_used_or_fixed_reg_p (regno) \ && !crtl->is_leaf))) /* We use this to wrap all emitted insns in the prologue. */ diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c index 703e44e..c148aa2 100644 --- a/gcc/config/i386/i386-options.c +++ b/gcc/config/i386/i386-options.c @@ -3076,7 +3076,7 @@ ix86_set_current_function (tree fndecl) Avoid expensive re-initialization of init_regs each time we switch function context. */ if (TARGET_64BIT - && (call_used_regs[SI_REG] + && (call_used_or_fixed_reg_p (SI_REG) == (cfun->machine->call_abi == MS_ABI))) reinit_regs (); /* Need to re-initialize init_regs if caller-saved registers are diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5e68a87..7525b9d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -5665,7 +5665,7 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return, bool ignore_outlined) return true; return (df_regs_ever_live_p (regno) - && !call_used_regs[regno] + && !call_used_or_fixed_reg_p (regno) && !fixed_regs[regno] && (regno != HARD_FRAME_POINTER_REGNUM || !frame_pointer_needed)); } @@ -7837,7 +7837,7 @@ ix86_expand_prologue (void) "around by avoiding functions with aggregate return."); /* Only need to push parameter pointer reg if it is caller saved. */ - if (!call_used_regs[REGNO (crtl->drap_reg)]) + if (!call_used_or_fixed_reg_p (REGNO (crtl->drap_reg))) { /* Push arg pointer reg */ insn = emit_insn (gen_push (crtl->drap_reg)); @@ -8012,7 +8012,7 @@ ix86_expand_prologue (void) if (ix86_static_chain_on_stack) stack_size += UNITS_PER_WORD; - if (!call_used_regs[REGNO (crtl->drap_reg)]) + if (!call_used_or_fixed_reg_p (REGNO (crtl->drap_reg))) stack_size += UNITS_PER_WORD; /* This over-estimates by 1 minimal-stack-alignment-unit but @@ -8903,7 +8903,7 @@ ix86_expand_epilogue (int style) if (ix86_static_chain_on_stack) param_ptr_offset += UNITS_PER_WORD; - if (!call_used_regs[REGNO (crtl->drap_reg)]) + if (!call_used_or_fixed_reg_p (REGNO (crtl->drap_reg))) param_ptr_offset += UNITS_PER_WORD; insn = emit_insn (gen_rtx_SET @@ -8921,7 +8921,7 @@ ix86_expand_epilogue (int style) GEN_INT (param_ptr_offset))); RTX_FRAME_RELATED_P (insn) = 1; - if (!call_used_regs[REGNO (crtl->drap_reg)]) + if (!call_used_or_fixed_reg_p (REGNO (crtl->drap_reg))) ix86_emit_restore_reg_using_pop (crtl->drap_reg); } @@ -19643,12 +19643,12 @@ x86_order_regs_for_local_alloc (void) /* First allocate the local general purpose registers. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (GENERAL_REGNO_P (i) && call_used_regs[i]) + if (GENERAL_REGNO_P (i) && call_used_or_fixed_reg_p (i)) reg_alloc_order [pos++] = i; /* Global general purpose registers. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (GENERAL_REGNO_P (i) && !call_used_regs[i]) + if (GENERAL_REGNO_P (i) && !call_used_or_fixed_reg_p (i)) reg_alloc_order [pos++] = i; /* x87 registers come first in case we are doing FP math diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 5e8f671..72f8e7e 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -690,7 +690,7 @@ if (GET_CODE (op) == PLUS && REG_P (XEXP (op, 0))) { int regno = REGNO (XEXP (op, 0)); - if (!HARD_REGISTER_NUM_P (regno) || call_used_regs[regno]) + if (!HARD_REGISTER_NUM_P (regno) || call_used_or_fixed_reg_p (regno)) { op = XEXP (op, 1); if (GOT32_symbol_operand (op, VOIDmode)) diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index ca69656..ff2ad20 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -2523,11 +2523,12 @@ emit_safe_across_calls (void) out_state = 0; while (1) { - while (rs < 64 && call_used_regs[PR_REG (rs)]) + while (rs < 64 && call_used_or_fixed_reg_p (PR_REG (rs))) rs++; if (rs >= 64) break; - for (re = rs + 1; re < 64 && ! call_used_regs[PR_REG (re)]; re++) + for (re = rs + 1; + re < 64 && ! call_used_or_fixed_reg_p (PR_REG (re)); re++) continue; if (out_state == 0) { @@ -2593,7 +2594,7 @@ find_gr_spill (enum ia64_frame_regs r, int try_locals) { for (regno = GR_REG (1); regno <= GR_REG (31); regno++) if (! df_regs_ever_live_p (regno) - && call_used_regs[regno] + && call_used_or_fixed_reg_p (regno) && ! fixed_regs[regno] && ! global_regs[regno] && ((current_frame_info.gr_used_mask >> regno) & 1) == 0 @@ -2641,7 +2642,7 @@ next_scratch_gr_reg (void) for (i = 0; i < 32; ++i) { regno = (last_scratch_gr_reg + i + 1) & 31; - if (call_used_regs[regno] + if (call_used_or_fixed_reg_p (regno) && ! fixed_regs[regno] && ! global_regs[regno] && ((current_frame_info.gr_used_mask >> regno) & 1) == 0) @@ -2762,7 +2763,7 @@ ia64_compute_frame_size (HOST_WIDE_INT size) which will always wind up on the stack. */ for (regno = FR_REG (2); regno <= FR_REG (127); regno++) - if (df_regs_ever_live_p (regno) && ! call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && ! call_used_or_fixed_reg_p (regno)) { SET_HARD_REG_BIT (mask, regno); spill_size += 16; @@ -2771,7 +2772,7 @@ ia64_compute_frame_size (HOST_WIDE_INT size) } for (regno = GR_REG (1); regno <= GR_REG (31); regno++) - if (df_regs_ever_live_p (regno) && ! call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && ! call_used_or_fixed_reg_p (regno)) { SET_HARD_REG_BIT (mask, regno); spill_size += 8; @@ -2780,7 +2781,7 @@ ia64_compute_frame_size (HOST_WIDE_INT size) } for (regno = BR_REG (1); regno <= BR_REG (7); regno++) - if (df_regs_ever_live_p (regno) && ! call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && ! call_used_or_fixed_reg_p (regno)) { SET_HARD_REG_BIT (mask, regno); spill_size += 8; @@ -2840,7 +2841,8 @@ ia64_compute_frame_size (HOST_WIDE_INT size) } else { - if (df_regs_ever_live_p (BR_REG (0)) && ! call_used_regs[BR_REG (0)]) + if (df_regs_ever_live_p (BR_REG (0)) + && ! call_used_or_fixed_reg_p (BR_REG (0))) { SET_HARD_REG_BIT (mask, BR_REG (0)); extra_spill_size += 8; @@ -2894,7 +2896,7 @@ ia64_compute_frame_size (HOST_WIDE_INT size) /* See if we need to store the predicate register block. */ for (regno = PR_REG (0); regno <= PR_REG (63); regno++) - if (df_regs_ever_live_p (regno) && ! call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && ! call_used_or_fixed_reg_p (regno)) break; if (regno <= PR_REG (63)) { diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h index 89efdaf..163a6d3 100644 --- a/gcc/config/iq2000/iq2000.h +++ b/gcc/config/iq2000/iq2000.h @@ -687,7 +687,7 @@ enum delay_type /* Tell prologue and epilogue if register REGNO should be saved / restored. */ #define MUST_SAVE_REGISTER(regno) \ - ((df_regs_ever_live_p (regno) && !call_used_regs[regno]) \ + ((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) \ || (regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed) \ || (regno == (GP_REG_FIRST + 31) && df_regs_ever_live_p (GP_REG_FIRST + 31))) diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c index 267ff27..67706a4 100644 --- a/gcc/config/lm32/lm32.c +++ b/gcc/config/lm32/lm32.c @@ -457,7 +457,7 @@ lm32_compute_frame_size (int size) and calculate size required to store them in the stack. */ for (regno = 1; regno < SP_REGNUM; regno++) { - if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) { reg_save_mask |= 1 << regno; callee_size += UNITS_PER_WORD; diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index b60044f..d8dc63e 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -1114,7 +1114,7 @@ need_to_save (int regno) )) return 1; if (df_regs_ever_live_p (regno) - && (!call_used_regs[regno] || cfun->machine->is_interrupt)) + && (!call_used_or_fixed_reg_p (regno) || cfun->machine->is_interrupt)) return 1; return 0; } diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index fd69511..1030dfa 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -944,7 +944,7 @@ m68k_save_reg (unsigned int regno, bool interrupt_handler) if (df_regs_ever_live_p (regno)) return true; - if (!crtl->is_leaf && call_used_regs[regno]) + if (!crtl->is_leaf && call_used_or_fixed_reg_p (regno)) return true; } @@ -953,7 +953,7 @@ m68k_save_reg (unsigned int regno, bool interrupt_handler) return false; /* Otherwise save everything that isn't call-clobbered. */ - return !call_used_regs[regno]; + return !call_used_or_fixed_reg_p (regno); } /* Emit RTL for a MOVEM or FMOVEM instruction. BASE + OFFSET represents diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index b259da5..a419d42 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -316,7 +316,7 @@ calc_live_regs (int * count) for (reg = 0; reg < FIRST_PSEUDO_REGISTER; reg++) { - if (df_regs_ever_live_p (reg) && !call_used_regs[reg]) + if (df_regs_ever_live_p (reg) && !call_used_or_fixed_reg_p (reg)) { (*count)++; live_regs_mask |= (1 << reg); diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index 3d0f593..6705168 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -2012,7 +2012,7 @@ microblaze_must_save_register (int regno) (regno == MB_ABI_PIC_ADDR_REGNUM) && df_regs_ever_live_p (regno)) return 1; - if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) return 1; if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM)) diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 8ebb829..b8d379d 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -464,7 +464,8 @@ mmix_opposite_regno (int regno, int incoming) int mmix_local_regno (int regno) { - return regno <= MMIX_LAST_STACK_REGISTER_REGNUM && !call_used_regs[regno]; + return (regno <= MMIX_LAST_STACK_REGISTER_REGNUM + && !call_used_or_fixed_reg_p (regno)); } /* TARGET_PREFERRED_RELOAD_CLASS. @@ -604,7 +605,7 @@ mmix_initial_elimination_offset (int fromreg, int toreg) for (regno = MMIX_FIRST_GLOBAL_REGNUM; regno <= 255; regno++) - if ((df_regs_ever_live_p (regno) && ! call_used_regs[regno]) + if ((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || IS_MMIX_EH_RETURN_DATA_REG (regno)) fp_sp_offset += 8; @@ -866,7 +867,7 @@ mmix_reorg (void) for (regno = MMIX_LAST_STACK_REGISTER_REGNUM; regno >= 0; regno--) - if ((df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if ((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || (regno == MMIX_FRAME_POINTER_REGNUM && frame_pointer_needed)) break; @@ -1958,7 +1959,7 @@ mmix_use_simple_return (void) /* Note that we assume that the frame-pointer-register is one of these registers, in which case we don't count it here. */ if ((((regno != MMIX_FRAME_POINTER_REGNUM || !frame_pointer_needed) - && df_regs_ever_live_p (regno) && !call_used_regs[regno])) + && df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno))) || IS_MMIX_EH_RETURN_DATA_REG (regno)) return 0; @@ -1994,7 +1995,7 @@ mmix_expand_prologue (void) /* Note that we assume that the frame-pointer-register is one of these registers, in which case we don't count it here. */ if ((((regno != MMIX_FRAME_POINTER_REGNUM || !frame_pointer_needed) - && df_regs_ever_live_p (regno) && !call_used_regs[regno])) + && df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno))) || IS_MMIX_EH_RETURN_DATA_REG (regno)) stack_space_to_allocate += 8; @@ -2180,7 +2181,7 @@ mmix_expand_prologue (void) regno >= MMIX_FIRST_GLOBAL_REGNUM; regno--) if (((regno != MMIX_FRAME_POINTER_REGNUM || !frame_pointer_needed) - && df_regs_ever_live_p (regno) && ! call_used_regs[regno]) + && df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || IS_MMIX_EH_RETURN_DATA_REG (regno)) { rtx insn; @@ -2233,7 +2234,7 @@ mmix_expand_epilogue (void) regno >= MMIX_FIRST_GLOBAL_REGNUM; regno--) if (((regno != MMIX_FRAME_POINTER_REGNUM || !frame_pointer_needed) - && df_regs_ever_live_p (regno) && !call_used_regs[regno]) + && df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || IS_MMIX_EH_RETURN_DATA_REG (regno)) stack_space_to_deallocate += 8; @@ -2262,7 +2263,7 @@ mmix_expand_epilogue (void) regno <= 255; regno++) if (((regno != MMIX_FRAME_POINTER_REGNUM || !frame_pointer_needed) - && df_regs_ever_live_p (regno) && !call_used_regs[regno]) + && df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || IS_MMIX_EH_RETURN_DATA_REG (regno)) { if (offset > 255) diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c index d840463..aa5948e 100644 --- a/gcc/config/moxie/moxie.c +++ b/gcc/config/moxie/moxie.c @@ -264,7 +264,7 @@ moxie_compute_frame (void) /* Save callee-saved registers. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if (df_regs_ever_live_p (regno) && (! call_used_regs[regno])) + if (df_regs_ever_live_p (regno) && (! call_used_or_fixed_reg_p (regno))) cfun->machine->callee_saved_reg_size += 4; cfun->machine->size_for_adjusting_sp = @@ -288,7 +288,9 @@ moxie_expand_prologue (void) /* Save callee-saved registers. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) { - if (!fixed_regs[regno] && df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if (!fixed_regs[regno] + && df_regs_ever_live_p (regno) + && !call_used_or_fixed_reg_p (regno)) { insn = emit_insn (gen_movsi_push (gen_rtx_REG (Pmode, regno))); RTX_FRAME_RELATED_P (insn) = 1; @@ -349,7 +351,7 @@ moxie_expand_epilogue (void) emit_insn (gen_addsi3 (reg, reg, hard_frame_pointer_rtx)); } for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0; ) - if (!fixed_regs[regno] && !call_used_regs[regno] + if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) { rtx preg = gen_rtx_REG (Pmode, regno); diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 521d9ba..6430823 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -1152,7 +1152,7 @@ msp430_preserve_reg_p (int regno) return true; } - if (!call_used_regs[regno] + if (!call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) return true; diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h index 6e62258..64cc455 100644 --- a/gcc/config/nds32/nds32.h +++ b/gcc/config/nds32/nds32.h @@ -226,7 +226,7 @@ enum nds32_16bit_address_type As long as the register satisfies both criteria above, it is required to be saved. */ #define NDS32_REQUIRED_CALLEE_SAVED_P(regno) \ - ((!call_used_regs[regno]) && (df_regs_ever_live_p (regno))) + (!call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) /* This macro is to check if the push25/pop25 are available to be used for code generation. Because pop25 also performs return behavior, diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c index 6167803..4cea0f4 100644 --- a/gcc/config/nios2/nios2.c +++ b/gcc/config/nios2/nios2.c @@ -1080,7 +1080,7 @@ prologue_saved_reg_p (unsigned regno) { gcc_assert (GP_REG_P (regno)); - if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) return true; if (regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed) diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c index 34b9d6f..eff83b9 100644 --- a/gcc/config/or1k/or1k.c +++ b/gcc/config/or1k/or1k.c @@ -100,7 +100,7 @@ static bool callee_saved_regno_p (int regno) { /* Check call-saved registers. */ - if (!call_used_regs[regno] && df_regs_ever_live_p (regno)) + if (!call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) return true; switch (regno) diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 9366b106..80a0ea0 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -4053,7 +4053,7 @@ pa_expand_prologue (void) } for (i = 18; i >= 4; i--) - if (df_regs_ever_live_p (i) && ! call_used_regs[i]) + if (df_regs_ever_live_p (i) && !call_used_or_fixed_reg_p (i)) { store_reg (i, offset, HARD_FRAME_POINTER_REGNUM); offset += UNITS_PER_WORD; @@ -4093,7 +4093,7 @@ pa_expand_prologue (void) } for (i = 18; i >= 3; i--) - if (df_regs_ever_live_p (i) && ! call_used_regs[i]) + if (df_regs_ever_live_p (i) && !call_used_or_fixed_reg_p (i)) { /* If merge_sp_adjust_with_store is nonzero, then we can optimize the first GR save. */ @@ -4394,7 +4394,7 @@ pa_expand_epilogue (void) } for (i = 18; i >= 4; i--) - if (df_regs_ever_live_p (i) && ! call_used_regs[i]) + if (df_regs_ever_live_p (i) && !call_used_or_fixed_reg_p (i)) { load_reg (i, offset, HARD_FRAME_POINTER_REGNUM); offset += UNITS_PER_WORD; @@ -4431,7 +4431,7 @@ pa_expand_epilogue (void) for (i = 18; i >= 3; i--) { - if (df_regs_ever_live_p (i) && ! call_used_regs[i]) + if (df_regs_ever_live_p (i) && !call_used_or_fixed_reg_p (i)) { /* Only for the first load. merge_sp_adjust_with_load holds the register load diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 2d3b94b..d7c6809 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -313,7 +313,7 @@ static bool pdp11_scalar_mode_supported_p (scalar_mode); static inline bool pdp11_saved_regno (unsigned regno) { - return !call_used_regs[regno] && df_regs_ever_live_p (regno); + return !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno); } /* Expand the function prologue. */ diff --git a/gcc/config/pru/pru.c b/gcc/config/pru/pru.c index 579d3d4..416399e 100644 --- a/gcc/config/pru/pru.c +++ b/gcc/config/pru/pru.c @@ -443,7 +443,7 @@ prologue_saved_reg_p (int regno) { gcc_assert (GP_REG_P (regno)); - if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) return true; /* 32-bit FP. */ diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index 9b16a1e..39bf87a 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -3442,7 +3442,7 @@ riscv_frame_set (rtx mem, rtx reg) static bool riscv_save_reg_p (unsigned int regno) { - bool call_saved = !global_regs[regno] && !call_used_regs[regno]; + bool call_saved = !global_regs[regno] && !call_used_or_fixed_reg_p (regno); bool might_clobber = crtl->saves_all_registers || df_regs_ever_live_p (regno); @@ -3473,7 +3473,7 @@ riscv_save_reg_p (unsigned int regno) /* We must save every register used in this function. If this is not a leaf function, then we must save all temporary registers. */ if (df_regs_ever_live_p (regno) - || (!crtl->is_leaf && call_used_regs[regno])) + || (!crtl->is_leaf && call_used_or_fixed_reg_p (regno))) return true; } @@ -4198,7 +4198,7 @@ riscv_epilogue_uses (unsigned int regno) /* An interrupt function restores temp regs, so we must indicate that they are live at function end. */ if (df_regs_ever_live_p (regno) - || (!crtl->is_leaf && call_used_regs[regno])) + || (!crtl->is_leaf && call_used_or_fixed_reg_p (regno))) return true; } @@ -4361,7 +4361,7 @@ riscv_hard_regno_mode_ok (unsigned int regno, machine_mode mode) /* Only use callee-saved registers if a potential callee is guaranteed to spill the requisite width. */ if (GET_MODE_UNIT_SIZE (mode) > UNITS_PER_FP_REG - || (!call_used_regs[regno] + || (!call_used_or_fixed_reg_p (regno) && GET_MODE_UNIT_SIZE (mode) > UNITS_PER_FP_ARG)) return false; } @@ -4370,7 +4370,8 @@ riscv_hard_regno_mode_ok (unsigned int regno, machine_mode mode) /* Require same callee-savedness for all registers. */ for (unsigned i = 1; i < nregs; i++) - if (call_used_regs[regno] != call_used_regs[regno + i]) + if (call_used_or_fixed_reg_p (regno) + != call_used_or_fixed_reg_p (regno + i)) return false; return true; diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c index 1c5d1e1..f132b47 100644 --- a/gcc/config/rl78/rl78.c +++ b/gcc/config/rl78/rl78.c @@ -723,7 +723,7 @@ need_to_save (unsigned int regno) any call_used registers, so we have to preserve them. We do not have to worry about the frame pointer register though, as that is handled below. */ - if (!crtl->is_leaf && call_used_regs[regno] && regno < 22) + if (!crtl->is_leaf && call_used_or_fixed_reg_p (regno) && regno < 22) return true; /* Otherwise we only have to save a register, call_used @@ -739,7 +739,7 @@ need_to_save (unsigned int regno) if (crtl->calls_eh_return) return true; if (df_regs_ever_live_p (regno) - && !call_used_regs[regno]) + && !call_used_or_fixed_reg_p (regno)) return true; return false; } diff --git a/gcc/config/rs6000/rs6000-logue.c b/gcc/config/rs6000/rs6000-logue.c index ebfe533..633a253 100644 --- a/gcc/config/rs6000/rs6000-logue.c +++ b/gcc/config/rs6000/rs6000-logue.c @@ -117,7 +117,7 @@ save_reg_p (int reg) return true; } - return !call_used_regs[reg] && df_regs_ever_live_p (reg); + return !call_used_or_fixed_reg_p (reg) && df_regs_ever_live_p (reg); } /* Return the first fixed-point register that is required to be @@ -875,7 +875,7 @@ rs6000_stack_info (void) using_static_chain_p = (cfun->static_chain_decl != NULL_TREE && df_regs_ever_live_p (STATIC_CHAIN_REGNUM) - && call_used_regs[STATIC_CHAIN_REGNUM]); + && call_used_or_fixed_reg_p (STATIC_CHAIN_REGNUM)); info->savres_strategy = rs6000_savres_strategy (info, using_static_chain_p); if (!(info->savres_strategy & SAVE_INLINE_GPRS) @@ -2082,7 +2082,7 @@ generate_set_vrsave (rtx reg, rs6000_stack_t *info, int epiloguep) for (i = FIRST_ALTIVEC_REGNO; i <= LAST_ALTIVEC_REGNO; ++i) if (info->vrsave_mask & ALTIVEC_REG_BIT (i)) { - if (!epiloguep || call_used_regs [i]) + if (!epiloguep || call_used_or_fixed_reg_p (i)) clobs[nclobs++] = gen_hard_reg_clobber (V4SImode, i); else { @@ -2971,9 +2971,10 @@ rs6000_emit_prologue (void) rtx cr_save_rtx = NULL_RTX; rtx_insn *insn; int strategy; - int using_static_chain_p = (cfun->static_chain_decl != NULL_TREE - && df_regs_ever_live_p (STATIC_CHAIN_REGNUM) - && call_used_regs[STATIC_CHAIN_REGNUM]); + int using_static_chain_p + = (cfun->static_chain_decl != NULL_TREE + && df_regs_ever_live_p (STATIC_CHAIN_REGNUM) + && call_used_or_fixed_reg_p (STATIC_CHAIN_REGNUM)); int using_split_stack = (flag_split_stack && (lookup_attribute ("no_split_stack", DECL_ATTRIBUTES (cfun->decl)) @@ -3571,7 +3572,7 @@ rs6000_emit_prologue (void) emit_insn (gen_prologue_movesi_from_cr (crsave)); for (i = 0; i < 8; i++) - if (!call_used_regs[CR0_REGNO + i]) + if (!call_used_or_fixed_reg_p (CR0_REGNO + i)) { rtvec p = rtvec_alloc (2); RTVEC_ELT (p, 0) @@ -4704,7 +4705,7 @@ rs6000_emit_epilogue (enum epilogue_type epilogue_type) int i, cr_off = info->ehcr_offset; for (i = 0; i < 8; i++) - if (!call_used_regs[CR0_REGNO + i]) + if (!call_used_or_fixed_reg_p (CR0_REGNO + i)) { rtx reg = gen_rtx_REG (SImode, 0); emit_insn (gen_frame_load (reg, frame_reg_rtx, diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 03349e8..f657ff3 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1990,7 +1990,7 @@ rs6000_debug_reg_print (int first_regno, int last_regno, const char *reg_name) comma = ", "; } - if (call_used_regs[r]) + if (call_used_or_fixed_reg_p (r)) { if (len > 70) { diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index a1fc22b..c7ce19c 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -1483,10 +1483,10 @@ rx_get_stack_layout (unsigned int * lowest, /* Always save all call clobbered registers inside non-leaf interrupt handlers, even if they are not live - they may be used in (non-interrupt aware) routines called from this one. */ - || (call_used_regs[reg] + || (call_used_or_fixed_reg_p (reg) && is_interrupt_func (NULL_TREE) && ! crtl->is_leaf)) - && (! call_used_regs[reg] + && (! call_used_or_fixed_reg_p (reg) /* Even call clobbered registered must be pushed inside interrupt handlers. */ || is_interrupt_func (NULL_TREE) diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 2c6b598..93e77d1 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -13341,7 +13341,7 @@ s390_call_saved_register_used (tree call_expr) if (REG_P (parm_rtx)) { for (reg = 0; reg < REG_NREGS (parm_rtx); reg++) - if (!call_used_regs[reg + REGNO (parm_rtx)]) + if (!call_used_or_fixed_reg_p (reg + REGNO (parm_rtx))) return true; } @@ -13356,7 +13356,7 @@ s390_call_saved_register_used (tree call_expr) gcc_assert (REG_P (r)); for (reg = 0; reg < REG_NREGS (r); reg++) - if (!call_used_regs[reg + REGNO (r)]) + if (!call_used_or_fixed_reg_p (reg + REGNO (r))) return true; } } diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index ab3a78f..ef60b8c 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -7055,7 +7055,8 @@ calc_live_regs (HARD_REG_SET *live_regs_mask) || (df_regs_ever_live_p (reg) && ((!call_really_used_regs[reg] && !(reg != PIC_OFFSET_TABLE_REGNUM - && fixed_regs[reg] && call_used_regs[reg])) + && fixed_regs[reg] + && call_used_or_fixed_reg_p (reg))) || (trapa_handler && reg == FPSCR_REG && TARGET_FPU_ANY))) || (crtl->calls_eh_return && (reg == EH_RETURN_DATA_REGNO (0) @@ -10815,16 +10816,16 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, registers are used for argument passing, are callee-saved, or reserved. */ /* We need to check call_used_regs / fixed_regs in case -fcall_saved-reg / -ffixed-reg has been used. */ - if (! call_used_regs[0] || fixed_regs[0]) + if (! call_used_or_fixed_reg_p (0) || fixed_regs[0]) error ("r0 needs to be available as a call-clobbered register"); scratch0 = scratch1 = scratch2 = gen_rtx_REG (Pmode, 0); { - if (call_used_regs[1] && ! fixed_regs[1]) + if (call_used_or_fixed_reg_p (1) && ! fixed_regs[1]) scratch1 = gen_rtx_REG (ptr_mode, 1); /* N.B., if not TARGET_HITACHI, register 2 is used to pass the pointer pointing where to return struct values. */ - if (call_used_regs[3] && ! fixed_regs[3]) + if (call_used_or_fixed_reg_p (3) && ! fixed_regs[3]) scratch2 = gen_rtx_REG (Pmode, 3); } diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 32767bc..43c6dd5 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -5446,7 +5446,7 @@ static inline bool save_global_or_fp_reg_p (unsigned int regno, int leaf_function ATTRIBUTE_UNUSED) { - return !call_used_regs[regno] && df_regs_ever_live_p (regno); + return !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno); } /* Return whether the return address register (%i7) is needed. */ @@ -5474,7 +5474,7 @@ static bool save_local_or_in_reg_p (unsigned int regno, int leaf_function) { /* General case: call-saved registers live at some point. */ - if (!call_used_regs[regno] && df_regs_ever_live_p (regno)) + if (!call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) return true; /* Frame pointer register (%fp) if needed. */ diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 23f546a..b2d4146 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -926,8 +926,8 @@ struct xstormy16_stack_layout /* Does REGNO need to be saved? */ #define REG_NEEDS_SAVE(REGNUM, IFUN) \ - ((df_regs_ever_live_p (REGNUM) && ! call_used_regs[REGNUM]) \ - || (IFUN && ! fixed_regs[REGNUM] && call_used_regs[REGNUM] \ + ((df_regs_ever_live_p (REGNUM) && !call_used_or_fixed_reg_p (REGNUM)) \ + || (IFUN && !fixed_regs[REGNUM] && call_used_or_fixed_reg_p (REGNUM) \ && (REGNUM != CARRY_REGNUM) \ && (df_regs_ever_live_p (REGNUM) || ! crtl->is_leaf))) @@ -1191,7 +1191,7 @@ xstormy16_expand_epilogue (void) int xstormy16_epilogue_uses (int regno) { - if (reload_completed && call_used_regs[regno]) + if (reload_completed && call_used_or_fixed_reg_p (regno)) { const int ifun = xstormy16_interrupt_function_p (); return REG_NEEDS_SAVE (regno, ifun); diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c index 4f29655..66a0ba5 100644 --- a/gcc/config/tilegx/tilegx.c +++ b/gcc/config/tilegx/tilegx.c @@ -3660,7 +3660,7 @@ tilegx_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) static bool need_to_save_reg (unsigned int regno) { - if (!fixed_regs[regno] && !call_used_regs[regno] + if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) return true; diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c index 2e14b2e..ff01428 100644 --- a/gcc/config/tilepro/tilepro.c +++ b/gcc/config/tilepro/tilepro.c @@ -3202,7 +3202,7 @@ tilepro_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) static bool need_to_save_reg (unsigned int regno) { - if (!fixed_regs[regno] && !call_used_regs[regno] + if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) return true; diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index d5c9ba7..9a367ab 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -1461,7 +1461,7 @@ compute_register_save_size (long * p_reg_saved) { /* Find the first register that needs to be saved. */ for (i = 0; i <= 31; i++) - if (df_regs_ever_live_p (i) && ((! call_used_regs[i]) + if (df_regs_ever_live_p (i) && ((! call_used_or_fixed_reg_p (i)) || i == LINK_POINTER_REGNUM)) break; @@ -1502,7 +1502,7 @@ compute_register_save_size (long * p_reg_saved) else { for (; i <= 31; i++) - if (df_regs_ever_live_p (i) && ((! call_used_regs[i]) + if (df_regs_ever_live_p (i) && ((! call_used_or_fixed_reg_p (i)) || i == LINK_POINTER_REGNUM)) { size += 4; diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 1c220ff..7a8c86d 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -166,7 +166,7 @@ vax_expand_prologue (void) rtx insn; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) mask |= 1 << regno; insn = emit_insn (gen_procedure_entry_mask (GEN_INT (mask))); diff --git a/gcc/config/visium/visium.c b/gcc/config/visium/visium.c index b51c23f..367e1e5 100644 --- a/gcc/config/visium/visium.c +++ b/gcc/config/visium/visium.c @@ -3589,7 +3589,7 @@ visium_save_reg_p (int interrupt, int regno) if (df_regs_ever_live_p (regno)) return 1; } - else if (call_used_regs[regno]) + else if (call_used_or_fixed_reg_p (regno)) return 1; /* To save mdb requires two temporary registers. To save mdc or @@ -3616,7 +3616,7 @@ visium_save_reg_p (int interrupt, int regno) } } - return df_regs_ever_live_p (regno) && !call_used_regs[regno]; + return df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno); } /* Compute the frame size required by the function. This function is called diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 98f30c5..822c215 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -2686,7 +2686,7 @@ xtensa_call_save_reg(int regno) if (crtl->calls_eh_return && regno >= 2 && regno < 4) return true; - return !fixed_regs[regno] && !call_used_regs[regno] && + return !fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno); } diff --git a/gcc/cselib.c b/gcc/cselib.c index 87b3d33..109cc27 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -2766,7 +2766,7 @@ cselib_process_insn (rtx_insn *insn) if (CALL_P (insn)) { for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (call_used_regs[i] + if (call_used_or_fixed_reg_p (i) || (REG_VALUES (i) && REG_VALUES (i)->elt && (targetm.hard_regno_call_part_clobbered (insn, i, GET_MODE (REG_VALUES (i)->elt->val_rtx))))) diff --git a/gcc/df-scan.c b/gcc/df-scan.c index d7bc2d8..9b08bdc 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -3500,7 +3500,7 @@ df_get_entry_block_def_set (bitmap entry_block_defs) /* Defs for the callee saved registers are inserted so that the pushes have some defining location. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if ((call_used_regs[i] == 0) && (df_regs_ever_live_p (i))) + if ((call_used_or_fixed_reg_p (i) == 0) && (df_regs_ever_live_p (i))) bitmap_set_bit (entry_block_defs, i); } diff --git a/gcc/function.c b/gcc/function.c index 33e3f3e..e60b6fa 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2122,7 +2122,7 @@ aggregate_value_p (const_tree exp, const_tree fntype) regno = REGNO (reg); nregs = hard_regno_nregs (regno, TYPE_MODE (type)); for (i = 0; i < nregs; i++) - if (! call_used_regs[regno + i]) + if (! call_used_or_fixed_reg_p (regno + i)) return 1; return 0; diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 5025aae..dba3acf 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -7207,7 +7207,7 @@ alloc_global_sched_pressure_data (void) fixed_regs_num[cl] = 0; for (int i = 0; i < ira_class_hard_regs_num[cl]; ++i) - if (!call_used_regs[ira_class_hard_regs[cl][i]]) + if (!call_used_or_fixed_reg_p (ira_class_hard_regs[cl][i])) ++call_saved_regs_num[cl]; else if (fixed_regs[ira_class_hard_regs[cl][i]]) ++fixed_regs_num[cl]; diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h index 33ac640..8fd787a 100644 --- a/gcc/hard-reg-set.h +++ b/gcc/hard-reg-set.h @@ -511,4 +511,13 @@ extern const char * reg_class_names[]; #define REG_CAN_CHANGE_MODE_P(REGN, FROM, TO) \ (targetm.can_change_mode_class (FROM, TO, REGNO_REG_CLASS (REGN))) +/* Return true if register REGNO is either fixed or call-used + (aka call-clobbered). */ + +inline bool +call_used_or_fixed_reg_p (unsigned int regno) +{ + return fixed_regs[regno] || call_used_regs[regno]; +} + #endif /* ! GCC_HARD_REG_SET_H */ diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c index eb7eb0f..166bd7b 100644 --- a/gcc/ira-lives.c +++ b/gcc/ira-lives.c @@ -1380,7 +1380,7 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node) if (!cfun->has_nonlocal_label && has_abnormal_call_or_eh_pred_edge_p (bb)) for (px = 0; px < FIRST_PSEUDO_REGISTER; px++) - if (call_used_regs[px] + if (call_used_or_fixed_reg_p (px) #ifdef REAL_PIC_OFFSET_TABLE_REGNUM /* We should create a conflict of PIC pseudo with PIC hard reg as PIC hard reg can have a wrong @@ -5589,7 +5589,9 @@ do_reload (void) poly_int64 size = get_frame_size () + STACK_CHECK_FIXED_FRAME_SIZE; for (int i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (df_regs_ever_live_p (i) && !fixed_regs[i] && call_used_regs[i]) + if (df_regs_ever_live_p (i) + && !fixed_regs[i] + && call_used_or_fixed_reg_p (i)) size += UNITS_PER_WORD; if (constant_lower_bound (size) > STACK_CHECK_MAX_FRAME_SIZE) diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c index e509cc3..6f08159 100644 --- a/gcc/lra-lives.c +++ b/gcc/lra-lives.c @@ -1106,7 +1106,7 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p) if (!cfun->has_nonlocal_label && has_abnormal_call_or_eh_pred_edge_p (bb)) for (px = 0; HARD_REGISTER_NUM_P (px); px++) - if (call_used_regs[px] + if (call_used_or_fixed_reg_p (px) #ifdef REAL_PIC_OFFSET_TABLE_REGNUM /* We should create a conflict of PIC pseudo with PIC hard reg as PIC hard reg can have a wrong value after diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c index 18c0a6a..ea6e817 100644 --- a/gcc/lra-remat.c +++ b/gcc/lra-remat.c @@ -1309,7 +1309,7 @@ lra_remat (void) all_cands.create (8000); call_used_regs_arr_len = 0; for (int i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (call_used_regs[i]) + if (call_used_or_fixed_reg_p (i)) call_used_regs_arr[call_used_regs_arr_len++] = i; initiate_cand_table (); create_remat_bb_data (); @@ -2420,7 +2420,7 @@ lra (FILE *f) if (crtl->saves_all_registers) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (! call_used_regs[i] && ! fixed_regs[i] && ! LOCAL_REGNO (i)) + if (!call_used_or_fixed_reg_p (i) && !fixed_regs[i] && !LOCAL_REGNO (i)) df_set_regs_ever_live (i, true); /* We don't DF from now and avoid its using because it is to diff --git a/gcc/postreload.c b/gcc/postreload.c index af64def..73b0afa 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -1135,7 +1135,7 @@ reload_combine_recognize_pattern (rtx_insn *insn) if (TEST_HARD_REG_BIT (reg_class_contents[INDEX_REG_CLASS], i) && reg_state[i].use_index == RELOAD_COMBINE_MAX_USES && reg_state[i].store_ruid <= reg_state[regno].use_ruid - && (call_used_regs[i] || df_regs_ever_live_p (i)) + && (call_used_or_fixed_reg_p (i) || df_regs_ever_live_p (i)) && (!frame_pointer_needed || i != HARD_FRAME_POINTER_REGNUM) && !fixed_regs[i] && !global_regs[i] && hard_regno_nregs (i, GET_MODE (reg)) == 1 @@ -2126,7 +2126,7 @@ reload_cse_move2add (rtx_insn *first) { for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--) { - if (call_used_regs[i]) + if (call_used_or_fixed_reg_p (i)) /* Reset the information about this register. */ reg_mode[i] = VOIDmode; } diff --git a/gcc/recog.c b/gcc/recog.c index a9f584b..f3e8a4c 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -3227,7 +3227,8 @@ peep2_find_free_register (int from, int to, const char *class_str, break; } /* And that we don't create an extra save/restore. */ - if (! call_used_regs[regno + j] && ! df_regs_ever_live_p (regno + j)) + if (! call_used_or_fixed_reg_p (regno + j) + && ! df_regs_ever_live_p (regno + j)) { success = 0; break; diff --git a/gcc/regrename.c b/gcc/regrename.c index 47d8224..14ce954 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -322,7 +322,7 @@ check_new_reg_p (int reg ATTRIBUTE_UNUSED, int new_reg, || global_regs[new_reg + i] /* Can't use regs which aren't saved by the prologue. */ || (! df_regs_ever_live_p (new_reg + i) - && ! call_used_regs[new_reg + i]) + && ! call_used_or_fixed_reg_p (new_reg + i)) #ifdef LEAF_REGISTERS /* We can't use a non-leaf register if we're in a leaf function. */ diff --git a/gcc/reload.c b/gcc/reload.c index 72cc38a..7731e0f 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -6911,14 +6911,14 @@ find_equiv_reg (rtx goal, rtx_insn *insn, enum reg_class rclass, int other, if (regno >= 0 && regno < FIRST_PSEUDO_REGISTER) for (i = 0; i < nregs; ++i) - if (call_used_regs[regno + i] + if (call_used_or_fixed_reg_p (regno + i) || targetm.hard_regno_call_part_clobbered (NULL, regno + i, mode)) return 0; if (valueno >= 0 && valueno < FIRST_PSEUDO_REGISTER) for (i = 0; i < valuenregs; ++i) - if (call_used_regs[valueno + i] + if (call_used_or_fixed_reg_p (valueno + i) || targetm.hard_regno_call_part_clobbered (NULL, valueno + i, mode)) return 0; diff --git a/gcc/reload1.c b/gcc/reload1.c index 8234e1e..c619c54 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -795,7 +795,9 @@ reload (rtx_insn *first, int global) if (crtl->saves_all_registers) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (! call_used_regs[i] && ! fixed_regs[i] && ! LOCAL_REGNO (i)) + if (! call_used_or_fixed_reg_p (i) + && ! fixed_regs[i] + && ! LOCAL_REGNO (i)) df_set_regs_ever_live (i, true); /* Find all the pseudo registers that didn't get hard regs @@ -1906,8 +1908,8 @@ find_reg (class insn_chain *chain, int order) && (inv_reg_alloc_order[regno] < inv_reg_alloc_order[best_reg]) #else - && call_used_regs[regno] - && ! call_used_regs[best_reg] + && call_used_or_fixed_reg_p (regno) + && ! call_used_or_fixed_reg_p (best_reg) #endif )) { diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index e515b1b..077845e 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -1123,7 +1123,7 @@ init_hard_regs_data (void) CLEAR_HARD_REG_SET (sel_hrd.regs_ever_used); for (cur_reg = 0; cur_reg < FIRST_PSEUDO_REGISTER; cur_reg++) - if (df_regs_ever_live_p (cur_reg) || call_used_regs[cur_reg]) + if (df_regs_ever_live_p (cur_reg) || call_used_or_fixed_reg_p (cur_reg)) SET_HARD_REG_BIT (sel_hrd.regs_ever_used, cur_reg); /* Initialize registers that are valid based on mode when this is |