diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2014-04-17 21:00:08 +0200 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-15 13:50:42 -0700 |
| commit | aaf398f26a5eabbc89f28abcb79b4778be9e74a6 (patch) | |
| tree | c25c990aa95e7bb0c8e3622105f26faef2802d6d /src/rustllvm/RustWrapper.cpp | |
| parent | 65b65fe4480eef5ed1cd755db00217913706ea21 (diff) | |
| download | rust-aaf398f26a5eabbc89f28abcb79b4778be9e74a6.tar.gz rust-aaf398f26a5eabbc89f28abcb79b4778be9e74a6.zip | |
Graphviz based flow graph pretty-printing.
Passing `--pretty flowgraph=<NODEID>` makes rustc print a control flow graph. In pratice, you will also need to pass the additional option: `-o <FILE>` to emit output to a `.dot` file for graphviz. (You can only print the flow-graph for a particular block in the AST.) ---- An interesting implementation detail is the way the code puts both the node index (`cfg::CFGIndex`) and a reference to the payload (`cfg::CFGNode`) into the single `Node` type that is used for labelling and walking the graph. I had once mistakenly thought that I only wanted the `cfg::CFGNode`, but for labelling, you really want the cfg index too, rather than e.g. trying to use the `ast::NodeId` as the label (which breaks down e.g. due to `ast::DUMMY_NODE_ID`). ---- As a drive-by fix, I had to fix `rustc::middle::cfg::construct` interface to reflect changes that have happened on the master branch while I was getting this integrated into the compiler. (The next commit actually adds tests of the `--pretty flowgraph` functionality, so that should ensure that the `rustc::middle::cfg` code does not go stale again.)
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
