[LLVMdev] Runtime optimization and other doubts
sabre at nondot.org
Wed Nov 2 13:35:05 PST 2005
On Wed, 2 Nov 2005, Sandra Johnson wrote:
> $lli -load ../../../mypass.so test1.bc
> using JIT and it worked perfectly.
> Now I am trying to generate static native code generation and then execute the
> native code program as:
> $opt -load ../../../mypass.so -myoption test.bc > test1.bc
> $llc -load ../../../mypass.so test1.bc -o test1.s
> $gcc test1.s -o test1.native -lpthread
> but now I get the following error
> /tmp/cc8ilAEp.o(.text+0x251): In function `main':
> : undefined reference to `llvm_profile_init'
gcc test1.s -o test1.native -lpthread ../../../mypass.so
Make sure that ../../.. is in your LD_LIBRARY_PATH when running your
> I am also interested in knowing more about profile driven runtime optimizations
There is one profile driven optimization (basic block layout), it does not
run at runtime though, and is not enabled by default.
> I found that optimizations of FunctionPass or MachineFunctionPass when
> used with JIT are executed only once for each function. Am I wright ?
> Is there any pass which will be executed each time a function is called
> or whenever it is needed i.e. during runtime ?
No. You could use a function pass that inserts a function call into each
function though, that would give you control every time each function is
> Is it possible to inline/ clone the function after the machine code is
> generated ?
No, not currently. High-level optimizations like inlining are best
performed on the LLVM IR level, not the machine code level.
More information about the llvm-dev