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: RFC: Gimple combine/folding interface


Andrew Pinski <pinskia@gmail.com> wrote:

>On Fri, Jul 19, 2013 at 5:09 PM, Andrew Pinski <pinskia@gmail.com>
>wrote:
>> I was creating a new gimple/folding interface and wanted some
>opinions
>> on the interface.
>>
>> typedef double_int (*nonzerobits_t)(tree var);
>> typedef tree (*valueizer_t)(tree var);
>>
>> class gimple_combine
>> {
>> public:
>>   gimple_combine(nonzerobits_t a, valueizer_t b) : nonzerobitsf(a),
>> valueizerv(b), allow_full_reassiocation(false) {}
>>   gimple_combine() : nonzerobitsf(NULL), valueizerv(NULL),
>> allow_full_reassiocation(false) {}
>>   gimple_combine(bool reas) : nonzerobitsf(NULL), valueizerv(NULL),
>> allow_full_reassiocation(reas) {}
>>   tree build2 (location_t, enum tree_code, tree, tree, tree);
>>   tree build1 (location_t, enum tree_code, tree, tree);
>>   tree build3 (location_t, enum tree_code, tree, tree, tree, tree);
>>   tree combine (gimple);
>> private:
>>   nonzerobits_t nonzerobitsf;
>>   valueizer_t valueizerv;
>>   bool allow_full_reassiocation;
>>   tree binary (location_t, enum tree_code, tree, tree, tree);
>>   tree unary (location_t, enum tree_code, tree, tree);
>>   tree ternary (location_t, enum tree_code, tree, tree, tree, tree);
>> };

Just a few comments before I return to work late in August.  I like the way of using a c++ object to store combiner flags as opposed to extra arguments. For the optimizers I want to retain the ability to specify the desired result (constant, single op, arbitrary) which also allows shortcutting some transforms.
I also want to retain the ability to return the combining result piecewise without building trees, at least for results that fit a single gimple stmt.

>> bool replace_rhs_after_ssa_combine (gimple_stmt_iterator *, tree);

... Precisely to avoid this.

I'm not sure if you want to replace the fold-const.c workers with this infrastructure?

Richard.

>> This is what I have so far and wonder if there is anything else I
>> should include.
>>
>> This will be used to replace the folding code in fold-const.c and
>gimple-fold.c.
>
>I placed what I decided in a branch in git:
>
>http://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gimple-ssa-combine.h;h=3d597291c1756cdf6e3318fd190ac70911ceb702;hb=d32468a31ab5e50fabab3a04303f6892ad890fd5
>
>Note I won't have time to work on this again until the middle of August
>or so.
>
>The status of the current patch is that it is able to build libgcc but
>there are some addition ICEs due to checking to make sure all of the
>forwprop optimizations are pushed over to gimple_combine (since I
>started this work on an older code base).
>
>Thanks,
>Andrew Pinski
>
>>
>> Thanks,
>> Andrew Pinski



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