<div dir="ltr">Dear all,<div><br></div><div><br></div><div>I'm writing an LLVM pass, and I want to insert a call instruction that takes a function pointer as a parameter. The effect would be the same as following:</div><div><br></div><div>atexit(foo);</div><div><br></div><div>Where foo is a function I insert with M.getOrInsertFunction(), which in LLVM is a Function class.</div><div><br></div><div>I searched for a while and did not come up with a satisfying answer. Should I create a Value class of pointer type, or a Int64Ty for a pointer? How do I get the pointer to the function I create? I also tried passing foo as Function* in LLVM as parameter to create CallInst directly, and I doesn't seem to work.</div><div><div><br></div><div>Any hints and enlightenment is appreciated. Many thanks.</div><div><br></div><div><br></div>Regards,<br><div class="gmail_signature"><div dir="ltr">Yours,<div>Kevin Hu</div></div></div>
</div><img src="http://t.signalecinque.com/e1t/o/5/f18dQhb0S7ks8dDMPbW2n0x6l2B9gXrN7sKj6v5dj0qW64JvZH6538V-MdV5ZMQFLCHW2swVb-1k1H6H0?si=5235970534801408&pi=e09ba43a-17ec-4fb1-826d-8dcbc262b7ec" width="1" height="1" style="display:none"></div>