[LLVMdev] Selectively Jitting using MCJIT
Willy WOLFF
willy.wolff at etu.unistra.fr
Fri May 23 11:00:39 PDT 2014
On 23 May 2014, at 14:55, Jonatan Waern wrote:
> Hello, I am a novice at using the llvm api to do much of anything.
>
> I am trying to lazily apply certain optimisation passes on select functions when jitting a large program. It is undesirable to me to load the entire program as IR code and then generate code in memory for it (time concerns). It seems that there is a function in MCJIT "loadObjectFile" that would suit my purposes, allowing me to statically compile the program and then load it into the jit.
>
As far as I know, ObjectFile is either COFF, ELF or MachO format, statically compiled. But the pass manager for applying optimisation passes works only on llvm-ir.
> My question is then what would be a good way to callback into the jit for applying the optimisation passes before calling one of the function? My current idea is to make the function extern in the llvm IR prior to static compile, and then use "installLazyFunctionCreator" to generate this function by loading ircode from an isolated module. Is this a feasible approach?
>
What you can do is to isolate the function you want to jit by extracting it to a new module. Load this module during runtime, apply your pass and jitting it.
--
Willy WOLFF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140523/f052ed98/attachment.html>
More information about the llvm-dev
mailing list