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: [cxx-conversion] RFC - Helper types for building GIMPLE


Xinliang David Li <davidxl@google.com> wrote:

>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.

That won't work with the magic in the builder to create ssa names for the results. Then people need to think about cfg merges and phi nodes. So much for labels and gotos...

I'd rather have people know about the context they are working in. Otherwise they cannot exploit its property either.

Richard.
>David
>
>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.



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