https://gcc.gnu.org/g:6261c3f7d814da6c455f23e156a49b5af0824682
commit r17-6198-g6261c3f7d814da6c455f23e156a49b5af0824682 Author: Trevor Saunders <[email protected]> Date: Mon Nov 9 18:44:20 2026 +0000 Use tighter insn types where the pointer is already an insn Callers already pass an rtx_call_insn *, an emit result, or a note. No new cast. gcc/ChangeLog: * config/arm/aarch-bti-insert.cc (call_needs_bti_j): Take an rtx_call_insn *. * sched-deps.cc (call_may_noreturn_p): Likewise. * ira-lives.cc (find_call_crossed_cheap_reg): Likewise. * dse.cc (get_call_args): Likewise. * cse.cc (invalidate_for_call): Likewise. * var-tracking.cc (prepare_call_arguments): Likewise. (reemit_marker_as_note): Return an rtx_note *. * early-remat.cc (early_remat::restrict_remat_for_call): Take an rtx_call_insn *. (remat_block_info, early_remat::process_block): Record the last call as an rtx_call_insn *. * config/i386/i386-expand.cc (ix86_expand_strlensi_unroll_1, ix86_expand_sse_compare_and_jump): Keep the emitted jump in an rtx_insn *. * config/i386/i386.md (@x86_shift<mode>_adj_2, @x86_shift<mode>_adj_3): Likewise. * config/pa/pa.cc (pa_combine_instructions): Keep the emitted jump in an rtx_jump_insn *. * valtrack.cc (dead_debug_insert_temp): Keep the debug insn in an rtx_insn *. Signed-off-by: Trevor Saunders <[email protected]> Diff: --- gcc/config/arm/aarch-bti-insert.cc | 2 +- gcc/config/i386/i386-expand.cc | 8 ++++---- gcc/config/i386/i386.md | 8 ++++---- gcc/config/pa/pa.cc | 8 ++++---- gcc/cse.cc | 2 +- gcc/dse.cc | 2 +- gcc/early-remat.cc | 8 ++++---- gcc/ira-lives.cc | 2 +- gcc/sched-deps.cc | 2 +- gcc/valtrack.cc | 7 ++++--- gcc/var-tracking.cc | 4 ++-- 11 files changed, 27 insertions(+), 26 deletions(-) diff --git a/gcc/config/arm/aarch-bti-insert.cc b/gcc/config/arm/aarch-bti-insert.cc index 9b89f3023f8f..6998b09b46eb 100644 --- a/gcc/config/arm/aarch-bti-insert.cc +++ b/gcc/config/arm/aarch-bti-insert.cc @@ -94,7 +94,7 @@ const pass_data pass_data_insert_bti = /* Decide if BTI J is needed after a call instruction. */ static bool -call_needs_bti_j (rtx_insn *insn) +call_needs_bti_j (rtx_call_insn *insn) { /* Call returns twice, one of which may be indirect. */ if (find_reg_note (insn, REG_SETJMP, NULL)) diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index c02e7128b9db..4980a04fdafa 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -11308,8 +11308,8 @@ ix86_expand_strlensi_unroll_1 (rtx out, rtx src, rtx align_rtx) tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp, gen_rtx_LABEL_REF (VOIDmode, end_2_label), pc_rtx); - tmp = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); - JUMP_LABEL (tmp) = end_2_label; + rtx_insn *jump = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); + JUMP_LABEL (jump) = end_2_label; /* Not in the first two. Move two bytes forward. */ emit_insn (gen_lshrsi3 (tmpreg, tmpreg, GEN_INT (16))); @@ -22853,8 +22853,8 @@ ix86_expand_sse_compare_and_jump (enum rtx_code code, rtx op0, rtx op1, tmp = gen_rtx_fmt_ee (code, VOIDmode, reg, const0_rtx); tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp, gen_rtx_LABEL_REF (VOIDmode, label), pc_rtx); - tmp = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); - JUMP_LABEL (tmp) = label; + rtx_insn *jump = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); + JUMP_LABEL (jump) = label; return label; } diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 005938c506f4..2d2e620713f1 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -17099,8 +17099,8 @@ tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp, gen_rtx_LABEL_REF (VOIDmode, label), pc_rtx); - tmp = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); - JUMP_LABEL (tmp) = label; + rtx_insn *jump = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); + JUMP_LABEL (jump) = label; emit_move_insn (operands[0], operands[1]); ix86_expand_clear (operands[1]); @@ -18501,8 +18501,8 @@ tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp, gen_rtx_LABEL_REF (VOIDmode, label), pc_rtx); - tmp = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); - JUMP_LABEL (tmp) = label; + rtx_insn *jump = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); + JUMP_LABEL (jump) = label; emit_move_insn (operands[0], operands[1]); emit_insn (gen_ashr<mode>3_cvt (operands[1], operands[1], diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc index 6586cbdf7eac..1bf30c86ee29 100644 --- a/gcc/config/pa/pa.cc +++ b/gcc/config/pa/pa.cc @@ -9834,15 +9834,15 @@ pa_combine_instructions (void) /* Emit the new_jump instruction and delete the old anchor. */ rtvec vtemp = gen_rtvec (2, copy_rtx (PATTERN (anchor)), copy_rtx (PATTERN (floater))); - rtx temp = gen_rtx_PARALLEL (VOIDmode, vtemp); - temp = emit_jump_insn_before (temp, anchor); + rtx body = gen_rtx_PARALLEL (VOIDmode, vtemp); + rtx_jump_insn *insn = emit_jump_insn_before (body, anchor); - JUMP_LABEL (temp) = JUMP_LABEL (anchor); + JUMP_LABEL (insn) = JUMP_LABEL (anchor); SET_INSN_DELETED (anchor); /* Emit a special USE insn for FLOATER, then delete the floating insn. */ - temp = copy_rtx (PATTERN (floater)); + rtx temp = copy_rtx (PATTERN (floater)); emit_insn_before (gen_rtx_USE (VOIDmode, temp), floater); delete_insn (floater); continue; diff --git a/gcc/cse.cc b/gcc/cse.cc index b75bdb4612f2..c593f4ab8094 100644 --- a/gcc/cse.cc +++ b/gcc/cse.cc @@ -2104,7 +2104,7 @@ rehash_using_reg (rtx x) register in INSN. Also update their TICK values. */ static void -invalidate_for_call (rtx_insn *insn) +invalidate_for_call (rtx_call_insn *insn) { unsigned int regno; unsigned hash; diff --git a/gcc/dse.cc b/gcc/dse.cc index 7c0d90e2f7a8..87a71eaa7cd0 100644 --- a/gcc/dse.cc +++ b/gcc/dse.cc @@ -2435,7 +2435,7 @@ check_mem_read_use (rtx *loc, void *data) So far it only handles arguments passed in registers. */ static bool -get_call_args (rtx_insn *call_insn, tree fn, rtx *args, int nargs) +get_call_args (rtx_call_insn *call_insn, tree fn, rtx *args, int nargs) { CUMULATIVE_ARGS args_so_far_v; cumulative_args_t args_so_far; diff --git a/gcc/early-remat.cc b/gcc/early-remat.cc index 033a2f5e52d1..8ff6223b7fea 100644 --- a/gcc/early-remat.cc +++ b/gcc/early-remat.cc @@ -248,7 +248,7 @@ const unsigned int MULTIPLE_CANDIDATES = -1U; /* Pass-specific information about one basic block. */ struct remat_block_info { /* The last call instruction in the block. */ - rtx_insn *last_call; + rtx_call_insn *last_call; /* The set of candidates that are live on entry to the block. NULL is equivalent to an empty set. */ @@ -438,7 +438,7 @@ private: void assign_value_number (unsigned int); void decide_candidate_validity (void); void restrict_remat_for_unavail_regs (bitmap, const_bitmap); - void restrict_remat_for_call (bitmap, rtx_insn *); + void restrict_remat_for_call (bitmap, rtx_call_insn *); bool stable_use_p (unsigned int); void emit_copy_before (unsigned int, rtx, rtx); void stabilize_pattern (unsigned int); @@ -1544,7 +1544,7 @@ early_remat::restrict_remat_for_unavail_regs (bitmap candidates, that is potentially live across CALL. */ void -early_remat::restrict_remat_for_call (bitmap candidates, rtx_insn *call) +early_remat::restrict_remat_for_call (bitmap candidates, rtx_call_insn *call) { /* We don't know whether partially-clobbered registers are live across the call or not, so assume that they are. */ @@ -1926,7 +1926,7 @@ void early_remat::process_block (basic_block bb) { remat_block_info *info = &m_block_info[bb->index]; - rtx_insn *last_call = NULL; + rtx_call_insn *last_call = NULL; rtx_insn *insn; /* Ensure that we always use the same candidate index to refer to an diff --git a/gcc/ira-lives.cc b/gcc/ira-lives.cc index 984cb91e7fa9..8dd2756364d5 100644 --- a/gcc/ira-lives.cc +++ b/gcc/ira-lives.cc @@ -1246,7 +1246,7 @@ process_dependent_filters () we find a SET rtx that we can use to deduce that a register can be cheaply caller-saved. Return such a register, or NULL_RTX if none is found. */ static rtx -find_call_crossed_cheap_reg (rtx_insn *insn) +find_call_crossed_cheap_reg (rtx_call_insn *insn) { rtx cheap_reg = NULL_RTX; rtx exp = CALL_INSN_FUNCTION_USAGE (insn); diff --git a/gcc/sched-deps.cc b/gcc/sched-deps.cc index 46a500b29514..2a50154ab762 100644 --- a/gcc/sched-deps.cc +++ b/gcc/sched-deps.cc @@ -3685,7 +3685,7 @@ sched_analyze_insn (class deps_desc *deps, rtx x, rtx_insn *insn) /* FIXME: Why can't this function just use flags_from_decl_or_type and test for ECF_NORETURN? */ static bool -call_may_noreturn_p (rtx_insn *insn) +call_may_noreturn_p (rtx_call_insn *insn) { rtx call; diff --git a/gcc/valtrack.cc b/gcc/valtrack.cc index 9f6b0f7024c4..497e3d0030d5 100644 --- a/gcc/valtrack.cc +++ b/gcc/valtrack.cc @@ -750,14 +750,15 @@ dead_debug_insert_temp (struct dead_debug_local *debug, unsigned int uregno, DEBUG_EXPR_TREE_DECL (dval), breg, VAR_INIT_STATUS_INITIALIZED); + rtx_insn *bind_insn; if (where == DEBUG_TEMP_AFTER_WITH_REG || where == DEBUG_TEMP_AFTER_WITH_REG_FORCE) - bind = emit_debug_insn_after (bind, insn); + bind_insn = emit_debug_insn_after (bind, insn); else - bind = emit_debug_insn_before (bind, insn); + bind_insn = emit_debug_insn_before (bind, insn); if (debug->to_rescan == NULL) debug->to_rescan = BITMAP_ALLOC (NULL); - bitmap_set_bit (debug->to_rescan, INSN_UID (bind)); + bitmap_set_bit (debug->to_rescan, INSN_UID (bind_insn)); /* Adjust all uses. */ while ((cur = uses)) diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc index b08043df4e05..273ca053f92b 100644 --- a/gcc/var-tracking.cc +++ b/gcc/var-tracking.cc @@ -6253,7 +6253,7 @@ static rtx call_arguments; /* Compute call_arguments. */ static void -prepare_call_arguments (basic_block bb, rtx_insn *insn) +prepare_call_arguments (basic_block bb, rtx_call_insn *insn) { rtx link, x, call; rtx prev, cur, next; @@ -10013,7 +10013,7 @@ vt_init_cfa_base (void) /* Reemit INSN, a MARKER_DEBUG_INSN, as a note. */ -static rtx_insn * +static rtx_note * reemit_marker_as_note (rtx_insn *insn) { gcc_checking_assert (DEBUG_MARKER_INSN_P (insn));
