[llvm-dev] Problem with inserting a function call after certain x86 instructions

Zhiyu Xie via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 23 19:15:15 PDT 2016


Hi all,
     I am writing a pass subclassing the MachineFunctionPass and doing the
instrumentation in runOnMachineFunction(). But I do not know how to insert
a function call. In my work, I write a special function for a program to be
compiled and I need to insert this function after certain instructions
whose destination register is esp. In X86InstrInfo.cpp, there are two kinds
of call may be useful, namely X86::CALL32r and X86::CALL32m. And in
X86InstrInfo.td, there are three, namely call32i, call32m and CallImmAddr.
But I do not know how to use them to insert my special function. Besides, I
can not find LEAVE instruction in X86InstrInfo.cpp though it is found in
X86InstrInfo.td. Should I use it in form of X86::LEAVE? I would appreciate
it if anyone could help me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160324/8b4212f1/attachment.html>


More information about the llvm-dev mailing list