summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-15 07:32:43 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-15 07:32:43 +0000
commitf1c570a65fd6f54d7e67f429189189c69dea9f2e (patch)
tree12094325c8b60fc5ff9b26dd40bcb17e41bcfaa5
parentbe10bb5abe53bc4f13d9085f3e03a238928dfd42 (diff)
downloadgcc-f1c570a65fd6f54d7e67f429189189c69dea9f2e.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211679 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/cse.c11
-rw-r--r--gcc/dce.c13
-rw-r--r--gcc/df-problems.c277
-rw-r--r--gcc/df-scan.c28
-rw-r--r--gcc/df.h8
-rw-r--r--gcc/regrename.c11
-rw-r--r--gcc/regstat.c48
8 files changed, 171 insertions, 243 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 10d612adaac..da8eb373d68 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,23 @@
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.
(FOR_EACH_INSN_INFO_USE, FOR_EACH_INSN_INFO_EQ_USE): Likewise.
(FOR_EACH_INSN_DEF, FOR_EACH_INSN_USE, FOR_EACH_INSN_EQ_USE): Likewise.
diff --git a/gcc/cse.c b/gcc/cse.c
index 3ca8e179757..147e3e372d1 100644
--- 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);
diff --git a/gcc/dce.c b/gcc/dce.c
index 252bc7a68e5..a11a4d8ea5a 100644
--- 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);
}
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index d2fb13b49cf..2855eb50cc9 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -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);
+ }
}
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index d4dc48de864..b2d51475bcf 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -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;
}
}
diff --git a/gcc/df.h b/gcc/df.h
index 809175c62a4..482ac930c9c 100644
--- 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. */
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 20f0baa62d7..e46da019eb3 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -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
diff --git a/gcc/regstat.c b/gcc/regstat.c
index 9621f94e8ea..10135b3022c 100644
--- a/gcc/regstat.c
+++ b/gcc/regstat.c
@@ -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)
{