Hash Function for "switch statement"

Basile Starynkevitch basile@starynkevitch.net
Mon Mar 15 03:12:00 GMT 2010


Jae Hyuk Kwak wrote:
> Hello, GCC developers.
> 
> In addition, I found that switch statement can use "Hash Table" rather
> than just replacing with "else if".
> Besides using "jump table", "Hash Table" can increase speed.
> Hash table idea can alleviate the problem of a huge size of jump table as well.
> 


It is much more complex than that. Read the  paper "A Superoptimizer 
Analysis of Multiway Branch Code Generation" by Roger A. Sayle in GCC 
summit 2008 proceedings. www.gccsummit.org/2008/gcc-2008-proceedings.pdf

Regards.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***



More information about the Gcc mailing list