Split BB_HEAD et al into BB_HEAD/SET_BB_HEAD variants
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Aug 2014 20:48:17 +0000 (20:48 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Aug 2014 20:48:17 +0000 (20:48 +0000)
gcc/
2014-08-18  David Malcolm  <dmalcolm@redhat.com>

* basic-block.h (BB_HEAD): Split macro in two: the existing one,
for rvalues, and...
(SET_BB_HEAD): New macro, for use as a lvalue.
(BB_END, SET_BB_END): Likewise.
(BB_HEADER, SET_BB_HEADER): Likewise.
(BB_FOOTER, SET_BB_FOOTER): Likewise.

* bb-reorder.c (add_labels_and_missing_jumps): Convert lvalue use
of BB_* macros into SET_BB_* macros.
(fix_crossing_unconditional_branches): Likewise.
* caller-save.c (save_call_clobbered_regs): Likewise.
(insert_one_insn): Likewise.
* cfgbuild.c (find_bb_boundaries): Likewise.
* cfgcleanup.c (merge_blocks_move_successor_nojumps): Likewise.
(outgoing_edges_match): Likewise.
(try_optimize_cfg): Likewise.
* cfgexpand.c (expand_gimple_cond): Likewise.
(expand_gimple_tailcall): Likewise.
(expand_gimple_basic_block): Likewise.
(construct_exit_block): Likewise.
* cfgrtl.c (delete_insn): Likewise.
(create_basic_block_structure): Likewise.
(rtl_delete_block): Likewise.
(rtl_split_block): Likewise.
(emit_nop_for_unique_locus_between): Likewise.
(rtl_merge_blocks): Likewise.
(block_label): Likewise.
(try_redirect_by_replacing_jump): Likewise.
(emit_barrier_after_bb): Likewise.
(fixup_abnormal_edges): Likewise.
(record_effective_endpoints): Likewise.
(relink_block_chain): Likewise.
(fixup_reorder_chain): Likewise.
(fixup_fallthru_exit_predecessor): Likewise.
(cfg_layout_duplicate_bb): Likewise.
(cfg_layout_split_block): Likewise.
(cfg_layout_delete_block): Likewise.
(cfg_layout_merge_blocks): Likewise.
* combine.c (update_cfg_for_uncondjump): Likewise.
* emit-rtl.c (add_insn_after): Likewise.
(remove_insn): Likewise.
(reorder_insns): Likewise.
(emit_insn_after_1): Likewise.
* haifa-sched.c (get_ebb_head_tail): Likewise.
(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): Likewise.
* reg-stack.c (change_stack): Likewise.
* sel-sched-ir.c (sel_move_insn): Likewise.
* sel-sched.c (move_nop_to_previous_block): Likewise.

* config/c6x/c6x.c (hwloop_optimize): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info): Likewise.

/
2014-08-18  David Malcolm  <dmalcolm@redhat.com>

* rtx-classes-status.txt (TODO): Add SET_BB_HEAD, SET_BB_END,
SET_BB_HEADER, SET_BB_FOOTER

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214121 138bc75d-0d04-0410-961f-82ee72b054a4

20 files changed:
ChangeLog
gcc/ChangeLog
gcc/basic-block.h
gcc/bb-reorder.c
gcc/caller-save.c
gcc/cfgbuild.c
gcc/cfgcleanup.c
gcc/cfgexpand.c
gcc/cfgrtl.c
gcc/combine.c
gcc/config/c6x/c6x.c
gcc/config/ia64/ia64.c
gcc/emit-rtl.c
gcc/haifa-sched.c
gcc/ifcvt.c
gcc/ira.c
gcc/reg-stack.c
gcc/sel-sched-ir.c
gcc/sel-sched.c
rtx-classes-status.txt

index 071a551..4688fe0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-08-18  David Malcolm  <dmalcolm@redhat.com>
 
+       * rtx-classes-status.txt (TODO): Add SET_BB_HEAD, SET_BB_END,
+       SET_BB_HEADER, SET_BB_FOOTER
+
+2014-08-18  David Malcolm  <dmalcolm@redhat.com>
+
        * rtx-classes-status.txt: New file
 
 2014-08-18 Roman Gareev  <gareevroman@gmail.com>
index 931a95f..a6f2c4b 100644 (file)
@@ -1,5 +1,65 @@
 2014-08-18  David Malcolm  <dmalcolm@redhat.com>
 
