[Openmcl-devel] llvm backend

Gary Byers gb at clozure.com
Mon Mar 28 12:45:45 PDT 2011

On Mon, 28 Mar 2011, Jason E. Aten wrote:

> Open question -- I'm really enjoying Clozure CL.? I wonder how difficult it
> is to write a new backend?? I would like be to talk to the code
> generation/just-in-time compiler from LLVM, to be able to target GPUs and
> ARMs, among others, eventually.

Someone asked about porting to the SPARC on this list last year; the discussion
may be interesting:


As it turns out, there's reason to believe that compiling C well and
compiling Lisp well are different things (even though there's some

The ARM port was started a few months after that; I think that it took
around 3 months, which was surprisingly quick.  The x86-64 and x86-32
ports had each taken around 6 months.  The ARM is a much saner
architecture (with an instruction set that seems to have been "designed"
rather than "allowed to happen"), and I think that that likely had something
to do with the effort involved in the port.

Porting a lisp to a GPU makes only slightly more sense to me than porting
a lisp to an FPU.  (Yes there are differences and a GPU may be a lot closer
to it, buy neither is exactly a general-purpose computer.  You can download
GPU code into the unit and execute it - so the FPU analogy breaks down -
but you'd probably find that that code can do some things incredibly quickly
and that other things are incredibly awkward.)  You might be able to do
something that allows you to express certain kinds of algorithms in Lisp,
compile that code into machine code for a GPU, download that code, execute
it, and find that the GPU was fast enough to make that all worthwhile; that's
probably easier than it would be to figure out how to implement CONS reasonably
or how to implement OPEN at all.

> Is there an architectural overview of the code someplace?

Chapter 16 of the manual doesn't talk too much about the compiler per se,
but it does discuss many aspects of CCL's runtime architecture.  A reader
of that chapter will probably note that it's a bit different from a C
program's runtime architecture.

> Thanks so much.
> Jason

More information about the Openmcl-devel mailing list