This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, rfc] add case-values-threshold as a param


> A couple of suggestions.
> 
> Firstly, the text description of this parameter is misleading/incorrect.
> The parameter is not the "maximum number of values in a case statement"!
> I'm fairly sure GCC can handle switches with as many as eight or nine
> values  :>  Instead it is the "minimum number of values implemented by a
> jump table".  A switch statement with less than this number of values
> will always use a sequence/tree of conditional branches.
> 

Much better.

> 
> Secondly, I think it should be possible to use this parameter to
> override the backend's default, and still preserve the current
> HAVE_casei behaviour.
> 

Agreed.

> The only place that CASE_VALUES_THRESHOLD is used is in expr.c's
> case_values_threshold.  Which may be rewritten as:
> 
> unsigned int
> case_values_threshold (void)
> {
>   unsigned int result;
> 
>   result = PARAM_VALUE (PARAM_CASE_VALUE_THRESHOLD);
>   if (result > 1)
>     return result;

> A value of less than or equal to 1 for PARAM_CASE_VALUE, which should
> include the default, perhaps -1 (or 0, or 1), indicates that the usual
> default should be used.  Values larger than this can then be used to
> tune this threshold, even on backends that provide their own defaults.
> 

Oh. That's a good idea. I was just coming up blank earlier today. Set
the value to something known and bogus (negative one is a good idea) and
then if it's that then return the old default.

> What do you think?

I approve :) I'll submit a real patch shortly - with documentation.

-eric

-- 
Eric Christopher <echristo@redhat.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]