Commit 74e59b6c by Richard Sandiford Committed by Richard Sandiford

df.h (df_single_def, [...]): New functions.

gcc/
	* df.h (df_single_def, df_single_use): New functions.
	* ira.c (find_moveable_pseudos): Use them.

From-SVN: r211681
parent fc8e9f58
2014-06-15 Richard Sandiford <rdsandiford@googlemail.com> 2014-06-15 Richard Sandiford <rdsandiford@googlemail.com>
* df.h (df_single_def, df_single_use): New functions.
* ira.c (find_moveable_pseudos): Use them.
2014-06-15 Richard Sandiford <rdsandiford@googlemail.com>
* df.h (FOR_EACH_INSN_INFO_MW): New macro. * df.h (FOR_EACH_INSN_INFO_MW): New macro.
* df-problems.c (df_note_bb_compute): Use it. * df-problems.c (df_note_bb_compute): Use it.
* regstat.c (regstat_bb_compute_ri): Likewise. * regstat.c (regstat_bb_compute_ri): Likewise.
......
...@@ -1165,6 +1165,25 @@ df_get_artificial_uses (unsigned int bb_index) ...@@ -1165,6 +1165,25 @@ df_get_artificial_uses (unsigned int bb_index)
return df_scan_get_bb_info (bb_index)->artificial_uses; return df_scan_get_bb_info (bb_index)->artificial_uses;
} }
/* If INSN defines exactly one register, return the associated reference,
otherwise return null. */
static inline df_ref
df_single_def (const df_insn_info *info)
{
df_ref *defs = DF_INSN_INFO_DEFS (info);
return defs[0] && !defs[1] ? defs[0] : NULL;
}
/* If INSN uses exactly one register, return the associated reference,
otherwise return null. */
static inline df_ref
df_single_use (const df_insn_info *info)
{
df_ref *uses = DF_INSN_INFO_USES (info);
return uses[0] && !uses[1] ? uses[0] : NULL;
}
/* web */ /* web */
......
...@@ -4437,20 +4437,19 @@ find_moveable_pseudos (void) ...@@ -4437,20 +4437,19 @@ find_moveable_pseudos (void)
if (NONDEBUG_INSN_P (insn)) if (NONDEBUG_INSN_P (insn))
{ {
df_insn_info *insn_info = DF_INSN_INFO_GET (insn); df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
df_ref *u_rec, *d_rec;
df_ref def, use; df_ref def, use;
uid_luid[INSN_UID (insn)] = i++; uid_luid[INSN_UID (insn)] = i++;
u_rec = DF_INSN_INFO_USES (insn_info); def = df_single_def (insn_info);
d_rec = DF_INSN_INFO_DEFS (insn_info); use = df_single_use (insn_info);
if (d_rec[0] != NULL && d_rec[1] == NULL if (use
&& u_rec[0] != NULL && u_rec[1] == NULL && def
&& DF_REF_REGNO (*u_rec) == DF_REF_REGNO (*d_rec) && DF_REF_REGNO (use) == DF_REF_REGNO (def)
&& !bitmap_bit_p (&set, DF_REF_REGNO (*u_rec)) && !bitmap_bit_p (&set, DF_REF_REGNO (use))
&& rtx_moveable_p (&PATTERN (insn), OP_IN)) && rtx_moveable_p (&PATTERN (insn), OP_IN))
{ {
unsigned regno = DF_REF_REGNO (*u_rec); unsigned regno = DF_REF_REGNO (use);
bitmap_set_bit (moveable, regno); bitmap_set_bit (moveable, regno);
bitmap_set_bit (&set, regno); bitmap_set_bit (&set, regno);
bitmap_set_bit (&used, regno); bitmap_set_bit (&used, regno);
...@@ -4487,16 +4486,16 @@ find_moveable_pseudos (void) ...@@ -4487,16 +4486,16 @@ find_moveable_pseudos (void)
FOR_BB_INSNS (bb, insn) FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn)) if (NONDEBUG_INSN_P (insn))
{ {
df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
rtx def_insn, closest_use, note; rtx def_insn, closest_use, note;
df_ref *def_rec, def, use; df_ref def, use;
unsigned regno; unsigned regno;
bool all_dominated, all_local; bool all_dominated, all_local;
enum machine_mode mode; enum machine_mode mode;
def_rec = DF_INSN_DEFS (insn); def = df_single_def (insn_info);
/* There must be exactly one def in this insn. */ /* There must be exactly one def in this insn. */
def = *def_rec; if (!def || !single_set (insn))
if (!def || def_rec[1] || !single_set (insn))
continue; continue;
/* This must be the only definition of the reg. We also limit /* This must be the only definition of the reg. We also limit
which modes we deal with so that we can assume we can generate which modes we deal with so that we can assume we can generate
......
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