[llvm-dev] re-compile a function
marwayusuf@feng.bu.edu.eg via llvm-dev
llvm-dev at lists.llvm.org
Sun Apr 10 04:13:30 PDT 2016
Hi Lang,
Is there any detailed instructions or tutorial for using orc layers?
Thanks in advance.
Regards,
Marwa Yusuf
Teaching Assistant - Computer Engineering Department
Faculty of Engineering - Benha University
E-JUST PhD Student
Computer Science & Engineering Dept.
________________________________
From: Lang Hames <lhames at gmail.com>
Sent: Wednesday, December 2, 2015 11:29 PM
To: marwayusuf at feng.bu.edu.eg
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] re-compile a function
Hi Marwa,
MCJIT doesn't provide any support for recompilation. The best you can do is use multiple MCJIT instances and destroy whichever one contains the function "foo" that you want to recompile. MCJIT does not do any dependence tracking either, so you'll also need to destroy and recompile any direct callers of "foo" (and their direct callers, and so on). If you know you want to be able to recompile a function it may be best to only call it indirectly - that way all you have to do is delete the containing MCJIT instance, create a new MCJIT instance, and update your function pointer.
You may find the Orc APIs a better fit for what you're doing: they at least support removing individual modules from the JIT session, so you don't have to maintain multiple JIT instances yourself. You'll still need to manage the invalidation and/or function pointer update. If you come up with a scheme for that though we could look at adding it in-tree. You might also be able to make some use of the utilities in include/llvm/ExecutionEngine/Orc/IndirectionUtils.h.
In case it's useful, I've attached an example that uses the Orc APIs to do recompilation at higher optimization levels, based on the Kaleidoscope tutorials. This was motivated by the following mailing list discussion: http://lists.llvm.org/pipermail/llvm-dev/2015-July/087776.html, which may also be related to what you want to do.
Cheers,
Lang.
On Sat, Nov 21, 2015 at 11:05 AM, marwayusuf at feng.bu.edu.eg<mailto:marwayusuf at feng.bu.edu.eg> via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
Dear All
Is there is a way to recompile a function at runtime?
It seems that I need to -like - invalidate the recompiled function to force the MCJIT to recompile it, cause when I just call runFunction, it neglects any modifications in the function code.
Thanks in advance.
Regards,
Marwa Yusuf
Teaching Assistant - Computer Engineering Department
Faculty of Engineering - Benha University
E-JUST PhD Student
Computer Science & Engineering Dept.
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160410/60d486fb/attachment.html>
More information about the llvm-dev
mailing list