-
Book Overview & Buying
-
Table Of Contents
LLVM Code Generation
By :
A lot of the work of a backend compiler engineer is about improving the performance of the generated code – in other words, write optimizations.
Although you could write any optimization you want from scratch, the LLVM infrastructure provides many APIs to help you in this endeavor.
This section has two goals:
Let us start with our first concept: legality!
The concept of legality is prevalent in every aspect of the work of a compiler engineer. The question you should ask yourself when coming up with new optimization is: Is this legal? In other words, does this optimization preserve the semantics of the program?
If the answer is yes, great – you only have to worry about the profitability aspect described in the next section!
If the answer is no, think about what you need to prove to...