This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: cse "library" routines


On Sat, Mar 11, 2000 at 11:42:22AM -0800, Richard Henderson wrote:
> On Sat, Mar 11, 2000 at 06:37:43PM +0000, Bernd Schmidt wrote:
> > I think the main reason is that I duplicated some parts from
> > cse.c.  I've had a brief look at hashtab.c now.  I could probably
> > use it but some parts might get more complicated; e.g. the code
> > needs to compute the hash value before inserting a new element
> > into the table (to avoid entering particular expressions which
> > can't be hashed), so we'd compute the hash value twice.  IMO not
> > using hashtab.c avoids some complications, but I won't object if
> > you want this changed.
>
> I'm somewhat concerned about the effect of a 32 entry chained hash
> table on functions with very large basic blocks.  So I guess I'd 
> really prefer you used hashtab.c.
> 
> If you're concerned about calculating the hash value twice, you can
> add alternate entry points to htab_find/find_slot that accept a
> pre-computed hash value instead of calling hash_f itself.

You can do this without adding entry points.  Store the hash value
inside the element, and have your callback function just retrieve the
value.  This also saves time when hashtab.c decides to enlarge the
table; you won't have to recalculate any of the hashes.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]