Skip to main content
Log in

Improving on Linear Scan Register Allocation

  • Research Article
  • Published:
International Journal of Automation and Computing Aims and scope Submit manuscript

Abstract

Register allocation is a major step for all compilers. Various register allocation algorithms have been developed over the decades. This work describes a new class of rapid register allocation algorithms and presents experimental data on their behavior. Our research encourages the avoidance of graphing and graph-coloring based on the fact that precise graph-coloring is nondeterministic polynomial time-complete (NP-complete), which is not suitable for real-time tasks. In addition, practical graph-coloring algorithms tend to use polynomial-time heuristics. In dynamic compilation environments, their super linear complexity makes them unsuitable for register allocation and code generation. Existing tools for code generation and register allocation do not completely fulfill the require- ments of fast compilation. Existing approaches either do not allow for the optimization of register allocation to be achieved compre- hensively with a sufficient degree of performance or they require an unjustifiable amount of time and/or resources. Therefore, we pro- pose a new class of register allocation and code generation algorithms that can be performed in linear time. These algorithms are based on the mathematical foundations of abstract interpretation and the computation of the level of abstraction. They have been implemen- ted in a specialized library for just-in-time compilation. The specialization of this library involves the execution of common intermedi- ate language (CIL) and low level virtual machine (LLVM) with a focus on embedded systems.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. D. D. Niu, L. Liu, X. Zhang, S. Lü, Z. Li. Security analysis model, system architecture and relational model of enterprise cloud services. International Journal of Automation and Computing, vol. 13, no. 6, pp. 574–584, 2016. DOI: 10.1007/s11633-016-1014-2.

    Article  Google Scholar 

  2. R. Odaira, T. Nakaike, T. Inagaki, H. Komatsu, T. Nakatani. Coloring-based coalescing for graph coloring register allocation. In Proceedings of the 8th Annual IEEE/ACM International Symposium on Code Generation and Optimization, ACM, Toronto, Canada, pp. 160–169, 2010.

    Google Scholar 

  3. Q. Liang, Y. Z. Wang, Y. H. Zhang. Resource virtualization model using hybrid-graph representation and converging algorithm for cloud computing. International Journal of Automation and Computing, vol. 10, no. 6, pp. 597–606, 2013. DOI: 10.1007/s11633-013-0758-1.

    Article  Google Scholar 

  4. K. Kononenko. Libjit linear scan: A model for fast and efficient compilation. International Review on Modelling & Simulations, vol. 3, no. 5, pp. 1035–1044, 2010.

    Google Scholar 

  5. K. Kononenko. A unified approach to identifying and healing vulnerabilities in x86 machine code. In Proceedings of the 18th Annual International Conference on Mobile Computing and Networking, ACM, Istanbul, Turkey, pp. 397–398, 2012.

    Google Scholar 

  6. F. P. Miller, A. F. Vandome, J. McBrewster. Mono (Software): MonoDevelop, Software Patents and Free Software, Novell, Comparison of Application Virtual Machines, DotGNU, Portable. NET, NET Framework, … Free and Open Source Software, Ximian. Alpha Press, 2009.

    Google Scholar 

  7. M. Pandey, S. Sarda. LLVM Cookbook. Birmingham, UK: Packt Publishing, 2015.

    Google Scholar 

  8. J. Z. Zhao, S. Nagarakatte, M. M. K. Martin, S. Zdancewic. Formal verification of SSA-based optimizations for LLVM. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation, ACM, Seattle, USA, pp. 175–186, 2013.

    Chapter  Google Scholar 

  9. M. D. Smith, N. Ramsey, G. Holloway. A generalized algorithm for graph-coloring register allocation. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation, ACM, Seattle, USA, pp. 277–288, 2004.

    Google Scholar 

  10. J. Cocke, J. Markstein. Measurement of code improvement algorithms. In Proceedings of the IFIP Congress, Tokyo, Japan, pp. 221–228, 1980.

    Google Scholar 

  11. A. P. Ershov. Alpha-an automatic programming system of high efficiency. ALGOL Bull, France. pp. 19–27, 1965.

    Google Scholar 

  12. J. R. Schwartz. On programming: An interim report on the SETL project. Installment I: Generalities; Installment II: The SETL Language and Examples of Its Use, Technical Report COO-3077-94, New York University, New York, USA, 1975.

    Google Scholar 

  13. G. J. Chaitin, M. A. Auslander, A. K. Chandra, J. Cocke, M. E. Hopkins, P. W. Markstein. Register allocation via coloring. Computer Languages, vol. 6, no. 1, pp. 47–57, 1981. DOI: 10.1016/0096-0551(81)90048-5.

    Article  Google Scholar 

  14. G. Chaitin. Register allocation and spilling via graph coloring. ACM SIGPLAN Notices, vol. 39, no. 4, pp. 66–74, 2004. DOI: 10.1145/989393.989403.

    Article  MathSciNet  Google Scholar 

  15. F. C. Chow, J. L. Hennessy. The priority-based coloring approach to register allocation. ACM Transactions on Programming Languages and Systems, vol. 12, no. 4, pp. 501–536, 1990. DOI: 10.1145/88616.88621.

    Article  Google Scholar 

  16. F. Rastello, B. Diouf, A. Cohen. A polynomial spilling heuristic: Layered allocation. In Proceedings of IEEE/ACM International Symposium on Code Generation and Optimization, IEEE, Washington DC, USA, pp. 1–10, 2013.

    Google Scholar 

  17. P. K. Krause. Optimal register allocation in polynomial time. In Proceedings of International Conference on Compiler Construction, Rome, Italy, pp. 1–20, 2013.

    Google Scholar 

  18. P. K. Krause. The complexity of register allocation. Discrete Applied Mathematics, vol. 168, pp. 51–59, 2014. DOI: 10.1016/j.dam.2013.03.015.

    Article  MathSciNet  MATH  Google Scholar 

  19. R. C. Lozano, M. Carlsson, F. Drejhammar, C. Schulte. Constraint-based register allocation and instruction scheduling. In Proceedings of the 18th international conference on Principles and Practice of Constraint Programming, Quebec City, Canada, pp. 750–766, 2012.

    Chapter  Google Scholar 

  20. V. Sarkar, R. Barik. Extended linear scan: An alternate foundation for global register allocation. In Proceedings of the 16th International Conference on Compiler Construction, Springer-Verlag, Braga, Portugal, pp. 141–155, 2007.

    Chapter  Google Scholar 

  21. O. Traub, G. Holloway, M. D. Smith. Quality and speed in linear-scan register allocation. In Proceedings of ACM SIGPLAN Conference on Programming Language Design and Implementation, ACM, Montreal, Canada, pp. 142–151, 1998.

    Google Scholar 

  22. C. Wimmer, M. Franz. Linear scan register allocation on SSA form. In Proceedings of the 8th Annual IEEE/ACM International Symposium on Code Generation and Optimization, ACM, Toronto, Canada, pp. 170–179, 2010.

    Google Scholar 

  23. G. Calinescu, M. M. Li. Register loading via linear programming. Algorithmica, vol. 72, no. 4, pp. 1011–1032, 2015. DOI: 10.1007/s00453-014-9888-2.

    Article  MathSciNet  MATH  Google Scholar 

  24. I. H. R. Jiang, G. J. Nam, H. Y. Chang, S. R. Nassif, J. Hayes. Smart grid load balancing techniques via simultaneous switch/tie-line/wire configurations. In Proceedings of IEEE/ACM International Conference on Computer-aided Design, IEEE, San Jose, pp. 382–388, 2014.

    Google Scholar 

  25. F. M. Quintão Pereira, J. Palsberg. Register allocation by puzzle solving. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation, ACM, Tucson, USA, pp. 216–226, 2008.

    Google Scholar 

  26. F. M. Quintão Pereira. Register alocation by puzzle solving, Ph. D. dissertation, University of California, USA, 2008.

    Google Scholar 

  27. R. Barik, J. S. Zhao, V. Sarkar. A decoupled non-SSA global register allocation using bipartite liveness graphs. ACM Transactions on Architecture and Code Optimization, vol. 10, no. 4, Article number 63, 2013.

    Google Scholar 

  28. Q. Colombet, B. Boissinot, P. Brisk, S. Hack, F. Rastello. Graph-coloring and treescan register allocation using repairing. In Proceedings of the 14th International Conference on Compilers, Architectures and Synthesis for Embedded Systems, ACM, Taipei, Taiwan, China, pp. 45–54, 2011.

    Google Scholar 

  29. H. B. Rong. Tree register allocation. In Proceedings of the 42nd Annual IEEE/ACM International Symposium on Microarchitecture, ACM, New York, USA, pp. 67–77, 2009.

    Google Scholar 

  30. J. Eisl. Trace register allocation. In Proceedings of ACM SIGPLAN International Conference on Systems, Programming, Languages and Applications: Software for Humanity, ACM, Pittsburgh, USA, pp. 21–23, 2015.

    Google Scholar 

  31. D. Callahan, B. Koblenz. Register allocation via hierarchical graph coloring. In Proceedings of ACM SIGPLAN Conference on Programming Language Design and Implementation, ACM, Toronto, Canada, pp. 192–203, 1991.

    Google Scholar 

  32. K. D. Cooper, A. Dasgupta, J. Eckhardt. Revisiting graph coloring register allocation: A study of the Chaitin-Briggs and Callahan-Koblenz algorithms. In Proceedings of the 18th International Conference on Languages and Compilers for Parallel Computing, Hawthorne, USA, pp. 1–16, 2006.

    Google Scholar 

  33. M. Mohr, A. Grudnitsky, T. Modschiedler, L. Bauer, S. Hack, J. Henkel. Hardware acceleration for programs in SSA form. In Proceedings of International Conference on Compilers, Architectures and Synthesis for Embedded Systems, IEEE, Montreal, Canada, Article number 14, 2013.

    Google Scholar 

  34. P. K. Krause. Bytewise register allocation. In Proceedings of the 18th International Workshop on Software and Compilers for Embedded Systems, ACM, Sankt Goar, Germany, pp. 22–27, 2015.

    Chapter  Google Scholar 

  35. F. Bouchez. A Study of Spilling and Coalescing in Register Allocation as Two Separate Phases, Ph. D. dissertation, Ecole Normale supérieure de Lyon, Lyon, France, 2009.

    Google Scholar 

  36. S. Hack, Register allocation for programs in SSA form, Ph. D. dissertation, University of Karlsruhe, Germany, 2007.

    MATH  Google Scholar 

  37. B. Boissinot, F. Brandner, A. Darte, B. D. de Dinechin, F. Rastello. A non-iterative data-flow algorithm for computing liveness sets in strict SSA programs. In Proceedings of the 9th Asian Conference on Programming Languages and Systems, Kenting, Taiwan, China, pp. 137–154, 2011.

    Chapter  Google Scholar 

  38. Q. Colombet, F. Brandner, A. Darte. Studying optimal spilling in the light of SSA. In Proceedings of the 14th International Conference on Compilers, Architectures and Synthesis for Embedded Systems, ACM, Taipei, Taiwan, China, pp. 25–34, 2011.

    Google Scholar 

  39. B. Boissinot, P. Brisk, A. Darte, F. Rastello. SSI properties revisited. ACM Transactions on Embedded Computing Systems, vol. 11S, no. 1, Article number 21, 2012. DOI: 10.1145/2180887.2180898.

    Google Scholar 

  40. P. Brisk, M. Sarrafzadeh. Interference graphs for procedures in static single information form are interval graphs. In Proceedings of the 10th International Workshop on Software & Compilers for Embedded Systems, ACM, Nice, France, pp. 101–110, 2007.

    Google Scholar 

  41. A. F. Deon, Y. A. Menyaev. The complete set simulation of stochastic sequences without repeated and skipped elements. Journal of Universal Computer Science, vol. 22, no. 8, pp. 1023–1047, 2016.

    MathSciNet  Google Scholar 

  42. A. F. Deon, Y. A. Menyaev. Parametrical tuning of twisting generators. Journal of Computer Science, vol. 12, no. 8, pp. 363–378, 2016. DOI: 10.3844/jcssp.2016.363.378.

    Article  Google Scholar 

  43. D. E. Knuth. Art of Computer Programming, volume 2: Seminumerical Algorithms. Boston, USA: Addison-Wesley Longman Publishing Co., Inc., 1997.

    Google Scholar 

  44. P. Cousot, R. Cousot. Static determination of dynamic properties of programs. In Proceedings of the 2nd International Symposium on Programming, Dunod, France, pp. 106–130, 1976.

    Google Scholar 

  45. P. Cousot, R. Cousot. Abstract interpretation: Past, present and future. In Proceedings of Joint Meeting of the 23rd EACSL Annual Conference on Computer Science Logic and the 29th Annual ACM/IEEE Symposium on Logic in Computer Science, ACM, Vienna, Austria, Article number 2, 2014.

    Google Scholar 

  46. P. Cousot, R. Cousot, L. Mauborgne. Theories, solvers and static analysis by abstract interpretation. Journal of the ACM, vol. 59, no. 6, Article number 31, 2012. DOI: 10.1145/2395116.2395120.

    Google Scholar 

  47. J. R. Dick, K. B. Kent, J. C. Libby. A quantitative analysis of the. NET common language runtime. Journal of Systems Architecture, vol. 54, no. 7, pp. 679–696, 2008. DOI: 10.1016/j.sysarc.2007.11.004.

    Article  Google Scholar 

  48. T. Davies, C. Karlsson, H. Liu, C. Ding, Z. Z. Chen. High performance linpack benchmark: A fault tolerant implementation without checkpointing. In Proceedings of International Conference on Supercomputing, ACM, Tucson, USA, pp. 162–171, 2011.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Kirill Kononenko.

Additional information

Recommended by Associate Editor James Whidborne

Shahrzad Kananizadeh received the B. Sc. degree in cyber security from University of Tubingen, Germany. She is currently a researcher at Saarland University, Germany and works in Robert Bosch, Germany.

Her research interests include programming languages, compilers and program analysis. Her areas of expertise include computer engineering, communication engineering and telecommunications.

Kirill Kononenko is a mathematician who is interested in the theoretical and mathematical foundations of computer science. He is also interested in linguistics and foreign languages. He developed the libjit-linear-scan library for dynamic compilation. He is a member of ACM and IEEE.

His research interests include theoretical physics, stochastic processes and mathematical logic.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Kananizadeh, S., Kononenko, K. Improving on Linear Scan Register Allocation. Int. J. Autom. Comput. 15, 228–238 (2018). https://doi.org/10.1007/s11633-017-1100-0

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11633-017-1100-0

Keywords

Navigation