Matt and Pranav, That's right. I wanted to understand the CFG and optimization inside gcc. >From what I see I will have to get a grip on the GCC architecture before I can >start experimentation.
That would include basic blocks, CFG, and other loop optmization code in there. Thanks, Rohan ----- Original Message ---- From: Matthew <[EMAIL PROTECTED]> To: Rohan Sreeram <[EMAIL PROTECTED]> Sent: Wednesday, August 20, 2008 10:30:07 PM Subject: Re: How to use gcc source and try new optmization techniques I'm in a similar position, but some pointers. > 1) Understand the control flow graphs being generated by GCC, which I could > build using the -fdump-tree-cfg option. Look very closely at the basic blocks and the loop optimizers. basic-block.h, cfg*.[h|c] - in the basic blocks, the fields "succs" and "preds" will be of large importance to you. As near as I can tell the CFG is built as part of the basic blocks themselves. > 2) Write code that could convert CFG to a different graph. > 3) Use this new graph for optimization. > 4) Use the optimized graph to generate machine code (say Intel architecture > for now). So long as your transformation can be expressed in GCC's IR, then code gen should be taken care of by back ends. Of course, bad transform means bad code. > > Please let me know how I could leverage the GCC code for this purpose, and if > you any suggestions/comments for me you are most welcome ! :) > > Thanks, > Rohan The GCC internals documents will be important, however they are not perfect (especially if you choose to develop on the trunk). The GCC wiki in certain areas is far stronger than the internals document, however in others is far weaker. The GCC IRC channel on oftc.net is helpful for very specific questions, and is good to get a feel for the community. I'd be really interested in hearing your experience with GCC after you've worked in it for a while, seeing how it matches up with my own. -- Matt G.