From 1130d5e3e31879417a982e3df5a2d8ea59bfa311 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 26 Aug 2014 18:56:58 +0000 Subject: [PATCH] Remove BB_HEAD, BB_END, BB_HEADER scaffolding gcc/ * basic-block.h (struct rtl_bb_info): Strengthen fields "end_" and "header_" from rtx to rtx_insn *. (struct basic_block_d): Likewise for field "head_" within "x" field of union basic_block_il_dependent. (BB_HEAD): Drop function... (SET_BB_HEAD): ...and this function in favor of... (BB_HEAD): ...reinstate macro. (BB_END): Drop function... (SET_BB_END): ...and this function in favor of... (BB_END): ...reinstate macro. (BB_HEADER): Drop function... (SET_BB_HEADER): ...and this function in favor of... (BB_HEADER): ...reinstate macro. * bb-reorder.c (add_labels_and_missing_jumps): Drop use of BB_END. (fix_crossing_unconditional_branches): Likewise. * caller-save.c (save_call_clobbered_regs): Likewise. (insert_one_insn): Drop use of SET_BB_HEAD and SET_BB_END. * cfgbuild.c (find_bb_boundaries): Drop use of SET_BB_END. * cfgcleanup.c (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (outgoing_edges_match): Update use of for_each_rtx to for_each_rtx_in_insn. * cfgexpand.c (expand_gimple_cond): Drop use of SET_BB_END. (expand_gimple_cond): Likewise. (expand_gimple_tailcall): Likewise. (expand_gimple_basic_block): Drop use of SET_BB_HEAD and SET_BB_END. (construct_exit_block): Drop use of SET_BB_END. * cfgrtl.c (cfg_layout_function_footer): Strengthen from rtx to rtx_insn *. (delete_insn): Rename param "insn" to "uncast_insn", introducing a new local "insn" with a checked cast to rtx_insn *. Drop use of SET_BB_HEAD and SET_BB_END. (create_basic_block_structure): Drop use of SET_BB_HEAD and SET_BB_END. (rtl_delete_block): Drop use of SET_BB_HEAD. (rtl_split_block): Drop use of SET_BB_END. (emit_nop_for_unique_locus_between): Likewise. (rtl_merge_blocks): Drop use of SET_BB_END and SET_BB_HEAD. (block_label): Drop use of SET_BB_HEAD. (fixup_abnormal_edges): Drop use of SET_BB_END. (record_effective_endpoints): Drop use of SET_BB_HEADER. (relink_block_chain): Likewise. (fixup_reorder_chain): Drop use of SET_BB_END. (cfg_layout_duplicate_bb): Drop use of SET_BB_HEADER. (cfg_layout_delete_block): Strengthen local "to" from rtx * to rtx_insn **. Drop use of SET_BB_HEADER. (cfg_layout_merge_blocks): Drop use of SET_BB_HEADER, SET_BB_END, SET_BB_HEAD. (BB_HEAD): Delete this function. (SET_BB_HEAD): Likewise. (BB_END): Likewise. (SET_BB_END): Likewise. (BB_HEADER): Likewise. (SET_BB_HEADER): Likewise. * emit-rtl.c (add_insn_after): Rename param "insn" to "uncast_insn", adding a new local "insn" and a checked cast to rtx_insn *. Drop use of SET_BB_END. (remove_insn): Strengthen locals "next" and "prev" from rtx to rtx_insn *. Drop use of SET_BB_HEAD and SET_BB_END. (reorder_insns): Drop use of SET_BB_END. (emit_insn_after_1): Strengthen param "first" and locals "last", "after_after" from rtx to rtx_insn *. Drop use of SET_BB_END. (emit_pattern_after_noloc): Add checked cast. * haifa-sched.c (get_ebb_head_tail): Drop use of SET_BB_END. (restore_other_notes): Likewise. (move_insn): Likewise. (sched_extend_bb): Likewise. (fix_jump_move): Likewise. * ifcvt.c (noce_process_if_block): Likewise. (dead_or_predicable): Likewise. * ira.c (update_equiv_regs): Drop use of SET_BB_HEAD. * reg-stack.c (change_stack): Drop use of SET_BB_END. * sel-sched-ir.c (sel_move_insn): Likewise. * sel-sched.c (move_nop_to_previous_block): Likewise. * config/c6x/c6x.c (hwloop_optimize): Drop use of SET_BB_HEAD and SET_BB_END. * config/ia64/ia64.c (emit_predicate_relation_info): Likewise. / * rtx-classes-status.txt (TODO): SET_BB_HEAD, SET_BB_END, SET_BB_HEADER are done. From-SVN: r214534 --- ChangeLog | 5 +++ gcc/ChangeLog | 83 ++++++++++++++++++++++++++++++++++++ gcc/basic-block.h | 18 +++----- gcc/bb-reorder.c | 4 +- gcc/caller-save.c | 6 +-- gcc/cfgbuild.c | 4 +- gcc/cfgcleanup.c | 8 ++-- gcc/cfgexpand.c | 22 +++++----- gcc/cfgrtl.c | 96 ++++++++++++------------------------------ gcc/config/c6x/c6x.c | 4 +- gcc/config/ia64/ia64.c | 6 +-- gcc/emit-rtl.c | 27 ++++++------ gcc/haifa-sched.c | 18 ++++---- gcc/ifcvt.c | 4 +- gcc/ira.c | 2 +- gcc/reg-stack.c | 2 +- gcc/sel-sched-ir.c | 2 +- gcc/sel-sched.c | 2 +- rtx-classes-status.txt | 1 - 19 files changed, 176 insertions(+), 138 deletions(-) diff --git a/ChangeLog b/ChangeLog index f61851f1819..f38a66cca41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-08-26 David Malcolm + + * rtx-classes-status.txt (TODO): SET_BB_HEAD, SET_BB_END, + SET_BB_HEADER are done. + 2014-08-26 David Malcolm * rtx-classes-status.txt (TODO): SET_DEP_PRO and SET_DEP_CON are diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1287a5e8735..75a77eaf8b8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,86 @@ +2014-08-26 David Malcolm + + * basic-block.h (struct rtl_bb_info): Strengthen fields "end_" + and "header_" from rtx to rtx_insn *. + (struct basic_block_d): Likewise for field "head_" within "x" + field of union basic_block_il_dependent. + (BB_HEAD): Drop function... + (SET_BB_HEAD): ...and this function in favor of... + (BB_HEAD): ...reinstate macro. + (BB_END): Drop function... + (SET_BB_END): ...and this function in favor of... + (BB_END): ...reinstate macro. + (BB_HEADER): Drop function... + (SET_BB_HEADER): ...and this function in favor of... + (BB_HEADER): ...reinstate macro. + + * bb-reorder.c (add_labels_and_missing_jumps): Drop use of BB_END. + (fix_crossing_unconditional_branches): Likewise. + * caller-save.c (save_call_clobbered_regs): Likewise. + (insert_one_insn): Drop use of SET_BB_HEAD and SET_BB_END. + * cfgbuild.c (find_bb_boundaries): Drop use of SET_BB_END. + * cfgcleanup.c (merge_blocks_move_successor_nojumps): Likewise. + (merge_blocks_move_successor_nojumps): Likewise. + (outgoing_edges_match): Update use of for_each_rtx to + for_each_rtx_in_insn. + * cfgexpand.c (expand_gimple_cond): Drop use of SET_BB_END. + (expand_gimple_cond): Likewise. + (expand_gimple_tailcall): Likewise. + (expand_gimple_basic_block): Drop use of SET_BB_HEAD and + SET_BB_END. + (construct_exit_block): Drop use of SET_BB_END. + * cfgrtl.c (cfg_layout_function_footer): Strengthen from rtx to + rtx_insn *. + (delete_insn): Rename param "insn" to "uncast_insn", introducing + a new local "insn" with a checked cast to rtx_insn *. Drop use of + SET_BB_HEAD and SET_BB_END. + (create_basic_block_structure): Drop use of SET_BB_HEAD and + SET_BB_END. + (rtl_delete_block): Drop use of SET_BB_HEAD. + (rtl_split_block): Drop use of SET_BB_END. + (emit_nop_for_unique_locus_between): Likewise. + (rtl_merge_blocks): Drop use of SET_BB_END and SET_BB_HEAD. + (block_label): Drop use of SET_BB_HEAD. + (fixup_abnormal_edges): Drop use of SET_BB_END. + (record_effective_endpoints): Drop use of SET_BB_HEADER. + (relink_block_chain): Likewise. + (fixup_reorder_chain): Drop use of SET_BB_END. + (cfg_layout_duplicate_bb): Drop use of SET_BB_HEADER. + (cfg_layout_delete_block): Strengthen local "to" from rtx * to + rtx_insn **. Drop use of SET_BB_HEADER. + (cfg_layout_merge_blocks): Drop use of SET_BB_HEADER, SET_BB_END, + SET_BB_HEAD. + (BB_HEAD): Delete this function. + (SET_BB_HEAD): Likewise. + (BB_END): Likewise. + (SET_BB_END): Likewise. + (BB_HEADER): Likewise. + (SET_BB_HEADER): Likewise. + * emit-rtl.c (add_insn_after): Rename param "insn" to + "uncast_insn", adding a new local "insn" and a checked cast to + rtx_insn *. Drop use of SET_BB_END. + (remove_insn): Strengthen locals "next" and "prev" from rtx to + rtx_insn *. Drop use of SET_BB_HEAD and SET_BB_END. + (reorder_insns): Drop use of SET_BB_END. + (emit_insn_after_1): Strengthen param "first" and locals "last", + "after_after" from rtx to rtx_insn *. Drop use of SET_BB_END. + (emit_pattern_after_noloc): Add checked cast. + * haifa-sched.c (get_ebb_head_tail): Drop use of SET_BB_END. + (restore_other_notes): Likewise. + (move_insn): Likewise. + (sched_extend_bb): Likewise. + (fix_jump_move): Likewise. + * ifcvt.c (noce_process_if_block): Likewise. + (dead_or_predicable): Likewise. + * ira.c (update_equiv_regs): Drop use of SET_BB_HEAD. + * reg-stack.c (change_stack): Drop use of SET_BB_END. + * sel-sched-ir.c (sel_move_insn): Likewise. + * sel-sched.c (move_nop_to_previous_block): Likewise. + + * config/c6x/c6x.c (hwloop_optimize): Drop use of SET_BB_HEAD and + SET_BB_END. + * config/ia64/ia64.c (emit_predicate_relation_info): Likewise. + 2014-08-26 David Malcolm * basic-block.h (create_basic_block_structure): Strengthen params diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 2122b4266a5..a7c88a4d8c1 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -122,11 +122,11 @@ struct loop; struct GTY(()) rtl_bb_info { /* The first insn of the block is embedded into bb->il.x. */ /* The last insn of the block. */ - rtx end_; + rtx_insn *end_; /* In CFGlayout mode points to insn notes/jumptables to be placed just before and after the block. */ - rtx header_; + rtx_insn *header_; rtx_insn *footer_; }; @@ -185,7 +185,7 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d union basic_block_il_dependent { struct gimple_bb_info GTY ((tag ("0"))) gimple; struct { - rtx head_; + rtx_insn *head_; struct rtl_bb_info * rtl; } GTY ((tag ("1"))) x; } GTY ((desc ("((%1.flags & BB_RTL) != 0)"))) il; @@ -372,15 +372,9 @@ struct GTY(()) control_flow_graph { to rtx_insn. Once the underlying fields are converted from rtx to rtx_insn, these can be converted back to macros. */ -extern rtx_insn *BB_HEAD (const_basic_block bb); -extern rtx& SET_BB_HEAD (basic_block bb); - -extern rtx_insn *BB_END (const_basic_block bb); -extern rtx& SET_BB_END (basic_block bb); - -extern rtx_insn *BB_HEADER (const_basic_block bb); -extern rtx& SET_BB_HEADER (basic_block bb); - +#define BB_HEAD(B) (B)->il.x.head_ +#define BB_END(B) (B)->il.x.rtl->end_ +#define BB_HEADER(B) (B)->il.x.rtl->header_ #define BB_FOOTER(B) (B)->il.x.rtl->footer_ /* Special block numbers [markers] for entry and exit. diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index d00acf490ad..b3f770d4797 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -1759,7 +1759,7 @@ add_labels_and_missing_jumps (vec crossing_edges) gcc_assert (single_succ_p (src)); new_jump = emit_jump_insn_after (gen_jump (label), BB_END (src)); - SET_BB_END (src) = new_jump; + BB_END (src) = new_jump; JUMP_LABEL (new_jump) = label; LABEL_NUSES (label) += 1; @@ -2190,7 +2190,7 @@ fix_crossing_unconditional_branches (void) /* Make BB_END for cur_bb be the jump instruction (NOT the barrier instruction at the end of the sequence...). */ - SET_BB_END (cur_bb) = jump_insn; + BB_END (cur_bb) = jump_insn; } } } diff --git a/gcc/caller-save.c b/gcc/caller-save.c index 03d22a0c6cb..8bdca517e0b 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -921,7 +921,7 @@ save_call_clobbered_regs (void) if (NEXT_INSN (ins)) SET_PREV_INSN (NEXT_INSN (ins)) = ins; if (BB_END (bb) == insn) - SET_BB_END (bb) = ins; + BB_END (bb) = ins; } else gcc_assert (DEBUG_INSN_P (ins)); @@ -1418,7 +1418,7 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat) CLEAR_REG_SET (&new_chain->dead_or_set); if (chain->insn == BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block))) - SET_BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn; + BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn; } else { @@ -1438,7 +1438,7 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat) &new_chain->live_throughout); CLEAR_REG_SET (&new_chain->dead_or_set); if (chain->insn == BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block))) - SET_BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn; + BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn; } new_chain->block = chain->block; new_chain->is_caller_save_insn = 1; diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index 3cd782ccea1..dd6ed7a00e1 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -462,7 +462,7 @@ find_bb_boundaries (basic_block bb) fallthru = split_block (bb, PREV_INSN (insn)); if (flow_transfer_insn) { - SET_BB_END (bb) = flow_transfer_insn; + BB_END (bb) = flow_transfer_insn; /* Clean up the bb field for the insns between the blocks. */ for (x = NEXT_INSN (flow_transfer_insn); @@ -499,7 +499,7 @@ find_bb_boundaries (basic_block bb) ordinary jump, we need to take care and move basic block boundary. */ if (flow_transfer_insn) { - SET_BB_END (bb) = flow_transfer_insn; + BB_END (bb) = flow_transfer_insn; /* Clean up the bb field for the insns that do not belong to BB. */ x = flow_transfer_insn; diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index ba0ab58f0f5..96ab4aa877a 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -728,7 +728,7 @@ merge_blocks_move_successor_nojumps (basic_block a, basic_block b) if (tablejump_p (BB_END (b), &label, &table) && prev_active_insn (label) == BB_END (b)) { - SET_BB_END (b) = table; + BB_END (b) = table; } /* There had better have been a barrier there. Delete it. */ @@ -741,7 +741,7 @@ merge_blocks_move_successor_nojumps (basic_block a, basic_block b) reorder_insns_nobb (BB_HEAD (b), BB_END (b), BB_END (a)); /* Restore the real end of b. */ - SET_BB_END (b) = real_b_end; + BB_END (b) = real_b_end; if (dump_file) fprintf (dump_file, "Moved block %d after %d and merged.\n", @@ -1725,7 +1725,7 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2) rr.r1 = label1; rr.r2 = label2; rr.update_label_nuses = false; - for_each_rtx (&SET_BB_END (bb1), replace_label, &rr); + for_each_rtx_in_insn (&BB_END (bb1), replace_label, &rr); match = (old_insns_match_p (mode, BB_END (bb1), BB_END (bb2)) == dir_both); @@ -1739,7 +1739,7 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2) from the instruction is deleted too. */ rr.r1 = label2; rr.r2 = label1; - for_each_rtx (&SET_BB_END (bb1), replace_label, &rr); + for_each_rtx_in_insn (&BB_END (bb1), replace_label, &rr); return match; } diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 34e57b923d7..b6e02ef38fd 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2175,9 +2175,9 @@ expand_gimple_cond (basic_block bb, gimple stmt) set_curr_insn_location (false_edge->goto_locus); emit_jump (label_rtx_for_bb (false_edge->dest)); - SET_BB_END (bb) = last; + BB_END (bb) = last; if (BARRIER_P (BB_END (bb))) - SET_BB_END (bb) = PREV_INSN (BB_END (bb)); + BB_END (bb) = PREV_INSN (BB_END (bb)); update_bb_for_insn (bb); new_bb = create_basic_block (NEXT_INSN (last), get_last_insn (), bb); @@ -2191,7 +2191,7 @@ expand_gimple_cond (basic_block bb, gimple stmt) new_edge->probability = REG_BR_PROB_BASE; new_edge->count = new_bb->count; if (BARRIER_P (BB_END (new_bb))) - SET_BB_END (new_bb) = PREV_INSN (BB_END (new_bb)); + BB_END (new_bb) = PREV_INSN (BB_END (new_bb)); update_bb_for_insn (new_bb); maybe_dump_rtl_for_gimple_stmt (stmt, last2); @@ -3490,7 +3490,7 @@ expand_gimple_tailcall (basic_block bb, gimple stmt, bool *can_fallthru) | EDGE_SIBCALL); e->probability += probability; e->count += count; - SET_BB_END (bb) = last; + BB_END (bb) = last; update_bb_for_insn (bb); if (NEXT_INSN (last)) @@ -3499,7 +3499,7 @@ expand_gimple_tailcall (basic_block bb, gimple stmt, bool *can_fallthru) last = BB_END (bb); if (BARRIER_P (last)) - SET_BB_END (bb) = PREV_INSN (last); + BB_END (bb) = PREV_INSN (last); } maybe_dump_rtl_for_gimple_stmt (stmt, last2); @@ -4962,15 +4962,15 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) /* Java emits line number notes in the top of labels. ??? Make this go away once line number notes are obsoleted. */ - SET_BB_HEAD (bb) = NEXT_INSN (last); + BB_HEAD (bb) = NEXT_INSN (last); if (NOTE_P (BB_HEAD (bb))) - SET_BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb)); + BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb)); note = emit_note_after (NOTE_INSN_BASIC_BLOCK, BB_HEAD (bb)); maybe_dump_rtl_for_gimple_stmt (stmt, last); } else - SET_BB_HEAD (bb) = note = emit_note (NOTE_INSN_BASIC_BLOCK); + BB_HEAD (bb) = note = emit_note (NOTE_INSN_BASIC_BLOCK); NOTE_BASIC_BLOCK (note) = bb; @@ -5253,7 +5253,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) last = PREV_INSN (last); if (JUMP_TABLE_DATA_P (last)) last = PREV_INSN (PREV_INSN (last)); - SET_BB_END (bb) = last; + BB_END (bb) = last; update_bb_for_insn (bb); @@ -5355,7 +5355,7 @@ construct_exit_block (void) return; /* While emitting the function end we could move end of the last basic block. */ - SET_BB_END (prev_bb) = orig_end; + BB_END (prev_bb) = orig_end; while (NEXT_INSN (head) && NOTE_P (NEXT_INSN (head))) head = NEXT_INSN (head); /* But make sure exit_block starts with RETURN_LABEL, otherwise the @@ -5367,7 +5367,7 @@ construct_exit_block (void) while (NEXT_INSN (head) != return_label) { if (!NOTE_P (NEXT_INSN (head))) - SET_BB_END (prev_bb) = NEXT_INSN (head); + BB_END (prev_bb) = NEXT_INSN (head); head = NEXT_INSN (head); } } diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 2fe9593e0cf..db6c8f8f6f7 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -64,7 +64,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 cfg_layout_function_footer; +static GTY(()) rtx_insn *cfg_layout_function_footer; static GTY(()) rtx cfg_layout_function_header; static rtx_insn *skip_insns_after_block (basic_block); @@ -123,8 +123,9 @@ can_delete_label_p (const rtx_code_label *label) /* Delete INSN by patching it out. */ void -delete_insn (rtx insn) +delete_insn (rtx uncast_insn) { + rtx_insn *insn = as_a (uncast_insn); rtx note; bool really_delete = true; @@ -152,9 +153,9 @@ delete_insn (rtx insn) && bb == BLOCK_FOR_INSN (bb_note)) { reorder_insns_nobb (insn, insn, bb_note); - SET_BB_HEAD (bb) = bb_note; + BB_HEAD (bb) = bb_note; if (BB_END (bb) == bb_note) - SET_BB_END (bb) = insn; + BB_END (bb) = insn; } } @@ -326,8 +327,8 @@ create_basic_block_structure (rtx_insn *head, rtx_insn *end, rtx_note *bb_note, if (NEXT_INSN (end) == bb_note) end = bb_note; - SET_BB_HEAD (bb) = head; - SET_BB_END (bb) = end; + BB_HEAD (bb) = head; + BB_END (bb) = end; bb->index = last_basic_block_for_fn (cfun)++; bb->flags = BB_NEW | BB_RTL; link_block (bb, after); @@ -401,7 +402,7 @@ rtl_delete_block (basic_block b) end = get_last_bb_insn (b); /* Selectively delete the entire chain. */ - SET_BB_HEAD (b) = NULL; + BB_HEAD (b) = NULL; delete_insn_chain (insn, end, true); @@ -744,7 +745,7 @@ rtl_split_block (basic_block bb, void *insnp) /* Create the new basic block. */ new_bb = create_basic_block (NEXT_INSN (insn), BB_END (bb), bb); BB_COPY_PARTITION (new_bb, bb); - SET_BB_END (bb) = insn; + BB_END (bb) = insn; /* Redirect the outgoing edges. */ new_bb->succs = bb->succs; @@ -803,7 +804,7 @@ emit_nop_for_unique_locus_between (basic_block a, basic_block b) if (!unique_locus_on_edge_between_p (a, b)) return; - SET_BB_END (a) = emit_insn_after_noloc (gen_nop (), BB_END (a), a); + BB_END (a) = emit_insn_after_noloc (gen_nop (), BB_END (a), a); INSN_LOCATION (BB_END (a)) = EDGE_SUCC (a, 0)->goto_locus; } @@ -885,8 +886,8 @@ rtl_merge_blocks (basic_block a, basic_block b) /* Delete everything marked above as well as crap that might be hanging out between the two blocks. */ - SET_BB_END (a) = a_end; - SET_BB_HEAD (b) = b_empty ? NULL_RTX : b_head; + BB_END (a) = a_end; + BB_HEAD (b) = b_empty ? NULL : b_head; delete_insn_chain (del_first, del_last, true); /* When not optimizing and the edge is the only place in RTL which holds @@ -902,8 +903,8 @@ rtl_merge_blocks (basic_block a, basic_block b) { update_bb_for_insn_chain (a_end, b_debug_end, a); - SET_BB_END (a) = b_debug_end; - SET_BB_HEAD (b) = NULL_RTX; + BB_END (a) = b_debug_end; + BB_HEAD (b) = NULL; } else if (b_end != b_debug_end) { @@ -915,7 +916,7 @@ rtl_merge_blocks (basic_block a, basic_block b) reorder_insns_nobb (NEXT_INSN (a_end), PREV_INSN (b_debug_start), b_debug_end); update_bb_for_insn_chain (b_debug_start, b_debug_end, a); - SET_BB_END (a) = b_debug_end; + BB_END (a) = b_debug_end; } df_bb_delete (b->index); @@ -980,7 +981,7 @@ block_label (basic_block block) if (!LABEL_P (BB_HEAD (block))) { - SET_BB_HEAD (block) = emit_label_before (gen_label_rtx (), BB_HEAD (block)); + BB_HEAD (block) = emit_label_before (gen_label_rtx (), BB_HEAD (block)); } return BB_HEAD (block); @@ -3259,7 +3260,7 @@ fixup_abnormal_edges (void) e = find_fallthru_edge (bb->succs); stop = NEXT_INSN (BB_END (bb)); - SET_BB_END (bb) = insn; + BB_END (bb) = insn; for (insn = NEXT_INSN (insn); insn != stop; insn = next) { @@ -3455,7 +3456,7 @@ record_effective_endpoints (void) rtx_insn *end; if (PREV_INSN (BB_HEAD (bb)) && next_insn != BB_HEAD (bb)) - SET_BB_HEADER (bb) = unlink_insn_chain (next_insn, + BB_HEADER (bb) = unlink_insn_chain (next_insn, PREV_INSN (BB_HEAD (bb))); end = skip_insns_after_block (bb); if (NEXT_INSN (BB_END (bb)) && BB_END (bb) != end) @@ -3617,7 +3618,7 @@ relink_block_chain (bool stay_in_cfglayout_mode) { bb->aux = NULL; if (!stay_in_cfglayout_mode) - SET_BB_HEADER (bb) = BB_FOOTER (bb) = NULL; + BB_HEADER (bb) = BB_FOOTER (bb) = NULL; } /* Maybe reset the original copy tables, they are not valid anymore @@ -3910,7 +3911,7 @@ fixup_reorder_chain (void) } nb = split_edge (e); if (!INSN_P (BB_END (nb))) - SET_BB_END (nb) = emit_insn_after_noloc (gen_nop (), BB_END (nb), + BB_END (nb) = emit_insn_after_noloc (gen_nop (), BB_END (nb), nb); INSN_LOCATION (BB_END (nb)) = e->goto_locus; @@ -4190,7 +4191,7 @@ cfg_layout_duplicate_bb (basic_block bb) insn = NEXT_INSN (insn); insn = duplicate_insn_chain (BB_HEADER (bb), insn); if (insn) - SET_BB_HEADER (new_bb) = unlink_insn_chain (insn, get_last_insn ()); + BB_HEADER (new_bb) = unlink_insn_chain (insn, get_last_insn ()); } if (BB_FOOTER (bb)) @@ -4413,7 +4414,7 @@ static void cfg_layout_delete_block (basic_block bb) { rtx_insn *insn, *next, *prev = PREV_INSN (BB_HEAD (bb)), *remaints; - rtx *to; + rtx_insn **to; if (BB_HEADER (bb)) { @@ -4463,7 +4464,7 @@ cfg_layout_delete_block (basic_block bb) } } if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun)) - to = &SET_BB_HEADER (bb->next_bb); + to = &BB_HEADER (bb->next_bb); else to = &cfg_layout_function_footer; @@ -4605,7 +4606,7 @@ cfg_layout_merge_blocks (basic_block a, basic_block b) SET_PREV_INSN (BB_FOOTER (a)) = last; BB_FOOTER (a) = BB_HEADER (b); } - SET_BB_HEADER (b) = NULL; + BB_HEADER (b) = NULL; } /* In the case basic blocks are not adjacent, move them around. */ @@ -4619,7 +4620,7 @@ cfg_layout_merge_blocks (basic_block a, basic_block b) else { insn = BB_HEAD (b); - SET_BB_END (a) = BB_END (b); + BB_END (a) = BB_END (b); } /* emit_insn_after_noloc doesn't call df_insn_change_bb. @@ -4630,7 +4631,7 @@ cfg_layout_merge_blocks (basic_block a, basic_block b) if (!NOTE_INSN_BASIC_BLOCK_P (insn)) insn = NEXT_INSN (insn); gcc_assert (NOTE_INSN_BASIC_BLOCK_P (insn)); - SET_BB_HEAD (b) = SET_BB_END (b) = NULL; + BB_HEAD (b) = BB_END (b) = NULL; delete_insn (insn); df_bb_delete (b->index); @@ -5102,49 +5103,4 @@ struct cfg_hooks cfg_layout_rtl_cfg_hooks = { rtl_account_profile_record, }; -/* BB_HEAD as an rvalue. */ - -rtx_insn *BB_HEAD (const_basic_block bb) -{ - rtx insn = bb->il.x.head_; - return safe_as_a (insn); -} - -/* BB_HEAD for use as an lvalue. */ - -rtx& SET_BB_HEAD (basic_block bb) -{ - return bb->il.x.head_; -} - -/* BB_END as an rvalue. */ - -rtx_insn *BB_END (const_basic_block bb) -{ - rtx insn = bb->il.x.rtl->end_; - return safe_as_a (insn); -} - -/* BB_END as an lvalue. */ - -rtx& SET_BB_END (basic_block bb) -{ - return bb->il.x.rtl->end_; -} - -/* BB_HEADER as an rvalue. */ - -rtx_insn *BB_HEADER (const_basic_block bb) -{ - rtx insn = bb->il.x.rtl->header_; - return safe_as_a (insn); -} - -/* BB_HEADER as an lvalue. */ - -rtx& SET_BB_HEADER (basic_block bb) -{ - return bb->il.x.rtl->header_; -} - #include "gt-cfgrtl.h" diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index 2df5aaf75e8..0977fbcde54 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -5834,8 +5834,8 @@ hwloop_optimize (hwloop_info loop) SET_NEXT_INSN (PREV_INSN (BB_HEAD (bb))) = orig_vec[0]; SET_NEXT_INSN (orig_vec[n_insns - 1]) = NEXT_INSN (BB_END (bb)); SET_PREV_INSN (NEXT_INSN (BB_END (bb))) = orig_vec[n_insns - 1]; - SET_BB_HEAD (bb) = orig_vec[0]; - SET_BB_END (bb) = orig_vec[n_insns - 1]; + BB_HEAD (bb) = orig_vec[0]; + BB_END (bb) = orig_vec[n_insns - 1]; undo_splits: free_delay_pairs (); FOR_BB_INSNS (bb, insn) diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 377ce449f21..5504da992e9 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -9623,7 +9623,7 @@ emit_predicate_relation_info (void) rtx p = gen_rtx_REG (BImode, r); rtx_insn *n = emit_insn_after (gen_pred_rel_mutex (p), head); if (head == BB_END (bb)) - SET_BB_END (bb) = n; + BB_END (bb) = n; head = n; } } @@ -9646,9 +9646,9 @@ emit_predicate_relation_info (void) emit_insn_before (gen_safe_across_calls_all (), insn); rtx_insn *a = emit_insn_after (gen_safe_across_calls_normal (), insn); if (BB_HEAD (bb) == insn) - SET_BB_HEAD (bb) = b; + BB_HEAD (bb) = b; if (BB_END (bb) == insn) - SET_BB_END (bb) = a; + BB_END (bb) = a; } if (insn == BB_END (bb)) diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 84594d892b6..2e09160e711 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3982,8 +3982,9 @@ add_insn_before_nobb (rtx insn, rtx before) they know how to update a SEQUENCE. */ void -add_insn_after (rtx insn, rtx after, basic_block bb) +add_insn_after (rtx uncast_insn, rtx after, basic_block bb) { + rtx_insn *insn = as_a (uncast_insn); add_insn_after_nobb (insn, after); if (!BARRIER_P (after) && !BARRIER_P (insn) @@ -3998,7 +3999,7 @@ add_insn_after (rtx insn, rtx after, basic_block bb) /* Avoid clobbering of structure when creating new BB. */ && !BARRIER_P (insn) && !NOTE_INSN_BASIC_BLOCK_P (insn)) - SET_BB_END (bb) = insn; + BB_END (bb) = insn; } } @@ -4063,8 +4064,8 @@ set_insn_deleted (rtx insn) void remove_insn (rtx insn) { - rtx next = NEXT_INSN (insn); - rtx prev = PREV_INSN (insn); + rtx_insn *next = NEXT_INSN (insn); + rtx_insn *prev = PREV_INSN (insn); basic_block bb; if (prev) @@ -4127,10 +4128,10 @@ remove_insn (rtx insn) /* Never ever delete the basic block note without deleting whole basic block. */ gcc_assert (!NOTE_P (insn)); - SET_BB_HEAD (bb) = next; + BB_HEAD (bb) = next; } if (BB_END (bb) == insn) - SET_BB_END (bb) = prev; + BB_END (bb) = prev; } } @@ -4230,12 +4231,12 @@ reorder_insns (rtx_insn *from, rtx_insn *to, rtx_insn *after) && (bb2 = BLOCK_FOR_INSN (from))) { if (BB_END (bb2) == to) - SET_BB_END (bb2) = prev; + BB_END (bb2) = prev; df_set_bb_dirty (bb2); } if (BB_END (bb) == after) - SET_BB_END (bb) = to; + BB_END (bb) = to; for (x = from; x != NEXT_INSN (to); x = NEXT_INSN (x)) if (!BARRIER_P (x)) @@ -4381,10 +4382,10 @@ emit_label_before (rtx label, rtx before) efficiently. */ static rtx -emit_insn_after_1 (rtx first, rtx after, basic_block bb) +emit_insn_after_1 (rtx_insn *first, rtx after, basic_block bb) { - rtx last; - rtx after_after; + rtx_insn *last; + rtx_insn *after_after; if (!bb && !BARRIER_P (after)) bb = BLOCK_FOR_INSN (after); @@ -4403,7 +4404,7 @@ emit_insn_after_1 (rtx first, rtx after, basic_block bb) df_insn_rescan (last); } if (BB_END (bb) == after) - SET_BB_END (bb) = last; + BB_END (bb) = last; } else for (last = first; NEXT_INSN (last); last = NEXT_INSN (last)) @@ -4443,7 +4444,7 @@ emit_pattern_after_noloc (rtx x, rtx after, basic_block bb, case CODE_LABEL: case BARRIER: case NOTE: - last = emit_insn_after_1 (x, after, bb); + last = emit_insn_after_1 (as_a (x), after, bb); break; #ifdef ENABLE_RTL_CHECKING diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 5a64f8103c3..54691a30db1 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -4810,7 +4810,7 @@ get_ebb_head_tail (basic_block beg, basic_block end, reorder_insns_nobb (note, note, end_tail); if (end_tail == BB_END (end)) - SET_BB_END (end) = note; + BB_END (end) = note; if (BLOCK_FOR_INSN (note) != end) df_insn_change_bb (note, end); @@ -4869,7 +4869,7 @@ restore_other_notes (rtx_insn *head, basic_block head_bb) SET_NEXT_INSN (note_list) = head; if (BLOCK_FOR_INSN (head) != head_bb) - SET_BB_END (head_bb) = note_list; + BB_END (head_bb) = note_list; head = note_head; } @@ -5268,7 +5268,7 @@ move_insn (rtx_insn *insn, rtx last, rtx nt) gcc_assert (BLOCK_FOR_INSN (PREV_INSN (insn)) == bb); - SET_BB_END (bb) = PREV_INSN (insn); + BB_END (bb) = PREV_INSN (insn); } gcc_assert (BB_END (bb) != last); @@ -5317,7 +5317,7 @@ move_insn (rtx_insn *insn, rtx last, rtx nt) /* Update BB_END, if needed. */ if (BB_END (bb) == last) - SET_BB_END (bb) = insn; + BB_END (bb) = insn; } SCHED_GROUP_P (insn) = 0; @@ -7614,7 +7614,7 @@ sched_extend_bb (void) rtx_note *note = emit_note_after (NOTE_INSN_DELETED, end); /* Make note appear outside BB. */ set_block_for_insn (note, NULL); - SET_BB_END (EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb) = end; + BB_END (EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb) = end; } } @@ -8301,18 +8301,18 @@ fix_jump_move (rtx jump) if (!NOTE_INSN_BASIC_BLOCK_P (BB_END (jump_bb_next))) /* if jump_bb_next is not empty. */ - SET_BB_END (jump_bb) = BB_END (jump_bb_next); + BB_END (jump_bb) = BB_END (jump_bb_next); if (BB_END (bb) != PREV_INSN (jump)) /* Then there are instruction after jump that should be placed to jump_bb_next. */ - SET_BB_END (jump_bb_next) = BB_END (bb); + BB_END (jump_bb_next) = BB_END (bb); else /* Otherwise jump_bb_next is empty. */ - SET_BB_END (jump_bb_next) = NEXT_INSN (BB_HEAD (jump_bb_next)); + BB_END (jump_bb_next) = NEXT_INSN (BB_HEAD (jump_bb_next)); /* To make assertion in move_insn happy. */ - SET_BB_END (bb) = PREV_INSN (jump); + BB_END (bb) = PREV_INSN (jump); update_bb_for_insn (jump_bb_next); } diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 4034b78682a..d5ae98b9962 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -2631,7 +2631,7 @@ noce_process_if_block (struct noce_if_info *if_info) rtx note; if (else_bb && insn_b == BB_END (else_bb)) - SET_BB_END (else_bb) = PREV_INSN (insn_b); + BB_END (else_bb) = PREV_INSN (insn_b); reorder_insns (insn_b, insn_b, PREV_INSN (jump)); /* If there was a REG_EQUAL note, delete it since it may have been @@ -4392,7 +4392,7 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, rtx_insn *insn; if (end == BB_END (merge_bb)) - SET_BB_END (merge_bb) = PREV_INSN (head); + BB_END (merge_bb) = PREV_INSN (head); /* PR 21767: when moving insns above a conditional branch, the REG_EQUAL notes being moved might become invalid. */ diff --git a/gcc/ira.c b/gcc/ira.c index f2c6f84fc87..71f64dbb8f2 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -3761,7 +3761,7 @@ update_equiv_regs (void) REG_LIVE_LENGTH (regno) = 2; if (insn == BB_HEAD (bb)) - SET_BB_HEAD (bb) = PREV_INSN (insn); + BB_HEAD (bb) = PREV_INSN (insn); ira_reg_equiv[regno].init_insns = gen_rtx_INSN_LIST (VOIDmode, new_insn, NULL_RTX); diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 7e232f80ed2..3dabe30064d 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -2597,7 +2597,7 @@ change_stack (rtx_insn *insn, stack_ptr old, stack_ptr new_stack, } if (update_end) - SET_BB_END (current_block) = PREV_INSN (insn); + BB_END (current_block) = PREV_INSN (insn); } /* Print stack configuration. */ diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index d9a144b1276..3cfa47b82fc 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -1435,7 +1435,7 @@ sel_move_insn (expr_t expr, int seqno, insn_t after) /* Update links from insn to bb and vice versa. */ df_insn_change_bb (insn, bb); if (BB_END (bb) == after) - SET_BB_END (bb) = insn; + BB_END (bb) = insn; prepare_insn_expr (insn, seqno); return insn; diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index 7a871004345..c75f9b76f2d 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -5203,7 +5203,7 @@ move_nop_to_previous_block (insn_t nop, basic_block prev_bb) SET_NEXT_INSN (nop) = note; SET_PREV_INSN (next_insn) = note; - SET_BB_END (prev_bb) = nop; + BB_END (prev_bb) = nop; BLOCK_FOR_INSN (nop) = prev_bb; } diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt index bcdb1878ead..f7c4d1d4b64 100644 --- a/rtx-classes-status.txt +++ b/rtx-classes-status.txt @@ -15,5 +15,4 @@ Phase 6: use extra rtx_def subclasses: TODO TODO: "Scaffolding" to be removed ================================= * DF_REF_INSN -* SET_BB_HEAD, SET_BB_END, SET_BB_HEADER * SET_NEXT_INSN, SET_PREV_INSN -- 2.30.2