Implementing the ABC-machine on M680x0 based architectures John van Groningen Abstract. To compile the functional language Clean, first code is generated for an abstract machine, the ABC machine. This ABC code is then translated to the concrete machine by a code generator. Such a code generator, which generates code for the MC68020 processor, has been designed and implemented and is described here. To generate code first the ABC instructions are divided into basic blocks. Then is determined which values are stored in registers at the start of such a basic block. Parameters and results of functions are passed in registers. Then a graph is constructed for the basic block, which represents the computations performed by this basic block. After that the code generator determines which values are stored in registers at the end of the basic block. Then the order in which this graph will be evaluated is determined using an adapted labeling algorithm. This adapted labeling algorithm determines a better evaluation order than the original labeling algorithm if some values are stored in registers at the beginning and/or end of the basic block, and can handle common subexpressions. Then intermediate code is generated from the graph. This intermediate code is very close to MC68020 machine code, but in this intermediate code an unlimited number of address and data registers may be used. While constructing the graph and generating intermediate code several optimizations are performed. Then the local register allocator changes the intermediate code of a basic block so that no more than 8 address registers and 8 data registers (the MC68020 has 8 data registers and address registers) are used. Then the intermediate code is optimized by using the postincrement and predecrement addressing modes of the MC68020 and optimizing jumps. And then from this intermediate code object code is generated for the linker. While generating this object code many very simple MC68020 specific peephole optimizations are performed. Compared to the previous (simpler) code generator computations on strict arguments and basic values (integers, reals, etc.) are done a lot faster (about 1.3 - 2.9 times as fast for some benchmarks). But computations on non strict arguments are executed only a bit faster (about 1.1 - 1.5 times as fast). Curried function applications are also executed a lot faster (about 1.8 - 2.0 times as fast), but not so much due to better code generation techniques.