[Haskell-cafe] Re: Compiler backend question

Achim Schneider barsoap at web.de
Tue Jan 1 12:44:46 EST 2008

Peter Verswyvelen <bf3 at telenet.be> wrote:

> Another question regarding the backend: a cool feature of the
> Microsoft Visual C++ (MVC) compiler is its ability to perform "LTCG" 
> (link-time-code-generation), performing whole program optimization.
> It something like this possible with Haskell / (or the GCC backend?).
> Would it be possible to feed all the generated C code of the GHC
> compiler into the MVC compiler, to generate one big MVC / LTCG
> generated executable? It would be interesting to see how much the
> whole program optimization approach (which can do analysis on the
> program as if it was a single module) would improve performance...
jhc does that. Or rather, it doesn't compile Haskell modules separately
but throws them together (presumably) in the first pass.

Regarding C, it's actually only a high-level assembly language, with
compiler optimisations only optimising heavily if you use those
idioms... say inlining, loop-unrolling. If your compiler backend outputs
something that is already close to some generalisation of different
assembly languages, containing no superfluous code and compile-time
evaluable expressions and looking generally like a mess of mov's and
jmp's, nothing much more than optimisating register allocation and
pipeline usage optimisation can be done, which are both highly
processor-specific bastards, and likely to be hard to write better than
<insert favourite c-compiler>.

I figure it's being lazy in the right way(TM)

(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 

More information about the Haskell-Cafe mailing list