Summary

The LLVM IR is the middle point between the frontend and backend. It is the place where target-independent optimizations take place. In this chapter, we explored the tools for the manipulation of the LLVM IR, the assembly syntax, and how to write a custom IR code generator. Moreover, we showed how the pass interface works, how to apply optimizations, and then provided examples on how to write our own IR transform or analysis passes.

In the next chapter, we will discuss how LLVM backends work and how we can build our own backend to translate LLVM IR code to a custom architecture.

Get Getting Started with LLVM Core Libraries now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.