Thank you, I appreciate your response. It seems an interesting alternative, but still I can't figure out how to do it. I want to forge some statements in the middle of the code, in some specific points, for instance. That is something I know how to do already, during parsing time. The thing is, I want to do it two different times, each one with some specific instructions, to get two different binaries. All that without having to add code to the source file.
I'll give you a simple example. Input source code: int foo (void) { int x = 10; return x; } Binary one: int foo (void) { int x = 10; x = 20; // I added this statement to the tree during parsing time return x; } Binary two: int foo (void) { int x = 10; x = 30; // I added this statement to the tree during parsing time return x; } So, are the Target Specific Optimizations the way to do it? Regards, --- Rodolfo Guilherme Wottrich Universidade Estadual de Campinas - Unicamp 2013/9/1 David Edelsohn <dje....@gmail.com>: > On Sat, Aug 31, 2013 at 11:57 PM, Rodolfo Guilherme Wottrich > <rgw...@gmail.com> wrote: >> Hello everyone, >> >> I would like to be able to generate multiple binaries from a single >> source file, each of which being slightly different from the other(s). >> For example, in case there's an OpenMP parallel region in the code, I >> want to generate two binaries: one of them being the normal one and >> the other one ignoring the parallel region, just like if the -fopenmp >> flag hadn't been used. >> This isn't exactly a good example, because I could just write a script >> to compile the source file twice, with and without the flag. But the >> manipulation I want to do with the code is something else. >> >> How do you guys suggest me to do it? It occurs to me that I may simply >> implement a new flag to perform a different behavior and compile the >> code twice, but looking at the code, I found it somehow difficult to >> do. Also, there may be some more clever way to do it. >> >> However, if you guys think that the flag thing is the best way to do >> it, please let me know and help me, telling how to implement that new >> flag (I can't figure out how to). > > This sounds a little like Target specific function optimizations. > > http://gcc.gnu.org/wiki/FunctionSpecificOpt > > - David