[LLVMdev] New 'analyze' pass for printing CFG as a graph

Chris Lattner sabre at nondot.org
Mon Oct 7 14:06:01 PDT 2002

I just checked in a new analyze pass that may be useful for people...
which converts the CFG of a function into a graph for easy printing or
visualization.  Since I thought this might be useful for other people
using LLVM, I thought I'd tell you all about it.

Basically do this:
analyze -print-cfg foo.bc

This will cause a bunch of 'dot' files to be written to the disk (one for
each function).  Using the 'dot' tool
(http://www.research.att.com/sw/tools/graphviz/), you can convert these to
a variety of formats, including postscript.  Just do:

dot -Tps < cfg.main.dot > cfg.main.ps

to make a postscript file out of the CFG for 'main'.  If you're on our
research machines, you can use my install of dot, which is here:

Have fun,



More information about the llvm-dev mailing list