Sunday, March 4, 2012

DragonEgg in Fedora 16

Hello visiting developers!

In this post I'll document how I compiled DragonEgg, an extension to GCC. The interest is that it implements sophisticated optimizers that could result in speed ups in some programs.

I won't go into the details of this optimizations as I don't understand them anyway :). What I can say is that it relies on LLVM to do sophisticated things on the generated code. In this regard it looks like CLang. However CLang is a full compiler, whereas DragonEgg is just an extension, and CLang doesn't (yet) support some features like OpenMP where DragonEgg supports it via GCC.

Install required packages:

> sudo yum install gcc-plugin-devel cmake

Create your working dir:

> cd
> mkdir -p Devel/llvm
> cd Devel/llvm 

Get the sources:

> svn co llvm-src

For DragonEgg:

> svn co dragonegg-src

Compile LLVM and DragonEgg
Configure and Build LLVM:

> mkdir llvm-build
> cd llvm-build
> ccmake ../llvm-src

Type "C" to start the configuration process. Once it is done you have the possibility to modify the configuration values. At this point you can leave the default values or mess around if you feel confident enough. When you're happy type "C" (once or twice) and "G" and :

> make

Building DragonEgg:

> cd ../dragonegg-src
> LLVM_CONFIG=~/Devel/llvm/llvm-build/bin/llvm-config GCC=/usr/bin/gcc make

That's it! You've now got the plugin for GCC. All you have to do now is add -03 fplugin=~/dev/llvm/dragonegg-src/ to CFLAGS or CXXFLAGS to automatically use dragonegg optimizers. You can have even more optimization by using both dragonegg's and gcc's (-fplugin-arg-dragonegg-enable-gcc-optzns but this is a bit unstable still.

No comments:

Post a Comment