Hi,

On Mon, 10 Jun 2019, Martin Liska wrote:

> 2019-07-24  Martin Liska  <mli...@suse.cz>
> 
>       * fold-const.c (operand_equal_p): Rename to ...
>       (operand_compare::operand_equal_p): ... this.
>       (add_expr):  Rename to ...
>       (operand_compare::hash_operand): ... this.
>       (operand_compare::operand_equal_valueize): Likewise.
>       (operand_compare::hash_operand_valueize): Likewise.
>       * fold-const.h (operand_equal_p): Set default
>       value for last argument.
>       (class operand_compare): New.

Hmpf.  A class without any data?  That doesn't sound like a good design.  
You seem to need it only to have the possibility of virtual functions, 
i.e. fancy callbacks.  AFAICS you only have one derived class, i.e. a 
simple distinction of two cases.  What do you think about encoding the 
additional new (ICF) case in the (existing) 'flags' argument to 
operand_equal_p (and in case the ICF flag is set simply call the 
"callback" directly)?  IMHO that would also make the logic within 
operand_equal_p clearer, because you don't have to think about all the 
potential callback functions that might be called.


Ciao,
Michael.

Reply via email to