<div dir="ltr">Hi Lang,<div><br></div><div>Thanks for the reply. Responses below.</div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>As far as I know nobody is actively working on MCJIT any more. I've been working on the next generation of LLVM JIT APIs (ORC - see include/llvm/ExecutionEngine/Orc) for a while now, but they don't have functionality for running arbitrary functions yet.<br></div></div></blockquote><div><br></div><div>Thanks for the pointer to ORC -- it looks like the runFunction there is a copy-paste from MCJIT (minus the finalize() stuff).</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span class=""><div><span style="font-size:12.800000190734863px">Definitely. I'd be happy to see something like this in ORC, and I think there would be other people who would appreciate it too.</span></div></span></div></blockquote><div><br></div><div>The basic approach I am using is to add a function to TargetMachine called runFunctionNatively:</div><div><br></div><div><div>  virtual GenericValue runFunctionNatively(Function *F, void *FPtr, ArrayRef<GenericValue> ArgValues);</div></div><div><br></div><div>This houses most of the duplicated code currently in runFunction, and can then be called from either MCJIT or OrcMCJITReplacement. I then have an override for X86TargetMachine that uses the register trick.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span class=""><div>I'd like to see a generic implementation that can handle all architectures first, maybe with an specialized version for specific ABIs as an optimization.<br></div></span></div></blockquote><div><br></div><div>I agree a generic implementation would be ideal, but I don't know how to do a generic dynamic dispatch in C. Lacking that generic implementation, would you be interested in seeing what I have so far?</div><div><br></div><div>Thanks!</div><div><br></div><div>Evan</div><div> </div></div><div class="gmail_signature" data-smartmail="gmail_signature"></div>
</div></div>