SelectionDAG debug output

Hello all,

I am currently working with LLVM and make use of the debug output from llc. The SelectionDAG dumping features are especially interesting to me since I am looking for operation patterns that allow me to decide which custom instructions can be added to a processor in order to improve the performance.

Providing a -view-dag-combine1-dags option (and its friends) to llc show the SelectionDAG nicely in a viewer. I was wondering about the reasoning behind this behavior.

In my case it would be much more useful to just get the DOT files of these graphs in either the current location, or optionally at some user specified location. That way I can decide myself what to do with them, I could just open them in a dot viewer if I want to have a look at them and I can load them into some other tools if I am just interested in getting the SelectionDAG into a different format.

I would like to propose the following change:

- Adding an option that selects between viewing or dumping the SelectionDAG graphs
- Adding an option that allows to set the output directory

And optionally, if we were to argue that dumping graphs could be the default over viewing:

- Renaming the existing -view-dag-... options (listed at [1]) to -dump-dag-...

I would like to hear your opinions on this.

Kind regards,


The dot file should be dumped to your temp directory before the view is invoked, but the file is deleted afterwards.

If you look here:

You can comment out Filename.eraseFromDisk() and the dot file will be saved in the temp folder after viewing.