[LLVMdev] CFG Customization

Sanjoy Das sanjoy at playingwithpointers.com
Thu Mar 12 14:14:27 PDT 2015


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