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? 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." :) 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. Thanks, -mike [1]:http://gcc.gnu.org/ml/gcc/2005-11/msg00929.html -- Michael McCracken UCSD CSE PhD Candidate research: http://www.cse.ucsd.edu/~mmccrack/ misc: http://michael-mccracken.net/wp/
On 31 Aug 2006, at 08:57, Michael McCracken wrote:> > 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.That would be great! That way I don't have to fiddle around with NAG f95 anymore, because even for research purposes, the license is quite expensive. Be sure to keep us posted on your progress. greetings, Kenneth -- Statistics are like a bikini. What they reveal is suggestive, but what they conceal is vital (Aaron Levenstein) Kenneth Hoste ELIS - Ghent University kenneth.hoste at elis.ugent.be http://www.elis.ugent.be/~kehoste
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.Yup.> 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. -Chris -- http://nondot.org/sabre/ http://llvm.org/
On 8/31/06, Chris Lattner <sabre at nondot.org> wrote:> 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. > > Yup. > > > 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.OK, I see.> > 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.OK, I've started by pulling the latest LLVM CVS and gcc4 SVN. It looks like building f95 requires GMP, so I'm working on that too. I'll update again once I get it building. Thanks, -mike -- Michael McCracken UCSD CSE PhD Candidate research: http://www.cse.ucsd.edu/~mmccrack/ misc: http://michael-mccracken.net/wp/