[LLVMdev] Parametric polymorphism

Jon Harrop jon at ffconsultancy.com
Wed Feb 18 14:31:58 PST 2009


On Wednesday 18 February 2009 21:43:30 DeLesley Hutchins wrote:
> The majority of llvm users are using llvm to compile C, or things that are
> similar to C.

C++, objective C and Cg.

> People who want to compile something other than C (Haskell, 
> ML, OCaml, C#, etc.)  would benefit from from having type variables in the
> IR.

Absolutely. My HLVM is specifically designed to support MLs.

However, I believe my project can only be completed with reasonable effort by 
building upon LLVM and taking a minimalist approach to placing requirements 
upon LLVM. I am not only avoiding contributing revolutionary changes to LLVM 
myself, I am avoiding everyone else's experimental features as well if at all 
possible.

> Focusing too much on one language leads to a limited VM. Witness the JVM
> (only supports Java), or MSIL (designed for C#, with other features tacked
> on as an afterthought). 

I agree completely but I do not believe that justifies making radical changes 
to LLVM itself. Indeed, you can do a perfectly good job by building upon LLVM 
precisely because LLVM does provide the esoteric low-level features that you 
want (e.g. tail call elimination is better in LLVM than on .NET!).

> What you say about maturity and destabilization is probably true, but
> that's more of a political problem or a manpower problem, not a technical
> problem.

Absolutely. I believe your proposal will not go ahead for non-technical 
reasons.

That is not to say that it would not be wonderful to have a HLVM with such 
features that is built upon LLVM. Indeed, that is precisely what I am trying 
to accomplish. It will certainly not be theoretically optimal but it will 
exist and, I believe, it will be of great practical value.

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-dev mailing list