Thanks John.
I guess I will use a ModulePass, so when I am implementing the “runOnModule”
function,
do I have to loop through all the functions, for each functions all the
BasicBlocks and for each BasicBlock all the instructions
or given the Module I have to call the CallGraph directly?
Is there an example out there? I can’t find anything.
Thanks.
Simone
> On Feb 24, 2015, at 13:29, John Criswell <jtcriswel at gmail.com>
wrote:
>
> On 2/24/15 2:27 PM, Simone Atzeni wrote:
>> Hi all,
>>
>> I would like to create a Pass that given an IR instruction walks
starting from that instruction up to the main function
>> to identify all the functions call that have been made to call that
instruction.
>>
>> Is it possible? What kind of Pass should I create?
>
> Yes, it is possible. I think a ModulePass would be most appropriate,
though a FunctionPass may be alright.
>
> To get the call graph, you can use LLVM's CallGraph analysis. If you
need to handle function pointers more accurately than LLVM's internal
CallGraph analysis does, you can use DSA's CallGraph analysis (which has the
same interface but may only work with LLVM 3.2 and earlier LLVM releases).
>
> -- John T.
>
>>
>> Thanks
>> Best,
>> Simone
>>
>> Simone Atzeni
>> simone.at at gmail.com
>> +1 (801) 696-8373
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
> --
> John Criswell
> Assistant Professor
> Department of Computer Science, University of Rochester
> http://www.cs.rochester.edu/u/criswell
>