From: Trevor Saunders <tsaund...@mozilla.com>

Hi,
Same idea as the last patch.

also bootstrapped and regtested on x86_64-unknown-linux-gnu with config-list.mk
ongoing ok?


Trev

gcc/

        * cfgrtl.c, combine.c, config/arc/arc.c, config/mcore/mcore.c,
        config/rs6000/rs6000.c, config/sh/sh.c, cprop.c, dwarf2out.c,
        emit-rtl.c, final.c, function.c, gcse.c, jump.c, reg-stack.c,
        reload1.c, reorg.c, resource.c, sel-sched-ir.c: Replace INSN_DELETED_P
        macro with staticly checked member functions.
        * rtl.h (rtx_insn::deleted): New method.
        (rtx_insn::set_deleted): Likewise.
        (rtx_insn::set_undeleted): Likewise.
---
 gcc/cfgrtl.c               |  8 ++++----
 gcc/combine.c              |  2 +-
 gcc/config/arc/arc.c       |  4 ++--
 gcc/config/mcore/mcore.c   |  2 +-
 gcc/config/rs6000/rs6000.c |  2 +-
 gcc/config/sh/sh.c         |  8 ++++----
 gcc/cprop.c                |  6 +++---
 gcc/dwarf2out.c            |  2 +-
 gcc/emit-rtl.c             |  6 +++---
 gcc/final.c                |  4 ++--
 gcc/function.c             |  2 +-
 gcc/gcse.c                 |  2 +-
 gcc/jump.c                 | 20 ++++++++++----------
 gcc/reg-stack.c            |  2 +-
 gcc/reload1.c              |  2 +-
 gcc/reorg.c                | 12 ++++++------
 gcc/resource.c             |  3 +--
 gcc/rtl.h                  | 13 +++++++++++++
 gcc/sel-sched-ir.c         |  4 ++--
 19 files changed, 58 insertions(+), 46 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index bc6c965..49779fc 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -165,11 +165,11 @@ delete_insn (rtx uncast_insn)
   if (really_delete)
     {
       /* If this insn has already been deleted, something is very wrong.  */
-      gcc_assert (!INSN_DELETED_P (insn));
+      gcc_assert (!insn->deleted ());
       if (INSN_P (insn))
        df_insn_delete (insn);
       remove_insn (insn);
-      INSN_DELETED_P (insn) = 1;
+      insn->set_deleted ();
     }
 
   /* If deleting a jump, decrement the use count of the label.  Deleting
@@ -254,7 +254,7 @@ delete_insn_chain (rtx start, rtx finish, bool clear_bb)
       else
        delete_insn (current);
 
-      if (clear_bb && !INSN_DELETED_P (current))
+      if (clear_bb && !current->deleted ())
        set_block_for_insn (current, NULL);
 
       if (current == start)
@@ -3278,7 +3278,7 @@ fixup_abnormal_edges (void)
                      if (GET_CODE (PATTERN (insn)) != USE)
                        {
                          /* We're not deleting it, we're moving it.  */
-                         INSN_DELETED_P (insn) = 0;
+                         insn->set_undeleted ();
                          SET_PREV_INSN (insn) = NULL_RTX;
                          SET_NEXT_INSN (insn) = NULL_RTX;
 
