[LLVMdev] gfortran

Chris Lattner sabre at nondot.org
Thu Aug 31 10:17:54 PDT 2006

On Wed, 30 Aug 2006, Michael McCracken wrote:
> Hi, in a thread this afternoon about compiling the Fortran SPEC2000 to
> LLVM bytecode, Chris mentioned that it should be possible to compile
> to LLVM with the gfortran front end, although no one has necessarily
> tried it.


> I was surprised (and happy) to hear this, as under the impression that 
> it would require a "complete rewrite of the gfortran backend" [1]. Now, 
> I probably misinterpreted that exchange, but it was the only public 
> record I could find of discussion about using LLVM and gfortran. What's 
> the difference between how it works now and what Steven Bosscher was 
> saying would be a huge job?

This comment meant that a "complete rewrite" was needed to go from 
GFortran AST's directly to LLVM, without going through GENERIC/GIMPLE.  If 
you use GENERIC/GIMPLE (as we currently do) it should be straight-forward.

> Also, is there any rough idea of how far from working it might be - I 
> note that there's considerable room for interpretation in the phrasing 
> of "See what works and what doesn't, debug, fix, submit patch, repeat." 
> :)

I don't know that anyone has tried it.  I'd suggest configuring llvm-gcc4 
with gfortran enabled, then try some simple fortran programs.  I expect 
that there are only minor corner cases missing, e.g. some forms of 
ARRAY_REF we don't implement or something.

> The reason I'm asking is that if it sounds like something I'll be able
> to make a dent in, I'm going to start on it first thing tomorrow
> morning. Like it's my job.

Very cool, that would certainly be welcome.



More information about the llvm-dev mailing list