[LLVMdev] Is LLVM our answer??

Óscar Fuentes ofv at wanadoo.es
Fri Apr 1 21:39:55 PDT 2011


"Andy O'Meara" <andrew.omeara at soundspectrum.com> writes:

[snip]

> so we're accessing the viability of converting our python code to
> vanilla C++ (or something else) and using LLVM/JIT during runtime to
> compile and run our code.  The compiled code would be linked with
> callback glue and be invoked by calling the entry point (and execution
> would pass to the newly compiled code, occasionally returning back to
> app procs as call backs occur).  In other words, we're considering
> migrating the language our content is authored from Python to C++ (or
> some other JIT-compatible language) in order to get a major performan!
> ce boost.
>
> From what I understand of LLVM, this would seem to be well supported.

You will need a C++ compiler that supports JIT compiling. Maybe Clang
already supports this. I think that CERN's CINT C++ interpreter is
following that route too.

In general, C++ is not an easily embeddable language. If you care about
performance and not so much about C++, there are better options. If your
language requirements are simple enough maybe you could create your own
language.

For an incomplete, possibly outdated list of projects using LLVM see

http://www.llvm.org/releases/2.8/docs/ReleaseNotes.html#externalproj

> That said, our customers are very non-technical, so all the LLVM
> components we'd have to use would *have* to live inside our app binary
> and app resource dirs (so installing any extra components into the
> system is would be off limits).

If you are afraid of having to install runtimes similar to .Net or Mono,
there is no such problem with LLVM. It is just a set of C++ libraries
that you link into your application.

> Also, we target both OS X and
> Windows, but I'm not getting the feeling there's support for MS Visual
> Studio.  I see minGW support not but no MSVS support, is that correct?

Visual Studio is supported. See

http://www.llvm.org/docs/GettingStartedVS.html

[snip]

> So, in short, a list of LLVM subcomponents and tutorials for me to
> concentrate on would really help us since the LLVM universe seems so
> massive to this newcomer!

If you want to see how JITting works, take a look at the examples
distributed with LLVM, specifically Fibonacci and HowToUseJit. Reading
the documentation is also highly advised.

I also create commercial software for Windows with VS. My applications
are written on a custom language that works with a C++ runtime,
interacting with C and C++ libraries. It supports JITting with LLVM and
the performance is the same as C++ would provide. However, LLVM is not
enabled by default because LLVM is very slow at JITting for large chunks
of code (I'm usually generating more than 1 MB of native code.) If you
work with small code snippets (measured on the KBs of produced native
code) there should be no problem.

[snip]




More information about the llvm-dev mailing list