When you say "spit bitecode from the JIT the first time, load it on subsequent sessions" :<br>- do you want to write the IR in a file via BitcodeWriter and re-read it via BitcodeReader ? (you will pay the cost of native code emission on each load ?)<br>
- do you want to write the native code ? In that case, how do you retrieve the size of the buffer prepared by the "getPointerToFunction" method ? Is it safe ? I was wondering on how memory access to global variable will come back in this case ?<br>
<br>Olivier.<br><br><div class="gmail_quote">On Thu, Jun 11, 2009 at 5:39 PM, Óscar Fuentes <span dir="ltr"><<a href="mailto:ofv@wanadoo.es">ofv@wanadoo.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
"Nicolas Capens" <<a href="mailto:nicolas@capens.net">nicolas@capens.net</a>> writes:<br>
<br>
Hello Nicolas.<br>
<div class="im"><br>
> I'd like to be able to write JIT-compiled code to a Windows DLL. I have no<br>
> idea where to start though. Does LLVM already offer some support for<br>
> this?<br>
<br>
</div>Nope. Don't hold your breadth waiting for it. It is far from trivial to<br>
do.<br>
<br>
I don't know your requirements, but mine is to avoid compilation every<br>
time the hosting application starts.<br>
<br>
I was thinking on:<br>
<br>
1. Compile and spit bitecode from the JIT the first time, load it on<br>
subsequent sessions. Seems doable. Doesn't work if your goal is<br>
using code on non-LLVM-aware applications, but if you want to do this<br>
the JIT is of no use anyways.<br>
<br>
2. Act as a traditional compiler and generate a shared library via<br>
llvmc + assembler + linker. Tricky, even more so on Windows. Resolving<br>
symbols is not as easy as is on case 1.<br>
<div class="im"><br>
> Or would it be straightforward to write my own DLL writer (no advanced<br>
> features needed)? Or maybe I could use an external linker? All help highly<br>
> appreciated!<br>
<br>
</div>If you end hacking a DLL writer, please contribute it to LLVM :-)<br>
<font color="#888888"><br>
--<br>
Óscar<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</font></blockquote></div><br>