[LLVMdev] instruction scheduling issue

Sergei Larin slarin at codeaurora.org
Mon Jan 7 11:53:20 PST 2013



  I do not think there is a trivial way to do it. Do you really _have_ to
have those instructions together, or mere order is enough?

Also, how much performance are you willing to sacrifice to do what you do?
Maybe turning off scheduling all together is an acceptable solution?





Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
The Linux Foundation


From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Xu Liu
Sent: Friday, January 04, 2013 11:38 AM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] instruction scheduling issue


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>


  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

in the following code, the memory access is at 402afa, not right next to the
function call at 402aed.



  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


  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/20130107/9fdf0ee6/attachment.html>

More information about the llvm-dev mailing list