[LLVMdev] instruction scheduling issue
Xu Liu
xl10 at rice.edu
Fri Jan 4 09:37:45 PST 2013
Hi all,
I'm trying to insert a function call "llvm_memory_profiling " right before each memory access. The function uses the effective address of the memory access as its single parameter.
A example is as follows: the function call at 402a99 has a parameter passed to %rdi at 402a91. One can see that the function call is exactly before the
memory access I want to monitor because the effective address used by 402a9e is passed to the function call.
402a91: 48 8d bc 1c 48 02 00 lea 0x248(%rsp,%rbx,1),%rdi
402a98: 00
402a99: e8 82 e0 ff ff callq 400b20 <llvm_memory_profiling at plt>
/home/xl10/llvm/test//luleshOMP-0611.cc:1974
402a9e: f2 0f 10 84 1c 48 02 movsd 0x248(%rsp,%rbx,1),%xmm0
402aa5: 00 00
402aa7: f2 0f 11 84 24 b8 01 movsd %xmm0,0x1b8(%rsp)
However, due to instruction scheduling, the following instruction of the function call is not always the desired memory access instruction. For example,
in the following code, the memory access is at 402afa, not right next to the function call at 402aed.
/home/xl10/llvm/test//luleshOMP-0611.cc:1972
402ae5: 48 8d bc 1c 08 02 00 lea 0x208(%rsp,%rbx,1),%rdi
402aec: 00
402aed: e8 2e e0 ff ff callq 400b20 <llvm_memory_profiling at plt>
402af2: 48 8d bc 1c c8 02 00 lea 0x2c8(%rsp,%rbx,1),%rdi
402af9: 00
/home/xl10/llvm/test//luleshOMP-0611.cc:1975
402afa: f2 0f 10 84 1c 08 02 movsd 0x208(%rsp,%rbx,1),%xmm0
402b01: 00 00
Could anyone point me how to solve this problem by modifying the instruction scheduling module in LLVM to make sure the function call instruction and the
memory access instruction next to each other? Thank you very much.
Best regards,
Xu Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130104/f682e0bb/attachment.html>
More information about the llvm-dev
mailing list