pingu219@xxxxxxxxx wrote: > I'm a student whose currently trying to build a refactoring tool for C > and I thought it might be best to dump the intermediate representation > of the source code straight from the gcc compiler frontend. However > the tokens seem to be missing stuff like full postion information and > from what I've heard function bodies aren't dumped either except with > g++ and C++ though this might be outdated info. They all should be there. However, you don't have everything in the dumps; that's not really what the dumps are for. > The tree seems to have been optimised and had alot of folding by the > time gcc dumps it so I was wondering if there was a way of getting a > complete, pre-optimised tree from gcc maybe via a commandline argument > or if there's a suitable API. We call fold() a lot in the front end, partly in order to reduce the size of the tree, but also so things like case labels have integer values. > I also keep hearing about how gcc's > frontend is intermingled with the backend though I'm not sure what > exactly is meant by that. Not any more. We now have a clean split between the front-end, which generates trees, and the back-end. gcc used to parse a statement at a time and generate RTL immediately but it's been a long time since we did that. > It would be great to hear your thoughts on the utility of gcc for > source code analysis by an external tool. Andrew.