This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Move add_case_node logic from stmt.c to gimplify.c
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Steven Bosscher <stevenb dot gcc at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Guenther <rguenther at suse dot de>, Jan Hubicha <jh at suse dot cz>
- Date: Sat, 28 Apr 2012 08:21:21 -0700
- Subject: Re: [patch] Move add_case_node logic from stmt.c to gimplify.c
- References: <CABu31nO1_QphN2eigTpoSShJZep-Nhqk_fhJdyuStG6dk5VZQQ@mail.gmail.com>
On Tue, Apr 17, 2012 at 3:11 PM, Steven Bosscher <email@example.com> wrote:
> On Wed, Apr 18, 2012 at 12:04 AM, Steven Bosscher <firstname.lastname@example.org> wrote:
>> This is another step towards moving GIMPLE_SWITCH expansion to an
>> earlier point in the pipeline.
>> With the attached patch, some of the logic from stmt.c:add_case_node()
>> is moved to gimplify.c:gimplify_switch_expr(). This includes:
>> * Code to drop case labels that are out of range for the switch index
>> expression. (Actually, I suspect this code hasn't worked properly
>> since gimplification was introduced, because the switch index
>> expression can be promoted by language specific gimplification, so
>> expand_case never actually sees the proper type with the current
>> implementation in stmt.c.)
>> * Code to fold_convert case label values to the right type. I've opted
>> to go for folding to the original type of the SWITCH_EXPR, rather than
>> to the post-gimplification switch index type.
>> * Code to canonicalize CASE_LABEL's subnodes, CASE_LOW and CASE_HIGH.
>> I've chosen to impose strict requirements that CASE_HIGH > CASE_LOW if
>> CASE_HIGH is non-zero. This is different from what add_case_node does,
>> but I think it makes sense to go for the minimal representation here:
>> The case labels in stmt.c never lived very long (only during expand)
>> but GIMPLE_SWITCH statements stay around for much of the compilation
>> process and can also be streamed out, etc.
>> Bootstrapped and tested on powerpc-unknown-linux-gnu. OK for trunk?
> And this time with the right subject and the right patch attached.
> Sorry for the inconvenience!