]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
df.h (FOR_EACH_ARTIFICIAL_USE, [...]): New macros.
authorRichard Sandiford <rdsandiford@googlemail.com>
Sun, 15 Jun 2014 07:32:43 +0000 (07:32 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 15 Jun 2014 07:32:43 +0000 (07:32 +0000)
gcc/
* df.h (FOR_EACH_ARTIFICIAL_USE, FOR_EACH_ARTIFICIAL_DEF): New macros.
* cse.c (cse_extended_basic_block): Use them.
* dce.c (mark_artificial_use): Likewise.
* df-problems.c (df_rd_simulate_artificial_defs_at_top): Likewise.
(df_lr_bb_local_compute, df_live_bb_local_compute): Likewise.
(df_chain_remove_problem, df_chain_bb_dump): Likewise.
(df_word_lr_bb_local_compute, df_note_bb_compute): Likewise.
(df_simulate_initialize_backwards): Likewise.
(df_simulate_finalize_backwards): Likewise.
(df_simulate_initialize_forwards): Likewise.
(df_md_simulate_artificial_defs_at_top): Likewise.
* df-scan.c (df_reorganize_refs_by_reg_by_insn): Likewise.
* regrename.c (init_rename_info): Likewise.
* regstat.c (regstat_bb_compute_ri): Likewise.
(regstat_bb_compute_calls_crossed): Likewise.

From-SVN: r211679

gcc/ChangeLog
gcc/cse.c
gcc/dce.c
gcc/df-problems.c
gcc/df-scan.c
gcc/df.h
gcc/regrename.c
gcc/regstat.c

index 10d612adaacfe94aa61b0696c84763488f5027b4..da8eb373d68c56f8568c7fab1e9af531d5d7717f 100644 (file)
@@ -1,3 +1,21 @@
+2014-06-15  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * df.h (FOR_EACH_ARTIFICIAL_USE, FOR_EACH_ARTIFICIAL_DEF): New macros.
+       * cse.c (cse_extended_basic_block): Use them.
+       * dce.c (mark_artificial_use): Likewise.
+       * df-problems.c (df_rd_simulate_artificial_defs_at_top): Likewise.
+       (df_lr_bb_local_compute, df_live_bb_local_compute): Likewise.
+       (df_chain_remove_problem, df_chain_bb_dump): Likewise.
+       (df_word_lr_bb_local_compute, df_note_bb_compute): Likewise.
+       (df_simulate_initialize_backwards): Likewise.
+       (df_simulate_finalize_backwards): Likewise.
+       (df_simulate_initialize_forwards): Likewise.
+       (df_md_simulate_artificial_defs_at_top): Likewise.
+       * df-scan.c (df_reorganize_refs_by_reg_by_insn): Likewise.
+       * regrename.c (init_rename_info): Likewise.
+       * regstat.c (regstat_bb_compute_ri): Likewise.
+       (regstat_bb_compute_calls_crossed): Likewise.
+
 2014-06-15  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * df.h (DF_INSN_INFO_MWS, FOR_EACH_INSN_INFO_DEF): New macros.
index 3ca8e179757555ae25defcd35c8464eb87beee07..147e3e372d1dc050e24e3da7ad39685541bf155f 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6406,14 +6406,11 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
         edge pointing to that bb.  */
       if (bb_has_eh_pred (bb))
        {
-         df_ref *def_rec;
+         df_ref def;
 
-         for (def_rec = df_get_artificial_defs (bb->index); *def_rec; def_rec++)
-           {
-             df_ref def = *def_rec;
-             if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
-               invalidate (DF_REF_REG (def), GET_MODE (DF_REF_REG (def)));
-           }
+         FOR_EACH_ARTIFICIAL_DEF (def, bb->index)
+           if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
+             invalidate (DF_REF_REG (def), GET_MODE (DF_REF_REG (def)));
        }
 
       optimize_this_for_speed_p = optimize_bb_for_speed_p (bb);
index 252bc7a68e5f1e0bb50cbe3e53345761b56d35d6..a11a4d8ea5aab59ea6b2c0ce67ca52d4ab451728 100644 (file)
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -661,16 +661,13 @@ mark_artificial_uses (void)
 {
   basic_block bb;
   struct df_link *defs;
-  df_ref *use_rec;
+  df_ref use;
 
   FOR_ALL_BB_FN (bb, cfun)
-    {
-      for (use_rec = df_get_artificial_uses (bb->index);
-          *use_rec; use_rec++)
-       for (defs = DF_REF_CHAIN (*use_rec); defs; defs = defs->next)
-         if (! DF_REF_IS_ARTIFICIAL (defs->ref))
-           mark_insn (DF_REF_INSN (defs->ref), false);
-    }
+    FOR_EACH_ARTIFICIAL_USE (use, bb->index)
+      for (defs = DF_REF_CHAIN (use); defs; defs = defs->next)
+       if (!DF_REF_IS_ARTIFICIAL (defs->ref))
+         mark_insn (DF_REF_INSN (defs->ref), false);
 }
 
 
index d2fb13b49cf5f10462903afeec365e97944022b1..2855eb50cc9c2c075a74237a71e2fa5c9367e426 100644 (file)
@@ -245,20 +245,17 @@ void
 df_rd_simulate_artificial_defs_at_top (basic_block bb, bitmap local_rd)
 {
   int bb_index = bb->index;
-  df_ref *def_rec;
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
-       {
-         unsigned int dregno = DF_REF_REGNO (def);
-         if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-           bitmap_clear_range (local_rd,
-                               DF_DEFS_BEGIN (dregno),
-                               DF_DEFS_COUNT (dregno));
-         bitmap_set_bit (local_rd, DF_REF_ID (def));
-       }
-    }
+  df_ref def;
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
+      {
+       unsigned int dregno = DF_REF_REGNO (def);
+       if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
+         bitmap_clear_range (local_rd,
+                             DF_DEFS_BEGIN (dregno),
+                             DF_DEFS_COUNT (dregno));
+       bitmap_set_bit (local_rd, DF_REF_ID (def));
+      }
 }
 
 /* Add the effect of the defs of INSN to the reaching definitions bitmap
@@ -834,30 +831,22 @@ df_lr_bb_local_compute (unsigned int bb_index)
   basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
   struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index);
   rtx insn;
-  df_ref *def_rec;
-  df_ref *use_rec;
   df_ref def, use;
 
   /* Process the registers set in an exception handler.  */
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
-       {
-         unsigned int dregno = DF_REF_REGNO (def);
-         bitmap_set_bit (&bb_info->def, dregno);
-         bitmap_clear_bit (&bb_info->use, dregno);
-       }
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
+      {
+       unsigned int dregno = DF_REF_REGNO (def);
+       bitmap_set_bit (&bb_info->def, dregno);
+       bitmap_clear_bit (&bb_info->use, dregno);
+      }
 
   /* Process the hardware registers that are always live.  */
