Re: LLVM as a gcc plugin?

2009-06-08 Thread Steven Bosscher
On Mon, Jun 8, 2009 at 3:10 AM, Rafael Espindolaespind...@google.com wrote:
 GMP and MPFR are required components of GCC, and every developer has to
 deal with them.  For interfacing between GCC and LLVM, the experts who'll
 be able to answer the questions are generally going to be found on the
 LLVM lists, not the gcc list, and those (like you) who participate on
 both lists, well, you're on both lists.

 That is not the case here. There is already a version of gcc that uses
 llvm.

I'd turn that around: There is already a version of LLVM that uses
GCC.  I don't see any way in which the FSF GCC benefits from this. And
since this list concerns the FSF GCC...

Ciao!
Steven


Re: LLVM as a gcc plugin?

2009-06-08 Thread Rafael Espindola
 I'd turn that around: There is already a version of LLVM that uses
 GCC.  I don't see any way in which the FSF GCC benefits from this. And
 since this list concerns the FSF GCC...

That is not a valid turn around. We know that the existing LLVM can handle
this. We are not sure if the existing plugin infrastructure can.

That also goes to the more general question should plugin development be
discussed on this list?. One of the main uses of plugins will probably be
adding features that are not of interest to GCC in general.

 Ciao!
 Steven



Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047


Re: LLVM as a gcc plugin?

2009-06-07 Thread Rafael Espindola
 GMP and MPFR are required components of GCC, and every developer has to
 deal with them.  For interfacing between GCC and LLVM, the experts who'll
 be able to answer the questions are generally going to be found on the
 LLVM lists, not the gcc list, and those (like you) who participate on
 both lists, well, you're on both lists.

That is not the case here. There is already a version of gcc that uses
llvm.  What
we are trying to find is if the GCC plugin infrastructure is generic
enough to support similar
use cases. In a previous mail I raised some issues in GCC that illustrate this.

 So as a practical matter, it seems that LLVM lists are more suitable.
 If it's ever decided that LLVM becomes a required piece of GCC, like
 GMP and MPFR, that would change.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047


Re: LLVM as a gcc plugin?

2009-06-05 Thread Grigori Fursin
Hi guys,

Just saw this discussion so wanted to mention that we at HiPEAC are now 
interested
to use both GCC as static compiler and LLVM as run-time infrastructure for 
research
and several colleagues wanted to port ICI framework (the recent release is based
on the official gcc plugin branch) to LLVM. We want to have both official
gcc plugins and ICI addition on top of it since we have a relatively large 
community
already around those tools and ICI plugins, and additional tools for automatic 
program 
optimization.

I will unlikely be involved in that now because I just don't have time so I CCed
this email to Andy Nisbet who has been interested to provide plugin system for 
LLVM,
Zbigniew Chamski who supports ICI for GCC and also Albert Cohen and Ayal Zaks 
who are also coordinating those activities within HiPEAC. 

The idea is to make GCC and LLVM more attractive to the researchers (i.e. that 
it's
easy to use compilers without knowing internals much) so that research ideas 
could
go back to the compilers much faster improving GCC and LLVM ...

Cheers,
Grigori


 On Jun 3, 2009, at 11:30 PM, Uros Bizjak wrote:

Hello!

Some time ago, there was a discussion about integrating LLVM and GCC
[1]. However, with plugin infrastructure in place, could LLVM be
plugged into GCC as an additional optimization plugin?


[1] http://gcc.gnu.org/ml/gcc/2005-11/msg00888.html 


 Hi Uros,

 I'd love to see this, but I can't contribute to it directly. I think the 
 plugin interfaces would
need small 
 extensions, but there are no specific technical issues preventing it from 
 happening. LLVM has
certainly progressed a 
 lot since that (really old) email went out :)

 -Chris



Re: LLVM as a gcc plugin?