diff --git a/gcc/combine.c b/gcc/combine.c
index 60524b5..67fd5b1 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1238,7 +1238,7 @@ combine_instructions (rtx_insn *f, unsigned int nregs)
            continue;
 
          while (last_combined_insn
-                && INSN_DELETED_P (last_combined_insn))
+                && last_combined_insn->deleted ())
            last_combined_insn = PREV_INSN (last_combined_insn);
          if (last_combined_insn == NULL_RTX
              || BARRIER_P (last_combined_insn)
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 7cddab7..89d0c11 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -8624,7 +8624,7 @@ arc_unalign_branch_p (rtx branch)
     return 0;
   /* Do not do this if we have a filled delay slot.  */
   if (get_attr_delay_slot_filled (branch) == DELAY_SLOT_FILLED_YES
-      && !INSN_DELETED_P (NEXT_INSN (branch)))
+      && !NEXT_INSN (branch)->deleted ())
     return 0;
   note = find_reg_note (branch, REG_BR_PROB, 0);
   return (!note
@@ -8705,7 +8705,7 @@ arc_pad_return (void)
          rtx save_pred = current_insn_predicate;
          final_scan_insn (prev, asm_out_file, optimize, 1, NULL);
          cfun->machine->force_short_suffix = -1;
-         INSN_DELETED_P (prev) = 1;
+         prev->set_deleted ();
          current_output_insn = insn;
          current_insn_predicate = save_pred;
        }
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index aad0f1a..e2208b7 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -2536,7 +2536,7 @@ conditionalize_block (rtx_insn *first)
     {
       rtx_insn *newinsn;
 
-      if (INSN_DELETED_P (insn))
+      if (insn->deleted ())
        continue;
       
       /* Try to form a conditional variant of the instruction and emit it.  */
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 6370304..28e47d2 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -34184,7 +34184,7 @@ replace_swap_with_copy (swap_web_entry *insn_entry, 
unsigned i)
 
   df_insn_delete (insn);
   remove_insn (insn);
-  INSN_DELETED_P (insn) = 1;
+  insn->set_deleted ();
 }
 
 /* Dump the swap table to DUMP_FILE.  */
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index e85ca57..acadf78 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -5572,7 +5572,7 @@ gen_block_redirect (rtx_insn *jump, int addr, int 
need_block)
   rtx dest;
 
   /* First, check if we already have an instruction that satisfies our need.  
*/
-  if (prev && NONJUMP_INSN_P (prev) && ! INSN_DELETED_P (prev))
+  if (prev && NONJUMP_INSN_P (prev) && ! prev->deleted ())
     {
       if (INSN_CODE (prev) == CODE_FOR_indirect_jump_scratch)
        return prev;
@@ -5615,7 +5615,7 @@ gen_block_redirect (rtx_insn *jump, int addr, int 
need_block)
        {
          enum rtx_code code;
 
-         if (INSN_DELETED_P (scan))
+         if (scan->deleted ())
            continue;
          code = GET_CODE (scan);
          if (code == CODE_LABEL || code == JUMP_INSN)
@@ -5634,7 +5634,7 @@ gen_block_redirect (rtx_insn *jump, int addr, int 
need_block)
        {
          enum rtx_code code;
 
-         if (INSN_DELETED_P (scan))
+         if (scan->deleted ())
            continue;
          code = GET_CODE (scan);
          if (INSN_P (scan))
@@ -6494,7 +6494,7 @@ split_branches (rtx_insn *first)
   for (insn = first; insn; insn = NEXT_INSN (insn))
     if (! INSN_P (insn))
       continue;
-    else if (INSN_DELETED_P (insn))
+    else if (insn->deleted ())
       {
        /* Shorten_branches would split this instruction again,
           so transform it into a note.  */
diff --git a/gcc/cprop.c b/gcc/cprop.c
index fa77faa..3711508 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1071,7 +1071,7 @@ retry:
                  print_rtl (dump_file, src);
                  fprintf (dump_file, "\n");
                }
-             if (INSN_DELETED_P (insn))
+             if (insn->deleted ())
                return 1;
            }
        }
@@ -1257,7 +1257,7 @@ local_cprop_pass (void)
                          break;
                        }
                    }
-                 if (INSN_DELETED_P (insn))
+                 if (insn->deleted ())
                    break;
                }
              while (i < reg_use_count);
@@ -1854,7 +1854,7 @@ one_cprop_pass (void)
                /* ??? Need to be careful w.r.t. mods done to INSN.
                       Don't call mark_oprs_set if we turned the
                       insn into a NOTE, or deleted the insn.  */
-               if (! NOTE_P (insn) && ! INSN_DELETED_P (insn))
+               if (! NOTE_P (insn) && ! insn->deleted ())
                  mark_oprs_set (insn);
              }
        }
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 23a80d8..f9327d6 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -21328,7 +21328,7 @@ dwarf2out_var_location (rtx_insn *loc_note)
 
   next_note = NEXT_INSN (loc_note);
   if (! next_note
-      || INSN_DELETED_P (next_note)
+      || next_note->deleted ()
       || ! NOTE_P (next_note)
       || (NOTE_KIND (next_note) != NOTE_INSN_VAR_LOCATION
          && NOTE_KIND (next_note) != NOTE_INSN_CALL_ARG_LOCATION))
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index e3df826..9a20e0e 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3796,7 +3796,7 @@ try_split (rtx pat, rtx uncast_trial, int last)
      We can't use next_active_insn here since AFTER may be a note.
      Ignore deleted insns, which can be occur if not optimizing.  */
   for (tem = NEXT_INSN (before); tem != after; tem = NEXT_INSN (tem))
