I am writing a llvm pass which inserts some code in a function. In code generation, I want to insert code for a function call. But for this, I need to get function object from list of functions available with Module. When I try to get the function object by specifying function name, it returns null. I suppose this happens because clang removes function prototypes if the function is not called in source file. Is there any way to retain the function prototypes in clang?? Or is there a way to get it during llvm pass?? -- Regards, Rahul Patil. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121025/28399d84/attachment.html>
Hi Rahul, On 25/10/12 11:51, Rahul wrote:> I am writing a llvm pass which inserts some code in a function. > In code generation, I want to insert code for a function call. But for this, I > need to get function object from list of functions available with Module. > When I try to get the function object by specifying function name, it returns null. > I suppose this happens because clang removes function prototypes if the function > is not called in source file. > Is there any way to retain the function prototypes in clang?? > Or is there a way to get it during llvm pass??if you want to mark a function as being used, to prevent the compiler eliminating it, give it the "used" attribute, __attribute__((used)). Ciao, Duncan.
Apparently Analagous Threads
- [LLVMdev] Get underlying object for Machine level memory operation
- [LLVMdev] Get underlying object for Machine level memory operation
- [LLVMdev] Dependence Analysis on Machine code
- [LLVMdev] Dependence Analysis on Machine code
- [LLVMdev] AESOP autoparallelizing compiler