next up previous contents
Next: Parsing Constructs Up: Implementation Previous: Implementation

Compiler Selection

It seemed clear from the outset that modifying an existing C compiler was the most sensible approach for implementing the qif and qint quasistatic constructs. Whereas many research languages have only one or two compiler implementations to choose from, there are a large number of C compilers which I might choose from. Criteria I was interested in included:

Source code available:
Not only should I be able to get my hands on a copy of the source code to modify, but my modifications and the compiler source code should be readily available to those who are interested, without excessive legal restrictions.
Widespread use:
If the compiler I modified was already used by a reasonably sized community, people could try out my modifications with relatively little installation effort.
Competitive performance:
If the compiler I modify is known to generate output programs with very poor performance as compared to other compilers, then any improvements obtained from the addition of support for quasistatic constructs are suspect as being artifacts of a poor base.
Profiling at run-time lends itself to the possibility of differential optimization on different platforms, hence it would be desireable for the compiler to have been ported to different platforms.
Ease of modification:
If the compiler is structured into easy to understand passes, the task of modifying it to support quasistatic constructs would be much simpler than trying to modify a monolithic program.

The compilers which were seriously evaluated were: lcc, a ANSI C compiler by Fraser & Hanson at AT&T Bell Laboratories and Princeton University []; gcc, the GNU C compiler from the Free Software Foundation []; and SUIF, the Stanford University Intermediate Format C compiler []. Candidates which were not seriously evaluated included vendor compilers and the C-to-C Translator package.gif No vendor compilers were investigated more carefully because it seemed from the start an unpromising path to pursue; the latter was not evaluated because it is relatively new; also, strictly speaking, C-to-C is in a different category in that it is only intended for use as a source-to-source compiler. Nevertheless, these candidates are included for comparisons purposes in Table gif.

Table: Comparison of candidate compilers.

Ultimately, I decided to modify the SUIF compiler. See Appendix gif for how well SUIF conforms to my criteria. In practice, SUIF has proven to be a good choice. The learning curve on using SUIF's kernel library routines to manipulate the intermediate format was high; however, learning to use them was certainly less effort than writing abstractions to operate on C abstract syntax trees myself.

next up previous contents
Next: Parsing Constructs Up: Implementation Previous: Implementation

Reinventing Computing, MIT AI Lab. Author: (Ping Huang)