[LLVMdev] Newbie question: Getting info about JIT-compiled function

Jeff Kuskin jk500500 at yahoo.com
Tue Jan 27 08:56:01 PST 2009


Apologies if this is a FAQ.

I am using the LLVM JIT facility on an x86_64 platform.  I generate IR for a single function using IRBuilder(), use the FunctionPassManager to do some optimization passes, and then call ExecutionEngine::getPointerToFunction() to get a native-code version of the function.  Everything works fine so far.

Two questions:

Question (1): How can I get the size of the native function?  I see that the information is stored in the __jitSymbolTable structure in JITEmitter.cpp, but I don't see any interface to query this symbol table.  I see AddFunctionToSymbolTable() and RemoveFunctionFromSymbolTable(), but not any equivalent of GetFunctionFromSymbolTable().  Is there a supported way to get at the JitSymbolEntry for a function?  If not, is there an alternate way to determine the size (in bytes) of the native function?

Question (2): Does LLVM have any routines for printing the disassembly of a native code function?  I see that lli can do this, but I would much prefer an LLVM library routine that I can call from my own code rather than having to write the bitcode to a file and then invoke lli.  Suggestions?

Thanks for any help!

-- Jeff Kuskin



      



More information about the llvm-dev mailing list