[llvm-dev] How to get return address at llvm ir level?
PenYiWang via llvm-dev
llvm-dev at lists.llvm.org
Tue Sep 4 19:16:44 PDT 2018
Hi
I want to write a FunctionPass to insert some code before return.
Funcion:
..
..
..
mov eax,[esp]
cmp eax,0x12345678
je 0x12345678
ret
(maybe stack will not balance)
I wonder that can I get the return address at llvm ir level?
I use IRBuilder to CreateICmpEQ and CreateCondBr.
but I don't how to get the value of return addrss.
I have found there is a Intrinsic::returnaddress.
Is Intrinsic::returnaddress can help me?
I don't konw how to use Intrinsic::returnaddress because few files use this
intrinsic.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180905/6b40c861/attachment.html>
More information about the llvm-dev
mailing list