-  for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
-    {
-      df_ref use = *use_rec;
-      /* Add use to set of uses in this BB.  */
-      if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
-       bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use));
-    }
+  FOR_EACH_ARTIFICIAL_USE (use, bb_index)
+    /* Add use to set of uses in this BB.  */
+    if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
+      bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use));
 
   FOR_BB_INSNS_REVERSE (bb, insn)
     {
@@ -883,26 +872,20 @@ df_lr_bb_local_compute (unsigned int bb_index)
   /* Process the registers set in an exception handler or the hard
      frame pointer if this block is the target of a non local
      goto.  */
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
-       {
-         unsigned int dregno = DF_REF_REGNO (def);
-         bitmap_set_bit (&bb_info->def, dregno);
-         bitmap_clear_bit (&bb_info->use, dregno);
-       }
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
+      {
+       unsigned int dregno = DF_REF_REGNO (def);
+       bitmap_set_bit (&bb_info->def, dregno);
+       bitmap_clear_bit (&bb_info->use, dregno);
+      }
 
 #ifdef EH_USES
   /* Process the uses that are live into an exception handler.  */
-  for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
-    {
-      df_ref use = *use_rec;
-      /* Add use to set of uses in this BB.  */
-      if (DF_REF_FLAGS (use) & DF_REF_AT_TOP)
-       bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use));
-    }
+  FOR_EACH_ARTIFICIAL_USE (use, bb_index)
+    /* Add use to set of uses in this BB.  */
+    if (DF_REF_FLAGS (use) & DF_REF_AT_TOP)
+      bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use));
 #endif
 
   /* If the df_live problem is not defined, such as at -O0 and -O1, we
@@ -1455,7 +1438,7 @@ df_live_bb_local_compute (unsigned int bb_index)
   basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
   struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index);
   rtx insn;
-  df_ref def, *def_rec;
+  df_ref def;
   int luid = 0;
 
   FOR_BB_INSNS (bb, insn)
@@ -1494,11 +1477,8 @@ df_live_bb_local_compute (unsigned int bb_index)
        }
     }
 
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      bitmap_set_bit (&bb_info->gen, DF_REF_REGNO (def));
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    bitmap_set_bit (&bb_info->gen, DF_REF_REGNO (def));
 }
 
 
@@ -1974,17 +1954,15 @@ df_chain_remove_problem (void)
   EXECUTE_IF_SET_IN_BITMAP (df_chain->out_of_date_transfer_functions, 0, bb_index, bi)
     {
       rtx insn;
-      df_ref *def_rec;
-      df_ref *use_rec;
       df_ref def, use;
       basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
 
       if (df_chain_problem_p (DF_DU_CHAIN))
-       for (def_rec = df_get_artificial_defs (bb->index); *def_rec; def_rec++)
-         DF_REF_CHAIN (*def_rec) = NULL;
+       FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+         DF_REF_CHAIN (def) = NULL;
       if (df_chain_problem_p (DF_UD_CHAIN))
-       for (use_rec = df_get_artificial_uses (bb->index); *use_rec; use_rec++)
-         DF_REF_CHAIN (*use_rec) = NULL;
+       FOR_EACH_ARTIFICIAL_USE (use, bb_index)
+         DF_REF_CHAIN (use) = NULL;
 
       FOR_BB_INSNS (bb, insn)
        if (INSN_P (insn))
@@ -2180,48 +2158,35 @@ df_chain_bb_dump (basic_block bb, FILE *file, bool top)
     return;
   if (df_chain_problem_p (DF_UD_CHAIN))
     {
+      df_ref use;
+
       fprintf (file,
               ";;  UD chains for artificial uses at %s\n",
               top ? "top" : "bottom");
-      df_ref *use_rec = df_get_artificial_uses (bb->index);
-      if (*use_rec)
-       {
-         while (*use_rec)
-           {
-             df_ref use = *use_rec;
-             if ((top && (DF_REF_FLAGS (use) & DF_REF_AT_TOP))
-                 || (!top && !(DF_REF_FLAGS (use) & DF_REF_AT_TOP)))
-               {
-                 fprintf (file, ";;   reg %d ", DF_REF_REGNO (use));
-                 df_chain_dump (DF_REF_CHAIN (use), file);
-                 fprintf (file, "\n");
-               }
-             use_rec++;
-           }
-       }
+      FOR_EACH_ARTIFICIAL_USE (use, bb->index)
+       if ((top && (DF_REF_FLAGS (use) & DF_REF_AT_TOP))
+           || (!top && !(DF_REF_FLAGS (use) & DF_REF_AT_TOP)))
+         {
+           fprintf (file, ";;   reg %d ", DF_REF_REGNO (use));
+           df_chain_dump (DF_REF_CHAIN (use), file);
+           fprintf (file, "\n");
+         }
     }
   if (df_chain_problem_p (DF_DU_CHAIN))
     {
+      df_ref def;
+
       fprintf (file,
               ";;  DU chains for artificial defs at %s\n",
               top ? "top" : "bottom");
-      df_ref *def_rec = df_get_artificial_defs (bb->index);
-      if (*def_rec)
-       {
-         while (*def_rec)
-           {
-             df_ref def = *def_rec;
-
-             if ((top && (DF_REF_FLAGS (def) & DF_REF_AT_TOP))
-                 || (!top && !(DF_REF_FLAGS (def) & DF_REF_AT_TOP)))
-               {
-                 fprintf (file, ";;   reg %d ", DF_REF_REGNO (def));
-                 df_chain_dump (DF_REF_CHAIN (def), file);
-                 fprintf (file, "\n");
-               }
-             def_rec++;
-           }
-       }
+      FOR_EACH_ARTIFICIAL_DEF (def, bb->index)
+       if ((top && (DF_REF_FLAGS (def) & DF_REF_AT_TOP))
+           || (!top && !(DF_REF_FLAGS (def) & DF_REF_AT_TOP)))
+         {
+           fprintf (file, ";;   reg %d ", DF_REF_REGNO (def));
+           df_chain_dump (DF_REF_CHAIN (def), file);
+           fprintf (file, "\n");
+         }
     }
 }
 
@@ -2503,22 +2468,14 @@ df_word_lr_bb_local_compute (unsigned int bb_index)
   basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
   struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index);
   rtx insn;
-  df_ref *def_rec;
-  df_ref *use_rec;
   df_ref def, use;
 
   /* Ensure that artificial refs don't contain references to pseudos.  */
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      gcc_assert (DF_REF_REGNO (def) < FIRST_PSEUDO_REGISTER);
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    gcc_assert (DF_REF_REGNO (def) < FIRST_PSEUDO_REGISTER);
 
