diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-05-03 17:40:26 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-03 17:40:26 -0700 |
| commit | 494330d4941ccaf50e07ef309fd783c2f44a492e (patch) | |
| tree | c8957f32c1d2740aee42acbad5675a34c1a9b47e /tools/render-test/render.h | |
| parent | 00afea1e59e8929324df882009618534d3065138 (diff) | |
Add a pass for computing dominator trees (#541)
This code is currently not used by anything, but I wanted to check in a first pass at an implementation of dominator tree construction so that we don't have to keep avoiding implementing algorithms that rely on having dominator information available.
The algorithm used to construct the dominator tree is taken from "A Simple, Fast Dominance Algorithm" by Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy.
This is not the "best" algorithm in terms of asymptotic performance, but it is among the simplest algorithms for computing a dominator tree that still outperforms naive iterative set-based methods.
The actual data structure and API for the dominator tree has a bit of "cleverness" in it to try to make the common queries reasonably fast (e.g., you can check whether A dominates B in constant time).
My hope is that even if we implement a more advanced algorithm for constructing the dominator tree, we can retain compatibility with passes that might make use of this API.
Because no code is currently using this logic, I have done only minimal testing by stepping through this code and validating the results on paper for some very small CFGs.
More serious testing/debugging may need to wait until we have an optimization pass that needs the dominator tree we compute here.
One open question I have is how best to introduce traditional unit testing into Slang, since this is an example of code that would benefit greatly from being unit tested.
Diffstat (limited to 'tools/render-test/render.h')
0 files changed, 0 insertions, 0 deletions
