inside the GHC code generator

Bulat Ziganshin bulat.ziganshin at
Thu Feb 23 13:40:48 EST 2006

Hello Kevin,

Thursday, February 23, 2006, 9:06:25 PM, you wrote:

KG> On a related point, Mercury has two C backends a low level one at the
KG> level of GHC's and a high level one. Bulat might want to read this for
KG> a description of the high level C implementation:


citating from this paper's annotation: "Many logic programming
implementations compile to C, but they compile to very low-level C,
and thus discard many of the advantages of compiling to a high-level
language". it's the same as i think

KG> Also, ghc used to be faster than gcc for a naive, recursive factorial
KG> function (once the cpr analysis and optimisation was added).  From
KG> what Bulat wrote it seems that gcc got better ...

i don't say that we must compile recursive Haskell/STG functions
naively to recursive C ones (as jhc does). no - i say that we should
translate recursive Haskell definitions to explicit C loops, what is
NATURAL C PROGRAMMING STYLE and therefore optimized much better as you
can see in the files i attached

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Glasgow-haskell-users mailing list