+       * basic-block.h (BB_HEAD): Split macro in two: the existing one,
+       for rvalues, and...
+       (SET_BB_HEAD): New macro, for use as a lvalue.
+       (BB_END, SET_BB_END): Likewise.
+       (BB_HEADER, SET_BB_HEADER): Likewise.
+       (BB_FOOTER, SET_BB_FOOTER): Likewise.
+
+       * bb-reorder.c (add_labels_and_missing_jumps): Convert lvalue use
+       of BB_* macros into SET_BB_* macros.
+       (fix_crossing_unconditional_branches): Likewise.
+       * caller-save.c (save_call_clobbered_regs): Likewise.
+       (insert_one_insn): Likewise.
+       * cfgbuild.c (find_bb_boundaries): Likewise.
+       * cfgcleanup.c (merge_blocks_move_successor_nojumps): Likewise.
+       (outgoing_edges_match): Likewise.
+       (try_optimize_cfg): Likewise.
+       * cfgexpand.c (expand_gimple_cond): Likewise.
+       (expand_gimple_tailcall): Likewise.
+       (expand_gimple_basic_block): Likewise.
+       (construct_exit_block): Likewise.
+       * cfgrtl.c (delete_insn): Likewise.
+       (create_basic_block_structure): Likewise.
+       (rtl_delete_block): Likewise.
+       (rtl_split_block): Likewise.
+       (emit_nop_for_unique_locus_between): Likewise.
+       (rtl_merge_blocks): Likewise.
+       (block_label): Likewise.
+       (try_redirect_by_replacing_jump): Likewise.
+       (emit_barrier_after_bb): Likewise.
+       (fixup_abnormal_edges): Likewise.
+       (record_effective_endpoints): Likewise.
+       (relink_block_chain): Likewise.
+       (fixup_reorder_chain): Likewise.
+       (fixup_fallthru_exit_predecessor): Likewise.
+       (cfg_layout_duplicate_bb): Likewise.
+       (cfg_layout_split_block): Likewise.
+       (cfg_layout_delete_block): Likewise.
+       (cfg_layout_merge_blocks): Likewise.
+       * combine.c (update_cfg_for_uncondjump): Likewise.
+       * emit-rtl.c (add_insn_after): Likewise.
+       (remove_insn): Likewise.
+       (reorder_insns): Likewise.
+       (emit_insn_after_1): Likewise.
+       * haifa-sched.c (get_ebb_head_tail): Likewise.
+       (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): Likewise.
+       * reg-stack.c (change_stack): Likewise.
+       * sel-sched-ir.c (sel_move_insn): Likewise.
+       * sel-sched.c (move_nop_to_previous_block): Likewise.
+
+       * config/c6x/c6x.c (hwloop_optimize): Likewise.
+       * config/ia64/ia64.c (emit_predicate_relation_info): Likewise.
+
+2014-08-18  David Malcolm  <dmalcolm@redhat.com>
+
        * rtl.h (for_each_rtx_in_insn): New function.
        * rtlanal.c (for_each_rtx_in_insn): Likewise.
 
index f417b34..98cb00c 100644 (file)
@@ -368,10 +368,17 @@ struct GTY(()) control_flow_graph {
 \f
 /* Stuff for recording basic block info.  */
 
-#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_
+/* These macros are currently split into two:
+   one suitable for reading, and for writing.
+   These will become functions in a follow-up patch.  */
+#define BB_HEAD(B)      (((const_basic_block)B)->il.x.head_)
+#define SET_BB_HEAD(B)  (B)->il.x.head_
+#define BB_END(B)       (((const rtl_bb_info *)(B)->il.x.rtl)->end_)
+#define SET_BB_END(B)   (B)->il.x.rtl->end_
+#define BB_HEADER(B)    (((const rtl_bb_info *)(B)->il.x.rtl)->header_)
+#define SET_BB_HEADER(B) (B)->il.x.rtl->header_
+#define BB_FOOTER(B)    (((const rtl_bb_info *)(B)->il.x.rtl)->footer_)
+#define SET_BB_FOOTER(B) (B)->il.x.rtl->footer_
 
 /* Special block numbers [markers] for entry and exit.
    Neither of them is supposed to hold actual statements.  */
index 96547c2..8675be0 100644 (file)
@@ -1757,7 +1757,7 @@ add_labels_and_missing_jumps (vec<edge> crossing_edges)
       gcc_assert (single_succ_p (src));
 
       new_jump = emit_jump_insn_after (gen_jump (label), BB_END (src));
-      BB_END (src) = new_jump;
+      SET_BB_END (src) = new_jump;
       JUMP_LABEL (new_jump) = label;
       LABEL_NUSES (label) += 1;
 
@@ -2188,7 +2188,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...).  */
 
