Abstract
A fast algorithm for finding dominators in a flowgraph is presented. The algorithm uses depth-first search and an efficient method of computing functions defined on paths in trees. A simple implementation of the algorithm runs in O(m log n) time, where m is the number of edges and n is the number of vertices in the problem graph. A more sophisticated implementation runs in O(mα(m, n)) time, where α(m, n) is a functional inverse of Ackermann's function.
Both versions of the algorithm were implemented in Algol W, a Stanford University version of Algol, and tested on an IBM 370/168. The programs were compared with an implementation by Purdom and Moore of a straightforward O(mn)-time algorithm, and with a bit vector algorithm described by Aho and Ullman. The fast algorithm beat the straightforward algorithm and the bit vector algorithm on all but the smallest graphs tested.
- 1 ACKERMA~N, W. Zum Hilbertschen Aufbau der reellen Zahlen. Math. Ann. 99 (1928), 118-133.Google Scholar
- 2 AMo, A.V., A~D ULLMA~q, J.D. The Theory of Parsing, Translation, and Compiling, Vol. II: Compiling. Prentice-Hall, Englewood Cliffs, N.J., 1972. Google Scholar
- 3 Axo, A.V., AND ULLMAS, J.D. Principles of Compiler Design. Addison-Wesley, Reading, Mass., 1977.Google Scholar
- 4 HEcuT, M.S., ANo ULLMAS, J.D. A simple algorithm for global data flow analysis problems. SIAM J. Comput. 4 (I973), 519-532.Google Scholar
- 5 K~uTH, D.E. The Art of Computer Programming, Vol. 1: Fundamental Algorithms. Addison- Wesley, Reading, Mass., 1968. Google Scholar
- 6 LORRY, E.S., ASr) MSOLOCK, C.W. Object code optimization. Comm. ACM/2, I (Jan. 1969), 13- 22. Google Scholar
- 7 PURDOM, P.W., AND MOORE, E.F. Algorithm 430: Immediate predominators in a directed graph. Comm. ACM 15, 8 (Aug. 1972), 777-778. Google Scholar
- 8 REIF, J. Combinatorial aspects of symbolic program analysis. Tech. Rep. TR-11-77, Center for Research in Computing Technology, Harvard U., Cambridge, Mass., 1977.Google Scholar
- 9 TARJA~, R.E. Depth-first search and linear graph algorithms. SIAM J. Comptng. I (1972), 146- 160.Google Scholar
- 10 TARJA~, R. Finding dominators in directed graphs SIAM J. Comptng. 3 (1974), 62-89.Google Scholar
- 11 TARJAN, R.E. Edge-disjoint spanning trees, dominators, and depth-first search. Tech. Rep. STAN-CS-74-455, Comptr. Sci. Dept., Stanford U., Stanford, Calif., 1974. Google Scholar
- 12 TARJAN, R.E. Applications of path compression on balanced trees. Tech. Rep. STAN-CS-75-512, Comptr. Sci. Dept., Stanford U., Stanford, Calif., 1975. Google Scholar
- 13 TARJAN, R.E. Solving path problems on directed graphs. Tech. Rep. STAN-CS-528, Comptr. Sci. Dept., Stanford U., Stanford, Calif., 1975. Google Scholar
- 14 TARJAN, R.E. Applications of path compression on balanced trees. To appear in J. ACM. Google Scholar
Index Terms
- A fast algorithm for finding dominators in a flowgraph
Recommendations
Finding dominators revisited: extended abstract
SODA '04: Proceedings of the fifteenth annual ACM-SIAM symposium on Discrete algorithmsThe problem of finding dominators in a flowgraph arises in many kinds of global code optimization and other settings. In 1979 Lengauer and Tarjan gave an almost-linear-time algorithm to find dominators. In 1985 Harel claimed a linear-time algorithm, but ...
A fast algorithm for finding common multiple-vertex dominators in circuit graphs
ASP-DAC '05: Proceedings of the 2005 Asia and South Pacific Design Automation ConferenceIn this paper we present a fast algorithm for computing common multiple-vertex dominators in circuit graphs. Dominators are widely used in CAD applications such as satisfiability checking, equivalence checking, ATPG, technology mapping, decomposition of ...
A new, simpler linear-time dominators algorithm
We present a new linear-time algorithm to find the immediate dominators of all vertices in a flowgraph. Our algorithm is simpler than previous linear-time algorithms: rather than employ complicated data structures, we combine the use of microtrees and ...
Comments