[LLVMdev] Using LLVM for a non-GC language?

Andreas Fredriksson deplinenoise at gmail.com
Sat Apr 30 01:00:54 PDT 2005

Hi list,

I've just found the LLVM project and I have some questions that I
couldn't find answers for in the FAQ or Documentation sections of the
web site.

To explain my intereset in LLVM: I'm evaluating code generation
backends for a closed-source project which includes a domain-specific
(object-oriented) language. The design goals for the runtime contract
of this language is that it will use reference counting rather than
garbage collection because of tight coupling with C and C++ entities.

Speedy compilation is also an important design goal. While most use
cases for the language call for plain execution (and good
performance), some developers will change source code often in an
iterative fashion (akin to a script language). This is why the design
calls for rapid compilation to native code that can be reloaded on
demand. This is similar to the Java model with class loaders, only
using shared objects instead. In the non-developer use case, code is
assumed to be ahead-of-time compiled and readily available in shared
objects with no compilation penalty.

Having read most of the material on the project's website, I feel that
the high-level structure of the projects is somewhat lost in the
detailed documentation of things such as DAGs and AST primitives. It
might be that I've missed obvious information, if so pointers to the
right starting place would be appreciated. :)

First a question about LLVM's license. Am I correct in my
understanding that the LLVM license (apart from the GCC frontent) does
not prohibit use within a proprietary product given that said product
and its documentation includes the appropriate copyrights and
disclaimers and gives due credit to LLVM authors?

I'm also puzzled about the runtime model of LLVM. It seems as if the
lli tool for instance can cope with any bytecode package, for any LLVM
frontend language. Does LLVM dictate a certain runtime contract, such
as an omnipresent base runtime library or the use of a specific
garbage collection?

I realize that LLVM cannot generate shared objects (or Win32 DLLs)
without external tools (i.e. assembling the output), so generating ELF
and/or COFF sections natively would likely be a contribution from our
project to LLVM if it would be of interest to other developers.

So to sum up: could LLVM be used as a code generation backend for an
ahead-of-time compiled language that depends on reference counting
rather than garbage collection and a custom runtime library? Are there
any pitfalls with this approach that would make it difficult with

Best regards,

More information about the llvm-dev mailing list