On Thu, Apr 08, 2010 at 09:38:35AM -0600, ThanhVu (Vu) Nguyen wrote: > Gabriel, Thanks for the quick response . Is there any benefits or side > effects if I use inplace modification like in your example ?
Yes. Imagine you have the following code: l: if(foo) { bar; } goto l; My code would produce: l: fprintf("hello"); if(foo) { bar ; } goto l; Elnatan's solution would result in something broken (because internally, CIL would point the goto to the "if" statement, but when trying to print it out, it would find that the "if" statement does not have any label). It depends on the semantics you expect, but my rule of thumb is: 1) NEVER use ChangeTo (or its ChangeDoChildrenPost counterpart) in vstmt (unless you return the same statement of course). 2) If you really feel the need to use it, think twice and goto rule 1. [ And if you really see no other solution, be aware that you will have to update every potential Goto in your program. By the way, some of you might remember performance issues I had a year ago. I tracked down the issue recently: I spent most of my time looking for broken Gotos and fixing them. Maintaining a table of labels -> goto improved speed amazingly but you are safer if you just do not have to do it. ] Regards, -- Gabriel Kerneis ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ CIL-users mailing list CIL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cil-users