On Thu, Mar 14, 2013 at 10:54 AM, Richard Biener <rguent...@suse.de> wrote: > Xinliang David Li <davi...@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.
I am not sure what you mean. The builder helper class should contain all the context information which should be accessible if user wants to take a peek. The low level information is usually needed for analysis, but not needs to be exposed for transformation. David > > Richard. >>David >> >>On Thu, Mar 14, 2013 at 4:25 AM, Michael Matz <m...@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. > >