From: Trevor Saunders Date: Thu, 22 Sep 2016 13:16:17 +0000 (+0000) Subject: make next/prev _nonnote_insn take rtx_insn * X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c9b0a22777c783ad538c7ac05b0e95acaf1e32f3;p=gcc.git make next/prev _nonnote_insn take rtx_insn * gcc/ChangeLog: 2016-09-22 Trevor Saunders * emit-rtl.c (next_nonnote_insn): Change argument type to rtx_insn *. (prev_nonnote_insn): Likewise. * jump.c (reversed_comparison_code_parts): Likewise. (reversed_comparison): Likewise. * rtl.h: Adjust prototypes. * config/arc/arc.md: Adjust. * cse.c (find_comparison_args): Likewise. * reorg.c (redundant_insn): Change return type to rtx_insn *. (fix_reg_dead_note): Change argument type to rtx_insn *. (delete_prior_computation): Likewise. (delete_computation): Likewise. (fill_slots_from_thread): Adjust. (relax_delay_slots): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. (simplify_relational_operation_1): Likewise. (simplify_ternary_operation): Likewise. From-SVN: r240357 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 80db88e935d..deca9dc12ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2016-09-22 Trevor Saunders + + * emit-rtl.c (next_nonnote_insn): Change argument type to + rtx_insn *. + (prev_nonnote_insn): Likewise. + * jump.c (reversed_comparison_code_parts): Likewise. + (reversed_comparison): Likewise. + * rtl.h: Adjust prototypes. + * config/arc/arc.md: Adjust. + * cse.c (find_comparison_args): Likewise. + * reorg.c (redundant_insn): Change return type to rtx_insn *. + (fix_reg_dead_note): Change argument type to rtx_insn *. + (delete_prior_computation): Likewise. + (delete_computation): Likewise. + (fill_slots_from_thread): Adjust. + (relax_delay_slots): Likewise. + * simplify-rtx.c (simplify_unary_operation_1): Likewise. + (simplify_relational_operation_1): Likewise. + (simplify_ternary_operation): Likewise. + 2016-09-22 Trevor Saunders * config/arc/arc-protos.h (arc_label_align): Change type of diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index 1102c53da26..22fdbbaa78b 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -3879,7 +3879,7 @@ "" "* { - rtx diff_vec = PATTERN (next_nonnote_insn (operands[3])); + rtx diff_vec = PATTERN (next_nonnote_insn (as_a (operands[3]))); if (GET_CODE (diff_vec) != ADDR_DIFF_VEC) { @@ -3907,10 +3907,12 @@ [(set_attr "type" "load") (set_attr_alternative "iscompact" [(cond - [(ne (symbol_ref "GET_MODE (PATTERN (next_nonnote_insn (operands[3])))") + [(ne (symbol_ref "GET_MODE (PATTERN (next_nonnote_insn + (as_a (operands[3]))))") (symbol_ref "QImode")) (const_string "false") - (match_test "!ADDR_DIFF_VEC_FLAGS (PATTERN (next_nonnote_insn (operands[3]))).offset_unsigned") + (match_test "!ADDR_DIFF_VEC_FLAGS (PATTERN (next_nonnote_insn + (as_a (operands[3])))).offset_unsigned") (const_string "false")] (const_string "true")) (const_string "false") @@ -3946,7 +3948,7 @@ "TARGET_COMPACT_CASESI" "* { - rtx diff_vec = PATTERN (next_nonnote_insn (operands[1])); + rtx diff_vec = PATTERN (next_nonnote_insn (as_a (operands[1]))); int unalign = arc_get_unalign (); rtx xop[3]; const char *s; diff --git a/gcc/cse.c b/gcc/cse.c index 99949f0abd5..7069fab6b38 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -3054,7 +3054,7 @@ find_comparison_args (enum rtx_code code, rtx *parg1, rtx *parg2, with floating-point operands. */ if (reverse_code) { - enum rtx_code reversed = reversed_comparison_code (x, NULL_RTX); + enum rtx_code reversed = reversed_comparison_code (x, NULL); if (reversed == UNKNOWN) break; else diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 9e0bda2cc41..49907d10781 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3301,9 +3301,8 @@ previous_insn (rtx_insn *insn) look inside SEQUENCEs. */ rtx_insn * -next_nonnote_insn (rtx uncast_insn) +next_nonnote_insn (rtx_insn *insn) { - rtx_insn *insn = safe_as_a (uncast_insn); while (insn) { insn = NEXT_INSN (insn); @@ -3337,10 +3336,8 @@ next_nonnote_insn_bb (rtx_insn *insn) not look inside SEQUENCEs. */ rtx_insn * -prev_nonnote_insn (rtx uncast_insn) +prev_nonnote_insn (rtx_insn *insn) { - rtx_insn *insn = safe_as_a (uncast_insn); - while (insn) { insn = PREV_INSN (insn); diff --git a/gcc/jump.c b/gcc/jump.c index 22f8a71b760..87a1a5d8873 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -62,7 +62,7 @@ static void mark_all_labels (rtx_insn *); static void mark_jump_label_1 (rtx, rtx_insn *, bool, bool); static void mark_jump_label_asm (rtx, rtx_insn *); static void redirect_exp_1 (rtx *, rtx, rtx, rtx); -static int invert_exp_1 (rtx, rtx); +static int invert_exp_1 (rtx, rtx_insn *); /* Worker for rebuild_jump_labels and rebuild_jump_labels_chain. */ static void @@ -360,7 +360,7 @@ mark_all_labels (rtx_insn *f) to help this function avoid overhead in these cases. */ enum rtx_code reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0, - const_rtx arg1, const_rtx insn) + const_rtx arg1, const rtx_insn *insn) { machine_mode mode; @@ -422,7 +422,7 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0, /* These CONST_CAST's are okay because prev_nonnote_insn just returns its argument and we assign it to a const_rtx variable. */ - for (rtx_insn *prev = prev_nonnote_insn (CONST_CAST_RTX (insn)); + for (rtx_insn *prev = prev_nonnote_insn (const_cast (insn)); prev != 0 && !LABEL_P (prev); prev = prev_nonnote_insn (prev)) { @@ -470,7 +470,7 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0, /* A wrapper around the previous function to take COMPARISON as rtx expression. This simplifies many callers. */ enum rtx_code -reversed_comparison_code (const_rtx comparison, const_rtx insn) +reversed_comparison_code (const_rtx comparison, const rtx_insn *insn) { if (!COMPARISON_P (comparison)) return UNKNOWN; @@ -484,7 +484,7 @@ reversed_comparison_code (const_rtx comparison, const_rtx insn) rtx reversed_comparison (const_rtx exp, machine_mode mode) { - enum rtx_code reversed_code = reversed_comparison_code (exp, NULL_RTX); + enum rtx_code reversed_code = reversed_comparison_code (exp, NULL); if (reversed_code == UNKNOWN) return NULL_RTX; else @@ -1623,7 +1623,7 @@ redirect_jump_2 (rtx_jump_insn *jump, rtx olabel, rtx nlabel, int delete_unused, /* Invert the jump condition X contained in jump insn INSN. Accrue the modifications into the change group. Return nonzero for success. */ static int -invert_exp_1 (rtx x, rtx insn) +invert_exp_1 (rtx x, rtx_insn *insn) { RTX_CODE code = GET_CODE (x); diff --git a/gcc/reorg.c b/gcc/reorg.c index c58d608bcb7..bc05930ce8f 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -219,12 +219,12 @@ static void steal_delay_list_from_fallthrough (rtx_insn *, rtx, rtx_sequence *, struct resources *, int, int *, int *); static void try_merge_delay_insns (rtx_insn *, rtx_insn *); -static rtx redundant_insn (rtx, rtx_insn *, const vec &); +static rtx_insn *redundant_insn (rtx, rtx_insn *, const vec &); static int own_thread_p (rtx, rtx, int); static void update_block (rtx_insn *, rtx); static int reorg_redirect_jump (rtx_jump_insn *, rtx); static void update_reg_dead_notes (rtx_insn *, rtx_insn *); -static void fix_reg_dead_note (rtx, rtx); +static void fix_reg_dead_note (rtx_insn *, rtx); static void update_reg_unused_notes (rtx, rtx); static void fill_simple_delay_slots (int); static void fill_slots_from_thread (rtx_jump_insn *, rtx, rtx, rtx, @@ -1449,7 +1449,7 @@ try_merge_delay_insns (rtx_insn *insn, rtx_insn *thread) redundant insn, but the cost of splitting seems greater than the possible gain in rare cases. */ -static rtx +static rtx_insn * redundant_insn (rtx insn, rtx_insn *target, const vec &delay_list) { rtx target_main = target; @@ -1606,7 +1606,7 @@ redundant_insn (rtx insn, rtx_insn *target, const vec &delay_list) resource requirements as we go. */ for (i = seq->len () - 1; i > 0; i--) { - rtx candidate = seq->element (i); + rtx_insn *candidate = seq->insn (i); /* If an insn will be annulled if the branch is false, it isn't considered as a possible duplicate insn. */ @@ -1773,7 +1773,7 @@ update_reg_dead_notes (rtx_insn *insn, rtx_insn *delayed_insn) confused into thinking the register is dead. */ static void -fix_reg_dead_note (rtx start_insn, rtx stop_insn) +fix_reg_dead_note (rtx_insn *start_insn, rtx stop_insn) { rtx link, next; rtx_insn *p; @@ -2417,7 +2417,7 @@ fill_slots_from_thread (rtx_jump_insn *insn, rtx condition, && (! own_thread || ! sets_cc0_p (pat))))) && ! can_throw_internal (trial)) { - rtx prior_insn; + rtx_insn *prior_insn; /* If TRIAL is redundant with some insn before INSN, we don't actually need to add it to the delay list; we can merely pretend @@ -2904,16 +2904,16 @@ fill_eager_delay_slots (void) } } -static void delete_computation (rtx insn); +static void delete_computation (rtx_insn *insn); /* Recursively delete prior insns that compute the value (used only by INSN which the caller is deleting) stored in the register mentioned by NOTE which is a REG_DEAD note associated with INSN. */ static void -delete_prior_computation (rtx note, rtx insn) +delete_prior_computation (rtx note, rtx_insn *insn) { - rtx our_prev; + rtx_insn *our_prev; rtx reg = XEXP (note, 0); for (our_prev = prev_nonnote_insn (insn); @@ -3025,7 +3025,7 @@ delete_prior_computation (rtx note, rtx insn) delete the insn that set it. */ static void -delete_computation (rtx insn) +delete_computation (rtx_insn *insn) { rtx note, next; @@ -3367,7 +3367,7 @@ relax_delay_slots (rtx_insn *first) if (! INSN_ANNULLED_BRANCH_P (delay_jump_insn) && ! condjump_in_parallel_p (delay_jump_insn) && prev_active_insn (target_label) == insn - && ! BARRIER_P (prev_nonnote_insn (target_label)) + && ! BARRIER_P (prev_nonnote_insn (as_a (target_label))) /* If the last insn in the delay slot sets CC0 for some insn, various code assumes that it is in a delay slot. We could put it back where it belonged and delete the register notes, diff --git a/gcc/rtl.h b/gcc/rtl.h index b531ab7b872..0d121bcefee 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2834,9 +2834,9 @@ extern void add_function_usage_to (rtx, rtx); extern rtx_call_insn *last_call_insn (void); extern rtx_insn *previous_insn (rtx_insn *); extern rtx_insn *next_insn (rtx_insn *); -extern rtx_insn *prev_nonnote_insn (rtx); +extern rtx_insn *prev_nonnote_insn (rtx_insn *); extern rtx_insn *prev_nonnote_insn_bb (rtx); -extern rtx_insn *next_nonnote_insn (rtx); +extern rtx_insn *next_nonnote_insn (rtx_insn *); extern rtx_insn *next_nonnote_insn_bb (rtx_insn *); extern rtx_insn *prev_nondebug_insn (rtx); extern rtx_insn *next_nondebug_insn (rtx); @@ -3498,9 +3498,9 @@ extern int redirect_jump (rtx_jump_insn *, rtx, int); extern void rebuild_jump_labels (rtx_insn *); extern void rebuild_jump_labels_chain (rtx_insn *); extern rtx reversed_comparison (const_rtx, machine_mode); -extern enum rtx_code reversed_comparison_code (const_rtx, const_rtx); +extern enum rtx_code reversed_comparison_code (const_rtx, const rtx_insn *); extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx, - const_rtx, const_rtx); + const_rtx, const rtx_insn *); extern void delete_for_peephole (rtx_insn *, rtx_insn *); extern int condjump_in_parallel_p (const rtx_insn *); diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 035f70e89b5..67902792cdf 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -886,7 +886,7 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) comparison is all ones. */ if (COMPARISON_P (op) && (mode == BImode || STORE_FLAG_VALUE == -1) - && ((reversed = reversed_comparison_code (op, NULL_RTX)) != UNKNOWN)) + && ((reversed = reversed_comparison_code (op, NULL)) != UNKNOWN)) return simplify_gen_relational (reversed, mode, VOIDmode, XEXP (op, 0), XEXP (op, 1)); @@ -1009,7 +1009,7 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) || (GET_CODE (false_rtx) == NEG && rtx_equal_p (XEXP (false_rtx, 0), true_rtx))) { - if (reversed_comparison_code (cond, NULL_RTX) != UNKNOWN) + if (reversed_comparison_code (cond, NULL) != UNKNOWN) temp = reversed_comparison (cond, mode); else { @@ -4627,7 +4627,7 @@ simplify_relational_operation_1 (enum rtx_code code, machine_mode mode, } else if (code == EQ) { - enum rtx_code new_code = reversed_comparison_code (op0, NULL_RTX); + enum rtx_code new_code = reversed_comparison_code (op0, NULL); if (new_code != UNKNOWN) return simplify_gen_relational (new_code, mode, VOIDmode, XEXP (op0, 0), XEXP (op0, 1)); @@ -5487,7 +5487,7 @@ simplify_ternary_operation (enum rtx_code code, machine_mode mode, else if (t == 0 && f == STORE_FLAG_VALUE) { enum rtx_code tmp; - tmp = reversed_comparison_code (op0, NULL_RTX); + tmp = reversed_comparison_code (op0, NULL); if (tmp == UNKNOWN) break; code = tmp;