diff options
author | Andrew Macleod <amacleod@redhat.com> | 2006-09-29 13:53:55 +0000 |
---|---|---|
committer | Andrew Macleod <amacleod@redhat.com> | 2006-09-29 13:53:55 +0000 |
commit | 3a25041914238291038e908467d0a1256287e5fb (patch) | |
tree | acfa58c0ca8076acd6d0bc447aa9f6a401d74a96 /gcc | |
parent | d02b7175cbace39c363541d64ca11a17140ec9ac (diff) |
fix coalesce time problems.
2006-09-29 Andrew MacLeod <amacleod@redhat.com>
* tree-ssa-ilve.c (mix): Define hash mix.
(coalesce_pair_map_hash): Use hash mix.
(create_coalesce_list): Calculate initial size of hash table.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/out-of-ssa-the-sequel@117304 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-live.c | 24 |
2 files changed, 27 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f3d861909ce..2bc978e1bf6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-09-29 Andrew MacLeod <amacleod@redhat.com> + + * tree-ssa-ilve.c (mix): Define hash mix. + (coalesce_pair_map_hash): Use hash mix. + (create_coalesce_list): Calculate initial size of hash table. + 2006-09-26 Andrew MacLeod <amacleod@redhat.com> * tree-outof-ssa.c (build_ssa_conflict_graph): Add comments. diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index cebb906df52..cc55b05637c 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -783,6 +783,20 @@ calculate_live_ranges (var_map map) return live; } +/* Borrowed from hashtab.c iterative_hash implementation. */ +#define mix(a,b,c) \ +{ \ + a -= b; a -= c; a ^= (c>>13); \ + b -= c; b -= a; b ^= (a<< 8); \ + c -= a; c -= b; c ^= ((b&0xffffffff)>>13); \ + a -= b; a -= c; a ^= ((c&0xffffffff)>>12); \ + b -= c; b -= a; b = (b ^ (a<<16)) & 0xffffffff; \ + c -= a; c -= b; c = (c ^ (b>> 5)) & 0xffffffff; \ + a -= b; a -= c; a = (a ^ (c>> 3)) & 0xffffffff; \ + b -= c; b -= a; b = (b ^ (a<<10)) & 0xffffffff; \ + c -= a; c -= b; c = (c ^ (b>>15)) & 0xffffffff; \ +} + /* Hash function for coalesce list. Calculate hash for PAIR. */ @@ -792,7 +806,8 @@ coalesce_pair_map_hash (const void *pair) hashval_t a = (hashval_t)(((coalesce_pair_p)pair)->first_element); hashval_t b = (hashval_t)(((coalesce_pair_p)pair)->second_element); - hashval_t val = (a << 16) & (b & 0xffff); + hashval_t val = 0x9e3779b9; + mix (a, b, val); return val; } @@ -817,10 +832,13 @@ coalesce_list_p create_coalesce_list (void) { coalesce_list_p list; + unsigned size = num_ssa_names * 3; - list = (coalesce_list_p) xmalloc (sizeof (struct coalesce_list_d)); + if (size < 40) + size = 40; - list->list = htab_create (60, coalesce_pair_map_hash, + list = (coalesce_list_p) xmalloc (sizeof (struct coalesce_list_d)); + list->list = htab_create (size, coalesce_pair_map_hash, coalesce_pair_map_eq, NULL); list->sorted = NULL; list->num_sorted = 0; |