aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2002-05-21 00:55:22 -0700
committerDavid S. Miller <davem@gcc.gnu.org>2002-05-21 00:55:22 -0700
commit31825e5755c97486d8cfdf12887b2cf3c364604b (patch)
tree932d7037971627befb8ca826cb992f2101ea8745
parent74e5c1f4ecb1aa38aafae71631b0e120e50e592c (diff)
downloadgcc-31825e5755c97486d8cfdf12887b2cf3c364604b.zip
gcc-31825e5755c97486d8cfdf12887b2cf3c364604b.tar.gz
gcc-31825e5755c97486d8cfdf12887b2cf3c364604b.tar.bz2
cselib.c (max_value_regs): New.
2002-05-20 David S. Miller <davem@redhat.com> * cselib.c (max_value_regs): New. (cselib_lookup, cselib_invalidate_regno): Initialize it when adding new entries to the REG_VALUES table and we are dealing with a hard register. (clear_table): Initialize it. (cselib_invalidate_regno): Use it to determine which hard registers to scan when mode is not VOIDmode. From-SVN: r53684
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/cselib.c39
2 files changed, 46 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 326f886..f74e6d5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2002-05-20 David S. Miller <davem@redhat.com>
+
+ * cselib.c (max_value_regs): New.
+ (cselib_lookup, cselib_invalidate_regno): Initialize it when
+ adding new entries to the REG_VALUES table and we are dealing with
+ a hard register.
+ (clear_table): Initialize it.
+ (cselib_invalidate_regno): Use it to determine which hard
+ registers to scan when mode is not VOIDmode.
+
2002-05-20 Duraid Madina <duraid@fl.net.au>
* tradcpp.c (fixup_newlines): Use old-style function header.
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 0eb17b8..b0348fb 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -104,6 +104,10 @@ static int n_useless_values;
static varray_type reg_values;
#define REG_VALUES(I) VARRAY_ELT_LIST (reg_values, (I))
+/* The largest number of hard regs used by any entry added to the
+ REG_VALUES table. Cleared on each clear_table() invocation. */
+static unsigned int max_value_regs;
+
/* Here the set of indices I with REG_VALUES(I) != 0 is saved. This is used
in clear_table() for fast emptying. */
static varray_type used_regs;
@@ -227,6 +231,8 @@ clear_table (clear_all)
for (i = 0; i < VARRAY_ACTIVE_SIZE (used_regs); i++)
REG_VALUES (VARRAY_UINT (used_regs, i)) = 0;
+ max_value_regs = 0;
+
VARRAY_POP_ALL (used_regs);
htab_empty (hash_table);
@@ -897,6 +903,14 @@ cselib_lookup (x, mode, create)
if (! create)
return 0;
+ if (i < FIRST_PSEUDO_REGISTER)
+ {
+ unsigned int n = HARD_REGNO_NREGS (i, mode);
+
+ if (n > max_value_regs)
+ max_value_regs = n;
+ }
+
e = new_cselib_val (++next_unknown_value, GET_MODE (x));
e->locs = new_elt_loc_list (e->locs, x);
if (REG_VALUES (i) == 0)
@@ -957,11 +971,22 @@ cselib_invalidate_regno (regno, mode)
pseudos, only REGNO is affected. For hard regs, we must take MODE
into account, and we must also invalidate lower register numbers
if they contain values that overlap REGNO. */
- endregno = regno + 1;
if (regno < FIRST_PSEUDO_REGISTER && mode != VOIDmode)
- endregno = regno + HARD_REGNO_NREGS (regno, mode);
+ {
+ if (regno < max_value_regs)
+ i = 0;
+ else
+ i = regno - max_value_regs;
- for (i = 0; i < endregno; i++)
+ endregno = regno + HARD_REGNO_NREGS (regno, mode);
+ }
+ else
+ {
+ i = regno;
+ endregno = regno + 1;
+ }
+
+ for (; i < endregno; i++)
{
struct elt_list **l = &REG_VALUES (i);
@@ -1171,6 +1196,14 @@ cselib_record_set (dest, src_elt, dest_addr_elt)
if (REG_VALUES (dreg) == 0)
VARRAY_PUSH_UINT (used_regs, dreg);
+ if (dreg < FIRST_PSEUDO_REGISTER)
+ {
+ unsigned int n = HARD_REGNO_NREGS (dreg, GET_MODE (dest));
+
+ if (n > max_value_regs)
+ max_value_regs = n;
+ }
+
REG_VALUES (dreg) = new_elt_list (REG_VALUES (dreg), src_elt);
if (src_elt->locs == 0)
n_useless_values--;