clang/llvm can generate graphic dot files .
Example:
clang -S -emit-llvm -o hello.ll hello.cpp opt hello.ll -dot-cfg -o hello.dot
This will produce multiple .dot files, one for each function defined in hello.cpp . You can also generate a dominance graph, a post-dominance graph, etc. (See here ).
Once you have the .dot files, you can use dot to convert it to a .png file. The .dot file itself contains only the graph structure, so the dot output should be very customizable (but I am not very familiar with it).
source share