[LLVMdev] Runtime optimization and other doubts

Sandra Johnson
Wed, 02 Nov 2005 09:37:29 -0000

Hi ,

Regarding my previous help on LLVM Instrumentation , gdb helped me out.

Your docs on Writing an LLVM Pass - Using gdb with dynamically loaded

passes was very useful.

I've done some instrumentation and collected profiles during runtime using

library routines in a separate pass with opt tool.

I used :

In the tools/lli/Makefile , I included the following line

TOOLLINKOPTS := -lpthread

$opt -load ../../../mypass.so -myoption test.bc > test1.bc

$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'

/tmp/cc8ilAEp.o(.text+0x26d): In function `main':

: undefined reference to `llvm_method_entry'

/tmp/cc8ilAEp.o(.text+0x39e): In function `main':

: undefined reference to `llvm_method_exit'

/tmp/cc8ilAEp.o(.text+0x3a3): In function `main':

: undefined reference to `llvm_profile_display'

collect2: ld returned 1 exit status

$

I also tried with various gcc options like -shared , -shared-libgcc , -L

to link my library mypass.so ,but nothing worked.How can I do this?

I am also interested in knowing more about profile driven runtime optimizations

on LLVM1.5.Is it already available ? If so where can I find it? If not any hint

on how/where to start .

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 ?

Is it possible to inline/ clone the function after the machine code is generated
?



Thanks in advance for any help,

Sandra







---------------------------------
 Yahoo! FareChase - Search multiple travel sites in one click.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20051102/436e5681/attachment.html>