8
Survey of the Existing Passes
While this book is about building an LLVM backend, it is important to also know what the middle end has to offer. Indeed, although you can connect an LLVM backend right after a frontend and skip all the middle-end optimizations, you realistically do not want to re-implement all the optimizations that are perfectly doable in the middle end. For instance, there is zero benefit in reimplementing your own mem2reg pass; at best your implementation will be equivalent and at worst you’ll introduce a bunch of bugs!
Sometimes it may make sense to reimplement something for your target’s specific needs or do that transformation at a lower level of intermediate representation (IR). However, you cannot make an educated decision ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access