From 9152e0aa1b60461c043c189307d2b913279f0646 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 26 Aug 2014 19:12:49 +0000 Subject: [PATCH] Params of add_insn and unlink_insn_chain gcc/ 2014-08-26 David Malcolm * rtl.h (add_insn): Strengthen param from rtx to rtx_insn *. (unlink_insn_chain): Strengthen both params from rtx to rtx_insn *. * cfgrtl.c (cfg_layout_function_header): Likewise for this variable. (unlink_insn_chain): Likewise for params "first" and "last". Remove now-redundant checked cast. (record_effective_endpoints): Replace use of NULL_RTX with NULL. (fixup_reorder_chain): Strengthen local "insn" from rtx to rtx_insn *. * emit-rtl.c (link_insn_into_chain): Likewise for all three params. (add_insn): Likewise for param "insn" and local "prev". (add_insn_after_nobb): Likewise for both params and local "next". (add_insn_before_nobb): Likewise for both params and local "prev". (add_insn_after): Rename param "after" to "uncast_after", introducing local "after" with another checked cast. (add_insn_before): Rename params "insn" and "before", giving them "uncast_" prefixes, adding the old names back using checked casts. (emit_note_after): Likewise for param "after". (emit_note_before): Likewise for param "before". (emit_label): Add a checked cast. From-SVN: r214536 --- gcc/ChangeLog | 26 ++++++++++++++++++++++++++ gcc/cfgrtl.c | 10 +++++----- gcc/emit-rtl.c | 29 +++++++++++++++++------------ gcc/rtl.h | 4 ++-- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e6414bc79ae..6fa5dfc1ae0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2014-08-26 David Malcolm + + * rtl.h (add_insn): Strengthen param from rtx to rtx_insn *. + (unlink_insn_chain): Strengthen both params from rtx to + rtx_insn *. + + * cfgrtl.c (cfg_layout_function_header): Likewise for this + variable. + (unlink_insn_chain): Likewise for params "first" and "last". + Remove now-redundant checked cast. + (record_effective_endpoints): Replace use of NULL_RTX with NULL. + (fixup_reorder_chain): Strengthen local "insn" from rtx to + rtx_insn *. + * emit-rtl.c (link_insn_into_chain): Likewise for all three + params. + (add_insn): Likewise for param "insn" and local "prev". + (add_insn_after_nobb): Likewise for both params and local "next". + (add_insn_before_nobb): Likewise for both params and local "prev". + (add_insn_after): Rename param "after" to "uncast_after", + introducing local "after" with another checked cast. + (add_insn_before): Rename params "insn" and "before", giving them + "uncast_" prefixes, adding the old names back using checked casts. + (emit_note_after): Likewise for param "after". + (emit_note_before): Likewise for param "before". + (emit_label): Add a checked cast. + 2014-08-26 David Malcolm * cselib.h (cselib_record_sets_hook): Strengthen initial param diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index db6c8f8f6f7..7b1fc2c4c94 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -65,7 +65,7 @@ along with GCC; see the file COPYING3. If not see /* Holds the interesting leading and trailing notes for the function. Only applicable if the CFG is in cfglayout mode. */ static GTY(()) rtx_insn *cfg_layout_function_footer; -static GTY(()) rtx cfg_layout_function_header; +static GTY(()) rtx_insn *cfg_layout_function_header; static rtx_insn *skip_insns_after_block (basic_block); static void record_effective_endpoints (void); @@ -3305,7 +3305,7 @@ fixup_abnormal_edges (void) /* Cut the insns from FIRST to LAST out of the insns stream. */ rtx_insn * -unlink_insn_chain (rtx first, rtx last) +unlink_insn_chain (rtx_insn *first, rtx_insn *last) { rtx_insn *prevfirst = PREV_INSN (first); rtx_insn *nextlast = NEXT_INSN (last); @@ -3320,7 +3320,7 @@ unlink_insn_chain (rtx first, rtx last) set_last_insn (prevfirst); if (!prevfirst) set_first_insn (nextlast); - return as_a (first); + return first; } /* Skip over inter-block insns occurring after BB which are typically @@ -3448,7 +3448,7 @@ record_effective_endpoints (void) cfg_layout_function_header = unlink_insn_chain (get_insns (), PREV_INSN (insn)); else - cfg_layout_function_header = NULL_RTX; + cfg_layout_function_header = NULL; next_insn = get_insns (); FOR_EACH_BB_FN (bb, cfun) @@ -3639,7 +3639,7 @@ static void fixup_reorder_chain (void) { basic_block bb; - rtx insn = NULL; + rtx_insn *insn = NULL; if (cfg_layout_function_header) { diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 2e09160e711..fa904222fd0 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3873,7 +3873,7 @@ make_note_raw (enum insn_note subtype) but also BARRIERs and JUMP_TABLE_DATAs. PREV and NEXT may be NULL. */ static inline void -link_insn_into_chain (rtx insn, rtx prev, rtx next) +link_insn_into_chain (rtx_insn *insn, rtx_insn *prev, rtx_insn *next) { SET_PREV_INSN (insn) = prev; SET_NEXT_INSN (insn) = next; @@ -3905,9 +3905,9 @@ link_insn_into_chain (rtx insn, rtx prev, rtx next) INSN may be an INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, BARRIER or NOTE. */ void -add_insn (rtx insn) +add_insn (rtx_insn *insn) { - rtx prev = get_last_insn (); + rtx_insn *prev = get_last_insn (); link_insn_into_chain (insn, prev, NULL); if (NULL == get_insns ()) set_first_insn (insn); @@ -3917,9 +3917,9 @@ add_insn (rtx insn) /* Add INSN into the doubly-linked list after insn AFTER. */ static void -add_insn_after_nobb (rtx insn, rtx after) +add_insn_after_nobb (rtx_insn *insn, rtx_insn *after) { - rtx next = NEXT_INSN (after); + rtx_insn *next = NEXT_INSN (after); gcc_assert (!optimize || !INSN_DELETED_P (after)); @@ -3946,9 +3946,9 @@ add_insn_after_nobb (rtx insn, rtx after) /* Add INSN into the doubly-linked list before insn BEFORE. */ static void -add_insn_before_nobb (rtx insn, rtx before) +add_insn_before_nobb (rtx_insn *insn, rtx_insn *before) { - rtx prev = PREV_INSN (before); + rtx_insn *prev = PREV_INSN (before); gcc_assert (!optimize || !INSN_DELETED_P (before)); @@ -3982,9 +3982,10 @@ add_insn_before_nobb (rtx insn, rtx before) they know how to update a SEQUENCE. */ void -add_insn_after (rtx uncast_insn, rtx after, basic_block bb) +add_insn_after (rtx uncast_insn, rtx uncast_after, basic_block bb) { rtx_insn *insn = as_a (uncast_insn); + rtx_insn *after = as_a (uncast_after); add_insn_after_nobb (insn, after); if (!BARRIER_P (after) && !BARRIER_P (insn) @@ -4011,8 +4012,10 @@ add_insn_after (rtx uncast_insn, rtx after, basic_block bb) they know how to update a SEQUENCE. */ void -add_insn_before (rtx insn, rtx before, basic_block bb) +add_insn_before (rtx uncast_insn, rtx uncast_before, basic_block bb) { + rtx_insn *insn = as_a (uncast_insn); + rtx_insn *before = as_a (uncast_before); add_insn_before_nobb (insn, before); if (!bb @@ -4559,8 +4562,9 @@ note_outside_basic_block_p (enum insn_note subtype, bool on_bb_boundary_p) /* Emit a note of subtype SUBTYPE after the insn AFTER. */ rtx_note * -emit_note_after (enum insn_note subtype, rtx after) +emit_note_after (enum insn_note subtype, rtx uncast_after) { + rtx_insn *after = as_a (uncast_after); rtx_note *note = make_note_raw (subtype); basic_block bb = BARRIER_P (after) ? NULL : BLOCK_FOR_INSN (after); bool on_bb_boundary_p = (bb != NULL && BB_END (bb) == after); @@ -4575,8 +4579,9 @@ emit_note_after (enum insn_note subtype, rtx after) /* Emit a note of subtype SUBTYPE before the insn BEFORE. */ rtx_note * -emit_note_before (enum insn_note subtype, rtx before) +emit_note_before (enum insn_note subtype, rtx uncast_before) { + rtx_insn *before = as_a (uncast_before); rtx_note *note = make_note_raw (subtype); basic_block bb = BARRIER_P (before) ? NULL : BLOCK_FOR_INSN (before); bool on_bb_boundary_p = (bb != NULL && BB_HEAD (bb) == before); @@ -4993,7 +4998,7 @@ emit_label (rtx label) { gcc_checking_assert (INSN_UID (label) == 0); INSN_UID (label) = cur_insn_uid++; - add_insn (label); + add_insn (as_a (label)); return as_a (label); } diff --git a/gcc/rtl.h b/gcc/rtl.h index 076f1653b95..f5b2ea1fffe 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -3114,7 +3114,7 @@ extern unsigned int unshare_all_rtl (void); extern void unshare_all_rtl_again (rtx_insn *); extern void unshare_all_rtl_in_chain (rtx); extern void verify_rtl_sharing (void); -extern void add_insn (rtx); +extern void add_insn (rtx_insn *); extern void add_insn_before (rtx, rtx, basic_block); extern void add_insn_after (rtx, rtx, basic_block); extern void remove_insn (rtx); @@ -3123,7 +3123,7 @@ extern void delete_insn (rtx); extern rtx_insn *entry_of_function (void); extern void emit_insn_at_entry (rtx); extern void delete_insn_chain (rtx, rtx, bool); -extern rtx_insn *unlink_insn_chain (rtx, rtx); +extern rtx_insn *unlink_insn_chain (rtx_insn *, rtx_insn *); extern void delete_insn_and_edges (rtx_insn *); extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx); extern rtx gen_const_mem (enum machine_mode, rtx); -- 2.30.2