hash_rtx and volatile subexpressions

Andrey Belevantsev abel@ispras.ru
Thu Jun 7 14:03:00 GMT 2007


Hello,

I would like to use some sort of hashing to speed up searching for an 
insn in an availability set in the selective scheduler.  It seems 
natural using hash_rtx for this purpose.  However, hash_rtx will not 
hash any volatile subexpressions, returning 0 in this case.  This is 
fine by me, but together with the recursion optimization it has near 
line 2345...

   for (; i >= 0; i--)
     {
       switch (fmt[i])

...

           /* If we are about to do the last recursive call
              needed at this level, change it into iteration.
              This function  is called enough to be worth it.  */
           if (i == 0)
             {
               x = XEXP (x, i);
               goto repeat;
             }

...one does not get a hash e.g. for any conditional jump like

(set (pc)
     (if_then_else (ne (reg:BI 262 p6 [360])
             (const_int 0 [0x0]))
         (label_ref:DI 191)
         (pc)))

...because the pc subexpression is always the first one, and the 
recursive call for it gets optimized by the above code, which results in 
a zero hash for the whole pattern.

Is this intentional, or do we want to have 'return hash;' instead of 
'return 0;' in all places when *do_not_record_p is set to 1?  Is there a 
better hash_rtx somewhere, which I don't know about?

Andrey



More information about the Gcc mailing list