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>
* 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.
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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;
}
}
......
......@@ -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. */
......
......@@ -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
......
......@@ -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)
{
......
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