Compiler Optimization

Very interesting topic! There is a dedicated lecture on this in CS241 - Foundations of Sequential Programs.

From this website, https://book.easyperf.net/perf_book, you can download the book: https://bit.ly/perf_book

todo

In the 80’s it was a lot of register allocation. So the idea of in a modern microprocessor what you’ll end of having is memory which is relatively slow and registers relatively fast. But you don’t have many registers. When you are writing code, the compiler needs to decided which values to put in registers. What the compiler ends up doing is thinking about things in a different representation in what the human thinks.

The RISC as opposed to CISC made things more complicated for the compiler because what they ended up doing is adding pipelines to the processor, which can do multiple things at the same time. This means the order of operations matters a lot. Classical compiler techniques called scheduling: moving instructions around so that the processor can keep its pipelines full instead of stalling and getting blocked.

Running time, memory use, code size is what people cares about in the embedded space.