-             BB_END (cur_bb) = jump_insn;
+             SET_BB_END (cur_bb) = jump_insn;
            }
        }
     }
index 64fd66c..41b3f01 100644 (file)
@@ -921,7 +921,7 @@ save_call_clobbered_regs (void)
                      if (NEXT_INSN (ins))
                        PREV_INSN (NEXT_INSN (ins)) = ins;
                       if (BB_END (bb) == insn)
-                       BB_END (bb) = ins;
+                       SET_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)))
-       BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn;
+       SET_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)))
-       BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn;
+       SET_BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn;
     }
   new_chain->block = chain->block;
   new_chain->is_caller_save_insn = 1;
index ae1f114..76d3a99 100644 (file)
@@ -467,7 +467,7 @@ find_bb_boundaries (basic_block bb)
          fallthru = split_block (bb, PREV_INSN (insn));
          if (flow_transfer_insn)
            {
-             BB_END (bb) = flow_transfer_insn;
+             SET_BB_END (bb) = flow_transfer_insn;
 
              /* Clean up the bb field for the insns between the blocks.  */
              for (x = NEXT_INSN (flow_transfer_insn);
@@ -504,7 +504,7 @@ find_bb_boundaries (basic_block bb)
      ordinary jump, we need to take care and move basic block boundary.  */
   if (flow_transfer_insn)
     {
-      BB_END (bb) = flow_transfer_insn;
+      SET_BB_END (bb) = flow_transfer_insn;
 
       /* Clean up the bb field for the insns that do not belong to BB.  */
       x = flow_transfer_insn;
index 0fbfd55..d6d4bc0 100644 (file)
@@ -726,7 +726,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))
     {
-      BB_END (b) = table;
+      SET_BB_END (b) = table;
     }
 
   /* There had better have been a barrier there.  Delete it.  */
@@ -739,7 +739,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.  */
-  BB_END (b) = real_b_end;
+  SET_BB_END (b) = real_b_end;
 
   if (dump_file)
     fprintf (dump_file, "Moved block %d after %d and merged.\n",
@@ -1723,7 +1723,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 (&BB_END (bb1), replace_label, &rr);
+                 for_each_rtx (&SET_BB_END (bb1), replace_label, &rr);
 
                  match = (old_insns_match_p (mode, BB_END (bb1), BB_END (bb2))
                           == dir_both);
@@ -1737,7 +1737,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 (&BB_END (bb1), replace_label, &rr);
+                 for_each_rtx (&SET_BB_END (bb1), replace_label, &rr);
 
                  return match;
                }
@@ -2673,13 +2673,13 @@ try_optimize_cfg (int mode)
                                {
                                  if (BB_FOOTER (b))
                                    {
-                                     BB_FOOTER (e->src) = BB_FOOTER (b);
-                                     BB_FOOTER (b) = NULL;
+                                     SET_BB_FOOTER (e->src) = BB_FOOTER (b);
+                                     SET_BB_FOOTER (b) = NULL;
                                    }
                                  else
                                    {
                                      start_sequence ();
-                                     BB_FOOTER (e->src) = emit_barrier ();
+                                     SET_BB_FOOTER (e->src) = emit_barrier ();
                                      end_sequence ();
                                    }
                                }
index f6da5d6..1235ff1 100644 (file)
@@ -2170,9 +2170,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));
 
-  BB_END (bb) = last;
+  SET_BB_END (bb) = last;
   if (BARRIER_P (BB_END (bb)))
-    BB_END (bb) = PREV_INSN (BB_END (bb));
+    SET_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);
@@ -2186,7 +2186,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)))
-    BB_END (new_bb) = PREV_INSN (BB_END (new_bb));
+    SET_BB_END (new_bb) = PREV_INSN (BB_END (new_bb));
   update_bb_for_insn (new_bb);
 
   maybe_dump_rtl_for_gimple_stmt (stmt, last2);
@@ -3485,7 +3485,7 @@ expand_gimple_tailcall (basic_block bb, gimple stmt, bool *can_fallthru)
                 | EDGE_SIBCALL);
   e->probability += probability;
   e->count += count;
-  BB_END (bb) = last;
+  SET_BB_END (bb) = last;
   update_bb_for_insn (bb);
 
   if (NEXT_INSN (last))
