Hello there! I'm an absolute newb at LLVM,and I was hoping someone could answer a few of my questions. I'm currently working on a game engine. As part of it's design, I need a virtual machine for scripts. Is LLVM suited for this at all? Such as registering external functions that can be called from the scripts? And if this did work, it wouldn't really matter what language the original scripts were written in, since they all get compiled down to the LLVM bytecode correct? As of now what platforms does LLVM not compile on? Is it good for embedded work? Sorry if these questions are extremely simplistic. I couldn't seem to find anythong on the LLVM website pertaining to these questions. Thanks in Advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090801/c9d2bbf7/attachment.html>
On Sat, Aug 1, 2009 at 11:43 PM, Tres Walsh<tres.walsh at gmail.com> wrote:> Hello there! > I'm an absolute newb at LLVM,and I was hoping someone could answer a few of > my questions. > I'm currently working on a game engine. As part of it's design, I need a > virtual machine for scripts. Is LLVM suited for this at all? Such as > registering external functions that can be called from the scripts?Possibly... but you're sort of making the decision at the wrong level; LLVM is really a low-level solution intended for implementing a language. If you need scripts, you probably want a scripting language of some sort, and if you're working on a game engine, you probably don't want to write your own scripting language, since it's a lot of work with no obvious benefit. There are numerous existing open-source solutions for this; I think Python and Lua are popular choices for that sort of thing.> And if > this did work, it wouldn't really matter what language the original scripts > were written in, since they all get compiled down to the LLVM bytecode > correct?You can't really just compile a scripting language down to LLVM bitcode and expect good performance; you really need some glue code to mix interpretation, compilation, and possibly recompilation at runtime to get good performance. And if the scripts in question aren't performance-sensitive, there's not really much point to using LLVM. It strongly depends on what you're doing.> As of now what platforms does LLVM not compile on? Is it good for embedded > work?In terms of platforms, it'll probably work for everything you might care about; see http://llvm.org/docs/ReleaseNotes-2.6.html#portability (although note that only some of those platforms have working JIT support). As for embedded work, it depends on what you mean by embedded; if 10MB code footprint sounds way too large, LLVM is probably not the way to go. You might want to take a look at http://llvm.org/docs/tutorial/ to get a better idea of what LLVM can do. -Eli
Thanks for the response :D I have used Python and Lua before. I'd love to use the syntax of lua with the object oriented ness of python, and I thought LLVM would be a way to do that. Again your help is appreciated. On Sun, Aug 2, 2009 at 12:25 AM, Eli Friedman <eli.friedman at gmail.com>wrote:> On Sat, Aug 1, 2009 at 11:43 PM, Tres Walsh<tres.walsh at gmail.com> wrote: > > Hello there! > > I'm an absolute newb at LLVM,and I was hoping someone could answer a few > of > > my questions. > > I'm currently working on a game engine. As part of it's design, I need a > > virtual machine for scripts. Is LLVM suited for this at all? Such as > > registering external functions that can be called from the scripts? > > Possibly... but you're sort of making the decision at the wrong level; > LLVM is really a low-level solution intended for implementing a > language. If you need scripts, you probably want a scripting language > of some sort, and if you're working on a game engine, you probably > don't want to write your own scripting language, since it's a lot of > work with no obvious benefit. There are numerous existing open-source > solutions for this; I think Python and Lua are popular choices for > that sort of thing. > > > And if > > this did work, it wouldn't really matter what language the original > scripts > > were written in, since they all get compiled down to the LLVM bytecode > > correct? > > You can't really just compile a scripting language down to LLVM > bitcode and expect good performance; you really need some glue code to > mix interpretation, compilation, and possibly recompilation at runtime > to get good performance. And if the scripts in question aren't > performance-sensitive, there's not really much point to using LLVM. > It strongly depends on what you're doing. > > > As of now what platforms does LLVM not compile on? Is it good for > embedded > > work? > > In terms of platforms, it'll probably work for everything you might > care about; see http://llvm.org/docs/ReleaseNotes-2.6.html#portability > (although note that only some of those platforms have working JIT > support). As for embedded work, it depends on what you mean by > embedded; if 10MB code footprint sounds way too large, LLVM is > probably not the way to go. > > You might want to take a look at http://llvm.org/docs/tutorial/ to get > a better idea of what LLVM can do. > > -Eli > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- http://treswalsh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090802/ff032e6a/attachment.html>