2009-06-05 Thread Andrew Nisbet
Hello,
I am interested in developing LLVM functionality to support the interfaces in 
GCC ICI. I
plan to spend some time to investigate feasibility in a couple of weeks time 
once all exam
boards are finished. My initial goal would be to enable LLVM to be used for 
iterative
compilation using the HiPEAC ICI framework, either as a drop in replacement for 
GCC, or as
a plugin. I'd welcome focussed discussion and collaboration with this goal in 
mind. 
 
 My previous work in LLVM was in trying to develop a backend for a  soft-core 
processor
written in HandelC.  I am also interested in developing/extending teaching 
resources to
support compiler based undergraduate/postgraduate courses and projects. One of 
my long
term research goals is to investigate (implement) iterative feedback directed 
compilation
and design space exploration tools/techniques for hybrid multicore processor 
architectures
comprised of hard and reconfigurable logic. 

Thanks,

   Andy

 Dr. Andy Nisbet: URL http://www.docm.mmu.ac.uk/STAFF/A.Nisbet
Department of Computing and Mathematics, John Dalton Building, Manchester
  Metropolitan University, Chester Street, Manchester M1 5GD, UK.
Email: a.nis...@mmu.ac.uk, Phone:(+44)-161-247-1556; Fax:(+44)-161-247-6840.


Before acting on this email or opening any attachments you
should read the Manchester Metropolitan University's email
disclaimer available on its website
http://www.mmu.ac.uk/emaildisclaimer 



  Dr. Andy Nisbet: URL http://www.docm.mmu.ac.uk/STAFF/A.Nisbet
Department of Computing and Mathematics, John Dalton Building, Manchester
   Metropolitan University, Chester Street, Manchester M1 5GD, UK.
Email: a.nis...@mmu.ac.uk, Phone:(+44)-161-247-1556; Fax:(+44)-161-247-6840. 


Before acting on this email or opening any attachments you
should read the Manchester Metropolitan University's email
disclaimer available on its website
http://www.mmu.ac.uk/emaildisclaimer 



Re: LLVM as a gcc plugin?

2009-06-05 Thread Steven Bosscher
On Fri, Jun 5, 2009 at 12:40 PM, Andrew  Nisbeta.nis...@mmu.ac.uk wrote:
 Hello,
 I am interested in developing LLVM functionality to support the interfaces in 
 GCC ICI.

*sigh*

GCC != LLVM.  And this is a GCC list. Can LLVM topics please be
discussed on an LLVM mailing list?

Ciao!
Steven


Re: LLVM as a gcc plugin?

2009-06-05 Thread Chris Lattner


On Jun 5, 2009, at 3:43 AM, Steven Bosscher wrote:

On Fri, Jun 5, 2009 at 12:40 PM, Andrew  Nisbeta.nis...@mmu.ac.uk  
wrote:

Hello,
I am interested in developing LLVM functionality to support the  
interfaces in GCC ICI.


*sigh*

GCC != LLVM.  And this is a GCC list. Can LLVM topics please be
discussed on an LLVM mailing list?


How is LLVM any different than another external imported library (like  
GMP or MPFR) in this context?


-Chris


Re: LLVM as a gcc plugin?

2009-06-05 Thread Joe Buck


On Fri, Jun 5, 2009 at 12:40 PM, Andrew  Nisbeta.nis...@mmu.ac.uk wrote:
  Hello,
  I am interested in developing LLVM functionality to support the
  interfaces in GCC ICI.

On Jun 5, 2009, at 3:43 AM, Steven Bosscher wrote:
  GCC != LLVM.  And this is a GCC list. Can LLVM topics please be
  discussed on an LLVM mailing list?

On Fri, Jun 05, 2009 at 09:48:52AM -0700, Chris Lattner wrote:
 How is LLVM any different than another external imported library (like
 GMP or MPFR) in this context?

GMP and MPFR are required components of GCC, and every developer has to
deal with them.  For interfacing between GCC and LLVM, the experts who'll
be able to answer the questions are generally going to be found on the
LLVM lists, not the gcc list, and those (like you) who participate on
both lists, well, you're on both lists.

So as a practical matter, it seems that LLVM lists are more suitable.
If it's ever decided that LLVM becomes a required piece of GCC, like
GMP and MPFR, that would change.