@@ -3494,7 +3494,7 @@ expand_gimple_tailcall (basic_block bb, gimple stmt, bool *can_fallthru)
 
       last = BB_END (bb);
       if (BARRIER_P (last))
-       BB_END (bb) = PREV_INSN (last);
+       SET_BB_END (bb) = PREV_INSN (last);
     }
 
   maybe_dump_rtl_for_gimple_stmt (stmt, last2);
@@ -4955,15 +4955,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.  */
-      BB_HEAD (bb) = NEXT_INSN (last);
+      SET_BB_HEAD (bb) = NEXT_INSN (last);
       if (NOTE_P (BB_HEAD (bb)))
-       BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb));
+       SET_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
-    note = BB_HEAD (bb) = emit_note (NOTE_INSN_BASIC_BLOCK);
+    note = SET_BB_HEAD (bb) = emit_note (NOTE_INSN_BASIC_BLOCK);
 
   NOTE_BASIC_BLOCK (note) = bb;
 
@@ -5246,7 +5246,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));
-  BB_END (bb) = last;
+  SET_BB_END (bb) = last;
 
   update_bb_for_insn (bb);
 
@@ -5348,7 +5348,7 @@ construct_exit_block (void)
     return;
   /* While emitting the function end we could move end of the last basic
      block.  */
-  BB_END (prev_bb) = orig_end;
+  SET_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
@@ -5360,7 +5360,7 @@ construct_exit_block (void)
       while (NEXT_INSN (head) != return_label)
        {
          if (!NOTE_P (NEXT_INSN (head)))
-           BB_END (prev_bb) = NEXT_INSN (head);
+           SET_BB_END (prev_bb) = NEXT_INSN (head);
          head = NEXT_INSN (head);
        }
     }
index 148c19d..6543762 100644 (file)
@@ -152,9 +152,9 @@ delete_insn (rtx insn)
              && bb == BLOCK_FOR_INSN (bb_note))
            {
              reorder_insns_nobb (insn, insn, bb_note);
-             BB_HEAD (bb) = bb_note;
+             SET_BB_HEAD (bb) = bb_note;
              if (BB_END (bb) == bb_note)
-               BB_END (bb) = insn;
+               SET_BB_END (bb) = insn;
            }
        }
 
@@ -326,8 +326,8 @@ create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after)
   if (NEXT_INSN (end) == bb_note)
     end = bb_note;
 
-  BB_HEAD (bb) = head;
-  BB_END (bb) = end;
+  SET_BB_HEAD (bb) = head;
+  SET_BB_END (bb) = end;
   bb->index = last_basic_block_for_fn (cfun)++;
   bb->flags = BB_NEW | BB_RTL;
   link_block (bb, after);
@@ -400,7 +400,7 @@ rtl_delete_block (basic_block b)
   end = get_last_bb_insn (b);
 
   /* Selectively delete the entire chain.  */
-  BB_HEAD (b) = NULL;
+  SET_BB_HEAD (b) = NULL;
   delete_insn_chain (insn, end, true);
 
 
@@ -743,7 +743,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);
-  BB_END (bb) = insn;
+  SET_BB_END (bb) = insn;
 
   /* Redirect the outgoing edges.  */
   new_bb->succs = bb->succs;
@@ -802,7 +802,7 @@ emit_nop_for_unique_locus_between (basic_block a, basic_block b)
   if (!unique_locus_on_edge_between_p (a, b))
     return;
 
-  BB_END (a) = emit_insn_after_noloc (gen_nop (), BB_END (a), a);
+  SET_BB_END (a) = emit_insn_after_noloc (gen_nop (), BB_END (a), a);
   INSN_LOCATION (BB_END (a)) = EDGE_SUCC (a, 0)->goto_locus;
 }
 
@@ -884,8 +884,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.  */
-  BB_END (a) = a_end;
-  BB_HEAD (b) = b_empty ? NULL_RTX : b_head;
+  SET_BB_END (a) = a_end;
+  SET_BB_HEAD (b) = b_empty ? NULL_RTX : b_head;
   delete_insn_chain (del_first, del_last, true);
 
   /* When not optimizing and the edge is the only place in RTL which holds
@@ -901,8 +901,8 @@ rtl_merge_blocks (basic_block a, basic_block b)
     {
       update_bb_for_insn_chain (a_end, b_debug_end, a);
 
-      BB_END (a) = b_debug_end;
-      BB_HEAD (b) = NULL_RTX;
+      SET_BB_END (a) = b_debug_end;
+      SET_BB_HEAD (b) = NULL_RTX;
     }
   else if (b_end != b_debug_end)
     {
@@ -914,7 +914,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);
-      BB_END (a) = b_debug_end;
+      SET_BB_END (a) = b_debug_end;
     }
 
   df_bb_delete (b->index);
@@ -979,7 +979,7 @@ block_label (basic_block block)
 
   if (!LABEL_P (BB_HEAD (block)))
     {
-      BB_HEAD (block) = emit_label_before (gen_label_rtx (), BB_HEAD (block));
+      SET_BB_HEAD (block) = emit_label_before (gen_label_rtx (), BB_HEAD (block));
     }
 
   return BB_HEAD (block);
@@ -1062,7 +1062,7 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
                  if (PREV_INSN (insn))
                    NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
                  else
-                   BB_FOOTER (src) = NEXT_INSN (insn);
+                   SET_BB_FOOTER (src) = NEXT_INSN (insn);
                  if (NEXT_INSN (insn))
                    PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
                }
@@ -1447,7 +1447,7 @@ emit_barrier_after_bb (basic_block bb)
   gcc_assert (current_ir_type () == IR_RTL_CFGRTL
               || current_ir_type () == IR_RTL_CFGLAYOUT);
   if (current_ir_type () == IR_RTL_CFGLAYOUT)
-    BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
+    SET_BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
 }
 
 /* Like force_nonfallthru below, but additionally performs redirection
@@ -3252,7 +3252,7 @@ fixup_abnormal_edges (void)
              e = find_fallthru_edge (bb->succs);
 
              stop = NEXT_INSN (BB_END (bb));
-             BB_END (bb) = insn;
+             SET_BB_END (bb) = insn;
 
              for (insn = NEXT_INSN (insn); insn != stop; insn = next)
                {
@@ -3448,11 +3448,11 @@ record_effective_endpoints (void)
       rtx end;
 
       if (PREV_INSN (BB_HEAD (bb)) && next_insn != BB_HEAD (bb))
-       BB_HEADER (bb) = unlink_insn_chain (next_insn,
-                                             PREV_INSN (BB_HEAD (bb)));
+       SET_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)
-       BB_FOOTER (bb) = unlink_insn_chain (NEXT_INSN (BB_END (bb)), end);
+       SET_BB_FOOTER (bb) = unlink_insn_chain (NEXT_INSN (BB_END (bb)), end);
       next_insn = NEXT_INSN (BB_END (bb));
     }
 
@@ -3610,7 +3610,7 @@ relink_block_chain (bool stay_in_cfglayout_mode)
     {
       bb->aux = NULL;
       if (!stay_in_cfglayout_mode)
-       BB_HEADER (bb) = BB_FOOTER (bb) = NULL;
+       SET_BB_HEADER (bb) = SET_BB_FOOTER (bb) = NULL;
     }
 
   /* Maybe reset the original copy tables, they are not valid anymore
@@ -3903,8 +3903,8 @@ fixup_reorder_chain (void)
                }
              nb = split_edge (e);
              if (!INSN_P (BB_END (nb)))
-               BB_END (nb) = emit_insn_after_noloc (gen_nop (), BB_END (nb),
-                                                    nb);
+               SET_BB_END (nb) = emit_insn_after_noloc (gen_nop (), BB_END (nb),
+                                                        nb);
              INSN_LOCATION (BB_END (nb)) = e->goto_locus;
 
              /* If there are other incoming edges to the destination block
@@ -3978,8 +3978,8 @@ fixup_fallthru_exit_predecessor (void)
          bb = split_block (bb, NULL)->dest;
          bb->aux = c->aux;
          c->aux = bb;
-         BB_FOOTER (bb) = BB_FOOTER (c);
-         BB_FOOTER (c) = NULL;
+         SET_BB_FOOTER (bb) = BB_FOOTER (c);
+         SET_BB_FOOTER (c) = NULL;
        }
 
       while (c->aux != bb)
@@ -4182,7 +4182,7 @@ cfg_layout_duplicate_bb (basic_block bb)
        insn = NEXT_INSN (insn);
       insn = duplicate_insn_chain (BB_HEADER (bb), insn);
       if (insn)
-       BB_HEADER (new_bb) = unlink_insn_chain (insn, get_last_insn ());
+       SET_BB_HEADER (new_bb) = unlink_insn_chain (insn, get_last_insn ());
     }
 
   if (BB_FOOTER (bb))
@@ -4192,7 +4192,7 @@ cfg_layout_duplicate_bb (basic_block bb)
        insn = NEXT_INSN (insn);
       insn = duplicate_insn_chain (BB_FOOTER (bb), insn);
       if (insn)
-       BB_FOOTER (new_bb) = unlink_insn_chain (insn, get_last_insn ());
+       SET_BB_FOOTER (new_bb) = unlink_insn_chain (insn, get_last_insn ());
     }
 
   return new_bb;
@@ -4300,8 +4300,8 @@ cfg_layout_split_block (basic_block bb, void *insnp)
   rtx insn = (rtx) insnp;
   basic_block new_bb = rtl_split_block (bb, insn);
 
-  BB_FOOTER (new_bb) = BB_FOOTER (bb);
-  BB_FOOTER (bb) = NULL;
+  SET_BB_FOOTER (new_bb) = BB_FOOTER (bb);
+  SET_BB_FOOTER (bb) = NULL;
 
   return new_bb;
 }
@@ -4431,7 +4431,7 @@ cfg_layout_delete_block (basic_block bb)
              if (PREV_INSN (insn))
                NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
              else
-               BB_FOOTER (bb) = NEXT_INSN (insn);
+               SET_BB_FOOTER (bb) = NEXT_INSN (insn);
              if (NEXT_INSN (insn))
                PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
            }
@@ -4454,7 +4454,7 @@ cfg_layout_delete_block (basic_block bb)
        }
     }
   if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
-    to = &BB_HEADER (bb->next_bb);
+    to = &SET_BB_HEADER (bb->next_bb);
   else
     to = &cfg_layout_function_footer;
 
@@ -4566,7 +4566,7 @@ cfg_layout_merge_blocks (basic_block a, basic_block b)
   if (BB_FOOTER (b))
     {
       if (!BB_FOOTER (a))
-       BB_FOOTER (a) = BB_FOOTER (b);
+       SET_BB_FOOTER (a) = SET_BB_FOOTER (b);
       else
        {
          rtx last = BB_FOOTER (a);
@@ -4576,7 +4576,7 @@ cfg_layout_merge_blocks (basic_block a, basic_block b)
          NEXT_INSN (last) = BB_FOOTER (b);
          PREV_INSN (BB_FOOTER (b)) = last;
        }
-      BB_FOOTER (b) = NULL;
+      SET_BB_FOOTER (b) = NULL;
     }
 
   /* Move things from b->header before a->footer.
@@ -4585,7 +4585,7 @@ cfg_layout_merge_blocks (basic_block a, basic_block b)
    if (BB_HEADER (b))
      {
       if (! BB_FOOTER (a))
-       BB_FOOTER (a) = BB_HEADER (b);
+       SET_BB_FOOTER (a) = BB_HEADER (b);
       else
        {
          rtx last = BB_HEADER (b);
@@ -4594,9 +4594,9 @@ cfg_layout_merge_blocks (basic_block a, basic_block b)
            last = NEXT_INSN (last);
          NEXT_INSN (last) = BB_FOOTER (a);
          PREV_INSN (BB_FOOTER (a)) = last;
-         BB_FOOTER (a) = BB_HEADER (b);
+         SET_BB_FOOTER (a) = BB_HEADER (b);
        }
-      BB_HEADER (b) = NULL;
+      SET_BB_HEADER (b) = NULL;
     }
 
   /* In the case basic blocks are not adjacent, move them around.  */
