Abstract
Although there are many register allocation algorithms that work well, it can be difficult to correctly implement these algorithms. As a result, it is common for bugs to remain in the register allocator, even after the compiler is released. The register allocator may run, but bugs can cause it to produce incorrect output code. The output program may even execute properly on some test data, but errors can remain. In this paper, we propose novel data flow analyses to statically check that the output code from the register allocator is correct in terms of its data dependences. The approach is accurate, fast, and can identify and report error locations and types. No false alarms are produced. The paper describes our approach, called SARAC, and a tool, called ra-analyzer, that statically checks a register allocation and reports the errors it finds. The tool has an average compile-time overhead of only 8% and a modest average memory overhead of 85KB.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Benitez, M.E., Davidson, J.W.: A portable global optimizer and linker. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (June 1988)
Bernstein, D., Goldin, D.Q., et al.: Spill code minimization techniques for optimizing compilers. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (June 1989)
Bradlee, D.G., Eggers, S.J., Henry, R.R.: Integrating register allocation and instruction scheduling for RISCs. In: 4th Int’l. Conf. on Architectural Support for Programming Languages and Operating Systems (April 1991)
Briggs, P., Cooper, K.D., Torczon, L.: Improvements to graph coloring register allocation. ACM Trans. on Programming Languages and Systems 3(16), 428–455 (1994)
Briggs, P., Cooper, K.D., Torczon, L.: Rematerialization. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (June 1992)
Chaitin, G.J.: Register allocation & spilling via graph coloring. In: Symp. on Compiler Construction (June 1982)
Chow, F.C., Hennessy, J.L.: The priority-based register allocation coloring approach. ACM Trans. on Programming Languages and Systems 4(12), 501–536 (1990)
CPU 2000, benchmark. Standard Performance Evaluation Corporation (SPEC) (2000), http://www.spec.org
Davidson, J.W., Fraser, C.W.: Register allocation and exhaustive peephole optimization. Software — Practice and Experience 14(9), 857–865 (1984)
GCC, http://gcc.gnu.org/
George, L., Appel, A.W.: Iterated register coalescing. ACM Trans. on Programming Languages and Systems 3(18), 300–324 (1996)
Gupta, R., Soffa, M.L., Steele, T.: Register allocation via clique separators. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (July 1989)
Jaramillo, C.S., Gupta, R., Soffa, M.L.: Verifying optimizers through comparison checking. In: Int’l. Workshop on Compiler Optimization Meets Compiler Verification (April 2002)
Lacey, D., Jones, N.D., Wyk, E.V., Frederiksen, C.C.: Proving correctness of compiler optimizations by temporal logic. In: Symp. on Principles of Programming Languages (January 2002)
Lee, C., Potkonjak, M., Mangione-Smith, W.H.: MediaBench: a tool for evaluating and synthesizing multimedia and communications systems. In: ACM/IEEE Int’l. Symp. on Microarchitecture (1997)
Lerner, S., Millstein, T., Chambers, C.: Automatically proving the correctness of compiler optimizations. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (June 2003)
Lerner, S., Millstein, T., Rice, E., Chambers, C.: Automated soundness proofs for dataflow analyses and transformations via local rules. In: Symp. on Principles of Programming Languages (2005)
McNerney, T.M.: Verifying the correctness of compiler transformations on basic blocks using abstract interpretation. In: ACM/SIGPLAN Workshop Partial Evaluation and Semantics-Based Program Manipulation (1991)
MiBench. University of Michigan, http://www.eecs.umich.edu/mibench/
Naik, M., Palsberg, J.: Correctness of ILP-based register allocation. (unpublished manuscript), http://theory.stanford.edu/~mhn/pubs/regalloc.pdf
Necula, G.C.: Translation validation for an optimizing compiler. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (June 2000)
Necula, G.C., Lee, P.: The design and implementation of a certifying compiler. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (June 1998)
Ohori, A.: Register allocation by proof transformation. In: Degano, P. (ed.) ESOP 2003. LNCS, vol. 2618, pp. 399–413. Springer, Heidelberg (2003)
Pinter, S.S.: Register allocation with instruction scheduling: a new approach. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (June 1993)
Pnueli, A., Siegel, M.D., Singerman, E.: Translation validation. In: Steffen, B. (ed.) TACAS 1998. LNCS, vol. 1384, p. 151. Springer, Heidelberg (1998)
Poletto, M., Sarkar, V.: Linear scan register allocation. ACM Trans. on Programming Languages and Systems 5(21), 895–913 (1999)
Rinard, M.C.: Credible compilation. Technical Report MIT-LCS-TR-776, MIT (March 1999)
Santhanam, V., Odnert, D.: Register allocation across procedure and module boundaries. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (June 1990)
Smith, M.D., Holloway, G.: Machine SUIF, http://www.eecs.harvard.edu/hube/research/machsuif.html
Smith, M.D., Ramsey, N., Holloway, G.: A generalized algorithm for graph-coloring register allocation. In: ACM SIGPLAN Conf. on Programming Language Design and Implementation (June 2004)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Huang, Y., Childers, B.R., Soffa, M.L. (2006). Catching and Identifying Bugs in Register Allocation. In: Yi, K. (eds) Static Analysis. SAS 2006. Lecture Notes in Computer Science, vol 4134. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11823230_19
Download citation
DOI: https://doi.org/10.1007/11823230_19
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-37756-6
Online ISBN: 978-3-540-37758-0
eBook Packages: Computer ScienceComputer Science (R0)