LLVM back end
wolfgang.thaller at gmx.net
Wed Dec 20 18:54:50 EST 2006
On 20-Dec-06, at 10:10 AM, Michael T. Richter wrote:
> Well, I'm almost entirely ignorant of LLVM and of Haskell --
> especially the internals of both. That makes me ideally suited for
> this project since I'm not aware that it's impossible.
I'm afraid LLVM currently lacks some features that are required for
efficient GHC code generation, specifically:
a) Global Register Variables
b) The ability to put data next to code
c) (maybe, I'm not sure) Tailcalls
We need to keep some things in global registers for speed reasons
(depending on the number of available registers); among other things,
the haskell stack pointer and the heap pointer. Using regular global
variables instead would be a lot slower.
With (almost) every chunk of code, we want to associate a smal chunk
of data (the "info table") which contains information used by the
garbage collector and other parts of the run time system. We want to
use only one pointer to point to both of those things, and we don't
want to waste time with any additional indirections, so we make the
pointer point between the data chunk and the code chunk.
While they are supported in theory, I couldn't get LLVM to generate
any tailcalls. Maybe I've done something wrong, maybe they're not
really implemented yet.
So I guess step one would be to start negotiating about those things
with the LLVM people.
More information about the Glasgow-haskell-users