@@ -4610,7 +4610,7 @@ cfg_layout_merge_blocks (basic_block a, basic_block b)
   else
     {
       insn = BB_HEAD (b);
-      BB_END (a) = BB_END (b);
+      SET_BB_END (a) = BB_END (b);
     }
 
   /* emit_insn_after_noloc doesn't call df_insn_change_bb.
@@ -4621,7 +4621,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));
-  BB_HEAD (b) = BB_END (b) = NULL;
+  SET_BB_HEAD (b) = SET_BB_END (b) = NULL;
   delete_insn (insn);
 
   df_bb_delete (b->index);
index c3f0ae7..2fd516e 100644 (file)
@@ -2422,7 +2422,7 @@ update_cfg_for_uncondjump (rtx insn)
            if (PREV_INSN (insn))
              NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
            else
-             BB_FOOTER (bb) = NEXT_INSN (insn);
+             SET_BB_FOOTER (bb) = NEXT_INSN (insn);
            if (NEXT_INSN (insn))
              PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
          }
index 7fa60b9..90241ea 100644 (file)
@@ -5828,8 +5828,8 @@ hwloop_optimize (hwloop_info loop)
   NEXT_INSN (PREV_INSN (BB_HEAD (bb))) = orig_vec[0];
   NEXT_INSN (orig_vec[n_insns - 1]) = NEXT_INSN (BB_END (bb));
   PREV_INSN (NEXT_INSN (BB_END (bb))) = orig_vec[n_insns - 1];
-  BB_HEAD (bb) = orig_vec[0];
-  BB_END (bb) = orig_vec[n_insns - 1];
+  SET_BB_HEAD (bb) = orig_vec[0];
+  SET_BB_END (bb) = orig_vec[n_insns - 1];
  undo_splits:
   free_delay_pairs ();
   FOR_BB_INSNS (bb, insn)
index cb840fd..ae22bea 100644 (file)
@@ -9618,7 +9618,7 @@ emit_predicate_relation_info (void)
            rtx p = gen_rtx_REG (BImode, r);
            rtx n = emit_insn_after (gen_pred_rel_mutex (p), head);
            if (head == BB_END (bb))
-             BB_END (bb) = n;
+             SET_BB_END (bb) = n;
            head = n;
          }
     }
@@ -9640,9 +9640,9 @@ emit_predicate_relation_info (void)
              rtx b = emit_insn_before (gen_safe_across_calls_all (), insn);
              rtx a = emit_insn_after (gen_safe_across_calls_normal (), insn);
              if (BB_HEAD (bb) == insn)
-               BB_HEAD (bb) = b;
+               SET_BB_HEAD (bb) = b;
              if (BB_END (bb) == insn)
-               BB_END (bb) = a;
+               SET_BB_END (bb) = a;
            }
 
          if (insn == BB_END (bb))
index 94f3275..56aad90 100644 (file)
@@ -3997,7 +3997,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))
-       BB_END (bb) = insn;
+       SET_BB_END (bb) = insn;
     }
 }
 
@@ -4126,10 +4126,10 @@ remove_insn (rtx insn)
          /* Never ever delete the basic block note without deleting whole
             basic block.  */
          gcc_assert (!NOTE_P (insn));