Re: LLVM as a gcc plugin?

2009-06-04 Thread Chris Lattner


On Jun 3, 2009, at 11:30 PM, Uros Bizjak wrote:


Hello!

Some time ago, there was a discussion about integrating LLVM and GCC
[1]. However, with plugin infrastructure in place, could LLVM be
plugged into GCC as an additional optimization plugin?

[1] http://gcc.gnu.org/ml/gcc/2005-11/msg00888.html


Hi Uros,

I'd love to see this, but I can't contribute to it directly.  I think  
the plugin interfaces would need small extensions, but there are no  
specific technical issues preventing it from happening.  LLVM has  
certainly progressed a lot since that (really old) email went out :)


-Chris


Re: LLVM as a gcc plugin?

2009-06-04 Thread Miles Bader
Chris Lattner clatt...@apple.com writes:
 Some time ago, there was a discussion about integrating LLVM and GCC
 [1]. However, with plugin infrastructure in place, could LLVM be
 plugged into GCC as an additional optimization plugin?

 I'd love to see this, but I can't contribute to it directly.  I think
 the plugin interfaces would need small extensions, but there are no
 specific technical issues preventing it from happening.  LLVM has
 certainly progressed a lot since that (really old) email went out :)

Is there a description somewhere of areas where llvm is thought to do
well compared to gcc, and maybe future plans for improvement?

In the (limited) tests I've done, gcc [4.4, but 4.2 yields similar
results] seems to do a lot better than llvm [2.5], but those were C++
code and I wonder if llvm is currently concentrating on C?

-Miles

-- 
Quotation, n. The act of repeating erroneously the words of another. The words
erroneously repeated.



Re: LLVM as a gcc plugin?

2009-06-04 Thread Duncan Sands

Hi,


Some time ago, there was a discussion about integrating LLVM and GCC
[1]. However, with plugin infrastructure in place, could LLVM be
plugged into GCC as an additional optimization plugin?


I plan to start working on an llvm plugin any day now.

Ciao,

Duncan.


Re: LLVM as a gcc plugin?

2009-06-04 Thread Rafael Espindola
 I'd love to see this, but I can't contribute to it directly.  I think the
 plugin interfaces would need small extensions, but there are no specific
 technical issues preventing it from happening.  LLVM has certainly
 progressed a lot since that (really old) email went out :)

I can help a bit.

There was some talk about it on #gcc. A plugin should be able to see
all the GCC IL, so it should be able to convert it to LLVM. Keeping
the current llvm-gcc interface would require some hacks

*) The plugin will have to call exit to keep gcc's code generation from running.
*) It will have to remove and recreate the .s file that is being
output. Not sure if this will work.
*) Gcc always produces .o files by calling the assembler, so -c
-emit-llvm will not work.
*) The plugis options will be of the form -fplugin-arg-llvm-emit-llvm

One way to avoid these problems is to make llvm-gcc a gcc wrapper that
runs gcc with the llvm plugin, converts command line options and in
the case of -c -emit-llvm calls llvm-as.

Another source of problem will be the early transformations that gcc
does and that are normally disabled in llvm-gcc. The one that I
remember right now is c++ thunk generation.

 -Chris


Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047


Re: LLVM as a gcc plugin?

2009-06-04 Thread Steven Bosscher
On Thu, Jun 4, 2009 at 12:14 PM, Rafael Espindola espind...@google.com wrote:
 I'd love to see this, but I can't contribute to it directly.  I think the
 plugin interfaces would need small extensions, but there are no specific
 technical issues preventing it from happening.  LLVM has certainly
 progressed a lot since that (really old) email went out :)

 I can help a bit.

Excuse me if this is a stupid question, but eh -- why would you want
to make an LLVM plugin?  Aren't LLVM and GCC doing just fine as
competing compilers?

Ciao!
Steven


Re: LLVM as a gcc plugin?

2009-06-04 Thread Rafael Espindola
 Excuse me if this is a stupid question, but eh -- why would you want
 to make an LLVM plugin?  Aren't LLVM and GCC doing just fine as
 competing compilers?

