Completeness in terms of number of redundancies identified, same as that of Kildall '73
Value expression to represent a set of equivalent expressions
Simplicity in understanding
Study of GCC APIs
Using GCC version 4.6.3
Extensive study done to gain familiarity with GCC Application Programming Interface for pass implementation using GCC source code, GCC Internals Documentation and other online resources.
Simple Algorithm for GVN
For GCC version 4.6.3
Focused on verifying correctness and completeness without regard to efficiency in the first attempt.
Current implementation handles only linear code.
Pass applied after cfg pass.
Expression pools at all program points are maintained in a custom data structure and transfer function applied over them iteratively.
After CFG pass
Dump produced by plugin (1/3)
Dump produced by plugin (2/3)
Dump produced by plugin (3/3)
GCC is a long running (about 27 years!), production quality framework, and consists of over 4 millions LOC spread over more than 35,000 files; which is a fairly difficult code base to understand.
- Attending the IITB workshop in summer 2012 got me started.
The GCC Internals Documentation, although about 700 pages in length, is considered quite sparse in terms of completeness.
- Getting help over GCC mailing list and GCC dev IRC channel, however slow in response at times, was a good experience.
Value numbering is studied in detail and multiple known algorithms for global analysis evaluated for completeness.
Familiarity with functionality of GCC as a compiler research infrastructure gained including some understanding of GCC source code.
One of the algorithms implemented as a dynamic plugin for linear code.
The complete goals of the project were not met due to over-optimistic estimate of time required for implementation. Lack of documentation and some difficulty faced in getting timely help added to the delay.
VanDrunen, T. J. 2004. Partial redundancy elimination for global value numbering.(Doctoral dissertation, Purdue University)
Gary A. Kildall. 1973. A unified approach to global program optimization.POPL '73. ACM, 194-206.
B. Alpern, M. N. Wegman, and F. K. Zadeck. 1988. Detecting equality of variables in programs. POPL '88. ACM, 1-11.
Rüthing, O., Knoop, J., & Steffen, B. 1999. Detecting equalities of variables: Combining efficiency with precision. Static Analysis, 848-848.
Karthik Gargi. 2002. A sparse algorithm for predicated global value numbering.PLDI '02. ACM, 45-56.
Gulwani, S., & Necula, G. 2004. A polynomial-time algorithm for global value numbering.Static Analysis, 703-1020.
Saleena Nabeezath, Vineeth Paleri. 2013. A Simple Algorithm for Global Value Numbering. arXiv:1303.1880.
Image on Structure of GCC slide: Compiler Pipeline, GCC Internals Course - November 2007 - Diego Novillo