Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Using LLVM to compile U++
Using LLVM to compile U++ [message #21355] Thu, 14 May 2009 20:27 Go to next message
phirox is currently offline  phirox
Messages: 49
Registered: December 2007
Member
I was intrigued by the move of freebsd to switch from GNU GCC to LLVM. So I installed llvm 2.5 with the clang frontend(llvm-gcc and llvm-g++).

I added a new Build Method named LLVM(under Setup->Build methods). Then set all the flags exactly like with GCC and edit the field Compiler name and put in llvm-g++.

Everything compiled ok, except one little part. In Lang.cpp it gave a segfault. I fixed this error by adding a nonsense variable above the ONCELOCK { line: e.g. "bool llvm_fix;".

Ok the main advantages seem to be compiler speed, better error/warning descriptions, runtime optimilizations which lead to faster execution speeds. The compiler speed is noticeable, I would guess about 30% faster in my case. The messages do seem more verbose. But onto the fun stuff, I tested the speed using the Timing package in reference.

The results for the GCC Speed build(-pipe -O2 -ffunction-section -fomit-frame-pointers):
The restm.Elapsed() = 8242
TIMING Index::FindAdd : 721.85 ms - 721.85 ns ( 2.01 s  / 1000000 )
TIMING AsString       : 160.85 ms - 160.85 ns ( 1.45 s  / 1000000 )
TIMING rand           :  0.00 ns -  0.00 ns ( 1.16 s  / 1000000 )

The results for the LLVM Speed build(identical flags):
tm.Elapsed() = 8334
TIMING Index::FindAdd : 726.35 ms - 726.35 ns ( 2.12 s  / 1000000 )
TIMING AsString       : 112.35 ms - 112.35 ns ( 1.50 s  / 1000000 )
TIMING rand           :  0.00 ns -  0.00 ns ( 1.14 s  / 1000000 )


Interesting results as you can see, I will definitely keep using it for now. If not only to keep testing upp's compatibility.
Re: Using LLVM to compile U++ [message #21356 is a reply to message #21355] Thu, 14 May 2009 21:08 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Nice.
Re: Using LLVM to compile U++ [message #21440 is a reply to message #21356] Wed, 20 May 2009 13:15 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Very interesting. I've been keeping an eye out for LLVM and am waiting for clang to produce a stand alone non GCC based front-end, but it's good to see that the GCC front end is so mature.

I am going to try it out when I have some free time, but until then I have a question: what format are the intermediate files generated during compilation? Do you get LLVM bytecode which is converted to native during final link version, or is the LLVM bytecode phase not visible and after the compilation of a single translation unit you get a native object file? If object files are LLVM, maybe it would be possible to produce a platform independent compiled version of a library. This idea has IMO immense potential.

Also, I didn't know about the intentions of FreeBSD. Quite a bold move. I'll look it up on the Internet. It seems that even FreeBSD might have its uses Smile! (I am not trying to insult FreeBSD or it's fans here).

Thank you for trying this out.
Re: Using LLVM to compile U++ [message #21470 is a reply to message #21440] Thu, 21 May 2009 23:38 Go to previous message
phirox is currently offline  phirox
Messages: 49
Registered: December 2007
Member
With the gcc like frontend(llvm-gcc or llvm-g++), it automatically makes compatible/linkable object binaries like any other compiler. So basically there is no difference in input, arguments or ouput. To create llvm bytecode you have to compile with some extra flags, but you (currently) cannot make a cross-platform binary.

This is the link to the freebsd news about the move.
Previous Topic: C++ Server Pages (CSP)
Next Topic: #error Unknown CPU architecture?
Goto Forum:
  


Current Time: Wed Apr 17 00:48:18 CEST 2024

Total time taken to generate the page: 0.03411 seconds