Hoopl vs LLVM?

Simon Marlow marlowsd at gmail.com
Thu Dec 13 09:44:28 CET 2012


On 12/12/12 17:37, Johan Tibell wrote:
> On Wed, Dec 12, 2012 at 4:35 AM, Simon Marlow <marlowsd at gmail.com> wrote:
>> On 11/12/12 21:33, Johan Tibell wrote:
>>> I'd definitely be interesting in understanding why as it, like you
>>> say, makes it harder for LLVM to understand what our code does and
>>> optimize it well.
>>
>>
>> The example that Simon gave is a good illustration:
>>
>> <snip>
>
> My question was more: why do we CPS transform? I guess it's because we
> manage our own stack?

Right.  In fact, LLVM does its own CPS transform (but doesn't call it 
that) when the code contains non-tail function calls.  We give LLVM code 
with tail-calls only.

The choice about whether to manage our own stack is *very* deep, and has 
ramifications all over the system.  Changing it would mean a completely 
new backend and replacing a lot of the RTS, that is if you could find a 
good scheme for tracking pointers in the stack - I'm not sure LLVM is up 
to the job without more work.  It could probably be done, but it's a 
huge undertaking and it's not at all clear that you could do any better 
than GHC currently does.  We generate very good code from idiomatic 
Haskell; where we fall down is in heavy numerical and loopy code, where 
LLVM does a much better job.

Cheers,
	Simon




More information about the Glasgow-haskell-users mailing list