skip to main content
article
Open Access

A fast algorithm for finding dominators in a flowgraph

Published:01 January 1979Publication History
Skip Abstract Section

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.

References

  1. 1 ACKERMA~N, W. Zum Hilbertschen Aufbau der reellen Zahlen. Math. Ann. 99 (1928), 118-133.Google ScholarGoogle Scholar
  2. 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 ScholarGoogle Scholar
  3. 3 Axo, A.V., AND ULLMAS, J.D. Principles of Compiler Design. Addison-Wesley, Reading, Mass., 1977.Google ScholarGoogle Scholar
  4. 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 ScholarGoogle Scholar
  5. 5 K~uTH, D.E. The Art of Computer Programming, Vol. 1: Fundamental Algorithms. Addison- Wesley, Reading, Mass., 1968. Google ScholarGoogle Scholar
  6. 6 LORRY, E.S., ASr) MSOLOCK, C.W. Object code optimization. Comm. ACM/2, I (Jan. 1969), 13- 22. Google ScholarGoogle Scholar
  7. 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 ScholarGoogle Scholar
  8. 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 ScholarGoogle Scholar
  9. 9 TARJA~, R.E. Depth-first search and linear graph algorithms. SIAM J. Comptng. I (1972), 146- 160.Google ScholarGoogle Scholar
  10. 10 TARJA~, R. Finding dominators in directed graphs SIAM J. Comptng. 3 (1974), 62-89.Google ScholarGoogle Scholar
  11. 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 ScholarGoogle Scholar
  12. 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 ScholarGoogle Scholar
  13. 13 TARJAN, R.E. Solving path problems on directed graphs. Tech. Rep. STAN-CS-528, Comptr. Sci. Dept., Stanford U., Stanford, Calif., 1975. Google ScholarGoogle Scholar
  14. 14 TARJAN, R.E. Applications of path compression on balanced trees. To appear in J. ACM. Google ScholarGoogle Scholar

Index Terms

  1. A fast algorithm for finding dominators in a flowgraph

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM Transactions on Programming Languages and Systems
        ACM Transactions on Programming Languages and Systems  Volume 1, Issue 1
        July 1979
        153 pages
        ISSN:0164-0925
        EISSN:1558-4593
        DOI:10.1145/357062
        Issue’s Table of Contents

        Copyright © 1979 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 1 January 1979
        Published in toplas Volume 1, Issue 1

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader