[cxx-conversion] RFC - Helper types for building GIMPLE

Xinliang David Li davidxl@google.com
Thu Mar 14 16:17:00 GMT 2013

I am with you for simple cases where straightline code is generated.

Helper class will be very useful when control flow manipulation is
involved.  People can simply just write 'straight line like code'
using gimple_label, goto_label etc without worrying about how split
blocks and create new cfg edges. The 'end/finalize' method of the
builder helper will do the magic.


On Thu, Mar 14, 2013 at 4:25 AM, Michael Matz <matz@suse.de> wrote:
> Hi,
> On Wed, 13 Mar 2013, Diego Novillo wrote:
>> To use the builder:
>> 1- Declare an instance 'gb' of gimple_builder_normal or
>>    gimple_builder_ssa.  E.g., gimple_builder_ssa gb;
>> 2- Use gb.add_* to add a new statement to it.  This
>>    returns an SSA name or VAR_DECL with the value of the added
>>    statement.
>> 3- Call gb.insert_*() to insert the sequence of statements in the
>>    builder into a statement iterator.
> I'm reiterating everything I said in
>   http://gcc.gnu.org/ml/gcc/2012-11/msg00230.html
> Actually your interface now is worse than what Lawrence proposed back in
> November in that the add_* methods return a tree, instead of a gimple
> statement.
> I haven't seen any convincing reason why the builder class is necessary,
> instead of improving the current interface.  IOW I don't like it much.
> Ciao,
> Michael.

More information about the Gcc-patches mailing list