Author: Jonathan Richard Stone
Source: GZipped PostScript (0kb)
This thesis describes the porting of a high quality C (and C++) compiler, initially aimed at CISC machines, to an early RISC architecture. The compiler achieves portability through the combination of exhaustive peephole optimisation of a Lisp-like register-transfer language and descriptions of target machine instructions in that language.
I achieved a successful port, based on conservative solutions in several instances of bad fits between the compiler and the target machine, particularly in the area of compares and conditional jumps. This port was distributed world-wide. Further experience with this conservative port led to my developing an improved port that produces better code than the native compiler.
I encountered particularly severe difficulties with variadic functions, which were implemented in a machine-independent way that cannot work on some RISC architectures. I present a corrected implementation that functions correctly on all machines. A more fundamental problem is that there are many possible implementations of variadic functions, to which a portable compiler must be able to conform. I present an original mechanism to solve this problem, which will become part of the machine-independent infrastructure of the compiler. This method has general applicability, to both other compilers and other architectures.