[LLVMdev] Selectively Jitting using MCJIT

Jonatan Waern Jonatan.Waern.5948 at student.uu.se
Fri May 23 05:55:43 PDT 2014


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.

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?




More information about the llvm-dev mailing list