This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 2/6] FOR_EACH_ARTIFICIAL_{DEF,USE}
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 14 Jun 2014 20:44:38 +0100
- Subject: [PATCH 2/6] FOR_EACH_ARTIFICIAL_{DEF,USE}
- Authentication-results: sourceware.org; auth=none
- References: <87a99ftha6 dot fsf at talisman dot default>
Similar to patch 1, but for artificial uses and defs.
Richard
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.
Index: gcc/df.h
===================================================================
--- gcc/df.h 2014-06-14 19:40:28.450704775 +0100
+++ gcc/df.h 2014-06-14 20:01:12.353400410 +0100
@@ -775,6 +775,14 @@ #define FOR_EACH_INSN_USE(ITER, INSN) \
#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: gcc/cse.c
===================================================================
--- gcc/cse.c 2014-06-14 19:40:26.919671918 +0100
+++ gcc/cse.c 2014-06-14 20:01:12.351400390 +0100
@@ -6406,14 +6406,11 @@ cse_extended_basic_block (struct cse_bas
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: gcc/dce.c
===================================================================
--- gcc/dce.c 2014-06-14 19:40:44.451212858 +0100
+++ gcc/dce.c 2014-06-14 20:01:23.401510789 +0100
@@ -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: gcc/df-problems.c
===================================================================
--- gcc/df-problems.c 2014-06-14 19:47:23.317957520 +0100
+++ gcc/df-problems.c 2014-06-14 20:01:12.352400400 +0100
@@ -245,20 +245,17 @@ df_rd_alloc (bitmap all_blocks)
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_
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_
/* 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 b
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 b
}
}
- 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 *
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 in
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_inde
{
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_inde
/* 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_inde
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,
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 (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_DEF (def, bb_index)
+ if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
+ bitmap_clear_bit (live, DF_REF_REGNO (def));
+
+ 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_bl
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_bl
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 @@ df_md_alloc (bitmap all_blocks)
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: gcc/df-scan.c
===================================================================
--- gcc/df-scan.c 2014-06-14 19:40:28.457704933 +0100
+++ gcc/df-scan.c 2014-06-14 20:01:12.353400410 +0100
@@ -1639,19 +1639,18 @@ df_reorganize_refs_by_reg_by_insn (struc
{
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 (struc
{
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: gcc/regrename.c
===================================================================
--- gcc/regrename.c 2014-06-14 19:40:26.919671918 +0100
+++ gcc/regrename.c 2014-06-14 20:01:12.353400410 +0100
@@ -533,7 +533,7 @@ struct bb_rename_info
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
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: gcc/regstat.c
===================================================================
--- gcc/regstat.c 2014-06-14 19:40:28.458704955 +0100
+++ gcc/regstat.c 2014-06-14 20:01:12.354400420 +0100
@@ -122,8 +122,6 @@ regstat_bb_compute_ri (unsigned int bb_i
{
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_i
/* 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 (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_DEF (def, bb_index)
+ if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
+ bitmap_clear_bit (live, DF_REF_REGNO (def));
+
+ 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 (unsign
{
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 (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_DEF (def, bb_index)
+ if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
+ bitmap_clear_bit (live, DF_REF_REGNO (def));
+
+ 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)
{