skip to main content
article
Open Access

A simple interprocedural register allocation algorithm and its effectiveness for LISP

Published:01 January 1989Publication History
Skip Abstract Section

Abstract

Register allocation is an important optimization in many compilers, but with per-procedure register allocation, it is often not possible to make good use of a large register set. Procedure calls limit the improvement from global register allocation, since they force variables allocated to registers to be saved and restored. This limitation is more pronounced in LISP programs due to the higher frequency of procedure calls. An interprocedural register allocation algorithm is developed by simplifying a version of interprocedural graph coloring. The simplification corresponds to a bottom-up coloring of the interference graph. The scheme is evaluated using a number of LISP programs. The evaluation considers the scheme's limitations and compares these “software register windows” against the hardware register windows used in the Berkeley RISC and SPUR processors.

References

  1. 1 AHO, A., HOPCROFT, J., AND ULLMAN, J. Data Structures and Algorithms. Addison-Wesley, Reading, Mass., 1983. Google ScholarGoogle Scholar
  2. 2 AHO, A., SETHI, R., AND ULLMAN, J. Compilers: Principles, Techniques, and Tools. Addison- Wesley, Reading, Mass., 1986. Google ScholarGoogle Scholar
  3. 3 BASART, E., AND FOLGER, D. RIDGE 32 Architecture--A RISC Variation. In Proceedings of the International Conference on Computer Design VLS! in Computers (Port Chester, N.Y., Oct., 1983). IEEE, New york, 1983.Google ScholarGoogle Scholar
  4. 4 BATALI, J., GOODHUE, E., HANSON, C., SHROBE, H., STALLMAN, R., AND SUSSMAN, G. The SCHEME-81 architecture--System and chip. In Proceedings of the 1982 Con{erence on Advanced Research in VLSI (Boston, Mass., Jan. 1982). MIT, Cambridge, Mass., 1982, pp. 69-77.Google ScholarGoogle Scholar
  5. 5 BAWDEN, A., GREENBLATT, R., HOLLOWAY, J., KNIGHT, T., MOON, D., AND WEINREB, D. LISP machine progress report. Tech. Rep. Memo 444, MIT Artificial Intelligence Laboratory, Cambridge, Mass., Aug. 1977.Google ScholarGoogle Scholar
  6. 6 BERENBAUM, A., DITZEL, D., AND MCLELLAN, H. Architectural innovations in the CRISP microprocessor. In Spring 1987 COMPCON Digest of Papers (San Francisco, Calif., Feb. 1987). IEEE, New York, 1987, pp. 91-95.Google ScholarGoogle Scholar
  7. 7 CHAITIN, G. Register allocation and spilling via graph coloring. In Proceedings of the SIGPLAN 82 Symposium on Compiler Construction (Boston, Mass., June 1982). ACM, New York, 1982, pp. 98-105. Google ScholarGoogle Scholar
  8. 8 CHARNIAK, E., RIESBECK, C. K., AND MCDERMOTT, D.V. Artificial Intelligence Programming. Erlbaum, Hillsdale, N.J., 1980. Google ScholarGoogle Scholar
  9. 9 CHOW, F. A portable machine-independent global optimizer--Design and measurements. Tech. Note 83-254, Ph.D. thesis, Computer Systems Lab., Stanford Univ., Stanford, Calif., Dec. 1983. Google ScholarGoogle Scholar
  10. 10 CHOW, F. Minimizing register usage penalty at procedure calls. In Proceedings of the SIGPLAN 88 Conference on Programming Language Design and Implementation (Atlanta, Ga., June 1988). ACM, New York, 1988, pp. 85-94. Google ScholarGoogle Scholar
  11. 11 CHOW, F., HIMELSTEIN, M., KILLIAN, E., AND WEBER, L. Engineering a RISC compiler system. In Spring 1986 COMPCON Digest of Papers (San Francisco, Calif., Mar. 1986). IEEE, New York, 1986, pp. 132-137.Google ScholarGoogle Scholar
  12. 12 CHOW, F. C., AND HENNESSY, J.L. Register allocation by priority-based coloring. In Proceedings of the SIGPLAN 84 Symposium on Compiler Construction (Montreal, June 1984). ACM, New York, 1984, pp. 222-232. Google ScholarGoogle Scholar
  13. 13 CHOW, P. MIPS-X instruction set and programmer's manual. Tech. Rep. CSL-86-289, Stanford, Calif., May 1986. Google ScholarGoogle Scholar
  14. 14 COOPER, K., KENNEDY, K., AND TORCZON, L. Interprocedural optimization: Eliminating unnecessary recompilation. In Proceedings of the SIGPLAN 86 Symposium on Compiler Construction (Palo Alto, Calif., June 1986). ACM, New York, 1986, pp. 58-67. Google ScholarGoogle Scholar
  15. 15 COUTANT, D., HAMMOND, C., AND KELLY, W. Compilers for the new generation of Hewlett- Packard computers. Hewlett-Packard J. I (Jan. 1986), 4-18.Google ScholarGoogle Scholar
  16. 16 DITZEL, D., MCLELLAN, H., AND BERENBAUM, A. Design tradeoffs to support the C programruing language in the CRISP microprocessor. In Proceedings of the 2nd International Conference on Architectural Support for Programming Languages and Operating Systems (Palo Alto, Calif., Oct. 1987). ACM, New York, 1987, pp. 158-163. (Also published in Comput. Arch. News 15, 5.) Google ScholarGoogle Scholar
  17. 17 DITZEL, D. R., AND MCLELLAN, H.R. Register allocation for free: The C machine stack cache. In Proceedings of the SIGARCH/SIGPLAN Symposium on Architectural Support for Programming Languages and Operating Systems (Palo Alto, Calif., Mar. 1982). ACM, New York, 1982, pp. 48- 56. (Also published in Comput. Arch. News 10, 2.) Google ScholarGoogle Scholar
  18. 18 FISCHER, C. N., AND LEBLANC, R.J. Crafting a Compiler. Benjamin/Cummings, Menlo Park, Calif., 1988. Google ScholarGoogle Scholar
  19. 19 FLYNN, M., MITCHELL, C., AND MULDER, H. And now a case for more complex instruction sets. Computer 20, 9 (Sept. 1987), 71-83. Google ScholarGoogle Scholar
  20. 20 GABRIEL, R.P. Computer Syster~s Series. Performance and Evaluation o{ LISP Systems. MIT Press, Cambridge, Mass., 1985. Google ScholarGoogle Scholar
  21. 21 GRISS, M. L., AND HEARN, A.C. A portable LISP compiler. Softw. Pract. Exper. 11, 6 (June 1981), 541-605.Google ScholarGoogle Scholar
  22. 22 GRISS, M. L., BENSON, E., AND HEARN, A.C. Current status of a portable LISP compiler. In Proceedings of the SIGPLAN 82 Symposium on Compiler Construction (Boston, Mass., June 1982). ACM, New York, 1982, pp. 276-283. Google ScholarGoogle Scholar
  23. 23 GRISS, M. L., BENSON, E., AND MAGUIRE, G.Q. PSL: A Portable LISP System. In Proceedings of the 1982 Symposium on LISP and Functional Programming (Pittsburgh, Pa., Aug. 1982). ACM, New York, 1982, pp. 88-97. Google ScholarGoogle Scholar
  24. 24 HAUCK, E., AND DENT, B. Burroughs' B6500/B7500 stack mechanism. In Computer Structures: Principles and Examples. D. Siewiorek, C. Bell, and A. Newell, Eds., McGraw-Hill, New York, 1982, chap. 16, pp. 244-259.Google ScholarGoogle Scholar
  25. 25 HENNESSY, J. L., JOUPPl, N., BASKETT, F., AND GILL, J. MIPS: A VLSI processor architecture. In Proceedings of the CMU Conference on VLSI Systems and Computations (Pittsburgh, Pa., Oct. 1981). CMU, Pittsburgh, Pa., 1981, pp. 337-346.Google ScholarGoogle Scholar
  26. 26 HOROWITZ, M., HENNESSY, J., CHOW, P., GULAK, P., ACKEN, J., AGARWAL, A., CHU, C. Y., MCFARLING, S., PRZYBYLSKI, S., RICHARDSON, S., SALZ, A., SIMONI, R., STARK, D., STEENKISTE, P., TZIANC, S., AND WING, M. A 32b microprocessor with on-chip 2K byte instruction cache. In Digest 1987 International Solid-State Circuits Conference (New York, Feb. 1987). IEEE, New York, 1987, pp. 30-31.Google ScholarGoogle Scholar
  27. 27 HUGUET, M. A C-oriented register set design. Tech. Rep. CSD-850019, Computer Science Dept., UCLA, June 1985.Google ScholarGoogle Scholar
  28. 28 JOHNSSON, R. An approach to global register allocation. Ph.D. thesis, Computer Science Dept., Carnegie-Mellon Univ., Pittsburgh, Pa., Dec. 1975. Google ScholarGoogle Scholar
  29. 29 KESSLER, R., PETERSON, J., CARR, H., DUGGAN, G., KNELL, J., AND KROHNFELDT, J. EPIC-- A retargetable highly optimizing LISP compiler. In Proceedings of the SIGPLAN 86 Symposium on Compiler Construction (Palo Alto, Calif., June 1986). ACM, New York, 1986, pp. 118-130. Google ScholarGoogle Scholar
  30. 30 LAND, T., AND HUOUET, M. Reduced register saving/restoring in single-window register files. Comput. Arch. News 14, 3 (June 1986), 17-26. Google ScholarGoogle Scholar
  31. 31 LARUS, J., AND H1LFINGER, P. Register allocation in the SPUR LISP compiler. In Proceedings of the S1GPLAN 86 Symposium on Compiler Construction (Palo Alto, Calif., June 1986). ACM, New York, 1986, pp. 255-263. Google ScholarGoogle Scholar
  32. 32 LEVERETT, B. Register Allocation in Optimizing Compilers. UMI Research Press, Ann Arbor, Mich., 1981. Google ScholarGoogle Scholar
  33. 33 MOON, D.A. Architecture of the Symbolics 3600. In Proceedings of the 12th Annual International Symposium on Computer Architecture (Boston, Mass., June 1985). ACM, New York, 1985, pp. 76-83. (Also in SIGARCH Newsl. 13, 3.) Google ScholarGoogle Scholar
  34. 34 MULDER, J. Tradeoffs in processor-architecture and data-buffer design. Tech. Rep. CSL-87- 345, Ph.D. thesis, Computer Systems Lab., Stanford Univ., Stanford, Calif., Dec. 1987. Google ScholarGoogle Scholar
  35. 35 MURTAGH, T. A less dynamic register allocation scheme for Algol-like languages. In Proceedings of the lOth Annual ACM Symposium on Principles of Programming Languages (Austin, Tex., Jan. 1983). ACM, New York, 1983, pp. 283-289. Google ScholarGoogle Scholar
  36. 36 PATTERSON, D. A., AND SEQUIN, C.H. A VLSI RISC. Computer 15, 9 (Sept. 1982), 8-22.Google ScholarGoogle Scholar
  37. 37 PENDLETON, J. A design methodology for VLSI processors. Ph.D. thesis, Computer Science Div. (EECS), Un~. of California, Berkeley, Calif., Sept. 1985.Google ScholarGoogle Scholar
  38. 38 REINER, A. Cost-minimization in register assignment for retargetable compilers. Tech. Rep. CMU-CS-84-137, Carnegie-Mellon Univ., Pittsburgh, Pa., June 1985.Google ScholarGoogle Scholar
  39. 39 RICHARDSON, S., AND GANAPATHI, M. Interprocedural Observations. Stanford Univ., Stanford, Calif., Jan. 1988.Google ScholarGoogle Scholar
  40. 40 SITES, R. L. How to use 1000 registers. In Proceedings of the Caltech Conference on VLSI (Pasadena, Calif., Jan. 1979). California Institute of Technology, Pasadena, 1979, pp. 527-532.Google ScholarGoogle Scholar
  41. 41 STEELE, G., JR., AND SUSSMAN, G. The dream of a lifetime: A lazy variable extent mechanism. In Conference Record of the 1980 LISP Conference (Stanford Univ., Aug. 1980). Stanford Univ., Stanford, Calif., 1980, pp. 163-172. Google ScholarGoogle Scholar
  42. 42 STEENKISTE, P. LISP on a reduced-instruction-set processor: Characterization and optimization. Ph.D. thesis, Computer Systems Lab., Stanford Univ., Stanford, Calif., Mar. 1987. Google ScholarGoogle Scholar
  43. 43 STEENKISTE, P., AND HENNESSY, g. LISP on a reduced-instruction-set-processor. In Proceedings of the 1986 Conference on LISP and Functional Programming (Boston, Mass., Aug. 1986). ACM, New York, 1996, pp. 192-201. Google ScholarGoogle Scholar
  44. 44 STEENKISTE, P., AND HENNESSY, J. LISP on a reduced-instruction-set processor. Characterization and optimization. Computer 21, 7 (July 1988), 34-45. Google ScholarGoogle Scholar
  45. 45 TAYLOR, G. S., HILFINGER, P., LARUS, g., PATTERSON, D., AND ZORN, B. Evaluation of the SPUR Lisp architecture. In Proceedings of the 13th Annual International Symposium on Computer Architecture (Tokyo, June 1986). ACM, New York, 1986, pp. 444-452. Google ScholarGoogle Scholar
  46. 46 UNGAR, D. The design and evaluation of a high performance Smalltalk system. Tech. Rep. UCB/CSD 86/287, Ph.D. thesis, Computer Science Div. (EECS), Univ. of California, Berkeley, Mar. 1986. Google ScholarGoogle Scholar
  47. 47 UNGAR, D., BLAU, R., FOLEY, P., SAMPLES, D., AND PATTERSON, D. Architecture of SOAR: Smalltalk on a RISC. In Proceedings of the 11th Annual International Symposium on Computer Architecture (Ann Arbor, Mich., June 1984). IEEE, New York, 1984, pp. 188-197. (Also in SIGARCH Newsl. 12, 3.) Google ScholarGoogle Scholar
  48. 48 WAITE, W. Code generation. In Compiler Construction--An Advanced Course, F. Bauer, and J. Eickel, Eds. Springer-Verlag, New York, 1976, chap. 3.E, pp. 302-332. Google ScholarGoogle Scholar
  49. 49 WALL, D. Global register allocation at link time. In Proceedings o{ the SIGPLAN 86 Symposium on Compiler Construction (Palo Alto, June 1986). ACM, New York, 1986, pp. 264-275. Google ScholarGoogle Scholar
  50. 50 WALL, D. Register windows vs. register allocation. In Proceedings of the SIGPLAN 88 Conference on Programming Language Design and Implementation (Atlanta, Ga., June 1988). ACM, New York, 1988. Google ScholarGoogle Scholar
  51. 51 WILCOX, T. Generating machine code for high-level programming languages. Ph.D. thesis, Dept. of Computer Science, Cornell Univ., Ithaca, N.Y., Sept. 1971. Google ScholarGoogle Scholar
  52. 52 WINSTON, P., AND HORN, B. Lisp. Addison-Wesley, Reading, Mass., 1981. Google ScholarGoogle Scholar
  53. 53 WULF, W., JOHNSSON, g., WEINSTOCK, C., HOBBS, S., AND GESCHKE, C. Programming Languages Series. Vol. 2, The Design of an Optimizing Compiler. Elsevier, North-Holland, New York, 1975. Google ScholarGoogle Scholar

Index Terms

  1. A simple interprocedural register allocation algorithm and its effectiveness for LISP

        Recommendations

        Reviews

        Karel De Vlaminck

        As RISC processors with many registers become more important, good register allocation is vital for overall performance. LISP and Prolog, the languages most used in AI, pose special problems because they rely heavily on recursion. This implies a large number of procedure calls and thus implies requires a special approach that will enable the program to use many registers effectively. Hardware register windowing helps to solve the problem of large overheads in programs that use extensive procedure calls. The authors present a simple and effective instance of software register windowing in a clear manner and support their claims with measurements. The authors first explain why intraprocedural allocation cannot make use of the high number of registers of present-day machines for LISP programs; this explanation relies on an analysis of the Gabriel benchmarks. They give an overview of existing interprocedural register allocation and discuss the problems of doing global program analysis in a dynamic environment. The method they propose for interprocedural register allocation is to combine intraprocedural allocation for each procedure with a bottom-up allocation according to the call graph. They handle recursion by introducing nodes that consist of recursive procedure groups, thereby removing cycles in the call graph, and by using an appropriate register-saving convention. Finally, the authors compare their system with that of Wall [1,2] and with hardware schemes.

        Access critical reviews of Computing literature here

        Become a reviewer for Computing Reviews.

        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 11, Issue 1
          Jan. 1989
          167 pages
          ISSN:0164-0925
          EISSN:1558-4593
          DOI:10.1145/59287
          Issue’s Table of Contents

          Copyright © 1989 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 January 1989
          Published in toplas Volume 11, 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