[LLVMdev] libFirm library

Chris Lattner clattner at apple.com
Mon Dec 1 17:28:20 PST 2008


On Dec 1, 2008, at 3:26 PM, Roman Levenstein wrote:

> Hi,
>
> The libFirm library ( http://www.info.uni-karlsruhe.de/software/libfirm/index.php?title=Main_Page 
>  ) is GPLed some time ago.
> libFirm is a library that provides an intermediate representation  
> and optimizations for compilers.
> Programs are represented in a graph based SSA form. Several targets  
> are supported, especially the x86.

Thanks for pointing this out, I didn't know they released it.  FIRM is  
good stuff, with many interesting ideas.

> Many optimizations are very similar to those of LLVM. But there are  
> also some differences.
> This is what I could find out by quickly looking at the source code:
> - It seems to have a different register allocator that works  
> directly on the SSA form and performs chordal graph register  
> allocation.
>  This is implemented by Sebastian Hack who is one of the pioneers  
> working on the register allocation by means of chordal graph coloring.
>
> - libFirm seems to have more advanced spilling and coalescing  
> heuristics
>
> - libFirm contains the implementation of the very fast liveness  
> analysis based on the dominance information.
>  There was a discussion on this mailing list about including this  
> algorithm into LLVM recently, if I remember correctly.

Yep.  Unfortunately FIRM as a whole (in particular it's regalloc  
approach etc) is very very slow.

> There is a discussion about libFirm on the FreeBSD mailing lists:
> http://groups.google.co.kr/group/mailing.freebsd.hackers/browse_thread/thread/9dd9b232a5ab6a52
>
> Apparently, people have asked how it compares to LLVM, both  
> architecturally and performance-wise.

The thread is short but interesting.  I wasn't aware of cparser, I'll  
go find out more.

>
> And there are some replies from the libFirm developers in the thread  
> mentioned above.
> BTW, on the project page there are some SPEC2000 performance  
> comparisons with GCC, LLVM-GCC and Intel  Compilers.


I don't see any comparison of llvm vs firm performance in the thread,  
and the last comparison they have on their web page is llvm 2.1 which  
is very old by now.

> It would be interesting to hear an opinion regarding those issues  
> from the LLVM developers as well, I guess.
> Anyone willing to comment?
>
> In any case, this library contains a lot of interesting and related  
> things and worse looking at it and investigating a bit deeper what  
> it is and what it provides.
> May be some ideas could be interesting and beneficial for LLVM.

FIRM has some interesting ideas from their paper, but typically you  
can't just copy code out of one compiler and have it work in  
another. :)  Besides that, the code is under an incompatible license,  
so we couldn't do it even if it were possible.  That said, I'm  
thrilled that they released their code so we can take a look!

-Chris




More information about the llvm-dev mailing list