
On Thu, 2007-09-13 at 15:55 -0700, brad clawsie wrote:
has anyone ever considered using llvm as a infrastructure for haskell compilation? it wold seem people are looking at building frontends for scheme, ocaml, etc. i don't know if an alternate backend is appropriate, but it would seem to be an interesting way to aggregate the best thinking for various optimizations over a more diverse group of developers.
I applied for Google Summer of Code with the suggestion to write a library to generate (and compile) LLVM code (not my idea in the first place, but I liked it), but it didn't get into the top 9 (i.e., funded) projects. It's certainly not a bad idea, but the immediate use to the community would admittedly not be too great. Targeting an existing Haskell compiler would probably be doable, but I am unsure what the big advantages would be. Many optimizations implemented for llvm are more high-level in nature and wouldn't make much sense for Haskell compilers, since translating to llvm would lose some information, and Haskell, being a lazy language, requires/enables non-standard transformations. Haskell-compilers currently require better low-level optimizations (instruction scheduling, register allocation, maybe memory locality optimazitions). I'm not up to date with how well llvm scores in these areas, but last time I checked it was slower than ghc, and ghc already isn't too great at this kind of stuff (compared to icc). I could however see some applications of an llvm-generation library for DSLs that require high performance, and currently have to invoke gcc at runtime. / Thomas