Hi people! I'm looking for a back-end compiler for a language project of mine, LLVM looks promising, but I'd like to clear a few things up first: 1. What relation does LLVM bear with GCC; why would somebody use LLVM for a compiler back-end over GCC (aside from the Virtual Machine)? How do the goals of GCC and LLVM differ as compiler toolkits? 2. How conducive to Incremental Compilation is LLVM? I would like to be able to compile and execute code in the same process immediately. An example of this would be in an interactive programming environment, or a Common Lisp style of compilation. 3. Is LLVM able to support advanced runtime features as continuations, garbage collection and resuming exception handling. Would there be anything in LLVM that would prevent these sorts of features? Is there anything in the LLVM runtime that is assumed (dynamic typing, etc). Or is LLVM as it's title sugests: Low-Level, so it won't get in your way? Thanks for your time! Tim.
On Sun, 16 Jan 2005, Tim Macfarlane wrote:> Hi people! > I'm looking for a back-end compiler for a language project of mine, LLVM > looks promising, but I'd like to clear a few things up first: > > 1. What relation does LLVM bear with GCC; why would somebody use LLVM > for a compiler back-end over GCC (aside from the Virtual Machine)? How > do the goals of GCC and LLVM differ as compiler toolkits?There are many differences in goals and implementation. LLVM does use a hacked on version of GCC for it's C and C++ parsers, but does not rely on it for anything else. GCC has advantages over LLVM (more target support etc), and LLVM has advantages over GCC (JIT compilation, easier to work with, interprocedural optimization, can use it to build non GPL tools, ...). This is really a big question that has many nuances, but that is at least part of it.> 2. How conducive to Incremental Compilation is LLVM? I would like to be > able to compile and execute code in the same process immediately. An > example of this would be in an interactive programming environment, or a > Common Lisp style of compilation.That is no problem. You can take a look at the llvm/examples/* directories, there are examples that build LLVM code on the fly and execute it.> 3. Is LLVM able to support advanced runtime features as continuations, > garbage collection and resuming exception handling. Would there be > anything in LLVM that would prevent these sorts of features? Is there > anything in the LLVM runtime that is assumed (dynamic typing, etc). Or > is LLVM as it's title sugests: Low-Level, so it won't get in your way?I believe that the only thing that we are presently missing is guaranteed tail calls, but it will be added in the near future. LLVM does not assume anything about your runtime, as you say, it doesn't get in your way. :) -Chris -- http://nondot.org/sabre/ http://llvm.cs.uiuc.edu/
>> 3. Is LLVM able to support advanced runtime features as continuations, >> garbage collection and resuming exception handling. Would there be >> anything in LLVM that would prevent these sorts of features? Is there >> anything in the LLVM runtime that is assumed (dynamic typing, etc). Or >> is LLVM as it's title sugests: Low-Level, so it won't get in your way? > > I believe that the only thing that we are presently missing is > guaranteed tail calls, but it will be added in the near future. LLVM > does not assume anything about your runtime, as you say, it doesn't > get in your way. :) >I would add a couple of minor caveats to this. Continuations are not a first-class feature in LLVM so any transformations that use them are not directly expressible - you would have to do those in a front-end if desired. Also, although you can *implement* any of the above language features in LLVM, I think the code for closures (and therefore any first-class functions) requires excessive use of void pointers and casts. --Vikram http://www.cs.uiuc.edu/~vadve http://llvm.cs.uiuc.edu/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1143 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050116/91be0d9b/attachment.bin>
Thanks Chris (& others who replied), Tim. On Sun, 2005-01-16 at 12:40 -0600, Chris Lattner wrote:> On Sun, 16 Jan 2005, Tim Macfarlane wrote: > > Hi people! > > I'm looking for a back-end compiler for a language project of mine, LLVM > > looks promising, but I'd like to clear a few things up first: > > > > 1. What relation does LLVM bear with GCC; why would somebody use LLVM > > for a compiler back-end over GCC (aside from the Virtual Machine)? How > > do the goals of GCC and LLVM differ as compiler toolkits? > > There are many differences in goals and implementation. LLVM does use a > hacked on version of GCC for it's C and C++ parsers, but does not rely on > it for anything else. GCC has advantages over LLVM (more target support > etc), and LLVM has advantages over GCC (JIT compilation, easier to work > with, interprocedural optimization, can use it to build non GPL tools, > ...). This is really a big question that has many nuances, but that is at > least part of it. > > > 2. How conducive to Incremental Compilation is LLVM? I would like to be > > able to compile and execute code in the same process immediately. An > > example of this would be in an interactive programming environment, or a > > Common Lisp style of compilation. > > That is no problem. You can take a look at the llvm/examples/* > directories, there are examples that build LLVM code on the fly and > execute it. > > > 3. Is LLVM able to support advanced runtime features as continuations, > > garbage collection and resuming exception handling. Would there be > > anything in LLVM that would prevent these sorts of features? Is there > > anything in the LLVM runtime that is assumed (dynamic typing, etc). Or > > is LLVM as it's title sugests: Low-Level, so it won't get in your way? > > I believe that the only thing that we are presently missing is guaranteed > tail calls, but it will be added in the near future. LLVM does not assume > anything about your runtime, as you say, it doesn't get in your way. :) > > -Chris >