[patch] Move lowering of switches to bit tests to GIMPLE

Richard Guenther richard.guenther@gmail.com
Sun Jul 1 09:58:00 GMT 2012


On Sat, Jun 30, 2012 at 12:29 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> This patch moves the emit_case_bit_tests method of switch lowering
> from 'expand' to a GIMPLE pass.
>
> Initially, I planned to move all switch lowering to something other
> than a casesi or tablejump to GIMPLE, but this is more involved than I
> anticipated. My plan was (and still is, but for later) to do the
> switch lowering using a divide-and-conquer approach: Parts of a switch
> may be best expanded as bit-tests, other parts maybe as a decision
> tree, and yet others as casesi/tablejump (the code in stmt.c uses only
> one of these approaches per GIMPLE_SWITCH). Also I wanted to use
> profile information in the lowering decision making (using Freescale's
> patch as a basis). But I need to come up with a way to handle the SJLJ
> dispatch table issue.
>
> I'll continue to work on all of the above, and I hope I can finish
> everything I planned to work on for GCC 4.8.
> But to make sure I don't miss the GCC 4.8 stage1 deadline, I'm
> proposing this for trunk now.
>
> Bootstrapped&tested on powerpc64-unknown-linux-gnu - several times in
> fact, over the past few months.
> Bootstrapped&tested on x86_64-unknown-linux-gnu. Also built&tested on
> various powerpc64 X embedded targets.
>
> OK for trunk?

This is ok.

We have to think about the point in the pass pipeline where we want to do
this (and the rest of) lowering.  At the moment switch-conversion runs before
profile-data is read and thus cannot do a very good job.  I think lowering
somewhere early after IPA optimizations (inlining and then constant
propagation might affect the optimal lowering?) might be most sensible?

Thanks for working on this,
Richard.

> Ciao!
> Steven



More information about the Gcc-patches mailing list