Compiler Optimization in a Language you Can Understand

submited by
Style Pass
2024-11-17 12:00:07

I immediately thought "Sure, I know a thousand articles and videos on that". But, I quickly realized that basically almost all sources assume knowledge of compiler lingo, internals, IRs, etc. The problem is: people who use compilers (like my friend) usually don't care about any of those. They don't care about LLVM IR, or what a φ node is, or which pass and why is named loop rotation. Rather, their priorities are, in order of decreasing importance, the following: (1) the what, (2) the why, (3) the how.

What. Above all, users want to know what the compiler can and cannot do, i.e., what they need to optimize themselves and what the compiler can do on its own.

Why. After that, they may be interested in knowing why the compiler optimized their code the way it did (e.g., why it chose one instruction over another).

How. This concerns how the compiler achieves things, i.e., the compiler technology. But this is the least of people's priorities, and usually people care about that to satisfy their curiosity, not to do their job.

Leave a Comment