Fortran and LLVM

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Fortran and LLVM

Warren Armstrong
Hi all,

I'm looking into using LLVM to do some optimisations of
Fortran code.  As part of this, I've been trying to build
the frontend with f95 support.  At the moment, I'm trying
to resolve undefined symbol problems for code defined in
c-common.c + elsewhere - I'm taking the temporary approach
of copy-pasting it into a new file, and linking that in.  I have no
idea if it will work, but you can't just link c-common.o in, because then
you get multiple definitions of some symbols.

However, judging from past threads on here, it seems that getting
gfortran support will require a lot of work.  I've also seen
people who use LLVM and Fortran to compile the SPEC FP benchmarks -
the NAG compiler has been mentioned in this context.  I have two
questions here:

1. I know someone previously tried to get gfortran working - did their
changes make it into the SVN mainline?

2. How do you go about hooking LLVM into the NAG compiler?  Does
it emit an IR that LLVM recognises?

Cheers,
Warren





_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fortran and LLVM

Devang Patel

On Nov 8, 2006, at 3:47 PM, Warren Armstrong wrote:

2. How do you go about hooking LLVM into the NAG compiler?  Does

it emit an IR that LLVM recognises?


NAG compiler does not emit LLVM IR. However you can take longer 
route. NAG compiler emits 'c' code that you can feed into llvm-gcc. 
I have not tried this myself :)

-
Devang

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fortran and LLVM

Michael McCracken
In reply to this post by Warren Armstrong
On 11/8/06, Warren Armstrong <[hidden email]> wrote:

> Hi all,
>
> I'm looking into using LLVM to do some optimisations of
> Fortran code.  As part of this, I've been trying to build
> the frontend with f95 support.  At the moment, I'm trying
> to resolve undefined symbol problems for code defined in
> c-common.c + elsewhere - I'm taking the temporary approach
> of copy-pasting it into a new file, and linking that in.  I have no
> idea if it will work, but you can't just link c-common.o in, because then
> you get multiple definitions of some symbols.
>
> However, judging from past threads on here, it seems that getting
> gfortran support will require a lot of work.  I've also seen
> people who use LLVM and Fortran to compile the SPEC FP benchmarks -
> the NAG compiler has been mentioned in this context.  I have two
> questions here:
>
> 1. I know someone previously tried to get gfortran working - did their
> changes make it into the SVN mainline?

Hi Warren, I think here you're referring to me. Some of my changes did
make it into the mainline, to the extent that you can produce an f95
binary that will compile correct LLVM code for some very small set of
toy fortran programs, but it chokes on real code.

The reason I stopped working on it is that the version of gfortran
that is on the LLVM branch is buggy and the latest version is rather
different, and the effort required to reconcile the changes in either
direction was too much to consider seriously.

I'd still like to get gfortran+LLVM working, but at least for my part,
I'm waiting until the LLVM-gcc4 tree is updated to a more current gcc,
with a more stable gfortran to start from.

-mike

> 2. How do you go about hooking LLVM into the NAG compiler?  Does
> it emit an IR that LLVM recognises?

--
Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/wp/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fortran and LLVM

Warren Armstrong
Michael McCracken wrote:

> On 11/8/06, Warren Armstrong <[hidden email]> wrote:
>  
>> Hi all,
>>
>> I'm looking into using LLVM to do some optimisations of
>> Fortran code.  As part of this, I've been trying to build
>> the frontend with f95 support.  At the moment, I'm trying
>> to resolve undefined symbol problems for code defined in
>> c-common.c + elsewhere - I'm taking the temporary approach
>> of copy-pasting it into a new file, and linking that in.  I have no
>> idea if it will work, but you can't just link c-common.o in, because then
>> you get multiple definitions of some symbols.
>>
>> However, judging from past threads on here, it seems that getting
>> gfortran support will require a lot of work.  I've also seen
>> people who use LLVM and Fortran to compile the SPEC FP benchmarks -
>> the NAG compiler has been mentioned in this context.  I have two
>> questions here:
>>
>> 1. I know someone previously tried to get gfortran working - did their
>> changes make it into the SVN mainline?
>>    
>
> Hi Warren, I think here you're referring to me. Some of my changes did
> make it into the mainline, to the extent that you can produce an f95
> binary that will compile correct LLVM code for some very small set of
> toy fortran programs, but it chokes on real code.
>
> The reason I stopped working on it is that the version of gfortran
> that is on the LLVM branch is buggy and the latest version is rather
> different, and the effort required to reconcile the changes in either
> direction was too much to consider seriously.
>
> I'd still like to get gfortran+LLVM working, but at least for my part,
> I'm waiting until the LLVM-gcc4 tree is updated to a more current gcc,
> with a more stable gfortran to start from.
>
> -mike
>  

Ah, I see.  I'll do the same, then.

Thanks to you and Devang for the replies.

Cheers,
Warren


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fortran and LLVM

Chris Lattner
In reply to this post by Warren Armstrong
On Thu, 9 Nov 2006, Warren Armstrong wrote:
> 2. How do you go about hooking LLVM into the NAG compiler?  Does
> it emit an IR that LLVM recognises?

FWIW, we use NAG on Darwin/PPC with the fortran programs in SPECCPU2000
and it works fine.  It outputs C code which we feed into llvm-gcc.

-Chris

--
http://nondot.org/sabre/
http://llvm.org/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev