[LLVMdev] ModuleProvider materializeFunction

Nick Lewycky nicholas at mxc.ca
Sat Jul 4 09:02:50 PDT 2009

Carter Cheng wrote:
> I have tracing the calls to materializeFunction in the LLVM code in hopes of determining how to properly utilize this function but from my explorations I gather it's just a hook which is called by the JIT system and I would mostly have to do the work myself.
> What is the preferred way to inject a llvm:Function which contains basic blocks into the Module + JIT? My understanding (perhaps erroneous) from some experimentation that modifying the module by inserting functions into it after you have created the EE does not automatically update the EE.

You should be able to add the Function to the Module at any time, then 
call EE->runFunction or EE->getPointerToFunction on it.

materializeFunction is used to load only part of a .bc file from disk. 
The functions which aren't loaded are given GhostLinkage then loaded 
later (materialized) when needed.


More information about the llvm-dev mailing list