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]

Re: cpplib: some size reductions


Jeffrey A Law wrote:
>   > It occurs to me that code like
>   > 
>   >        if (x == a)  foo;
>   >        else if (x == b)  bar;
>   >        else if (x == c)  baz;
>   >        else if ...
>   >        else whatever;
>   > 
>   > might be usefully optimized to a binary search or even a jump table.
>   > Is this feasible with the current global optimizer framework?
> The decision to use a series of if-else statements or a case/switch happens
> during the tree->rtl conversion.  By the time the global optimizer gets
> involved the decision was already made.

Yah, but couldn't the global optimizer transform the RTL for a series
of if-elses testing equality into a binary search?

zw


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