Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article
Open access

Improvements to graph coloring register allocation

Published: 01 May 1994 Publication History
  • Get Citation Alerts
  • Abstract

    We describe two improvements to Chaitin-style graph coloring register allocators. The first, optimistic coloring, uses a stronger heuristic to find a k-coloring for the interference graph. The second extends Chaitin's treatment of rematerialization to handle a larger class of values. These techniques are complementary. Optimistic coloring decreases the number of procedures that require spill code and reduces the amount of spill code when spilling is unavoidable. Rematerialization lowers the cost of spilling some values. This paper describes both of the techniques and our experience building and using register allocators that incorporate them. It provides a detailed description of optimistic coloring and rematerialization. It presents experimental data to show the performance of several versions of the register allocator on a suite of FORTRAN programs. It discusses several insights that we discovered only after repeated implementation of these allocators.

    References

    [1]
    ~ ANKLAM, P., CUTLER, D., HEINEN, R., JR., AND MACLAREN, M.D. 1982. Engineering a Cornptler: ~ VAX-11 Code Generatzon and Optzrnzzat~on. Digital Press, Bedford, Mass
    [2]
    ~ BERNSTEIN, D., GOLDIN, D. Q., GOLUMBIC, M. C, KRAWCZYK, H., MANSOUR, Y., NAHSHON, I., AND ~ PINTER, R.Y. 1989. Spill code minimization techniques for optimizing compilers. In Proceed- ~ ings of the ACM SIGPLAN 89 Conference on Programming Language Design and Implementa- ~ tion. SIGPLAN Not. 24, 7 (July), 258-263
    [3]
    ~ BRIGGS, P. 1992. Register allocation via graph coloring Ph.D. thesis, Dept. of Computer ~ Science, Rice Univ., Houston, Tex., Apr.
    [4]
    ~ BRIGGS, P., COOPER, K. D., AND TORCZON, L. 1992. Coloring register pmrs ACMLett. Program. ~ Lang. Syst. 1, 1 (Mar.), 3-13.
    [5]
    ~ CALLAHAN, D., AND KOBLENZ, B. 1991. Regaster allocation wa hierarchical graph coloring. In ~ Proceedings of the SIGPLAN 91 Conference on Programming Language Design and Implemen- ~ tatmn. SIGPLAN Not. 26, 6 (June), 192-203.
    [6]
    ~ CHAITIN, G.J. 1982. Register alloca,~ion and spilling via graph coloring. In Proceedings of the ~ ACM SIGPLAN 82 Symposmm ort Compiler Construction. SIGPLAN Not. 17. 6 (June), ~ 98-105.
    [7]
    ~ CHAITIN, G.J. 1986. Register allocal~lon and spilling via graph coloring. United States Patent ~ 4,571,678, Feb.
    [8]
    ~ CHAITIN, a. J., AUSLANDER, M. A., CRANDRA, A K, COOKE, J., HOPKINS, M. E., AND MARKSTEIN, ~ P.W. 1981. Register allocation via coloring. Comput. Lang. 6, 1 (Jan.), 47-57.
    [9]
    ~ CHOI, J.-D., CYTRON, Z., AND FERRANTE, J. 1991. Automatic constructmn of sparse data flow ~ evaluation graphs. In Conference Record of the 18th ACM Sympostum on Prznctples of ~ Programming Languages (Orlando, Fl., Jan. 21-23). ACM, New York, 55-66.
    [10]
    CHOW, F. C. AND HENNESSY, g. L. 1984. Register allocation by priority-based coloring. In ~ Proceedings of the ACM SIGPLAN 84 Symposium on Compiler Construction. SIGPLAN Not. ~19, 6 (June), 222-232.
    [11]
    CHOW, F. C., AND HENNESS~, J. L. 1990. The priority-based coloring approach to register ~allocation. ACM Trans. Program. Lang. Syst. 12, 4 (Oct.), 501-536.
    [12]
    COOPER, K. D., HALL, M. W., HOOD, R. T., KENNEDY, K., MCKINLEY, K., MELLOR-CRUMMEY, J., ~TORCZON, L., AND WARREN, S.K. 1993. The ParaScope parallel programming environment. ~Proc. IEEE 81, 2 (Feb.), 244-263.
    [13]
    CYTRON, R., FERRANTE, J., ROSEN, B. K., WEGMAN, M. N., AND ZADECK, F.K. 1991. Efficiently ~computing static single assignment form and the control dependence graph. ACM Trans. ~Program. Lang. Syst. 13, 4 (Oct.), 451-490.
    [14]
    ERSHOV, A.P. 1962. Reduction of the problem of memory allocation in programming to the ~problem of coloring the vertices of graphs. Doklady Akademii Nauk S.S.S.R. 142, 4, 785-787. ~(English translation in Soviet Math. 3, 1 (Jan. 1962), 163-165.)
    [15]
    ERSHOV, A.P. 1966. Alpha--An automatic programming system of high efficiency. J. ACM ~13, 1 (Jan.), 17-24.
    [16]
    FABRI, J. 1979. Automatic storage optimization. In Proceedings of the ACM SIGPLAN 79 ~Symposium on Compiler Construction. SIGPLAN Not. 14, 8 (Aug.), 83-91.
    [17]
    FISCHER, C. N., AND PROEBSTING, T.A. 1992. Probabilistic register allocation. In Proceedings of ~the SIGPLAN 92 Conference on Programming Language Design and Implementation. SIG- ~PLAN Not. 27, 7 (July), 300-311.
    [18]
    FORSYTHE, G. E., MALCOLM, M. A., AND MOLER, C.B. 1977. Computer Methods for Mathematl- ~cal Computations. Prentice-Hall, Englewood Cliffs, N.J.
    [19]
    FRASER, C. W., AND HANSON, D.R. 1991. A retargetable compiler for ANSI C. SIGPLAN Not. ~ 26, 10 (Oct.), 29-43.
    [20]
    FRASER, C. W., AND HANSON, D.R. 1992. Simple register spilling in a retargetable compiler. ~Softw. Pract. Exper. 22, 1 (Jan.), 85-99.
    [21]
    ~GAREY, M. R., AND JOHNSON, D.S. 1979. Computers and Intractabdtty: A Gutde to the Theory ~of NP - Completeness. W. H. Freeman, San Francisco, Calif.
    [22]
    ~GOLUB, G. H., AND REINSCH, C. 1971. Singular value decomposition and least squares solu- ~tions. In Handbook for Automatic Computation, J. H. Wilkinson and C. Reinsch, Eds. ~Springer-Verlag, New York.
    [23]
    ~GUPTA, R., SOFFA, M. L., AND STEELE, T. 1989. Register allocation via clique separators. In ~Proceedings of the ACM SIGPLAN 89 Conference on Programming Language Design and ~Implementation. SIGPLAN Not. 25, 7 (July), 264-274.
    [24]
    ~jOHNSON, M. S., AND MILLER, T.C. 1986. Effectiveness of a machine-level global optimizer. In ~Proceedings of the ACM SIGPLAN 86 Symposium on Compiler Construction. SIGPLAN Not. ~21, 7 (July), 99-108.
    [25]
    ~KENNEDY, K. 1971. Global flow analysis and register allocation for simple code structures. ~Ph.D. thesis, Courant Inst., New York Univ., New York, Oct.
    [26]
    ~LARUS, j. R., AND HmFINGER, P.N. 1986. Register allocation in the SPUR Lisp compiler. In ~Proceedings of the ACM SIGPLAN 86 Symposium on Compiler Construction. SIGPLAN Not. ~21, 7 (July), 255-263.
    [27]
    ~LAVROV, S.S. 1961. Store economy in closed operator schemes. J. Comput. Math. Math. Phys. ~1, 4, 687-701. (English translation in U.S.S.R. Comput. Math. Math. Phys. 1, 3 (1962), ~810-828.
    [28]
    ~MATULA, D. W., AND BECK, L. L. 1983. Smallest-last ordering and clustering and graph ~coloring algorithms. J. ACM 30, 3 (July), 417-427.
    [29]
    ~NICKERSON, B.R. 1990. Graph coloring register allocation for processors with multi-register ~operands. In Proceedings of the ACM SIGPLAN 90 Conference on Programming Language ~Design and Implementation. SIGPLAN Not. 25, 6 (June), 40-52.
    [30]
    ~SCHWARTZ, J.T. 1973. On programming: An interim report on the SETL project, Installment ~II: The SETL language and examples of its use. Tech. Rep., Courant Inst., New York Univ., ~New York, Oct.
    [31]
    ~SPEC. 1990. Release 1.2, Standards Performance Evaluation Corp., Freemont, Calif., Sept.
    [32]
    ~WEGMAN, M. N., AND ZADECK, F.K. 1991. Constant propagation with conditional branches. ~ACM Trans. Program. Lang. Syst. 1.q, 2 (Apr.), 181-9.10. ACM Transactions on Programming Languages and Systems, Vol. 16, No. 3, May 1994.

    Cited By

    View all
    • (2024)PresCount: Effective Register Allocation for Bank Conflict Reduction2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)10.1109/CGO57630.2024.10444841(170-181)Online publication date: 2-Mar-2024
    • (2024)Representing Data Collections in an SSA Form2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)10.1109/CGO57630.2024.10444817(308-321)Online publication date: 2-Mar-2024
    • (2023)rNdN: Fast Query Compilation for NVIDIA GPUsACM Transactions on Architecture and Code Optimization10.1145/360350320:3(1-25)Online publication date: 19-Jul-2023
    • Show More Cited By

    Index Terms

    1. Improvements to graph coloring register allocation

      Recommendations

      Reviews

      Rajiv Gupta

      The authors identify problems with the Chaitin-style graph coloring register allocator and propose solutions to these problems. The first problem is unnecessary spilling of values. Chaitin's allocator continues to spill values until the resulting interference graph is guaranteed to be k -colorable, where k is the number of registers. Registers may in fact be available for some of the spilled values, however. The authors develop an optimistic coloring algorithm that attempts to assign registers to values that would otherwise be spilled by Chaitin's algorithm. The second problem addressed is reducing the cost of spill code in situations where the spill code must be generated. In some situations, it is cheaper to recompute the value than to store it and retrieve it from memory. In particular, if a constant value must be spilled, it is cheaper to regenerate the value using a single immediate load instruction than to store and load the value. The authors present a technique called rematerialization to take advantage of such situations. The experimental results suggest that execution time can be reduced by up to 40 percent using optimistic coloring, and up to 20 percent improvement can result using rematerialization. A thorough comparison with Chow's priority-based register allocator [1] would have been valuable. Since Chow's algorithm does not attempt to guarantee the colorability of the interference graph through repeated spilling, it is unlikely to suffer from the problem of unnecessary spilling of values. Chow's algorithm can also benefit from the opportunities exploited through rematerialization, however. The paper is well written and provides an excellent summary of Chaitin's register allocator as well as valuable insight into the implementation of such register allocators. In addition, some problems with Chaitin's allocator are identified, and modifications that successfully address these problems are developed.

      Access critical reviews of Computing literature here

      Become a reviewer for Computing Reviews.

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Transactions on Programming Languages and Systems
      ACM Transactions on Programming Languages and Systems  Volume 16, Issue 3
      May 1994
      773 pages
      ISSN:0164-0925
      EISSN:1558-4593
      DOI:10.1145/177492
      Issue’s Table of Contents

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 01 May 1994
      Published in TOPLAS Volume 16, Issue 3

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. code generation
      2. graph coloring
      3. register allocation

      Qualifiers

      • Article

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)368
      • Downloads (Last 6 weeks)33
      Reflects downloads up to 10 Aug 2024

      Other Metrics

      Citations

      Cited By

      View all
      • (2024)PresCount: Effective Register Allocation for Bank Conflict Reduction2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)10.1109/CGO57630.2024.10444841(170-181)Online publication date: 2-Mar-2024
      • (2024)Representing Data Collections in an SSA Form2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)10.1109/CGO57630.2024.10444817(308-321)Online publication date: 2-Mar-2024
      • (2023)rNdN: Fast Query Compilation for NVIDIA GPUsACM Transactions on Architecture and Code Optimization10.1145/360350320:3(1-25)Online publication date: 19-Jul-2023
      • (2023)RL4ReAl: Reinforcement Learning for Register AllocationProceedings of the 32nd ACM SIGPLAN International Conference on Compiler Construction10.1145/3578360.3580273(133-144)Online publication date: 17-Feb-2023
      • (2023)A Sound and Complete Algorithm for Code Generation in Distance-Based ISAProceedings of the 32nd ACM SIGPLAN International Conference on Compiler Construction10.1145/3578360.3580263(73-84)Online publication date: 17-Feb-2023
      • (2023)Decomposing graphs into interval colorable subgraphs and no-wait multi-stage schedulesDiscrete Applied Mathematics10.1016/j.dam.2022.07.015335(25-35)Online publication date: Aug-2023
      • (2023)RegGuardComputers and Security10.1016/j.cose.2023.103213129:COnline publication date: 1-Jun-2023
      • (2023)BibliographyEngineering a Compiler10.1016/B978-0-12-815412-0.00023-1(793-813)Online publication date: 2023
      • (2023)Register AllocationEngineering a Compiler10.1016/B978-0-12-815412-0.00019-X(663-712)Online publication date: 2023
      • (2023)A Comparative Study of Register Allocation AlgorithmsICT Analysis and Applications10.1007/978-981-99-6568-7_3(19-28)Online publication date: 22-Dec-2023
      • Show More Cited By

      View Options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Get Access

      Login options

      Full Access

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media