-    if (! INSN_DELETED_P (tem) && INSN_P (tem))
+    if (! tem->deleted () && INSN_P (tem))
       tem = try_split (PATTERN (tem), tem, 1);
 
   /* Return either the first or the last insn, depending on which was
@@ -3973,7 +3973,7 @@ add_insn_after_nobb (rtx_insn *insn, rtx_insn *after)
 {
   rtx_insn *next = NEXT_INSN (after);
 
-  gcc_assert (!optimize || !INSN_DELETED_P (after));
+  gcc_assert (!optimize || !after->deleted ());
 
   link_insn_into_chain (insn, after, next);
 
@@ -4002,7 +4002,7 @@ add_insn_before_nobb (rtx_insn *insn, rtx_insn *before)
 {
   rtx_insn *prev = PREV_INSN (before);
 
-  gcc_assert (!optimize || !INSN_DELETED_P (before));
+  gcc_assert (!optimize || !before->deleted ());
 
   link_insn_into_chain (insn, prev, before);
 
diff --git a/gcc/final.c b/gcc/final.c
index 6469f40..114e83d 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1133,7 +1133,7 @@ shorten_branches (rtx_insn *first)
       if (NOTE_P (insn) || BARRIER_P (insn)
          || LABEL_P (insn) || DEBUG_INSN_P (insn))
        continue;
-      if (INSN_DELETED_P (insn))
+      if (insn->deleted ())
        continue;
 
       body = PATTERN (insn);
@@ -2185,7 +2185,7 @@ final_scan_insn (rtx uncast_insn, FILE *file, int 
optimize_p ATTRIBUTE_UNUSED,
 
   /* Ignore deleted insns.  These can occur when we split insns (due to a
      template of "#") while not optimizing.  */
-  if (INSN_DELETED_P (insn))
+  if (insn->deleted ())
     return NEXT_INSN (insn);
 
   switch (GET_CODE (insn))
diff --git a/gcc/function.c b/gcc/function.c
index 8b125ae..8428f8a 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1933,7 +1933,7 @@ instantiate_virtual_regs (void)
        else
          instantiate_virtual_regs_in_insn (insn);
 
-       if (INSN_DELETED_P (insn))
+       if (insn->deleted ())
          continue;
 
        instantiate_virtual_regs_in_rtx (&REG_NOTES (insn));
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 4a8fe50..15b8bca 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -2486,7 +2486,7 @@ pre_insert_copies (void)
                  continue;
 
                /* Don't handle this one if it's a redundant one.  */
-               if (INSN_DELETED_P (insn))
+               if (insn->deleted ())
                  continue;
 
                /* Or if the expression doesn't reach the deleted one.  */
diff --git a/gcc/jump.c b/gcc/jump.c
index 12edd92..300cae5 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -291,7 +291,7 @@ mark_all_labels (rtx_insn *f)
             handled by other optimizers using better algorithms.  */
          FOR_BB_INSNS (bb, insn)
            {
-             gcc_assert (! INSN_DELETED_P (insn));
+             gcc_assert (! insn->deleted ());
              if (NONDEBUG_INSN_P (insn))
                mark_jump_label (PATTERN (insn), insn, 0);
            }
@@ -312,7 +312,7 @@ mark_all_labels (rtx_insn *f)
       rtx_insn *prev_nonjump_insn = NULL;
       for (insn = f; insn; insn = NEXT_INSN (insn))
        {
-         if (INSN_DELETED_P (insn))
+         if (insn->deleted ())
            ;
          else if (LABEL_P (insn))
            prev_nonjump_insn = NULL;
@@ -1254,11 +1254,11 @@ delete_related_insns (rtx uncast_insn)
   rtx note;
   rtx_insn *next = NEXT_INSN (insn), *prev = PREV_INSN (insn);
 
-  while (next && INSN_DELETED_P (next))
+  while (next && next->deleted ())
     next = NEXT_INSN (next);
 
   /* This insn is already deleted => return first following nondeleted.  */
-  if (INSN_DELETED_P (insn))
+  if (insn->deleted ())
     return next;
 
   delete_insn (insn);
@@ -1279,7 +1279,7 @@ delete_related_insns (rtx uncast_insn)
     {
       rtx_insn *p;
 
-      for (p = next && INSN_DELETED_P (next) ? NEXT_INSN (next) : next;
+      for (p = next && next->deleted () ? NEXT_INSN (next) : next;
           p && NOTE_P (p);
           p = NEXT_INSN (p))
        if (NOTE_KIND (p) == NOTE_INSN_CALL_ARG_LOCATION)
@@ -1323,7 +1323,7 @@ delete_related_insns (rtx uncast_insn)
       for (i = 0; i < len; i++)
        if (LABEL_NUSES (XEXP (XVECEXP (pat, diff_vec_p, i), 0)) == 0)
          delete_related_insns (XEXP (XVECEXP (pat, diff_vec_p, i), 0));
-      while (next && INSN_DELETED_P (next))
+      while (next && next->deleted ())
        next = NEXT_INSN (next);
       return next;
     }
@@ -1339,7 +1339,7 @@ delete_related_insns (rtx uncast_insn)
        if (LABEL_NUSES (XEXP (note, 0)) == 0)
          delete_related_insns (XEXP (note, 0));
 
-  while (prev && (INSN_DELETED_P (prev) || NOTE_P (prev)))
+  while (prev && (prev->deleted () || NOTE_P (prev)))
     prev = PREV_INSN (prev);
 
   /* If INSN was a label and a dispatch table follows it,
@@ -1362,7 +1362,7 @@ delete_related_insns (rtx uncast_insn)
          if (code == NOTE)
            next = NEXT_INSN (next);
          /* Keep going past other deleted labels to delete what follows.  */
-         else if (code == CODE_LABEL && INSN_DELETED_P (next))
+         else if (code == CODE_LABEL && next->deleted ())
            next = NEXT_INSN (next);
          /* Keep the (use (insn))s created by dbr_schedule, which needs
             them in order to track liveness relative to a previous
@@ -1386,7 +1386,7 @@ delete_related_insns (rtx uncast_insn)
      but I see no clean and sure alternative way
      to find the first insn after INSN that is not now deleted.
      I hope this works.  */
-  while (next && INSN_DELETED_P (next))
+  while (next && next->deleted ())
     next = NEXT_INSN (next);
   return next;
 }
@@ -1408,7 +1408,7 @@ delete_for_peephole (rtx_insn *from, rtx_insn *to)
 
       if (!NOTE_P (insn))
        {
-         INSN_DELETED_P (insn) = 1;
+         insn->set_deleted();
 
          /* Patch this insn out of the chain.  */
          /* We don't do this all at once, because we
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index af8e3cd..8c0a5c8 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -2341,7 +2341,7 @@ subst_stack_regs (rtx_insn *insn, stack_ptr regstack)
   /* subst_stack_regs_pat may have deleted a no-op insn.  If so, any
      REG_UNUSED will already have been dealt with, so just return.  */
 
-  if (NOTE_P (insn) || INSN_DELETED_P (insn))
+  if (NOTE_P (insn) || insn->deleted ())
     return control_flow_insn_deleted;
 
   /* If this a noreturn call, we can't insert pop insns after it.
diff --git a/gcc/reload1.c b/gcc/reload1.c
index c18ee67..f258a2b 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -8847,7 +8847,7 @@ delete_output_reload (rtx_insn *insn, int j, int 
last_reload_reg,
 
   /* It is possible that this reload has been only used to set another reload
      we eliminated earlier and thus deleted this instruction too.  */
-  if (INSN_DELETED_P (output_reload_insn))
+  if (output_reload_insn->deleted ())
     return;
 
   /* Get the raw pseudo-register referred to.  */
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 18717a7..35d24d1 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -535,7 +535,7 @@ emit_delay_sequence (rtx_insn *insn, rtx_insn_list *list, 
int length)
       rtx note, next;
 
       /* Show that this copy of the insn isn't deleted.  */
-      INSN_DELETED_P (tem) = 0;
+      tem->set_undeleted ();
 
       /* Unlink insn from its original place, and re-emit it into
         the sequence.  */
@@ -1425,7 +1425,7 @@ try_merge_delay_insns (rtx insn, rtx_insn *thread)
 
                  update_block (dtrial, thread);
                  new_rtx = delete_from_delay_slot (dtrial);
-                 if (INSN_DELETED_P (thread))
+                 if (thread->deleted ())
                    thread = new_rtx;
                  INSN_FROM_TARGET_P (next_to_match) = 0;
                }
@@ -1463,7 +1463,7 @@ try_merge_delay_insns (rtx insn, rtx_insn *thread)
 
              update_block (merged_insns->insn (), thread);
              new_rtx = delete_from_delay_slot (merged_insns->insn ());
-             if (INSN_DELETED_P (thread))
+             if (thread->deleted ())
                thread = new_rtx;
            }
          else