-         BB_HEAD (bb) = next;
+         SET_BB_HEAD (bb) = next;
        }
       if (BB_END (bb) == insn)
-       BB_END (bb) = prev;
+       SET_BB_END (bb) = prev;
     }
 }
 
@@ -4229,12 +4229,12 @@ reorder_insns (rtx from, rtx to, rtx after)
          && (bb2 = BLOCK_FOR_INSN (from)))
        {
          if (BB_END (bb2) == to)
-           BB_END (bb2) = prev;
+           SET_BB_END (bb2) = prev;
          df_set_bb_dirty (bb2);
        }
 
       if (BB_END (bb) == after)
-       BB_END (bb) = to;
+       SET_BB_END (bb) = to;
 
       for (x = from; x != NEXT_INSN (to); x = NEXT_INSN (x))
        if (!BARRIER_P (x))
@@ -4402,7 +4402,7 @@ emit_insn_after_1 (rtx first, rtx after, basic_block bb)
          df_insn_rescan (last);
        }
       if (BB_END (bb) == after)
-       BB_END (bb) = last;
+       SET_BB_END (bb) = last;
     }
   else
     for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
index aada6e4..69002af 100644 (file)
@@ -4809,7 +4809,7 @@ get_ebb_head_tail (basic_block beg, basic_block end, rtx *headp, rtx *tailp)
                reorder_insns_nobb (note, note, end_tail);
 
                if (end_tail == BB_END (end))
-                 BB_END (end) = note;
+                 SET_BB_END (end) = note;
 
                if (BLOCK_FOR_INSN (note) != end)
                  df_insn_change_bb (note, end);
@@ -4868,7 +4868,7 @@ restore_other_notes (rtx head, basic_block head_bb)
       NEXT_INSN (note_list) = head;
 
       if (BLOCK_FOR_INSN (head) != head_bb)
-       BB_END (head_bb) = note_list;
+       SET_BB_END (head_bb) = note_list;
 
       head = note_head;
     }
@@ -5267,7 +5267,7 @@ move_insn (rtx insn, rtx last, rtx nt)
 
          gcc_assert (BLOCK_FOR_INSN (PREV_INSN (insn)) == bb);
 
-         BB_END (bb) = PREV_INSN (insn);
+         SET_BB_END (bb) = PREV_INSN (insn);
        }
 
       gcc_assert (BB_END (bb) != last);
@@ -5316,7 +5316,7 @@ move_insn (rtx insn, rtx last, rtx nt)
 
       /* Update BB_END, if needed.  */
       if (BB_END (bb) == last)
-       BB_END (bb) = insn;
+       SET_BB_END (bb) = insn;
     }
 
   SCHED_GROUP_P (insn) = 0;
@@ -7613,7 +7613,7 @@ sched_extend_bb (void)
       rtx note = emit_note_after (NOTE_INSN_DELETED, end);
       /* Make note appear outside BB.  */
       set_block_for_insn (note, NULL);
-      BB_END (EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb) = end;
+      SET_BB_END (EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb) = end;
     }
 }
 
@@ -8297,18 +8297,18 @@ fix_jump_move (rtx jump)
 
   if (!NOTE_INSN_BASIC_BLOCK_P (BB_END (jump_bb_next)))
     /* if jump_bb_next is not empty.  */
-    BB_END (jump_bb) = BB_END (jump_bb_next);
+    SET_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.  */
-    BB_END (jump_bb_next) = BB_END (bb);
+    SET_BB_END (jump_bb_next) = BB_END (bb);
   else
     /* Otherwise jump_bb_next is empty.  */
-    BB_END (jump_bb_next) = NEXT_INSN (BB_HEAD (jump_bb_next));
+    SET_BB_END (jump_bb_next) = NEXT_INSN (BB_HEAD (jump_bb_next));
 
   /* To make assertion in move_insn happy.  */
-  BB_END (bb) = PREV_INSN (jump);
+  SET_BB_END (bb) = PREV_INSN (jump);
 
   update_bb_for_insn (jump_bb_next);
 }
index 521dca0..8e0f3bd 100644 (file)
@@ -2618,7 +2618,7 @@ noce_process_if_block (struct noce_if_info *if_info)
          rtx note;
 
          if (else_bb && insn_b == BB_END (else_bb))
-           BB_END (else_bb) = PREV_INSN (insn_b);
+           SET_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
@@ -4372,7 +4372,7 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb,
       rtx insn;
 
       if (end == BB_END (merge_bb))
-       BB_END (merge_bb) = PREV_INSN (head);
+       SET_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.  */
index ccc6c79..3f41061 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3760,7 +3760,7 @@ update_equiv_regs (void)
                      REG_LIVE_LENGTH (regno) = 2;
 
                      if (insn == BB_HEAD (bb))
-                       BB_HEAD (bb) = PREV_INSN (insn);
+                       SET_BB_HEAD (bb) = PREV_INSN (insn);
 
                      ira_reg_equiv[regno].init_insns
                        = gen_rtx_INSN_LIST (VOIDmode, new_insn, NULL_RTX);
index f24382c..fe1ce7e 100644 (file)
@@ -2595,7 +2595,7 @@ change_stack (rtx insn, stack_ptr old, stack_ptr new_stack, enum emit_where wher
     }
 
   if (update_end)
-    BB_END (current_block) = PREV_INSN (insn);
+    SET_BB_END (current_block) = PREV_INSN (insn);
 }
 \f
 /* Print stack configuration.  */
index 0399efa..8411d6f 100644 (file)
@@ -1432,7 +1432,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)
-    BB_END (bb) = insn;
+    SET_BB_END (bb) = insn;
 
   prepare_insn_expr (insn, seqno);
   return insn;
index 416e917..60a077c 100644 (file)
@@ -5202,7 +5202,7 @@ move_nop_to_previous_block (insn_t nop, basic_block prev_bb)
   NEXT_INSN (nop) = note;
   PREV_INSN (next_insn) = note;
 
-  BB_END (prev_bb) = nop;
+  SET_BB_END (prev_bb) = nop;
   BLOCK_FOR_INSN (nop) = prev_bb;
 }
 
index 63f6972..59aa5c5 100644 (file)
@@ -11,3 +11,7 @@ Phase 3: per-file commits within "config" subdirs: TODO
 Phase 4: removal of "scaffolding":                 TODO
 Phase 5: additional rtx_def subclasses:            TODO
 Phase 6: use extra rtx_def subclasses:             TODO
+
+TODO: "Scaffolding" to be removed
+=================================
+* SET_BB_HEAD, SET_BB_END, SET_BB_HEADER, SET_BB_FOOTER