[LLVMdev] CallGraph

Alexandru Ionut Diaconescu alexandruionutdiaconescu at gmail.com
Fri Apr 26 04:26:28 PDT 2013


Thank you !


On Fri, Apr 26, 2013 at 1:24 PM, Duncan Sands <baldrick at free.fr> wrote:

> Hi,
>
>
> On 26/04/13 13:17, Alexandru Ionut Diaconescu wrote:
>
>> Thanks for the response.
>> I looked and I cannot see what exactly I need. I saw getCalledFunction()
>> so I
>> need CallSite CS(cast<Value>(II)) where II is a basic block iterator, so
>> an
>> instruction. It seems not easier than the "unelegant" version....if I am
>> still
>> at the Instruction level...
>>
>
> the call graph gives you a graph where the nodes are functions, and there
> is an
> edge from function F to function G if function F calls function G.
>
>
>
>> I need a method that takes from a "leaf" basic block from a function
>> (Maybe
>> there is the possibility not to have only one "end" basic block) the
>> connection
>> with an entry basic block of another function.
>>
>
> Most functions don't end in a call to another function, they end by
> returning
> control to the function that called them.
>
> Ciao, Duncan.
>
>
>> Thank you !
>>
>>
>>
>> On Fri, Apr 26, 2013 at 1:04 PM, Duncan Sands <baldrick at free.fr
>> <mailto:baldrick at free.fr>> wrote:
>>
>>     Hi,
>>
>>
>>     On 26/04/13 11:19, Alexandru Ionut Diaconescu wrote:
>>
>>         Hello,
>>
>>         I try to make a big CFG (control flow graph) by combining all the
>> CFG-s
>>         from all
>>         the functions of a module. I still have one problem : I want to
>> get the
>>         links
>>         between functions.
>>
>>         For CFG-s, I used CallGraphNode->second->__**getFunction, then
>>
>>         Function_iterators
>>         and succ_iterators, so I have all the links between BBs. Now, the
>>         questions is
>>         how do I link BBs from different functions?
>>
>>         I can do it in a way not so elegant. Take the last BB of every
>> function,
>>         then
>>         getTerminator and see that function it is called and then link to
>>         (instruction-2-instruction).
>>
>>
>>     calls don't have to be terminators, so that wouldn't work properly
>> anyway.
>>
>>
>>
>>         There must be there a better way to get the linkage between BBs
>> that are in
>>         different functions.
>>
>>
>>     Sure, take a look at include/llvm/Analysis/__**CallGraph.h
>>
>>     Ciao, Duncan.
>>     ______________________________**___________________
>>     LLVM Developers mailing list
>>     LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>
>> http://llvm.cs.uiuc.edu
>>     http://lists.cs.uiuc.edu/__**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/__mailman/listinfo/llvmdev>
>>
>>     <http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>
>> >
>>
>>
>>
>>
>> --
>> Best regards,
>> Alexandru Ionut Diaconescu
>>
>
>


-- 
Best regards,
Alexandru Ionut Diaconescu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130426/68cf3af1/attachment.html>


More information about the llvm-dev mailing list