Commit fc8e9f58 by Richard Sandiford Committed by Richard Sandiford

df.h (FOR_EACH_INSN_INFO_MW): New macro.

gcc/
	* df.h (FOR_EACH_INSN_INFO_MW): New macro.
	* df-problems.c (df_note_bb_compute): Use it.
	* regstat.c (regstat_bb_compute_ri): Likewise.

From-SVN: r211680
parent 292321a5
2014-06-15 Richard Sandiford <rdsandiford@googlemail.com> 2014-06-15 Richard Sandiford <rdsandiford@googlemail.com>
* df.h (FOR_EACH_INSN_INFO_MW): New macro.
* df-problems.c (df_note_bb_compute): Use it.
* regstat.c (regstat_bb_compute_ri): Likewise.
2014-06-15 Richard Sandiford <rdsandiford@googlemail.com>
* df.h (FOR_EACH_ARTIFICIAL_USE, FOR_EACH_ARTIFICIAL_DEF): New macros. * df.h (FOR_EACH_ARTIFICIAL_USE, FOR_EACH_ARTIFICIAL_DEF): New macros.
* cse.c (cse_extended_basic_block): Use them. * cse.c (cse_extended_basic_block): Use them.
* dce.c (mark_artificial_use): Likewise. * dce.c (mark_artificial_use): Likewise.
......
...@@ -3114,7 +3114,7 @@ df_note_bb_compute (unsigned int bb_index, ...@@ -3114,7 +3114,7 @@ df_note_bb_compute (unsigned int bb_index,
FOR_BB_INSNS_REVERSE (bb, insn) FOR_BB_INSNS_REVERSE (bb, insn)
{ {
df_insn_info *insn_info = DF_INSN_INFO_GET (insn); df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
struct df_mw_hardreg **mws_rec; df_mw_hardreg *mw;
int debug_insn; int debug_insn;
if (!INSN_P (insn)) if (!INSN_P (insn))
...@@ -3137,17 +3137,11 @@ df_note_bb_compute (unsigned int bb_index, ...@@ -3137,17 +3137,11 @@ df_note_bb_compute (unsigned int bb_index,
/* We only care about real sets for calls. Clobbers cannot /* We only care about real sets for calls. Clobbers cannot
be depended on to really die. */ be depended on to really die. */
mws_rec = DF_INSN_INFO_MWS (insn_info); FOR_EACH_INSN_INFO_MW (mw, insn_info)
while (*mws_rec) if ((DF_MWS_REG_DEF_P (mw))
{ && !df_ignore_stack_reg (mw->start_regno))
struct df_mw_hardreg *mws = *mws_rec; df_set_unused_notes_for_mw (insn, mw, live, do_not_gen,
if ((DF_MWS_REG_DEF_P (mws))
&& !df_ignore_stack_reg (mws->start_regno))
df_set_unused_notes_for_mw (insn,
mws, live, do_not_gen,
artificial_uses, &debug); artificial_uses, &debug);
mws_rec++;
}
/* All of the defs except the return value are some sort of /* All of the defs except the return value are some sort of
clobber. This code is for the return. */ clobber. This code is for the return. */
...@@ -3168,16 +3162,10 @@ df_note_bb_compute (unsigned int bb_index, ...@@ -3168,16 +3162,10 @@ df_note_bb_compute (unsigned int bb_index,
else else
{ {
/* Regular insn. */ /* Regular insn. */
mws_rec = DF_INSN_INFO_MWS (insn_info); FOR_EACH_INSN_INFO_MW (mw, insn_info)
while (*mws_rec) if (DF_MWS_REG_DEF_P (mw))
{ df_set_unused_notes_for_mw (insn, mw, live, do_not_gen,
struct df_mw_hardreg *mws = *mws_rec; artificial_uses, &debug);
if (DF_MWS_REG_DEF_P (mws))
df_set_unused_notes_for_mw (insn,
mws, live, do_not_gen,
artificial_uses, &debug);
mws_rec++;
}
FOR_EACH_INSN_INFO_DEF (def, insn_info) FOR_EACH_INSN_INFO_DEF (def, insn_info)
{ {
...@@ -3194,25 +3182,19 @@ df_note_bb_compute (unsigned int bb_index, ...@@ -3194,25 +3182,19 @@ df_note_bb_compute (unsigned int bb_index,
} }
/* Process the uses. */ /* Process the uses. */
mws_rec = DF_INSN_INFO_MWS (insn_info); FOR_EACH_INSN_INFO_MW (mw, insn_info)
while (*mws_rec) if (DF_MWS_REG_USE_P (mw)
{ && !df_ignore_stack_reg (mw->start_regno))
struct df_mw_hardreg *mws = *mws_rec; {
if (DF_MWS_REG_USE_P (mws) bool really_add_notes = debug_insn != 0;
&& !df_ignore_stack_reg (mws->start_regno))
{
bool really_add_notes = debug_insn != 0;
df_set_dead_notes_for_mw (insn, df_set_dead_notes_for_mw (insn, mw, live, do_not_gen,
mws, live, do_not_gen, artificial_uses,
artificial_uses, &really_add_notes);
&really_add_notes);
if (really_add_notes) if (really_add_notes)
debug_insn = -1; debug_insn = -1;
} }
mws_rec++;
}
FOR_EACH_INSN_INFO_USE (use, insn_info) FOR_EACH_INSN_INFO_USE (use, insn_info)
{ {
......
...@@ -766,6 +766,10 @@ struct df_d ...@@ -766,6 +766,10 @@ struct df_d
for (df_ref *ITER##_ = DF_INSN_INFO_EQ_USES (INSN); (ITER = *ITER##_); \ for (df_ref *ITER##_ = DF_INSN_INFO_EQ_USES (INSN); (ITER = *ITER##_); \
++ITER##_) ++ITER##_)
#define FOR_EACH_INSN_INFO_MW(ITER, INSN) \
for (df_mw_hardreg **ITER##_ = DF_INSN_INFO_MWS (INSN); (ITER = *ITER##_); \
++ITER##_)
#define FOR_EACH_INSN_DEF(ITER, INSN) \ #define FOR_EACH_INSN_DEF(ITER, INSN) \
FOR_EACH_INSN_INFO_DEF(ITER, DF_INSN_INFO_GET (INSN)) FOR_EACH_INSN_INFO_DEF(ITER, DF_INSN_INFO_GET (INSN))
......
...@@ -153,7 +153,7 @@ regstat_bb_compute_ri (unsigned int bb_index, ...@@ -153,7 +153,7 @@ regstat_bb_compute_ri (unsigned int bb_index,
{ {
struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn); struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
bitmap_iterator bi; bitmap_iterator bi;
struct df_mw_hardreg **mws_rec; df_mw_hardreg *mw;
rtx link; rtx link;
if (!NONDEBUG_INSN_P (insn)) if (!NONDEBUG_INSN_P (insn))
...@@ -202,29 +202,26 @@ regstat_bb_compute_ri (unsigned int bb_index, ...@@ -202,29 +202,26 @@ regstat_bb_compute_ri (unsigned int bb_index,
/* We only care about real sets for calls. Clobbers cannot /* We only care about real sets for calls. Clobbers cannot
be depended on. be depended on.
Only do this if the value is totally dead. */ Only do this if the value is totally dead. */
for (mws_rec = DF_INSN_INFO_MWS (insn_info); *mws_rec; mws_rec++) FOR_EACH_INSN_INFO_MW (mw, insn_info)
{ if (DF_MWS_REG_DEF_P (mw))
struct df_mw_hardreg *mws = *mws_rec; {
if (DF_MWS_REG_DEF_P (mws)) bool all_dead = true;
{ unsigned int r;
bool all_dead = true;
unsigned int r; for (r = mw->start_regno; r <= mw->end_regno; r++)
if (bitmap_bit_p (artificial_uses, r)
for (r = mws->start_regno; r <= mws->end_regno; r++) || bitmap_bit_p (live, r))
if (bitmap_bit_p (artificial_uses, r)
|| bitmap_bit_p (live, r))
{
all_dead = false;
break;
}
if (all_dead)
{ {
regno = mws->start_regno; all_dead = false;
REG_LIVE_LENGTH (regno)++; break;
} }
}
} if (all_dead)
{
regno = mw->start_regno;
REG_LIVE_LENGTH (regno)++;
}
}
/* All of the defs except the return value are some sort of /* All of the defs except the return value are some sort of
clobber. This code is for the return. */ clobber. This code is for the return. */
......
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