aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/df-problems.c89
-rw-r--r--gcc/df-scan.c4
-rw-r--r--gcc/df.h1
4 files changed, 77 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c9c7e30..4865f2b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2007-07-27 Richard Sandiford <rsandifo@nildram.co.uk>
+
+ * df.h (df_mw_hardreg): Remove "loc" field.
+ * df-scan.c (df_ref_record): Don't set it. Remove redundant
+ local variable.
+ * df-problems.c (df_whole_mw_reg_unused_p): New function,
+ split out from df_set_unused_notes_for_mw. Return false for
+ partial references. Assert that mw_reg is a REG when returning true.
+ (df_set_unused_notes_for_mw): Use it. Use mw_reg instead of *loc.
+ (df_whole_mw_reg_dead_p): New function, split out from
+ df_set_dead_notes_for_mw. Return false for partial references.
+ Assert that mw_reg is a REG when returning true.
+ (df_set_dead_notes_for_mw): Use it. Use mw_reg instead of *loc.
+ Remove redundant bitmap check.
+
2007-07-26 H.J. Lu <hongjiu.lu@intel.com>
* config/ia64/t-ia64 ($(T)crtbegin.o): Removed.
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 4dcb3b15..b3ae9a1 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -3716,6 +3716,32 @@ df_set_note (enum reg_note note_type, rtx insn, rtx old, rtx reg)
return old;
}
+/* A subroutine of df_set_unused_notes_for_mw, with a selection of its
+ arguments. Return true if the register value described by MWS's
+ mw_reg is known to be completely unused, and if mw_reg can therefore
+ be used in a REG_UNUSED note. */
+
+static bool
+df_whole_mw_reg_unused_p (struct df_mw_hardreg *mws,
+ bitmap live, bitmap artificial_uses)
+{
+ unsigned int r;
+
+ /* If MWS describes a partial reference, create REG_UNUSED notes for
+ individual hard registers. */
+ if (mws->flags & DF_REF_PARTIAL)
+ return false;
+
+ /* Likewise if some part of the register is used. */
+ for (r = mws->start_regno; r <= mws->end_regno; r++)
+ if (bitmap_bit_p (live, r)
+ || bitmap_bit_p (artificial_uses, r))
+ return false;
+
+ gcc_assert (REG_P (mws->mw_reg));
+ return true;
+}
+
/* Set the REG_UNUSED notes for the multiword hardreg defs in INSN
based on the bits in LIVE. Do not generate notes for registers in
artificial uses. DO_NOT_GEN is updated so that REG_DEAD notes are
@@ -3728,7 +3754,6 @@ df_set_unused_notes_for_mw (rtx insn, rtx old, struct df_mw_hardreg *mws,
bitmap live, bitmap do_not_gen,
bitmap artificial_uses)
{
- bool all_dead = true;
unsigned int r;
#ifdef REG_DEAD_DEBUGGING
@@ -3736,18 +3761,11 @@ df_set_unused_notes_for_mw (rtx insn, rtx old, struct df_mw_hardreg *mws,
fprintf (dump_file, "mw_set_unused looking at mws[%d..%d]\n",
mws->start_regno, mws->end_regno);
#endif
- for (r=mws->start_regno; r <= mws->end_regno; r++)
- if ((bitmap_bit_p (live, r))
- || bitmap_bit_p (artificial_uses, r))
- {
- all_dead = false;
- break;
- }
-
- if (all_dead)
+
+ if (df_whole_mw_reg_unused_p (mws, live, artificial_uses))
{
unsigned int regno = mws->start_regno;
- old = df_set_note (REG_UNUSED, insn, old, *(mws->loc));
+ old = df_set_note (REG_UNUSED, insn, old, mws->mw_reg);
#ifdef REG_DEAD_DEBUGGING
df_print_note ("adding 1: ", insn, REG_NOTES (insn));
@@ -3772,6 +3790,34 @@ df_set_unused_notes_for_mw (rtx insn, rtx old, struct df_mw_hardreg *mws,
}
+/* A subroutine of df_set_dead_notes_for_mw, with a selection of its
+ arguments. Return true if the register value described by MWS's
+ mw_reg is known to be completely dead, and if mw_reg can therefore
+ be used in a REG_DEAD note. */
+
+static bool
+df_whole_mw_reg_dead_p (struct df_mw_hardreg *mws,
+ bitmap live, bitmap artificial_uses,
+ bitmap do_not_gen)
+{
+ unsigned int r;
+
+ /* If MWS describes a partial reference, create REG_DEAD notes for
+ individual hard registers. */
+ if (mws->flags & DF_REF_PARTIAL)
+ return false;
+
+ /* Likewise if some part of the register is not dead. */
+ for (r = mws->start_regno; r <= mws->end_regno; r++)
+ if (bitmap_bit_p (live, r)
+ || bitmap_bit_p (artificial_uses, r)
+ || bitmap_bit_p (do_not_gen, r))
+ return false;
+
+ gcc_assert (REG_P (mws->mw_reg));
+ return true;
+}
+
/* Set the REG_DEAD notes for the multiword hardreg use in INSN based
on the bits in LIVE. DO_NOT_GEN is used to keep REG_DEAD notes
from being set if the instruction both reads and writes the
@@ -3782,7 +3828,6 @@ df_set_dead_notes_for_mw (rtx insn, rtx old, struct df_mw_hardreg *mws,
bitmap live, bitmap do_not_gen,
bitmap artificial_uses)
{
- bool all_dead = true;
unsigned int r;
#ifdef REG_DEAD_DEBUGGING
@@ -3798,25 +3843,13 @@ df_set_dead_notes_for_mw (rtx insn, rtx old, struct df_mw_hardreg *mws,
}
#endif
- for (r = mws->start_regno; r <= mws->end_regno; r++)
- if ((bitmap_bit_p (live, r))
- || bitmap_bit_p (artificial_uses, r)
- || bitmap_bit_p (do_not_gen, r))
- {
- all_dead = false;
- break;
- }
-
- if (all_dead)
+ if (df_whole_mw_reg_dead_p (mws, live, artificial_uses, do_not_gen))
{
- if (!bitmap_bit_p (do_not_gen, mws->start_regno))
- {
- /* Add a dead note for the entire multi word register. */
- old = df_set_note (REG_DEAD, insn, old, *(mws->loc));
+ /* Add a dead note for the entire multi word register. */
+ old = df_set_note (REG_DEAD, insn, old, mws->mw_reg);
#ifdef REG_DEAD_DEBUGGING
- df_print_note ("adding 1: ", insn, REG_NOTES (insn));
+ df_print_note ("adding 1: ", insn, REG_NOTES (insn));
#endif
- }
}
else
{
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index acef3e4..6e622f8 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -2625,7 +2625,6 @@ df_ref_record (struct df_collection_rec *collection_rec,
enum df_ref_type ref_type,
enum df_ref_flags ref_flags)
{
- rtx oldreg = reg;
unsigned int regno;
gcc_assert (REG_P (reg) || GET_CODE (reg) == SUBREG);
@@ -2656,7 +2655,7 @@ df_ref_record (struct df_collection_rec *collection_rec,
{
/* Sets to a subreg of a multiword register are partial.
Sets to a non-subreg of a multiword register are not. */
- if (GET_CODE (oldreg) == SUBREG)
+ if (GET_CODE (reg) == SUBREG)
ref_flags |= DF_REF_PARTIAL;
ref_flags |= DF_REF_MW_HARDREG;
@@ -2664,7 +2663,6 @@ df_ref_record (struct df_collection_rec *collection_rec,
hardreg->type = ref_type;
hardreg->flags = ref_flags;
hardreg->mw_reg = reg;
- hardreg->loc = loc;
hardreg->start_regno = regno;
hardreg->end_regno = endregno - 1;
hardreg->mw_order = df->ref_order++;
diff --git a/gcc/df.h b/gcc/df.h
index e4f2c09..7740431 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -311,7 +311,6 @@ struct dataflow
struct df_mw_hardreg
{
rtx mw_reg; /* The multiword hardreg. */
- rtx *loc; /* The location of the reg. */
enum df_ref_type type; /* Used to see if the ref is read or write. */
enum df_ref_flags flags; /* Various flags. */
unsigned int start_regno; /* First word of the multi word subreg. */