[Haskell-cafe] Compiler backend question

Peter Verswyvelen bf3 at telenet.be
Tue Jan 1 15:18:21 EST 2008

Neil Mitchell wrote:
> GCC is optimised for dealing with code that comes from C, and the back
> end language is much like C. GCC is also not really set up to be used
> by bolting different front ends on to different back ends - part of
> this is a license issue - if the front and back ends were well split
> and available separately you could write a commerical backend onto a
> GPL front end.

Well, I don't know about the licensing, but according to
http://en.wikipedia.org/wiki/GNU_Compiler_Collection#Front_ends, a new
cleaner intermediate language was created in 2005 for GCC, which might be
more "general"?

> You would get much better improvements on whole program at the Haskell
> level. By the time you get to the generated C you have obfustcated all
> the structure of the program, and are unlikely to benefit that much.

Yes that would be great! Or even at JIT time ;-) But, given the time GHC
takes to optimize a single module, I guess it would not really be practical
to let those optimization take place on the full program? It would take ages

I just wanted to see if it is *possible* to feed just all the C code from
GHC into a C compiler, and then generate a single executable from that C
code (including the GHC runtime). For example, for the XBOX DEVKIT,
Microsoft shipped LTCG versions for all the core libraries, which gave a
nice performance improvement for free (if I'm not mistaking, this gives 10%
to 15% faster code). Actually this LTCG thingy was first supported by the
Intel compiler I believe.


More information about the Haskell-Cafe mailing list