Saturday, January 17, 2009

LLVM is great.

It seems that the LLVM crowd have mistaken my blog posts for criticism of LLVM. Let me make it clear that I have nothing but respect for LLVM.

I've previously mentioned that LLVM doesn't support zero-overhead garbage collection. Big deal. It's about the same as saying LLVM doesn't answer whether P=NP. I apparently failed in conveying that this is an unsolved problem in computer science.

Solving this problem isn't as simple as putting heap pointers in registers (although it is required). The real beef lies in determining which registers are heap pointers when it isn't known statically. Determining at run-time which registers are heap pointers is intimately tied to the data model of the high-level language. Doing this well in an agnostic way is an unsolved problem. (Note that pointer tagging is generally avoided).


Several people apparently took it personally when I mentioned writing yet another NCG. Let it be clear that I'd never rewrite any of LLVM nor wish to belittle the effort it takes to write a general compiler. I was merely talking about writing a non-optimizing translator from an extremely limited IR to machine code.


So:
  • LLVM is great. I do not wish to criticise any part of it.
  • What you guys have created is impressive. I do not wish to belittle your efforts.
  • LLVM is not a silver bullet. It does not solve all open questions in the academic world and no one expects it to.

4 comments:

  1. The point of contention seems to be "does not" vs "could not". Yes, LLVM *today* is limited, but if you're willing to experiment why not do it on LLVM? Yes, it may require more work than an experimental language, but that's only because it'd be broadly useful, rather than a specialized experiment.

    ReplyDelete
  2. Adam Olsen:

    You don't seem to appreciate the difficulty of the program. Solving it requires research. Applying a solution to LLVM or C-- would just take a bit of engineering. I have absolutely no intentions of doing any research in this area.

    ReplyDelete
  3. So a) what you want doesn't exist yet, and b) once somebody creates it it's easy to apply to LLVM.

    I think what you mean is that it doesn't exist *in an otherwise powerful compiler*. If you write a naive compiler you can do it, which'll let you move on to your real goals. Is that right?

    ReplyDelete
  4. Exactly, what I want to do can't yet be done by /any/ general-purpose compiler.

    ReplyDelete