<div>Judging from the documentation, I'd say yes.</div><div>You can use intrinsics by importing them first using Intrinsics::getType and Intrinsics::lookupLLVMIntrinsicsByName I think. Then just call them like any other function. You might need to take special care with inline attributes and whatnot though</div><div><br></div><div>Zhang</div><div><includetail><div> </div><div style="font:Verdana normal 14px;color:#000;"><div style="FONT-SIZE: 12px;FONT-FAMILY: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div style="FONT-SIZE: 12px;background:#efefef;padding:8px;"><div id="menu_sender"><b>From: </b> "PenYiWang via llvm-dev"<llvm-dev@lists.llvm.org>;</div><div><b>Date: </b> Wed, Sep 5, 2018 10:16 AM</div><div><b>To: </b> "llvm-dev"<llvm-dev@lists.llvm.org>; <wbr></div><div></div><div><b>Subject: </b> [llvm-dev] How to get return address at llvm ir level?</div></div><div> </div><div style="position:relative;"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi<div><br></div><div>I want to write a FunctionPass to insert some code before return.</div><div><br></div><div>Funcion:</div><div>..</div><div>..</div><div>..</div><div>mov eax,[esp]</div><div>cmp eax,0x12345678</div><div>je 0x12345678</div><div>ret</div><div>(maybe stack will not balance)</div><div><br></div><div>I wonder that can I get the return address at llvm ir level?</div><div><br></div><div>I use IRBuilder to CreateICmpEQ and CreateCondBr.</div><div><br></div><div>but I don't how to get the value of return addrss.</div><div><br></div><div>I have found there is a  Intrinsic::returnaddress.<br></div><div><br></div><div>Is Intrinsic::returnaddress can help me?</div><div><br></div><div>I don't konw how to use Intrinsic::returnaddress because few files use this intrinsic.</div><div><br></div><div>Thanks</div><div><br></div><div><br></div></div></div></div></div></div></div></div>

</div></div><!--<![endif]--></includetail></div>