<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>