1Date: Wed, 31 Jan 2001 12:04:33 -0600
2From: Vikram S. Adve <vadve@cs.uiuc.edu>
3To: Chris Lattner <lattner@cs.uiuc.edu>
4Subject: another thought
5
6I have a budding idea about making LLVM a little more ambitious: a
7customizable runtime system that can be used to implement language-specific
8virtual machines for many different languages.  E.g., a C vm, a C++ vm, a
9Java vm, a Lisp vm, ..
10
11The idea would be that LLVM would provide a standard set of runtime features
12(some low-level like standard assembly instructions with code generation and
13static and runtime optimization; some higher-level like type-safety and
14perhaps a garbage collection library).  Each language vm would select the
15runtime features needed for that language, extending or customizing them as
16needed.  Most of the machine-dependent code-generation and optimization
17features as well as low-level machine-independent optimizations (like PRE)
18could be provided by LLVM and should be sufficient for any language,
19simplifying the language compiler.  (This would also help interoperability
20between languages.)  Also, some or most of the higher-level
21machine-independent features like type-safety and access safety should be
22reusable by different languages, with minor extensions.  The language
23compiler could then focus on language-specific analyses and optimizations.
24
25The risk is that this sounds like a universal IR -- something that the
26compiler community has tried and failed to develop for decades, and is
27universally skeptical about.  No matter what we say, we won't be able to
28convince anyone that we have a universal IR that will work.  We need to
29think about whether LLVM is different or if has something novel that might
30convince people.  E.g., the idea of providing a package of separable
31features that different languages select from.  Also, using SSA with or
32without type-safety as the intermediate representation.
33
34One interesting starting point would be to discuss how a JVM would be
35implemented on top of LLVM a bit more.  That might give us clues on how to
36structure LLVM to support one or more language VMs.
37
38--Vikram
39
40