Arnamoy Bhattacharyya
2013-Oct-30 17:22 UTC
[LLVMdev] Setting called value for an indirect function call
Hello; I am trying to clone some call instructions in the IR and then set the call destination of those call instructions to my own library functions that happens to have the same arguments and return types of the original callee. It works perfectly for direct calls using setCalledFunction(). But when the function call is indirect, is there a way to set the callee? Something like setCalledValue()? How do I achieve this? Any help will be appreciated, thanks a lot! -- Arnamoy Bhattacharyya Athabasca Hall 143 Department of Computing Science - University of Alberta Edmonton, Alberta, Canada, T6G 2E8 587-710-7073
John Criswell
2013-Oct-30 18:03 UTC
[LLVMdev] Setting called value for an indirect function call
On 10/30/13 12:22 PM, Arnamoy Bhattacharyya wrote:> Hello; > > I am trying to clone some call instructions in the IR and then set the > call destination of those call instructions to my own library > functions that happens to have the same arguments and return types of > the original callee. > > It works perfectly for direct calls using setCalledFunction(). But > when the function call is indirect, is there a way to set the callee? > Something like setCalledValue()? How do I achieve this? > > Any help will be appreciated, thanks a lot! >Try the setCalledFunction() method of CallInst. Despite the name, it looks like it takes a generic Value *, which means it should be able to set the called function operand to either a Function * or to a computed, indirect value (e.g., a Value *). -- John T.
Seemingly Similar Threads
- [LLVMdev] "symbol lookup error" while running a Simple Loop Pass
- [LLVMdev] "symbol lookup error" while running a Simple Loop Pass
- [LLVMdev] Identifying the instructions that uses a pointer used as a function argument
- [LLVMdev] Get the filename on which a pass is running?
- [LLVMdev] Adding a New Instruction to LLVM IR