[LLVMdev] Graphviz and LLVM-TV

Ioannis Nousias ioannis.nousias at googlemail.com
Sun Sep 6 07:30:36 PDT 2009


I've tried to write a DFGPrinter based on the CFGPrinter, as you 
suggested, but encountered problems.

The GraphWriter expects 
GraphTraits<GraphType>::nodes_begin()/nodes_end(). The way this is 
implemented in CFG.h, a function is a graph of basic blocks. A 
GraphTraits<Function*>  inherits from GraphTraits<BasicBlock*>, and 
implements those nodes_begin()/nodes_end() wrapper functions. Should I 
modify CFG.h and make now BasicBlock a graph of Instruction(s) ?

The DataFlow.h deals with Value and User. Now BasicBlock is derived from 
Value and Instruction from User, but I don't understand how that helps.

It's a bit confusing to be honest. Can you help?

thanks,
Ioannis


Tobias Grosser wrote:
> Hi Ioannis,
>
> On Thu, 2009-08-13 at 19:31 +0100, Ioannis Nousias wrote: 
>   
>> Thanks Tobi for the tip.
>>
>> however I also need the Data-Flow-Graph of each basic block/functions. 
>> As I said, I need a view of how the instructions 'link' to each other 
>> (via registers or memory aliasing or whatnot)
>>     
>
>
> I believe that there is not yet a DOT printer for this kind of
> information.
>
> grep DOTGraphTraits -R *
>
> should give you all data types, for which dot printing is implemented,
> and the data flow does not seem to exist. However there is already a
> graph representation of the data flow information in
> "include/llvm/Support/DataFlow.h":
>
> -------------------------------------------------------------------------
> This file defines specializations of GraphTraits that allows Use-Def and
> Def-Use relations to be treated as proper graphs for generic algorithms.
> -------------------------------------------------------------------------
>
> It should be easy to write the DOTPrinter for this data type. You can
> take the CFGPrinter as reference.
>
> Tobi
>
>
>   




More information about the llvm-dev mailing list