Minimizing code footprint in RISC-V-based applications
Feb 4, 2022
How can you as a developer help the compiler to make better decisions? How do you work with the code to achieve the right optimizations? In this article, our Rafael Taubinger is talking about this.
An optimizing compiler tries to generate code that’s both small and fast by selecting the right instructions in the best order for execution. It does so by repeatedly applying a number of transformations to the source program. Most optimizations follow mathematical or logical rules based on a sound theoretical foundation. Other transformations are based on heuristics, where experience has shown that some transformations often result in good code or open up opportunities for further optimization.
So, the way you write your source code can determine whether an optimization can be applied to your program or not. Sometimes small changes in the source code could significantly impact the efficiency of the code generated by the compiler.