On Fri, 2012-08-03 at 13:21 -0500, Amin Farmahini wrote:
Hi All,
Hi. Sorry about the belated response.
The Gimple representation of GCC provides some data flow analysis
for
each basic block in the SSA (Static Single Assignment) form. One could
see the data dependencies (which I think are called flow-dependence
edges) in gimple form. I would like to take Gimple as input and
generate a data flow graph for basic blocks. The example shown on the
website shows how to generate control flom graph using "show-ssa.py."
Yes, this code is ultimately a wrapper around some code in gccutils.py
which generates a "dot" file for input to graphviz, using the html-like
syntax. Potentially you could use this code as a starting point for
creating the visualization you want (or maybe subclass it?).
[Minor rant follows: Be warned that I've had no end of problems in
dealing with this format: it's *not* html, merely something that looks
like it, and graphviz doesn't generate helpful error messages when it's
unhappy with the input, and the precise format isn't well-documented.
So I've learned the hard way whenever I've worked with it to make one
small change at a time when tweaking the output.]
However, it does not visualize the data dependencies in each basic
block. I need to visualize the data dependence in order to analyze the
data flow in each basic block in form of a data flow graph. By data
flow graphs I mean graphs in which nodes in the graph represent
operations like addition and multiplication, and edges represent data
dependence between nodes. I was wondering if there is already such a
plugin? Or it would be great if you could provide some advice on how
to write such a pass.
AFAIK no-one's yet written such a script. But it sounds do-able, and it
would be interesting to see the results.
You could perhaps use the gccutils.DotPrettyPrinter class; this has some
handy methods for escaping text and the like to the dot format. Then
loop through the blocks and statements and emit nodes and edges as
desired.
Hope this is helpful, sorry again for the belated response
Dave