[LLVMdev] Using LLVM to generate x86 dynamically in memory
shanko_chavano at hotmail.com
Tue Feb 2 15:05:29 PST 2010
Hi. I'm very new to LLVM, and have read some of the documentation online. Before I invest too much time, however, in learning about LLVM, I'd like to know if it can be used for my purpose. We currently have a critical runtime component that evaluates expressions via interpretation. The bytecode that we generate goes through various optimization phases similarly to that of optimizing language compilers (although definitely not as complete) before being evaluated at runtime. For quite some time now we have been thinking about getting away from interpretation all-together and generating native code directly.
What I'd like to know is:
1) Is there an LLVM backend library that can take either a) a C source program in memory or b) an LLVM program in memory, as input and generate x86 instructions in memory?
2) HOw "light-weight" would a mechanism like this be? I suppose that depends on what optimizations we decided to apply during this code-gen phase.
What we plan to do is invoke this in-memory compiler to generate the x86 instructions, and then ship them at runtime to our new expression evaluation engine that will simply set a function pointer to it and execute.
I heard of a compiler called TinyCC that basically has a library (libtcc) that can be invoked at runtime to generate x86 instructions directly from a C program stored in memory. That's what I would like, but with the aggressive opts provided in the LLVM infrastructure. Thanks so much for your time...
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev