Hello Shawn,<div><br></div><div>I've just implemented something similar. It might be horribly wrong to do it this way, but at least it works for me :-)</div><div><br></div><div>Here's what I do:</div><div><br></div>
<div>* Rename your function "haha" -> "haha_" to avoid name collisions in the next step;</div><div>* Get its function type and modify to suite your needs: add new parameters, change types, whatever;</div>
<div>* Create new function named "haha" with that signature;</div><div>* Relink all basic blocks from original function to the new one. Now "haha_" is empty, but you can't delete it yet;<br>* Iterate over all modules/functions that reference your original function and replace call instructions to match new signature;</div>
<div>* Delete "haha_" function.</div><div><br></div><div>I'm no LLVM expert by any means, so take this with a grain of salt..</div><div><br></div><div>- Yury</div>