[PATCH] New JIT APIs (ORC)

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Jan 22 08:51:55 PST 2015


> Questions and comments welcome.

The way lazy compilation is implemented looks odd. My understanding is
that the IR is patched to turn "call @foo" into a load + call into the
JIT.

Why no just make @foo a declaration and compile with -fPIC? That will
produce a 'call foo at plt' in the produced .o file. With that, our
"dynamic linker" can create a got and a plt. The plt loads the got and
jumps to it. The initial value in the GOT can be to just jump to
MCJIT. Following calls will be direct.

So the PLT the our dynamic linker creates could look like

jmpq *got_entry
movq some_jit_created_id_of_the_function $RDI ; The got_entry
initially points here
jmpq some_mcjit_funcion

Then some_mcjit_funcion can extract the IR out to a new module,
codegen that and set the got_entry.

This also has the advantage of not requiring a large code model, even
if the two functions are put far apart.

Cheers,
Rafael



More information about the llvm-commits mailing list