[Haskell-cafe] Toy compression algorithms [was: A very edgy
language]
Stefan O'Rear
stefanor at cox.net
Sun Jul 8 11:22:03 EDT 2007
On Sun, Jul 08, 2007 at 04:07:59PM +0100, Andrew Coppin wrote:
> The way I heard it is that it *does* native code generation, but it's "not
> as good" as the via-C version. (Can't imagine why... You would have thought
> directly implementing functional primitives would be much easier than
> trying to mangle them to fit C's multitude of limitations. Still, what do I
> know?)
This is very true - but -fvia-C isn't really C. First it generates GCC
C (with global register variables, among other things), then it feeds
the output through gcc - and then it runs a GHC-specific Perl script
called the Evil Mangler over the assembly output, which promptly regexes
your code to death.
If you want to see what a difference exists between true C and the NCG,
try compiling your program with -fvia-C -unreg. -unreg tells GHC to
generate (something very close to) ANSI C; also, the mangler is not
used. -unreg is mainly used for porting...
Stefan
More information about the Haskell-Cafe
mailing list