[LLVMdev] Backend optimizations

Rinaldini Julien julien.rinaldini at heig-vd.ch
Mon Jan 26 05:21:19 PST 2015


Hi,

I'm writting an intrinsics for the X86 plateform that replace every
'call' instruction by a 'push ret_addr' followed by a 'jmp func_addr'.
I'm doing this in the X86ISelLowering class with a custom inserter.

So if I have something like this:

0x0 call foobar
0x1 ...

the call will be replaced like this:

0x0 push 0x2
0x1 jmp foobar_addr
0x2 ...

This works fine in -O0, but when I try to compile in -O1,2,3, my program
fails. Since there is no more 'call' instruction, the optimizations in
the backend remove the operation that manage the function's arguments (I
guess it thinks the arguments are not needed anymore).

How can I resolve this problem? Is there a specific pass that remove
unused values that I can disabled?

Cheers



More information about the llvm-dev mailing list