High-level programming languages allow programmers to write more abstract and understandable code, while also providing better program compatibility between different systems. Compilers for high-level languages must be able to convert high-level program to machine code that can be executed on the CPU and due to high market competitiveness, the compilers must also ensure the generated code is efficient. The goal of this thesis is to add a phase of intermediate code optimisation to the compiler that was written during the Compilers course for prev programming language, and then measure execution time improvement. In this thesis we look at the different intermediate representations used in modern compilers and compare the optimisations performed by two of the most popular compilers for the C programming language. We have enhanced the compiler by adding a middle-end, which executes a series of optimisations on Appel's tree intermediate representations. In the thesis, we also explain how these optimisations are implemented. The implemented compiler was tested using multiple benchmarks, then the execution times were measured, which confirmed that the optimized programs do in fact, run faster than non-optimized ones.
|