[llvm-dev] How to insert instructions before each function calls?

Ryan Taylor via llvm-dev llvm-dev at lists.llvm.org
Sat Sep 3 15:04:29 PDT 2016


Take a look at IRBuilder and SetInsertPoint().

On Sep 3, 2016 18:02, "SHUCAI YAO via llvm-dev" <llvm-dev at lists.llvm.org>
wrote:

> I'm trying to insert some instructions before each function calls (before
> arguments push):
>    lea %EAX, label                      ----- new instructions
>    mov [ESP+stacksize], %EAX  ----- new instructions
>    push arg1
>    push arg2
>    ...
>    push argn
>    call callee_name
>
> I am a newbie to LLVM. I tried to use buildMI() to insert the instructions
> in the lowercall() function. But I couldn't put these instructions in the
> right positions. Is there a way to locate the position by using
> MachineBasicBlock iterator?
>
> Any suggestions are appreciated.
>
> Thanks!
> Shucai
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160903/82f1ef1c/attachment.html>


More information about the llvm-dev mailing list