[cfe-dev] Need for new FORTRAN front-end for LLVM ?

John McCall rjmccall at apple.com
Fri Aug 24 17:40:07 PDT 2012


On Aug 22, 2012, at 8:35 AM, Mahesha HS wrote:
> I believe that Clang is now in par with other well known industry standard compiler front-ends with compliant to standards, and also far better than other compiler front-ends in few aspects. On the other hand, many industry compiler vendors are started using LLVM internally in their compilers and tools chain for one or the other purpose. Also, many high performance server compiler vendors started looking into LLVM compiler due to various reasons. As all of us know, FORTRAN was and is the language of choice for developing high permanence (scientific) applications, for various known reasons. 
> 
> In this line, do you guys think, it is acceptable, if someone seriously start supporting new FORTRAN front-end for LLVM? I understand that Clang, being an umbrella for implementing C family of languages for LLVM, may not cover well, the non C family languages like FORTRAN.
> 
> However, I am curious know about the thoughts (positive or negative) of Clang community regarding this topic (need for new FORTRAN front-end for LLVM). If you guys agree that there is a need for it, what is the best way to go about implementing it?, I mean, do we need to completely separate it from Clang project? Or is it possible and is it good to leverage some of the Clang implementation here? In any case, in your experience, how much effort and time duration is required to come-up with a well defined and designed basic infrastructure implementation so that people who are interested can start contributing to it?

A high-quality LLVM-backed FORTRAN frontend would be great.  I do not think it'd be a good idea in the long run to implement it by translating FORTRAN into Clang's C ASTs, and there are probably relatively few things that you could re-use from Clang's source code.  I recommend using Clang primarily as a design model, rather than as a shortcut to a working implementation.

If you're seriously interested in this, there are ways that we could suggest to *improve* on Clang as an implementation model.  In particular, I would recommend introducing a third IR, so that the translation goes like so:
  source code -> AST -> high-level IR -> LLVM IR -> machine code
In high-performance scientific applications, it is going to be extremely valuable to be able to apply high-level optimizations to (e.g.) combine operations and eliminate unnecessary copies;  those can be straightforward to do in a high-level representation, but quite difficult to do after lowering to LLVM IR.

John.



More information about the cfe-dev mailing list