LLVM is a toolkit. There is a patched version of GCC that uses LLVM
(llvm-gcc). This is particularly important for fortran and ada since
clang supports only c like languages.

The hope is that a plugin will be easier to maintain than llvm-gcc.

 Ciao!
 Steven


Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047


Re: LLVM as a gcc plugin?

2009-06-04 Thread Chris Lattner


On Jun 3, 2009, at 11:59 PM, Miles Bader wrote:


Chris Lattner clatt...@apple.com writes:

Some time ago, there was a discussion about integrating LLVM and GCC
[1]. However, with plugin infrastructure in place, could LLVM be
plugged into GCC as an additional optimization plugin?


I'd love to see this, but I can't contribute to it directly.  I think
the plugin interfaces would need small extensions, but there are no
specific technical issues preventing it from happening.  LLVM has
certainly progressed a lot since that (really old) email went out :)


Is there a description somewhere of areas where llvm is thought to do
well compared to gcc, and maybe future plans for improvement?

In the (limited) tests I've done, gcc [4.4, but 4.2 yields similar
results] seems to do a lot better than llvm [2.5], but those were C++
code and I wonder if llvm is currently concentrating on C?


LLVM has many capabilities and advantages that GCC doesn't (and is  
also missing some features and capabilities that GCC has), but it is  
also common to misconfigure it so that it isn't optimizing like it  
should.  It is pretty off topic for this list though, please ask on  
the llvmdev mailing list for more information.  Please send  
information about how you built llvm and what your machine  
configuration is,


Thanks,

-Chris


Re: LLVM as a gcc plugin?

2009-06-04 Thread Chris Lattner


On Jun 4, 2009, at 3:20 AM, Steven Bosscher wrote:

On Thu, Jun 4, 2009 at 12:14 PM, Rafael Espindola espind...@google.com 
 wrote:
I'd love to see this, but I can't contribute to it directly.  I  
think the
plugin interfaces would need small extensions, but there are no  
specific

technical issues preventing it from happening.  LLVM has certainly
progressed a lot since that (really old) email went out :)


I can help a bit.



Aren't LLVM and GCC doing just fine as
competing compilers?


I'm not sure what you mean, LLVM and GCC are two completely different  
things.  LLVM is an infrastructure for building compilers, GCC is an  
instance of a compiler.  Combining LLVM with GCC gives LLVM-GCC  
(another instance of a compiler), which adds new capabilities to GCC  
that many users find useful.  These include things such as cross- 
language LTO support (for C, c++, fortran, etc), JIT compilation,  
better performance in some scenarios, etc.



Excuse me if this is a stupid question, but eh -- why would you want
to make an LLVM plugin?


There are multiple answers to this question.  The most obvious one is  
that the current version of llvm-gcc is stuck on GCC 4.2, and 4.2  
lacks a number of improvements the fortran and ada front-ends and  
runtimes.  It would be straight-forward to forward port the patches to  
gcc mainline, but presumably implementing llvm-gcc in terms of plugins  
would result in something that has easier maintenance (this remains to  
be seen of course).


-Chris




Re: LLVM as a gcc plugin?

2009-06-04 Thread Duncan Sands

Hi Rafael,


There was some talk about it on #gcc. A plugin should be able to see
all the GCC IL, so it should be able to convert it to LLVM. Keeping
the current llvm-gcc interface would require some hacks

*) The plugin will have to call exit to keep gcc's code generation from running.


this would work when doing unit-at-a-time, but not when doing
function-at-a-time.  Does gcc still do function-at-a-time?


Another source of problem will be the early transformations that gcc
does and that are normally disabled in llvm-gcc. The one that I
remember right now is c++ thunk generation.


Good point.

Ciao,

Duncan.


Re: LLVM as a gcc plugin?

2009-06-04 Thread Ian Lance Taylor
Duncan Sands baldr...@free.fr writes:

 this would work when doing unit-at-a-time, but not when doing
 function-at-a-time.  Does gcc still do function-at-a-time?

No.

Ian