[LLVMdev] CFG Customization

Thomas Rubiano rubiano at lipn.univ-paris13.fr
Fri Mar 13 02:53:58 PDT 2015


Hi,

thank for your advice.

This is what I've already done for testing.

I thought there is a better way to do that using LLVM structures.
The goal is to reuse some functionalities offers by GraphTraits<NodeType>.
For instance, I would use GraphWriter, DOTGraphTraits etc... to see my 
graph.

I want to do it very properly, I think a hashtable will not be enough, 
right ?

Sorry again if I was not clear ...

Regards

Le 12/03/2015 22:14, Sanjoy Das a écrit :
> Why not have a hastable mapping llvm::BasicBlock pointers to whatever
> metadata you want to track per block?
>
> On Thu, Mar 12, 2015 at 7:53 AM, rubiano <rubiano at lipn.univ-paris13.fr> wrote:
>> Hi John, thank you for your answer.
>>
>> Sorry if I was not clear ^^'
>>
>> I try to build a RCG (Resource Control Graph) which is a CFG with a weight.
>> In my case, this weight corresponds to the number of heap allocations.
>> Then I want to add this weight to each node (then basic block) of this
>> graph.
>>
>> I think that a CFG is a GraphTraits<BasicBlock*> then I suppose that this
>> RCG will be
>> a GraphTraits<MyBasicBlock*>
>> "MyBasicBlock" can be an object like BasicBlock with a weight. (inherited or
>> not?)
>>
>> I think that with this kind of graph it will be easier to detect "non size
>> increasing"
>> functions or loops.
>>
>> My question is : what is the best way to build this graph ?
>>
>> Thanks again,
>>
>> Thomas
>>
>> Le 2015-03-12 15:12, John Criswell a écrit :
>>
>>> Dear Thomas,
>>>
>>> If you can describe more clearly what you are trying to accomplish, it
>>> would help people give better advice.  As I don't have a clear idea of
>>> what you're trying to do, I can't explain the best way to do it.
>>>
>>> Regards,
>>>
>>> John Criswell
>>>
>>>
>>> On 3/12/15 12:41 PM, rubiano wrote:
>>>> Hi all,
>>>>
>>>> I'm discovering LLVM and I want to build a customized CFG with customized
>>>> nodes (here BasicBlocks).
>>>> Simply, the purpose is to enrich CFG with some other informations.
>>>> What is the best way to do that ?
>>>>
>>>> Please, tell me if I'm wrong (I'm not familiar enough with c++) but I
>>>> understand that :
>>>> - CFG is a GraphTraits<BasicBlock*>
>>>> - it's not allowed to inherit from BasicBlock (never seen in the project)
>>>>
>>>> Maybe it's better to create a new class (like MachineBasicBlock) that
>>>> contains a pointer to its BasicBlock ?
>>>> But this option requires to rewrite similar lines of code, right ?
>>>>
>>>> Thanks,
>>>>
>>>> Thomas
>>>>
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list