Shobaki, Ghassan wrote:
In some optimization passes it may be useful to know the programming language that we are compiling. Is there a way to get that information in the middle end and back end?
I am not sure that would be a good idea. In fact you are suggesting that the intermediate representation[s] (ie Gimple) is not intermediate enough, since you need something more (like the source language).
And there might be some scenarii where making a programming language dependent optimization is wrong. Consider for example compiling with your GCC the output of the old f2c (fortran to C) translator. Would you consider that being C or Fortran?
I would believe you should at least explain what exactly are the language dependent optimizations you are thinking of (is it for matrix code in Fortran vs C?).
Still, I tend to believe that if you really need some language specific information, that would be better settled in the long term thru an evolution or enhancement of the middle end representations...
Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} ***