@@ -1946,7 +1946,7 @@ fill_simple_delay_slots (int non_jumps_p)
 
       insn = unfilled_slots_base[i];
       if (insn == 0
-         || INSN_DELETED_P (insn)
+         || insn->deleted ()
          || (NONJUMP_INSN_P (insn)
              && GET_CODE (PATTERN (insn)) == SEQUENCE)
          || (JUMP_P (insn) && non_jumps_p)
@@ -2860,7 +2860,7 @@ fill_eager_delay_slots (void)
 
       insn = unfilled_slots_base[i];
       if (insn == 0
-         || INSN_DELETED_P (insn)
+         || insn->deleted ()
          || !JUMP_P (insn)
          || ! (condjump_p (insn) || condjump_in_parallel_p (insn)))
        continue;
@@ -3831,7 +3831,7 @@ dbr_schedule (rtx_insn *first)
       memset (total_annul_slots, 0, sizeof total_annul_slots);
       for (insn = first; insn; insn = NEXT_INSN (insn))
        {
-         if (! INSN_DELETED_P (insn)
+         if (! insn->deleted ()
              && NONJUMP_INSN_P (insn)
              && GET_CODE (PATTERN (insn)) != USE
              && GET_CODE (PATTERN (insn)) != CLOBBER)
diff --git a/gcc/resource.c b/gcc/resource.c
index 5528831..6035c49 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -930,8 +930,7 @@ mark_target_live_regs (rtx_insn *insns, rtx 
target_maybe_return, struct resource
         information, we can get it from there unless the insn at the
         start of the basic block has been deleted.  */
       if (tinfo && tinfo->block != -1
-         && ! INSN_DELETED_P (BB_HEAD (BASIC_BLOCK_FOR_FN (cfun,
-                                                           tinfo->block))))
+         && ! BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, tinfo->block))->deleted ())
        b = tinfo->block;
     }
 
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 2d66a89..e364698 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -490,6 +490,7 @@ is_a_helper <const rtx_sequence *>::test (const_rtx rt)
 
 class GTY(()) rtx_insn : public rtx_def
 {
+public:
   /* No extra fields, but adds the invariant:
 
      (INSN_P (X)
@@ -505,6 +506,18 @@ class GTY(()) rtx_insn : public rtx_def
     i.e. we have an rtx that has an INSN_UID field and can be part of
     a linked list of insns.
   */
+
+  /* Returns true if this insn has been deleted.  */
+
+  bool deleted () const { return volatil; }
+
+  /* Mark this insn as deleted.  */
+
+  void set_deleted () { volatil = true; }
+
+  /* Mark this insn as not deleted.  */
+
+  void set_undeleted () { volatil = false; }
 };
 
 /* Subclasses of rtx_insn.  */
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 02dc8f2..0a6c52c 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -1069,7 +1069,7 @@ return_nop_to_pool (insn_t nop, bool full_tidying)
   sel_remove_insn (nop, false, full_tidying);
 
   /* We'll recycle this nop.  */
-  INSN_DELETED_P (nop) = 0;
+  nop->set_undeleted ();
 
   if (nop_pool.n == nop_pool.s)
     nop_pool.v = XRESIZEVEC (rtx_insn *, nop_pool.v,
@@ -1404,7 +1404,7 @@ sel_gen_insn_from_expr_after (expr_t expr, vinsn_t vinsn, 
int seqno,
 
   /* The insn may come from the transformation cache, which may hold already
      deleted insns, so mark it as not deleted.  */
-  INSN_DELETED_P (insn) = 0;
+  insn->set_undeleted ();
 
   add_insn_after (insn, after, BLOCK_FOR_INSN (insn));
 
-- 
2.1.0

Reply via email to