This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cpplib: some size reductions
- To: law at cygnus dot com
- Subject: Re: cpplib: some size reductions
- From: Zack Weinberg <zack at bitmover dot com>
- Date: Thu, 28 Oct 1999 21:59:24 -0700
- cc: gcc-patches at gcc dot gnu dot org
- References: <683.941171053@upchuck>
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