RFC: define_predicate
Joern Rennecke
joern.rennecke@superh.com
Mon Aug 2 18:50:00 GMT 2004
> 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.
I propose it is only inserted if you omit the third argument.
For are worried about people shooting themselves in the foot, for
ENABLE_CHECKING, you could create wrappers that check that there are
no positives that disagree with the rtx_code.
More information about the Gcc-patches
mailing list