Browse > Article
http://dx.doi.org/10.3745/KIPSTA.2011.18A.3.109

Compiler triggered C level error check  

Zheng, Zhiwen (서울대학교 전기컴퓨터공학부)
Youn, Jong-Hee M. (강릉원주대학교 컴퓨터공학과)
Lee, Jong-Won (서울대학교 전기컴퓨터공학부)
Paek, Yun-Heung (서울대학교 전기컴퓨터공학부)
Abstract
We describe a technique for automatically proving compiler optimizations sound, meaning that their transformations are always semantics-preserving. As is well known, IR (Intermediate Representation) optimization is an important step in a compiler backend. But unfortunately, it is difficult to detect and debug the IR optimization errors for compiler developers. So, we introduce a C level error check system for detecting the correctness of these IR transformation techniques. In our system, we first create an IR-to-C converter to translate IR to C code before and after each compiler optimization phase, respectively, since our technique is based on the Memory Comparison-based Clone(MeCC) detector which is a tool of detecting semantic equivalency in C level. MeCC accepts only C codes as its input and it uses a path-sensitive semantic-based static analyzer to estimate the memory states at exit point of each procedure, and compares memory states to determine whether the procedures are equal or not. But MeCC cannot guarantee two semantic-equivalency codes always have 100% similarity or two codes with different semantics does not get the result of 100% similarity. To increase the reliability of the results, we describe a technique which comprises how to generate C codes in IR-to-C transformation phase and how to send the optimization information to MeCC to avoid the occurrence of these unexpected problems. Our methodology is illustrated by three familiar optimizations, dead code elimination, instruction scheduling and common sub-expression elimination and our experimental results show that the C level error check system is highly reliable.
Keywords
Compiler Optimization; Correctness Proofs;
Citations & Related Records
연도 인용수 순위
  • Reference
1 Bernhard Steffen, Generating dataflow analysis algorithms for model specifications, Science of Computer Programming, 21(2):115-139, 1993.   DOI   ScienceOn
2 Heejung Kim, Yungbum Jung, Sunghun Kim, Kwangkeun Yi, MeCC: Memory Comparison-based Clone Detector, ICSE 2011: The 33rd International Conference on Software Engineering, Waikiki, Honolulu, Hawaii, May 21 - 28, 2011.
3 M. Ahn, SoarGen: A user retargetable compiler in the design of embedded systems, Ph.D thesis, Seoul National University, 2009.
4 J. Guttman, J. Ramsdell, and M. Wand, VLISP: a verified implementation of Scheme, Lisp and Symbolic Compucation, 8(1-2):33-110, 1995.   DOI
5 F. Lockwood Morris, Advice on structuring compilers and proving them correct, In Conference Record of the 1st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Boston MA, January, 1973.
6 Jens Knoop, Oliver Ruthing, and Bernhard Steffen, Optimal code motion: Theory and practice. ACM Transactions on Programming Languages and Systems, 16(4):1117-1155, July, 1994.   DOI   ScienceOn
7 M. Kauffmann and R.S. Boyer, The Boyer-Moore theorem prover and its interactive enhancement, Computers and Mathematics with Applications, 29(2):27-62, 1995.   DOI   ScienceOn
8 George C. Necula, Translation validation for an optimizing compiler, In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 83-95, Vancouver, Canada, June, 2000.
9 A. Pnueli, M. Siegel, and E. Singerman, Translation validation, In Tools and Algorithms for Construction and Analysis of Systems, TACAS '98, volume 1384 of Lecture Notes in Computer Science, pages151-166, 1998.   DOI   ScienceOn
10 Martin Rinard, Credible compilation, Technical Report MIT-LCS-TR-776, Massachusetts Institute of Technology, March, 1999.