Last Updated: February 25, 2016
·
1.532K
· parvizp

Displaying LLVM GraphViz Graphs on Mac

A nice debugging feature when developing LLVM backends is to display the various intermediate graphs visually. The static compiler 'llc' allows you to do this using one of the following flags:

-view-dag-combine1-dags displays the DAG after being built, before the first optimization pass.
-view-legalize-dags displays the DAG before Legalization.
-view-dag-combine2-dags displays the DAG before the second optimization pass.
-view-isel-dags displays the DAG before the Select phase.
-view-sched-dags displays the DAG before Scheduling.

However, the graphviz binaries built with Mac Ports draws graphs that are difficult to read and have visual artifacts. Using the GraphViz GUI viewer fixes this. First, install the package:
http://www.graphviz.org/Download_macos.php

Then edit your CMakeCache.txt to replace the dotty binary:

...
//Path to a program.
//LLVM_PATH_DOT:FILEPATH=/opt/local/bin/dot
LLVM_PATH_DOT:FILEPATH=/Applications/Graphviz.app/Contents/MacOS/Graphviz
...

2 Responses
Add your response

Hi, I am install LLVM via brew, Could u plz tell where is the CMakeCache.txt?

over 1 year ago ·

This is intended for doing LLVM development (i.e. creating a new backend). If you intend to do LLVM development, instead of using 'brew' to compile and install the binaries, just directly checkout the LLVM source, then you will see the CMakeCache.txt file.

over 1 year ago ·