Unify gcse and cse exp{r,}_equiv_p functions

Paolo Bonzini bonzini@gnu.org
Sat Aug 7 08:28:00 GMT 2004


 > In short: put
> the switch statement inside a "if (GET_CODE (x) == GET_CODE (y)" 
> statement, and before it add
> 
>   result = rtlhooks.exp_equiv_p (x, y, validate, equal_values);
>   if (result != -1)
>     return result;

No, actually: replace the two if's before the switch statement with

   code = GET_CODE (x);
   result = rtlhooks.exp_equiv_p (x, y, validate, equal_values);
   if (result != -1)
     return result;
   if (code != GET_CODE (y))
     return 0;

and also add a test for

   if (GET_MODE (x) != GET_MODE (y))
      return 0;

at the beginning (before the switch) of the GCSE hook and at the end 
(before returning -1) of the CSE hook.

Paolo




More information about the Gcc-patches mailing list