Couple newbie questions :|

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!

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 LLVM Tutorial: Table of Contents — LLVM 16.0.0git documentation to get
a better idea of what LLVM can do.

-Eli

Thanks for the response :smiley:

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.

The other big issue to consider here is the memory footprint. Maybe try asking here:

http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com

Add add more details of exactly what you wish to do.