[LLVMdev] CFG of a function

Alexandru Ionut Diaconescu alexandruionutdiaconescu at gmail.com
Sat Jun 8 00:27:45 PDT 2013


But I don't want to map only basic blocks, I need too to map the edges "the
whole CFG of the function"
*Yes. First you create simple methods to create an integer graph and to
addEdge. Then, two types of edges: between basic blocks inside a function
(you can use LLVM succesors) and between functions (use Call/Return/ and
identify the pairs (Callee/Caller), so you can add edges between the
correspondent basic blocks from different functions.*
Save the CFG of the function in another memory address and call it for
example orgCFG and change the CFG by referencing to the orgCFG
*So first make all the changes on orgCFG (the integers CFG) and then, in
another transformation pass: modify your old CFG (by removing./adding,
which I don't recommand) or add metadata (keeps information about the
changes you want to make, but you don't actually make)*
Thank you for help and patience
*Good luck !*


On Fri, Jun 7, 2013 at 10:43 PM, Rasha Omar <rasha.sala7 at gmail.com> wrote:

> But I don't want to map only basic blocks, I need too to map the edges
> "the whole CFG of the function"
> Save the CFG of the function in another memory address and call it for
> example orgCFG and change the CFG by referencing to the orgCFG
> Thank you for help and patience
>
>
> On 6 June 2013 10:59, Alexandru Ionut Diaconescu <
> alexandruionutdiaconescu at gmail.com> wrote:
>
>> I don't use a function for do the mapping, it may be MapValue(). If it
>> does not work, alias an int identifier for each basic block. Be aware
>> because basic block cannot have the same name (getName) in the same
>> function, but they might have the same name being in different functions.
>> Therefore, take into account the function name as well.
>>
>> Good luck
>>
>>
>> On Thu, Jun 6, 2013 at 10:55 AM, Rasha Omar <rasha.sala7 at gmail.com>wrote:
>>
>>> I think I understood that, but what I mean is what is the function
>>> responsible to do mapping is it MapValue() in ValueMapper.h?
>>>
>>> Thanks for your help
>>>
>>>
>>>
>>> On 6 June 2013 09:54, Alexandru Ionut Diaconescu <
>>> alexandruionutdiaconescu at gmail.com> wrote:
>>>
>>>> Map every basic block from the CFG to a set of integers. The successors
>>>> from the CFG can be used to make the edges in your simplified graph. The
>>>> pair (Callee,Caller) can link the CFG-s between them in a larger CFG-like.
>>>>
>>>>
>>>> On Wed, Jun 5, 2013 at 11:03 PM, Rasha Omar <rasha.sala7 at gmail.com>wrote:
>>>>
>>>>> What do you mean by mapping to integers?
>>>>>
>>>>>
>>>>> On 5 June 2013 22:32, Alexandru Ionut Diaconescu <
>>>>> alexandruionutdiaconescu at gmail.com> wrote:
>>>>>
>>>>>> Why you don't map the basic blocks to integers and apply algorithms
>>>>>> on the integer graph? And construct your new CFG.
>>>>>>
>>>>>>
>>>>>> On Wed, Jun 5, 2013 at 10:27 PM, Rasha Omar <rasha.sala7 at gmail.com>wrote:
>>>>>>
>>>>>>> How could I keep the function CFG in another memory space.
>>>>>>> I want to be able to change one of the old CFG , but keeping the
>>>>>>> original one in another space.
>>>>>>> Thanks
>>>>>>>
>>>>>>> --
>>>>>>> *Rasha Salah Omar
>>>>>>> Msc Student at E-JUST
>>>>>>> Demonestrator  at Faculty of Computers and Informatics
>>>>>>> Benha University
>>>>>>> *
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> LLVM Developers mailing list
>>>>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>> Alexandru Ionut Diaconescu
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Rasha Salah Omar
>>>>> Msc Student at E-JUST
>>>>> Demonestrator  at Faculty of Computers and Informatics
>>>>> Benha University
>>>>> *
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>> Alexandru Ionut Diaconescu
>>>>
>>>
>>>
>>>
>>> --
>>> *Rasha Salah Omar
>>> Msc Student at E-JUST
>>> Demonestrator  at Faculty of Computers and Informatics
>>> Benha University
>>> *
>>>
>>
>>
>>
>> --
>> Best regards,
>> Alexandru Ionut Diaconescu
>>
>
>
>
> --
> *Rasha Salah Omar
> Msc Student at E-JUST
> Demonestrator  at Faculty of Computers and Informatics
> Benha University
> *
>



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


More information about the llvm-dev mailing list