-  for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
-    {
-      df_ref use = *use_rec;
-      gcc_assert (DF_REF_REGNO (use) < FIRST_PSEUDO_REGISTER);
-    }
+  FOR_EACH_ARTIFICIAL_USE (use, bb_index)
+    gcc_assert (DF_REF_REGNO (use) < FIRST_PSEUDO_REGISTER);
 
   FOR_BB_INSNS_REVERSE (bb, insn)
     {
@@ -3112,8 +3069,6 @@ df_note_bb_compute (unsigned int bb_index,
 {
   basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
   rtx insn;
-  df_ref *def_rec;
-  df_ref *use_rec;
   df_ref def, use;
   struct dead_debug_local debug;
 
@@ -3130,10 +3085,8 @@ df_note_bb_compute (unsigned int bb_index,
 
   /* Process the artificial defs and uses at the bottom of the block
      to begin processing.  */
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
     {
-      df_ref def = *def_rec;
-
       if (REG_DEAD_DEBUGGING && dump_file)
        fprintf (dump_file, "artificial def %d\n", DF_REF_REGNO (def));
 
@@ -3141,19 +3094,16 @@ df_note_bb_compute (unsigned int bb_index,
        bitmap_clear_bit (live, DF_REF_REGNO (def));
     }
 
-  for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
-    {
-      df_ref use = *use_rec;
-      if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
-       {
-         unsigned int regno = DF_REF_REGNO (use);
-         bitmap_set_bit (live, regno);
+  FOR_EACH_ARTIFICIAL_USE (use, bb_index)
+    if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
+      {
+       unsigned int regno = DF_REF_REGNO (use);
+       bitmap_set_bit (live, regno);
 
-         /* Notes are not generated for any of the artificial registers
-            at the bottom of the block.  */
-         bitmap_set_bit (artificial_uses, regno);
-       }
-    }
+       /* Notes are not generated for any of the artificial registers
+          at the bottom of the block.  */
+       bitmap_set_bit (artificial_uses, regno);
+      }
 
   if (REG_DEAD_DEBUGGING && dump_file)
     {
@@ -3533,23 +3483,16 @@ df_simulate_fixup_sets (basic_block bb, bitmap live)
 void
 df_simulate_initialize_backwards (basic_block bb, bitmap live)
 {
-  df_ref *def_rec;
-  df_ref *use_rec;
+  df_ref def, use;
   int bb_index = bb->index;
 
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
-       bitmap_clear_bit (live, DF_REF_REGNO (def));
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
+      bitmap_clear_bit (live, DF_REF_REGNO (def));
 
-  for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
-    {
-      df_ref use = *use_rec;
-      if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
-       bitmap_set_bit (live, DF_REF_REGNO (use));
-    }
+  FOR_EACH_ARTIFICIAL_USE (use, bb_index)
+    if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
+      bitmap_set_bit (live, DF_REF_REGNO (use));
 }
 
 
@@ -3573,26 +3516,20 @@ df_simulate_one_insn_backwards (basic_block bb, rtx insn, bitmap live)
 void
 df_simulate_finalize_backwards (basic_block bb, bitmap live)
 {
-  df_ref *def_rec;
+  df_ref def;
 #ifdef EH_USES
-  df_ref *use_rec;
+  df_ref use;
 #endif
   int bb_index = bb->index;
 
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
-       bitmap_clear_bit (live, DF_REF_REGNO (def));
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
+      bitmap_clear_bit (live, DF_REF_REGNO (def));
 
 #ifdef EH_USES
-  for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
-    {
-      df_ref use = *use_rec;
-      if (DF_REF_FLAGS (use) & DF_REF_AT_TOP)
-       bitmap_set_bit (live, DF_REF_REGNO (use));
-    }
+  FOR_EACH_ARTIFICIAL_USE (use, bb_index)
+    if (DF_REF_FLAGS (use) & DF_REF_AT_TOP)
+      bitmap_set_bit (live, DF_REF_REGNO (use));
 #endif
 }
 /*----------------------------------------------------------------------------
@@ -3614,15 +3551,12 @@ df_simulate_finalize_backwards (basic_block bb, bitmap live)
 void
 df_simulate_initialize_forwards (basic_block bb, bitmap live)
 {
-  df_ref *def_rec;
+  df_ref def;
   int bb_index = bb->index;
 
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
-       bitmap_set_bit (live, DF_REF_REGNO (def));
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
+      bitmap_set_bit (live, DF_REF_REGNO (def));
 }
 
 /* Simulate the forwards effects of INSN on the bitmap LIVE.  */
@@ -4121,20 +4055,17 @@ void
 df_md_simulate_artificial_defs_at_top (basic_block bb, bitmap local_md)
 {
   int bb_index = bb->index;
-  df_ref *def_rec;
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
-       {
-         unsigned int dregno = DF_REF_REGNO (def);
-         if (DF_REF_FLAGS (def)
-             & (DF_REF_PARTIAL | DF_REF_CONDITIONAL | DF_REF_MAY_CLOBBER))
-           bitmap_set_bit (local_md, dregno);
-         else
-           bitmap_clear_bit (local_md, dregno);
-       }
-    }
+  df_ref def;
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
+      {
+       unsigned int dregno = DF_REF_REGNO (def);
+       if (DF_REF_FLAGS (def)
+           & (DF_REF_PARTIAL | DF_REF_CONDITIONAL | DF_REF_MAY_CLOBBER))
+         bitmap_set_bit (local_md, dregno);
+       else
+         bitmap_clear_bit (local_md, dregno);
+      }
 }
 
 
index d4dc48de864424cb22d9feb247cc34c44940be36..b2d51475bcf76c20779d7f0cca1e1bfd253e4ff0 100644 (file)
@@ -1639,19 +1639,18 @@ df_reorganize_refs_by_reg_by_insn (struct df_ref_info *ref_info,
     {
       basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
       rtx insn;
-      df_ref *ref_rec;
       df_ref def, use;
 
       if (include_defs)
-       for (ref_rec = df_get_artificial_defs (bb_index); *ref_rec; ref_rec++)
+       FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
          {
-           unsigned int regno = DF_REF_REGNO (*ref_rec);
+           unsigned int regno = DF_REF_REGNO (def);
            ref_info->count[regno]++;
          }
       if (include_uses)
-       for (ref_rec = df_get_artificial_uses (bb_index); *ref_rec; ref_rec++)
+       FOR_EACH_ARTIFICIAL_USE (use, bb_index)
          {
-           unsigned int regno = DF_REF_REGNO (*ref_rec);
+           unsigned int regno = DF_REF_REGNO (use);
            ref_info->count[regno]++;
          }
 
@@ -1694,33 +1693,30 @@ df_reorganize_refs_by_reg_by_insn (struct df_ref_info *ref_info,
     {
       basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
       rtx insn;
-      df_ref *ref_rec;
       df_ref def, use;
 
       if (include_defs)
-       for (ref_rec = df_get_artificial_defs (bb_index); *ref_rec; ref_rec++)
+       FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
          {
-           df_ref ref = *ref_rec;
-           unsigned int regno = DF_REF_REGNO (ref);
+           unsigned int regno = DF_REF_REGNO (def);
            if (regno >= start)
              {
                unsigned int id
                  = ref_info->begin[regno] + ref_info->count[regno]++;
-               DF_REF_ID (ref) = id;
-               ref_info->refs[id] = ref;
+               DF_REF_ID (def) = id;
+               ref_info->refs[id] = def;
              }
          }
       if (include_uses)
-       for (ref_rec = df_get_artificial_uses (bb_index); *ref_rec; ref_rec++)
+       FOR_EACH_ARTIFICIAL_USE (use, bb_index)
          {
-           df_ref ref = *ref_rec;
-           unsigned int regno = DF_REF_REGNO (ref);
+           unsigned int regno = DF_REF_REGNO (def);
            if (regno >= start)
              {
                unsigned int id
                  = ref_info->begin[regno] + ref_info->count[regno]++;
-               DF_REF_ID (ref) = id;
-               ref_info->refs[id] = ref;
+               DF_REF_ID (use) = id;
+               ref_info->refs[id] = use;
              }
          }
 
index 809175c62a431b84664ebd68f9283d33b87e556f..482ac930c9c274dbdfb651a6e596f90799e8d7b9 100644 (file)
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -775,6 +775,14 @@ struct df_d
 #define FOR_EACH_INSN_EQ_USE(ITER, INSN) \
   FOR_EACH_INSN_INFO_EQ_USE(ITER, DF_INSN_INFO_GET (INSN))
 
+#define FOR_EACH_ARTIFICIAL_USE(ITER, BB_INDEX) \
+  for (df_ref *ITER##_ = df_get_artificial_uses (BB_INDEX); \
+       (ITER = *ITER##_); ++ITER##_)
+
+#define FOR_EACH_ARTIFICIAL_DEF(ITER, BB_INDEX) \
+  for (df_ref *ITER##_ = df_get_artificial_defs (BB_INDEX); \
+       (ITER = *ITER##_); ++ITER##_)
+
 /* An obstack for bitmap not related to specific dataflow problems.
    This obstack should e.g. be used for bitmaps with a short life time
    such as temporary bitmaps.  This obstack is declared in df-core.c.  */
index 20f0baa62d768550168126b0bc7f36731949e00d..e46da019eb3e37661bd42a88c3b009383c41a332 100644 (file)
@@ -533,7 +533,7 @@ static void
 init_rename_info (struct bb_rename_info *p, basic_block bb)
 {
   int i;
-  df_ref *def_rec;
+  df_ref def;
   HARD_REG_SET start_chains_set;
 
   p->bb = bb;
@@ -545,12 +545,9 @@ init_rename_info (struct bb_rename_info *p, basic_block bb)
 
   CLEAR_HARD_REG_SET (live_in_chains);
   REG_SET_TO_HARD_REG_SET (live_hard_regs, df_get_live_in (bb));
-  for (def_rec = df_get_artificial_defs (bb->index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
-       SET_HARD_REG_BIT (live_hard_regs, DF_REF_REGNO (def));
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb->index)
+    if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
+      SET_HARD_REG_BIT (live_hard_regs, DF_REF_REGNO (def));
 
   /* Open chains based on information from (at least one) predecessor
      block.  This gives us a chance later on to combine chains across
index 9621f94e8ea835f3c6f54665be18646fe0795d07..10135b3022c2fe5906b24040992ba1a784a56a47 100644 (file)
@@ -122,8 +122,6 @@ regstat_bb_compute_ri (unsigned int bb_index,
 {
   basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
   rtx insn;
-  df_ref *def_rec;
-  df_ref *use_rec;
   df_ref def, use;
   int luid = 0;
   bitmap_iterator bi;
@@ -139,23 +137,17 @@ regstat_bb_compute_ri (unsigned int bb_index,
 
   /* Process the artificial defs and uses at the bottom of the block
      to begin processing.  */
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
-       bitmap_clear_bit (live, DF_REF_REGNO (def));
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
+      bitmap_clear_bit (live, DF_REF_REGNO (def));
 
-  for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
-    {
-      df_ref use = *use_rec;
-      if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
-       {
-         regno = DF_REF_REGNO (use);
-         bitmap_set_bit (live, regno);
-         bitmap_set_bit (artificial_uses, regno);
-       }
-    }
+  FOR_EACH_ARTIFICIAL_USE (use, bb_index)
+    if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
+      {
+       regno = DF_REF_REGNO (use);
+       bitmap_set_bit (live, regno);
+       bitmap_set_bit (artificial_uses, regno);
+      }
 
   FOR_BB_INSNS_REVERSE (bb, insn)
     {
@@ -441,27 +433,19 @@ regstat_bb_compute_calls_crossed (unsigned int bb_index, bitmap live)
 {
   basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
   rtx insn;
-  df_ref *def_rec;
-  df_ref *use_rec;
   df_ref def, use;
 
   bitmap_copy (live, df_get_live_out (bb));
 
   /* Process the artificial defs and uses at the bottom of the block
      to begin processing.  */
-  for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
-    {
-      df_ref def = *def_rec;
-      if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
-       bitmap_clear_bit (live, DF_REF_REGNO (def));
-    }
+  FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
+    if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
+      bitmap_clear_bit (live, DF_REF_REGNO (def));
 
-  for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
-    {
-      df_ref use = *use_rec;
-      if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
-       bitmap_set_bit (live, DF_REF_REGNO (use));
-    }
+  FOR_EACH_ARTIFICIAL_USE (use, bb_index)
+    if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
+      bitmap_set_bit (live, DF_REF_REGNO (use));
 
   FOR_BB_INSNS_REVERSE (bb, insn)
     {