On Sun, 18 Nov 2007, Robert Dewar wrote: | Let's take an example, suppose we want to write a semantic analysis | tool (e.g. the Mozilla style checker mentioned earlier). For Ada, | we can write an ASIS application and we need to know NOTHING AT ALL | about the internals of the compiler we are using, we only read the | ASIS documentation. Indeed we could start writing that tool before | we decided which Ada commpiler we would use. | | I know of nothing vaguely equivalent to this in the general gcc | context, am I really missing something that big?
I have been able to build similar tool for at least two radically different C++ front ends -- one being proprietary, the other one being GCC (the most painful to work with). We call the representation `IPR' (for Internal Program Representation). The interface is completely compiler neutral. I haven't tested it myself on another important proprietary compiler but from feedback people we talked with, we should not worry. Yes, that is not an ISO-approved thing, but just a data point something `vaguely equivalent to this in the general g++' context has been done. We have not released IPR yet, but it be open source a fairly open license. | On the other hand, if your mission is to plug in an extra optimization | pass, ASIS won't help since it is strictly a read-only interface with | no provision for feeding back information to the compiler. IPR doesn't attempt to replace compiler internal data structures for writing optimizations. Nor it is a plugin into GIMPLE or RTL -- as I said, it is designed to be compiler neutral. -- Gaby