inside the GHC code generator

Bulat Ziganshin bulat.ziganshin at
Thu Feb 23 13:07:45 EST 2006

Hello Claus,

Thursday, February 23, 2006, 8:56:57 PM, you wrote:

>> the long answer is: are you ever heard promises that gcc is best
>> cpu-independent assembler? no? and you know why? because gcc is not
>> cpu-independent assembler. gcc was strongly optimized to make
>> efficient asm from the code usually written by the C programmers. but
>> code generated by ghc has nothing common with it. so we are stay with
>> all these register-memory moves, non-unrolled loops and all other
>> results of naive compilation. gcc is just don't know how to
>> efficiently manage such code!

CR> would there be any advantage to targetting gcc's backend directly?

CR> I notice that Mercury seems to support this:

CR> that is, does using C as assembler disable possible optimizations,
CR> or is going through the C frontend enabling more optimizations than
CR> going to the backend directly?

i will read this. but one disadvantage is obvious - we can't use other
C compilers, including more efficient intel c/c++ (for my code it was
constantly 10% faster)

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Glasgow-haskell-users mailing list