RFC: define_predicate

Andrew Pinski pinskia@physics.uc.edu
Mon Aug 2 19:00:00 GMT 2004


On Aug 2, 2004, at 11:51 AM, Joern Rennecke wrote:

>> if genpreds.c would put an additional switch statement before the user
>> code.  Well, maybe in this case it is not that much more readable 
>> (maybe
>> the opposite is true), but in many predicates the third argument to
>> define_predicate would be superfluous, as in
>>
>> +;; Return 1 if OP refers to a symbol.
>> +(define_predicate "symbolic_operand" "symbol_ref,const,label_ref"
>> +{
>> +  switch (GET_CODE (op))
>> +    {
>> +    case CONST:
>> +    case SYMBOL_REF:
>> +    case LABEL_REF:
>> +      return 1;
>> +
>> +    default:
>> +      break;
>> +    }
>> +  return 0;
>> +})
>>
>> and that argument could be made optional (defaulting to "return 1;").
>> Does this make sense?
>
> It's very hard to optimize that switch statement away if it is not 
> needed.

Are you sure about that any more?

Andrew



More information about the Gcc-patches mailing list