Commit 292321a5 by Richard Sandiford Committed by Richard Sandiford

df.h (FOR_EACH_ARTIFICIAL_USE, [...]): New macros.

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
parent bfac633a
2014-06-15 Richard Sandiford <rdsandiford@googlemail.com> 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. * 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_INFO_USE, FOR_EACH_INSN_INFO_EQ_USE): Likewise.
(FOR_EACH_INSN_DEF, FOR_EACH_INSN_USE, FOR_EACH_INSN_EQ_USE): Likewise. (FOR_EACH_INSN_DEF, FOR_EACH_INSN_USE, FOR_EACH_INSN_EQ_USE): Likewise.
......
...@@ -6406,15 +6406,12 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data) ...@@ -6406,15 +6406,12 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
edge pointing to that bb. */ edge pointing to that bb. */
if (bb_has_eh_pred (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++) FOR_EACH_ARTIFICIAL_DEF (def, bb->index)
{
df_ref def = *def_rec;
if (DF_REF_FLAGS (def) & DF_REF_AT_TOP) if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
invalidate (DF_REF_REG (def), GET_MODE (DF_REF_REG (def))); invalidate (DF_REF_REG (def), GET_MODE (DF_REF_REG (def)));
} }
}
optimize_this_for_speed_p = optimize_bb_for_speed_p (bb); optimize_this_for_speed_p = optimize_bb_for_speed_p (bb);
FOR_BB_INSNS (bb, insn) FOR_BB_INSNS (bb, insn)
......
...@@ -661,16 +661,13 @@ mark_artificial_uses (void) ...@@ -661,16 +661,13 @@ mark_artificial_uses (void)
{ {
basic_block bb; basic_block bb;
struct df_link *defs; struct df_link *defs;
df_ref *use_rec; df_ref use;
FOR_ALL_BB_FN (bb, cfun) FOR_ALL_BB_FN (bb, cfun)
{ FOR_EACH_ARTIFICIAL_USE (use, bb->index)
for (use_rec = df_get_artificial_uses (bb->index); for (defs = DF_REF_CHAIN (use); defs; defs = defs->next)
*use_rec; use_rec++) if (!DF_REF_IS_ARTIFICIAL (defs->ref))
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); mark_insn (DF_REF_INSN (defs->ref), false);
}
} }
......
...@@ -245,10 +245,8 @@ void ...@@ -245,10 +245,8 @@ void
df_rd_simulate_artificial_defs_at_top (basic_block bb, bitmap local_rd) df_rd_simulate_artificial_defs_at_top (basic_block bb, bitmap local_rd)
{ {
int bb_index = bb->index; int bb_index = bb->index;
df_ref *def_rec; df_ref def;
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 (DF_REF_FLAGS (def) & DF_REF_AT_TOP) if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
{ {
unsigned int dregno = DF_REF_REGNO (def); unsigned int dregno = DF_REF_REGNO (def);
...@@ -258,7 +256,6 @@ df_rd_simulate_artificial_defs_at_top (basic_block bb, bitmap local_rd) ...@@ -258,7 +256,6 @@ df_rd_simulate_artificial_defs_at_top (basic_block bb, bitmap local_rd)
DF_DEFS_COUNT (dregno)); DF_DEFS_COUNT (dregno));
bitmap_set_bit (local_rd, DF_REF_ID (def)); bitmap_set_bit (local_rd, DF_REF_ID (def));
} }
}
} }
/* Add the effect of the defs of INSN to the reaching definitions bitmap /* 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) ...@@ -834,30 +831,22 @@ df_lr_bb_local_compute (unsigned int bb_index)
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, 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); struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index);
rtx insn; rtx insn;
df_ref *def_rec;
df_ref *use_rec;
df_ref def, use; df_ref def, use;
/* Process the registers set in an exception handler. */ /* Process the registers set in an exception handler. */
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 ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0) if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
{ {
unsigned int dregno = DF_REF_REGNO (def); unsigned int dregno = DF_REF_REGNO (def);
bitmap_set_bit (&bb_info->def, dregno); bitmap_set_bit (&bb_info->def, dregno);
bitmap_clear_bit (&bb_info->use, dregno); bitmap_clear_bit (&bb_info->use, dregno);
} }
}
/* Process the hardware registers that are always live. */ /* Process the hardware registers that are always live. */
for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++) FOR_EACH_ARTIFICIAL_USE (use, bb_index)
{
df_ref use = *use_rec;
/* Add use to set of uses in this BB. */ /* Add use to set of uses in this BB. */
if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0) if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use)); bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use));
}
FOR_BB_INSNS_REVERSE (bb, insn) FOR_BB_INSNS_REVERSE (bb, insn)
{ {
...@@ -883,26 +872,20 @@ df_lr_bb_local_compute (unsigned int bb_index) ...@@ -883,26 +872,20 @@ df_lr_bb_local_compute (unsigned int bb_index)
/* Process the registers set in an exception handler or the hard /* Process the registers set in an exception handler or the hard
frame pointer if this block is the target of a non local frame pointer if this block is the target of a non local
goto. */ goto. */
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 (DF_REF_FLAGS (def) & DF_REF_AT_TOP) if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
{ {
unsigned int dregno = DF_REF_REGNO (def); unsigned int dregno = DF_REF_REGNO (def);
bitmap_set_bit (&bb_info->def, dregno); bitmap_set_bit (&bb_info->def, dregno);
bitmap_clear_bit (&bb_info->use, dregno); bitmap_clear_bit (&bb_info->use, dregno);
} }
}
#ifdef EH_USES #ifdef EH_USES
/* Process the uses that are live into an exception handler. */ /* Process the uses that are live into an exception handler. */
for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++) FOR_EACH_ARTIFICIAL_USE (use, bb_index)
{
df_ref use = *use_rec;
/* Add use to set of uses in this BB. */ /* Add use to set of uses in this BB. */
if (DF_REF_FLAGS (use) & DF_REF_AT_TOP) if (DF_REF_FLAGS (use) & DF_REF_AT_TOP)
bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use)); bitmap_set_bit (&bb_info->use, DF_REF_REGNO (use));
}
#endif #endif
/* If the df_live problem is not defined, such as at -O0 and -O1, we /* 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) ...@@ -1455,7 +1438,7 @@ df_live_bb_local_compute (unsigned int bb_index)
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, 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); struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index);
rtx insn; rtx insn;
df_ref def, *def_rec; df_ref def;
int luid = 0; int luid = 0;
FOR_BB_INSNS (bb, insn) FOR_BB_INSNS (bb, insn)
...@@ -1494,11 +1477,8 @@ df_live_bb_local_compute (unsigned int bb_index) ...@@ -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++) FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
{
df_ref def = *def_rec;
bitmap_set_bit (&bb_info->gen, DF_REF_REGNO (def)); bitmap_set_bit (&bb_info->gen, DF_REF_REGNO (def));
}
} }
...@@ -1974,17 +1954,15 @@ df_chain_remove_problem (void) ...@@ -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) EXECUTE_IF_SET_IN_BITMAP (df_chain->out_of_date_transfer_functions, 0, bb_index, bi)
{ {
rtx insn; rtx insn;
df_ref *def_rec;
df_ref *use_rec;
df_ref def, use; df_ref def, use;
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
if (df_chain_problem_p (DF_DU_CHAIN)) if (df_chain_problem_p (DF_DU_CHAIN))
for (def_rec = df_get_artificial_defs (bb->index); *def_rec; def_rec++) FOR_EACH_ARTIFICIAL_DEF (def, bb_index)
DF_REF_CHAIN (*def_rec) = NULL; DF_REF_CHAIN (def) = NULL;
if (df_chain_problem_p (DF_UD_CHAIN)) if (df_chain_problem_p (DF_UD_CHAIN))
for (use_rec = df_get_artificial_uses (bb->index); *use_rec; use_rec++) FOR_EACH_ARTIFICIAL_USE (use, bb_index)
DF_REF_CHAIN (*use_rec) = NULL; DF_REF_CHAIN (use) = NULL;
FOR_BB_INSNS (bb, insn) FOR_BB_INSNS (bb, insn)
if (INSN_P (insn)) if (INSN_P (insn))
...@@ -2180,15 +2158,12 @@ df_chain_bb_dump (basic_block bb, FILE *file, bool top) ...@@ -2180,15 +2158,12 @@ df_chain_bb_dump (basic_block bb, FILE *file, bool top)
return; return;
if (df_chain_problem_p (DF_UD_CHAIN)) if (df_chain_problem_p (DF_UD_CHAIN))
{ {
df_ref use;
fprintf (file, fprintf (file,
";; UD chains for artificial uses at %s\n", ";; UD chains for artificial uses at %s\n",
top ? "top" : "bottom"); top ? "top" : "bottom");
df_ref *use_rec = df_get_artificial_uses (bb->index); FOR_EACH_ARTIFICIAL_USE (use, bb->index)
if (*use_rec)
{
while (*use_rec)
{
df_ref use = *use_rec;
if ((top && (DF_REF_FLAGS (use) & DF_REF_AT_TOP)) if ((top && (DF_REF_FLAGS (use) & DF_REF_AT_TOP))
|| (!top && !(DF_REF_FLAGS (use) & DF_REF_AT_TOP))) || (!top && !(DF_REF_FLAGS (use) & DF_REF_AT_TOP)))
{ {
...@@ -2196,22 +2171,15 @@ df_chain_bb_dump (basic_block bb, FILE *file, bool top) ...@@ -2196,22 +2171,15 @@ df_chain_bb_dump (basic_block bb, FILE *file, bool top)
df_chain_dump (DF_REF_CHAIN (use), file); df_chain_dump (DF_REF_CHAIN (use), file);
fprintf (file, "\n"); fprintf (file, "\n");
} }
use_rec++;
}
}
} }
if (df_chain_problem_p (DF_DU_CHAIN)) if (df_chain_problem_p (DF_DU_CHAIN))
{ {
df_ref def;
fprintf (file, fprintf (file,
";; DU chains for artificial defs at %s\n", ";; DU chains for artificial defs at %s\n",
top ? "top" : "bottom"); top ? "top" : "bottom");
df_ref *def_rec = df_get_artificial_defs (bb->index); FOR_EACH_ARTIFICIAL_DEF (def, bb->index)
if (*def_rec)
{
while (*def_rec)
{
df_ref def = *def_rec;
if ((top && (DF_REF_FLAGS (def) & DF_REF_AT_TOP)) if ((top && (DF_REF_FLAGS (def) & DF_REF_AT_TOP))
|| (!top && !(DF_REF_FLAGS (def) & DF_REF_AT_TOP))) || (!top && !(DF_REF_FLAGS (def) & DF_REF_AT_TOP)))
{ {
...@@ -2219,9 +2187,6 @@ df_chain_bb_dump (basic_block bb, FILE *file, bool top) ...@@ -2219,9 +2187,6 @@ df_chain_bb_dump (basic_block bb, FILE *file, bool top)
df_chain_dump (DF_REF_CHAIN (def), file); df_chain_dump (DF_REF_CHAIN (def), file);
fprintf (file, "\n"); fprintf (file, "\n");
} }
def_rec++;
}
}
} }
} }
...@@ -2503,22 +2468,14 @@ df_word_lr_bb_local_compute (unsigned int bb_index) ...@@ -2503,22 +2468,14 @@ df_word_lr_bb_local_compute (unsigned int bb_index)
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, 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); struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index);
rtx insn; rtx insn;
df_ref *def_rec;
df_ref *use_rec;
df_ref def, use; df_ref def, use;
/* Ensure that artificial refs don't contain references to pseudos. */ /* Ensure that artificial refs don't contain references to pseudos. */
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;
gcc_assert (DF_REF_REGNO (def) < FIRST_PSEUDO_REGISTER); gcc_assert (DF_REF_REGNO (def) < FIRST_PSEUDO_REGISTER);
}
for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++) FOR_EACH_ARTIFICIAL_USE (use, bb_index)
{
df_ref use = *use_rec;
gcc_assert (DF_REF_REGNO (use) < FIRST_PSEUDO_REGISTER); gcc_assert (DF_REF_REGNO (use) < FIRST_PSEUDO_REGISTER);
}
FOR_BB_INSNS_REVERSE (bb, insn) FOR_BB_INSNS_REVERSE (bb, insn)
{ {
...@@ -3112,8 +3069,6 @@ df_note_bb_compute (unsigned int bb_index, ...@@ -3112,8 +3069,6 @@ df_note_bb_compute (unsigned int bb_index,
{ {
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn; rtx insn;
df_ref *def_rec;
df_ref *use_rec;
df_ref def, use; df_ref def, use;
struct dead_debug_local debug; struct dead_debug_local debug;
...@@ -3130,10 +3085,8 @@ df_note_bb_compute (unsigned int bb_index, ...@@ -3130,10 +3085,8 @@ df_note_bb_compute (unsigned int bb_index,
/* Process the artificial defs and uses at the bottom of the block /* Process the artificial defs and uses at the bottom of the block
to begin processing. */ 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) if (REG_DEAD_DEBUGGING && dump_file)
fprintf (dump_file, "artificial def %d\n", DF_REF_REGNO (def)); fprintf (dump_file, "artificial def %d\n", DF_REF_REGNO (def));
...@@ -3141,9 +3094,7 @@ df_note_bb_compute (unsigned int bb_index, ...@@ -3141,9 +3094,7 @@ df_note_bb_compute (unsigned int bb_index,
bitmap_clear_bit (live, DF_REF_REGNO (def)); bitmap_clear_bit (live, DF_REF_REGNO (def));
} }
for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++) FOR_EACH_ARTIFICIAL_USE (use, bb_index)
{
df_ref use = *use_rec;
if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0) if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
{ {
unsigned int regno = DF_REF_REGNO (use); unsigned int regno = DF_REF_REGNO (use);
...@@ -3153,7 +3104,6 @@ df_note_bb_compute (unsigned int bb_index, ...@@ -3153,7 +3104,6 @@ df_note_bb_compute (unsigned int bb_index,
at the bottom of the block. */ at the bottom of the block. */
bitmap_set_bit (artificial_uses, regno); bitmap_set_bit (artificial_uses, regno);
} }
}
if (REG_DEAD_DEBUGGING && dump_file) if (REG_DEAD_DEBUGGING && dump_file)
{ {
...@@ -3533,23 +3483,16 @@ df_simulate_fixup_sets (basic_block bb, bitmap live) ...@@ -3533,23 +3483,16 @@ df_simulate_fixup_sets (basic_block bb, bitmap live)
void void
df_simulate_initialize_backwards (basic_block bb, bitmap live) df_simulate_initialize_backwards (basic_block bb, bitmap live)
{ {
df_ref *def_rec; df_ref def, use;
df_ref *use_rec;
int bb_index = bb->index; int bb_index = bb->index;
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 ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0) if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
bitmap_clear_bit (live, DF_REF_REGNO (def)); bitmap_clear_bit (live, DF_REF_REGNO (def));
}
for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++) FOR_EACH_ARTIFICIAL_USE (use, bb_index)
{
df_ref use = *use_rec;
if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0) if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
bitmap_set_bit (live, DF_REF_REGNO (use)); bitmap_set_bit (live, DF_REF_REGNO (use));
}
} }
...@@ -3573,26 +3516,20 @@ df_simulate_one_insn_backwards (basic_block bb, rtx insn, bitmap live) ...@@ -3573,26 +3516,20 @@ df_simulate_one_insn_backwards (basic_block bb, rtx insn, bitmap live)
void void
df_simulate_finalize_backwards (basic_block bb, bitmap live) df_simulate_finalize_backwards (basic_block bb, bitmap live)
{ {
df_ref *def_rec; df_ref def;
#ifdef EH_USES #ifdef EH_USES
df_ref *use_rec; df_ref use;
#endif #endif
int bb_index = bb->index; int bb_index = bb->index;
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 (DF_REF_FLAGS (def) & DF_REF_AT_TOP) if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
bitmap_clear_bit (live, DF_REF_REGNO (def)); bitmap_clear_bit (live, DF_REF_REGNO (def));
}
#ifdef EH_USES #ifdef EH_USES
for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++) FOR_EACH_ARTIFICIAL_USE (use, bb_index)
{
df_ref use = *use_rec;
if (DF_REF_FLAGS (use) & DF_REF_AT_TOP) if (DF_REF_FLAGS (use) & DF_REF_AT_TOP)
bitmap_set_bit (live, DF_REF_REGNO (use)); bitmap_set_bit (live, DF_REF_REGNO (use));
}
#endif #endif
} }
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
...@@ -3614,15 +3551,12 @@ df_simulate_finalize_backwards (basic_block bb, bitmap live) ...@@ -3614,15 +3551,12 @@ df_simulate_finalize_backwards (basic_block bb, bitmap live)
void void
df_simulate_initialize_forwards (basic_block bb, bitmap live) df_simulate_initialize_forwards (basic_block bb, bitmap live)
{ {
df_ref *def_rec; df_ref def;
int bb_index = bb->index; int bb_index = bb->index;
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 (DF_REF_FLAGS (def) & DF_REF_AT_TOP) if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
bitmap_set_bit (live, DF_REF_REGNO (def)); bitmap_set_bit (live, DF_REF_REGNO (def));
}
} }
/* Simulate the forwards effects of INSN on the bitmap LIVE. */ /* Simulate the forwards effects of INSN on the bitmap LIVE. */
...@@ -4121,10 +4055,8 @@ void ...@@ -4121,10 +4055,8 @@ void
df_md_simulate_artificial_defs_at_top (basic_block bb, bitmap local_md) df_md_simulate_artificial_defs_at_top (basic_block bb, bitmap local_md)
{ {
int bb_index = bb->index; int bb_index = bb->index;
df_ref *def_rec; df_ref def;
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 (DF_REF_FLAGS (def) & DF_REF_AT_TOP) if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
{ {
unsigned int dregno = DF_REF_REGNO (def); unsigned int dregno = DF_REF_REGNO (def);
...@@ -4134,7 +4066,6 @@ df_md_simulate_artificial_defs_at_top (basic_block bb, bitmap local_md) ...@@ -4134,7 +4066,6 @@ df_md_simulate_artificial_defs_at_top (basic_block bb, bitmap local_md)
else else
bitmap_clear_bit (local_md, dregno); bitmap_clear_bit (local_md, dregno);
} }
}
} }
......
...@@ -1639,19 +1639,18 @@ df_reorganize_refs_by_reg_by_insn (struct df_ref_info *ref_info, ...@@ -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); basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn; rtx insn;
df_ref *ref_rec;
df_ref def, use; df_ref def, use;
if (include_defs) 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]++; ref_info->count[regno]++;
} }
if (include_uses) 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]++; ref_info->count[regno]++;
} }
...@@ -1694,33 +1693,30 @@ df_reorganize_refs_by_reg_by_insn (struct df_ref_info *ref_info, ...@@ -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); basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn; rtx insn;
df_ref *ref_rec;
df_ref def, use; df_ref def, use;
if (include_defs) 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 (def);
unsigned int regno = DF_REF_REGNO (ref);
if (regno >= start) if (regno >= start)
{ {
unsigned int id unsigned int id
= ref_info->begin[regno] + ref_info->count[regno]++; = ref_info->begin[regno] + ref_info->count[regno]++;
DF_REF_ID (ref) = id; DF_REF_ID (def) = id;
ref_info->refs[id] = ref; ref_info->refs[id] = def;
} }
} }
if (include_uses) 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 (def);
unsigned int regno = DF_REF_REGNO (ref);
if (regno >= start) if (regno >= start)
{ {
unsigned int id unsigned int id
= ref_info->begin[regno] + ref_info->count[regno]++; = ref_info->begin[regno] + ref_info->count[regno]++;
DF_REF_ID (ref) = id; DF_REF_ID (use) = id;
ref_info->refs[id] = ref; ref_info->refs[id] = use;
} }
} }
......
...@@ -775,6 +775,14 @@ struct df_d ...@@ -775,6 +775,14 @@ struct df_d
#define FOR_EACH_INSN_EQ_USE(ITER, INSN) \ #define FOR_EACH_INSN_EQ_USE(ITER, INSN) \
FOR_EACH_INSN_INFO_EQ_USE(ITER, DF_INSN_INFO_GET (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. /* An obstack for bitmap not related to specific dataflow problems.
This obstack should e.g. be used for bitmaps with a short life time 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. */ such as temporary bitmaps. This obstack is declared in df-core.c. */
......
...@@ -533,7 +533,7 @@ static void ...@@ -533,7 +533,7 @@ static void
init_rename_info (struct bb_rename_info *p, basic_block bb) init_rename_info (struct bb_rename_info *p, basic_block bb)
{ {
int i; int i;
df_ref *def_rec; df_ref def;
HARD_REG_SET start_chains_set; HARD_REG_SET start_chains_set;
p->bb = bb; p->bb = bb;
...@@ -545,12 +545,9 @@ init_rename_info (struct bb_rename_info *p, basic_block bb) ...@@ -545,12 +545,9 @@ init_rename_info (struct bb_rename_info *p, basic_block bb)
CLEAR_HARD_REG_SET (live_in_chains); CLEAR_HARD_REG_SET (live_in_chains);
REG_SET_TO_HARD_REG_SET (live_hard_regs, df_get_live_in (bb)); 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++) FOR_EACH_ARTIFICIAL_DEF (def, bb->index)
{
df_ref def = *def_rec;
if (DF_REF_FLAGS (def) & DF_REF_AT_TOP) if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
SET_HARD_REG_BIT (live_hard_regs, DF_REF_REGNO (def)); SET_HARD_REG_BIT (live_hard_regs, DF_REF_REGNO (def));
}
/* Open chains based on information from (at least one) predecessor /* Open chains based on information from (at least one) predecessor
block. This gives us a chance later on to combine chains across block. This gives us a chance later on to combine chains across
......
...@@ -122,8 +122,6 @@ regstat_bb_compute_ri (unsigned int bb_index, ...@@ -122,8 +122,6 @@ regstat_bb_compute_ri (unsigned int bb_index,
{ {
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn; rtx insn;
df_ref *def_rec;
df_ref *use_rec;
df_ref def, use; df_ref def, use;
int luid = 0; int luid = 0;
bitmap_iterator bi; bitmap_iterator bi;
...@@ -139,23 +137,17 @@ regstat_bb_compute_ri (unsigned int bb_index, ...@@ -139,23 +137,17 @@ regstat_bb_compute_ri (unsigned int bb_index,
/* Process the artificial defs and uses at the bottom of the block /* Process the artificial defs and uses at the bottom of the block
to begin processing. */ 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 ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0) if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
bitmap_clear_bit (live, DF_REF_REGNO (def)); bitmap_clear_bit (live, DF_REF_REGNO (def));
}
for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++) FOR_EACH_ARTIFICIAL_USE (use, bb_index)
{
df_ref use = *use_rec;
if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0) if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
{ {
regno = DF_REF_REGNO (use); regno = DF_REF_REGNO (use);
bitmap_set_bit (live, regno); bitmap_set_bit (live, regno);
bitmap_set_bit (artificial_uses, regno); bitmap_set_bit (artificial_uses, regno);
} }
}
FOR_BB_INSNS_REVERSE (bb, insn) FOR_BB_INSNS_REVERSE (bb, insn)
{ {
...@@ -441,27 +433,19 @@ regstat_bb_compute_calls_crossed (unsigned int bb_index, bitmap live) ...@@ -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); basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn; rtx insn;
df_ref *def_rec;
df_ref *use_rec;
df_ref def, use; df_ref def, use;
bitmap_copy (live, df_get_live_out (bb)); bitmap_copy (live, df_get_live_out (bb));
/* Process the artificial defs and uses at the bottom of the block /* Process the artificial defs and uses at the bottom of the block
to begin processing. */ 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 ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0) if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
bitmap_clear_bit (live, DF_REF_REGNO (def)); bitmap_clear_bit (live, DF_REF_REGNO (def));
}
for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++) FOR_EACH_ARTIFICIAL_USE (use, bb_index)
{
df_ref use = *use_rec;
if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0) if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
bitmap_set_bit (live, DF_REF_REGNO (use)); bitmap_set_bit (live, DF_REF_REGNO (use));
}
FOR_BB_INSNS_REVERSE (bb, insn) FOR_BB_INSNS_REVERSE (bb, insn)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment