Abstract
Although register allocation is critical for performance, the implementation of register allocation algorithms is difficult, due to the complexity of the algorithms and target machine architectures. It is particularly difficult to detect register allocation errors if the output code runs to completion, as bugs in the register allocator can cause the compiler to produce incorrect output code. The output code may even execute properly on some test data, but errors can remain. In this article, we propose novel data flow analyses to statically check that the value flow of the output code from the register allocator is the same as the value flow of its input code. The approach is accurate, fast, and can identify and report error locations and types. It is independent of the register allocator and uses only the input and output code of the register allocator. It can be used with different register allocators, including those that perform coalescing and rematerialization. The article describes our approach, called SARAC, and a tool that statically checks a register allocation and reports the errors and their types that it finds. The tool has an average compile-time overhead of only 8% and a modest average memory overhead of 85KB. Our techniques can be used by compiler developers during regression testing and as a command-line-enabled debugging pass for mysterious compiler behavior.
- Adl-Tabatabai, A. and Gross, T. 1993. Evicted variables and the interaction of global register allocation and symbolic debugging. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Adl-Tabatabai, A. and Gross, T. 1996. Source-Level debugging of scalar optimized code. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Barthe, G., Gregoire, B., Kunz, C., and Rezk, T. 2006. Certificate translation for optimizing compilers. In Proceedings of the 13th International Static Analysis Symposium. Google Scholar
Digital Library
- Blech, J. O. and Gregoire, B. 2008. Certifying code generation runs with Coq: A tool description. In Proceedings of the 7th International Workshop on Compiler Optimization Meets Compiler Verification.Google Scholar
- Benitez, M. E. and Davidson, J. W. 1988. A portable global optimizer and linker. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Bernstein, D., Golumbic, M., Mansour, Y., Pinter, R., Goldin, D., Krawczyk, H., and Nahshon, I. 1989. Spill code minimization techniques for optimizing compilers. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Bradlee, D. G., Eggers, S. J., and Henry, R. R. 1991. Integrating register allocation and instruction scheduling for RISCs. In Proceedings of the 4th International Conference on Architectural Support for Programming Languages and Operating Systems. Google Scholar
Digital Library
- Briggs, P., Cooper, K. D., and Torczon, L. 1992. Rematerialization. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Briggs, P., Cooper, K. D., and Torczon, L. 1994. Improvements to graph coloring register allocation. ACM Trans. Program. Lang. Syst. 3, 16, 428--455. Google Scholar
Digital Library
- Chaitin, G. J. 1982. Register allocation and spilling via graph coloring. In Proceedings of the Symposium on Compiler Construction. Google Scholar
Digital Library
- Chow, F. C. and Hennessy, J. L. 1990. The priority-based register allocation coloring approach. ACM Trans. Program. Lang. Syst. 4, 12, 501--536. Google Scholar
Digital Library
- Cooper, K. D. and Lu, J. 1997. Register promotion in C programs. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- CPU2000 benchmark. Standard Performance Evaluation Corporation (SPEC). http://www.spec.org.Google Scholar
- Davidson, J. W. and Fraser, C. W. 1984. Register allocation and exhaustive peephole optimization. Softw. Pract. Exper. 14, 9, 857--865.Google Scholar
Cross Ref
- Dor, N., Adams, S., Das, M., and Yang, Z. 2004. Software validation via scalable path-sensitive value flow analysis. In Proceedings of the International Symposium on Software Testing and Analysis. Google Scholar
Digital Library
- Dwyer, M. B. and Clarke, L. A. 1994. Data flow analysis for verifying properties of concurrent programs. In Proceedings of the ACM SIGSOFT Symposium on Foundations of Software Engineering. Google Scholar
Digital Library
- GCC. GCC homepage. http://gcc.gnu.org/.Google Scholar
- George, L. and Appel, A. W. 1996. Iterated register coalescing. ACM Trans. Program. Lang. Syst. 3, 18, 300--324. Google Scholar
Digital Library
- Gupta, R., Soffa, M. L., and Steele, T. 1989. Register allocation via clique separators. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Jaramillo, C. S., Gupta, R., and Soffa, M. L. 2002. Verifying optimizers through comparison checking. In Proceedings of the International Workshop on Compiler Optimization Meets Compiler Verification.Google Scholar
- Lee, C., Potkonjak, M., and Mangione-Smith, W. H. 1997. MediaBench: A tool for evaluating and synthesizing multimedia and communicatons systems. In Proceedings of the ACM/IEEE International Symposium on Microarchitecture. Google Scholar
Digital Library
- Lee, K. D. 2003. A formally verified register allocation framework. Electron. Not. Theor. Comput. Sci. 82, 3.Google Scholar
- Lerner, S., Millstein, T., and Chambers, C. 2003. Automatically proving the correctness of compiler optimizations. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Lerner, S., Millstein, T., Rice, E., and Chambers, C. 2005. Automated soundness proofs for dataflow analyses and transformations via local rules. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Leroy, X. 2006. Formal certification of a compiler back-end or: Programming a compiler with a proof assistant. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Li, G., Owens, S., and Slind, K. 2007. Structure of a proof-producing compiler for a subset of higher order logic. In Proceedings of the 16th European Symposium on Programming (ESOP'07). Lecture Notes in Computer Science, vol. 4421. Springer, 205--219. Google Scholar
Digital Library
- McNerney, T. M. 1991. Verifying the correctness of compiler transformations on basic blocks using abstract interpretation. In Proceedings of the ACM/SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation. Google Scholar
Digital Library
- MiBench. University of Michigan. http://www.eecs.umich.edu/mibench/.Google Scholar
- Nandivada, V. K., Pereira, F. M. Q., and Palsberg, J. 2007. A framework for end-to-end verification and evaluation of register allocators. In Proceedings of the 14th International Static Analysis Symposium. Google Scholar
Digital Library
- Necula, G. C. 2000. Translation validation for an optimizing compiler. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Necula, G. C. and Lee, P. 1998. The design and implementation of a certifying compiler. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Pereira, F. M. Q. 2006. Static validation of register allocation. http://compilers.cs.ucla.edu/ralf/publications/Pereira06b-tech-report.pdf.Google Scholar
- Pinter, S. S. 1993. Register allocation with instruction scheduling: A new approach. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Pnueli, A., Siegel, M., and Singerman, F. 1998. Translation validation. In Proceedings of the 4th Conference on Tools and Algorithms for Construction and Analysis of Systems. Google Scholar
Digital Library
- Poletto, M. and Sarkar, V. 1999. Linear scan register allocation. ACM Trans. Program. Lang. Syst. 5, 21, 895--913. Google Scholar
Digital Library
- Rinard, M. C. 1999. Credible compilation. Tech. rep. MIT-LCS-TR-776, Massachusetts Institute of Technology. March.Google Scholar
- Rival, X. 2004. Symbolic transfer function-based approaches to certified compilation. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Santhanam, V. and Odnert, D. 1990. Register allocation across procedure and module boundaries. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Smith, M. D. and Holloway, G. Machine SUIF. http://www.eecs.harvard.edu/hube/research/machsuif.html.Google Scholar
- Smith, M. D., Ramsey, N., and Holloway, G. 2004. A generalized algorithm for graph-coloring register allocation. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Steffen, B., Knoop, J., and Ruthing, O. 1990. The value flow graph: A program representation for optimal program transformations. In Proceedings of the 3rd European Symposium on Programming (ESOP). Lecture Notes in Computer Science, vol. 432. Springer, 389--405. Google Scholar
Digital Library
- Wismueller, R. 1994. Debugging of globally optimized programs using data flow analysis. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
Index Terms
Detecting bugs in register allocation
Recommendations
Differential register allocation
PLDI '05: Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementationMicro-architecture designers are very cautious about expanding the number of architected registers (also the register field), because increasing the register field adds to the code size, raises I-cache and memory pressure, complicates processor ...
Differential register allocation
Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementationMicro-architecture designers are very cautious about expanding the number of architected registers (also the register field), because increasing the register field adds to the code size, raises I-cache and memory pressure, complicates processor ...
Bytewise Register Allocation
SCOPES '15: Proceedings of the 18th International Workshop on Software and Compilers for Embedded SystemsTraditionally, variables have been considered as atoms by register allocation: Each variable was to be placed in one register, or spilt (placed in main memory) or rematerialized (recalculated as needed). Some flexibility arose from what would be ...






Comments