From: Trevor Saunders <[email protected]>
gcc/ChangeLog:
* caller-save.cc (setup_save_areas, save_call_clobbered_regs,
insert_one_insn): Use dyn_cast instead of a class predicate.
* calls.cc (fixup_tail_calls): Likewise.
* cfgbuild.cc (make_edges, find_bb_boundaries): Likewise.
* cfgcleanup.cc (old_insns_match_p): Likewise.
* cfgrtl.cc (purge_dead_edges, need_fake_edge_p): Likewise.
* combine.cc (try_combine, record_dead_and_set_regs): Likewise.
* config/aarch64/aarch64.cc (aarch64_components_for_bb): Likewise.
* config/arm/aarch-bti-insert.cc (rest_of_insert_bti): Likewise.
* config/avr/avr.cc (_reg_unused_after): Likewise.
* config/c6x/c6x.cc (returning_call_p, split_delayed_branch): Likewise.
* config/i386/i386-features.cc
(rest_of_insert_endbr_and_patchable_area): Likewise.
* config/i386/i386.cc (ix86_avx_u128_mode_needed,
ix86_avx_u128_mode_after, ix86_min_insn_size, ix86_components_for_bb):
Likewise.
* config/loongarch/loongarch.cc (loongarch_components_for_bb): Likewise.
* config/pa/pa.cc (legitimize_pic_address): Likewise.
* config/riscv/riscv-sr.cc (riscv_remove_unneeded_save_restore_calls):
Likewise.
* config/riscv/riscv.cc (riscv_components_for_bb): Likewise.
* config/rs6000/rs6000-logue.cc (compute_save_world_info,
rs6000_ra_ever_killed): Likewise.
* config/sh/sh.cc (find_barrier, gen_block_redirect): Likewise.
* config/sparc/sparc.cc (sparc_asm_function_epilogue): Likewise.
* cse.cc (canonicalize_insn, cse_insn, count_reg_usage): Likewise.
* cselib.cc (cselib_process_insn): Likewise.
* dce.cc (deletable_insn_p, mark_insn): Use dyn_cast instead of CALL_P
and drop a redundant as_a.
* df-problems.cc (can_move_insns_across): Use dyn_cast instead of a
class predicate.
* dse.cc (scan_insn): Likewise.
* dwarf2cfi.cc (create_trace_edges): Likewise.
* dwarf2out.cc (dwarf2out_var_location): Likewise.
* early-remat.cc (early_remat::process_block): Likewise.
* emit-rtl.cc (unshare_all_rtl_again, reset_insn_used_flags,
verify_insn_sharing, unshare_all_rtl_in_chain, try_split): Likewise.
* except.cc (set_nothrow_function_flags): Likewise.
* ext-dce.cc (ext_dce_process_bb): Likewise.
* final.cc (output_asm_label, leaf_function_p,
collect_fn_hard_reg_usage): Likewise.
* function.cc (instantiate_virtual_regs,
thread_prologue_and_epilogue_insns): Likewise.
* gcse.cc (compute_hash_table_work): Likewise.
* ira-lives.cc (process_bb_node_lives): Likewise.
* ira.cc (validate_equiv_mem, memref_used_between_p,
update_equiv_regs_prescan): Likewise.
* loop-invariant.cc (find_exits, find_invariants_bb): Likewise.
* loop-iv.cc (simplify_using_initial_values): Likewise.
* lra-constraints.cc (inherit_in_ebb): Likewise.
* lra-lives.cc (process_bb_lives): Likewise.
* lra-remat.cc (set_bb_regs, calculate_gen_cands, do_remat): Likewise.
* lra-spills.cc (spill_pseudos): Likewise.
* lra.cc (lra_set_insn_recog_data, lra_update_insn_regno_info):
Likewise.
* postreload-gcse.cc (record_opr_changes): Likewise.
* postreload.cc (reload_combine, reload_cse_move2add_invalidate):
Likewise.
* print-rtl.cc (rtx_writer::print_rtx_operand_code_u): Likewise.
* reg-stack.cc (subst_stack_regs): Likewise.
* regcprop.cc (copyprop_hardreg_forward_1): Likewise.
* regrename.cc (build_def_use): Likewise.
* reload.cc (find_equiv_reg): Likewise.
* reload1.cc (reload, reload_as_needed, delete_output_reload): Likewise.
* reorg.cc (delete_prior_computation): Likewise.
* resource.cc (mark_target_live_regs): Likewise.
* rtlanal.cc (reg_set_p, find_all_hard_reg_sets, note_stores,
rtx_properties::try_to_add_insn, find_reg_fusage, find_regno_fusage,
replace_label): Likewise.
* sched-deps.cc (sched_analyze_insn, deps_analyze_insn): Likewise.
* sel-sched.cc (fur_orig_expr_found, fur_orig_expr_not_found): Likewise.
* store-motion.cc (store_killed_in_insn): Likewise.
* var-tracking.cc (vt_initialize): Likewise.
Signed-off-by: Trevor Saunders <[email protected]>
---
gcc/caller-save.cc | 45 ++++++++++++++--------------
gcc/calls.cc | 4 +--
gcc/cfgbuild.cc | 22 +++++++-------
gcc/cfgcleanup.cc | 8 ++---
gcc/cfgrtl.cc | 18 ++++++-----
gcc/combine.cc | 15 +++++-----
gcc/config/aarch64/aarch64.cc | 4 +--
gcc/config/arm/aarch-bti-insert.cc | 3 +-
gcc/config/avr/avr.cc | 4 +--
gcc/config/c6x/c6x.cc | 16 +++++-----
gcc/config/i386/i386-features.cc | 11 +++----
gcc/config/i386/i386.cc | 31 +++++++++----------
gcc/config/loongarch/loongarch.cc | 4 +--
gcc/config/pa/pa.cc | 4 +--
gcc/config/riscv/riscv-sr.cc | 7 ++---
gcc/config/riscv/riscv.cc | 4 +--
gcc/config/rs6000/rs6000-logue.cc | 7 +++--
gcc/config/sh/sh.cc | 10 +++----
gcc/config/sparc/sparc.cc | 5 ++--
gcc/cse.cc | 18 +++++------
gcc/cselib.cc | 14 ++++-----
gcc/dce.cc | 27 +++++++++--------
gcc/df-problems.cc | 4 +--
gcc/dse.cc | 14 ++++-----
gcc/dwarf2cfi.cc | 8 ++---
gcc/dwarf2out.cc | 8 ++---
gcc/early-remat.cc | 4 +--
gcc/emit-rtl.cc | 28 ++++++++---------
gcc/except.cc | 3 +-
gcc/ext-dce.cc | 15 +++++-----
gcc/final.cc | 20 ++++++-------
gcc/function.cc | 7 +++--
gcc/gcse.cc | 14 ++++-----
gcc/ira-lives.cc | 14 ++++-----
gcc/ira.cc | 11 +++----
gcc/loop-invariant.cc | 14 +++++----
gcc/loop-iv.cc | 4 +--
gcc/lra-constraints.cc | 19 ++++++------
gcc/lra-lives.cc | 8 ++---
gcc/lra-remat.cc | 12 ++++----
gcc/lra-spills.cc | 10 ++++---
gcc/lra.cc | 8 ++---
gcc/postreload-gcse.cc | 14 ++++-----
gcc/postreload.cc | 10 +++----
gcc/print-rtl.cc | 6 ++--
gcc/reg-stack.cc | 6 ++--
gcc/regcprop.cc | 8 ++---
gcc/regrename.cc | 9 +++---
gcc/reload.cc | 9 +++---
gcc/reload1.cc | 17 ++++++-----
gcc/reorg.cc | 5 ++--
gcc/resource.cc | 6 ++--
gcc/rtlanal.cc | 48 ++++++++++++++++--------------
gcc/sched-deps.cc | 34 ++++++++++-----------
gcc/sel-sched.cc | 8 ++---
gcc/store-motion.cc | 4 +--
gcc/var-tracking.cc | 4 +--
57 files changed, 358 insertions(+), 336 deletions(-)
diff --git a/gcc/caller-save.cc b/gcc/caller-save.cc
index 100d2e33a80..b7ec5ab25bb 100644
--- a/gcc/caller-save.cc
+++ b/gcc/caller-save.cc
@@ -421,13 +421,13 @@ setup_save_areas (void)
insn = chain->insn;
next = chain->next;
- if (!CALL_P (insn)
- || find_reg_note (insn, REG_NORETURN, NULL))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (!call || find_reg_note (call, REG_NORETURN, NULL))
continue;
- freq = REG_FREQ_FROM_BB (BLOCK_FOR_INSN (insn));
+ freq = REG_FREQ_FROM_BB (BLOCK_FOR_INSN (call));
REG_SET_TO_HARD_REG_SET (hard_regs_to_save,
&chain->live_throughout);
- used_regs = insn_callee_abi (insn).full_reg_clobbers ();
+ used_regs = insn_callee_abi (call).full_reg_clobbers ();
/* Record all registers set in this call insn. These don't
need to be saved. N.B. the call insn might set a subreg
@@ -435,9 +435,9 @@ setup_save_areas (void)
live during the call, but the subreg that is set
isn't. */
CLEAR_HARD_REG_SET (this_insn_sets);
- note_stores (insn, mark_set_regs, &this_insn_sets);
+ note_stores (call, mark_set_regs, &this_insn_sets);
/* Sibcalls are considered to set the return value. */
- if (SIBLING_CALL_P (insn) && crtl->return_rtx)
+ if (SIBLING_CALL_P (call) && crtl->return_rtx)
mark_set_regs (crtl->return_rtx, NULL_RTX, &this_insn_sets);
used_regs &= ~(fixed_reg_set | this_insn_sets);
@@ -451,7 +451,7 @@ setup_save_areas (void)
new_saved_hard_reg (regno, freq);
SET_HARD_REG_BIT (hard_regs_used, regno);
}
- cheap = find_reg_note (insn, REG_RETURNED, NULL);
+ cheap = find_reg_note (call, REG_RETURNED, NULL);
if (cheap)
cheap = XEXP (cheap, 0);
/* Look through all live pseudos, mark their hard registers. */
@@ -500,17 +500,17 @@ setup_save_areas (void)
call_saved_regs_num = 0;
insn = chain->insn;
next = chain->next;
- if (!CALL_P (insn)
- || find_reg_note (insn, REG_NORETURN, NULL))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (!call || find_reg_note (call, REG_NORETURN, NULL))
continue;
- cheap = find_reg_note (insn, REG_RETURNED, NULL);
+ cheap = find_reg_note (call, REG_RETURNED, NULL);
if (cheap)
cheap = XEXP (cheap, 0);
REG_SET_TO_HARD_REG_SET (hard_regs_to_save,
&chain->live_throughout);
- used_regs = insn_callee_abi (insn).full_reg_clobbers ();
+ used_regs = insn_callee_abi (call).full_reg_clobbers ();
/* Record all registers set in this call insn. These don't
need to be saved. N.B. the call insn might set a subreg
@@ -518,10 +518,10 @@ setup_save_areas (void)
live during the call, but the subreg that is set
isn't. */
CLEAR_HARD_REG_SET (this_insn_sets);
- note_stores (insn, mark_set_regs, &this_insn_sets);
+ note_stores (call, mark_set_regs, &this_insn_sets);
/* Sibcalls are considered to set the return value,
compare df-scan.cc:df_get_call_refs. */
- if (SIBLING_CALL_P (insn) && crtl->return_rtx)
+ if (SIBLING_CALL_P (call) && crtl->return_rtx)
mark_set_regs (crtl->return_rtx, NULL_RTX, &this_insn_sets);
used_regs &= ~(fixed_reg_set | this_insn_sets);
@@ -782,16 +782,17 @@ save_call_clobbered_regs (void)
hard_regs_saved &= ~this_insn_sets;
}
- if (code == CALL_INSN
- && ! SIBLING_CALL_P (insn)
- && ! find_reg_note (insn, REG_NORETURN, NULL))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call
+ && ! SIBLING_CALL_P (call)
+ && ! find_reg_note (call, REG_NORETURN, NULL))
{
unsigned regno;
HARD_REG_SET hard_regs_to_save;
reg_set_iterator rsi;
rtx cheap;
- cheap = find_reg_note (insn, REG_RETURNED, NULL);
+ cheap = find_reg_note (call, REG_RETURNED, NULL);
if (cheap)
cheap = XEXP (cheap, 0);
@@ -831,10 +832,10 @@ save_call_clobbered_regs (void)
multi-hard-reg pseudo; then the pseudo is considered live
during the call, but the subreg that is set isn't. */
CLEAR_HARD_REG_SET (this_insn_sets);
- note_stores (insn, mark_set_regs, &this_insn_sets);
+ note_stores (call, mark_set_regs, &this_insn_sets);
/* Compute which hard regs must be saved before this call. */
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
hard_regs_to_save &= ~(fixed_reg_set
| this_insn_sets
| hard_regs_saved);
@@ -858,7 +859,7 @@ save_call_clobbered_regs (void)
REGNO (cheap)))
{
rtx dest, newpat;
- rtx pat = PATTERN (insn);
+ rtx pat = PATTERN (call);
if (GET_CODE (pat) == PARALLEL)
pat = XVECEXP (pat, 0, 0);
dest = SET_DEST (pat);
@@ -1361,8 +1362,8 @@ insert_one_insn (class insn_chain *chain, int before_p,
int code, rtx pat)
&new_chain->live_throughout);
/* If CHAIN->INSN is a call, then the registers which contain
the arguments to the function are live in the new insn. */
- if (CALL_P (chain->insn))
- for (link = CALL_INSN_FUNCTION_USAGE (chain->insn);
+ if (auto call = dyn_cast<rtx_call_insn *> (chain->insn))
+ for (link = CALL_INSN_FUNCTION_USAGE (call);
link != NULL_RTX;
link = XEXP (link, 1))
note_uses (&XEXP (link, 0), add_used_regs,
diff --git a/gcc/calls.cc b/gcc/calls.cc
index b7e5d74fc49..2e77ba1ff72 100644
--- a/gcc/calls.cc
+++ b/gcc/calls.cc
@@ -4128,8 +4128,8 @@ fixup_tail_calls (void)
/* There are never REG_EQUIV notes for the incoming arguments
after the NOTE_INSN_FUNCTION_BEG note, so stop if we see it. */
- if (NOTE_P (insn)
- && NOTE_KIND (insn) == NOTE_INSN_FUNCTION_BEG)
+ auto note_insn = dyn_cast<rtx_note *> (insn);
+ if (note_insn && NOTE_KIND (note_insn) == NOTE_INSN_FUNCTION_BEG)
break;
note = find_reg_note (insn, REG_EQUIV, 0);
diff --git a/gcc/cfgbuild.cc b/gcc/cfgbuild.cc
index ddc2eb6b647..5e25c9c9541 100644
--- a/gcc/cfgbuild.cc
+++ b/gcc/cfgbuild.cc
@@ -236,8 +236,8 @@ make_edges (basic_block min, basic_block max, int update_p)
}
}
- if (LABEL_P (BB_HEAD (bb))
- && LABEL_ALT_ENTRY_P (BB_HEAD (bb)))
+ auto label = dyn_cast<rtx_code_label *> (BB_HEAD (bb));
+ if (label && LABEL_ALT_ENTRY_P (label))
cached_make_edge (NULL, ENTRY_BLOCK_PTR_FOR_FN (cfun), bb, 0);
/* Examine the last instruction of the block, and discover the
@@ -314,7 +314,8 @@ make_edges (basic_block min, basic_block max, int update_p)
and return, and so we need an edge to the exit block. No need to
worry about EH edges, since we wouldn't have created the sibling call
in the first place. */
- if (code == CALL_INSN && SIBLING_CALL_P (insn))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call && SIBLING_CALL_P (call))
cached_make_edge (edge_cache, bb, EXIT_BLOCK_PTR_FOR_FN (cfun),
EDGE_SIBCALL | EDGE_ABNORMAL);
@@ -322,14 +323,14 @@ make_edges (basic_block min, basic_block max, int
update_p)
handler for this CALL_INSN. If we're handling non-call
exceptions then any insn can reach any of the active handlers.
Also mark the CALL_INSN as reaching any nonlocal goto handler. */
- else if (code == CALL_INSN || cfun->can_throw_non_call_exceptions)
+ else if (call || cfun->can_throw_non_call_exceptions)
{
/* Add any appropriate EH edges. */
rtl_make_eh_edge (edge_cache, bb, insn);
- if (code == CALL_INSN)
+ if (call)
{
- if (can_nonlocal_goto (insn))
+ if (can_nonlocal_goto (call))
{
/* ??? This could be made smarter: in some cases it's
possible to tell that certain calls will not do a
@@ -362,9 +363,9 @@ make_edges (basic_block min, basic_block max, int update_p)
if (e && e->flags & EDGE_FALLTHRU)
insn = NULL;
- while (insn
- && NOTE_P (insn)
- && NOTE_KIND (insn) != NOTE_INSN_BASIC_BLOCK)
+ rtx_note *note;
+ while ((note = safe_dyn_cast<rtx_note *> (insn))
+ && NOTE_KIND (note) != NOTE_INSN_BASIC_BLOCK)
insn = NEXT_INSN (insn);
if (!insn)
@@ -573,7 +574,8 @@ find_bb_boundaries (basic_block bb)
bb->count = profile_count::uninitialized ();
flow_transfer_insn = NULL;
debug_insn = NULL;
- if (code == CODE_LABEL && LABEL_ALT_ENTRY_P (insn))
+ auto label = dyn_cast<rtx_code_label *> (insn);
+ if (label && LABEL_ALT_ENTRY_P (label))
make_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun), bb, 0);
}
else if (code == BARRIER)
diff --git a/gcc/cfgcleanup.cc b/gcc/cfgcleanup.cc
index bc802c3237f..0ad7de6420e 100644
--- a/gcc/cfgcleanup.cc
+++ b/gcc/cfgcleanup.cc
@@ -1190,7 +1190,7 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx_insn
*i1, rtx_insn *i2)
Also check for identical exception regions. */
- if (CALL_P (i1))
+ if (auto call1 = dyn_cast<rtx_call_insn *> (i1))
{
/* Ensure the same EH region. */
rtx n1 = find_reg_note (i1, REG_EH_REGION, 0);
@@ -1202,10 +1202,10 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx_insn
*i1, rtx_insn *i2)
if (n1 && (!n2 || XEXP (n1, 0) != XEXP (n2, 0)))
return dir_none;
- if (!rtx_equal_p (CALL_INSN_FUNCTION_USAGE (i1),
+ if (!rtx_equal_p (CALL_INSN_FUNCTION_USAGE (call1),
CALL_INSN_FUNCTION_USAGE (i2))
- || CALL_INSN_ABI_ID (i1) != CALL_INSN_ABI_ID (i2)
- || SIBLING_CALL_P (i1) != SIBLING_CALL_P (i2))
+ || CALL_INSN_ABI_ID (call1) != CALL_INSN_ABI_ID (i2)
+ || SIBLING_CALL_P (call1) != SIBLING_CALL_P (i2))
return dir_none;
/* For address sanitizer, never crossjump __asan_report_* builtins,
diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc
index cf265755ece..8714334bc9a 100644
--- a/gcc/cfgrtl.cc
+++ b/gcc/cfgrtl.cc
@@ -3394,10 +3394,11 @@ purge_dead_edges (basic_block bb)
in the hope that it is cleaned up later. If it is not, just
remove REG_EH_REGION note. While the call maybe can throw, the
current function's frame will not be there anymore when it does. */
- if (CALL_P (insn)
- && SIBLING_CALL_P (insn)
- && (note = find_reg_note (insn, REG_EH_REGION, NULL)))
- remove_note (insn, note);
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call
+ && SIBLING_CALL_P (call)
+ && (note = find_reg_note (call, REG_EH_REGION, NULL)))
+ remove_note (call, note);
/* Cleanup abnormal edges caused by exceptions or non-local gotos. */
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
@@ -5300,10 +5301,11 @@ need_fake_edge_p (const rtx_insn *insn)
if (!INSN_P (insn))
return false;
- if ((CALL_P (insn)
- && !SIBLING_CALL_P (insn)
- && !find_reg_note (insn, REG_NORETURN, NULL)
- && !(RTL_CONST_OR_PURE_CALL_P (insn))))
+ auto call = dyn_cast<const rtx_call_insn *> (insn);
+ if ((call
+ && !SIBLING_CALL_P (call)
+ && !find_reg_note (call, REG_NORETURN, NULL)
+ && !(RTL_CONST_OR_PURE_CALL_P (call))))
return true;
return ((GET_CODE (PATTERN (insn)) == ASM_OPERANDS
diff --git a/gcc/combine.cc b/gcc/combine.cc
index 939c5495e39..f4ef46b15c2 100644
--- a/gcc/combine.cc
+++ b/gcc/combine.cc
@@ -4408,9 +4408,10 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1,
rtx_insn *i0,
INSN_CODE (i3) = insn_code_number;
PATTERN (i3) = newpat;
- if (CALL_P (i3) && CALL_INSN_FUNCTION_USAGE (i3))
+ auto call = dyn_cast<rtx_call_insn *> (i3);
+ if (call && CALL_INSN_FUNCTION_USAGE (call))
{
- for (rtx link = CALL_INSN_FUNCTION_USAGE (i3); link;
+ for (rtx link = CALL_INSN_FUNCTION_USAGE (call); link;
link = XEXP (link, 1))
{
if (substed_i2)
@@ -13600,10 +13601,10 @@ record_dead_and_set_regs (rtx_insn *insn)
record_value_for_reg (XEXP (link, 0), insn, NULL_RTX);
}
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
HARD_REG_SET callee_clobbers
- = insn_callee_abi (insn).full_and_partial_reg_clobbers ();
+ = insn_callee_abi (call).full_and_partial_reg_clobbers ();
hard_reg_set_iterator hrsi;
EXECUTE_IF_SET_IN_HARD_REG_SET (callee_clobbers, 0, i, hrsi)
{
@@ -13619,7 +13620,7 @@ record_dead_and_set_regs (rtx_insn *insn)
situation before RA. */
rsp = ®_stat[i];
rsp->last_set_invalid = true;
- rsp->last_set = insn;
+ rsp->last_set = call;
rsp->last_set_value = 0;
rsp->last_set_mode = VOIDmode;
rsp->last_set_nonzero_bits = 0;
@@ -13628,13 +13629,13 @@ record_dead_and_set_regs (rtx_insn *insn)
rsp->truncated_to_mode = VOIDmode;
}
- last_call_luid = mem_last_set = DF_INSN_LUID (insn);
+ last_call_luid = mem_last_set = DF_INSN_LUID (call);
/* We can't combine into a call pattern. Remember, though, that
the return value register is set at this LUID. We could
still replace a register with the return value from the
wrong subroutine call! */
- note_stores (insn, record_dead_and_set_regs_1, NULL_RTX);
+ note_stores (call, record_dead_and_set_regs_1, NULL_RTX);
}
else
note_stores (insn, record_dead_and_set_regs_1, insn);
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 263c0afd4ab..397ffd5089d 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -10155,8 +10155,8 @@ aarch64_components_for_bb (basic_block bb)
function_abi_aggregator callee_abis;
rtx_insn *insn;
FOR_BB_INSNS (bb, insn)
- if (CALL_P (insn))
- callee_abis.note_callee_abi (insn_callee_abi (insn));
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ callee_abis.note_callee_abi (insn_callee_abi (call));
HARD_REG_SET extra_caller_saves = callee_abis.caller_save_regs (*crtl->abi);
/* GPRs are used in a bb if they are in the IN, GEN, or KILL sets. */
diff --git a/gcc/config/arm/aarch-bti-insert.cc
b/gcc/config/arm/aarch-bti-insert.cc
index 4fc60e1f307..9b89f3023f8 100644
--- a/gcc/config/arm/aarch-bti-insert.cc
+++ b/gcc/config/arm/aarch-bti-insert.cc
@@ -165,7 +165,8 @@ rest_of_insert_bti (void)
/* Also look for calls that may return indirectly, such as setjmp,
and put a BTI J after them. */
- if (CALL_P (insn) && call_needs_bti_j (insn))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call && call_needs_bti_j (call))
{
bti_insn = aarch_gen_bti_j ();
emit_insn_after (bti_insn, insn);
diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc
index ff5dc76ff1c..2d0f9a8f31f 100644
--- a/gcc/config/avr/avr.cc
+++ b/gcc/config/avr/avr.cc
@@ -3484,10 +3484,10 @@ _reg_unused_after (rtx_insn *insn, rtx reg, bool
look_at_insn)
return false;
}
- if (code == CALL_INSN)
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
rtx tem;
- for (tem = CALL_INSN_FUNCTION_USAGE (insn); tem; tem = XEXP (tem, 1))
+ for (tem = CALL_INSN_FUNCTION_USAGE (call); tem; tem = XEXP (tem, 1))
if (GET_CODE (XEXP (tem, 0)) == USE
&& REG_P (XEXP (XEXP (tem, 0), 0))
&& reg_overlap_mentioned_p (reg, XEXP (XEXP (tem, 0), 0)))
diff --git a/gcc/config/c6x/c6x.cc b/gcc/config/c6x/c6x.cc
index e11bf5b1dba..985b20f0551 100644
--- a/gcc/config/c6x/c6x.cc
+++ b/gcc/config/c6x/c6x.cc
@@ -4717,10 +4717,10 @@ emit_nop_after (int cycles, rtx_insn *after)
static bool
returning_call_p (rtx_insn *insn)
{
- if (CALL_P (insn))
- return (!SIBLING_CALL_P (insn)
- && get_attr_type (insn) != TYPE_CALLP
- && get_attr_type (insn) != TYPE_SHADOW);
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ return (!SIBLING_CALL_P (call)
+ && get_attr_type (call) != TYPE_CALLP
+ && get_attr_type (call) != TYPE_SHADOW);
if (recog_memoized (insn) < 0)
return false;
if (get_attr_type (insn) == TYPE_CALL)
@@ -5128,7 +5128,7 @@ split_delayed_branch (rtx_insn *insn)
if (GET_CODE (pat) == COND_EXEC)
pat = COND_EXEC_CODE (pat);
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
rtx src = pat, dest = NULL_RTX;
rtx callee;
@@ -5138,7 +5138,7 @@ split_delayed_branch (rtx_insn *insn)
src = SET_SRC (pat);
}
callee = XEXP (XEXP (src, 0), 0);
- if (SIBLING_CALL_P (insn))
+ if (SIBLING_CALL_P (call))
{
if (REG_P (callee))
newpat = gen_indirect_sibcall_shadow ();
@@ -5162,8 +5162,8 @@ split_delayed_branch (rtx_insn *insn)
newpat = gen_call_shadow (callee);
pat = gen_real_call (callee);
}
- pat = duplicate_cond (pat, insn);
- newpat = duplicate_cond (newpat, insn);
+ pat = duplicate_cond (pat, call);
+ newpat = duplicate_cond (newpat, call);
}
else
{
diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc
index fdea1cbe6d8..ee5ad076857 100644
--- a/gcc/config/i386/i386-features.cc
+++ b/gcc/config/i386/i386-features.cc
@@ -3305,12 +3305,12 @@ rest_of_insert_endbr_and_patchable_area (bool
need_endbr,
for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb));
insn = NEXT_INSN (insn))
{
- if (CALL_P (insn))
+ if (auto call_insn = dyn_cast<rtx_call_insn *> (insn))
{
- need_endbr = find_reg_note (insn, REG_SETJMP, NULL) != NULL;
- if (!need_endbr && !SIBLING_CALL_P (insn))
+ need_endbr = find_reg_note (call_insn, REG_SETJMP, NULL) != NULL;
+ if (!need_endbr && !SIBLING_CALL_P (call_insn))
{
- rtx call = get_call_rtx_from (insn);
+ rtx call = get_call_rtx_from (call_insn);
rtx fnaddr = XEXP (call, 0);
tree fndecl = NULL_TREE;
@@ -3338,7 +3338,8 @@ rest_of_insert_endbr_and_patchable_area (bool need_endbr,
twice, setjmp-like functions. */
endbr = gen_nop_endbr ();
- emit_insn_after_setloc (endbr, insn, INSN_LOCATION (insn));
+ emit_insn_after_setloc (endbr, call_insn,
+ INSN_LOCATION (call_insn));
continue;
}
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 283602d2bdc..19ad6cd06fa 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -15624,13 +15624,13 @@ ix86_avx_u128_mode_needed (rtx_insn *insn,
HARD_REG_SET live)
if (DEBUG_INSN_P (insn))
return AVX_U128_ANY;
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
rtx link;
/* Needed mode is set to AVX_U128_CLEAN if there are
no 256bit or 512bit modes used in function arguments. */
- for (link = CALL_INSN_FUNCTION_USAGE (insn);
+ for (link = CALL_INSN_FUNCTION_USAGE (call);
link;
link = XEXP (link, 1))
{
@@ -15646,19 +15646,19 @@ ix86_avx_u128_mode_needed (rtx_insn *insn,
HARD_REG_SET live)
/* Needed mode is set to AVX_U128_CLEAN if there are no 256bit
nor 512bit registers used in the function return register. */
bool avx_upper_reg_found = false;
- note_stores (insn, ix86_check_avx_upper_stores,
+ note_stores (call, ix86_check_avx_upper_stores,
&avx_upper_reg_found);
if (avx_upper_reg_found)
return AVX_U128_DIRTY;
- if (vzeroupper_pattern (PATTERN (insn), VOIDmode))
+ if (vzeroupper_pattern (PATTERN (call), VOIDmode))
return AVX_U128_ANY;
/* Should be safe to issue a vzeroupper before sibling_call_p. */
- if (SIBLING_CALL_P (insn))
+ if (SIBLING_CALL_P (call))
return AVX_U128_CLEAN;
- const function_abi &abi = insn_callee_abi (insn);
+ const function_abi &abi = insn_callee_abi (call);
/* IPA-RA conservatively records fixed registers as used by the
callee, e.g. xmm8-xmm15 for ia32, so ignore them. */
@@ -15808,10 +15808,10 @@ ix86_avx_u128_mode_after (int mode, rtx_insn *insn)
/* We know that state is clean after CALL insn if there are no
256bit or 512bit registers used in the function return register. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
bool avx_upper_reg_found = false;
- note_stores (insn, ix86_check_avx_upper_stores, &avx_upper_reg_found);
+ note_stores (call, ix86_check_avx_upper_stores, &avx_upper_reg_found);
if (avx_upper_reg_found)
return AVX_U128_DIRTY;
@@ -15819,8 +15819,8 @@ ix86_avx_u128_mode_after (int mode, rtx_insn *insn)
/* If the function doesn't clobber any sse registers or only clobber
128-bit part, then vzeroupper isn't issued before the function exit,
and the function doesn't change the status. */
- const function_abi &abi = insn_callee_abi (insn);
- if (!(SIBLING_CALL_P (insn)
+ const function_abi &abi = insn_callee_abi (call);
+ if (!(SIBLING_CALL_P (call)
|| hard_reg_set_subset_p (reg_class_contents[SSE_REGS],
abi.mode_clobbers (V4DImode))))
return mode;
@@ -25030,9 +25030,10 @@ ix86_min_insn_size (rtx_insn *insn)
/* Important case - calls are always 5 bytes.
It is common to have many calls in the row. */
- if (CALL_P (insn)
- && symbolic_reference_mentioned_p (PATTERN (insn))
- && !SIBLING_CALL_P (insn))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call
+ && symbolic_reference_mentioned_p (PATTERN (call))
+ && !SIBLING_CALL_P (call))
return 5;
len = get_attr_length (insn);
if (len <= 1)
@@ -29900,8 +29901,8 @@ ix86_components_for_bb (basic_block bb)
function_abi_aggregator callee_abis;
rtx_insn *insn;
FOR_BB_INSNS (bb, insn)
- if (CALL_P (insn))
- callee_abis.note_callee_abi (insn_callee_abi (insn));
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ callee_abis.note_callee_abi (insn_callee_abi (call));
HARD_REG_SET extra_caller_saves = callee_abis.caller_save_regs (*crtl->abi);
/* GPRs are used in a bb if they are in the IN, GEN, or KILL sets. */
diff --git a/gcc/config/loongarch/loongarch.cc
b/gcc/config/loongarch/loongarch.cc
index 57d09584a16..2aa50a6c716 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -8830,8 +8830,8 @@ loongarch_components_for_bb (basic_block bb)
function_abi_aggregator callee_abis;
rtx_insn *insn;
FOR_BB_INSNS (bb, insn)
- if (CALL_P (insn))
- callee_abis.note_callee_abi (insn_callee_abi (insn));
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ callee_abis.note_callee_abi (insn_callee_abi (call));
HARD_REG_SET extra_caller_saves =
callee_abis.caller_save_regs (*crtl->abi);
diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc
index 8f0248252bc..6586cbdf7ea 100644
--- a/gcc/config/pa/pa.cc
+++ b/gcc/config/pa/pa.cc
@@ -995,8 +995,8 @@ legitimize_pic_address (rtx orig, machine_mode mode, rtx
reg)
orig = XEXP (orig, 0);
add_reg_note (insn, REG_LABEL_OPERAND, orig);
/* Make sure we have label and not a note. */
- if (LABEL_P (orig))
- LABEL_NUSES (orig)++;
+ if (auto lab = dyn_cast<rtx_code_label *> (orig))
+ LABEL_NUSES (lab)++;
}
crtl->uses_pic_offset_table = 1;
return reg;
diff --git a/gcc/config/riscv/riscv-sr.cc b/gcc/config/riscv/riscv-sr.cc
index 84dc9504d05..cf4514b1302 100644
--- a/gcc/config/riscv/riscv-sr.cc
+++ b/gcc/config/riscv/riscv-sr.cc
@@ -393,13 +393,10 @@ riscv_remove_unneeded_save_restore_calls (void)
has no more than 1 call (checked above). To convert this single call
into a tail call we rely on the call being the last thing before the
epilogue. */
- if (GET_CODE (insn_before_epilogue) != CALL_INSN)
+ auto call = dyn_cast<rtx_call_insn *> (insn_before_epilogue);
+ if (!call)
return;
- /* The last instruction in this block, just before the epilogue is a
- call. We can potentially change this call into a tail call. */
- rtx_insn *call = insn_before_epilogue;
-
/* Transform call in insn to a sibcall, this will only be done if the
last thing in the function is a call. */
rtx callpat = PATTERN (call);
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index d53f72ff9fb..d83e26351c9 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -11373,8 +11373,8 @@ riscv_components_for_bb (basic_block bb)
function_abi_aggregator callee_abis;
rtx_insn *insn;
FOR_BB_INSNS (bb, insn)
- if (CALL_P (insn))
- callee_abis.note_callee_abi (insn_callee_abi (insn));
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ callee_abis.note_callee_abi (insn_callee_abi (call));
HARD_REG_SET extra_caller_saves = callee_abis.caller_save_regs (*crtl->abi);
/* GPRs are used in a bb if they are in the IN, GEN, or KILL sets. */
diff --git a/gcc/config/rs6000/rs6000-logue.cc
b/gcc/config/rs6000/rs6000-logue.cc
index 316a5ffc4ee..658c59dde77 100644
--- a/gcc/config/rs6000/rs6000-logue.cc
+++ b/gcc/config/rs6000/rs6000-logue.cc
@@ -239,8 +239,9 @@ compute_save_world_info (rs6000_stack_t *info)
if (WORLD_SAVE_P (info))
{
rtx_insn *insn;
+ rtx_call_insn *call;
for (insn = get_last_insn_anywhere (); insn; insn = PREV_INSN (insn))
- if (CALL_P (insn) && SIBLING_CALL_P (insn))
+ if ((call = dyn_cast<rtx_call_insn *> (insn)) && SIBLING_CALL_P (call))
{
info->world_save_p = 0;
break;
@@ -1224,9 +1225,9 @@ rs6000_ra_ever_killed (void)
{
if (INSN_P (insn))
{
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- if (!SIBLING_CALL_P (insn))
+ if (!SIBLING_CALL_P (call))
return 1;
}
else if (find_regno_note (insn, REG_INC, LR_REGNO))
diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc
index 516a8da5dbe..44d90e1719f 100644
--- a/gcc/config/sh/sh.cc
+++ b/gcc/config/sh/sh.cc
@@ -5255,9 +5255,9 @@ find_barrier (int num_mova, rtx_insn *mova, rtx_insn
*from)
while (NOTE_P (from) || JUMP_P (from) || LABEL_P (from))
from = PREV_INSN (from);
- if (CALL_P (from))
+ if (auto call = dyn_cast<rtx_call_insn *> (from))
{
- bool sibcall_p = SIBLING_CALL_P (from);
+ bool sibcall_p = SIBLING_CALL_P (call);
/* If FROM was a sibling call, then we know that control
will not return. In fact, we were guaranteed to hit
@@ -5267,7 +5267,7 @@ find_barrier (int num_mova, rtx_insn *mova, rtx_insn
*from)
costs space, but more importantly it confuses dwarf2cfi
generation. */
if (sibcall_p)
- return emit_barrier_after (from);
+ return emit_barrier_after (call);
}
from = emit_jump_insn_after (gen_jump (label), from);
@@ -5547,8 +5547,8 @@ gen_block_redirect (rtx_insn *jump, int addr, int
need_block)
if (INSN_P (scan))
{
used |= regs_used (PATTERN (scan), 0);
- if (code == CALL_INSN)
- used |= regs_used (CALL_INSN_FUNCTION_USAGE (scan), 0);
+ if (auto call = dyn_cast<rtx_call_insn *> (scan))
+ used |= regs_used (CALL_INSN_FUNCTION_USAGE (call), 0);
dead |= (used >> 16) & ~used;
if (dead & attempt)
{
diff --git a/gcc/config/sparc/sparc.cc b/gcc/config/sparc/sparc.cc
index 35d2402e98e..e69d7625310 100644
--- a/gcc/config/sparc/sparc.cc
+++ b/gcc/config/sparc/sparc.cc
@@ -6358,9 +6358,8 @@ sparc_asm_function_epilogue (FILE *file)
&& (seq = dyn_cast <rtx_sequence *> (PATTERN (last_real_insn))))
last_real_insn = seq->insn (0);
- if (last_real_insn
- && CALL_P (last_real_insn)
- && !SIBLING_CALL_P (last_real_insn))
+ auto call = safe_dyn_cast<rtx_call_insn *> (last_real_insn);
+ if (call && !SIBLING_CALL_P (call))
fputs("\tnop\n", file);
sparc_output_deferred_case_vectors ();
diff --git a/gcc/cse.cc b/gcc/cse.cc
index 53483b967ed..b75bdb4612f 100644
--- a/gcc/cse.cc
+++ b/gcc/cse.cc
@@ -4444,11 +4444,11 @@ canonicalize_insn (rtx_insn *insn, vec<struct set>
*psets)
rtx x = PATTERN (insn);
int i;
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- for (tem = CALL_INSN_FUNCTION_USAGE (insn); tem; tem = XEXP (tem, 1))
+ for (tem = CALL_INSN_FUNCTION_USAGE (call); tem; tem = XEXP (tem, 1))
if (GET_CODE (XEXP (tem, 0)) != SET)
- XEXP (tem, 0) = canon_reg (XEXP (tem, 0), insn);
+ XEXP (tem, 0) = canon_reg (XEXP (tem, 0), call);
}
if (GET_CODE (x) == SET && GET_CODE (SET_SRC (x)) == CALL)
@@ -5905,18 +5905,18 @@ cse_insn (rtx_insn *insn)
/* Some registers are invalidated by subroutine calls. Memory is
invalidated by non-constant calls. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- if (!(RTL_CONST_OR_PURE_CALL_P (insn)))
+ if (!(RTL_CONST_OR_PURE_CALL_P (call)))
invalidate_memory ();
else
/* For const/pure calls, invalidate any argument slots, because
those are owned by the callee. */
- for (tem = CALL_INSN_FUNCTION_USAGE (insn); tem; tem = XEXP (tem, 1))
+ for (tem = CALL_INSN_FUNCTION_USAGE (call); tem; tem = XEXP (tem, 1))
if (GET_CODE (XEXP (tem, 0)) == USE
&& MEM_P (XEXP (XEXP (tem, 0), 0)))
invalidate (XEXP (XEXP (tem, 0), 0), VOIDmode);
- invalidate_for_call (insn);
+ invalidate_for_call (call);
}
/* Now invalidate everything set by this instruction.
@@ -7159,8 +7159,8 @@ count_reg_usage (rtx x, int *counts, rtx dest, int incr)
&& !insn_nothrow_p (as_a <rtx_insn *> (x)))
|| side_effects_p (PATTERN (x)))
dest = pc_rtx;
- if (code == CALL_INSN)
- count_reg_usage (CALL_INSN_FUNCTION_USAGE (x), counts, dest, incr);
+ if (auto call = dyn_cast<rtx_call_insn *> (x))
+ count_reg_usage (CALL_INSN_FUNCTION_USAGE (call), counts, dest, incr);
count_reg_usage (PATTERN (x), counts, dest, incr);
/* Things used in a REG_EQUAL note aren't dead since loop may try to
diff --git a/gcc/cselib.cc b/gcc/cselib.cc
index 3e48fe5dcb0..e821621542e 100644
--- a/gcc/cselib.cc
+++ b/gcc/cselib.cc
@@ -3366,9 +3366,9 @@ cselib_process_insn (rtx_insn *insn)
/* If this is a call instruction, forget anything stored in a
call clobbered register, or, if this is not a const call, in
memory. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{
elt_list **l = ®_VALUES (i);
@@ -3385,14 +3385,14 @@ cselib_process_insn (rtx_insn *insn)
/* Since it is not clear how cselib is going to be used, be
conservative here and treat looping pure or const functions
as if they were regular functions. */
- if (RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)
- || !(RTL_CONST_OR_PURE_CALL_P (insn)))
+ if (RTL_LOOPING_CONST_OR_PURE_CALL_P (call)
+ || !(RTL_CONST_OR_PURE_CALL_P (call)))
cselib_invalidate_mem (callmem[0]);
else
{
/* For const/pure calls, invalidate any argument slots because
they are owned by the callee. */
- for (x = CALL_INSN_FUNCTION_USAGE (insn); x; x = XEXP (x, 1))
+ for (x = CALL_INSN_FUNCTION_USAGE (call); x; x = XEXP (x, 1))
if (GET_CODE (XEXP (x, 0)) == USE
&& MEM_P (XEXP (XEXP (x, 0), 0)))
cselib_invalidate_mem (XEXP (XEXP (x, 0), 0));
@@ -3411,9 +3411,9 @@ cselib_process_insn (rtx_insn *insn)
/* Look for any CLOBBERs in CALL_INSN_FUNCTION_USAGE, but only
after we have processed the insn. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- for (x = CALL_INSN_FUNCTION_USAGE (insn); x; x = XEXP (x, 1))
+ for (x = CALL_INSN_FUNCTION_USAGE (call); x; x = XEXP (x, 1))
if (GET_CODE (XEXP (x, 0)) == CLOBBER)
cselib_invalidate_rtx (XEXP (XEXP (x, 0), 0));
diff --git a/gcc/dce.cc b/gcc/dce.cc
index 693baab6386..ac65f4936fe 100644
--- a/gcc/dce.cc
+++ b/gcc/dce.cc
@@ -124,22 +124,22 @@ deletable_insn_p (rtx_insn *insn, bool fast, bitmap
arg_stores)
int i;
df_ref def;
- if (CALL_P (insn)
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call
/* We cannot delete calls inside of the recursive dce because
this may cause basic blocks to be deleted and this messes up
the rest of the stack of optimization passes. */
&& (!df_in_progress)
/* We cannot delete pure or const sibling calls because it is
hard to see the result. */
- && (!SIBLING_CALL_P (insn))
+ && (!SIBLING_CALL_P (call))
/* We can delete dead const or pure calls as long as they do not
infinite loop. */
- && (RTL_CONST_OR_PURE_CALL_P (insn)
- && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn))
+ && (RTL_CONST_OR_PURE_CALL_P (call)
+ && !RTL_LOOPING_CONST_OR_PURE_CALL_P (call))
/* Don't delete calls that may throw if we cannot do so. */
- && can_delete_call (insn))
- return find_call_stack_args (as_a <rtx_call_insn *> (insn), false,
- fast, arg_stores);
+ && can_delete_call (call))
+ return find_call_stack_args (call, false, fast, arg_stores);
/* Don't delete jumps, notes and the like. */
if (!NONJUMP_INSN_P (insn))
@@ -225,13 +225,14 @@ mark_insn (rtx_insn *insn, bool fast)
bitmap_set_bit (marked, INSN_UID (insn));
if (dump_file)
fprintf (dump_file, " Adding insn %d to worklist\n", INSN_UID (insn));
- if (CALL_P (insn)
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call
&& !df_in_progress
- && !SIBLING_CALL_P (insn)
- && (RTL_CONST_OR_PURE_CALL_P (insn)
- && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn))
- && can_delete_call (insn))
- find_call_stack_args (as_a <rtx_call_insn *> (insn), true, fast, NULL);
+ && !SIBLING_CALL_P (call)
+ && (RTL_CONST_OR_PURE_CALL_P (call)
+ && !RTL_LOOPING_CONST_OR_PURE_CALL_P (call))
+ && can_delete_call (call))
+ find_call_stack_args (call, true, fast, NULL);
}
}
diff --git a/gcc/df-problems.cc b/gcc/df-problems.cc
index 49861a7766a..b38d183026e 100644
--- a/gcc/df-problems.cc
+++ b/gcc/df-problems.cc
@@ -4177,9 +4177,9 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to,
for (insn = across_to; ; insn = next)
{
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- if (RTL_CONST_OR_PURE_CALL_P (insn))
+ if (RTL_CONST_OR_PURE_CALL_P (call))
/* Pure functions can read from memory. Const functions can
read from arguments that the ABI has forced onto the stack.
Neither sort of read can be volatile. */
diff --git a/gcc/dse.cc b/gcc/dse.cc
index 8e88cde0f42..7c0d90e2f7a 100644
--- a/gcc/dse.cc
+++ b/gcc/dse.cc
@@ -2537,7 +2537,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn, int
max_active_local_stores)
/* Look at all of the uses in the insn. */
note_uses (&PATTERN (insn), check_mem_read_use, bb_info);
- if (CALL_P (insn))
+ if (auto call_insn = dyn_cast<rtx_call_insn *> (insn))
{
bool const_call;
rtx call, sym;
@@ -2549,9 +2549,9 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn, int
max_active_local_stores)
however, they can read their parameters which may have
been pushed onto the stack.
memset and bzero don't read memory either. */
- const_call = RTL_CONST_CALL_P (insn);
+ const_call = RTL_CONST_CALL_P (call_insn);
if (!const_call
- && (call = get_call_rtx_from (insn))
+ && (call = get_call_rtx_from (call_insn))
&& (sym = XEXP (XEXP (call, 0), 0))
&& GET_CODE (sym) == SYMBOL_REF
&& SYMBOL_REF_DECL (sym)
@@ -2574,7 +2574,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn, int
max_active_local_stores)
arg pointer. If it is a frame pointer on the target,
even before reload we need to kill frame pointer based
stores. */
- || (SIBLING_CALL_P (insn)
+ || (SIBLING_CALL_P (call_insn)
&& HARD_FRAME_POINTER_IS_ARG_POINTER))
insn_info->frame_read = true;
@@ -2622,7 +2622,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn, int
max_active_local_stores)
if (memset_call)
{
rtx args[3];
- if (get_call_args (insn, memset_call, args, 3)
+ if (get_call_args (call_insn, memset_call, args, 3)
&& CONST_INT_P (args[1])
&& CONST_INT_P (args[2])
&& INTVAL (args[2]) > 0)
@@ -2650,7 +2650,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn, int
max_active_local_stores)
clear_rhs_from_active_local_stores ();
}
}
- else if (SIBLING_CALL_P (insn)
+ else if (SIBLING_CALL_P (call_insn)
&& (reload_completed || HARD_FRAME_POINTER_IS_ARG_POINTER))
/* Arguments for a sibling call that are pushed to memory are passed
using the incoming argument pointer of the current function. After
@@ -2663,7 +2663,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn, int
max_active_local_stores)
that is not relative to the frame. */
add_non_frame_wild_read (bb_info);
- for (rtx link = CALL_INSN_FUNCTION_USAGE (insn);
+ for (rtx link = CALL_INSN_FUNCTION_USAGE (call_insn);
link != NULL_RTX;
link = XEXP (link, 1))
if (GET_CODE (XEXP (link, 0)) == USE && MEM_P (XEXP (XEXP (link, 0),0)))
diff --git a/gcc/dwarf2cfi.cc b/gcc/dwarf2cfi.cc
index b79294c9719..4378c2adbbf 100644
--- a/gcc/dwarf2cfi.cc
+++ b/gcc/dwarf2cfi.cc
@@ -2694,18 +2694,18 @@ create_trace_edges (rtx_insn *insn)
maybe_record_trace_start (lab, insn);
}
}
- else if (CALL_P (insn))
+ else if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
/* Sibling calls don't have edges inside this function. */
- if (SIBLING_CALL_P (insn))
+ if (SIBLING_CALL_P (call))
return;
/* Process non-local goto edges. */
- if (can_nonlocal_goto (insn))
+ if (can_nonlocal_goto (call))
for (rtx_insn_list *lab = nonlocal_goto_handler_labels;
lab;
lab = lab->next ())
- maybe_record_trace_start_abnormal (lab->insn (), insn);
+ maybe_record_trace_start_abnormal (lab->insn (), call);
}
else if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (PATTERN (insn)))
{
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index ca21fe6f100..55bfad9ad01 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -28625,13 +28625,13 @@ dwarf2out_var_location (rtx_insn *loc_note)
if (!NOTE_P (loc_note))
{
- if (CALL_P (loc_note))
+ if (auto call = dyn_cast<rtx_call_insn *> (loc_note))
{
- maybe_reset_location_view (loc_note, cur_line_info_table);
+ maybe_reset_location_view (call, cur_line_info_table);
call_site_count++;
- if (SIBLING_CALL_P (loc_note))
+ if (SIBLING_CALL_P (call))
tail_call_site_count++;
- if (find_reg_note (loc_note, REG_CALL_ARG_LOCATION, NULL_RTX))
+ if (find_reg_note (call, REG_CALL_ARG_LOCATION, NULL_RTX))
{
call_insn = loc_note;
loc_note = NULL;
diff --git a/gcc/early-remat.cc b/gcc/early-remat.cc
index 94dfff98214..033a2f5e52d 100644
--- a/gcc/early-remat.cc
+++ b/gcc/early-remat.cc
@@ -1995,7 +1995,7 @@ early_remat::process_block (basic_block bb)
}
}
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
if (!last_call)
{
@@ -2012,7 +2012,7 @@ early_remat::process_block (basic_block bb)
emit_remat_insns (m_required, NULL, info->rd_after_call,
last_call);
}
- last_call = insn;
+ last_call = call;
bitmap_clear (m_available);
gcc_checking_assert (empty_p (m_required));
}
diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc
index 03ac60a3468..bfc6cfad51f 100644
--- a/gcc/emit-rtl.cc
+++ b/gcc/emit-rtl.cc
@@ -2994,8 +2994,8 @@ unshare_all_rtl_again (rtx_insn *insn)
{
reset_used_flags (PATTERN (p));
reset_used_flags (REG_NOTES (p));
- if (CALL_P (p))
- reset_used_flags (CALL_INSN_FUNCTION_USAGE (p));
+ if (auto call = dyn_cast<rtx_call_insn *> (p))
+ reset_used_flags (CALL_INSN_FUNCTION_USAGE (call));
}
/* Make sure that virtual stack slots are not shared. */
@@ -3144,8 +3144,8 @@ reset_insn_used_flags (rtx_insn *insn)
gcc_assert (INSN_P (insn));
reset_used_flags (PATTERN (insn));
reset_used_flags (REG_NOTES (insn));
- if (CALL_P (insn))
- reset_used_flags (CALL_INSN_FUNCTION_USAGE (insn));
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ reset_used_flags (CALL_INSN_FUNCTION_USAGE (call));
}
/* Go through all the RTL insn bodies and clear all the USED bits. */
@@ -3182,8 +3182,8 @@ verify_insn_sharing (rtx_insn *insn)
gcc_assert (INSN_P (insn));
verify_rtx_sharing (PATTERN (insn), insn);
verify_rtx_sharing (REG_NOTES (insn), insn);
- if (CALL_P (insn))
- verify_rtx_sharing (CALL_INSN_FUNCTION_USAGE (insn), insn);
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ verify_rtx_sharing (CALL_INSN_FUNCTION_USAGE (call), call);
}
/* Go through all the RTL insn bodies and check that there is no unexpected
@@ -3229,9 +3229,9 @@ unshare_all_rtl_in_chain (rtx_insn *insn)
{
PATTERN (insn) = copy_rtx_if_shared (PATTERN (insn));
REG_NOTES (insn) = copy_rtx_if_shared (REG_NOTES (insn));
- if (CALL_P (insn))
- CALL_INSN_FUNCTION_USAGE (insn)
- = copy_rtx_if_shared (CALL_INSN_FUNCTION_USAGE (insn));
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ CALL_INSN_FUNCTION_USAGE (call)
+ = copy_rtx_if_shared (CALL_INSN_FUNCTION_USAGE (call));
}
}
@@ -4070,23 +4070,23 @@ try_split (rtx pat, rtx_insn *trial, int last)
/* If we are splitting a CALL_INSN, look for the CALL_INSN
in SEQ and copy any additional information across. */
- if (CALL_P (trial))
+ if (auto call_trial = dyn_cast<rtx_call_insn *> (trial))
{
for (insn = insn_last; insn ; insn = PREV_INSN (insn))
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
gcc_assert (call_insn == NULL_RTX);
call_insn = insn;
/* Add the old CALL_INSN_FUNCTION_USAGE to whatever the
target may have explicitly specified. */
- rtx *p = &CALL_INSN_FUNCTION_USAGE (insn);
+ rtx *p = &CALL_INSN_FUNCTION_USAGE (call);
while (*p)
p = &XEXP (*p, 1);
- *p = CALL_INSN_FUNCTION_USAGE (trial);
+ *p = CALL_INSN_FUNCTION_USAGE (call_trial);
/* Preserve the ABI information from the original call. */
- CALL_INSN_ABI_ID (insn) = CALL_INSN_ABI_ID (trial);
+ CALL_INSN_ABI_ID (call) = CALL_INSN_ABI_ID (call_trial);
/* If the old call was a sibling call, the new one must
be too. */
diff --git a/gcc/except.cc b/gcc/except.cc
index eb53f8d1aaf..a8985ee81e1 100644
--- a/gcc/except.cc
+++ b/gcc/except.cc
@@ -2003,7 +2003,8 @@ set_nothrow_function_flags (void)
{
crtl->nothrow = 0;
- if (!CALL_P (insn) || !SIBLING_CALL_P (insn))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (!call || !SIBLING_CALL_P (call))
{
crtl->all_throwers_are_sibcalls = 0;
return 0;
diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc
index e38ecc5e98c..e431bb0e404 100644
--- a/gcc/ext-dce.cc
+++ b/gcc/ext-dce.cc
@@ -1515,9 +1515,9 @@ ext_dce_process_bb (basic_block bb)
bool skipped_dest = ext_dce_process_sets (insn, PATTERN (insn),
live_tmp);
/* CALL_INSNs need processing their fusage data. */
- if (CALL_P (insn))
- skipped_dest |= ext_dce_process_sets (insn,
- CALL_INSN_FUNCTION_USAGE (insn),
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ skipped_dest |= ext_dce_process_sets (call,
+ CALL_INSN_FUNCTION_USAGE (call),
live_tmp);
/* And now uses, optimizing away SIGN/ZERO extensions as we go. */
@@ -1532,19 +1532,20 @@ ext_dce_process_bb (basic_block bb)
}
/* And process fusage data for the use as well. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- if (!FAKE_CALL_P (insn))
+ if (!FAKE_CALL_P (call))
bitmap_set_range (livenow, STACK_POINTER_REGNUM * 4, 4);
/* If this is not a call to a const function, then assume it
can read any global register. */
- if (!RTL_CONST_CALL_P (insn))
+ if (!RTL_CONST_CALL_P (call))
for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (global_regs[i])
bitmap_set_range (livenow, i * 4, 4);
- ext_dce_process_uses (insn, CALL_INSN_FUNCTION_USAGE (insn),
live_tmp, false);
+ ext_dce_process_uses (call, CALL_INSN_FUNCTION_USAGE (call),
+ live_tmp, false);
}
BITMAP_FREE (live_tmp);
diff --git a/gcc/final.cc b/gcc/final.cc
index 9f9bc20f19b..e1f46a21f7f 100644
--- a/gcc/final.cc
+++ b/gcc/final.cc
@@ -3691,9 +3691,10 @@ output_asm_label (rtx x)
if (GET_CODE (x) == LABEL_REF)
x = label_ref_label (x);
+ rtx_note *note = dyn_cast<rtx_note *> (x);
if (LABEL_P (x)
- || (NOTE_P (x)
- && NOTE_KIND (x) == NOTE_INSN_DELETED_LABEL))
+ || (note
+ && NOTE_KIND (note) == NOTE_INSN_DELETED_LABEL))
ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));
else
output_operand_lossage ("'%%l' operand isn't a label");
@@ -4166,15 +4167,14 @@ leaf_function_p (void)
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
{
- if (CALL_P (insn)
- && ! SIBLING_CALL_P (insn)
- && ! FAKE_CALL_P (insn))
+ rtx_call_insn *call = dyn_cast<rtx_call_insn *> (insn);
+ if (call && ! SIBLING_CALL_P (call) && ! FAKE_CALL_P (call))
return false;
rtx_sequence *seq;
if (NONJUMP_INSN_P (insn)
&& (seq = dyn_cast <rtx_sequence *> (PATTERN (insn)))
- && CALL_P (seq->insn (0))
- && ! SIBLING_CALL_P (seq->insn (0)))
+ && (call = dyn_cast<rtx_call_insn *> (seq->insn (0)))
+ && ! SIBLING_CALL_P (call))
return false;
}
@@ -4701,10 +4701,10 @@ collect_fn_hard_reg_usage (void)
if (!NONDEBUG_INSN_P (insn))
continue;
- if (CALL_P (insn)
- && !self_recursive_call_p (insn))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call && !self_recursive_call_p (call))
function_used_regs
- |= insn_callee_abi (insn).full_and_partial_reg_clobbers ();
+ |= insn_callee_abi (call).full_and_partial_reg_clobbers ();
find_all_hard_reg_sets (insn, &insn_used_regs, false);
function_used_regs |= insn_used_regs;
diff --git a/gcc/function.cc b/gcc/function.cc
index e10a0274341..f6503f259c0 100644
--- a/gcc/function.cc
+++ b/gcc/function.cc
@@ -2072,8 +2072,8 @@ instantiate_virtual_regs (void)
instantiate_virtual_regs_in_rtx (®_NOTES (insn));
/* Instantiate any virtual registers in CALL_INSN_FUNCTION_USAGE. */
- if (CALL_P (insn))
- instantiate_virtual_regs_in_rtx (&CALL_INSN_FUNCTION_USAGE (insn));
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ instantiate_virtual_regs_in_rtx (&CALL_INSN_FUNCTION_USAGE (call));
}
/* Instantiate the virtual registers in the DECLs for debugging purposes. */
@@ -6342,7 +6342,8 @@ thread_prologue_and_epilogue_insns (void)
rtx_insn *insn = BB_END (e->src);
- if (!(CALL_P (insn) && SIBLING_CALL_P (insn)))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (!(call && SIBLING_CALL_P (call)))
continue;
rtx_insn *ep_seq;
diff --git a/gcc/gcse.cc b/gcc/gcse.cc
index e6ab8270345..5e68b066995 100644
--- a/gcc/gcse.cc
+++ b/gcc/gcse.cc
@@ -1618,7 +1618,7 @@ compute_hash_table_work (struct gcse_hash_table_d *table)
if (!NONDEBUG_INSN_P (insn))
continue;
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
hard_reg_set_iterator hrsi;
@@ -1626,14 +1626,14 @@ compute_hash_table_work (struct gcse_hash_table_d
*table)
to be conservative and assume that partial kills
are full kills. */
HARD_REG_SET callee_clobbers
- = insn_callee_abi (insn).full_and_partial_reg_clobbers ();
+ = insn_callee_abi (call).full_and_partial_reg_clobbers ();
EXECUTE_IF_SET_IN_HARD_REG_SET (callee_clobbers, 0, regno, hrsi)
- record_last_reg_set_info (insn, regno);
+ record_last_reg_set_info (call, regno);
- if (! RTL_CONST_OR_PURE_CALL_P (insn)
- || RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)
- || can_throw_external (insn))
- record_last_mem_set_info (insn);
+ if (! RTL_CONST_OR_PURE_CALL_P (call)
+ || RTL_LOOPING_CONST_OR_PURE_CALL_P (call)
+ || can_throw_external (call))
+ record_last_mem_set_info (call);
}
note_stores (insn, record_last_set_info, insn);
diff --git a/gcc/ira-lives.cc b/gcc/ira-lives.cc
index 98279bec6f1..984cb91e7fa 100644
--- a/gcc/ira-lives.cc
+++ b/gcc/ira-lives.cc
@@ -1553,14 +1553,14 @@ process_bb_node_lives (ira_loop_tree_node_t
loop_tree_node)
process_dependent_filters ();
process_single_reg_constrained_operands (false, freq);
- if (call_p)
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
/* Try to find a SET in the CALL_INSN_FUNCTION_USAGE, and from
there, try to find a pseudo that is live across the call but
can be cheaply reconstructed from the return value. */
- rtx cheap_reg = find_call_crossed_cheap_reg (insn);
+ rtx cheap_reg = find_call_crossed_cheap_reg (call);
if (cheap_reg != NULL_RTX)
- add_reg_note (insn, REG_RETURNED, cheap_reg);
+ add_reg_note (call, REG_RETURNED, cheap_reg);
last_call_num++;
sparseset_clear (allocnos_processed);
@@ -1570,22 +1570,22 @@ process_bb_node_lives (ira_loop_tree_node_t
loop_tree_node)
ira_object_t obj = ira_object_id_map[i];
a = OBJECT_ALLOCNO (obj);
int num = ALLOCNO_NUM (a);
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
/* Don't allocate allocnos that cross setjmps or any
call, if this function receives a nonlocal
goto. */
if (cfun->has_nonlocal_label
|| (!targetm.setjmp_preserves_nonvolatile_regs_p ()
- && (find_reg_note (insn, REG_SETJMP, NULL_RTX)
+ && (find_reg_note (call, REG_SETJMP, NULL_RTX)
!= NULL_RTX)))
{
SET_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj));
SET_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj));
}
eh_region r;
- if (can_throw_internal (insn)
- && (r = get_eh_region_from_rtx (insn)) != NULL)
+ if (can_throw_internal (call)
+ && (r = get_eh_region_from_rtx (call)) != NULL)
add_conflict_from_region_landing_pads (r, obj, callee_abi);
if (sparseset_bit_p (allocnos_processed, num))
continue;
diff --git a/gcc/ira.cc b/gcc/ira.cc
index dd8c64f5dcb..3c0866ec6f7 100644
--- a/gcc/ira.cc
+++ b/gcc/ira.cc
@@ -3188,7 +3188,7 @@ validate_equiv_mem (rtx_insn *start, rtx reg, rtx memref)
if (find_reg_note (insn, REG_DEAD, reg))
return ret;
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
/* We can combine a reg def from one insn into a reg use in
another over a call if the memory is readonly or the call
@@ -3200,7 +3200,7 @@ validate_equiv_mem (rtx_insn *start, rtx reg, rtx memref)
been changed and all hell breaks loose. */
ret = valid_combine;
if (!MEM_READONLY_P (memref)
- && (!RTL_CONST_OR_PURE_CALL_P (insn)
+ && (!RTL_CONST_OR_PURE_CALL_P (call)
|| equiv_init_varies_p (XEXP (memref, 0))))
return valid_none;
}
@@ -3466,7 +3466,8 @@ memref_used_between_p (rtx memref, rtx_insn *start,
rtx_insn *end)
return true;
/* Nonconst functions may access memory. */
- if (CALL_P (insn) && (! RTL_CONST_CALL_P (insn)))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call && ! RTL_CONST_CALL_P (call))
return true;
}
@@ -3609,8 +3610,8 @@ update_equiv_regs_prescan (void)
if (NONDEBUG_INSN_P (insn))
{
set_paradoxical_subreg (insn);
- if (CALL_P (insn))
- callee_abis.note_callee_abi (insn_callee_abi (insn));
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ callee_abis.note_callee_abi (insn_callee_abi (call));
}
HARD_REG_SET extra_caller_saves = callee_abis.caller_save_regs (*crtl->abi);
diff --git a/gcc/loop-invariant.cc b/gcc/loop-invariant.cc
index 8b82cdfbd7c..e6931f6fbe9 100644
--- a/gcc/loop-invariant.cc
+++ b/gcc/loop-invariant.cc
@@ -594,9 +594,10 @@ find_exits (class loop *loop, basic_block *body,
{
FOR_BB_INSNS (body[i], insn)
{
- if (CALL_P (insn)
- && (RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)
- || !RTL_CONST_OR_PURE_CALL_P (insn)))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call
+ && (RTL_LOOPING_CONST_OR_PURE_CALL_P (call)
+ || !RTL_CONST_OR_PURE_CALL_P (call)))
{
has_call = true;
bitmap_set_bit (may_exit, i);
@@ -1213,10 +1214,11 @@ find_invariants_bb (class loop *loop, basic_block bb,
bool always_reached,
find_invariants_insn (insn, always_reached, always_executed);
+ auto call = dyn_cast<rtx_call_insn *> (insn);
if (always_reached
- && CALL_P (insn)
- && (RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)
- || ! RTL_CONST_OR_PURE_CALL_P (insn)))
+ && call
+ && (RTL_LOOPING_CONST_OR_PURE_CALL_P (call)
+ || ! RTL_CONST_OR_PURE_CALL_P (call)))
always_reached = false;
}
}
diff --git a/gcc/loop-iv.cc b/gcc/loop-iv.cc
index 6ec9115c2a8..503c6620dea 100644
--- a/gcc/loop-iv.cc
+++ b/gcc/loop-iv.cc
@@ -1956,12 +1956,12 @@ simplify_using_initial_values (class loop *loop, enum
rtx_code op, rtx *expr)
CLEAR_REG_SET (this_altered);
note_stores (insn, mark_altered, this_altered);
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
/* Kill all registers that might be clobbered by the call.
We don't track modes of hard registers, so we need to be
conservative and assume that partial kills are full kills. */
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
IOR_REG_SET_HRS (this_altered,
callee_abi.full_and_partial_reg_clobbers ());
}
diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index e07905579f0..35e47735774 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -7615,11 +7615,12 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
}
last_processed_bb = curr_bb;
last_insn = get_last_insertion_point (curr_bb);
+ auto call = dyn_cast<rtx_call_insn *> (last_insn);
after_p = (! JUMP_P (last_insn)
- && (! CALL_P (last_insn)
- || (find_reg_note (last_insn,
+ && (! call
+ || (find_reg_note (call,
REG_NORETURN, NULL_RTX) == NULL_RTX
- && ! SIBLING_CALL_P (last_insn))));
+ && ! SIBLING_CALL_P (call))));
CLEAR_HARD_REG_SET (potential_reload_hard_regs);
EXECUTE_IF_SET_IN_BITMAP (to_process, 0, j, bi)
{
@@ -7796,19 +7797,19 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
ALL_REGS, curr_insn,
to_inherit[i].insns))
change_p = true;
- if (CALL_P (curr_insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (curr_insn))
{
rtx cheap, pat, dest;
rtx_insn *restore;
int regno, hard_regno;
calls_num++;
- function_abi callee_abi = insn_callee_abi (curr_insn);
+ function_abi callee_abi = insn_callee_abi (call);
last_call_for_abi[callee_abi.id ()] = calls_num;
full_and_partial_call_clobbers
|= callee_abi.full_and_partial_reg_clobbers ();
- first_call_insn = curr_insn;
- if ((cheap = find_reg_note (curr_insn,
+ first_call_insn = call;
+ if ((cheap = find_reg_note (call,
REG_RETURNED, NULL_RTX)) != NULL_RTX
&& ((cheap = XEXP (cheap, 0)), true)
&& (regno = REGNO (cheap)) >= FIRST_PSEUDO_REGISTER
@@ -7823,7 +7824,7 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
REG_RETURNED note says that the pseudo value is
in the call result and the pseudo is an argument
of the call. */
- pat = PATTERN (curr_insn);
+ pat = PATTERN (call);
if (GET_CODE (pat) == PARALLEL)
pat = XVECEXP (pat, 0, 0);
dest = SET_DEST (pat);
@@ -7834,7 +7835,7 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
start_sequence ();
emit_move_insn (cheap, copy_rtx (dest));
restore = end_sequence ();
- lra_process_new_insns (curr_insn, NULL, restore,
+ lra_process_new_insns (call, NULL, restore,
"Inserting call parameter
restore");
/* We don't need to save/restore of the pseudo from
this call. */
diff --git a/gcc/lra-lives.cc b/gcc/lra-lives.cc
index 15b6b7c8c54..a678355fab2 100644
--- a/gcc/lra-lives.cc
+++ b/gcc/lra-lives.cc
@@ -706,7 +706,6 @@ process_bb_lives (basic_block bb, int &curr_point, bool
dead_insn_p)
it probably doesn't matter much in practice. */
FOR_BB_INSNS_REVERSE_SAFE (bb, curr_insn, next)
{
- bool call_p;
int n_alt, dst_regno, src_regno;
rtx set;
struct lra_insn_reg *reg;
@@ -786,7 +785,6 @@ process_bb_lives (basic_block bb, int &curr_point, bool
dead_insn_p)
lra_hard_reg_usage[regno] += freq;
}
- call_p = CALL_P (curr_insn);
/* If we have a simple register copy and the source reg is live after
this instruction, then remove the source reg from the live set so
@@ -911,9 +909,9 @@ process_bb_lives (basic_block bb, int &curr_point, bool
dead_insn_p)
/* It is a clobber. */
make_hard_regno_dead (regno - FIRST_PSEUDO_REGISTER);
- if (call_p)
+ if (auto call = dyn_cast<rtx_call_insn *> (curr_insn))
{
- function_abi call_abi = insn_callee_abi (curr_insn);
+ function_abi call_abi = insn_callee_abi (call);
if (last_call_abi != call_abi)
EXECUTE_IF_SET_IN_SPARSESET (pseudos_live, j)
@@ -925,7 +923,7 @@ process_bb_lives (basic_block bb, int &curr_point, bool
dead_insn_p)
pseudos_live_through_calls, pseudos_live);
if (cfun->has_nonlocal_label
|| (!targetm.setjmp_preserves_nonvolatile_regs_p ()
- && (find_reg_note (curr_insn, REG_SETJMP, NULL_RTX)
+ && (find_reg_note (call, REG_SETJMP, NULL_RTX)
!= NULL_RTX)))
sparseset_ior (pseudos_live_through_setjumps,
pseudos_live_through_setjumps, pseudos_live);
diff --git a/gcc/lra-remat.cc b/gcc/lra-remat.cc
index 815fe187a73..3bfa74f22ad 100644
--- a/gcc/lra-remat.cc
+++ b/gcc/lra-remat.cc
@@ -634,10 +634,10 @@ set_bb_regs (basic_block bb, rtx_insn *insn)
if (regno >= FIRST_PSEUDO_REGISTER && reg->subreg_p)
bitmap_set_bit (&subreg_regs, regno);
}
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
/* Partially-clobbered registers might still be live. */
- HARD_REG_SET clobbers = insn_callee_abi (insn).full_reg_clobbers ();
+ HARD_REG_SET clobbers = insn_callee_abi (call).full_reg_clobbers ();
bitmap_ior_into (&get_remat_bb_data (bb)->dead_regs,
bitmap_view<HARD_REG_SET> (clobbers));
}
@@ -809,9 +809,9 @@ calculate_gen_cands (void)
}
}
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
EXECUTE_IF_SET_IN_BITMAP (gen_insns, 0, uid, bi)
{
rtx_insn *insn2 = lra_insn_recog_data[uid]->insn;
@@ -1223,9 +1223,9 @@ do_remat (void)
bitmap_set_bit (&temp_bitmap, cand->index);
}
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
EXECUTE_IF_SET_IN_BITMAP (avail_cands, 0, cid, bi)
{
cand = all_cands[cid];
diff --git a/gcc/lra-spills.cc b/gcc/lra-spills.cc
index f55839f50b7..d76f8a84432 100644
--- a/gcc/lra-spills.cc
+++ b/gcc/lra-spills.cc
@@ -556,13 +556,15 @@ spill_pseudos (void)
{
bool removed_pseudo_p = false;
+ rtx_call_insn *call;
if (bitmap_bit_p (changed_insns, INSN_UID (insn)))
{
rtx *link_loc, link;
removed_pseudo_p = remove_pseudos (&PATTERN (insn), insn);
- if (CALL_P (insn)
- && remove_pseudos (&CALL_INSN_FUNCTION_USAGE (insn), insn))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call
+ && remove_pseudos (&CALL_INSN_FUNCTION_USAGE (call), call))
removed_pseudo_p = true;
for (link_loc = ®_NOTES (insn);
(link = *link_loc) != NULL_RTX;
@@ -598,7 +600,7 @@ spill_pseudos (void)
if (lra_reg_spill_p || targetm.different_addr_displacement_p ())
lra_set_used_insn_alternative (insn, LRA_UNKNOWN_ALT);
}
- else if (CALL_P (insn)
+ else if ((call = dyn_cast<rtx_call_insn *> (insn))
/* Presence of any pseudo in CALL_INSN_FUNCTION_USAGE
does not affect value of insn_bitmap of the
corresponding lra_reg_info. That is because we
@@ -607,7 +609,7 @@ spill_pseudos (void)
insns in the insn_bitmap of given pseudo here, we
can miss the pseudo in some
CALL_INSN_FUNCTION_USAGEs. */
- && remove_pseudos (&CALL_INSN_FUNCTION_USAGE (insn), insn))
+ && remove_pseudos (&CALL_INSN_FUNCTION_USAGE (call), call))
removed_pseudo_p = true;
if (removed_pseudo_p)
{
diff --git a/gcc/lra.cc b/gcc/lra.cc
index e25710dc7d7..4ec432a51fc 100644
--- a/gcc/lra.cc
+++ b/gcc/lra.cc
@@ -1128,7 +1128,7 @@ lra_set_insn_recog_data (rtx_insn *insn)
= collect_non_operand_hard_regs (insn, &PATTERN (insn), data,
NULL, OP_IN, false);
data->arg_hard_regs = NULL;
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
bool use_p;
rtx link;
@@ -1138,7 +1138,7 @@ lra_set_insn_recog_data (rtx_insn *insn)
/* Finding implicit hard register usage. We believe it will be
not changed whatever transformations are used. Call insns
are such example. */
- for (link = CALL_INSN_FUNCTION_USAGE (insn);
+ for (link = CALL_INSN_FUNCTION_USAGE (call);
link != NULL_RTX;
link = XEXP (link, 1))
if (((use_p = GET_CODE (XEXP (link, 0)) == USE)
@@ -1679,12 +1679,12 @@ lra_update_insn_regno_info (rtx_insn *insn)
if ((code = GET_CODE (PATTERN (insn))) == CLOBBER || code == USE)
add_regs_to_insn_regno_info (data, XEXP (PATTERN (insn), 0), insn,
code == USE ? OP_IN : OP_OUT, 0);
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
/* On some targets call insns can refer to pseudos in memory in
CALL_INSN_FUNCTION_USAGE list. Process them in order to
consider their occurrences in calls for different
transformations (e.g. inheritance) with given pseudos. */
- for (link = CALL_INSN_FUNCTION_USAGE (insn);
+ for (link = CALL_INSN_FUNCTION_USAGE (call);
link != NULL_RTX;
link = XEXP (link, 1))
{
diff --git a/gcc/postreload-gcse.cc b/gcc/postreload-gcse.cc
index 5cf9191e932..74479269749 100644
--- a/gcc/postreload-gcse.cc
+++ b/gcc/postreload-gcse.cc
@@ -769,21 +769,21 @@ record_opr_changes (rtx_insn *insn)
record_last_reg_set_info (insn, XEXP (note, 0));
/* Finally, if this is a call, record all call clobbers. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
unsigned int regno;
hard_reg_set_iterator hrsi;
/* We don't track modes of hard registers, so we need to be
conservative and assume that partial kills are full kills. */
HARD_REG_SET callee_clobbers
- = insn_callee_abi (insn).full_and_partial_reg_clobbers ();
+ = insn_callee_abi (call).full_and_partial_reg_clobbers ();
EXECUTE_IF_SET_IN_HARD_REG_SET (callee_clobbers, 0, regno, hrsi)
- record_last_reg_set_info_regno (insn, regno);
+ record_last_reg_set_info_regno (call, regno);
- if (! RTL_CONST_OR_PURE_CALL_P (insn)
- || RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)
- || can_throw_external (insn))
- record_last_mem_set_info (insn);
+ if (! RTL_CONST_OR_PURE_CALL_P (call)
+ || RTL_LOOPING_CONST_OR_PURE_CALL_P (call)
+ || can_throw_external (call))
+ record_last_mem_set_info (call);
}
}
diff --git a/gcc/postreload.cc b/gcc/postreload.cc
index 475b5889629..9b62404d20e 100644
--- a/gcc/postreload.cc
+++ b/gcc/postreload.cc
@@ -1460,10 +1460,10 @@ reload_combine (void)
note_stores (insn, reload_combine_note_store, NULL);
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
rtx link;
- HARD_REG_SET used_regs = insn_callee_abi (insn).full_reg_clobbers ();
+ HARD_REG_SET used_regs = insn_callee_abi (call).full_reg_clobbers ();
hard_reg_set_iterator hrsi2;
EXECUTE_IF_SET_IN_HARD_REG_SET (used_regs, 0, r, hrsi2)
@@ -1472,7 +1472,7 @@ reload_combine (void)
reg_state[r].store_ruid = reload_combine_ruid;
}
- for (link = CALL_INSN_FUNCTION_USAGE (insn); link;
+ for (link = CALL_INSN_FUNCTION_USAGE (call); link;
link = XEXP (link, 1))
{
rtx setuse = XEXP (link, 0);
@@ -2082,9 +2082,9 @@ reload_cse_move2add_invalidate (rtx_insn *insn)
/* If this is a CALL_INSN, all call used registers are stored with
unknown values. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
for (int i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--)
if (reg_mode[i] != VOIDmode
&& reg_mode[i] != BLKmode
diff --git a/gcc/print-rtl.cc b/gcc/print-rtl.cc
index d7fddf2f8ee..bb33d2ac8a9 100644
--- a/gcc/print-rtl.cc
+++ b/gcc/print-rtl.cc
@@ -628,13 +628,13 @@ rtx_writer::print_rtx_operand_code_u (const_rtx in_rtx,
int idx)
if (GET_CODE (in_rtx) == LABEL_REF)
{
- if (subc == NOTE
- && NOTE_KIND (sub) == NOTE_INSN_DELETED_LABEL)
+ rtx_note *note = dyn_cast<rtx_note *> (sub);
+ if (note && NOTE_KIND (note) == NOTE_INSN_DELETED_LABEL)
{
if (flag_dump_unnumbered)
fprintf (m_outfile, " [# deleted]");
else
- fprintf (m_outfile, " [%d deleted]", INSN_UID (sub));
+ fprintf (m_outfile, " [%d deleted]", INSN_UID (note));
m_sawclose = false;
return;
}
diff --git a/gcc/reg-stack.cc b/gcc/reg-stack.cc
index 47b94e791c2..f24aa85d42e 100644
--- a/gcc/reg-stack.cc
+++ b/gcc/reg-stack.cc
@@ -2447,8 +2447,8 @@ subst_stack_regs (rtx_insn *insn, stack_ptr regstack)
/* If the target of the call doesn't clobber any stack registers,
Don't clear the arguments. */
- if (CALL_P (insn)
- && callee_clobbers_any_stack_reg (insn_callee_abi (insn)))
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call && callee_clobbers_any_stack_reg (insn_callee_abi (call)))
{
int top = regstack->top;
@@ -2458,7 +2458,7 @@ subst_stack_regs (rtx_insn *insn, stack_ptr regstack)
if (top >= 0)
{
- straighten_stack (insn, regstack);
+ straighten_stack (call, regstack);
/* Now mark the arguments as dead after the call. */
diff --git a/gcc/regcprop.cc b/gcc/regcprop.cc
index 9ef99d6838d..db56950c9cc 100644
--- a/gcc/regcprop.cc
+++ b/gcc/regcprop.cc
@@ -1131,14 +1131,14 @@ copyprop_hardreg_forward_1 (basic_block bb, struct
value_data *vd)
ksvd.insn_is_frame_related = false;
/* Clobber call-clobbered registers. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
unsigned int set_regno = INVALID_REGNUM;
unsigned int set_nregs = 0;
unsigned int regno;
rtx exp;
- for (exp = CALL_INSN_FUNCTION_USAGE (insn); exp; exp = XEXP (exp, 1))
+ for (exp = CALL_INSN_FUNCTION_USAGE (call); exp; exp = XEXP (exp, 1))
{
rtx x = XEXP (exp, 0);
if (GET_CODE (x) == SET)
@@ -1154,7 +1154,7 @@ copyprop_hardreg_forward_1 (basic_block bb, struct
value_data *vd)
}
}
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (vd->e[regno].mode != VOIDmode
&& callee_abi.clobbers_reg_p (vd->e[regno].mode, regno)
@@ -1166,7 +1166,7 @@ copyprop_hardreg_forward_1 (basic_block bb, struct
value_data *vd)
CLOBBERs on the CALL_INSN, we could wrongly assume the
value in it is still live. */
if (ksvd.ignore_set_reg)
- kill_clobbered_values (insn, vd);
+ kill_clobbered_values (call, vd);
}
bool copy_p = (set
diff --git a/gcc/regrename.cc b/gcc/regrename.cc
index bc02b28117f..a0331dcd8d0 100644
--- a/gcc/regrename.cc
+++ b/gcc/regrename.cc
@@ -1815,8 +1815,9 @@ build_def_use (basic_block bb)
restore_operands (insn, n_ops, old_operands, old_dups);
/* Step 2B: Can't rename function call argument registers. */
- if (CALL_P (insn) && CALL_INSN_FUNCTION_USAGE (insn))
- scan_rtx (insn, &CALL_INSN_FUNCTION_USAGE (insn),
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call && CALL_INSN_FUNCTION_USAGE (call))
+ scan_rtx (call, &CALL_INSN_FUNCTION_USAGE (call),
NO_REGS, mark_all_read, OP_IN);
/* Step 2C: Can't rename asm operands that were originally
@@ -1889,9 +1890,9 @@ build_def_use (basic_block bb)
/* Step 4B: If this is a call, any chain live at this point
requires a caller-saved reg. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
class du_head *p;
for (p = open_chains; p; p = p->next_chain)
{
diff --git a/gcc/reload.cc b/gcc/reload.cc
index 71aa30598ad..06813fbba9b 100644
--- a/gcc/reload.cc
+++ b/gcc/reload.cc
@@ -6940,12 +6940,12 @@ find_equiv_reg (rtx goal, rtx_insn *insn, enum
reg_class rclass, int other,
/* Don't trust the conversion past a function call
if either of the two is in a call-clobbered register, or memory. */
- if (CALL_P (p))
+ if (auto call = dyn_cast<rtx_call_insn *> (p))
{
if (goal_mem || need_stable_sp)
return 0;
- function_abi callee_abi = insn_callee_abi (p);
+ function_abi callee_abi = insn_callee_abi (call);
if (regno >= 0
&& regno < FIRST_PSEUDO_REGISTER
&& callee_abi.clobbers_reg_p (mode, regno))
@@ -7048,11 +7048,12 @@ find_equiv_reg (rtx goal, rtx_insn *insn, enum
reg_class rclass, int other,
}
}
- if (CALL_P (p) && CALL_INSN_FUNCTION_USAGE (p))
+ auto call = dyn_cast<rtx_call_insn *> (p);
+ if (call && CALL_INSN_FUNCTION_USAGE (call))
{
rtx link;
- for (link = CALL_INSN_FUNCTION_USAGE (p); XEXP (link, 1) != 0;
+ for (link = CALL_INSN_FUNCTION_USAGE (call); XEXP (link, 1) != 0;
link = XEXP (link, 1))
{
pat = XEXP (link, 0);
diff --git a/gcc/reload1.cc b/gcc/reload1.cc
index 97b7e732be2..2a54973034b 100644
--- a/gcc/reload1.cc
+++ b/gcc/reload1.cc
@@ -1179,9 +1179,9 @@ reload (rtx_insn *first, int global)
{
rtx *pnote;
- if (CALL_P (insn))
- replace_pseudos_in (& CALL_INSN_FUNCTION_USAGE (insn),
- VOIDmode, CALL_INSN_FUNCTION_USAGE (insn));
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ replace_pseudos_in (& CALL_INSN_FUNCTION_USAGE (call),
+ VOIDmode, CALL_INSN_FUNCTION_USAGE (call));
if ((GET_CODE (PATTERN (insn)) == USE
/* We mark with QImode USEs introduced by reload itself. */
@@ -4775,16 +4775,16 @@ reload_as_needed (int live_known)
/* Don't assume a reload reg is still good after a call insn
if it is a call-used reg, or if it contains a value that will
be partially clobbered by the call. */
- else if (CALL_P (insn))
+ else if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
reg_reloaded_valid
- &= ~insn_callee_abi (insn).full_and_partial_reg_clobbers ();
+ &= ~insn_callee_abi (call).full_and_partial_reg_clobbers ();
/* If this is a call to a setjmp-type function, we must not
reuse any reload reg contents across the call; that will
just be clobbered by other uses of the register in later
code, before the longjmp. */
- if (find_reg_note (insn, REG_SETJMP, NULL_RTX))
+ if (find_reg_note (call, REG_SETJMP, NULL_RTX))
CLEAR_HARD_REG_SET (reg_reloaded_valid);
}
}
@@ -8722,8 +8722,9 @@ delete_output_reload (rtx_insn *insn, int j, int
last_reload_reg,
}
}
n_occurrences = count_occurrences (PATTERN (insn), reg, 0);
- if (CALL_P (insn) && CALL_INSN_FUNCTION_USAGE (insn))
- n_occurrences += count_occurrences (CALL_INSN_FUNCTION_USAGE (insn),
+ auto call = dyn_cast<rtx_call_insn *> (insn);
+ if (call && CALL_INSN_FUNCTION_USAGE (call))
+ n_occurrences += count_occurrences (CALL_INSN_FUNCTION_USAGE (call),
reg, 0);
if (substed)
n_occurrences += count_occurrences (PATTERN (insn),
diff --git a/gcc/reorg.cc b/gcc/reorg.cc
index a0db455e0c4..6616e6d150b 100644
--- a/gcc/reorg.cc
+++ b/gcc/reorg.cc
@@ -2903,8 +2903,9 @@ delete_prior_computation (rtx note, rtx_insn *insn)
/* If we reach a CALL which is not calling a const function
or the callee pops the arguments, then give up. */
- if (CALL_P (our_prev)
- && (! RTL_CONST_CALL_P (our_prev)
+ auto call = dyn_cast<rtx_call_insn *> (our_prev);
+ if (call
+ && (! RTL_CONST_CALL_P (call)
|| GET_CODE (pat) != SET || GET_CODE (SET_SRC (pat)) != CALL))
break;
diff --git a/gcc/resource.cc b/gcc/resource.cc
index d5adefecefb..a3f108a9b13 100644
--- a/gcc/resource.cc
+++ b/gcc/resource.cc
@@ -800,16 +800,16 @@ mark_target_live_regs (rtx_insn *insns, rtx
target_maybe_return, struct resource
&& INSN_P (XEXP (PATTERN (insn), 0)))
real_insn = as_a <rtx_insn *> (XEXP (PATTERN (insn), 0));
- if (CALL_P (real_insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (real_insn))
{
/* Values in call-clobbered registers survive a COND_EXEC CALL
if that is not executed; this matters for resource use because
they may be used by a complementarily (or more strictly)
predicated instruction, or if the CALL is NORETURN. */
- if (GET_CODE (PATTERN (real_insn)) != COND_EXEC)
+ if (GET_CODE (PATTERN (call)) != COND_EXEC)
{
HARD_REG_SET regs_invalidated_by_this_call
- = insn_callee_abi (real_insn).full_reg_clobbers ();
+ = insn_callee_abi (call).full_reg_clobbers ();
/* CALL clobbers all call-used regs that aren't fixed except
sp, ap, and fp. Do this before setting the result of the
call live. */
diff --git a/gcc/rtlanal.cc b/gcc/rtlanal.cc
index 568c9eaca11..86af7f4984c 100644
--- a/gcc/rtlanal.cc
+++ b/gcc/rtlanal.cc
@@ -1256,12 +1256,13 @@ reg_set_p (const_rtx reg, const_rtx uncast_insn)
/* We can be passed an insn or part of one. If we are passed an insn,
check if a side-effect of the insn clobbers REG. */
+ auto call = dyn_cast<const rtx_call_insn *> (insn);
if (INSN_P (insn)
&& (FIND_REG_INC_NOTE (insn, reg)
- || (CALL_P (insn)
+ || (call
&& ((REG_P (reg)
&& REGNO (reg) < FIRST_PSEUDO_REGISTER
- && (insn_callee_abi (insn)
+ && (insn_callee_abi (call)
.clobbers_reg_p (GET_MODE (reg), REGNO (reg))))
|| MEM_P (reg)
|| find_reg_fusage (insn, CLOBBER, reg)))))
@@ -1519,8 +1520,9 @@ find_all_hard_reg_sets (const rtx_insn *insn,
HARD_REG_SET *pset, bool implicit)
CLEAR_HARD_REG_SET (*pset);
note_stores (insn, record_hard_reg_sets, pset);
- if (CALL_P (insn) && implicit)
- *pset |= insn_callee_abi (insn).full_reg_clobbers ();
+ auto call = dyn_cast<const rtx_call_insn *> (insn);
+ if (call && implicit)
+ *pset |= insn_callee_abi (call).full_reg_clobbers ();
for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
if (REG_NOTE_KIND (link) == REG_INC)
record_hard_reg_sets (XEXP (link, 0), NULL, pset);
@@ -1992,8 +1994,8 @@ void
note_stores (const rtx_insn *insn,
void (*fun) (rtx, const_rtx, void *), void *data)
{
- if (CALL_P (insn))
- for (rtx link = CALL_INSN_FUNCTION_USAGE (insn);
+ if (auto call = dyn_cast<const rtx_call_insn *> (insn))
+ for (rtx link = CALL_INSN_FUNCTION_USAGE (call);
link; link = XEXP (link, 1))
if (GET_CODE (XEXP (link, 0)) == CLOBBER)
note_pattern_stores (XEXP (link, 0), fun, data);
@@ -2315,7 +2317,7 @@ rtx_properties::try_to_add_pattern (const_rtx pat)
void
rtx_properties::try_to_add_insn (const rtx_insn *insn, bool include_notes)
{
- if (CALL_P (insn))
+ if (auto call = dyn_cast<const rtx_call_insn *> (insn))
{
/* Non-const functions can read from global registers. Impure
functions can also set them.
@@ -2324,10 +2326,10 @@ rtx_properties::try_to_add_insn (const rtx_insn *insn,
bool include_notes)
a fixed-form clobber of register R could come before a real set
of register R. */
if (!hard_reg_set_empty_p (global_reg_set)
- && !RTL_CONST_CALL_P (insn))
+ && !RTL_CONST_CALL_P (call))
{
unsigned int flags = rtx_obj_flags::IS_READ;
- if (!RTL_PURE_CALL_P (insn))
+ if (!RTL_PURE_CALL_P (call))
flags |= rtx_obj_flags::IS_WRITE;
for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
/* As a special case, the stack pointer is invariant across calls
@@ -2342,21 +2344,21 @@ rtx_properties::try_to_add_insn (const rtx_insn *insn,
bool include_notes)
/* Untyped calls implicitly set all function value registers.
Again, we add them first in case the main pattern contains
a fixed-form clobber. */
- if (find_reg_note (insn, REG_UNTYPED_CALL, NULL_RTX))
+ if (find_reg_note (call, REG_UNTYPED_CALL, NULL_RTX))
for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
if (targetm.calls.function_value_regno_p (regno)
&& ref_iter != ref_end)
*ref_iter++ = rtx_obj_reference (regno, rtx_obj_flags::IS_WRITE,
reg_raw_mode[regno], 0);
- if (ref_iter != ref_end && !RTL_CONST_CALL_P (insn))
+ if (ref_iter != ref_end && !RTL_CONST_CALL_P (call))
{
auto mem_flags = rtx_obj_flags::IS_READ;
- if (!RTL_PURE_CALL_P (insn))
+ if (!RTL_PURE_CALL_P (call))
mem_flags |= rtx_obj_flags::IS_WRITE;
*ref_iter++ = rtx_obj_reference (MEM_REGNO, mem_flags, BLKmode);
}
- try_to_add_pattern (PATTERN (insn));
- for (rtx link = CALL_INSN_FUNCTION_USAGE (insn); link;
+ try_to_add_pattern (PATTERN (call));
+ for (rtx link = CALL_INSN_FUNCTION_USAGE (call); link;
link = XEXP (link, 1))
{
rtx x = XEXP (link, 0);
@@ -2634,7 +2636,8 @@ find_reg_fusage (const rtx_insn *insn, enum rtx_code
code, const_rtx datum)
{
/* If it's not a CALL_INSN, it can't possibly have a
CALL_INSN_FUNCTION_USAGE field, so don't bother checking. */
- if (!CALL_P (insn))
+ auto call = dyn_cast<const rtx_call_insn *> (insn);
+ if (!call)
return false;
gcc_assert (datum);
@@ -2643,7 +2646,7 @@ find_reg_fusage (const rtx_insn *insn, enum rtx_code
code, const_rtx datum)
{
rtx link;
- for (link = CALL_INSN_FUNCTION_USAGE (insn);
+ for (link = CALL_INSN_FUNCTION_USAGE (call);
link;
link = XEXP (link, 1))
if (GET_CODE (XEXP (link, 0)) == code
@@ -2663,7 +2666,7 @@ find_reg_fusage (const rtx_insn *insn, enum rtx_code
code, const_rtx datum)
unsigned int i;
for (i = regno; i < end_regno; i++)
- if (find_regno_fusage (insn, code, i))
+ if (find_regno_fusage (call, code, i))
return true;
}
}
@@ -2682,11 +2685,11 @@ find_regno_fusage (const rtx_insn *insn, enum rtx_code
code, unsigned int regno)
/* CALL_INSN_FUNCTION_USAGE information cannot contain references
to pseudo registers, so don't bother checking. */
- if (regno >= FIRST_PSEUDO_REGISTER
- || !CALL_P (insn) )
+ auto call = dyn_cast<const rtx_call_insn *> (insn);
+ if (regno >= FIRST_PSEUDO_REGISTER || !call)
return false;
- for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
+ for (link = CALL_INSN_FUNCTION_USAGE (call); link; link = XEXP (link, 1))
{
rtx op, reg;
@@ -3454,8 +3457,9 @@ replace_label (rtx *loc, rtx_insn *old_label, rtx_insn
*new_label,
/* If this is a JUMP_INSN, then we also need to fix the JUMP_LABEL
field. This is not handled by the iterator because it doesn't
handle unprinted ('0') fields. */
- if (JUMP_P (x) && JUMP_LABEL (x) == old_label)
- JUMP_LABEL (x) = new_label;
+ auto jump = dyn_cast<rtx_jump_insn *> (x);
+ if (jump && JUMP_LABEL (jump) == old_label)
+ JUMP_LABEL (jump) = new_label;
subrtx_ptr_iterator::array_type array;
FOR_EACH_SUBRTX_PTR (iter, array, loc, ALL)
diff --git a/gcc/sched-deps.cc b/gcc/sched-deps.cc
index 5b8001f64ee..46a500b2951 100644
--- a/gcc/sched-deps.cc
+++ b/gcc/sched-deps.cc
@@ -3020,20 +3020,20 @@ sched_analyze_insn (class deps_desc *deps, rtx x,
rtx_insn *insn)
sched_analyze_2 (deps, x, insn);
/* Mark registers CLOBBERED or used by called function. */
- if (CALL_P (insn))
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
- for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
+ for (link = CALL_INSN_FUNCTION_USAGE (call); link; link = XEXP (link, 1))
{
if (GET_CODE (XEXP (link, 0)) == CLOBBER)
- sched_analyze_1 (deps, XEXP (link, 0), insn);
+ sched_analyze_1 (deps, XEXP (link, 0), call);
else if (GET_CODE (XEXP (link, 0)) != SET)
- sched_analyze_2 (deps, XEXP (link, 0), insn);
+ sched_analyze_2 (deps, XEXP (link, 0), call);
}
/* Don't schedule anything after a tail call, tail call needs
to use at least all call-saved registers. */
- if (SIBLING_CALL_P (insn))
+ if (SIBLING_CALL_P (call))
reg_pending_barrier = TRUE_BARRIER;
- else if (find_reg_note (insn, REG_SETJMP, NULL))
+ else if (find_reg_note (call, REG_SETJMP, NULL))
reg_pending_barrier = MOVE_BARRIER;
}
@@ -3836,11 +3836,11 @@ deps_analyze_insn (class deps_desc *deps, rtx_insn
*insn)
{
sched_analyze_insn (deps, PATTERN (insn), insn);
}
- else if (CALL_P (insn))
+ else if (auto call = dyn_cast<rtx_call_insn *> (insn))
{
int i;
- CANT_MOVE (insn) = 1;
+ CANT_MOVE (call) = 1;
if (!reload_completed)
{
@@ -3849,7 +3849,7 @@ deps_analyze_insn (class deps_desc *deps, rtx_insn *insn)
it may incorrectly move up an assignment over a longjmp. */
reg_pending_barrier = MOVE_BARRIER;
}
- else if (find_reg_note (insn, REG_SETJMP, NULL))
+ else if (find_reg_note (call, REG_SETJMP, NULL))
{
/* This is setjmp. Assume that all registers, not just
hard registers, may be clobbered by this call. */
@@ -3857,7 +3857,7 @@ deps_analyze_insn (class deps_desc *deps, rtx_insn *insn)
}
else
{
- function_abi callee_abi = insn_callee_abi (insn);
+ function_abi callee_abi = insn_callee_abi (call);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
/* A call may read and modify global register variables. */
if (global_regs[i])
@@ -3889,11 +3889,11 @@ deps_analyze_insn (class deps_desc *deps, rtx_insn
*insn)
/* For each insn which shouldn't cross a call, add a dependence
between that insn and this call insn. */
- add_dependence_list_and_free (deps, insn,
+ add_dependence_list_and_free (deps, call,
&deps->sched_before_next_call, 1,
REG_DEP_ANTI, true);
- sched_analyze_insn (deps, PATTERN (insn), insn);
+ sched_analyze_insn (deps, PATTERN (call), call);
/* If CALL would be in a sched group, then this will violate
convention that sched group insns have dependencies only on the
@@ -3902,27 +3902,27 @@ deps_analyze_insn (class deps_desc *deps, rtx_insn
*insn)
Of course one can say: "Hey! What about head of the sched group?"
And I will answer: "Basic principles (one dep per insn) are always
the same." */
- gcc_assert (!SCHED_GROUP_P (insn));
+ gcc_assert (!SCHED_GROUP_P (call));
/* In the absence of interprocedural alias analysis, we must flush
all pending reads and writes, and start new dependencies starting
from here. But only flush writes for constant calls (which may
be passed a pointer to something we haven't written yet). */
- flush_pending_lists (deps, insn, true, ! RTL_CONST_OR_PURE_CALL_P
(insn));
+ flush_pending_lists (deps, call, true, ! RTL_CONST_OR_PURE_CALL_P
(call));
if (!deps->readonly)
{
/* Remember the last function call for limiting lifetimes. */
free_INSN_LIST_list (&deps->last_function_call);
- deps->last_function_call = alloc_INSN_LIST (insn, NULL_RTX);
+ deps->last_function_call = alloc_INSN_LIST (call, NULL_RTX);
- if (call_may_noreturn_p (insn))
+ if (call_may_noreturn_p (call))
{
/* Remember the last function call that might not always return
normally for limiting moves of trapping insns. */
free_INSN_LIST_list (&deps->last_function_call_may_noreturn);
deps->last_function_call_may_noreturn
- = alloc_INSN_LIST (insn, NULL_RTX);
+ = alloc_INSN_LIST (call, NULL_RTX);
}
/* Before reload, begin a post-call group, so as to keep the
diff --git a/gcc/sel-sched.cc b/gcc/sel-sched.cc
index e79b087045f..8315631df05 100644
--- a/gcc/sel-sched.cc
+++ b/gcc/sel-sched.cc
@@ -6016,8 +6016,8 @@ fur_orig_expr_found (insn_t insn, expr_t expr
ATTRIBUTE_UNUSED,
fur_static_params_p params = (fur_static_params_p) static_params;
regset tmp;
- if (CALL_P (insn))
- params->crossed_call_abis |= 1 << insn_callee_abi (insn).id ();
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ params->crossed_call_abis |= 1 << insn_callee_abi (call).id ();
def_list_add (params->original_insns, insn, params->crossed_call_abis);
@@ -6233,8 +6233,8 @@ fur_orig_expr_not_found (insn_t insn, av_set_t orig_ops,
void *static_params)
av_set_iterator avi;
fur_static_params_p sparams = (fur_static_params_p) static_params;
- if (CALL_P (insn))
- sparams->crossed_call_abis |= 1 << insn_callee_abi (insn).id ();
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ sparams->crossed_call_abis |= 1 << insn_callee_abi (call).id ();
else if (DEBUG_INSN_P (insn))
return true;
diff --git a/gcc/store-motion.cc b/gcc/store-motion.cc
index 1db914c3306..9c7e0a20e2a 100644
--- a/gcc/store-motion.cc
+++ b/gcc/store-motion.cc
@@ -375,11 +375,11 @@ store_killed_in_insn (const_rtx x, const vec<rtx> &x_regs,
if (! NONDEBUG_INSN_P (insn))
return false;
- if (CALL_P (insn))
+ if (auto call = dyn_cast<const rtx_call_insn *> (insn))
{
/* A normal or pure call might read from pattern,
but a const call will not. */
- if (!RTL_CONST_CALL_P (insn))
+ if (!RTL_CONST_CALL_P (call))
return true;
/* But even a const call reads its parameters. Check whether the
diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc
index 71f1edbae93..b08043df4e0 100644
--- a/gcc/var-tracking.cc
+++ b/gcc/var-tracking.cc
@@ -10295,8 +10295,8 @@ vt_initialize (void)
if (MAY_HAVE_DEBUG_BIND_INSNS)
{
- if (CALL_P (insn))
- prepare_call_arguments (bb, insn);
+ if (auto call = dyn_cast<rtx_call_insn *> (insn))
+ prepare_call_arguments (bb, call);
cselib_process_insn (insn);
if (dump_file && (dump_flags & TDF_DETAILS))
{
--
2.53.0