University of Cambridge
Cambridge, CB3 0FD
Keywords: Compiler, Backend, Common Language Runtime.
We examine the issues involved in producing a backend for the GNU Compiler Collection (GCC) that targets the .NET Common Language Runtime (CLR).
We describe a simple backend, which is written in standard GCC style, and interfaces with the register transfer language (RTL) GCC intermediate representation.
We show, both quantitatively and qualitatively, how this simple .NET backend is flawed. Our quantitative analysis comes from a comparison of code speed and size for .NET executables generated by several standard compilers, along with our GCC .NET implementation. Our qualitative analysis is drawn from a consideration of function call handling, runtime support for object-orientation and language interoperability, amongst other things.
The problems arise because conversion to RTL throws away much information which could be used to enhance the .NET code generation phase. We explore several possible alternative methods of creating a GCC .NET backend, which would produce more efficient and effective .NET bytecode. These methods include using XML to preserve more semantic information for the backend, and using a stack transfer language, rather than RTL, as the GCC intermediate format.